diff --git a/build/social-web/index.asset.php b/build/social-web/index.asset.php index 01e6b4278..81439f8ad 100644 --- a/build/social-web/index.asset.php +++ b/build/social-web/index.asset.php @@ -1 +1 @@ - array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-primitives', 'wp-private-apis', 'wp-url', 'wp-warning'), 'version' => 'dcd1fc89c94fc175e1b4'); + array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-private-apis', 'wp-url', 'wp-warning'), 'version' => 'be0ff2d292f0cf3f66f7'); diff --git a/build/social-web/index.js b/build/social-web/index.js index 76df6b831..77d54d16a 100644 --- a/build/social-web/index.js +++ b/build/social-web/index.js @@ -1,116 +1,115 @@ -(()=>{var e,t,n,i={252:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,a;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!==r--;)if(!e(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;for(r of t.entries())if(!e(r[1],n.get(r[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((i=t.length)!=n.length)return!1;for(r=i;0!==r--;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!==r--;)if(!Object.prototype.hasOwnProperty.call(n,a[r]))return!1;for(r=i;0!==r--;){var s=a[r];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n}},436:(e,t,n)=>{"use strict";var i=n(609),r=n.t(i,2);const a=window.wp.element,s=window.wp.components,o=window.wp.keyboardShortcuts,l=window.wp.commands,c=window.ReactJSXRuntime,u=window.wp.primitives;var d=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})}),f=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})}),m=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M18.5 5.5V8H20V5.5h2.5V4H20V1.5h-1.5V4H16v1.5h2.5zM12 4H6a2 2 0 00-2 2v12a2 2 0 002 2h12a2 2 0 002-2v-6h-1.5v6a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5h6V4z"})}),v=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{d:"M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z"})}),p=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})}),h=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})});const g=window.wp.data,b=window.wp.i18n,w=window.wp.coreData,x=window.wp.htmlEntities;var y=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"})});const _=window.wp.keycodes,j=window.wp.url;var C=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,c.jsx)(u.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"})});function S(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t{const{getEntityRecord:t}=e(w.store),n=t("root","__unstableBase");return{homeUrl:n?.home,siteTitle:!n?.name&&n?.url?(0,j.filterURLForDisplay)(n?.url):n?.name}},[]),{open:n}=(0,g.useDispatch)(l.store);return(0,c.jsx)("div",{className:"site-hub",children:(0,c.jsxs)(s.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,c.jsx)("div",{className:"site-hub__icon-container",children:(0,c.jsx)(s.Button,{__next40pxDefaultSize:!0,href:"/wp-admin/",label:(0,b.__)("Go to the Dashboard","activitypub"),className:"site-hub__icon-button",style:{transform:"scale(0.5333) translateX(-4px)",borderRadius:4},children:(0,c.jsx)(I,{className:"site-hub__icon"})})}),(0,c.jsxs)(s.__experimentalHStack,{children:[(0,c.jsx)("div",{className:"site-hub__title",children:(0,c.jsxs)(s.Button,{variant:"link",href:e,target:"_blank",children:[(0,x.decodeEntities)(t),(0,c.jsx)(s.VisuallyHidden,{as:"span",children:/* translators: accessibility text */ /* translators: accessibility text */ -(0,b.__)("(opens in a new tab)","activitypub")})]})}),(0,c.jsx)(s.__experimentalHStack,{spacing:0,expanded:!1,className:"site-hub__actions",children:(0,c.jsx)(s.Button,{size:"compact",className:"site-hub__command-button",icon:y,onClick:()=>n(),label:(0,b.__)("Open command palette","activitypub"),shortcut:_.displayShortcut.primary("k")})})]})]})})},E=[{id:"dashboard",label:(0,b.__)("Dashboard"),icon:d},{id:"followers",label:(0,b.__)("Followers"),icon:f},{id:"following",label:(0,b.__)("Following"),icon:m},{id:"interactions",label:(0,b.__)("Interactions"),icon:v}];function N({activeSection:e,onNavigate:t}){return(0,c.jsxs)("div",{className:"sidebar",children:[(0,c.jsx)(V,{}),(0,c.jsxs)("nav",{className:"nav",children:[(0,c.jsxs)(s.__experimentalHStack,{spacing:3,alignment:"flex-start",className:"sidebar-navigation__icon-title",children:[(0,c.jsx)(s.Button,{className:"sidebar-navigation__button",size:"compact",icon:(0,b.isRTL)()?p:h,href:"/wp-admin/",label:(0,b.__)("Go to the Dashboard","activitypub")}),(0,c.jsx)(s.__experimentalHeading,{className:"sidebar-navigation__title",level:1,size:20,children:(0,b.__)("Social Web","activitypub")})]}),(0,c.jsx)(s.NavigableMenu,{children:(0,c.jsx)(s.MenuGroup,{children:E.map(n=>(0,c.jsxs)(s.MenuItem,{isSelected:e===n.id,onClick:()=>t(n.id),className:"menu-item",children:[n.icon&&(0,c.jsx)(s.Icon,{icon:n.icon,size:20}),(0,c.jsx)("span",{children:n.label})]},n.id))})})]}),(0,c.jsx)("div",{className:"footer",children:(0,c.jsxs)(s.MenuGroup,{children:[(0,c.jsx)(s.MenuItem,{onClick:()=>window.open("/docs","_blank"),children:"Documentation"}),(0,c.jsx)(s.MenuItem,{onClick:()=>t("settings"),children:"Settings"})]})})]})}function F({className:e,children:t}){return(0,c.jsx)("div",{className:k("themed-surface",e),children:t})}function M({className:e,children:t}){return(0,c.jsx)("div",{className:k("panel",e),children:(0,c.jsx)(F,{children:t})})}function O({title:e,subTitle:t,badges:n,actions:i,breadcrumbs:r,hasPadding:a=!0,hasBorder:s=!1,contentWidth:o="default",children:l}){return(0,c.jsxs)("div",{className:"page",children:[(0,c.jsxs)("header",{className:k("header",{"has-border":s}),children:[r&&(0,c.jsx)("div",{className:"breadcrumbs",children:r}),(0,c.jsxs)("div",{className:"title-row",children:[(0,c.jsxs)("div",{className:"title-group",children:[(0,c.jsx)("h1",{className:"title",children:e}),n&&(0,c.jsx)("div",{className:"badges",children:n})]}),i&&(0,c.jsx)("div",{className:"actions",children:i})]}),t&&(0,c.jsx)("p",{className:"sub-title",children:t})]}),(0,c.jsx)("div",{className:k("content",{padded:a,constrained:"constrained"===o,full:"full"===o}),children:l})]})}const L=window.wp.dataControls,P=window.wp.apiFetch;var A=n.n(P);const D={setFollowers:e=>({type:"SET_FOLLOWERS",followers:e}),setFollowing:e=>({type:"SET_FOLLOWING",following:e}),setInteractions:e=>({type:"SET_INTERACTIONS",interactions:e}),setLoading:(e,t)=>({type:"SET_LOADING",resource:e,isLoading:t}),*fetchFollowers(){yield D.setLoading("followers",!0);try{const e=yield A()({path:"/activitypub/v1/followers"});yield D.setFollowers(e)}catch(e){console.error("Failed to fetch followers:",e)}finally{yield D.setLoading("followers",!1)}},*fetchFollowing(){yield D.setLoading("following",!0);try{const e=yield A()({path:"/activitypub/v1/following"});yield D.setFollowing(e)}catch(e){console.error("Failed to fetch following:",e)}finally{yield D.setLoading("following",!1)}},*fetchInteractions(){yield D.setLoading("interactions",!0);try{const e=yield A()({path:"/activitypub/v1/interactions"});yield D.setInteractions(e)}catch(e){console.error("Failed to fetch interactions:",e)}finally{yield D.setLoading("interactions",!1)}},*blockFollower(e){try{yield A()({path:`/activitypub/v1/followers/${e}/block`,method:"POST"}),yield D.fetchFollowers()}catch(e){console.error("Failed to block follower:",e)}},*removeFollower(e){try{yield A()({path:`/activitypub/v1/followers/${e}`,method:"DELETE"}),yield D.fetchFollowers()}catch(e){console.error("Failed to remove follower:",e)}}},T={followers:[],following:[],interactions:[],isLoading:{followers:!1,following:!1,interactions:!1}},B="activitypub/social-web",z=(0,g.createReduxStore)(B,{reducer:function(e=T,t){switch(t.type){case"SET_FOLLOWERS":return{...e,followers:t.followers};case"SET_FOLLOWING":return{...e,following:t.following};case"SET_INTERACTIONS":return{...e,interactions:t.interactions};case"SET_LOADING":return{...e,isLoading:{...e.isLoading,[t.resource]:t.isLoading}};default:return e}},actions:D,selectors:{getFollowers:e=>e.followers,getFollowerById:(e,t)=>e.followers.find(e=>e.id===t),getFollowing:e=>e.following,getFollowingById:(e,t)=>e.following.find(e=>e.id===t),getInteractions:e=>e.interactions,getInteractionById:(e,t)=>e.interactions.find(e=>e.id===t),isLoading:(e,t)=>e.isLoading[t],getStats:e=>({followers:e.followers.length,following:e.following.length,interactions:e.interactions.length,posts:0})},controls:L.controls});function H(e,t){const n=function(){const e=(0,g.useSelect)(e=>{const t=e(B);return{followers:t.getFollowers(),following:t.getFollowing(),interactions:t.getInteractions(),stats:t.getStats(),isLoading:{followers:t.isLoading("followers"),following:t.isLoading("following"),interactions:t.isLoading("interactions")}}},[]),{fetchFollowers:t,fetchFollowing:n,fetchInteractions:i,blockFollower:r,removeFollower:s}=(0,g.useDispatch)(B);return(0,a.useEffect)(()=>{t(),n(),i()},[]),{...e,fetchFollowers:t,fetchFollowing:n,fetchInteractions:i,blockFollower:r,removeFollower:s}}();if(!e)return{items:n,isLoading:!1};if(t){const i=(0,g.useSelect)(n=>{const i=n(B);return"followers"===e?i.getFollowerById(t):"following"===e?i.getFollowingById(t):"interactions"===e?i.getInteractionById(t):null},[e,t]);return{items:i,isLoading:n.isLoading[e]}}return{items:n[e],isLoading:n.isLoading[e]}}function R(){const{items:e}=H("followers"),{items:t}=H("following"),{items:n}=H("interactions");return(0,c.jsx)(O,{title:"Dashboard",subTitle:"Overview of your ActivityPub network",hasPadding:!0,contentWidth:"constrained",children:(0,c.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"var(--wpds-spacing-60, 24px)"},children:[(0,c.jsx)(s.Card,{children:(0,c.jsxs)(s.CardBody,{children:[(0,c.jsx)("h3",{children:"Followers"}),(0,c.jsx)("p",{style:{fontSize:"32px",margin:"8px 0"},children:e?.length||0})]})}),(0,c.jsx)(s.Card,{children:(0,c.jsxs)(s.CardBody,{children:[(0,c.jsx)("h3",{children:"Following"}),(0,c.jsx)("p",{style:{fontSize:"32px",margin:"8px 0"},children:t?.length||0})]})}),(0,c.jsx)(s.Card,{children:(0,c.jsxs)(s.CardBody,{children:[(0,c.jsx)("h3",{children:"Interactions"}),(0,c.jsx)("p",{style:{fontSize:"32px",margin:"8px 0"},children:n?.length||0})]})})]})})}(0,g.register)(z);const W=window.wp.compose;var $=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})}),q=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const G="is",K="isNot",U="isAny",Y="isNone",Z="isAll",X="isNotAll",Q="lessThan",J="greaterThan",ee="lessThanOrEqual",te="greaterThanOrEqual",ne="before",ie="after",re="beforeInc",ae="afterInc",se="contains",oe="notContains",le="startsWith",ce="between",ue="on",de="notOn",fe="inThePast",me="over",ve=[G,K,U,Y,Z,X,Q,J,ee,te,ne,ie,re,ae,se,oe,le,ce,ue,de,fe,me],pe=[G,K,Q,J,ee,te,ne,ie,re,ae,se,oe,le,ue,de],he={[G]:{key:"is-filter",label:(0,b.__)("Is")},[K]:{key:"is-not-filter",label:(0,b.__)("Is not")},[U]:{key:"is-any-filter",label:(0,b.__)("Is any")},[Y]:{key:"is-none-filter",label:(0,b.__)("Is none")},[Z]:{key:"is-all-filter",label:(0,b.__)("Is all")},[X]:{key:"is-not-all-filter",label:(0,b.__)("Is not all")},[Q]:{key:"less-than-filter",label:(0,b.__)("Less than")},[J]:{key:"greater-than-filter",label:(0,b.__)("Greater than")},[ee]:{key:"less-than-or-equal-filter",label:(0,b.__)("Less than or equal")},[te]:{key:"greater-than-or-equal-filter",label:(0,b.__)("Greater than or equal")},[ne]:{key:"before-filter",label:(0,b.__)("Before")},[ie]:{key:"after-filter",label:(0,b.__)("After")},[re]:{key:"before-inc-filter",label:(0,b.__)("Before (inc)")},[ae]:{key:"after-inc-filter",label:(0,b.__)("After (inc)")},[se]:{key:"contains-filter",label:(0,b.__)("Contains")},[oe]:{key:"not-contains-filter",label:(0,b.__)("Doesn't contain")},[le]:{key:"starts-with-filter",label:(0,b.__)("Starts with")},[ce]:{key:"between-filter",label:(0,b.__)("Between (inc)")},[ue]:{key:"on-filter",label:(0,b.__)("On")},[de]:{key:"not-on-filter",label:(0,b.__)("Not on")},[fe]:{key:"in-the-past-filter",label:(0,b.__)("In the past")},[me]:{key:"over-filter",label:(0,b.__)("Over")}},ge=["asc","desc"],be={asc:"↑",desc:"↓"},we={asc:"ascending",desc:"descending"},xe={asc:(0,b.__)("Sort ascending"),desc:(0,b.__)("Sort descending")},ye={asc:$,desc:q},_e="table",je="grid",Ce=(0,a.createContext)({view:{type:_e},onChangeView:()=>{},fields:[],data:[],paginationInfo:{totalItems:0,totalPages:0},selection:[],onChangeSelection:()=>{},setOpenedFilter:()=>{},openedFilter:null,getItemId:e=>e.id,isItemClickable:()=>!0,renderItemLink:void 0,containerWidth:0,containerRef:(0,a.createRef)(),resizeObserverRef:()=>{},defaultLayouts:{list:{},grid:{},table:{}},filters:[],isShowingFilter:!1,setIsShowingFilter:()=>{},hasInfiniteScrollHandler:!1,config:{perPageSizes:[]}});Ce.displayName="DataViewsContext";var Se=Ce,ke=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"})}),Ie=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"})}),Ve=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})}),Ee=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})});function Ne({selection:e,onChangeSelection:t,item:n,getItemId:i,titleField:r,disabled:a,...o}){const l=i(n),u=!a&&e.includes(l),d=r?.getValue?.({item:n})||(0,b.__)("(no title)");return(0,c.jsx)(s.CheckboxControl,{className:"dataviews-selection-checkbox",__nextHasNoMarginBottom:!0,"aria-label":d,"aria-disabled":a,checked:u,onChange:()=>{a||t(e.includes(l)?e.filter(e=>l!==e):[...e,l])},...o})}var Fe=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})});const Me=window.wp.privateApis,{lock:Oe,unlock:Le}=(0,Me.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/dataviews"),{Menu:Pe,kebabCase:Ae}=Le(s.privateApis);function De({action:e,onClick:t,items:n}){const i="string"==typeof e.label?e.label:e.label(n);return(0,c.jsx)(s.Button,{disabled:!!e.disabled,accessibleWhenDisabled:!0,size:"compact",onClick:t,children:i})}function Te({action:e,onClick:t,items:n}){const i="string"==typeof e.label?e.label:e.label(n);return(0,c.jsx)(Pe.Item,{disabled:e.disabled,onClick:t,children:(0,c.jsx)(Pe.ItemLabel,{children:i})})}function Be({action:e,items:t,closeModal:n}){const i="string"==typeof e.label?e.label:e.label(t),r="function"==typeof e.modalHeader?e.modalHeader(t):e.modalHeader;return(0,c.jsx)(s.Modal,{title:r||i,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:n,focusOnMount:e.modalFocusOnMount??!0,size:e.modalSize||"medium",overlayClassName:`dataviews-action-modal dataviews-action-modal__${Ae(e.id)}`,children:(0,c.jsx)(e.RenderModal,{items:t,closeModal:n})})}function ze({actions:e,item:t,registry:n,setActiveModalAction:i}){return(0,c.jsx)(Pe.Group,{children:e.map(e=>(0,c.jsx)(Te,{action:e,onClick:()=>{"RenderModal"in e?i(e):e.callback([t],{registry:n})},items:[t]},e.id))})}function He({item:e,actions:t,isCompact:n}){const i=(0,g.useRegistry)(),{primaryActions:r,eligibleActions:o}=(0,a.useMemo)(()=>{const n=t.filter(t=>!t.isEligible||t.isEligible(e));return{primaryActions:n.filter(e=>e.isPrimary),eligibleActions:n}},[t,e]);return n?(0,c.jsx)(Re,{item:e,actions:o,isSmall:!0,registry:i}):(0,c.jsxs)(s.__experimentalHStack,{spacing:0,justify:"flex-end",className:"dataviews-item-actions",style:{flexShrink:0,width:"auto"},children:[(0,c.jsx)(We,{item:e,actions:r,registry:i}),r.lengtho(null)})]})}function We({item:e,actions:t,registry:n}){const[i,r]=(0,a.useState)(null);return(0,W.useViewportMatch)("medium","<")?null:Array.isArray(t)&&0!==t.length?(0,c.jsxs)(c.Fragment,{children:[t.map(t=>(0,c.jsx)(De,{action:t,onClick:()=>{"RenderModal"in t?r(t):t.callback([e],{registry:n})},items:[e]},t.id)),!!i&&(0,c.jsx)(Be,{action:i,items:[e],closeModal:()=>r(null)})]}):null}var $e=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})});function qe({action:e,items:t,ActionTriggerComponent:n}){const[i,r]=(0,a.useState)(!1),s={action:e,onClick:()=>{r(!0)},items:t};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n,{...s}),i&&(0,c.jsx)(Be,{action:e,items:t,closeModal:()=>r(!1)})]})}function Ge(e,t){return(0,a.useMemo)(()=>e.some(e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))),[e,t])}function Ke(e,t){return(0,a.useMemo)(()=>t.some(t=>e.some(e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t)))),[e,t])}function Ue({selection:e,onChangeSelection:t,data:n,actions:i,getItemId:r}){const o=(0,a.useMemo)(()=>n.filter(e=>i.some(t=>t.supportsBulk&&(!t.isEligible||t.isEligible(e)))),[n,i]),l=n.filter(t=>e.includes(r(t))&&o.includes(t)),u=l.length===o.length;return(0,c.jsx)(s.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:u,indeterminate:!u&&!!l.length,onChange:()=>{t(u?[]:o.map(e=>r(e)))},"aria-label":u?(0,b.__)("Deselect all"):(0,b.__)("Select all")})}function Ye({action:e,onClick:t,isBusy:n,items:i}){const r="string"==typeof e.label?e.label:e.label(i);return(0,W.useViewportMatch)("medium","<")?(0,c.jsx)(s.Button,{disabled:n,accessibleWhenDisabled:!0,label:r,icon:e.icon,size:"compact",onClick:t,isBusy:n}):(0,c.jsx)(s.Button,{disabled:n,accessibleWhenDisabled:!0,size:"compact",onClick:t,isBusy:n,children:r})}const Ze=[];function Xe({action:e,selectedItems:t,actionInProgress:n,setActionInProgress:i}){const r=(0,g.useRegistry)(),s=(0,a.useMemo)(()=>t.filter(t=>!e.isEligible||e.isEligible(t)),[e,t]);return"RenderModal"in e?(0,c.jsx)(qe,{action:e,items:s,ActionTriggerComponent:Ye},e.id):(0,c.jsx)(Ye,{action:e,onClick:async()=>{i(e.id),await e.callback(t,{registry:r}),i(null)},items:s,isBusy:n===e.id},e.id)}function Qe(e,t,n,i,r,a,o,l,u){const d=a.length>0?(0,b.sprintf)( +(()=>{var e,t,n,r={162:(e,t,n)=>{"use strict";var r=n(609),i=n(888),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useSyncExternalStore,a=r.useRef,l=r.useEffect,c=r.useMemo,u=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=a(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==i&&f.hasValue){var t=f.value;if(i(t,e))return a=t}return a=e}if(t=a,o(s,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]);var h=s(e,d[0],d[1]);return l(function(){f.hasValue=!0,f.value=h},[h]),u(h),h}},242:(e,t,n)=>{"use strict";e.exports=n(162)},252:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!==i--;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((r=t.length)!=n.length)return!1;for(i=r;0!==i--;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!==i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!==i--;){var s=o[i];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n}},427:(e,t,n)=>{"use strict";var r={};n.r(r),n.d(r,{registerMenuItem:()=>uo});var i={};n.r(i),n.d(i,{getMenuItems:()=>fo});const o=window.wp.element,s=window.wp.components,a=window.ReactJSXRuntime;function l(e,t){if(!e)throw new Error("Invariant failed")}function c(e){return e[e.length-1]}function u(e,t){return function(e){return"function"==typeof e}(e)?e(t):e}const d=Object.prototype.hasOwnProperty;function f(e,t){if(e===t)return e;const n=t,r=g(e)&&g(n);if(!(r||p(e)&&p(n)))return n;const i=r?e:h(e);if(!i)return n;const o=r?n:h(n);if(!o)return n;const s=i.length,a=o.length,l=r?new Array(a):{};let c=0;for(let t=0;ti||!v(e[s],t[s],n)))return!1;return i===o}return!1}function w(e){let t,n;const r=new Promise((e,r)=>{t=e,n=r});return r.status="pending",r.resolve=n=>{r.status="resolved",r.value=n,t(n),e?.(n)},r.reject=e=>{r.status="rejected",n(e)},r}function b(e){return Boolean(e&&"object"==typeof e&&"function"==typeof e.then)}const x=Array.from(new Map([["%","%25"],["\\","%5C"],["/","%2F"],[";","%3B"],[":","%3A"],["@","%40"],["&","%26"],["=","%3D"],["+","%2B"],["$","%24"],[",","%2C"]]).values());function y(e,t=x,n=0){if(""===e||!e.match(/%[0-9A-Fa-f]{2}/g))return e;for(let r=n;r{try{return decodeURIComponent(e)}catch{return e}})}}(e)}function _(e){return S(e.filter(e=>void 0!==e).join("/"))}function S(e){return e.replace(/\/{2,}/g,"/")}function C(e){return"/"===e?e:e.replace(/^\/{1,}/,"")}function j(e){return"/"===e?e:e.replace(/\/{1,}$/,"")}function k(e){return j(C(e))}function I(e,t){return e?.endsWith("/")&&"/"!==e&&e!==`${t}/`?e.slice(0,-1):e}function M(e){const{type:t,value:n}=e;if(0===t)return n;const{prefixSegment:r,suffixSegment:i}=e;if(1===t){const e=n.substring(1);if(r&&i)return`${r}{$${e}}${i}`;if(r)return`${r}{$${e}}`;if(i)return`{$${e}}${i}`}if(3===t){const e=n.substring(1);return r&&i?`${r}{-$${e}}${i}`:r?`${r}{-$${e}}`:i?`{-$${e}}${i}`:`{-$${e}}`}if(2===t){if(r&&i)return`${r}{$}${i}`;if(r)return`${r}{$}`;if(i)return`{$}${i}`}return n}const E=(e,t)=>{if(!e)return[];const n=t?.get(e);if(n)return n;const r=function(e){const t=[];if("/"===(e=S(e)).slice(0,1)&&(e=e.substring(1),t.push({type:0,value:"/"})),!e)return t;const n=e.split("/").filter(Boolean);return t.push(...n.map(e=>{const t=e.match(O);if(t)return{type:2,value:"$",prefixSegment:t[1]||void 0,suffixSegment:t[2]||void 0};const n=e.match(V);if(n){const e=n[1];return{type:3,value:n[2],prefixSegment:e||void 0,suffixSegment:n[3]||void 0}}const r=e.match(L);if(r){const e=r[1];return{type:1,value:""+r[2],prefixSegment:e||void 0,suffixSegment:r[3]||void 0}}return P.test(e)?{type:1,value:"$"+e.substring(1),prefixSegment:void 0,suffixSegment:void 0}:N.test(e)?{type:2,value:"$",prefixSegment:void 0,suffixSegment:void 0}:{type:0,value:y(e)}})),"/"===e.slice(-1)&&(e=e.substring(1),t.push({type:0,value:"/"})),t}(e);return t?.set(e,r),r},P=/^\$.{1,}$/,L=/^(.*?)\{(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,V=/^(.*?)\{-(\$[a-zA-Z_$][a-zA-Z0-9_$]*)\}(.*)$/,N=/^\$$/,O=/^(.*?)\{\$\}(.*)$/;function R({path:e,params:t,leaveWildcards:n,leaveParams:r,decodeCharMap:i,parseCache:o}){const s=E(e,o);function a(e){const n=t[e],r="string"==typeof n;return"*"===e||"_splat"===e?r?encodeURI(n):n:r?function(e,t){let n=encodeURIComponent(e);if(t)for(const[e,r]of t)n=n.replaceAll(e,r);return n}(n,i):n}let l=!1;const c={},u=_(s.map(e=>{if(0===e.type)return e.value;if(2===e.type){c._splat=t._splat,c["*"]=t._splat;const r=e.prefixSegment||"",i=e.suffixSegment||"";if(!t._splat)return l=!0,n?`${r}${e.value}${i}`:r||i?`${r}${i}`:void 0;const o=a("_splat");return n?`${r}${e.value}${o??""}${i}`:`${r}${o}${i}`}if(1===e.type){const n=e.value.substring(1);l||n in t||(l=!0),c[n]=t[n];const i=e.prefixSegment||"",o=e.suffixSegment||"";if(r){const t=a(e.value);return`${i}${e.value}${t??""}${o}`}return`${i}${a(n)??"undefined"}${o}`}if(3===e.type){const i=e.value.substring(1),o=e.prefixSegment||"",s=e.suffixSegment||"";if(!(i in t)||null==t[i])return n?`${o}${i}${s}`:o||s?`${o}${s}`:void 0;if(c[i]=t[i],r){const t=a(e.value);return`${o}${e.value}${t??""}${s}`}return n?`${o}${i}${a(i)??""}${s}`:`${o}${a(i)??""}${s}`}return e.value}));return{usedParams:c,interpolatedPath:u,isMissingParams:l}}function F(e,t,n){const r=function(e,{to:t,fuzzy:n,caseSensitive:r},i){const o=t,s={};return function(e,t,n,r,i){let o=0,s=0;for(;oe.value)));n&&s.startsWith(n)&&(s=s.slice(n.length)),i&&s.endsWith(i)&&(s=s.slice(0,s.length-i.length)),r=s}else r=decodeURI(_(t.map(e=>e.value)));return n["*"]=r,n._splat=r,!0}if(0===l.type){if("/"===l.value&&!a?.value){s++;continue}if(a){if(i){if(l.value!==a.value)return!1}else if(l.value.toLowerCase()!==a.value.toLowerCase())return!1;o++,s++;continue}return!1}if(1===l.type){if(!a)return!1;if("/"===a.value)return!1;let e="",t=!1;if(l.prefixSegment||l.suffixSegment){const n=l.prefixSegment||"",r=l.suffixSegment||"",i=a.value;if(n&&!i.startsWith(n))return!1;if(r&&!i.endsWith(r))return!1;let o=i;n&&o.startsWith(n)&&(o=o.slice(n.length)),r&&o.endsWith(r)&&(o=o.slice(0,o.length-r.length)),e=decodeURIComponent(o),t=!0}else e=decodeURIComponent(a.value),t=!0;t&&(n[l.value.substring(1)]=e,o++),s++;continue}if(3===l.type){if(!a){s++;continue}if("/"===a.value){s++;continue}let r="",i=!1;if(l.prefixSegment||l.suffixSegment){const e=l.prefixSegment||"",t=l.suffixSegment||"",n=a.value;if((!e||n.startsWith(e))&&(!t||n.endsWith(t))){let o=n;e&&o.startsWith(e)&&(o=o.slice(e.length)),t&&o.endsWith(t)&&(o=o.slice(0,o.length-t.length)),r=decodeURIComponent(o),i=!0}}else{let n=!0;for(let r=s+1;r=t.length)return n["**"]=_(e.slice(o).map(e=>e.value)),!!r&&"/"!==t[t.length-1]?.value;if(s=e.length){for(let e=s;e{this.originalIndex=e.originalIndex;const t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=A:this.parentRoute||l(!1);let r=n?A:t?.path;r&&"/"!==r&&(r=C(r));const i=t?.id||r;let o=n?A:_([this.parentRoute.id===A?"":this.parentRoute.id,i]);r===A&&(r="/"),o!==A&&(o=_(["/",o]));const s=o===A?"/":_([this.parentRoute.fullPath,r]);this._path=r,this._id=o,this._fullPath=s,this._to=s},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),"object"==typeof e&&null!==e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class B extends D{constructor(e){super(e)}}var z=n(609),$=n.t(z,2),H=n(242);function W(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=q(e);if(n.length!==q(t).length)return!1;for(let r=0;re,n={}){const r=n.equal??W;return(0,H.useSyncExternalStoreWithSelector)(e.subscribe,()=>e.state,()=>e.state,t,r)}(n.__store,t=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const n=f(r.current,e.select(t));return r.current=n,n}return e.select(t)}return t})}const Z=z.createContext(void 0),X=z.createContext(void 0);function J(e){const t=z.useContext(e.from?X:Z),n=Y({select:n=>{const r=n.matches.find(n=>e.from?e.from===n.routeId:n.id===t);if(l(!((e.shouldThrow??1)&&!r),e.from&&e.from),void 0!==r)return e.select?e.select(r):r},structuralSharing:e.structuralSharing});return n}function Q(e){return J({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function ee(e){const{select:t,...n}=e;return J({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function te(e){return J({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=!1===e.strict?t.params:t._strictParams;return e.select?e.select(n):n}})}function ne(e){return J({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function re(e){const t=K();return z.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}const ie=window.ReactDOM,oe="undefined"!=typeof window?z.useLayoutEffect:z.useEffect;function se(e){const t=z.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}const ae={},le={className:"active"},ce={role:"link","aria-disabled":!0},ue={"data-status":"active","aria-current":"page"},de={"data-transitioning":"transitioning"},fe=new WeakMap,he={rootMargin:"100px"},pe=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}},me=z.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:i,ref:o,...s}=function(e,t){const n=K(),[r,i]=z.useState(!1),o=z.useRef(!1),s=function(e){const t=z.useRef(null);return z.useImperativeHandle(e,()=>t.current,[]),t}(t),{activeProps:a,inactiveProps:l,activeOptions:c,to:d,preload:f,preloadDelay:h,hashScrollIntoView:p,replace:m,startTransition:g,resetScroll:w,viewTransition:b,children:x,target:y,disabled:_,style:S,className:C,onClick:j,onFocus:k,onMouseEnter:M,onMouseLeave:E,onTouchStart:P,ignoreBlocker:L,params:V,search:N,hash:O,state:R,mask:F,reloadDocument:T,unsafeRelative:A,from:D,_fromLocation:B,...$}=e,H=Y({select:e=>e.location.search,structuralSharing:!0}),W=e.from,q=z.useMemo(()=>({...e,from:W}),[n,H,W,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),U=z.useMemo(()=>n.buildLocation({...q}),[n,q]),G=z.useMemo(()=>{if(_)return;let e=U.maskedLocation?U.maskedLocation.url:U.url,t=!1;return n.origin&&(e.startsWith(n.origin)?e=n.history.createHref(e.replace(n.origin,""))||"/":t=!0),{href:e,external:t}},[_,U.maskedLocation,U.url,n.origin,n.history]),Z=z.useMemo(()=>{if(G?.external)return G.href;try{return new URL(d),d}catch{}},[d,G]),X=!e.reloadDocument&&!Z&&(f??n.options.defaultPreload),J=h??n.options.defaultPreloadDelay??0,Q=Y({select:e=>{if(Z)return!1;if(c?.exact){if(t=e.location.pathname,r=U.pathname,I(t,i=n.basepath)!==I(r,i))return!1}else{const t=I(e.location.pathname,n.basepath),r=I(U.pathname,n.basepath);if(!t.startsWith(r)||t.length!==r.length&&"/"!==t[r.length])return!1}var t,r,i;return!((c?.includeSearch??1)&&!v(e.location.search,U.search,{partial:!c?.exact,ignoreUndefined:!c?.explicitUndefined})||c?.includeHash&&e.location.hash!==U.hash)}}),ee=z.useCallback(()=>{n.preloadRoute({...q}).catch(e=>{console.warn(e),console.warn("Error preloading route! ☝️")})},[n,q]);if(function(e,t,n={},r={}){z.useEffect(()=>{if(!e.current||r.disabled||"function"!=typeof IntersectionObserver)return;const i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}(s,z.useCallback(e=>{e?.isIntersecting&&ee()},[ee]),he,{disabled:!(!_&&"viewport"===X)}),z.useEffect(()=>{o.current||_||"render"!==X||(ee(),o.current=!0)},[_,ee,X]),Z)return{...$,ref:s,href:Z,...x&&{children:x},...y&&{target:y},..._&&{disabled:_},...S&&{style:S},...C&&{className:C},...j&&{onClick:j},...k&&{onFocus:k},...M&&{onMouseEnter:M},...E&&{onMouseLeave:E},...P&&{onTouchStart:P}};const te=e=>{_||X&&ee()},ne=te,re=Q?u(a,{})??le:ae,oe=Q?ae:u(l,{})??ae,se=[C,re.className,oe.className].filter(Boolean).join(" "),me=(S||re.style||oe.style)&&{...S,...re.style,...oe.style};return{...$,...re,...oe,href:G?.href,ref:s,onClick:pe([j,e=>{const t=e.currentTarget.getAttribute("target"),r=void 0!==y?y:t;if(!(_||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||e.defaultPrevented||r&&"_self"!==r||0!==e.button)){e.preventDefault(),(0,ie.flushSync)(()=>{i(!0)});const t=n.subscribe("onResolved",()=>{t(),i(!1)});n.navigate({...q,replace:m,resetScroll:w,hashScrollIntoView:p,startTransition:g,viewTransition:b,ignoreBlocker:L})}}]),onFocus:pe([k,te]),onMouseEnter:pe([M,e=>{if(!_&&X)if(J){const t=e.target;if(fe.has(t))return;const n=setTimeout(()=>{fe.delete(t),ee()},J);fe.set(t,n)}else ee()}]),onMouseLeave:pe([E,e=>{if(_||!X||!J)return;const t=e.target,n=fe.get(t);n&&(clearTimeout(n),fe.delete(t))}]),onTouchStart:pe([P,ne]),disabled:!!_,target:y,...me&&{style:me},...se&&{className:se},..._&&ce,...Q&&ue,...r&&de}}(r,t),a="function"==typeof r.children?r.children({isActive:"active"===s["data-status"]}):r.children;return void 0===n&&delete s.disabled,z.createElement(n||"a",{...s,ref:o},a)});class ge extends D{constructor(e){super(e),this.useMatch=e=>J({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>J({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ne({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>te({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ee({...e,from:this.id}),this.useLoaderData=e=>Q({...e,from:this.id}),this.useNavigate=()=>re({from:this.fullPath}),this.Link=z.forwardRef((e,t)=>(0,a.jsx)(me,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}function ve(e){return new ge(e)}class we extends B{constructor(e){super(e),this.useMatch=e=>J({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>J({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ne({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>te({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ee({...e,from:this.id}),this.useLoaderData=e=>Q({...e,from:this.id}),this.useNavigate=()=>re({from:this.fullPath}),this.Link=z.forwardRef((e,t)=>(0,a.jsx)(me,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for("react.memo")}}const be="__TSR_index",xe="popstate",ye="beforeunload";function _e(e,t){t||(t={});const n=je();return{...t,key:n,__TSR_key:n,[be]:e}}function Se(e){const t=e?.window??("undefined"!=typeof document?window:void 0),n=t.history.pushState,r=t.history.replaceState;let i=[];const o=()=>i,s=e?.createHref??(e=>e),a=e?.parseLocation??(()=>Ce(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const e=je();t.history.replaceState({[be]:0,key:e,__TSR_key:e},"")}let l,c,u,d=a(),f=!1,h=!1,p=!1,m=!1;const g=()=>{c&&(y._ignoreSubscribers=!0,(c.isPush?t.history.pushState:t.history.replaceState)(c.state,"",c.href),y._ignoreSubscribers=!1,c=void 0,u=void 0,l=void 0)},v=(e,t,n)=>{const r=s(t);u||(l=d),d=Ce(t,n),c={href:r,state:n,isPush:c?.isPush||"push"===e},u||(u=Promise.resolve().then(()=>g()))},w=e=>{d=a(),y.notify({type:e})},b=async()=>{if(h)return void(h=!1);const e=a(),n=e.state[be]-d.state[be],r=-1===n,i=!(1===n)&&!r||f;f=!1;const s=i?"GO":r?"BACK":"FORWARD",l=i?{type:"GO",index:n}:{type:r?"BACK":"FORWARD"};if(p)p=!1;else{const n=o();if("undefined"!=typeof document&&n.length)for(const r of n)if(await r.blockerFn({currentLocation:d,nextLocation:e,action:s}))return h=!0,t.history.go(1),void y.notify(l)}d=a(),y.notify(l)},x=e=>{if(m)return void(m=!1);let t=!1;const n=o();if("undefined"!=typeof document&&n.length)for(const e of n){const n=e.enableBeforeUnload??!0;if(!0===n){t=!0;break}if("function"==typeof n&&!0===n()){t=!0;break}}return t?(e.preventDefault(),e.returnValue=""):void 0},y=function(e){let t=e.getLocation();const n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??1?r(n):t=e.getLocation()},o=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker)return void n();const o=e.getBlockers?.()??[],s="PUSH"===i.type||"REPLACE"===i.type;if("undefined"!=typeof document&&o.length&&s)for(const n of o){const r=Ce(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type}))return void e.onBlocked?.()}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,s)=>{const a=t.state[be];i=_e(a+1,i),o({task:()=>{e.pushState(n,i),r({type:"PUSH"})},navigateOpts:s,type:"PUSH",path:n,state:i})},replace:(n,i,s)=>{const a=t.state[be];i=_e(a,i),o({task:()=>{e.replaceState(n,i),r({type:"REPLACE"})},navigateOpts:s,type:"REPLACE",path:n,state:i})},go:(t,n)=>{o({task:()=>{e.go(t),i({type:"GO",index:t})},navigateOpts:n,type:"GO"})},back:t=>{o({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:"BACK"})},navigateOpts:t,type:"BACK"})},forward:t=>{o({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:"FORWARD"})},navigateOpts:t,type:"FORWARD"})},canGoBack:()=>0!==t.state[be],createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};const n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{const n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}({getLocation:()=>d,getLength:()=>t.history.length,pushState:(e,t)=>v("push",e,t),replaceState:(e,t)=>v("replace",e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{f=!0,t.history.go(e)},createHref:e=>s(e),flush:g,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(ye,x,{capture:!0}),t.removeEventListener(xe,b)},onBlocked:()=>{l&&d!==l&&(d=l)},getBlockers:o,setBlockers:e=>i=e,notifyOnIndexChange:!1});return t.addEventListener(ye,x,{capture:!0}),t.addEventListener(xe,b),t.history.pushState=function(...e){const r=n.apply(t.history,e);return y._ignoreSubscribers||w("PUSH"),r},t.history.replaceState=function(...e){const n=r.apply(t.history,e);return y._ignoreSubscribers||w("REPLACE"),n},y}function Ce(e,t){const n=e.indexOf("#"),r=e.indexOf("?"),i=je();return{href:e,pathname:e.substring(0,n>0?r>0?Math.min(n,r):n:r>0?r:e.length),hash:n>-1?e.substring(n):"",search:r>-1?e.slice(r,-1===n?void 0:n):"",state:t||{[be]:0,key:i,__TSR_key:i}}}function je(){return(Math.random()+1).toString(36).substring(7)}const ke=new WeakMap,Ie=new WeakMap,Me={current:[]};let Ee=!1,Pe=0;const Le=new Set,Ve=new Map;function Ne(e){for(const t of e){if(Me.current.includes(t))continue;Me.current.push(t),t.recompute();const e=Ie.get(t);if(e)for(const t of e){const e=ke.get(t);(null==e?void 0:e.length)&&Ne(e)}}}function Oe(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Re(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Fe(e){if(Pe>0&&!Ve.has(e)&&Ve.set(e,e.prevState),Le.add(e),!(Pe>0||Ee))try{for(Ee=!0;Le.size>0;){const e=Array.from(Le);Le.clear();for(const t of e){const e=Ve.get(t)??t.prevState;t.prevState=e,Oe(t)}for(const t of e){const e=ke.get(t);e&&(Me.current.push(t),Ne(e))}for(const t of e){const e=ke.get(t);if(e)for(const t of e)Re(t)}}}finally{Ee=!1,Me.current=[],Ve.clear()}}function Te(e){Pe++;try{e()}finally{if(Pe--,0===Pe){const e=Le.values().next().value;e&&Fe(e)}}}class Ae{constructor(e,t){this.listeners=new Set,this.subscribe=e=>{var t,n;this.listeners.add(e);const r=null==(n=null==(t=this.options)?void 0:t.onSubscribe)?void 0:n.call(t,e,this);return()=>{this.listeners.delete(e),null==r||r()}},this.prevState=e,this.state=e,this.options=t}setState(e){var t,n,r;this.prevState=this.state,(null==(t=this.options)?void 0:t.updateFn)?this.state=this.options.updateFn(this.prevState)(e):function(e){return"function"==typeof e}(e)?this.state=e(this.prevState):this.state=e,null==(r=null==(n=this.options)?void 0:n.onUpdate)||r.call(n),Fe(this)}}const De=2e-4,Be=1e-4;function ze(e,t){return e.prefixSegment&&e.suffixSegment?t+.05+De*e.prefixSegment.length+Be*e.suffixSegment.length:e.prefixSegment?t+.02+De*e.prefixSegment.length:e.suffixSegment?t+.01+Be*e.suffixSegment.length:t}const $e="tsr-scroll-restoration-v1_3",He=function(){const e=function(){try{if("undefined"!=typeof window&&"object"==typeof window.sessionStorage)return window.sessionStorage}catch{}}();if(!e)return null;const t=e.getItem($e);let n=t?JSON.parse(t):{};return{state:n,set:t=>(n=u(t,n)||n,e.setItem($e,JSON.stringify(n)))}}(),We=e=>e.state.__TSR_key||e.href;let qe=!1;function Ue({storageKey:e,key:t,behavior:n,shouldScrollRestoration:r,scrollToTopSelectors:i,location:o}){let s;try{s=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(e){return void console.error(e)}const a=s[t||window.history.state?.__TSR_key];qe=!0;e:{if(r&&a&&Object.keys(a).length>0){for(const e in a){const t=a[e];if("window"===e)window.scrollTo({top:t.scrollY,left:t.scrollX,behavior:n});else if(e){const n=document.querySelector(e);n&&(n.scrollLeft=t.scrollX,n.scrollTop=t.scrollY)}}break e}const e=(o??window.location).hash.split("#",2)[1];if(e){const t=window.history.state?.__hashScrollIntoViewOptions??!0;if(t){const n=document.getElementById(e);n&&n.scrollIntoView(t)}break e}const t={top:0,left:0,behavior:n};if(window.scrollTo(t),i)for(const e of i){if("window"===e)continue;const n="function"==typeof e?e():document.querySelector(e);n&&n.scrollTo(t)}}qe=!1}function Ge(e){return e?"false"!==e&&("true"===e||(0*+e==0&&+e+""===e?+e:e)):""}const Ke=(Ye=JSON.parse,e=>{"?"===e[0]&&(e=e.substring(1));const t=function(e){const t=new URLSearchParams(e),n={};for(const[e,r]of t.entries()){const t=n[e];null==t?n[e]=Ge(r):Array.isArray(t)?t.push(Ge(r)):n[e]=[t,Ge(r)]}return n}(e);for(const e in t){const n=t[e];if("string"==typeof n)try{t[e]=Ye(n)}catch(e){}}return t});var Ye;const Ze=function(e,t){const n="function"==typeof t;function r(r){if("object"==typeof r&&null!==r)try{return e(r)}catch(e){}else if(n&&"string"==typeof r)try{return t(r),e(r)}catch(e){}return r}return e=>{const t=function(e,t=String){const n=new URLSearchParams;for(const r in e){const i=e[r];void 0!==i&&n.set(r,t(i))}return n.toString()}(e,r);return t?`?${t}`:""}}(JSON.stringify,JSON.parse);function Xe(e){return e instanceof Response&&!!e.options}const Je=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Qe=(e,t)=>!(!e.preload||e.router.state.matches.some(e=>e.id===t)),et=(e,t)=>{const n=e.router.routesById[t.routeId??""]??e.router.routeTree;!n.options.notFoundComponent&&e.router.options?.defaultNotFoundComponent&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),l(n.options.notFoundComponent);const r=e.matches.find(e=>e.routeId===n.id);l(r,n.id),e.updateMatch(r.id,e=>({...e,status:"notFound",error:t,isFetching:!1})),"BEFORE_LOAD"===t.routerCode&&n.parentRoute&&(t.routeId=n.parentRoute.id,et(e,t))},tt=(e,t,n)=>{if(Xe(n)||T(n)){if(Xe(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;const r=Xe(n)?"redirected":"notFound";e.updateMatch(t.id,e=>({...e,status:r,isFetching:!1,error:n})),T(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw Xe(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)):(et(e,n),n)}},nt=(e,t)=>{const n=e.router.getMatch(t);return!(e.router.isServer||!n._nonReactive.dehydrated)||!(!e.router.isServer||!1!==n.ssr)},rt=(e,t,n,r)=>{const{id:i,routeId:o}=e.matches[t],s=e.router.looseRoutesById[o];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,tt(e,e.router.getMatch(i),n);try{s.options.onError?.(n)}catch(t){n=t,tt(e,e.router.getMatch(i),n)}e.updateMatch(i,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},it=(e,t,n,r)=>{if(void 0!==r._nonReactive.pendingTimeout)return;const i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!e.router.isServer&&!Qe(e,t)&&(n.options.loader||n.options.beforeLoad||ht(n))&&"number"==typeof i&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){const t=setTimeout(()=>{Je(e)},i);r._nonReactive.pendingTimeout=t}},ot=(e,t)=>{const{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],o=()=>((e,t,n,r)=>{const i=e.router.getMatch(t),o=i._nonReactive.loadPromise;i._nonReactive.loadPromise=w(()=>{o?.resolve()});const{paramsError:s,searchError:a}=i;s&&rt(e,n,s,"PARSE_PARAMS"),a&&rt(e,n,a,"VALIDATE_SEARCH"),it(e,t,r,i);const l=new AbortController,c=e.matches[n-1]?.id,u=c?e.router.getMatch(c):void 0,d={...u?.context??e.router.options.context??void 0,...i.__routeContext};let f=!1;const h=()=>{f||(f=!0,e.updateMatch(t,e=>({...e,isFetching:"beforeLoad",fetchCount:e.fetchCount+1,abortController:l,context:d})))},p=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad)return void Te(()=>{h(),p()});i._nonReactive.beforeLoadPromise=w();const{search:m,params:g,cause:v}=i,x=Qe(e,t),y={search:m,abortController:l,params:g,preload:x,context:d,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:x?"preload":v,matches:e.matches,...e.router.options.additionalContext},_=r=>{void 0!==r?((Xe(r)||T(r))&&(h(),rt(e,n,r,"BEFORE_LOAD")),Te(()=>{h(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r,context:{...e.context,...r}})),p()})):Te(()=>{h(),p()})};let S;try{if(S=r.options.beforeLoad(y),b(S))return h(),S.catch(t=>{rt(e,n,t,"BEFORE_LOAD")}).then(_)}catch(t){h(),rt(e,n,t,"BEFORE_LOAD")}_(S)})(e,n,t,i),s=()=>{if(nt(e,n))return;const t=((e,t,n)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;it(e,t,n,r);const i=()=>{const n=e.router.getMatch(t);!n.preload||"redirected"!==n.status&&"notFound"!==n.status||tt(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()})(e,n,i);return b(t)?t.then(o):o()};return(()=>{if(e.router.isServer){const r=((e,t,n,r)=>{const i=e.router.getMatch(t),o=e.matches[n-1]?.id,s=o?e.router.getMatch(o):void 0;if(e.router.isShell())return void(i.ssr=t===A);if(!1===s?.ssr)return void(i.ssr=!1);const a=e=>!0===e&&"data-only"===s?.ssr?"data-only":e,l=e.router.options.defaultSsr??!0;if(void 0===r.options.ssr)return void(i.ssr=a(l));if("function"!=typeof r.options.ssr)return void(i.ssr=a(r.options.ssr));const{search:c,params:u}=i,d={search:ft(c,i.searchError),params:ft(u,i.paramsError),location:e.location,matches:e.matches.map(e=>({index:e.index,pathname:e.pathname,fullPath:e.fullPath,staticData:e.staticData,id:e.id,routeId:e.routeId,search:ft(e.search,e.searchError),params:ft(e.params,e.paramsError),ssr:e.ssr}))},f=r.options.ssr(d);if(b(f))return f.then(e=>{i.ssr=a(e??l)});i.ssr=a(f??l)})(e,n,t,i);if(b(r))return r.then(s)}return s()})()},st=(e,t,n)=>{const r=e.router.getMatch(t);if(!r)return;if(!n.options.head&&!n.options.scripts&&!n.options.headers)return;const i={matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>{const r=e?.meta,i=e?.links,o=e?.scripts,s=e?.styles;return{meta:r,links:i,headScripts:o,headers:n,scripts:t,styles:s}})},at=(e,t,n,r)=>{const i=e.matchPromises[n-1],{params:o,loaderDeps:s,abortController:a,context:l,cause:c}=e.router.getMatch(t),u=Qe(e,t);return{params:o,deps:s,preload:!!u,parentMatchPromise:i,abortController:a,context:l,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:u?"preload":c,route:r,...e.router.options.additionalContext}},lt=async(e,t,n,r)=>{try{const i=e.router.getMatch(t);try{e.router.isServer&&!0!==i.ssr||dt(r);const o=r.options.loader?.(at(e,t,n,r)),s=r.options.loader&&b(o);if(!!(s||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||i._nonReactive.minPendingPromise)&&e.updateMatch(t,e=>({...e,isFetching:"loader"})),r.options.loader){const n=s?await o:o;tt(e,e.router.getMatch(t),n),void 0!==n&&e.updateMatch(t,e=>({...e,loaderData:n}))}r._lazyPromise&&await r._lazyPromise;const a=st(e,t,r),l=a?await a:void 0,c=i._nonReactive.minPendingPromise;c&&await c,r._componentsPromise&&await r._componentsPromise,e.updateMatch(t,e=>({...e,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),...l}))}catch(n){let o=n;const s=i._nonReactive.minPendingPromise;s&&await s,T(n)&&await(r.options.notFoundComponent?.preload?.()),tt(e,e.router.getMatch(t),n);try{r.options.onError?.(n)}catch(n){o=n,tt(e,e.router.getMatch(t),n)}const a=st(e,t,r),l=a?await a:void 0;e.updateMatch(t,e=>({...e,error:o,status:"error",isFetching:!1,...l}))}}catch(n){const i=e.router.getMatch(t);if(i){const n=st(e,t,r);if(n){const r=await n;e.updateMatch(t,e=>({...e,...r}))}i._nonReactive.loaderPromise=void 0}tt(e,i,n)}},ct=async(e,t)=>{const{id:n,routeId:r}=e.matches[t];let i=!1,o=!1;const s=e.router.looseRoutesById[r];if(nt(e,n)){if(e.router.isServer){const t=st(e,n,s);if(t){const r=await t;e.updateMatch(n,e=>({...e,...r}))}return e.router.getMatch(n)}}else{const r=e.router.getMatch(n);if(r._nonReactive.loaderPromise){if("success"===r.status&&!e.sync&&!r.preload)return r;await r._nonReactive.loaderPromise;const t=e.router.getMatch(n);t.error&&tt(e,t,t.error)}else{const a=Date.now()-r.updatedAt,l=Qe(e,n),c=l?s.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:s.options.staleTime??e.router.options.defaultStaleTime??0,u=s.options.shouldReload,d="function"==typeof u?u(at(e,n,t,s)):u,f=!!l&&!e.router.state.matches.some(e=>e.id===n),h=e.router.getMatch(n);h._nonReactive.loaderPromise=w(),f!==h.preload&&e.updateMatch(n,e=>({...e,preload:f}));const{status:p,invalid:m}=h;if(i="success"===p&&(m||(d??a>c)),l&&!1===s.options.preload);else if(i&&!e.sync)o=!0,(async()=>{try{await lt(e,n,t,s);const r=e.router.getMatch(n);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0}catch(t){Xe(t)&&await e.router.navigate(t.options)}})();else if("success"!==p||i&&e.sync)await lt(e,n,t,s);else{const t=st(e,n,s);if(t){const r=await t;e.updateMatch(n,e=>({...e,...r}))}}}}const a=e.router.getMatch(n);o||(a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loadPromise?.resolve()),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0,o||(a._nonReactive.loaderPromise=void 0),a._nonReactive.dehydrated=void 0;const l=!!o&&a.isFetching;return l!==a.isFetching||!1!==a.invalid?(e.updateMatch(n,e=>({...e,isFetching:l,invalid:!1})),e.router.getMatch(n)):a};async function ut(e){const t=Object.assign(e,{matchPromises:[]});!t.router.isServer&&t.router.state.matches.some(e=>e._forcePending)&&Je(t);try{for(let e=0;e{const{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&void 0===e._componentsPromise){const t=()=>{const t=[];for(const n of pt){const r=e.options[n]?.preload;r&&t.push(r())}if(t.length)return Promise.all(t).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function ft(e,t){return t?{status:"error",error:t}:{status:"success",value:e}}function ht(e){for(const t of pt)if(e.options[t]?.preload)return!0;return!1}const pt=["component","errorComponent","pendingComponent","notFoundComponent"];function mt(e,t){const n=e?.input?.({url:t});if(n){if("string"==typeof n)return new URL(n);if(n instanceof URL)return n}return t}function gt(e,t){const n=e?.output?.({url:t});if(n){if("string"==typeof n)return new URL(n);if(n instanceof URL)return n}return t}function vt(e){const t=e.resolvedLocation,n=e.location;return{fromLocation:t,toLocation:n,pathChanged:t?.pathname!==n.pathname,hrefChanged:t?.href!==n.href,hashChanged:t?.hash!==n.hash}}class wt{constructor(e){this.tempLocationKey=`${Math.round(1e7*Math.random())}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const t=this.options,n=this.basepath??t?.basepath??"/",r=void 0===this.basepath,i=t?.rewrite;this.options={...t,...e},this.isServer=this.options.isServer??"undefined"==typeof document,this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(e=>[encodeURIComponent(e),e])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=Se())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&"null"!==window.origin?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new Ae({loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:this.latestLocation,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200},{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(e=>!["redirected"].includes(e.status))}}}),function(e,t){if(!He&&!e.isServer)return;if((t??e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isServer||e.isScrollRestorationSetup||!He)return;e.isScrollRestorationSetup=!0,qe=!1;const n=e.options.getScrollRestorationKey||We;window.history.scrollRestoration="manual","undefined"!=typeof document&&document.addEventListener("scroll",(e=>{let t;return(...n)=>{t||(t=setTimeout(()=>{e(...n),t=null},100))}})(t=>{if(qe||!e.isScrollRestoring)return;let r="";if(t.target===document||t.target===window)r="window";else{const e=t.target.getAttribute("data-scroll-restoration-id");r=e?`[data-scroll-restoration-id="${e}"]`:function(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}(t.target)}const i=n(e.state.location);He.set(e=>{const t=e[i]||={},n=t[r]||={};if("window"===r)n.scrollX=window.scrollX||0,n.scrollY=window.scrollY||0;else if(r){const e=document.querySelector(r);e&&(n.scrollX=e.scrollLeft||0,n.scrollY=e.scrollTop||0)}return e})}),!0),e.subscribe("onRendered",t=>{const r=n(t.toLocation);if(e.resetNextScroll){if("function"==typeof e.options.scrollRestoration&&!e.options.scrollRestoration({location:e.latestLocation}))return;Ue({storageKey:$e,key:r,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&He.set(e=>(e[r]||={},e))}else e.resetNextScroll=!0})}(this));let o=!1;const s=this.options.basepath??"/",a=this.options.rewrite;if(r||n!==s||i!==a){this.basepath=s;const e=[];""!==k(s)&&e.push(function(e){const t=k(e.basepath),n=`/${t}`,r=`${n}/`,i=e.caseSensitive?n:n.toLowerCase(),o=e.caseSensitive?r:r.toLowerCase();return{input:({url:t})=>{const r=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return r===i?t.pathname="/":r.startsWith(o)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=_(["/",t,e.pathname]),e)}}({basepath:s})),a&&e.push(a),this.rewrite=0===e.length?void 0:1===e.length?e[0]:function(e){return{input:({url:t})=>{for(const n of e)t=mt(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=gt(e[n],t);return t}}}(e),this.history&&this.updateLatestLocation(),o=!0}o&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),"undefined"!=typeof window&&"CSS"in window&&"function"==typeof window.CSS?.supports&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:e,routesByPath:t,flatRoutes:n}=function({routeTree:e,initRoute:t}){const n={},r={},i=e=>{e.forEach((e,o)=>{if(t?.(e,o),l(!n[e.id],String(e.id)),n[e.id]=e,!e.isRoot&&e.path){const t=j(e.fullPath);r[t]&&!e.fullPath.endsWith("/")||(r[t]=e)}const s=e.children;s?.length&&i(s)})};i([e]);const o=function(e){const t=[];e.forEach((e,n)=>{if(e.isRoot||!e.path)return;const r=C(e.fullPath);let i=E(r),o=0;for(;i.length>o+1&&"/"===i[o]?.value;)o++;o>0&&(i=i.slice(o));let s=0,a=!1;const l=i.map((e,t)=>{if("/"===e.value)return.75;if(0===e.type)return 1;let n;1===e.type?n=.5:3===e.type?(n=.4,s++):n=.25;for(let r=t+1;r{const n=Math.min(e.scores.length,t.scores.length);for(let r=0;rt.parsed[r].value?1:-1;return e.index-t.index}).map((e,t)=>(e.child.rank=t,e.child));return n}(Object.values(n));return{routesById:n,routesByPath:r,flatRoutes:o}}({routeTree:this.routeTree,initRoute:(e,t)=>{e.init({originalIndex:t})}});this.routesById=e,this.routesByPath=t,this.flatRoutes=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)},this.subscribe=(e,t)=>{const n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{const n=({href:e,state:n})=>{const r=new URL(e,this.origin),i=mt(this.rewrite,r),o=this.options.parseSearch(i.search),s=this.options.stringifySearch(o);i.search=s;const a=i.href.replace(i.origin,""),{pathname:l,hash:c}=i;return{href:a,publicHref:e,url:i.href,pathname:l,searchStr:s,search:f(t?.search,o),hash:c.split("#").reverse()[0]??"",state:f(t?.state,n)}},r=n(e),{__tempLocation:i,__tempKey:o}=r.state;if(i&&(!o||o===this.tempLocationKey)){const e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>{const n=function({base:e,to:t,trailingSlash:n="never",parseCache:r}){let i=E(e,r).slice();const o=E(t,r);i.length>1&&"/"===c(i)?.value&&i.pop();for(let e=0,t=o.length;e1&&("/"===c(i).value?"never"===n&&i.pop():"always"===n&&i.push({type:0,value:"/"})),_(i.map(M))}({base:e,to:S(t),trailingSlash:this.options.trailingSlash,parseCache:this.parsePathnameCache});return n},this.matchRoutes=(e,t,n)=>"string"==typeof e?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.parsePathnameCache=function(){const e=new Map;let t,n;const r=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,n&&(n.next=e,e.prev=n)):(e.next.prev=void 0,t=e.next,e.next=void 0,n&&(e.prev=n,n.next=e)),n=e)};return{get(t){const n=e.get(t);if(n)return r(n),n.value},set(i,o){if(e.size>=1e3&&t){const r=t;e.delete(r.key),r.next&&(t=r.next,r.next.prev=void 0),r===n&&(n=void 0)}const s=e.get(i);if(s)s.value=o,r(s);else{const r={key:i,value:o,prev:n};n&&(n.next=r),n=r,t||(t=r),e.set(i,r)}}}}(),this.getMatchedRoutes=(e,t)=>function({pathname:e,routePathname:t,caseSensitive:n,routesByPath:r,routesById:i,flatRoutes:o,parseCache:s}){let a={};const l=j(e),c=e=>F(l,{to:e.fullPath,caseSensitive:e.options?.caseSensitive??n,fuzzy:!0},s);let u=void 0!==t?r[t]:void 0;if(u)a=c(u);else{let e;for(const t of o){const n=c(t);if(n){if("/"===t.path||!n["**"]){u=t,a=n;break}e||(e={foundRoute:t,routeParams:n})}}!u&&e&&(u=e.foundRoute,a=e.routeParams)}let d=u||i[A];const f=[d];for(;d.parentRoute;)d=d.parentRoute,f.push(d);return f.reverse(),{matchedRoutes:f,routeParams:a,foundRoute:u}}({pathname:e,routePathname:t,caseSensitive:this.options.caseSensitive,routesByPath:this.routesByPath,routesById:this.routesById,flatRoutes:this.flatRoutes,parseCache:this.parsePathnameCache}),this.cancelMatch=e=>{const t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.state.pendingMatches?.forEach(e=>{this.cancelMatch(e.id)})},this.buildLocation=e=>{const t=(t={})=>{const n=t._fromLocation||this.latestLocation,r=c(this.matchRoutes(n,{_buildLocation:!0}));t.from;const i="path"===t.unsafeRelative?n.pathname:t.from??r.fullPath,o=this.resolvePathWithBase(i,"."),s=r.search,a={...r.params},l=t.to?this.resolvePathWithBase(o,`${t.to}`):this.resolvePathWithBase(o,"."),d=!1===t.params||null===t.params?{}:!0===(t.params??!0)?a:Object.assign(a,u(t.params,a)),h=R({path:l,params:d,parseCache:this.parsePathnameCache}).interpolatedPath,p=this.matchRoutes(h,void 0,{_buildLocation:!0}).map(e=>this.looseRoutesById[e.routeId]);if(Object.keys(d).length>0)for(const e of p){const t=e.options.params?.stringify??e.options.stringifyParams;t&&Object.assign(d,t(d))}const m=y(R({path:l,params:d,leaveWildcards:!1,leaveParams:e.leaveParams,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath);let g=s;if(e._includeValidateSearch&&this.options.search?.strict){const e={};p.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,yt(t.options.validateSearch,{...e,...g}))}catch{}}),g=e}g=function({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){const i=n.reduce((e,t)=>{const n=[];if("search"in t.options)t.options.search?.middlewares&&n.push(...t.options.search.middlewares);else if(t.options.preSearchFilters||t.options.postSearchFilters){const e=({search:e,next:n})=>{let r=e;"preSearchFilters"in t.options&&t.options.preSearchFilters&&(r=t.options.preSearchFilters.reduce((e,t)=>t(e),e));const i=n(r);return"postSearchFilters"in t.options&&t.options.postSearchFilters?t.options.postSearchFilters.reduce((e,t)=>t(e),i):i};n.push(e)}if(r&&t.options.validateSearch){const e=({search:e,next:n})=>{const r=n(e);try{return{...r,...yt(t.options.validateSearch,r)??void 0}}catch{return r}};n.push(e)}return e.concat(n)},[])??[];i.push(({search:e})=>t.search?!0===t.search?e:u(t.search,e):{});const o=(e,t)=>e>=i.length?t:(0,i[e])({search:t,next:t=>o(e+1,t)});return o(0,e)}({search:g,dest:t,destRoutes:p,_includeValidateSearch:e._includeValidateSearch}),g=f(s,g);const v=this.options.stringifySearch(g),w=!0===t.hash?n.hash:t.hash?u(t.hash,n.hash):void 0,b=w?`#${w}`:"";let x=!0===t.state?n.state:t.state?u(t.state,n.state):{};x=f(n.state,x);const _=`${m}${v}${b}`,S=new URL(_,this.origin),C=gt(this.rewrite,S);return{publicHref:C.pathname+C.search+C.hash,href:_,url:C.href,pathname:m,search:g,searchStr:v,state:x,hash:w??"",unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{const i=t(n);let o=r?t(r):void 0;if(!o){let n={};const s=this.options.routeMasks?.find(e=>{const t=F(i.pathname,{to:e.from,caseSensitive:!1,fuzzy:!1},this.parsePathnameCache);return!!t&&(n=t,!0)});if(s){const{from:i,...a}=s;r={from:e.from,...a,params:n},o=t(r)}}return o&&(i.maskedLocation=o),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:t,...n})=>{const r=j(this.latestLocation.href)===j(n.href),i=this.commitLocationPromise;if(this.commitLocationPromise=w(()=>{i?.resolve()}),r&&(()=>{const e=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});const t=v(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t})())this.load();else{let{maskedLocation:r,hashScrollIntoView:i,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=i??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?"replace":"push"](o.publicHref,o.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:o,...s}={})=>{if(o){const t=this.history.location.state.__TSR_index,n=Ce(o,{__TSR_index:e?t:t+1});s.to=n.pathname,s.search=this.options.parseSearch(n.search),s.hash=n.hash.slice(1)}const a=this.buildLocation({...s,_includeValidateSearch:!0});return this.commitLocation({...a,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i})},this.navigate=({to:e,reloadDocument:t,href:n,...r})=>{if(!t&&n)try{new URL(`${n}`),t=!0}catch{}return t?(n||(n=this.buildLocation({to:e,...r}).url),r.replace?window.location.replace(n):window.location.href=n,Promise.resolve()):this.buildAndCommitLocation({...r,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const e=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),t=e=>{try{return encodeURI(decodeURI(e))}catch{return e}};if(k(t(this.latestLocation.href))!==k(t(e.href))){let t=e.url;throw this.origin&&t.startsWith(this.origin)&&(t=t.replace(this.origin,"")||"/"),function(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&"string"==typeof e.href)try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&null===t.get("Location")&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}({href:t})}}const e=this.matchRoutes(this.latestLocation);this.__store.setState(t=>({...t,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:t.cachedMatches.filter(t=>!e.some(e=>e.id===t.id))}))},this.load=async e=>{let t,n,r,i;for(r=new Promise(i=>{this.startTransition(async()=>{try{this.beforeLoad();const t=this.latestLocation,n=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...vt({resolvedLocation:n,location:t})}),this.emit({type:"onBeforeLoad",...vt({resolvedLocation:n,location:t})}),await ut({router:this,sync:e?.sync,matches:this.state.pendingMatches,location:t,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=[],t=[],n=[];Te(()=>{this.__store.setState(r=>{const i=r.matches,o=r.pendingMatches||r.matches;return e=i.filter(e=>!o.some(t=>t.id===e.id)),t=o.filter(e=>!i.some(t=>t.id===e.id)),n=o.filter(e=>i.some(t=>t.id===e.id)),{...r,isLoading:!1,loadedAt:Date.now(),matches:o,pendingMatches:void 0,cachedMatches:[...r.cachedMatches,...e.filter(e=>"error"!==e.status)]}}),this.clearExpiredCache()}),[[e,"onLeave"],[t,"onEnter"],[n,"onStay"]].forEach(([e,t])=>{e.forEach(e=>{this.looseRoutesById[e.routeId].options[t]?.(e)})})})})}})}catch(e){Xe(e)?(t=e,this.isServer||this.navigate({...t.options,replace:!0,ignoreBlocker:!0})):T(e)&&(n=e),this.__store.setState(e=>({...e,statusCode:t?t.status:n?404:e.matches.some(e=>"error"===e.status)?500:200,redirect:t}))}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;this.hasNotFoundMatch()?i=404:this.__store.state.matches.some(e=>"error"===e.status)&&(i=500),void 0!==i&&this.__store.setState(e=>({...e,statusCode:i}))},this.startViewTransition=e=>{const t=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,t&&"undefined"!=typeof document&&"startViewTransition"in document&&"function"==typeof document.startViewTransition){let n;if("object"==typeof t&&this.isViewTransitionTypesSupported){const r=this.latestLocation,i=this.state.resolvedLocation,o="function"==typeof t.types?t.types(vt({resolvedLocation:i,location:r})):t.types;if(!1===o)return void e();n={update:e,types:o}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{const n=this.state.pendingMatches?.some(t=>t.id===e)?"pendingMatches":this.state.matches.some(t=>t.id===e)?"matches":this.state.cachedMatches.some(t=>t.id===e)?"cachedMatches":"";n&&this.__store.setState(r=>({...r,[n]:r[n]?.map(n=>n.id===e?t(n):n)}))},this.getMatch=e=>{const t=t=>t.id===e;return this.state.cachedMatches.find(t)??this.state.pendingMatches?.find(t)??this.state.matches.find(t)},this.invalidate=e=>{const t=t=>e?.filter?.(t)??1?{...t,invalid:!0,...e?.forcePending||"error"===t.status?{status:"pending",error:void 0}:void 0}:t;return this.__store.setState(e=>({...e,matches:e.matches.map(t),cachedMatches:e.cachedMatches.map(t),pendingMatches:e.pendingMatches?.map(t)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{if(!e.options.href){const t=this.buildLocation(e.options);let n=t.url;this.origin&&n.startsWith(this.origin)&&(n=n.replace(this.origin,"")||"/"),e.options.href=t.href,e.headers.set("Location",n)}return e.headers.get("Location")||e.headers.set("Location",e.options.href),e},this.clearCache=e=>{const t=e?.filter;void 0!==t?this.__store.setState(e=>({...e,cachedMatches:e.cachedMatches.filter(e=>!t(e))})):this.__store.setState(e=>({...e,cachedMatches:[]}))},this.clearExpiredCache=()=>{this.clearCache({filter:e=>{const t=this.looseRoutesById[e.routeId];if(!t.options.loader)return!0;const n=(e.preload?t.options.preloadGcTime??this.options.defaultPreloadGcTime:t.options.gcTime??this.options.defaultGcTime)??3e5;return"error"===e.status||Date.now()-e.updatedAt>=n}})},this.loadRouteChunk=dt,this.preloadRoute=async e=>{const t=this.buildLocation(e);let n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e});const r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(e=>e.id)),i=new Set([...r,...this.state.cachedMatches.map(e=>e.id)]);Te(()=>{n.forEach(e=>{i.has(e.id)||this.__store.setState(t=>({...t,cachedMatches:[...t.cachedMatches,e]}))})});try{return n=await ut({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Xe(e)){if(e.options.reloadDocument)return;return await this.preloadRoute({...e.options,_fromLocation:t})}return void(T(e)||console.error(e))}},this.matchRoute=(e,t)=>{const n={...e,to:e.to?this.resolvePathWithBase(e.from||"",e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&"pending"!==this.state.status)return!1;const i=(void 0===t?.pending?!this.state.isLoading:t.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,o=F(i.pathname,{...t,to:r.pathname},this.parsePathnameCache);return!!o&&!(e.params&&!v(o,e.params,{partial:!0}))&&(o&&(t?.includeSearch??1)?!!v(i.search,r.search,{partial:!0})&&o:o)},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>"notFound"===e.status||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??Ze,parseSearch:e.parseSearch??Ke}),"undefined"!=typeof document&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(e,t){const{foundRoute:n,matchedRoutes:r,routeParams:i}=this.getMatchedRoutes(e.pathname,t?.dest?.to);let o=!1;(n?"/"!==n.path&&i["**"]:j(e.pathname))&&(this.options.notFoundRoute?r.push(this.options.notFoundRoute):o=!0);const s=(()=>{if(o){if("root"!==this.options.notFoundMode)for(let e=r.length-1;e>=0;e--){const t=r[e];if(t.children)return t.id}return A}})(),a=[],l=e=>{const t=e?.id;return t?e.context??this.options.context??void 0:this.options.context??void 0};return r.forEach((n,r)=>{const o=a[r-1],[c,u,d]=(()=>{const r=o?.search??e.search,i=o?._strictSearch??void 0;try{const e=yt(n.options.validateSearch,{...r})??void 0;return[{...r,...e},{...i,...e},void 0]}catch(e){let n=e;if(e instanceof bt||(n=new bt(e.message,{cause:e})),t?.throwOnError)throw n;return[r,{},n]}})(),h=n.options.loaderDeps?.({search:c})??"",p=h?JSON.stringify(h):"",{interpolatedPath:m,usedParams:g}=R({path:n.fullPath,params:i,decodeCharMap:this.pathParamsDecodeCharMap}),v=R({path:n.id,params:i,leaveWildcards:!0,decodeCharMap:this.pathParamsDecodeCharMap,parseCache:this.parsePathnameCache}).interpolatedPath+p,b=this.getMatch(v),x=this.state.matches.find(e=>e.routeId===n.id),y=b?._strictParams??g;let _;if(!b){const e=n.options.params?.parse??n.options.parseParams;if(e)try{Object.assign(y,e(y))}catch(e){if(_=new xt(e.message,{cause:e}),t?.throwOnError)throw _}}Object.assign(i,y);const S=x?"stay":"enter";let C;if(b)C={...b,cause:S,params:x?f(x.params,i):i,_strictParams:y,search:f(x?x.search:b.search,c),_strictSearch:u};else{const e=n.options.loader||n.options.beforeLoad||n.lazyFn||ht(n)?"pending":"success";C={id:v,index:r,routeId:n.id,params:x?f(x.params,i):i,_strictParams:y,pathname:m,updatedAt:Date.now(),search:x?f(x.search,c):c,_strictSearch:u,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:_,__routeContext:void 0,_nonReactive:{loadPromise:w()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:x?f(x.loaderDeps,h):h,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:n.options.staticData||{},fullPath:n.fullPath}}t?.preload||(C.globalNotFound=s===n.id),C.searchError=d;const j=l(o);C.context={...j,...C.__routeContext,...C.__beforeLoadContext},a.push(C)}),a.forEach((n,r)=>{const i=this.looseRoutesById[n.routeId];if(!this.getMatch(n.id)&&!0!==t?._buildLocation){const t=a[r-1],o=l(t);if(i.options.context){const t={deps:n.loaderDeps,params:n.params,context:o??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:a};n.__routeContext=i.options.context(t)??void 0}n.context={...o,...n.__routeContext,...n.__beforeLoadContext}}}),a}}class bt extends Error{}class xt extends Error{}function yt(e,t){if(null==e)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new bt("Async validation not supported");if(n.issues)throw new bt(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):"function"==typeof e?e(t):{}}function _t(e){return"object"==typeof e?new St(e,{silent:!0}).createRoute(e):new St(e,{silent:!0}).createRoute}class St{constructor(e,t){this.path=e,this.createRoute=e=>{this.silent;const t=ve(e);return t.isRoot=!1,t},this.silent=t?.silent}}class Ct{constructor(e){this.useMatch=e=>J({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>J({from:this.options.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ne({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>te({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>ee({...e,from:this.options.id}),this.useLoaderData=e=>Q({...e,from:this.options.id}),this.useNavigate=()=>re({from:K().routesById[this.options.id].fullPath}),this.options=e,this.$$typeof=Symbol.for("react.memo")}}function jt(e){return"object"==typeof e?new Ct(e):t=>new Ct({id:e,...t})}function kt(e){const t=e.errorComponent??Mt;return(0,a.jsx)(It,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?z.createElement(t,{error:n,reset:r}):e.children})}"undefined"!=typeof globalThis?(globalThis.createFileRoute=_t,globalThis.createLazyFileRoute=jt):"undefined"!=typeof window&&(window.createFileRoute=_t,window.createLazyFileRoute=jt);class It extends z.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Mt({error:e}){const[t,n]=z.useState(!1);return(0,a.jsxs)("div",{style:{padding:".5rem",maxWidth:"100%"},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[(0,a.jsx)("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),(0,a.jsx)("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(e=>!e),children:t?"Hide Error":"Show Error"})]}),(0,a.jsx)("div",{style:{height:".25rem"}}),t?(0,a.jsx)("div",{children:(0,a.jsx)("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?(0,a.jsx)("code",{children:e.message}):null})}):null]})}function Et(){const e=K(),t=z.useRef({router:e,mounted:!1}),[n,r]=z.useState(!1),{hasPendingMatches:i,isLoading:o}=Y({select:e=>({isLoading:e.isLoading,hasPendingMatches:e.matches.some(e=>"pending"===e.status)}),structuralSharing:!0}),s=se(o),a=o||n||i,l=se(a),c=o||i,u=se(c);return e.startTransition=e=>{r(!0),z.startTransition(()=>{e(),r(!1)})},z.useEffect(()=>{const t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return j(e.latestLocation.href)!==j(n.href)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),oe(()=>{"undefined"!=typeof window&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),oe(()=>{s&&!o&&e.emit({type:"onLoad",...vt(e.state)})},[s,e,o]),oe(()=>{u&&!c&&e.emit({type:"onBeforeRouteMount",...vt(e.state)})},[c,u,e]),oe(()=>{l&&!a&&(e.emit({type:"onResolved",...vt(e.state)}),e.__store.setState(e=>({...e,status:"idle",resolvedLocation:e.location})),function(e){if("undefined"!=typeof document&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&""!==e.state.location.hash){const n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}(e))},[a,l,e]),null}function Pt(e){const t=Y({select:e=>`not-found-${e.location.pathname}-${e.status}`});return(0,a.jsx)(kt,{getResetKey:()=>t,onCatch:(t,n)=>{if(!T(t))throw t;e.onCatch?.(t,n)},errorComponent:({error:t})=>{if(T(t))return e.fallback?.(t);throw t},children:e.children})}function Lt(){return(0,a.jsx)("p",{children:"Not Found"})}function Vt(e){return(0,a.jsx)(a.Fragment,{children:e.children})}function Nt(e,t,n){return t.options.notFoundComponent?(0,a.jsx)(t.options.notFoundComponent,{data:n}):e.options.defaultNotFoundComponent?(0,a.jsx)(e.options.defaultNotFoundComponent,{data:n}):(0,a.jsx)(Lt,{})}function Ot({children:e}){const t=K();return t.isServer?(0,a.jsx)("script",{nonce:t.options.ssr?.nonce,className:"$tsr",dangerouslySetInnerHTML:{__html:[e].filter(Boolean).join("\n")+";$_TSR.c()"}}):null}function Rt(){const e=K();if(!e.isScrollRestoring||!e.isServer)return null;if("function"==typeof e.options.scrollRestoration&&!e.options.scrollRestoration({location:e.latestLocation}))return null;const t=(e.options.getScrollRestorationKey||We)(e.latestLocation),n=t!==We(e.latestLocation)?t:void 0,r={storageKey:$e,shouldScrollRestoration:!0};return n&&(r.key=n),(0,a.jsx)(Ot,{children:`(${Ue.toString()})(${JSON.stringify(r)})`})}function Ft({children:e,fallback:t=null}){return z.useSyncExternalStore(Tt,()=>!0,()=>!1)?(0,a.jsx)(z.Fragment,{children:e}):(0,a.jsx)(z.Fragment,{children:t})}function Tt(){return()=>{}}const At=z.memo(function({matchId:e}){const t=K(),n=Y({select:t=>{const n=t.matches.find(t=>t.id===e);return l(n),{routeId:n.routeId,ssr:n.ssr,_displayPending:n._displayPending}},structuralSharing:!0}),r=t.routesById[n.routeId],i=r.options.pendingComponent??t.options.defaultPendingComponent,o=i?(0,a.jsx)(i,{}):null,s=r.options.errorComponent??t.options.defaultErrorComponent,c=r.options.onCatch??t.options.defaultOnCatch,u=r.isRoot?r.options.notFoundComponent??t.options.notFoundRoute?.options.component:r.options.notFoundComponent,d=!1===n.ssr||"data-only"===n.ssr,f=(!r.isRoot||r.options.wrapInSuspense||d)&&(r.options.wrapInSuspense??i??(r.options.errorComponent?.preload||d))?z.Suspense:Vt,h=s?kt:Vt,p=u?Pt:Vt,m=Y({select:e=>e.loadedAt}),g=Y({select:t=>{const n=t.matches.findIndex(t=>t.id===e);return t.matches[n-1]?.routeId}}),v=r.isRoot?r.options.shellComponent??Vt:Vt;return(0,a.jsxs)(v,{children:[(0,a.jsx)(Z.Provider,{value:e,children:(0,a.jsx)(f,{fallback:o,children:(0,a.jsx)(h,{getResetKey:()=>m,errorComponent:s||Mt,onCatch:(e,t)=>{if(T(e))throw e;c?.(e,t)},children:(0,a.jsx)(p,{fallback:e=>{if(!u||e.routeId&&e.routeId!==n.routeId||!e.routeId&&!r.isRoot)throw e;return z.createElement(u,e)},children:d||n._displayPending?(0,a.jsx)(Ft,{fallback:o,children:(0,a.jsx)(Bt,{matchId:e})}):(0,a.jsx)(Bt,{matchId:e})})})})}),g===A&&t.options.scrollRestoration?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Dt,{}),(0,a.jsx)(Rt,{})]}):null]})});function Dt(){const e=K(),t=z.useRef(void 0);return(0,a.jsx)("script",{suppressHydrationWarning:!0,ref:n=>{!n||void 0!==t.current&&t.current.href===e.latestLocation.href||(e.emit({type:"onRendered",...vt(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const Bt=z.memo(function({matchId:e}){const t=K(),{match:n,key:r,routeId:i}=Y({select:n=>{const r=n.matches.find(t=>t.id===e),i=r.routeId,o=t.routesById[i].options.remountDeps??t.options.defaultRemountDeps,s=o?.({routeId:i,loaderDeps:r.loaderDeps,params:r._strictParams,search:r._strictSearch});return{key:s?JSON.stringify(s):void 0,routeId:i,match:{id:r.id,status:r.status,error:r.error,_forcePending:r._forcePending,_displayPending:r._displayPending}}},structuralSharing:!0}),o=t.routesById[i],s=z.useMemo(()=>{const e=o.options.component??t.options.defaultComponent;return e?(0,a.jsx)(e,{},r):(0,a.jsx)(zt,{})},[r,o.options.component,t.options.defaultComponent]);if(n._displayPending)throw t.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw t.getMatch(n.id)?._nonReactive.minPendingPromise;if("pending"===n.status){const e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){const r=t.getMatch(n.id);if(r&&!r._nonReactive.minPendingPromise&&!t.isServer){const t=w();r._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),r._nonReactive.minPendingPromise=void 0},e)}}throw t.getMatch(n.id)?._nonReactive.loadPromise}if("notFound"===n.status)return l(T(n.error)),Nt(t,o,n.error);if("redirected"===n.status)throw l(Xe(n.error)),t.getMatch(n.id)?._nonReactive.loadPromise;if("error"===n.status){if(t.isServer){const e=(o.options.errorComponent??t.options.defaultErrorComponent)||Mt;return(0,a.jsx)(e,{error:n.error,reset:void 0,info:{componentStack:""}})}throw n.error}return s}),zt=z.memo(function(){const e=K(),t=z.useContext(Z),n=Y({select:e=>e.matches.find(e=>e.id===t)?.routeId}),r=e.routesById[n],i=Y({select:e=>{const n=e.matches.find(e=>e.id===t);return l(n),n.globalNotFound}}),o=Y({select:e=>{const n=e.matches,r=n.findIndex(e=>e.id===t);return n[r+1]?.id}}),s=e.options.defaultPendingComponent?(0,a.jsx)(e.options.defaultPendingComponent,{}):null;if(i)return Nt(e,r,void 0);if(!o)return null;const c=(0,a.jsx)(At,{matchId:o});return t===A?(0,a.jsx)(z.Suspense,{fallback:s,children:c}):c});function $t(){const e=K(),t=e.routesById[A].options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,a.jsx)(t,{}):null,r=e.isServer||"undefined"!=typeof document&&e.ssr?Vt:z.Suspense,i=(0,a.jsxs)(r,{fallback:n,children:[!e.isServer&&(0,a.jsx)(Et,{}),(0,a.jsx)(Ht,{})]});return e.options.InnerWrap?(0,a.jsx)(e.options.InnerWrap,{children:i}):i}function Ht(){const e=K(),t=Y({select:e=>e.matches[0]?.id}),n=Y({select:e=>e.loadedAt}),r=t?(0,a.jsx)(At,{matchId:t}):null;return(0,a.jsx)(Z.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,a.jsx)(kt,{getResetKey:()=>n,errorComponent:Mt,onCatch:e=>{e.message||e.toString()},children:r})})}function Wt({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=G(),i=(0,a.jsx)(r.Provider,{value:e,children:t});return e.options.Wrap?(0,a.jsx)(e.options.Wrap,{children:i}):i}function qt({router:e,...t}){return(0,a.jsx)(Wt,{router:e,...t,children:(0,a.jsx)($t,{})})}const Ut=window.wp.i18n,Gt=window.wp.data,Kt=window.wp.commands,Yt=(0,o.createContext)({resolvedSettings:{color:{}}});function Zt(e){return"string"===Xt(e)}function Xt(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Jt(e,{precision:t,unit:n}){return Qt(e)?"none":function(e,t){if(0===e)return 0;let n=~~e,r=0;n&&t&&(r=1+~~Math.log10(Math.abs(n)));const i=10**(t-r);return Math.floor(e*i+.5)/i}(e,t)+(n??"")}function Qt(e){return Number.isNaN(e)||e instanceof Number&&e?.none}const en={deg:1,grad:.9,rad:180/Math.PI,turn:360};function tn(e){return e[e.length-1]}function nn(e,t,n){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*n}function rn(e,t,n){return nn(t[0],t[1],function(e,t,n){return(n-e)/(t-e)}(e[0],e[1],n))}function on(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function sn(e,t){return on(Math.abs(e)**t,e)}function an(e,t){return 0===t?0:e/t}const ln=new class{add(e,t,n){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][n?"unshift":"push"](t)},this);else for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1])}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}};function cn(e,t){let n=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map(e=>[e]));let r=t[0].length,i=t[0].map((e,n)=>t.map(e=>e[n])),o=e.map(e=>i.map(t=>{let n=0;if(!Array.isArray(e)){for(let r of t)n+=e*r;return n}for(let r=0;re[0]):o}const un={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function dn(e){return Array.isArray(e)?e:un[e]}function fn(e,t,n,r={}){if(e=dn(e),t=dn(t),!e||!t)throw new TypeError(`Missing white point to convert ${e?"":"from"}${e||t?"":"/"}${t?"":"to"}`);if(e===t)return n;let i={W1:e,W2:t,XYZ:n,options:r};if(ln.run("chromatic-adaptation-start",i),i.M||(i.W1===un.D65&&i.W2===un.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===un.D50&&i.W2===un.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),ln.run("chromatic-adaptation-end",i),i.M)return cn(i.M,i.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}class hn{constructor(e){this.id=e.id,this.name=e.name,this.base=e.base?hn.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let t=e.coords??this.base.coords;for(let e in t)"name"in t[e]||(t[e].name=e);this.coords=t;let n=e.white??this.base.white??"D65";this.white=dn(n),this.formats=e.formats??{};for(let e in this.formats){let t=this.formats[e];t.type||="function",t.name||=e}this.formats.color?.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace="self"===e.gamutSpace?this:hn.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(e,t)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:pn(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),ln.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=75e-6}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let n=Object.values(this.coords);return e.every((e,r)=>{let i=n[r];if("angle"!==i.type&&i.range){if(Number.isNaN(e))return!0;let[n,r]=i.range;return(void 0===n||e>=n-t)&&(void 0===r||e<=r+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){return this.formats?.color?.id||this.id}get isPolar(){for(let e in this.coords)if("angle"===this.coords[e].type)return!0;return!1}getFormat(e){if("object"==typeof e)return mn(e,this);let t;return t="default"===e?Object.values(this.formats)[0]:this.formats[e],t?(t=mn(t,this),t):null}equals(e){return!!e&&(this===e||this.id===e||this.id===e.id)}to(e,t){if(1===arguments.length){const n=xn(e);[e,t]=[n.space,n.coords]}if(e=hn.get(e),this.equals(e))return t;t=t.map(e=>Number.isNaN(e)?0:e);let n,r,i=this.path,o=e.path;for(let e=0;er;e--)t=i[e].toBase(t);for(let e=r+1;e=0){let e=Object.entries(n.coords)[r];if(e)return{space:n,id:e[0],index:r,...e[1]}}n=hn.get(n);let o=r.toLowerCase(),s=0;for(let e in n.coords){let t=n.coords[e];if(e.toLowerCase()===o||t.name?.toLowerCase()===o)return{space:n,id:e,index:s,...t};s++}throw new TypeError(`No "${r}" coordinate found in ${n.name}. Its coordinates are: ${Object.keys(n.coords).join(", ")}`)}static DEFAULT_FORMAT={type:"functions",name:"color"}}function pn(e){let t=[e];for(let n=e;n=n.base;)t.push(n);return t}function mn(e,{coords:t}={}){if(e.coords&&!e.coordGrammar){e.type||="function",e.name||="color",e.coordGrammar=e.coords.map(e=>e.split("|").map(e=>{let t=(e=e.trim()).match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(t){let e=new String(t[1]);return e.range=[+t[2],+t[3]],e}return e}));let n=Object.entries(t).map(([t,n],r)=>{let i=e.coordGrammar[r][0],o=n.range||n.refRange,s=i.range,a="";return""==i?(s=[0,100],a="%"):""==i&&(a="deg"),{fromRange:o,toRange:s,suffix:a}});e.serializeCoords=(e,t)=>e.map((e,r)=>{let{fromRange:i,toRange:o,suffix:s}=n[r];return i&&o&&(e=rn(i,o,e)),Jt(e,{precision:t,unit:s})})}return e}const gn={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==globalThis?.process?.env?.NODE_ENV?.toLowerCase(),warn:function(e){this.verbose&&globalThis?.console?.warn?.(e)}},vn=new Set(["","",""]);function wn(e,t,n,r){let i=Object.entries(e.coords).map(([e,i],o)=>{let s,a=t.coordGrammar[o],l=r[o],c=l?.type;if(s=l.none?a.find(e=>vn.has(e)):a.find(e=>e==c),!s){let t=i.name||e;throw new TypeError(`${c??l.raw} not allowed for ${t} in ${n}()`)}let u=s.range;""===c&&(u||=[0,1]);let d=i.range||i.refRange;return u&&d&&(r[o]=rn(u,d,r[o])),s});return i}function bn(e,{meta:t}={}){let n={str:String(e)?.trim()};if(ln.run("parse-start",n),n.color)return n.color;if(n.parsed=function(e){if(!e)return;e=e.trim();const t=/^-?[\d.]+$/,n=/%|deg|g?rad|turn$/,r=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let i=e.match(/^([a-z]+)\((.+?)\)$/i);if(i){let e=[];return i[2].replace(r,(r,i)=>{let o=i.match(n),s=i;if(o){let e=o[0],t=s.slice(0,-e.length);"%"===e?(s=new Number(t/100),s.type=""):(s=new Number(t*en[e]),s.type="",s.unit=e)}else t.test(s)?(s=new Number(s),s.type=""):"none"===s&&(s=new Number(NaN),s.none=!0);r.startsWith("/")&&(s=s instanceof Number?s:new Number(s),s.alpha=!0),"object"==typeof s&&s instanceof Number&&(s.raw=i),e.push(s)}),{name:i[1].toLowerCase(),rawName:i[1],rawArgs:i[2],args:e}}}(n.str),n.parsed){let e=n.parsed.name;if("color"===e){let e=n.parsed.args.shift(),r=e.startsWith("--")?e.substring(2):`--${e}`,i=[e,r],o=n.parsed.rawArgs.indexOf("/")>0?n.parsed.args.pop():1;for(let r of hn.all){let s=r.getFormat("color");if(s&&(i.includes(s.id)||s.ids?.filter(e=>i.includes(e)).length)){const i=Object.keys(r.coords).map((e,t)=>n.parsed.args[t]||0);let a;return s.coordGrammar&&(a=wn(r,s,"color",i)),t&&Object.assign(t,{formatId:"color",types:a}),s.id.startsWith("--")&&!e.startsWith("--")&&gn.warn(`${r.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${s.id}) instead of color(${e}).`),e.startsWith("--")&&!s.id.startsWith("--")&&gn.warn(`${r.name} is a standard space and supported in the CSS spec. Use color(${s.id}) instead of prefixed color(${e}).`),{spaceId:r.id,coords:i,alpha:o}}}let s="",a=e in hn.registry?e:r;if(a in hn.registry){let e=hn.registry[a].formats?.color?.id;e&&(s=`Did you mean color(${e})?`)}throw new TypeError(`Cannot parse color(${e}). `+(s||"Missing a plugin?"))}for(let r of hn.all){let i=r.getFormat(e);if(i&&"function"===i.type){let o=1;(i.lastAlpha||tn(n.parsed.args).alpha)&&(o=n.parsed.args.pop());let s,a=n.parsed.args;return i.coordGrammar&&(s=wn(r,i,e,a)),t&&Object.assign(t,{formatId:i.name,types:s}),{spaceId:r.id,coords:a,alpha:o}}}}else for(let e of hn.all)for(let r in e.formats){let i=e.formats[r];if("custom"!==i.type)continue;if(i.test&&!i.test(n.str))continue;let o=i.parse(n.str);if(o)return o.alpha??=1,t&&(t.formatId=r),o}throw new TypeError(`Could not parse ${e} as a color. Missing a plugin?`)}function xn(e){if(Array.isArray(e))return e.map(xn);if(!e)throw new TypeError("Empty color reference");Zt(e)&&(e=bn(e));let t=e.space||e.spaceId;return t instanceof hn||(e.space=hn.get(t)),void 0===e.alpha&&(e.alpha=1),e}const yn=new hn({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]}),Sn=new hn({id:"xyz-d50",name:"XYZ D50",white:"D50",base:yn,fromBase:e=>fn(yn.white,"D50",e),toBase:e=>fn("D50",yn.white,e)}),Cn=216/24389,jn=24/116,kn=24389/27;let In=un.D50;const Mn=new hn({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:In,base:Sn,fromBase(e){let t=e.map((e,t)=>e/In[t]),n=t.map(e=>e>Cn?Math.cbrt(e):(kn*e+16)/116);return[116*n[1]-16,500*(n[0]-n[1]),200*(n[1]-n[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>jn?Math.pow(t[0],3):(116*t[0]-16)/kn,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/kn,t[2]>jn?Math.pow(t[2],3):(116*t[2]-16)/kn].map((e,t)=>e*In[t])},formats:{lab:{coords:[" | "," | [-1,1]"," | [-1,1]"]}}});function En(e){return(e%360+360)%360}const Pn=new hn({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Mn,fromBase(e){let t,[n,r,i]=e;return t=Math.abs(r)<.02&&Math.abs(i)<.02?NaN:180*Math.atan2(i,r)/Math.PI,[n,Math.sqrt(r**2+i**2),En(t)]},toBase(e){let[t,n,r]=e;return n<0&&(n=0),isNaN(r)&&(r=0),[t,n*Math.cos(r*Math.PI/180),n*Math.sin(r*Math.PI/180)]},formats:{lch:{coords:[" | "," | "," | "]}}}),Ln=25**7,Vn=Math.PI,Nn=180/Vn,On=Vn/180;function Rn(e){const t=e*e;return t*t*t*e}function Fn(e,t,{kL:n=1,kC:r=1,kH:i=1}={}){[e,t]=xn([e,t]);let[o,s,a]=Mn.from(e),l=Pn.from(Mn,[o,s,a])[1],[c,u,d]=Mn.from(t),f=Pn.from(Mn,[c,u,d])[1];l<0&&(l=0),f<0&&(f=0);let h=Rn((l+f)/2),p=.5*(1-Math.sqrt(h/(h+Ln))),m=(1+p)*s,g=(1+p)*u,v=Math.sqrt(m**2+a**2),w=Math.sqrt(g**2+d**2),b=0===m&&0===a?0:Math.atan2(a,m),x=0===g&&0===d?0:Math.atan2(d,g);b<0&&(b+=2*Vn),x<0&&(x+=2*Vn),b*=Nn,x*=Nn;let y,_=c-o,S=w-v,C=x-b,j=b+x,k=Math.abs(C);v*w===0?y=0:k<=180?y=C:C>180?y=C-360:C<-180?y=C+360:gn.warn("the unthinkable has happened");let I,M=2*Math.sqrt(w*v)*Math.sin(y*On/2),E=(o+c)/2,P=(v+w)/2,L=Rn(P);I=v*w===0?j:k<=180?j/2:j<360?(j+360)/2:(j-360)/2;let V=(E-50)**2,N=1+.015*V/Math.sqrt(20+V),O=1+.045*P,R=1;R-=.17*Math.cos((I-30)*On),R+=.24*Math.cos(2*I*On),R+=.32*Math.cos((3*I+6)*On),R-=.2*Math.cos((4*I-63)*On);let F=1+.015*P*R,T=30*Math.exp(-1*((I-275)/25)**2),A=2*Math.sqrt(L/(L+Ln)),D=(_/(n*N))**2;return D+=(S/(r*O))**2,D+=(M/(i*F))**2,D+=-1*Math.sin(2*T*On)*A*(S/(r*O))*(M/(i*F)),Math.sqrt(D)}const Tn=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],An=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],Dn=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],Bn=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],zn=new hn({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:yn,fromBase(e){let t=cn(Tn,e).map(e=>Math.cbrt(e));return cn(Dn,t)},toBase(e){let t=cn(Bn,e).map(e=>e**3);return cn(An,t)},formats:{oklab:{coords:[" | "," | [-1,1]"," | [-1,1]"]}}});function $n(e,t){[e,t]=xn([e,t]);let[n,r,i]=zn.from(e),[o,s,a]=zn.from(t),l=n-o,c=r-s,u=i-a;return Math.sqrt(l**2+c**2+u**2)}function Hn(e,t,{epsilon:n=75e-6}={}){e=xn(e),t||(t=e.space),t=hn.get(t);let r=e.coords;return t!==e.space&&(r=t.from(e)),t.inGamut(r,{epsilon:n})}function Wn(e,t){return e=xn(e),!t||e.space.equals(t)?e.coords.slice():(t=hn.get(t)).from(e)}function qn(e,t){e=xn(e);let{space:n,index:r}=hn.resolveCoord(t,e.space);return Wn(e,n)[r]}function Un(e,t,n){return e=xn(e),t=hn.get(t),e.coords=t.to(e.space,n),e}function Gn(e,t,n){if(e=xn(e),2===arguments.length&&"object"===Xt(arguments[1])){let t=arguments[1];for(let n in t)Gn(e,n,t[n])}else{"function"==typeof n&&(n=n(qn(e,t)));let{space:r,index:i}=hn.resolveCoord(t,e.space),o=Wn(e,r);o[i]=n,Un(e,r,o)}return e}function Kn(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}Un.returns="color",Gn.returns="color";const Yn=Math.PI/180,Zn=new hn({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:yn,fromBase:e=>e.map(e=>Math.max(203*e,0)),toBase:e=>e.map(e=>Math.max(e/203,0))}),Xn=1.15,Jn=.66,Qn=2610/16384,er=16384/2610,tr=.8359375,nr=2413/128,rr=18.6875,ir=1.7*2523/32,or=32/(1.7*2523),sr=-.56,ar=16295499532821565e-27,lr=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],cr=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],ur=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],dr=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]],fr=new hn({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Zn,fromBase(e){let[t,n,r]=e,i=cn(lr,[Xn*t-(Xn-1)*r,Jn*n-(Jn-1)*t,r]).map(function(e){return((tr+nr*(e/1e4)**Qn)/(1+rr*(e/1e4)**Qn))**ir}),[o,s,a]=cn(ur,i);return[(1+sr)*o/(1+sr*o)-ar,s,a]},toBase(e){let[t,n,r]=e,i=cn(dr,[(t+ar)/(1+sr-sr*(t+ar)),n,r]).map(function(e){return 1e4*((tr-e**or)/(rr*e**or-nr))**er}),[o,s,a]=cn(cr,i),l=(o+(Xn-1)*a)/Xn;return[l,(s+(Jn-1)*l)/Jn,a]},formats:{color:{coords:[" | "," | [-1,1]"," | [-1,1]"]}}}),hr=new hn({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:fr,fromBase(e){let t,[n,r,i]=e;const o=2e-4;return t=Math.abs(r)[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]}),pr=.8359375,mr=2413/128,gr=18.6875,vr=2610/16384,wr=16384/2610,br=32/2523,xr=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],yr=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],_r=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],Sr=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],Cr=new hn({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:Zn,fromBase:e=>function(e){let t=e.map(function(e){return((pr+mr*(e/1e4)**vr)/(1+gr*(e/1e4)**vr))**78.84375});return cn(yr,t)}(cn(xr,e)),toBase(e){let t=function(e){return cn(_r,e).map(function(e){return 1e4*(Math.max(e**br-pr,0)/(mr-gr*e**br))**wr})}(e);return cn(Sr,t)}}),jr=un.D65,kr=1/.42,Ir=2*Math.PI,Mr=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],Er=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],Pr=[[460,451,288],[460,-891,-261],[460,-220,-6300]],Lr={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Vr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},Nr=180/Math.PI,Or=Math.PI/180;function Rr(e,t){const n=e.map(e=>{const n=sn(t*Math.abs(e)*.01,.42);return 400*on(n,e)/(n+27.13)});return n}function Fr(e,t,n,r,i){const o={};o.discounting=i,o.refWhite=e,o.surround=r;const s=e.map(e=>100*e);o.la=t,o.yb=n;const a=s[1],l=cn(Mr,s),c=(r=Lr[o.surround])[0];o.c=r[1],o.nc=r[2];const u=(1/(5*o.la+1))**4;o.fl=u*o.la+.1*(1-u)*(1-u)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/a,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const d=i?1:Math.max(Math.min(c*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=l.map(e=>nn(1,a/e,d)),o.dRgbInv=o.dRgb.map(e=>1/e);const f=l.map((e,t)=>e*o.dRgb[t]),h=Rr(f,o.fl);return o.aW=o.nbb*(2*h[0]+h[1]+.05*h[2]),o}const Tr=Fr(jr,64/Math.PI*.2,20,"average",!1);function Ar(e,t){if(!(void 0!==e.J^void 0!==e.Q))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(void 0!==e.C^void 0!==e.M^void 0!==e.s))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(void 0!==e.h^void 0!==e.H))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(0===e.J||0===e.Q)return[0,0,0];let n=0;n=void 0!==e.h?En(e.h)*Or:function(e){let t=(e%400+400)%400;const n=Math.floor(.01*t);t%=100;const[r,i]=Vr.h.slice(n,n+2),[o,s]=Vr.e.slice(n,n+2);return En((t*(s*r-o*i)-100*r*s)/(t*(s-o)-100*s))}(e.H)*Or;const r=Math.cos(n),i=Math.sin(n);let o=0;void 0!==e.J?o=.1*sn(e.J,.5):void 0!==e.Q&&(o=.25*t.c*e.Q/((t.aW+4)*t.flRoot));let s=0;void 0!==e.C?s=e.C/o:void 0!==e.M?s=e.M/t.flRoot/o:void 0!==e.s&&(s=4e-4*e.s**2*(t.aW+4)/t.c);const a=sn(s*Math.pow(1.64-Math.pow(.29,t.n),-.73),10/9),l=.25*(Math.cos(n+2)+3.8),c=t.aW*sn(o,2/t.c/t.z),u=5e4/13*t.nc*t.ncb*l,d=c/t.nbb,f=23*(d+.305)*an(a,23*u+a*(11*r+108*i)),h=function(e,t){const n=100/t*2588.068098016295;return e.map(e=>{const t=Math.abs(e);return on(n*sn(t/(400-t),kr),e)})}(cn(Pr,[d,f*r,f*i]).map(e=>1*e/1403),t.fl);return cn(Er,h.map((e,n)=>e*t.dRgbInv[n])).map(e=>e/100)}function Dr(e,t){const n=e.map(e=>100*e),r=Rr(cn(Mr,n).map((e,n)=>e*t.dRgb[n]),t.fl),i=r[0]+(-12*r[1]+r[2])/11,o=(r[0]+r[1]-2*r[2])/9,s=(Math.atan2(o,i)%Ir+Ir)%Ir,a=.25*(Math.cos(s+2)+3.8),l=sn(5e4/13*t.nc*t.ncb*an(a*Math.sqrt(i**2+o**2),r[0]+r[1]+1.05*r[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),c=sn(t.nbb*(2*r[0]+r[1]+.05*r[2])/t.aW,.5*t.c*t.z),u=100*sn(c,2),d=4/t.c*c*(t.aW+4)*t.flRoot,f=l*c,h=f*t.flRoot,p=En(s*Nr),m=function(e){let t=En(e);t<=Vr.h[0]&&(t+=360);const n=function(e,t,n=0,r=e.length){for(;n>1;e[i]Ar({J:e[0],M:e[1],h:e[2]},Tr)});const Br=216/24389,zr=24389/27;function $r(e){return e>8?Math.pow((e+16)/116,3):e/zr}const Hr=Fr(un.D65,200/Math.PI*$r(50),100*$r(50),"average",!1),Wr=new hn({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:yn,fromBase:e=>function(e){const t=function(e){return 116*(e>Br?Math.cbrt(e):(zr*e+16)/116)-16}(e[1]);if(0===t)return[0,0,0];const n=Dr(e,Hr);return[En(n.h),n.C,t]}(e),toBase:e=>function(e,t){let[n,r,i]=e,o=[],s=0;if(0===i)return[0,0,0];let a=$r(i);s=i>0?.00379058511492914*i**2+.608983189401032*i+.9155088574762233:9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;let l=0,c=1/0,u=s;for(;l<=15;){o=Ar({J:s,C:r,h:n},t);const e=Math.abs(o[1]-a);if(e | "," | "," | "]}}}),qr=(Math.PI,Math.PI/180),Ur=[1,.007,.0228];function Gr(e){e[1]<0&&(e=Wr.fromBase(Wr.toBase(e)));const t=Math.log(Math.max(1+Ur[2]*e[1]*Hr.flRoot,1))/Ur[2],n=e[0]*qr,r=t*Math.cos(n),i=t*Math.sin(n);return[e[2],r,i]}const Kr={deltaE76:function(e,t){return function(e,t,n="lab"){let r=(n=hn.get(n)).from(e),i=n.from(t);return Math.sqrt(r.reduce((e,t,n)=>{let r=i[n];return isNaN(t)||isNaN(r)?e:e+(r-t)**2},0))}(e,t,"lab")},deltaECMC:function(e,t,{l:n=2,c:r=1}={}){[e,t]=xn([e,t]);let[i,o,s]=Mn.from(e),[,a,l]=Pn.from(Mn,[i,o,s]),[c,u,d]=Mn.from(t),f=Pn.from(Mn,[c,u,d])[1];a<0&&(a=0),f<0&&(f=0);let h=i-c,p=a-f,m=(o-u)**2+(s-d)**2-p**2,g=.511;i>=16&&(g=.040975*i/(1+.01765*i));let v,w=.0638*a/(1+.0131*a)+.638;Number.isNaN(l)&&(l=0),v=l>=164&&l<=345?.56+Math.abs(.2*Math.cos((l+168)*Yn)):.36+Math.abs(.4*Math.cos((l+35)*Yn));let b=Math.pow(a,4),x=Math.sqrt(b/(b+1900)),y=(h/(n*g))**2;return y+=(p/(r*w))**2,y+=m/(w*(x*v+1-x))**2,Math.sqrt(y)},deltaE2000:Fn,deltaEJz:function(e,t){[e,t]=xn([e,t]);let[n,r,i]=hr.from(e),[o,s,a]=hr.from(t),l=n-o,c=r-s;Number.isNaN(i)&&Number.isNaN(a)?(i=0,a=0):Number.isNaN(i)?i=a:Number.isNaN(a)&&(a=i);let u=i-a,d=2*Math.sqrt(r*s)*Math.sin(u/2*(Math.PI/180));return Math.sqrt(l**2+c**2+d**2)},deltaEITP:function(e,t){[e,t]=xn([e,t]);let[n,r,i]=Cr.from(e),[o,s,a]=Cr.from(t);return 720*Math.sqrt((n-o)**2+.25*(r-s)**2+(i-a)**2)},deltaEOK:$n,deltaEHCT:function(e,t){[e,t]=xn([e,t]);let[n,r,i]=Gr(Wr.from(e)),[o,s,a]=Gr(Wr.from(t));return Math.sqrt((n-o)**2+(r-s)**2+(i-a)**2)}},Yr={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function Zr(e,{method:t=gn.gamut_mapping,space:n,deltaEMethod:r="",jnd:i=2,blackWhiteClamp:o={}}={}){if(e=xn(e),Zt(arguments[1])?n=arguments[1]:n||(n=e.space),Hn(e,n=hn.get(n),{epsilon:0}))return e;let s;if("css"===t)s=function(e,{space:t}={}){const n=.02,r=1e-4;e=xn(e),t||(t=e.space),t=hn.get(t);const i=hn.get("oklch");if(t.isUnbounded)return Jr(e,t);const o=Jr(e,i);let s=o.coords[0];if(s>=1){const n=Jr(Xr.WHITE,t);return n.alpha=e.alpha,Jr(n,t)}if(s<=0){const n=Jr(Xr.BLACK,t);return n.alpha=e.alpha,Jr(n,t)}if(Hn(o,t,{epsilon:0}))return Jr(o,t);function a(e){const n=Jr(e,t),r=Object.values(t.coords);return n.coords=n.coords.map((e,t)=>{if("range"in r[t]){const[n,i]=r[t].range;return function(e,t,n){return Math.max(Math.min(n,t),e)}(n,e,i)}return e}),n}let l=0,c=o.coords[1],u=!0,d=Kn(o),f=a(d),h=$n(f,d);if(hr;){const e=(l+c)/2;if(d.coords[1]=e,u&&Hn(d,t,{epsilon:0}))l=e;else if(f=a(d),h=$n(f,d),hi){if(3===Object.keys(o).length){let t=hn.resolveCoord(o.channel),n=qn(Jr(e,t.space),t.id);if(Qt(n)&&(n=0),n>=o.max)return Jr({space:"xyz-d65",coords:un.D65},e.space);if(n<=o.min)return Jr({space:"xyz-d65",coords:[0,0,0]},e.space)}let r=hn.resolveCoord(t),l=r.space,c=r.id,u=Jr(e,l);u.coords.forEach((e,t)=>{Qt(e)&&(u.coords[t]=0)});let d=(r.range||r.refRange)[0],f=function(e){const t=e?Math.floor(Math.log10(Math.abs(e))):0;return Math.max(parseFloat("1e"+(t-2)),1e-6)}(i),h=d,p=qn(u,c);for(;p-h>f;){let e=Kn(u);e=Zr(e,{space:n,method:"clip"}),a(u,e)-ie.range||[]);s.coords=s.coords.map((t,n)=>{let[r,i]=e[n];return void 0!==r&&(t=Math.max(r,t)),void 0!==i&&(t=Math.min(t,i)),t})}}return n!==e.space&&(s=Jr(s,e.space)),e.coords=s.coords,e}Zr.returns="color";const Xr={WHITE:{space:zn,coords:[1,0,0]},BLACK:{space:zn,coords:[0,0,0]}};function Jr(e,t,{inGamut:n}={}){e=xn(e);let r=(t=hn.get(t)).from(e),i={space:t,coords:r,alpha:e.alpha};return n&&(i=Zr(i,!0===n?void 0:n)),i}Jr.returns="color";class Qr extends hn{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=yn),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??=t=>{let n=cn(e.toXYZ_M,t);return this.white!==this.base.white&&(n=fn(this.white,this.base.white,n)),n},e.fromBase??=t=>(t=fn(this.base.white,this.white,t),cn(e.fromXYZ_M,t))),e.referred??="display",super(e)}}const ei=new Qr({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],fromXYZ_M:[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]]}),ti={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[.6,50/255,.8],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,.6],lightslategrey:[119/255,136/255,.6],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[.4,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,.8],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[.4,.2,.6],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let ni=Array(3).fill(" | [0, 255]"),ri=Array(3).fill("[0, 255]");const ii=new Qr({id:"srgb",name:"sRGB",base:ei,fromBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n>.0031308?t*(1.055*n**(1/2.4)-.055):12.92*e}),toBase:e=>e.map(e=>{let t=e<0?-1:1,n=e*t;return n<=.04045?e/12.92:t*((n+.055)/1.055)**2.4}),formats:{rgb:{coords:ni},rgb_number:{name:"rgb",commas:!0,coords:ri,noAlpha:!0},color:{},rgba:{coords:ni,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:ri},hex:{type:"custom",toGamut:!0,test:e=>/^#([a-f0-9]{3,4}){1,2}$/i.test(e),parse(e){e.length<=5&&(e=e.replace(/[a-f0-9]/gi,"$&$&"));let t=[];return e.replace(/[a-f0-9]{2}/gi,e=>{t.push(parseInt(e,16)/255)}),{spaceId:"srgb",coords:t.slice(0,3),alpha:t.slice(3)[0]}},serialize:(e,t,{collapse:n=!0}={})=>{t<1&&e.push(t),e=e.map(e=>Math.round(255*e));let r=n&&e.every(e=>e%17==0),i=e.map(e=>r?(e/17).toString(16):e.toString(16).padStart(2,"0")).join("");return"#"+i}},keyword:{type:"custom",test:e=>/^[a-z]+$/i.test(e),parse(e){let t={spaceId:"srgb",coords:null,alpha:1};if("transparent"===(e=e.toLowerCase())?(t.coords=ti.black,t.alpha=0):t.coords=ti[e],t.coords)return t}}}}),oi=new hn({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:ii,fromBase:e=>{let t=Math.max(...e),n=Math.min(...e),[r,i,o]=e,[s,a,l]=[NaN,0,(n+t)/2],c=t-n;if(0!==c){switch(a=0===l||1===l?0:(t-l)/Math.min(l,1-l),t){case r:s=(i-o)/c+(i=360&&(s-=360),[s,100*a,100*l]},toBase:e=>{let[t,n,r]=e;function i(e){let i=(e+t/30)%12,o=n*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(i-3,9-i,1))}return t%=360,t<0&&(t+=360),n/=100,r/=100,[i(0),i(8),i(4)]},formats:{hsl:{coords:[" | ","",""]},hsla:{coords:[" | ","",""],commas:!0,lastAlpha:!0}}});function si(e,{precision:t=gn.precision,format:n="default",inGamut:r=!0,...i}={}){let o,s=n;n=(e=xn(e)).space.getFormat(n)??e.space.getFormat("default")??hn.DEFAULT_FORMAT;let a=e.coords.slice();if(r||=n.toGamut,r&&!Hn(e)&&(a=Zr(Kn(e),!0===r?void 0:r).coords),"custom"===n.type){if(i.precision=t,!n.serialize)throw new TypeError(`format ${s} can only be used to parse colors, not for serialization`);o=n.serialize(a,e.alpha,i)}else{let r=n.name||"color";n.serializeCoords?a=n.serializeCoords(a,t):null!==t&&(a=a.map(e=>Jt(e,{precision:t})));let i=[...a];if("color"===r){let t=n.id||n.ids?.[0]||e.space.id;i.unshift(t)}let s=e.alpha;null!==t&&(s=Jt(s,{precision:t}));let l=e.alpha>=1||n.noAlpha?"":`${n.commas?",":" /"} ${s}`;o=`${r}(${i.join(n.commas?", ":" ")}${l})`}return o}function ai(e,t){var n,r,i=0;function o(){var o,s,a=n,l=arguments.length;e:for(;a;){if(a.args.length===arguments.length){for(s=0;s | "," | [0,1]"," | "]}}}),ci=new Qr({id:"p3-linear",cssId:"--display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],fromXYZ_M:[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]]}),ui=new Qr({id:"p3",cssId:"display-p3",name:"P3",base:ci,fromBase:ii.fromBase,toBase:ii.toBase});hn.register(ii),hn.register(li),hn.register(ui),hn.register(oi);const di={"--wpds-border-radius-x-small":{".":"1px"},"--wpds-border-radius-small":{".":"2px"},"--wpds-border-radius-medium":{".":"4px"},"--wpds-border-radius-large":{".":"8px"},"--wpds-border-width-focus":{".":"2px","high-dpi":"1.5px"},"--wpds-color-bg-surface-neutral":{".":"var(--wpds-color-private-bg-surface2)"},"--wpds-color-bg-surface-neutral-strong":{".":"var(--wpds-color-private-bg-surface3)"},"--wpds-color-bg-surface-neutral-weak":{".":"var(--wpds-color-private-bg-surface1)"},"--wpds-color-bg-surface-brand":{".":"var(--wpds-color-private-primary-surface1)"},"--wpds-color-bg-surface-success":{".":"var(--wpds-color-private-success-surface4)"},"--wpds-color-bg-surface-success-weak":{".":"var(--wpds-color-private-success-surface2)"},"--wpds-color-bg-surface-info":{".":"var(--wpds-color-private-info-surface4)"},"--wpds-color-bg-surface-info-weak":{".":"var(--wpds-color-private-info-surface2)"},"--wpds-color-bg-surface-warning":{".":"var(--wpds-color-private-warning-surface4)"},"--wpds-color-bg-surface-warning-weak":{".":"var(--wpds-color-private-warning-surface2)"},"--wpds-color-bg-surface-caution":{".":"var(--wpds-color-private-caution-surface4)"},"--wpds-color-bg-surface-caution-weak":{".":"var(--wpds-color-private-caution-surface2)"},"--wpds-color-bg-surface-error":{".":"var(--wpds-color-private-error-surface4)"},"--wpds-color-bg-surface-error-weak":{".":"var(--wpds-color-private-error-surface2)"},"--wpds-color-bg-interactive-neutral":{".":"#00000000"},"--wpds-color-bg-interactive-neutral-active":{".":"var(--wpds-color-private-bg-surface4)"},"--wpds-color-bg-interactive-neutral-disabled":{".":"var(--wpds-color-private-bg-surface5)"},"--wpds-color-bg-interactive-neutral-strong":{".":"var(--wpds-color-private-bg-bg-fill-inverted1)"},"--wpds-color-bg-interactive-neutral-strong-active":{".":"var(--wpds-color-private-bg-bg-fill-inverted2)"},"--wpds-color-bg-interactive-neutral-strong-disabled":{".":"var(--wpds-color-private-bg-surface6)"},"--wpds-color-bg-interactive-neutral-weak":{".":"#00000000"},"--wpds-color-bg-interactive-neutral-weak-active":{".":"var(--wpds-color-private-bg-surface4)"},"--wpds-color-bg-interactive-neutral-weak-disabled":{".":"var(--wpds-color-private-bg-surface5)"},"--wpds-color-bg-interactive-brand":{".":"#00000000"},"--wpds-color-bg-interactive-brand-active":{".":"var(--wpds-color-private-primary-surface2)"},"--wpds-color-bg-interactive-brand-disabled":{".":"var(--wpds-color-private-bg-surface5)"},"--wpds-color-bg-interactive-brand-strong":{".":"var(--wpds-color-private-primary-bg-fill1)"},"--wpds-color-bg-interactive-brand-strong-active":{".":"var(--wpds-color-private-primary-bg-fill2)"},"--wpds-color-bg-interactive-brand-strong-disabled":{".":"var(--wpds-color-private-bg-surface6)"},"--wpds-color-bg-interactive-brand-weak":{".":"#00000000"},"--wpds-color-bg-interactive-brand-weak-active":{".":"var(--wpds-color-private-primary-surface4)"},"--wpds-color-bg-interactive-brand-weak-disabled":{".":"var(--wpds-color-private-bg-surface5)"},"--wpds-color-bg-track-neutral-weak":{".":"var(--wpds-color-private-bg-stroke1)"},"--wpds-color-bg-track-neutral":{".":"var(--wpds-color-private-bg-stroke2)"},"--wpds-color-bg-thumb-neutral-weak":{".":"var(--wpds-color-private-bg-stroke3)"},"--wpds-color-bg-thumb-neutral-weak-active":{".":"var(--wpds-color-private-bg-stroke4)"},"--wpds-color-bg-thumb-brand":{".":"var(--wpds-color-private-primary-stroke3)"},"--wpds-color-bg-thumb-brand-active":{".":"var(--wpds-color-private-primary-stroke3)"},"--wpds-color-bg-thumb-brand-disabled":{".":"var(--wpds-color-private-bg-stroke2)"},"--wpds-color-fg-content-neutral":{".":"var(--wpds-color-private-bg-fg-surface4)"},"--wpds-color-fg-content-neutral-weak":{".":"var(--wpds-color-private-bg-fg-surface3)"},"--wpds-color-fg-content-success":{".":"var(--wpds-color-private-success-fg-surface4)"},"--wpds-color-fg-content-success-weak":{".":"var(--wpds-color-private-success-fg-surface3)"},"--wpds-color-fg-content-info":{".":"var(--wpds-color-private-info-fg-surface4)"},"--wpds-color-fg-content-info-weak":{".":"var(--wpds-color-private-info-fg-surface3)"},"--wpds-color-fg-content-warning":{".":"var(--wpds-color-private-warning-fg-surface4)"},"--wpds-color-fg-content-warning-weak":{".":"var(--wpds-color-private-warning-fg-surface3)"},"--wpds-color-fg-content-caution":{".":"var(--wpds-color-private-caution-fg-surface4)"},"--wpds-color-fg-content-caution-weak":{".":"var(--wpds-color-private-caution-fg-surface3)"},"--wpds-color-fg-content-error":{".":"var(--wpds-color-private-error-fg-surface4)"},"--wpds-color-fg-content-error-weak":{".":"var(--wpds-color-private-error-fg-surface3)"},"--wpds-color-fg-interactive-neutral":{".":"var(--wpds-color-private-bg-fg-surface4)"},"--wpds-color-fg-interactive-neutral-active":{".":"var(--wpds-color-private-bg-fg-surface4)"},"--wpds-color-fg-interactive-neutral-disabled":{".":"var(--wpds-color-private-bg-fg-surface2)"},"--wpds-color-fg-interactive-neutral-strong":{".":"var(--wpds-color-private-bg-fg-fill-inverted)"},"--wpds-color-fg-interactive-neutral-strong-active":{".":"var(--wpds-color-private-bg-fg-fill-inverted)"},"--wpds-color-fg-interactive-neutral-strong-disabled":{".":"var(--wpds-color-private-bg-fg-surface3)"},"--wpds-color-fg-interactive-neutral-weak":{".":"var(--wpds-color-private-bg-fg-surface3)"},"--wpds-color-fg-interactive-neutral-weak-disabled":{".":"var(--wpds-color-private-bg-fg-surface2)"},"--wpds-color-fg-interactive-brand":{".":"var(--wpds-color-private-primary-fg-surface3)"},"--wpds-color-fg-interactive-brand-active":{".":"var(--wpds-color-private-primary-fg-surface3)"},"--wpds-color-fg-interactive-brand-disabled":{".":"var(--wpds-color-private-bg-fg-surface2)"},"--wpds-color-fg-interactive-brand-strong":{".":"var(--wpds-color-private-primary-fg-fill)"},"--wpds-color-fg-interactive-brand-strong-active":{".":"var(--wpds-color-private-primary-fg-fill)"},"--wpds-color-fg-interactive-brand-strong-disabled":{".":"var(--wpds-color-private-bg-fg-surface3)"},"--wpds-color-stroke-surface-neutral":{".":"var(--wpds-color-private-bg-stroke2)"},"--wpds-color-stroke-surface-neutral-weak":{".":"var(--wpds-color-private-bg-stroke1)"},"--wpds-color-stroke-surface-neutral-strong":{".":"var(--wpds-color-private-bg-stroke3)"},"--wpds-color-stroke-surface-brand":{".":"var(--wpds-color-private-primary-stroke1)"},"--wpds-color-stroke-surface-brand-strong":{".":"var(--wpds-color-private-primary-stroke3)"},"--wpds-color-stroke-surface-success":{".":"var(--wpds-color-private-success-stroke1)"},"--wpds-color-stroke-surface-success-strong":{".":"var(--wpds-color-private-success-stroke3)"},"--wpds-color-stroke-surface-info":{".":"var(--wpds-color-private-info-stroke1)"},"--wpds-color-stroke-surface-info-strong":{".":"var(--wpds-color-private-info-stroke3)"},"--wpds-color-stroke-surface-warning":{".":"var(--wpds-color-private-warning-stroke1)"},"--wpds-color-stroke-surface-warning-strong":{".":"var(--wpds-color-private-warning-stroke3)"},"--wpds-color-stroke-surface-error":{".":"var(--wpds-color-private-error-stroke1)"},"--wpds-color-stroke-surface-error-strong":{".":"var(--wpds-color-private-error-stroke3)"},"--wpds-color-stroke-interactive-neutral":{".":"var(--wpds-color-private-bg-stroke3)"},"--wpds-color-stroke-interactive-neutral-active":{".":"var(--wpds-color-private-bg-stroke4)"},"--wpds-color-stroke-interactive-neutral-disabled":{".":"var(--wpds-color-private-bg-stroke2)"},"--wpds-color-stroke-interactive-neutral-strong":{".":"var(--wpds-color-private-bg-stroke4)"},"--wpds-color-stroke-interactive-brand":{".":"var(--wpds-color-private-primary-stroke3)"},"--wpds-color-stroke-interactive-brand-active":{".":"var(--wpds-color-private-primary-stroke4)"},"--wpds-color-stroke-interactive-brand-disabled":{".":"var(--wpds-color-private-bg-stroke2)"},"--wpds-color-stroke-interactive-error-strong":{".":"var(--wpds-color-private-error-stroke3)"},"--wpds-color-stroke-focus-brand":{".":"var(--wpds-color-private-primary-stroke3)"},"--wpds-elevation-x-small":{".":"0 1px 1px 0 #00000008, 0 1px 2px 0 #00000005, 0 3px 3px 0 #00000005, 0 4px 4px 0 #00000003"},"--wpds-elevation-small":{".":"0 1px 2px 0 #0000000d, 0 2px 3px 0 #0000000a, 0 6px 6px 0 #00000008, 0 8px 8px 0 #00000005"},"--wpds-elevation-medium":{".":"0 2px 3px 0 #0000000d, 0 4px 5px 0 #0000000a, 0 12px 12px 0 #00000008, 0 16px 16px 0 #00000005"},"--wpds-elevation-large":{".":"0 5px 15px 0 #00000014, 0 15px 27px 0 #00000012, 0 30px 36px 0 #0000000a, 0 50px 43px 0 #00000005"},"--wpds-spacing-05":{".":"4px"},"--wpds-spacing-10":{".":"8px"},"--wpds-spacing-15":{".":"12px"},"--wpds-spacing-20":{".":"16px"},"--wpds-spacing-30":{".":"24px"},"--wpds-spacing-40":{".":"32px"},"--wpds-spacing-50":{".":"40px"},"--wpds-spacing-60":{".":"48px"},"--wpds-spacing-70":{".":"56px"},"--wpds-spacing-80":{".":"64px"},"--wpds-font-family-heading":{".":'-apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif'},"--wpds-font-family-body":{".":'-apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif'},"--wpds-font-family-mono":{".":'"Menlo", "Consolas", monaco, monospace'},"--wpds-font-size-x-small":{".":"11px"},"--wpds-font-size-small":{".":"12px"},"--wpds-font-size-medium":{".":"13px"},"--wpds-font-size-large":{".":"15px"},"--wpds-font-size-x-large":{".":"20px"},"--wpds-font-size-2x-large":{".":"32px"},"--wpds-font-line-height-x-small":{".":"16px"},"--wpds-font-line-height-small":{".":"20px"},"--wpds-font-line-height-medium":{".":"24px"},"--wpds-font-line-height-large":{".":"28px"},"--wpds-font-line-height-x-large":{".":"32px"},"--wpds-font-line-height-2x-large":{".":"40px"}};function fi(e){return qn(e,[yn,"y"])}function hi(e){return si(Jr(e,ii),{format:"hex",inGamut:!0})}function pi(e,t){return function(e,t){e=xn(e),t=xn(t);let n=Math.max(fi(e),0),r=Math.max(fi(t),0);return r>n&&([n,r]=[r,n]),(n+.05)/(r+.05)}(e,t)}const mi=Jr("white",li),gi=Jr("black",li),vi={lighter:{min:.2,max:.4},darker:{min:.75,max:.98}},wi={bg:"#f8f8f8",primary:"#3858e9",info:"#0090ff",success:"#4ab866",caution:"#f0d149",warning:"#f0b849",error:"#cc1818"},bi=e=>Jr(Zr(e,{space:ui,method:"css"}),li);function xi(e,t){return pi(e,gi)>pi(e,mi)+(t?3.1:0)?{better:"darker",worse:"lighter"}:{better:"lighter",worse:"darker"}}function yi(e){return 1===e?1:e+.05}function _i(e,t){const n=vi[t];return Math.max(n.min,Math.min(n.max,e))}function Si(e){return e<0?0:e>1?1:e}function Ci(e){let t=e%360;return t<0&&(t+=360),t}function ji(e){const t=Si(e);return.5-.5*Math.cos(Math.PI*t)}const ki=new Map;function Ii(e,t){return Math.round(e/t)*t}function Mi(e,t,n,r){const i=function(e,t,n,r){return`${n}|L:${Ii(e,.001)}|H:${Ii(Ci(t),.1)}|cap:${Ii(r,.001)}`}(e,t,n===ui?"p3":"srgb",r),o=ki.get(i);if("number"==typeof o)return o;const s=function(e,t,n,r){let i=0,o=r,s=0;const a=Si(e),l=Ci(t);for(let e=0;e<18;e++){const e=(i+o)/2;Hn({spaceId:"oklch",coords:[a,e,l]},n)?(s=e,i=e):o=e}return s}(e,t,n,r);return ki.set(i,s),s}function Ei(e,t,n,r,{lightnessConstraint:i,taperChromaOptions:o,strict:s=!0}={}){if(n<=1)return{color:t,reached:!0,achieved:1};function a(e){let n=e,r=qn(t,[li,"c"]);if(o){const e=function(e,t,n={}){var r,i,o,s,a,l,c,u,d;const f="p3"===(null!==(r=n.gamut)&&void 0!==r?r:"p3")?ui:ii,h=null!==(i=n.alpha)&&void 0!==i?i:.65,p=null!==(o=n.carry)&&void 0!==o?o:.5,m=null!==(s=n.cUpperBound)&&void 0!==s?s:.45,g=null!==(a=n.radiusLight)&&void 0!==a?a:.2,v=null!==(l=n.radiusDark)&&void 0!==l?l:.2,w=null!==(c=n.kLight)&&void 0!==c?c:.85,b=null!==(u=n.kDark)&&void 0!==u?u:.85,x=null!==(d=n.achromaEpsilon)&&void 0!==d?d:.005,y=Math.max(0,qn(e,[li,"c"]));let _=Number(qn(e,[li,"h"]));const S=y0?k:1e-6));const E=h*I*Math.pow(M,Si(p)),P=function(e,t,n){const r=t-e;if(r>=0){const e=n.radiusLight>0?Math.abs(r)/n.radiusLight:1,t=ji(e>1?1:e);return 1-(1-n.kLight)*t}const i=n.radiusDark>0?Math.abs(r)/n.radiusDark:1,o=ji(i>1?1:i);return 1-(1-n.kDark)*o}(j,t,{radiusLight:g,radiusDark:v,kLight:w,kDark:b});let L=E*P;const V=Si(t);return Hn({spaceId:"oklch",coords:[V,L,_]},f)||(L=Mi(V,_,f,Math.min(L,m))),L=Math.min(L,y),{l:V,c:L}}(t,n,o);if(!("l"in e)||!("c"in e))return e;n=e.l,r=e.c}return bi({spaceId:"oklch",coords:[n,r,qn(t,[li,"h"])]})}if(i){const t=a(i.value),r=pi(e,t);if("force"===i.type||r>=n)return{color:t,reached:r>=n,achieved:r}}const l="lighter"===r?1:0,c="lighter"===r?mi:gi,u=pi(e,c);if(u=n?(p=t,m=w,g&&(f=(f+n)/2),g=!0,h=!1):(d=t,f=w,h&&(m=(m+n)/2),h=!0,g=!1)}return{color:v,reached:!0,achieved:w}}function Pi({seed:e,sortedSteps:t,config:n,mainDir:r,oppDir:i,pinLightness:o}){const s={};let a=!0,l="lighter",c=0;const u=new Map;u.set("seed",e);for(const d of t){const{contrast:f,lightness:h,taperChromaOptions:p,sameAsIfPossible:m}=n[d],g=u.get(f.reference);if(!g)throw new Error(`Reference color for step ${d} not found: ${f.reference}`);if(m){const _=u.get(m);if(_&&pi(g,_)>=yi(f.target)){u.set(d,_),s[d]={color:hi(_),warning:!1};continue}}function v(e,t){return"main"===t?r:"opposite"===t?i:"best"===t?xi(e,f.preferLighter).better:t}const w=v(g,f.followDirection),b=yi(f.target);let x;o?.stepName===d?x={value:o.value,type:"force"}:h&&(x={value:h(w),type:"onlyIfSucceeds"});const y=Ei(g,e,b,w,{strict:!1,lightnessConstraint:x,taperChromaOptions:p});if(!y.reached&&!f.ignoreWhenAdjustingSeed){a=!1;const S=(b-y.achieved)*(1/pi(e,g));S>c&&(c=S,l=w)}u.set(d,y.color),s[d]={color:hi(y.color),warning:!f.ignoreWhenAdjustingSeed&&!y.reached}}return{rampResults:s,SATISFIED_ALL_CONTRAST_REQUIREMENTS:a,UNSATISFIED_DIRECTION:l}}function Li(e,t,{mainDirection:n,pinLightness:r,rescaleToFitContrastTargets:i=!0}={}){let o;try{o=bi(bn(e))}catch(t){throw new Error(`Invalid seed color "${e}": ${t instanceof Error?t.message:"Unknown error"}`)}let s="lighter",a="darker";if(n)s=n,a="darker"===n?"lighter":"darker";else{const{better:e,worse:t}=xi(o);s=e,a=t}const l=function(e){const{dependents:t}=function(e){const t=new Map,n=new Map;return Object.keys(e).forEach(e=>{t.set(e,[])}),n.set("seed",[]),Object.keys(e).forEach(e=>{n.set(e,[])}),Object.entries(e).forEach(([e,r])=>{const i=e,o=r.contrast.reference;t.get(i).push(o),n.get(o).push(i),r.sameAsIfPossible&&(t.get(i).push(r.sameAsIfPossible),n.get(r.sameAsIfPossible).push(i))}),{dependencies:t,dependents:n}}(e),n=[],r=new Set,i=new Set;return function e(o){if(i.has(o))throw new Error(`Circular dependency detected involving step: ${String(o)}`);r.has(o)||(i.add(o),(t.get(o)||[]).forEach(t=>{e(t)}),i.delete(o),r.add(o),"seed"!==o&&n.unshift(o))}("seed"),n}(t),{rampResults:c,SATISFIED_ALL_CONTRAST_REQUIREMENTS:u,UNSATISFIED_DIRECTION:d}=Pi({seed:o,sortedSteps:l,config:t,mainDir:s,oppDir:a,pinLightness:r}),f={ramp:c,direction:s};if(!u&&i){let e=qn(o,[li,"l"]),n="lighter"===d?0:1;for(let i=0;i<10&&Math.abs(n-e)>.004;i++){const i=bi(Gn(Kn(o),[li,"l"],(e+n)/2)),c=Pi({seed:i,sortedSteps:l,config:t,mainDir:s,oppDir:a,pinLightness:r});c.SATISFIED_ALL_CONTRAST_REQUIREMENTS?(n=qn(i,[li,"l"]),f.ramp=c.rampResults):d!==s?n=qn(i,[li,"l"]):e=qn(i,[li,"l"])}}if("darker"===s){const e=f.ramp.surface1;f.ramp.surface1=f.ramp.surface3,f.ramp.surface3=e}return f}const Vi=e=>"lighter"===e?.9551:.235,Ni={alpha:.7},Oi={alpha:.6,kLight:.2,kDark:.2},Ri={alpha:.6,radiusDark:.01,radiusLight:.01,kLight:.8,kDark:.8},Fi={alpha:.75,radiusDark:.01,radiusLight:.01},Ti={contrast:{reference:"surface3",followDirection:"main",target:7,preferLighter:!0},lightness:Vi,taperChromaOptions:Oi},Ai={surface1:{contrast:{reference:"surface2",followDirection:"opposite",target:1.02,ignoreWhenAdjustingSeed:!0},taperChromaOptions:Ni},surface2:{contrast:{reference:"seed",followDirection:"main",target:1}},surface3:{contrast:{reference:"surface2",followDirection:"main",target:1.02},taperChromaOptions:Ni},surface4:{contrast:{reference:"surface2",followDirection:"main",target:1.08},taperChromaOptions:Ni},surface5:{contrast:{reference:"surface2",followDirection:"main",target:1.2},taperChromaOptions:Ni},surface6:{contrast:{reference:"surface2",followDirection:"main",target:1.4},taperChromaOptions:Ni},bgFill1:{contrast:{reference:"surface2",followDirection:"main",target:4},lightness:e=>"lighter"===e?.67:.45},bgFill2:{contrast:{reference:"bgFill1",followDirection:"main",target:1.2}},bgFillInverted1:{contrast:{reference:"bgFillInverted2",followDirection:"opposite",target:1.2}},bgFillInverted2:Ti,bgFillDark:{contrast:{reference:"surface3",followDirection:"darker",target:7,ignoreWhenAdjustingSeed:!0},lightness:Vi,taperChromaOptions:Oi},stroke1:{contrast:{reference:"stroke3",followDirection:"opposite",target:2.2},taperChromaOptions:Ri},stroke2:{contrast:{reference:"stroke3",followDirection:"opposite",target:1.5},taperChromaOptions:Ri},stroke3:{contrast:{reference:"surface3",followDirection:"main",target:3},taperChromaOptions:Ri},stroke4:{contrast:{reference:"stroke3",followDirection:"main",target:1.5},taperChromaOptions:Ri},fgSurface1:{contrast:{reference:"surface3",followDirection:"main",target:2,preferLighter:!0},taperChromaOptions:Oi},fgSurface2:{contrast:{reference:"surface3",followDirection:"main",target:3,preferLighter:!0},taperChromaOptions:Oi},fgSurface3:{contrast:{reference:"surface3",followDirection:"main",target:4.5,preferLighter:!0},lightness:e=>"lighter"===e?.77:.56,taperChromaOptions:Oi},fgSurface4:Ti,fgFill:{contrast:{reference:"bgFill1",followDirection:"best",target:4.5,preferLighter:!0},lightness:Vi,taperChromaOptions:Oi},fgFillInverted:{contrast:{reference:"bgFillInverted1",followDirection:"best",target:4.5,preferLighter:!0},lightness:Vi,taperChromaOptions:Oi},fgFillDark:{contrast:{reference:"bgFillDark",followDirection:"best",target:4.5,preferLighter:!0},lightness:Vi,taperChromaOptions:Oi}},Di={...Ai,surface1:{...Ai.surface1,taperChromaOptions:Fi},surface2:{contrast:{reference:"bgFill1",followDirection:"opposite",target:Ai.bgFill1.contrast.target,ignoreWhenAdjustingSeed:!0},taperChromaOptions:Fi},surface3:{...Ai.surface3,taperChromaOptions:Fi},surface4:{...Ai.surface4,taperChromaOptions:Fi},surface5:{...Ai.surface5,taperChromaOptions:Fi},surface6:{...Ai.surface6,taperChromaOptions:Fi},bgFill1:{contrast:{reference:"seed",followDirection:"main",target:1}},stroke1:{...Ai.stroke1},stroke2:{...Ai.stroke2},stroke3:{...Ai.stroke3,sameAsIfPossible:"fgSurface3",taperChromaOptions:void 0},stroke4:{...Ai.stroke4,taperChromaOptions:void 0},fgSurface1:{...Ai.fgSurface1,taperChromaOptions:void 0},fgSurface2:{...Ai.fgSurface2,taperChromaOptions:void 0},fgSurface3:{...Ai.fgSurface3,taperChromaOptions:void 0,sameAsIfPossible:"bgFill1"},fgSurface4:{...Ai.fgSurface4,taperChromaOptions:void 0}},Bi="surface2",zi=ai(function(e){if("string"!=typeof e||""===e.trim())throw new Error("Seed color must be a non-empty string");return Li(e,Ai)},{maxSize:10}),$i=ai(function(e,t){if("string"!=typeof e||""===e.trim())throw new Error("Seed color must be a non-empty string");const n=t?{mainDirection:(r=t).direction,pinLightness:{stepName:Bi,value:_i(qn(bn(r.ramp[Bi].color),[li,"l"]),r.direction)}}:void 0;var r;return Li(e,Di,n)},{maxSize:10}),Hi=[["--wp-components-color-accent","var(--wp-admin-theme-color)"],["--wp-components-color-accent-darker-10","var(--wp-admin-theme-color-darker-10)"],["--wp-components-color-accent-darker-20","var(--wp-admin-theme-color-darker-20)"],["--wp-components-color-accent-inverted","var(--wpds-color-fg-interactive-brand-strong)"],["--wp-components-color-background","var(--wpds-color-bg-surface-neutral-strong)"],["--wp-components-color-foreground","var(--wpds-color-fg-content-neutral)"],["--wp-components-color-foreground-inverted","var(--wpds-color-bg-surface-neutral)"],["--wp-components-color-gray-100","var(--wpds-color-bg-surface-neutral)"],["--wp-components-color-gray-200","var(--wpds-color-stroke-surface-neutral)"],["--wp-components-color-gray-300","var(--wpds-color-stroke-surface-neutral)"],["--wp-components-color-gray-400","var(--wpds-color-stroke-interactive-neutral)"],["--wp-components-color-gray-600","var(--wpds-color-stroke-interactive-neutral)"],["--wp-components-color-gray-700","var(--wpds-color-fg-content-neutral-weak)"],["--wp-components-color-gray-800","var(--wpds-color-fg-content-neutral)"]];function Wi(e){const t=Jr(e,ii);return[qn(t,"srgb.r"),qn(t,"srgb.g"),qn(t,"srgb.b")].map(e=>Math.round(255*e)).join(", ")}function qi(e){const t=Jr(bn(e),oi),n=t.coords,r=Jr({space:oi,coords:[n[0],n[1],Math.max(0,Math.min(100,n[2]-5))]},ii),i=Jr({space:oi,coords:[n[0],n[1],Math.max(0,Math.min(100,n[2]-10))]},ii);return[["--wp-admin-theme-color",si(Jr(t,ii),{format:"hex"})],["--wp-admin-theme-color--rgb",Wi(t)],["--wp-admin-theme-color-darker-10",si(r,{format:"hex"})],["--wp-admin-theme-color-darker-10--rgb",Wi(r)],["--wp-admin-theme-color-darker-20",si(i,{format:"hex"})],["--wp-admin-theme-color-darker-20--rgb",Wi(i)]]}function Ui(e=()=>!0){return Object.entries(di).filter(e).map(([e,t])=>[e,t["."]])}function Gi(e,t){return[...Object.entries(e.ramp)].map(([e,n])=>{return[`${t}${r=e,r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase())}`,n.color];var r})}const Ki="oCdkMr1YS5uhKiwZlTit";function Yi({instanceId:e,isRoot:t}){const n=`[data-wpds-theme-provider-id="${e}"]`,r=[];return t&&r.push(`:root:has(.${Ki}[data-wpds-root-provider="true"]${n})`),r.push(`.${Ki}.${Ki}${n}`),r.join(",")}const Zi=window.wp.coreData,Xi=window.wp.htmlEntities,Ji=window.wp.primitives;var Qi=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"})});const eo=window.wp.keycodes,to=window.wp.url;function no(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t(0,o.cloneElement)(e,{width:t,height:t,...n,ref:r})),oo=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,a.jsx)(Ji.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"})});const so=function({className:e}){const{isRequestingSite:t,siteIconUrl:n}=(0,Gt.useSelect)(e=>{const{getEntityRecord:t}=e(Zi.store),n=t("root","__unstableBase",void 0);return{isRequestingSite:!n,siteIconUrl:n?.site_icon_url}},[]);let r=null;return r=t&&!n?(0,a.jsx)("div",{className:"boot-site-icon__image"}):n?(0,a.jsx)("img",{className:"boot-site-icon__image",alt:(0,Ut.__)("Site Icon"),src:n}):(0,a.jsx)(io,{className:"boot-site-icon__icon",icon:oo,size:48}),(0,a.jsx)("div",{className:ro(e,"boot-site-icon"),children:r})},ao=function({to:e,isBackButton:t,...n}){const r=K(),i=Y({select:e=>0!==e.location.state.__TSR_index});return(0,a.jsx)(me,{to:e,"aria-label":n["aria-label"],className:"boot-site-icon-link",onClick:e=>{i&&t&&(e.preventDefault(),r.history.back())},children:(0,a.jsx)(so,{})})},lo=function(){const{homeUrl:e,siteTitle:t}=(0,Gt.useSelect)(e=>{const{getEntityRecord:t}=e(Zi.store),n=t("root","__unstableBase");return{homeUrl:n?.home,siteTitle:!n?.name&&n?.url?(0,to.filterURLForDisplay)(n?.url):n?.name}},[]),{open:n}=(0,Gt.useDispatch)(Kt.store);return(0,a.jsxs)("div",{className:"boot-site-hub",children:[(0,a.jsx)(ao,{to:"/wp-admin/","aria-label":(0,Ut.__)("Go to the Dashboard")}),(0,a.jsx)(s.ExternalLink,{href:null!=e?e:"/",className:"boot-site-hub__title",children:t&&(0,Xi.decodeEntities)(t)}),(0,a.jsx)(s.__experimentalHStack,{className:"boot-site-hub__actions",children:(0,a.jsx)(s.Button,{variant:"tertiary",icon:Qi,onClick:()=>n(),size:"compact",label:(0,Ut.__)("Open command palette"),shortcut:eo.displayShortcut.primary("k")})})]})},co={menuItems:{}};function uo(e,t){return{type:"REGISTER_MENU_ITEM",id:e,menuItem:t}}function fo(e){return Object.values(e.menuItems)}const ho="wordpress/boot",po=(0,Gt.createReduxStore)(ho,{reducer:function(e=co,t){return"REGISTER_MENU_ITEM"===t.type?{...e,menuItems:{...e.menuItems,[t.id]:t.menuItem}}:e},actions:r,selectors:i});var mo;(0,Gt.register)(po);const go=(mo=(0,o.forwardRef)(function(e,t){return(0,a.jsx)(s.__experimentalItem,{as:"a",ref:t,...e})}),z.forwardRef(function(e,t){return(0,a.jsx)(me,{...e,_asChild:mo,ref:t})}));function vo(e,t=!0){if(n=e,(0,o.isValidElement)(n)&&(n.type===Ji.SVG||"svg"===n.type))return(0,a.jsx)(s.Icon,{icon:e});var n;if("string"==typeof e&&e.startsWith("dashicons-")){const t=e.replace(/^dashicons-/,"");return(0,a.jsx)(s.Dashicon,{style:{padding:"2px"},icon:t,"aria-hidden":"true"})}return"string"==typeof e&&e.startsWith("data:")?(0,a.jsx)("img",{src:e,alt:"","aria-hidden":"true",style:{width:"20px",height:"20px",display:"block",padding:"2px"}}):e||(t?(0,a.jsx)("div",{style:{width:"24px",height:"24px"},"aria-hidden":"true"}):null)}function wo({className:e,icon:t,shouldShowPlaceholder:n=!0,children:r,to:i}){const o=!String(new URL(i,window.location.origin)).startsWith(window.location.origin),l=(0,a.jsxs)(s.__experimentalHStack,{justify:"flex-start",spacing:2,style:{flexGrow:"1"},children:[vo(t,n),(0,a.jsx)(s.FlexBlock,{children:r})]});return o?(0,a.jsx)(s.__experimentalItem,{as:"a",href:i,className:ro("boot-navigation-item",e),children:l}):(0,a.jsx)(go,{to:i,className:ro("boot-navigation-item",e),children:l})}var bo=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})}),xo=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"})});function yo({className:e,id:t,icon:n,shouldShowPlaceholder:r=!0,children:i,onNavigate:o}){return(0,a.jsx)(s.__experimentalItem,{className:ro("boot-navigation-item",e),onClick:e=>{e.preventDefault(),o({id:t,direction:"forward"})},children:(0,a.jsxs)(s.__experimentalHStack,{justify:"flex-start",spacing:2,style:{flexGrow:"1"},children:[vo(n,r),(0,a.jsx)(s.FlexBlock,{children:i}),(0,a.jsx)(s.Icon,{icon:(0,Ut.isRTL)()?bo:xo})]})})}var _o=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"m15.99 10.889-3.988 3.418-3.988-3.418.976-1.14 3.012 2.582 3.012-2.581.976 1.139Z"})});const So=window.wp.compose;function Co({className:e,id:t,icon:n,children:r,isExpanded:i,onToggle:o}){const l=(0,Gt.useSelect)(e=>e(ho).getMenuItems(),[]).filter(e=>e.parent===t),c=(0,So.useReducedMotion)();return(0,a.jsxs)("div",{className:"boot-dropdown-item",children:[(0,a.jsx)(s.__experimentalItem,{className:ro("boot-navigation-item",e),onClick:e=>{e.preventDefault(),e.stopPropagation(),o()},onMouseDown:e=>e.preventDefault(),children:(0,a.jsxs)(s.__experimentalHStack,{justify:"flex-start",spacing:2,style:{flexGrow:"1"},children:[vo(n,!1),(0,a.jsx)(s.FlexBlock,{children:r}),(0,a.jsx)(s.Icon,{icon:_o,className:ro("boot-dropdown-item__chevron",{"is-up":i})})]})}),(0,a.jsx)(s.__unstableAnimatePresence,{initial:!1,children:i&&(0,a.jsx)(s.__unstableMotion.div,{initial:{height:0},animate:{height:"auto"},exit:{height:0},transition:{type:"tween",duration:c?0:.2,ease:"easeOut"},className:"boot-dropdown-item__children",children:l.map((e,t)=>(0,a.jsx)(wo,{to:e.to,shouldShowPlaceholder:!1,children:e.label},t))})})]})}var jo=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})}),ko=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})});const Io={initial:e=>({x:"forward"===e?100:-100,opacity:0}),animate:{x:0,opacity:1},exit:e=>({x:"forward"===e?100:-100,opacity:0})};function Mo({isRoot:e,title:t,actions:n,content:r,description:i,animationDirection:o,backMenuItem:l,backButtonRef:c,navigationKey:u,onNavigate:d}){const f=(0,Ut.isRTL)()?jo:ko,h=(0,So.useReducedMotion)();return(0,a.jsx)("div",{className:"boot-navigation-screen",style:{overflow:"hidden",position:"relative",display:"grid",gridTemplateColumns:"1fr",gridTemplateRows:"1fr"},children:(0,a.jsx)(s.__unstableAnimatePresence,{initial:!1,children:(0,a.jsxs)(s.__unstableMotion.div,{custom:o,variants:Io,initial:"initial",animate:"animate",exit:"exit",transition:{type:"tween",duration:h?0:.3,ease:[.33,0,0,1]},style:{width:"100%",gridColumn:"1",gridRow:"1"},children:[(0,a.jsxs)(s.__experimentalHStack,{spacing:2,className:"boot-navigation-screen__title-icon",children:[!e&&(0,a.jsx)(s.Button,{ref:c,icon:f,onClick:e=>{e.preventDefault(),d({id:l,direction:"backward"})},label:(0,Ut.__)("Back"),size:"small",variant:"tertiary"}),(0,a.jsx)(s.__experimentalHeading,{className:"boot-navigation-screen__title",level:1,size:"15px",children:t}),n&&(0,a.jsx)("div",{className:"boot-navigation-screen__actions",children:n})]}),i&&(0,a.jsx)("div",{className:"boot-navigation-screen__description",children:i}),r]},u)})})}const Eo=(e,t)=>{if(!t||t===e)return!1;const n=e=>{const t=e.startsWith("/")?e:"/"+e;return t.endsWith("/")&&t.length>1?t.slice(0,-1):t},r=n(e),i=n(t);return r.startsWith(i)&&("/"===r[i.length]||"/"===i)},Po=(e,t)=>{const n=t.find(t=>t.to===e);if(n)return n;let r=null,i=0;for(const n of t)n.to&&Eo(e,n.to)&&n.to.length>i&&(r=n,i=n.to.length);return r},Lo=(e,t)=>{if(!e)return;const n=t.find(t=>t.id===e);if(n&&n.parent){const e=t.find(e=>e.id===n.parent);if("drilldown"===e?.parent_type)return e.id;if(e)return Lo(e.id,t)}},Vo=(e,t)=>{if(!e)return;const n=t.find(t=>t.id===e);if(n&&n.parent){const e=t.find(e=>e.id===n.parent);if("dropdown"===e?.parent_type)return e.id}},No=function(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(null),[r,i,s,l]=function(){var e;const t=Y({select:e=>{const t=e.matches;return d?.select?d.select(t):t},structuralSharing:d?.structuralSharing}),n=K(),r=(0,Gt.useSelect)(e=>e(ho).getMenuItems(),[]),i=t[t.length-1].pathname.slice(null!==(e=n.options.basepath?.length)&&void 0!==e?e:0),s=Po(i,r),[a,l]=(0,o.useState)(Lo(s?.id,r)),[c,u]=(0,o.useState)(Vo(s?.id,r));var d;return(0,o.useEffect)(()=>{const e=Po(i,r),t=Lo(e?.id,r),n=Vo(e?.id,r);l(t),u(n)},[i,r]),[a,l,c,u]}(),c=(0,Gt.useSelect)(e=>e(ho).getMenuItems(),[]),u=(0,o.useMemo)(()=>c.find(e=>e.id===r),[c,r]),d=u?`drilldown-${u.id}`:"root",f=({id:e,direction:t})=>{n(t),i(e)},h=(0,o.useMemo)(()=>c.filter(e=>e.parent===r),[c,r]),p=h.some(e=>!!e.icon);return(0,a.jsx)(Mo,{isRoot:!u,title:u?u.label:"",backMenuItem:u?.parent,backButtonRef:e,animationDirection:t||void 0,navigationKey:d,onNavigate:f,content:(0,a.jsx)(a.Fragment,{children:h.map(e=>"dropdown"===e.parent_type?(0,a.jsx)(Co,{id:e.id,className:"boot-navigation-item",icon:e.icon,shouldShowPlaceholder:p,isExpanded:s===e.id,onToggle:()=>{return t=e.id,void l(s===t?void 0:t);var t},children:e.label},e.id):"drilldown"===e.parent_type?(0,a.jsx)(yo,{id:e.id,icon:e.icon,shouldShowPlaceholder:p,onNavigate:f,children:e.label},e.id):(0,a.jsx)(wo,{to:e.to,icon:e.icon,shouldShowPlaceholder:p,children:e.label},e.id))})})};function Oo(){return(0,a.jsxs)("div",{className:"boot-sidebar__scrollable",children:[(0,a.jsx)(lo,{}),(0,a.jsx)("div",{className:"boot-sidebar__content",children:(0,a.jsx)(No,{})})]})}const Ro=({children:e,color:t={},isRoot:n=!1})=>{const r=(0,o.useId)(),{themeProviderStyles:i,resolvedSettings:s}=function({color:e={}}={}){var t,n,r,i;const{resolvedSettings:s}=(0,o.useContext)(Yt),a=null!==(t=null!==(n=e.primary)&&void 0!==n?n:s.color?.primary)&&void 0!==t?t:wi.primary,l=null!==(r=null!==(i=e.bg)&&void 0!==i?i:s.color?.bg)&&void 0!==r?r:wi.bg;return{resolvedSettings:(0,o.useMemo)(()=>({color:{primary:a,bg:l}}),[a,l]),themeProviderStyles:(0,o.useMemo)(()=>{const e={...wi,bg:l,primary:a},t=new Map,n=zi(e.bg);return Object.entries(e).forEach(([e,r])=>{"bg"===e?t.set(e,n):t.set(e,$i(r,n))}),function({primary:e,computedColorRamps:t}){return Object.fromEntries([Array.from(t).map(([e,t])=>[Gi(t,`--wpds-color-private-${e}-`)]).flat(2),Ui(([e])=>/color/.test(e)),qi(e),Hi].flat())}({primary:e.primary,computedColorRamps:t})},[a,l])}}({color:t}),l=(0,o.useMemo)(()=>({resolvedSettings:s}),[s]);return(0,a.jsxs)(a.Fragment,{children:[i?(0,a.jsx)("style",{children:`${Yi({instanceId:r,isRoot:n})} {${c=i,Object.entries(c).map(([e,t])=>`${e}: ${t};`).join("")}}`}):null,(0,a.jsx)("div",{"data-wpds-theme-provider-id":r,"data-wpds-root-provider":n,className:Ki,children:(0,a.jsx)(Yt.Provider,{value:l,children:e})})]});var c};var Fo=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})}),To=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})}),Ao=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M18.5 5.5V8H20V5.5h2.5V4H20V1.5h-1.5V4H16v1.5h2.5zM12 4H6a2 2 0 00-2 2v12a2 2 0 002 2h12a2 2 0 002-2v-6h-1.5v6a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5h6V4z"})}),Do=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z"})});function Bo({title:e,subTitle:t,badges:n,actions:r,breadcrumbs:i,hasPadding:o=!0,hasBorder:s=!1,contentWidth:l="default",children:c}){return(0,a.jsxs)("div",{className:"page",children:[(0,a.jsxs)("header",{className:ro("header",{"has-border":s}),children:[i&&(0,a.jsx)("div",{className:"breadcrumbs",children:i}),(0,a.jsxs)("div",{className:"title-row",children:[(0,a.jsxs)("div",{className:"title-group",children:[(0,a.jsx)("h1",{className:"title",children:e}),n&&(0,a.jsx)("div",{className:"badges",children:n})]}),r&&(0,a.jsx)("div",{className:"actions",children:r})]}),t&&(0,a.jsx)("p",{className:"sub-title",children:t})]}),(0,a.jsx)("div",{className:ro("content",{padded:o,constrained:"constrained"===l,full:"full"===l}),children:c})]})}const zo=window.wp.dataControls,$o=window.wp.apiFetch;var Ho=n.n($o);const Wo={setFollowers:e=>({type:"SET_FOLLOWERS",followers:e}),setFollowing:e=>({type:"SET_FOLLOWING",following:e}),setInteractions:e=>({type:"SET_INTERACTIONS",interactions:e}),setLoading:(e,t)=>({type:"SET_LOADING",resource:e,isLoading:t}),*fetchFollowers(){yield Wo.setLoading("followers",!0);try{const e=yield Ho()({path:"/activitypub/v1/followers"});yield Wo.setFollowers(e)}catch(e){console.error("Failed to fetch followers:",e)}finally{yield Wo.setLoading("followers",!1)}},*fetchFollowing(){yield Wo.setLoading("following",!0);try{const e=yield Ho()({path:"/activitypub/v1/following"});yield Wo.setFollowing(e)}catch(e){console.error("Failed to fetch following:",e)}finally{yield Wo.setLoading("following",!1)}},*fetchInteractions(){yield Wo.setLoading("interactions",!0);try{const e=yield Ho()({path:"/activitypub/v1/interactions"});yield Wo.setInteractions(e)}catch(e){console.error("Failed to fetch interactions:",e)}finally{yield Wo.setLoading("interactions",!1)}},*blockFollower(e){try{yield Ho()({path:`/activitypub/v1/followers/${e}/block`,method:"POST"}),yield Wo.fetchFollowers()}catch(e){console.error("Failed to block follower:",e)}},*removeFollower(e){try{yield Ho()({path:`/activitypub/v1/followers/${e}`,method:"DELETE"}),yield Wo.fetchFollowers()}catch(e){console.error("Failed to remove follower:",e)}}},qo={followers:[],following:[],interactions:[],isLoading:{followers:!1,following:!1,interactions:!1}},Uo="activitypub/social-web",Go=(0,Gt.createReduxStore)(Uo,{reducer:function(e=qo,t){switch(t.type){case"SET_FOLLOWERS":return{...e,followers:t.followers};case"SET_FOLLOWING":return{...e,following:t.following};case"SET_INTERACTIONS":return{...e,interactions:t.interactions};case"SET_LOADING":return{...e,isLoading:{...e.isLoading,[t.resource]:t.isLoading}};default:return e}},actions:Wo,selectors:{getFollowers:e=>e.followers,getFollowerById:(e,t)=>e.followers.find(e=>e.id===t),getFollowing:e=>e.following,getFollowingById:(e,t)=>e.following.find(e=>e.id===t),getInteractions:e=>e.interactions,getInteractionById:(e,t)=>e.interactions.find(e=>e.id===t),isLoading:(e,t)=>e.isLoading[t],getStats:e=>({followers:e.followers.length,following:e.following.length,interactions:e.interactions.length,posts:0})},controls:zo.controls});function Ko(e,t){const n=function(){const e=(0,Gt.useSelect)(e=>{const t=e(Uo);return{followers:t.getFollowers(),following:t.getFollowing(),interactions:t.getInteractions(),stats:t.getStats(),isLoading:{followers:t.isLoading("followers"),following:t.isLoading("following"),interactions:t.isLoading("interactions")}}},[]),{fetchFollowers:t,fetchFollowing:n,fetchInteractions:r,blockFollower:i,removeFollower:s}=(0,Gt.useDispatch)(Uo);return(0,o.useEffect)(()=>{t(),n(),r()},[]),{...e,fetchFollowers:t,fetchFollowing:n,fetchInteractions:r,blockFollower:i,removeFollower:s}}();if(!e)return{items:n,isLoading:!1};if(t){const r=(0,Gt.useSelect)(n=>{const r=n(Uo);return"followers"===e?r.getFollowerById(t):"following"===e?r.getFollowingById(t):"interactions"===e?r.getInteractionById(t):null},[e,t]);return{items:r,isLoading:n.isLoading[e]}}return{items:n[e],isLoading:n.isLoading[e]}}function Yo(){const{items:e}=Ko("followers"),{items:t}=Ko("following"),{items:n}=Ko("interactions");return(0,a.jsx)(Bo,{title:"Dashboard",subTitle:"Overview of your ActivityPub network",hasPadding:!0,contentWidth:"constrained",children:(0,a.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"var(--wpds-spacing-60, 24px)"},children:[(0,a.jsx)(s.Card,{children:(0,a.jsxs)(s.CardBody,{children:[(0,a.jsx)("h3",{children:"Followers"}),(0,a.jsx)("p",{style:{fontSize:"32px",margin:"8px 0"},children:e?.length||0})]})}),(0,a.jsx)(s.Card,{children:(0,a.jsxs)(s.CardBody,{children:[(0,a.jsx)("h3",{children:"Following"}),(0,a.jsx)("p",{style:{fontSize:"32px",margin:"8px 0"},children:t?.length||0})]})}),(0,a.jsx)(s.Card,{children:(0,a.jsxs)(s.CardBody,{children:[(0,a.jsx)("h3",{children:"Interactions"}),(0,a.jsx)("p",{style:{fontSize:"32px",margin:"8px 0"},children:n?.length||0})]})})]})})}(0,Gt.register)(Go);var Zo=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})}),Xo=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})});const Jo="is",Qo="isNot",es="isAny",ts="isNone",ns="isAll",rs="isNotAll",is="lessThan",os="greaterThan",ss="lessThanOrEqual",as="greaterThanOrEqual",ls="before",cs="after",us="beforeInc",ds="afterInc",fs="contains",hs="notContains",ps="startsWith",ms="between",gs="on",vs="notOn",ws="inThePast",bs="over",xs=[Jo,Qo,es,ts,ns,rs,is,os,ss,as,ls,cs,us,ds,fs,hs,ps,ms,gs,vs,ws,bs],ys=[Jo,Qo,is,os,ss,as,ls,cs,us,ds,fs,hs,ps,gs,vs],_s={[Jo]:{key:"is-filter",label:(0,Ut.__)("Is")},[Qo]:{key:"is-not-filter",label:(0,Ut.__)("Is not")},[es]:{key:"is-any-filter",label:(0,Ut.__)("Is any")},[ts]:{key:"is-none-filter",label:(0,Ut.__)("Is none")},[ns]:{key:"is-all-filter",label:(0,Ut.__)("Is all")},[rs]:{key:"is-not-all-filter",label:(0,Ut.__)("Is not all")},[is]:{key:"less-than-filter",label:(0,Ut.__)("Less than")},[os]:{key:"greater-than-filter",label:(0,Ut.__)("Greater than")},[ss]:{key:"less-than-or-equal-filter",label:(0,Ut.__)("Less than or equal")},[as]:{key:"greater-than-or-equal-filter",label:(0,Ut.__)("Greater than or equal")},[ls]:{key:"before-filter",label:(0,Ut.__)("Before")},[cs]:{key:"after-filter",label:(0,Ut.__)("After")},[us]:{key:"before-inc-filter",label:(0,Ut.__)("Before (inc)")},[ds]:{key:"after-inc-filter",label:(0,Ut.__)("After (inc)")},[fs]:{key:"contains-filter",label:(0,Ut.__)("Contains")},[hs]:{key:"not-contains-filter",label:(0,Ut.__)("Doesn't contain")},[ps]:{key:"starts-with-filter",label:(0,Ut.__)("Starts with")},[ms]:{key:"between-filter",label:(0,Ut.__)("Between (inc)")},[gs]:{key:"on-filter",label:(0,Ut.__)("On")},[vs]:{key:"not-on-filter",label:(0,Ut.__)("Not on")},[ws]:{key:"in-the-past-filter",label:(0,Ut.__)("In the past")},[bs]:{key:"over-filter",label:(0,Ut.__)("Over")}},Ss=["asc","desc"],Cs={asc:"↑",desc:"↓"},js={asc:"ascending",desc:"descending"},ks={asc:(0,Ut.__)("Sort ascending"),desc:(0,Ut.__)("Sort descending")},Is={asc:Zo,desc:Xo},Ms="table",Es="grid",Ps=(0,o.createContext)({view:{type:Ms},onChangeView:()=>{},fields:[],data:[],paginationInfo:{totalItems:0,totalPages:0},selection:[],onChangeSelection:()=>{},setOpenedFilter:()=>{},openedFilter:null,getItemId:e=>e.id,isItemClickable:()=>!0,renderItemLink:void 0,containerWidth:0,containerRef:(0,o.createRef)(),resizeObserverRef:()=>{},defaultLayouts:{list:{},grid:{},table:{}},filters:[],isShowingFilter:!1,setIsShowingFilter:()=>{},hasInfiniteScrollHandler:!1,config:{perPageSizes:[]}});Ps.displayName="DataViewsContext";var Ls=Ps,Vs=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"})}),Ns=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"})}),Os=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})}),Rs=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})});function Fs({selection:e,onChangeSelection:t,item:n,getItemId:r,titleField:i,disabled:o,...l}){const c=r(n),u=!o&&e.includes(c),d=i?.getValue?.({item:n})||(0,Ut.__)("(no title)");return(0,a.jsx)(s.CheckboxControl,{className:"dataviews-selection-checkbox",__nextHasNoMarginBottom:!0,"aria-label":d,"aria-disabled":o,checked:u,onChange:()=>{o||t(e.includes(c)?e.filter(e=>c!==e):[...e,c])},...l})}var Ts=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})});const As=window.wp.privateApis,{lock:Ds,unlock:Bs}=(0,As.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/dataviews"),{Menu:zs,kebabCase:$s}=Bs(s.privateApis);function Hs({action:e,onClick:t,items:n}){const r="string"==typeof e.label?e.label:e.label(n);return(0,a.jsx)(s.Button,{disabled:!!e.disabled,accessibleWhenDisabled:!0,size:"compact",onClick:t,children:r})}function Ws({action:e,onClick:t,items:n}){const r="string"==typeof e.label?e.label:e.label(n);return(0,a.jsx)(zs.Item,{disabled:e.disabled,onClick:t,children:(0,a.jsx)(zs.ItemLabel,{children:r})})}function qs({action:e,items:t,closeModal:n}){const r="string"==typeof e.label?e.label:e.label(t),i="function"==typeof e.modalHeader?e.modalHeader(t):e.modalHeader;return(0,a.jsx)(s.Modal,{title:i||r,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:n,focusOnMount:e.modalFocusOnMount??!0,size:e.modalSize||"medium",overlayClassName:`dataviews-action-modal dataviews-action-modal__${$s(e.id)}`,children:(0,a.jsx)(e.RenderModal,{items:t,closeModal:n})})}function Us({actions:e,item:t,registry:n,setActiveModalAction:r}){return(0,a.jsx)(zs.Group,{children:e.map(e=>(0,a.jsx)(Ws,{action:e,onClick:()=>{"RenderModal"in e?r(e):e.callback([t],{registry:n})},items:[t]},e.id))})}function Gs({item:e,actions:t,isCompact:n}){const r=(0,Gt.useRegistry)(),{primaryActions:i,eligibleActions:l}=(0,o.useMemo)(()=>{const n=t.filter(t=>!t.isEligible||t.isEligible(e));return{primaryActions:n.filter(e=>e.isPrimary),eligibleActions:n}},[t,e]);return n?(0,a.jsx)(Ks,{item:e,actions:l,isSmall:!0,registry:r}):(0,a.jsxs)(s.__experimentalHStack,{spacing:0,justify:"flex-end",className:"dataviews-item-actions",style:{flexShrink:0,width:"auto"},children:[(0,a.jsx)(Ys,{item:e,actions:i,registry:r}),i.lengthl(null)})]})}function Ys({item:e,actions:t,registry:n}){const[r,i]=(0,o.useState)(null);return(0,So.useViewportMatch)("medium","<")?null:Array.isArray(t)&&0!==t.length?(0,a.jsxs)(a.Fragment,{children:[t.map(t=>(0,a.jsx)(Hs,{action:t,onClick:()=>{"RenderModal"in t?i(t):t.callback([e],{registry:n})},items:[e]},t.id)),!!r&&(0,a.jsx)(qs,{action:r,items:[e],closeModal:()=>i(null)})]}):null}var Zs=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})});function Xs({action:e,items:t,ActionTriggerComponent:n}){const[r,i]=(0,o.useState)(!1),s={action:e,onClick:()=>{i(!0)},items:t};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n,{...s}),r&&(0,a.jsx)(qs,{action:e,items:t,closeModal:()=>i(!1)})]})}function Js(e,t){return(0,o.useMemo)(()=>e.some(e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))),[e,t])}function Qs(e,t){return(0,o.useMemo)(()=>t.some(t=>e.some(e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t)))),[e,t])}function ea({selection:e,onChangeSelection:t,data:n,actions:r,getItemId:i}){const l=(0,o.useMemo)(()=>n.filter(e=>r.some(t=>t.supportsBulk&&(!t.isEligible||t.isEligible(e)))),[n,r]),c=n.filter(t=>e.includes(i(t))&&l.includes(t)),u=c.length===l.length;return(0,a.jsx)(s.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:u,indeterminate:!u&&!!c.length,onChange:()=>{t(u?[]:l.map(e=>i(e)))},"aria-label":u?(0,Ut.__)("Deselect all"):(0,Ut.__)("Select all")})}function ta({action:e,onClick:t,isBusy:n,items:r}){const i="string"==typeof e.label?e.label:e.label(r);return(0,So.useViewportMatch)("medium","<")?(0,a.jsx)(s.Button,{disabled:n,accessibleWhenDisabled:!0,label:i,icon:e.icon,size:"compact",onClick:t,isBusy:n}):(0,a.jsx)(s.Button,{disabled:n,accessibleWhenDisabled:!0,size:"compact",onClick:t,isBusy:n,children:i})}const na=[];function ra({action:e,selectedItems:t,actionInProgress:n,setActionInProgress:r}){const i=(0,Gt.useRegistry)(),s=(0,o.useMemo)(()=>t.filter(t=>!e.isEligible||e.isEligible(t)),[e,t]);return"RenderModal"in e?(0,a.jsx)(Xs,{action:e,items:s,ActionTriggerComponent:ta},e.id):(0,a.jsx)(ta,{action:e,onClick:async()=>{r(e.id),await e.callback(t,{registry:i}),r(null)},items:s,isBusy:n===e.id},e.id)}function ia(e,t,n,r,i,o,l,c,u){const d=o.length>0?(0,Ut.sprintf)( /* translators: %d: number of items. */ /* translators: %d: number of items. */ -(0,b._n)("%d Item selected","%d Items selected",a.length),a.length):(0,b.sprintf)( +(0,Ut._n)("%d Item selected","%d Items selected",o.length),o.length):(0,Ut.sprintf)( /* translators: %d: number of items. */ /* translators: %d: number of items. */ -(0,b._n)("%d Item","%d Items",e.length),e.length);return(0,c.jsxs)(s.__experimentalHStack,{expanded:!1,className:"dataviews-bulk-actions-footer__container",spacing:3,children:[(0,c.jsx)(Ue,{selection:i,onChangeSelection:u,data:e,actions:t,getItemId:n}),(0,c.jsx)("span",{className:"dataviews-bulk-actions-footer__item-count",children:d}),(0,c.jsxs)(s.__experimentalHStack,{className:"dataviews-bulk-actions-footer__action-buttons",expanded:!1,spacing:1,children:[r.map(e=>(0,c.jsx)(Xe,{action:e,selectedItems:a,actionInProgress:o,setActionInProgress:l},e.id)),a.length>0&&(0,c.jsx)(s.Button,{icon:$e,showTooltip:!0,tooltipPosition:"top",size:"compact",label:(0,b.__)("Cancel"),disabled:!!o,accessibleWhenDisabled:!1,onClick:()=>{u(Ze)}})]})]})}function Je({selection:e,actions:t,onChangeSelection:n,data:i,getItemId:r}){const[s,o]=(0,a.useState)(null),l=(0,a.useRef)(null),c=(0,W.useViewportMatch)("medium","<"),u=(0,a.useMemo)(()=>t.filter(e=>e.supportsBulk),[t]),d=(0,a.useMemo)(()=>i.filter(e=>u.some(t=>!t.isEligible||t.isEligible(e))),[i,u]),f=(0,a.useMemo)(()=>i.filter(t=>e.includes(r(t))&&d.includes(t)),[e,i,r,d]),m=(0,a.useMemo)(()=>t.filter(e=>e.supportsBulk&&(!c||e.icon)&&f.some(t=>!e.isEligible||e.isEligible(t))),[t,f,c]);return s?(l.current||(l.current=Qe(i,t,r,e,m,f,s,o,n)),l.current):(l.current&&(l.current=null),Qe(i,t,r,e,m,f,s,o,n))}function et(){const{data:e,selection:t,actions:n=Ze,onChangeSelection:i,getItemId:r}=(0,a.useContext)(Se);return(0,c.jsx)(Je,{selection:t,onChangeSelection:i,data:e,actions:n,getItemId:r})}var tt=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})}),nt=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"})}),it=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})}),rt=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{d:"M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z"})});const{Menu:at}=Le(s.privateApis);function st({children:e}){return a.Children.toArray(e).filter(Boolean).map((e,t)=>(0,c.jsxs)(a.Fragment,{children:[t>0&&(0,c.jsx)(at.Separator,{}),e]},t))}const ot=(0,a.forwardRef)(function({fieldId:e,view:t,fields:n,onChangeView:i,onHide:r,setOpenedFilter:a,canMove:o=!0},l){const u=t.fields??[],d=u?.indexOf(e),f=t.sort?.field===e;let m=!1,v=!1,p=!1,h=[];const g=n.find(t=>t.id===e);if(!g)return null;m=!1!==g.enableHiding,v=!1!==g.enableSorting;const w=g.header;return h=!!g.filterBy&&g.filterBy?.operators||[],p=!(t.filters?.some(t=>e===t.field)||!g.hasElements&&!g.Edit||!1===g.filterBy||g.filterBy?.isPrimary),v||o||m||p?(0,c.jsxs)(at,{children:[(0,c.jsxs)(at.TriggerButton,{render:(0,c.jsx)(s.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:l,variant:"tertiary"}),children:[w,t.sort&&f&&(0,c.jsx)("span",{"aria-hidden":"true",children:be[t.sort.direction]})]}),(0,c.jsx)(at.Popover,{style:{minWidth:"240px"},children:(0,c.jsxs)(st,{children:[v&&(0,c.jsx)(at.Group,{children:ge.map(n=>{const r=t.sort&&f&&t.sort.direction===n,a=`${e}-${n}`;return(0,c.jsx)(at.RadioItem,{name:"view-table-sorting",value:a,checked:r,onChange:()=>{i({...t,sort:{field:e,direction:n},showLevels:!1})},children:(0,c.jsx)(at.ItemLabel,{children:xe[n]})},a)})}),p&&(0,c.jsx)(at.Group,{children:(0,c.jsx)(at.Item,{prefix:(0,c.jsx)(s.Icon,{icon:tt}),onClick:()=>{a(e),i({...t,page:1,filters:[...t.filters||[],{field:e,value:void 0,operator:h[0]}]})},children:(0,c.jsx)(at.ItemLabel,{children:(0,b.__)("Add filter")})})}),(o||m)&&g&&(0,c.jsxs)(at.Group,{children:[o&&(0,c.jsx)(at.Item,{prefix:(0,c.jsx)(s.Icon,{icon:nt}),disabled:d<1,onClick:()=>{i({...t,fields:[...u.slice(0,d-1)??[],e,u[d-1],...u.slice(d+1)]})},children:(0,c.jsx)(at.ItemLabel,{children:(0,b.__)("Move left")})}),o&&(0,c.jsx)(at.Item,{prefix:(0,c.jsx)(s.Icon,{icon:it}),disabled:d>=u.length-1,onClick:()=>{i({...t,fields:[...u.slice(0,d)??[],u[d+1],e,...u.slice(d+2)]})},children:(0,c.jsx)(at.ItemLabel,{children:(0,b.__)("Move right")})}),m&&g&&(0,c.jsx)(at.Item,{prefix:(0,c.jsx)(s.Icon,{icon:rt}),onClick:()=>{r(g),i({...t,fields:u.filter(t=>t!==e)})},children:(0,c.jsx)(at.ItemLabel,{children:(0,b.__)("Hide column")})})]})]})})]}):w});var lt=ot;function ct({item:e,isItemClickable:t,onClickItem:n,renderItemLink:i,className:r,children:s,...o}){if(!t(e))return(0,c.jsx)("div",{className:r,...o,children:s});if(i){const t=i({item:e,className:`${r} ${r}--clickable`,...o,children:s});return(0,a.cloneElement)(t,{onClick:e=>{e.stopPropagation(),t.props.onClick&&t.props.onClick(e)},onKeyDown:e=>{"Enter"!==e.key&&""!==e.key&&" "!==e.key||(e.stopPropagation(),t.props.onKeyDown&&t.props.onKeyDown(e))}})}const l=function({item:e,isItemClickable:t,onClickItem:n,className:i}){return t(e)&&n?{className:i?`${i} ${i}--clickable`:void 0,role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),n(e)},onKeyDown:t=>{"Enter"!==t.key&&""!==t.key&&" "!==t.key||(t.stopPropagation(),n(e))}}:{className:i}}({item:e,isItemClickable:t,onClickItem:n,className:r});return(0,c.jsx)("div",{...l,...o,children:s})}var ut=function({item:e,level:t,titleField:n,mediaField:i,descriptionField:r,onClickItem:a,renderItemLink:o,isItemClickable:l}){return(0,c.jsxs)(s.__experimentalHStack,{spacing:3,justify:"flex-start",children:[i&&(0,c.jsx)(ct,{item:e,isItemClickable:l,onClickItem:a,renderItemLink:o,className:"dataviews-view-table__cell-content-wrapper dataviews-column-primary__media","aria-label":n?(0,b.sprintf)( +(0,Ut._n)("%d Item","%d Items",e.length),e.length);return(0,a.jsxs)(s.__experimentalHStack,{expanded:!1,className:"dataviews-bulk-actions-footer__container",spacing:3,children:[(0,a.jsx)(ea,{selection:r,onChangeSelection:u,data:e,actions:t,getItemId:n}),(0,a.jsx)("span",{className:"dataviews-bulk-actions-footer__item-count",children:d}),(0,a.jsxs)(s.__experimentalHStack,{className:"dataviews-bulk-actions-footer__action-buttons",expanded:!1,spacing:1,children:[i.map(e=>(0,a.jsx)(ra,{action:e,selectedItems:o,actionInProgress:l,setActionInProgress:c},e.id)),o.length>0&&(0,a.jsx)(s.Button,{icon:Zs,showTooltip:!0,tooltipPosition:"top",size:"compact",label:(0,Ut.__)("Cancel"),disabled:!!l,accessibleWhenDisabled:!1,onClick:()=>{u(na)}})]})]})}function oa({selection:e,actions:t,onChangeSelection:n,data:r,getItemId:i}){const[s,a]=(0,o.useState)(null),l=(0,o.useRef)(null),c=(0,So.useViewportMatch)("medium","<"),u=(0,o.useMemo)(()=>t.filter(e=>e.supportsBulk),[t]),d=(0,o.useMemo)(()=>r.filter(e=>u.some(t=>!t.isEligible||t.isEligible(e))),[r,u]),f=(0,o.useMemo)(()=>r.filter(t=>e.includes(i(t))&&d.includes(t)),[e,r,i,d]),h=(0,o.useMemo)(()=>t.filter(e=>e.supportsBulk&&(!c||e.icon)&&f.some(t=>!e.isEligible||e.isEligible(t))),[t,f,c]);return s?(l.current||(l.current=ia(r,t,i,e,h,f,s,a,n)),l.current):(l.current&&(l.current=null),ia(r,t,i,e,h,f,s,a,n))}function sa(){const{data:e,selection:t,actions:n=na,onChangeSelection:r,getItemId:i}=(0,o.useContext)(Ls);return(0,a.jsx)(oa,{selection:t,onChangeSelection:r,data:e,actions:n,getItemId:i})}var aa=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})}),la=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"})}),ca=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})}),ua=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z"})});const{Menu:da}=Bs(s.privateApis);function fa({children:e}){return o.Children.toArray(e).filter(Boolean).map((e,t)=>(0,a.jsxs)(o.Fragment,{children:[t>0&&(0,a.jsx)(da.Separator,{}),e]},t))}const ha=(0,o.forwardRef)(function({fieldId:e,view:t,fields:n,onChangeView:r,onHide:i,setOpenedFilter:o,canMove:l=!0},c){const u=t.fields??[],d=u?.indexOf(e),f=t.sort?.field===e;let h=!1,p=!1,m=!1,g=[];const v=n.find(t=>t.id===e);if(!v)return null;h=!1!==v.enableHiding,p=!1!==v.enableSorting;const w=v.header;return g=!!v.filterBy&&v.filterBy?.operators||[],m=!(t.filters?.some(t=>e===t.field)||!v.hasElements&&!v.Edit||!1===v.filterBy||v.filterBy?.isPrimary),p||l||h||m?(0,a.jsxs)(da,{children:[(0,a.jsxs)(da.TriggerButton,{render:(0,a.jsx)(s.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:c,variant:"tertiary"}),children:[w,t.sort&&f&&(0,a.jsx)("span",{"aria-hidden":"true",children:Cs[t.sort.direction]})]}),(0,a.jsx)(da.Popover,{style:{minWidth:"240px"},children:(0,a.jsxs)(fa,{children:[p&&(0,a.jsx)(da.Group,{children:Ss.map(n=>{const i=t.sort&&f&&t.sort.direction===n,o=`${e}-${n}`;return(0,a.jsx)(da.RadioItem,{name:"view-table-sorting",value:o,checked:i,onChange:()=>{r({...t,sort:{field:e,direction:n},showLevels:!1})},children:(0,a.jsx)(da.ItemLabel,{children:ks[n]})},o)})}),m&&(0,a.jsx)(da.Group,{children:(0,a.jsx)(da.Item,{prefix:(0,a.jsx)(s.Icon,{icon:aa}),onClick:()=>{o(e),r({...t,page:1,filters:[...t.filters||[],{field:e,value:void 0,operator:g[0]}]})},children:(0,a.jsx)(da.ItemLabel,{children:(0,Ut.__)("Add filter")})})}),(l||h)&&v&&(0,a.jsxs)(da.Group,{children:[l&&(0,a.jsx)(da.Item,{prefix:(0,a.jsx)(s.Icon,{icon:la}),disabled:d<1,onClick:()=>{r({...t,fields:[...u.slice(0,d-1)??[],e,u[d-1],...u.slice(d+1)]})},children:(0,a.jsx)(da.ItemLabel,{children:(0,Ut.__)("Move left")})}),l&&(0,a.jsx)(da.Item,{prefix:(0,a.jsx)(s.Icon,{icon:ca}),disabled:d>=u.length-1,onClick:()=>{r({...t,fields:[...u.slice(0,d)??[],u[d+1],e,...u.slice(d+2)]})},children:(0,a.jsx)(da.ItemLabel,{children:(0,Ut.__)("Move right")})}),h&&v&&(0,a.jsx)(da.Item,{prefix:(0,a.jsx)(s.Icon,{icon:ua}),onClick:()=>{i(v),r({...t,fields:u.filter(t=>t!==e)})},children:(0,a.jsx)(da.ItemLabel,{children:(0,Ut.__)("Hide column")})})]})]})})]}):w});var pa=ha;function ma({item:e,isItemClickable:t,onClickItem:n,renderItemLink:r,className:i,children:s,...l}){if(!t(e))return(0,a.jsx)("div",{className:i,...l,children:s});if(r){const t=r({item:e,className:`${i} ${i}--clickable`,...l,children:s});return(0,o.cloneElement)(t,{onClick:e=>{e.stopPropagation(),t.props.onClick&&t.props.onClick(e)},onKeyDown:e=>{"Enter"!==e.key&&""!==e.key&&" "!==e.key||(e.stopPropagation(),t.props.onKeyDown&&t.props.onKeyDown(e))}})}const c=function({item:e,isItemClickable:t,onClickItem:n,className:r}){return t(e)&&n?{className:r?`${r} ${r}--clickable`:void 0,role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),n(e)},onKeyDown:t=>{"Enter"!==t.key&&""!==t.key&&" "!==t.key||(t.stopPropagation(),n(e))}}:{className:r}}({item:e,isItemClickable:t,onClickItem:n,className:i});return(0,a.jsx)("div",{...c,...l,children:s})}var ga=function({item:e,level:t,titleField:n,mediaField:r,descriptionField:i,onClickItem:o,renderItemLink:l,isItemClickable:c}){return(0,a.jsxs)(s.__experimentalHStack,{spacing:3,justify:"flex-start",children:[r&&(0,a.jsx)(ma,{item:e,isItemClickable:c,onClickItem:o,renderItemLink:l,className:"dataviews-view-table__cell-content-wrapper dataviews-column-primary__media","aria-label":n?(0,Ut.sprintf)( // translators: %s is the item title. // translators: %s is the item title. -(0,b.__)("Click item: %s"),n.getValue?.({item:e})):void 0,children:(0,c.jsx)(i.render,{item:e,field:i,config:{sizes:"32px"}})}),(0,c.jsxs)(s.__experimentalVStack,{spacing:0,alignment:"flex-start",className:"dataviews-view-table__primary-column-content",children:[n&&(0,c.jsxs)(ct,{item:e,isItemClickable:l,onClickItem:a,renderItemLink:o,className:"dataviews-view-table__cell-content-wrapper dataviews-title-field",children:[void 0!==t&&t>0&&(0,c.jsxs)("span",{className:"dataviews-view-table__level",children:["—".repeat(t)," "]}),(0,c.jsx)(n.render,{item:e,field:n})]}),r&&(0,c.jsx)(r.render,{item:e,field:r})]})]})};function dt(e,t){return e.reduce((e,n)=>{const i=t.getValue({item:n});return e.has(i)||e.set(i,[]),e.get(i)?.push(n),e},new Map)}function ft({item:e,fields:t,column:n,align:i}){const r=t.find(e=>e.id===n);if(!r)return null;const a=k("dataviews-view-table__cell-content-wrapper",{"dataviews-view-table__cell-align-end":"end"===i,"dataviews-view-table__cell-align-center":"center"===i});return(0,c.jsx)("div",{className:a,children:(0,c.jsx)(r.render,{item:e,field:r})})}function mt({hasBulkActions:e,item:t,level:n,actions:i,fields:r,id:s,view:o,titleField:l,mediaField:u,descriptionField:d,selection:f,getItemId:m,isItemClickable:v,onClickItem:p,renderItemLink:h,onChangeSelection:g,isActionsColumnSticky:b,posinset:w}){const{paginationInfo:x}=(0,a.useContext)(Se),y=Ge(i,t),j=y&&f.includes(s),[C,S]=(0,a.useState)(!1),{showTitle:I=!0,showMedia:V=!0,showDescription:E=!0,infiniteScrollEnabled:N}=o,F=(0,a.useRef)(!1),M=o.fields??[],O=l&&I||u&&V||d&&E;return(0,c.jsxs)("tr",{className:k("dataviews-view-table__row",{"is-selected":y&&j,"is-hovered":C,"has-bulk-actions":y}),onMouseEnter:()=>{S(!0)},onMouseLeave:()=>{S(!1)},onTouchStart:()=>{F.current=!0},"aria-setsize":N?x.totalItems:void 0,"aria-posinset":w,role:N?"article":void 0,onClick:e=>{y&&(F.current||"Range"===document.getSelection()?.type||(((0,_.isAppleOS)()?e.metaKey:e.ctrlKey)?g(f.includes(s)?f.filter(e=>s!==e):[...f,s]):g(f.includes(s)?f.filter(e=>s!==e):[s])))},children:[e&&(0,c.jsx)("td",{className:"dataviews-view-table__checkbox-column",children:(0,c.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,c.jsx)(Ne,{item:t,selection:f,onChangeSelection:g,getItemId:m,titleField:l,disabled:!y})})}),O&&(0,c.jsx)("td",{children:(0,c.jsx)(ut,{item:t,level:n,titleField:I?l:void 0,mediaField:V?u:void 0,descriptionField:E?d:void 0,isItemClickable:v,onClickItem:p,renderItemLink:h})}),M.map(e=>{const{width:n,maxWidth:i,minWidth:a,align:s}=o.layout?.styles?.[e]??{};return(0,c.jsx)("td",{style:{width:n,maxWidth:i,minWidth:a},children:(0,c.jsx)(ft,{fields:r,item:t,column:e,align:s})},e)}),!!i?.length&&(0,c.jsx)("td",{className:k("dataviews-view-table__actions-column",{"dataviews-view-table__actions-column--sticky":!0,"dataviews-view-table__actions-column--stuck":b}),onClick:e=>e.stopPropagation(),children:(0,c.jsx)(He,{item:t,actions:i})})]})}const vt=(0,a.forwardRef)(({className:e,previewSize:t,...n},i)=>(0,c.jsx)("div",{ref:i,className:k("dataviews-view-grid-items",e),style:{gridTemplateColumns:t&&`repeat(auto-fill, minmax(${t}px, 1fr))`},...n})),{Badge:pt}=Le(s.privateApis);function ht({view:e,selection:t,onChangeSelection:n,onClickItem:i,isItemClickable:r,renderItemLink:o,getItemId:l,item:u,actions:d,mediaField:f,titleField:m,descriptionField:v,regularFields:p,badgeFields:h,hasBulkActions:g,config:w,posinset:x}){const{showTitle:y=!0,showMedia:j=!0,showDescription:C=!0,infiniteScrollEnabled:S}=e,I=Ge(d,u),V=l(u),E=(0,W.useInstanceId)(ht),N=t.includes(V),F=f?.render?(0,c.jsx)(f.render,{item:u,field:f,config:w}):null,M=y&&m?.render?(0,c.jsx)(m.render,{item:u,field:m}):null,O=j&&F;let L,P;r(u)&&i&&(M?(L={"aria-labelledby":`dataviews-view-grid__title-field-${E}`},P={id:`dataviews-view-grid__title-field-${E}`}):L={"aria-label":(0,b.__)("Navigate to item")});const{paginationInfo:A}=(0,a.useContext)(Se);return(0,c.jsxs)(s.__experimentalVStack,{spacing:0,className:k("dataviews-view-grid__card",{"is-selected":I&&N}),onClickCapture:e=>{if((0,_.isAppleOS)()?e.metaKey:e.ctrlKey){if(e.stopPropagation(),e.preventDefault(),!I)return;n(t.includes(V)?t.filter(e=>V!==e):[...t,V])}},role:S?"article":void 0,"aria-setsize":S?A.totalItems:void 0,"aria-posinset":x,children:[O&&(0,c.jsx)(ct,{item:u,isItemClickable:r,onClickItem:i,renderItemLink:o,className:"dataviews-view-grid__media",...L,children:F}),g&&O&&(0,c.jsx)(Ne,{item:u,selection:t,onChangeSelection:n,getItemId:l,titleField:m,disabled:!I}),!y&&O&&!!d?.length&&(0,c.jsx)("div",{className:"dataviews-view-grid__media-actions",children:(0,c.jsx)(He,{item:u,actions:d,isCompact:!0})}),y&&(0,c.jsxs)(s.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions",children:[(0,c.jsx)(ct,{item:u,isItemClickable:r,onClickItem:i,renderItemLink:o,className:"dataviews-view-grid__title-field dataviews-title-field",...P,children:M}),!!d?.length&&(0,c.jsx)(He,{item:u,actions:d,isCompact:!0})]}),(0,c.jsxs)(s.__experimentalVStack,{spacing:1,children:[C&&v?.render&&(0,c.jsx)(v.render,{item:u,field:v}),!!h?.length&&(0,c.jsx)(s.__experimentalHStack,{className:"dataviews-view-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:h.map(e=>(0,c.jsx)(pt,{className:"dataviews-view-grid__field-value",children:(0,c.jsx)(e.render,{item:u,field:e})},e.id))}),!!p?.length&&(0,c.jsx)(s.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:1,children:p.map(e=>(0,c.jsx)(s.Flex,{className:"dataviews-view-grid__field",gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:"row",children:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.Tooltip,{text:e.label,children:(0,c.jsx)(s.FlexItem,{className:"dataviews-view-grid__field-name",children:e.header})}),(0,c.jsx)(s.FlexItem,{className:"dataviews-view-grid__field-value",style:{maxHeight:"none"},children:(0,c.jsx)(e.render,{item:u,field:e})})]})},e.id))})]})]},V)}const{Menu:gt}=Le(s.privateApis);function bt(e){return`${e}-item-wrapper`}function wt(e){return`${e}-dropdown`}function xt({idPrefix:e,primaryAction:t,item:n}){const i=(0,g.useRegistry)(),[r,o]=(0,a.useState)(!1),l=function(e,t){return`${e}-primary-action-${t}`}(e,t.id),u="string"==typeof t.label?t.label:t.label([n]);return"RenderModal"in t?(0,c.jsx)("div",{role:"gridcell",children:(0,c.jsx)(s.Composite.Item,{id:l,render:(0,c.jsx)(s.Button,{disabled:!!t.disabled,accessibleWhenDisabled:!0,size:"small",onClick:()=>o(!0),variant:"link",children:u}),children:r&&(0,c.jsx)(Be,{action:t,items:[n],closeModal:()=>o(!1)})})},t.id):(0,c.jsx)("div",{role:"gridcell",children:(0,c.jsx)(s.Composite.Item,{id:l,render:(0,c.jsx)(s.Button,{disabled:!!t.disabled,accessibleWhenDisabled:!0,size:"small",onClick:()=>{t.callback([n],{registry:i})},variant:"link",children:u})})},t.id)}function yt({view:e,actions:t,idPrefix:n,isSelected:i,item:r,titleField:o,mediaField:l,descriptionField:u,onSelect:d,otherFields:f,onDropdownTriggerKeyDown:m,posinset:v}){const{showTitle:p=!0,showMedia:h=!0,showDescription:w=!0,infiniteScrollEnabled:x}=e,y=(0,a.useRef)(null),_=`${n}-label`,j=`${n}-description`,C=(0,g.useRegistry)(),[S,I]=(0,a.useState)(!1),[V,E]=(0,a.useState)(null),N=({type:e})=>{I("mouseenter"===e)},{paginationInfo:F}=(0,a.useContext)(Se);(0,a.useEffect)(()=>{i&&y.current?.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})},[i]);const{primaryAction:M,eligibleActions:O}=(0,a.useMemo)(()=>{const e=t.filter(e=>!e.isEligible||e.isEligible(r));return{primaryAction:e.filter(e=>e.isPrimary)[0],eligibleActions:e}},[t,r]),L=M&&1===t.length,P=h&&l?.render?(0,c.jsx)("div",{className:"dataviews-view-list__media-wrapper",children:(0,c.jsx)(l.render,{item:r,field:l,config:{sizes:"52px"}})}):null,A=p&&o?.render?(0,c.jsx)(o.render,{item:r,field:o}):null,D=O?.length>0&&(0,c.jsxs)(s.__experimentalHStack,{spacing:3,className:"dataviews-view-list__item-actions",children:[M&&(0,c.jsx)(xt,{idPrefix:n,primaryAction:M,item:r}),!L&&(0,c.jsxs)("div",{role:"gridcell",children:[(0,c.jsxs)(gt,{placement:"bottom-end",children:[(0,c.jsx)(gt.TriggerButton,{render:(0,c.jsx)(s.Composite.Item,{id:wt(n),render:(0,c.jsx)(s.Button,{size:"small",icon:Fe,label:(0,b.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,onKeyDown:m})})}),(0,c.jsx)(gt.Popover,{children:(0,c.jsx)(ze,{actions:O,item:r,registry:C,setActiveModalAction:E})})]}),!!V&&(0,c.jsx)(Be,{action:V,items:[r],closeModal:()=>E(null)})]})]});return(0,c.jsx)(s.Composite.Row,{ref:y,render:(0,c.jsx)("div",{"aria-posinset":v,"aria-setsize":x?F.totalItems:void 0}),role:x?"article":"row",className:k({"is-selected":i,"is-hovered":S}),onMouseEnter:N,onMouseLeave:N,children:(0,c.jsxs)(s.__experimentalHStack,{className:"dataviews-view-list__item-wrapper",spacing:0,children:[(0,c.jsx)("div",{role:"gridcell",children:(0,c.jsx)(s.Composite.Item,{id:bt(n),"aria-pressed":i,"aria-labelledby":_,"aria-describedby":j,className:"dataviews-view-list__item",onClick:()=>d(r)})}),(0,c.jsxs)(s.__experimentalHStack,{spacing:3,justify:"start",alignment:"flex-start",children:[P,(0,c.jsxs)(s.__experimentalVStack,{spacing:1,className:"dataviews-view-list__field-wrapper",children:[(0,c.jsxs)(s.__experimentalHStack,{spacing:0,children:[(0,c.jsx)("div",{className:"dataviews-title-field",id:_,children:A}),D]}),w&&u?.render&&(0,c.jsx)("div",{className:"dataviews-view-list__field",children:(0,c.jsx)(u.render,{item:r,field:u})}),(0,c.jsx)("div",{className:"dataviews-view-list__fields",id:j,children:f.map(e=>(0,c.jsxs)("div",{className:"dataviews-view-list__field",children:[(0,c.jsx)(s.VisuallyHidden,{as:"span",className:"dataviews-view-list__field-label",children:e.label}),(0,c.jsx)("span",{className:"dataviews-view-list__field-value",children:(0,c.jsx)(e.render,{item:r,field:e})})]},e.id))})]})]})]})})}function _t(e){return!!e}const{Badge:jt}=Le(s.privateApis);function Ct({view:e,multiselect:t,selection:n,onChangeSelection:i,getItemId:r,item:a,mediaField:o,titleField:l,descriptionField:u,regularFields:d,badgeFields:f,config:m,posinset:v,setsize:p}){const{showTitle:h=!0,showMedia:g=!0,showDescription:w=!0}=e,x=r(a),y=n.includes(x),_=o?.render?(0,c.jsx)(o.render,{item:a,field:o,config:m}):null,j=h&&l?.render?(0,c.jsx)(l.render,{item:a,field:l}):null;return(0,c.jsxs)(s.Composite.Item,{"aria-label":l?l.getValue({item:a})||(0,b.__)("(no title)"):void 0,render:({children:e,...t})=>(0,c.jsx)(s.__experimentalVStack,{spacing:0,children:e,...t}),role:"option","aria-posinset":v,"aria-setsize":p,className:k("dataviews-view-picker-grid__card",{"is-selected":y}),"aria-selected":y,onClick:()=>{if(y)i(n.filter(e=>x!==e));else{const e=t?[...n,x]:[x];i(e)}},children:[g&&_&&(0,c.jsx)("div",{className:"dataviews-view-picker-grid__media",children:_}),g&&_&&(0,c.jsx)(Ne,{item:a,selection:n,onChangeSelection:i,getItemId:r,titleField:l,disabled:!1,"aria-hidden":!0,tabIndex:-1}),h&&(0,c.jsx)(s.__experimentalHStack,{justify:"space-between",className:"dataviews-view-picker-grid__title-actions",children:(0,c.jsx)("div",{className:"dataviews-view-picker-grid__title-field dataviews-title-field",children:j})}),(0,c.jsxs)(s.__experimentalVStack,{spacing:1,children:[w&&u?.render&&(0,c.jsx)(u.render,{item:a,field:u}),!!f?.length&&(0,c.jsx)(s.__experimentalHStack,{className:"dataviews-view-picker-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:f.map(e=>(0,c.jsx)(jt,{className:"dataviews-view-picker-grid__field-value",children:(0,c.jsx)(e.render,{item:a,field:e})},e.id))}),!!d?.length&&(0,c.jsx)(s.__experimentalVStack,{className:"dataviews-view-picker-grid__fields",spacing:1,children:d.map(e=>(0,c.jsx)(s.Flex,{className:"dataviews-view-picker-grid__field",gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:"row",children:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.FlexItem,{className:"dataviews-view-picker-grid__field-name",children:e.header}),(0,c.jsx)(s.FlexItem,{className:"dataviews-view-picker-grid__field-value",style:{maxHeight:"none"},children:(0,c.jsx)(e.render,{item:a,field:e})})]})},e.id))})]})]},x)}function St({groupName:e,groupField:t,children:n}){const i=(0,W.useInstanceId)(St,"dataviews-view-picker-grid-group__header");return(0,c.jsxs)(s.__experimentalVStack,{spacing:2,role:"group","aria-labelledby":i,children:[(0,c.jsx)("h3",{className:"dataviews-view-picker-grid-group__header",id:i,children:(0,b.sprintf)( +(0,Ut.__)("Click item: %s"),n.getValue?.({item:e})):void 0,children:(0,a.jsx)(r.render,{item:e,field:r,config:{sizes:"32px"}})}),(0,a.jsxs)(s.__experimentalVStack,{spacing:0,alignment:"flex-start",className:"dataviews-view-table__primary-column-content",children:[n&&(0,a.jsxs)(ma,{item:e,isItemClickable:c,onClickItem:o,renderItemLink:l,className:"dataviews-view-table__cell-content-wrapper dataviews-title-field",children:[void 0!==t&&t>0&&(0,a.jsxs)("span",{className:"dataviews-view-table__level",children:["—".repeat(t)," "]}),(0,a.jsx)(n.render,{item:e,field:n})]}),i&&(0,a.jsx)(i.render,{item:e,field:i})]})]})};function va(e,t){return e.reduce((e,n)=>{const r=t.getValue({item:n});return e.has(r)||e.set(r,[]),e.get(r)?.push(n),e},new Map)}function wa({item:e,fields:t,column:n,align:r}){const i=t.find(e=>e.id===n);if(!i)return null;const o=ro("dataviews-view-table__cell-content-wrapper",{"dataviews-view-table__cell-align-end":"end"===r,"dataviews-view-table__cell-align-center":"center"===r});return(0,a.jsx)("div",{className:o,children:(0,a.jsx)(i.render,{item:e,field:i})})}function ba({hasBulkActions:e,item:t,level:n,actions:r,fields:i,id:s,view:l,titleField:c,mediaField:u,descriptionField:d,selection:f,getItemId:h,isItemClickable:p,onClickItem:m,renderItemLink:g,onChangeSelection:v,isActionsColumnSticky:w,posinset:b}){const{paginationInfo:x}=(0,o.useContext)(Ls),y=Js(r,t),_=y&&f.includes(s),[S,C]=(0,o.useState)(!1),{showTitle:j=!0,showMedia:k=!0,showDescription:I=!0,infiniteScrollEnabled:M}=l,E=(0,o.useRef)(!1),P=l.fields??[],L=c&&j||u&&k||d&&I;return(0,a.jsxs)("tr",{className:ro("dataviews-view-table__row",{"is-selected":y&&_,"is-hovered":S,"has-bulk-actions":y}),onMouseEnter:()=>{C(!0)},onMouseLeave:()=>{C(!1)},onTouchStart:()=>{E.current=!0},"aria-setsize":M?x.totalItems:void 0,"aria-posinset":b,role:M?"article":void 0,onClick:e=>{y&&(E.current||"Range"===document.getSelection()?.type||(((0,eo.isAppleOS)()?e.metaKey:e.ctrlKey)?v(f.includes(s)?f.filter(e=>s!==e):[...f,s]):v(f.includes(s)?f.filter(e=>s!==e):[s])))},children:[e&&(0,a.jsx)("td",{className:"dataviews-view-table__checkbox-column",children:(0,a.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,a.jsx)(Fs,{item:t,selection:f,onChangeSelection:v,getItemId:h,titleField:c,disabled:!y})})}),L&&(0,a.jsx)("td",{children:(0,a.jsx)(ga,{item:t,level:n,titleField:j?c:void 0,mediaField:k?u:void 0,descriptionField:I?d:void 0,isItemClickable:p,onClickItem:m,renderItemLink:g})}),P.map(e=>{const{width:n,maxWidth:r,minWidth:o,align:s}=l.layout?.styles?.[e]??{};return(0,a.jsx)("td",{style:{width:n,maxWidth:r,minWidth:o},children:(0,a.jsx)(wa,{fields:i,item:t,column:e,align:s})},e)}),!!r?.length&&(0,a.jsx)("td",{className:ro("dataviews-view-table__actions-column",{"dataviews-view-table__actions-column--sticky":!0,"dataviews-view-table__actions-column--stuck":w}),onClick:e=>e.stopPropagation(),children:(0,a.jsx)(Gs,{item:t,actions:r})})]})}const xa=(0,o.forwardRef)(({className:e,previewSize:t,...n},r)=>(0,a.jsx)("div",{ref:r,className:ro("dataviews-view-grid-items",e),style:{gridTemplateColumns:t&&`repeat(auto-fill, minmax(${t}px, 1fr))`},...n})),{Badge:ya}=Bs(s.privateApis);function _a({view:e,selection:t,onChangeSelection:n,onClickItem:r,isItemClickable:i,renderItemLink:l,getItemId:c,item:u,actions:d,mediaField:f,titleField:h,descriptionField:p,regularFields:m,badgeFields:g,hasBulkActions:v,config:w,posinset:b}){const{showTitle:x=!0,showMedia:y=!0,showDescription:_=!0,infiniteScrollEnabled:S}=e,C=Js(d,u),j=c(u),k=(0,So.useInstanceId)(_a),I=t.includes(j),M=f?.render?(0,a.jsx)(f.render,{item:u,field:f,config:w}):null,E=x&&h?.render?(0,a.jsx)(h.render,{item:u,field:h}):null,P=y&&M;let L,V;i(u)&&r&&(E?(L={"aria-labelledby":`dataviews-view-grid__title-field-${k}`},V={id:`dataviews-view-grid__title-field-${k}`}):L={"aria-label":(0,Ut.__)("Navigate to item")});const{paginationInfo:N}=(0,o.useContext)(Ls);return(0,a.jsxs)(s.__experimentalVStack,{spacing:0,className:ro("dataviews-view-grid__card",{"is-selected":C&&I}),onClickCapture:e=>{if((0,eo.isAppleOS)()?e.metaKey:e.ctrlKey){if(e.stopPropagation(),e.preventDefault(),!C)return;n(t.includes(j)?t.filter(e=>j!==e):[...t,j])}},role:S?"article":void 0,"aria-setsize":S?N.totalItems:void 0,"aria-posinset":b,children:[P&&(0,a.jsx)(ma,{item:u,isItemClickable:i,onClickItem:r,renderItemLink:l,className:"dataviews-view-grid__media",...L,children:M}),v&&P&&(0,a.jsx)(Fs,{item:u,selection:t,onChangeSelection:n,getItemId:c,titleField:h,disabled:!C}),!x&&P&&!!d?.length&&(0,a.jsx)("div",{className:"dataviews-view-grid__media-actions",children:(0,a.jsx)(Gs,{item:u,actions:d,isCompact:!0})}),x&&(0,a.jsxs)(s.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions",children:[(0,a.jsx)(ma,{item:u,isItemClickable:i,onClickItem:r,renderItemLink:l,className:"dataviews-view-grid__title-field dataviews-title-field",...V,children:E}),!!d?.length&&(0,a.jsx)(Gs,{item:u,actions:d,isCompact:!0})]}),(0,a.jsxs)(s.__experimentalVStack,{spacing:1,children:[_&&p?.render&&(0,a.jsx)(p.render,{item:u,field:p}),!!g?.length&&(0,a.jsx)(s.__experimentalHStack,{className:"dataviews-view-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:g.map(e=>(0,a.jsx)(ya,{className:"dataviews-view-grid__field-value",children:(0,a.jsx)(e.render,{item:u,field:e})},e.id))}),!!m?.length&&(0,a.jsx)(s.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:1,children:m.map(e=>(0,a.jsx)(s.Flex,{className:"dataviews-view-grid__field",gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:"row",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.Tooltip,{text:e.label,children:(0,a.jsx)(s.FlexItem,{className:"dataviews-view-grid__field-name",children:e.header})}),(0,a.jsx)(s.FlexItem,{className:"dataviews-view-grid__field-value",style:{maxHeight:"none"},children:(0,a.jsx)(e.render,{item:u,field:e})})]})},e.id))})]})]},j)}const{Menu:Sa}=Bs(s.privateApis);function Ca(e){return`${e}-item-wrapper`}function ja(e){return`${e}-dropdown`}function ka({idPrefix:e,primaryAction:t,item:n}){const r=(0,Gt.useRegistry)(),[i,l]=(0,o.useState)(!1),c=function(e,t){return`${e}-primary-action-${t}`}(e,t.id),u="string"==typeof t.label?t.label:t.label([n]);return"RenderModal"in t?(0,a.jsx)("div",{role:"gridcell",children:(0,a.jsx)(s.Composite.Item,{id:c,render:(0,a.jsx)(s.Button,{disabled:!!t.disabled,accessibleWhenDisabled:!0,size:"small",onClick:()=>l(!0),variant:"link",children:u}),children:i&&(0,a.jsx)(qs,{action:t,items:[n],closeModal:()=>l(!1)})})},t.id):(0,a.jsx)("div",{role:"gridcell",children:(0,a.jsx)(s.Composite.Item,{id:c,render:(0,a.jsx)(s.Button,{disabled:!!t.disabled,accessibleWhenDisabled:!0,size:"small",onClick:()=>{t.callback([n],{registry:r})},variant:"link",children:u})})},t.id)}function Ia({view:e,actions:t,idPrefix:n,isSelected:r,item:i,titleField:l,mediaField:c,descriptionField:u,onSelect:d,otherFields:f,onDropdownTriggerKeyDown:h,posinset:p}){const{showTitle:m=!0,showMedia:g=!0,showDescription:v=!0,infiniteScrollEnabled:w}=e,b=(0,o.useRef)(null),x=`${n}-label`,y=`${n}-description`,_=(0,Gt.useRegistry)(),[S,C]=(0,o.useState)(!1),[j,k]=(0,o.useState)(null),I=({type:e})=>{C("mouseenter"===e)},{paginationInfo:M}=(0,o.useContext)(Ls);(0,o.useEffect)(()=>{r&&b.current?.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})},[r]);const{primaryAction:E,eligibleActions:P}=(0,o.useMemo)(()=>{const e=t.filter(e=>!e.isEligible||e.isEligible(i));return{primaryAction:e.filter(e=>e.isPrimary)[0],eligibleActions:e}},[t,i]),L=E&&1===t.length,V=g&&c?.render?(0,a.jsx)("div",{className:"dataviews-view-list__media-wrapper",children:(0,a.jsx)(c.render,{item:i,field:c,config:{sizes:"52px"}})}):null,N=m&&l?.render?(0,a.jsx)(l.render,{item:i,field:l}):null,O=P?.length>0&&(0,a.jsxs)(s.__experimentalHStack,{spacing:3,className:"dataviews-view-list__item-actions",children:[E&&(0,a.jsx)(ka,{idPrefix:n,primaryAction:E,item:i}),!L&&(0,a.jsxs)("div",{role:"gridcell",children:[(0,a.jsxs)(Sa,{placement:"bottom-end",children:[(0,a.jsx)(Sa.TriggerButton,{render:(0,a.jsx)(s.Composite.Item,{id:ja(n),render:(0,a.jsx)(s.Button,{size:"small",icon:Ts,label:(0,Ut.__)("Actions"),accessibleWhenDisabled:!0,disabled:!t.length,onKeyDown:h})})}),(0,a.jsx)(Sa.Popover,{children:(0,a.jsx)(Us,{actions:P,item:i,registry:_,setActiveModalAction:k})})]}),!!j&&(0,a.jsx)(qs,{action:j,items:[i],closeModal:()=>k(null)})]})]});return(0,a.jsx)(s.Composite.Row,{ref:b,render:(0,a.jsx)("div",{"aria-posinset":p,"aria-setsize":w?M.totalItems:void 0}),role:w?"article":"row",className:ro({"is-selected":r,"is-hovered":S}),onMouseEnter:I,onMouseLeave:I,children:(0,a.jsxs)(s.__experimentalHStack,{className:"dataviews-view-list__item-wrapper",spacing:0,children:[(0,a.jsx)("div",{role:"gridcell",children:(0,a.jsx)(s.Composite.Item,{id:Ca(n),"aria-pressed":r,"aria-labelledby":x,"aria-describedby":y,className:"dataviews-view-list__item",onClick:()=>d(i)})}),(0,a.jsxs)(s.__experimentalHStack,{spacing:3,justify:"start",alignment:"flex-start",children:[V,(0,a.jsxs)(s.__experimentalVStack,{spacing:1,className:"dataviews-view-list__field-wrapper",children:[(0,a.jsxs)(s.__experimentalHStack,{spacing:0,children:[(0,a.jsx)("div",{className:"dataviews-title-field",id:x,children:N}),O]}),v&&u?.render&&(0,a.jsx)("div",{className:"dataviews-view-list__field",children:(0,a.jsx)(u.render,{item:i,field:u})}),(0,a.jsx)("div",{className:"dataviews-view-list__fields",id:y,children:f.map(e=>(0,a.jsxs)("div",{className:"dataviews-view-list__field",children:[(0,a.jsx)(s.VisuallyHidden,{as:"span",className:"dataviews-view-list__field-label",children:e.label}),(0,a.jsx)("span",{className:"dataviews-view-list__field-value",children:(0,a.jsx)(e.render,{item:i,field:e})})]},e.id))})]})]})]})})}function Ma(e){return!!e}const{Badge:Ea}=Bs(s.privateApis);function Pa({view:e,multiselect:t,selection:n,onChangeSelection:r,getItemId:i,item:o,mediaField:l,titleField:c,descriptionField:u,regularFields:d,badgeFields:f,config:h,posinset:p,setsize:m}){const{showTitle:g=!0,showMedia:v=!0,showDescription:w=!0}=e,b=i(o),x=n.includes(b),y=l?.render?(0,a.jsx)(l.render,{item:o,field:l,config:h}):null,_=g&&c?.render?(0,a.jsx)(c.render,{item:o,field:c}):null;return(0,a.jsxs)(s.Composite.Item,{"aria-label":c?c.getValue({item:o})||(0,Ut.__)("(no title)"):void 0,render:({children:e,...t})=>(0,a.jsx)(s.__experimentalVStack,{spacing:0,children:e,...t}),role:"option","aria-posinset":p,"aria-setsize":m,className:ro("dataviews-view-picker-grid__card",{"is-selected":x}),"aria-selected":x,onClick:()=>{if(x)r(n.filter(e=>b!==e));else{const e=t?[...n,b]:[b];r(e)}},children:[v&&y&&(0,a.jsx)("div",{className:"dataviews-view-picker-grid__media",children:y}),v&&y&&(0,a.jsx)(Fs,{item:o,selection:n,onChangeSelection:r,getItemId:i,titleField:c,disabled:!1,"aria-hidden":!0,tabIndex:-1}),g&&(0,a.jsx)(s.__experimentalHStack,{justify:"space-between",className:"dataviews-view-picker-grid__title-actions",children:(0,a.jsx)("div",{className:"dataviews-view-picker-grid__title-field dataviews-title-field",children:_})}),(0,a.jsxs)(s.__experimentalVStack,{spacing:1,children:[w&&u?.render&&(0,a.jsx)(u.render,{item:o,field:u}),!!f?.length&&(0,a.jsx)(s.__experimentalHStack,{className:"dataviews-view-picker-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:f.map(e=>(0,a.jsx)(Ea,{className:"dataviews-view-picker-grid__field-value",children:(0,a.jsx)(e.render,{item:o,field:e})},e.id))}),!!d?.length&&(0,a.jsx)(s.__experimentalVStack,{className:"dataviews-view-picker-grid__fields",spacing:1,children:d.map(e=>(0,a.jsx)(s.Flex,{className:"dataviews-view-picker-grid__field",gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:"row",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.FlexItem,{className:"dataviews-view-picker-grid__field-name",children:e.header}),(0,a.jsx)(s.FlexItem,{className:"dataviews-view-picker-grid__field-value",style:{maxHeight:"none"},children:(0,a.jsx)(e.render,{item:o,field:e})})]})},e.id))})]})]},b)}function La({groupName:e,groupField:t,children:n}){const r=(0,So.useInstanceId)(La,"dataviews-view-picker-grid-group__header");return(0,a.jsxs)(s.__experimentalVStack,{spacing:2,role:"group","aria-labelledby":r,children:[(0,a.jsx)("h3",{className:"dataviews-view-picker-grid-group__header",id:r,children:(0,Ut.sprintf)( // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". -(0,b.__)("%1$s: %2$s"),t.label,e)}),n]},e)}const kt=[{value:120,breakpoint:1},{value:170,breakpoint:1},{value:230,breakpoint:1},{value:290,breakpoint:1112},{value:350,breakpoint:1636},{value:430,breakpoint:588}];function It(){const e=(0,a.useContext)(Se),t=e.view,n=kt.filter(t=>e.containerWidth>=t.breakpoint),i=t.layout?.previewSize??230,r=n.map((e,t)=>({...e,index:t})).filter(e=>e.value<=i).sort((e,t)=>t.value-e.value)[0]?.index??0,o=n.map((e,t)=>({value:t}));return(0,c.jsx)(s.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,showTooltip:!1,label:(0,b.__)("Preview size"),value:r,min:0,max:n.length-1,withInputField:!1,onChange:(i=0)=>{e.onChangeView({...t,layout:{...t.layout,previewSize:n[i].value}})},step:1,marks:o})}const Vt=[{type:_e,label:(0,b.__)("Table"),component:function({actions:e,data:t,fields:n,getItemId:i,getItemLevel:r,isLoading:o=!1,onChangeView:l,onChangeSelection:u,selection:d,setOpenedFilter:f,onClickItem:m,isItemClickable:v,renderItemLink:p,view:h,className:g,empty:w}){const{containerRef:x}=(0,a.useContext)(Se),y=(0,a.useRef)(new Map),_=(0,a.useRef)(),[j,C]=(0,a.useState)(),S=Ke(e,t);(0,a.useEffect)(()=>{_.current&&(_.current.focus(),_.current=void 0)});const I=(0,a.useId)(),V=function({scrollContainerRef:e,enabled:t=!1}){const[n,i]=(0,a.useState)(!1),r=(0,W.useDebounce)((0,a.useCallback)(()=>{const t=e.current;var n;t&&i((n=t,(0,b.isRTL)()?Math.abs(n.scrollLeft)<=1:n.scrollLeft+n.clientWidth>=n.scrollWidth-1))},[e,i]),200);return(0,a.useEffect)(()=>"undefined"!=typeof window&&t&&e.current?(r(),e.current.addEventListener("scroll",r),window.addEventListener("resize",r),()=>{e.current?.removeEventListener("scroll",r),window.removeEventListener("resize",r)}):()=>{},[e,t]),n}({scrollContainerRef:x,enabled:!!e?.length});if(j)return _.current=j,void C(void 0);const E=e=>{const t=y.current.get(e.id),n=t?y.current.get(t.fallback):void 0;C(n?.node)},N=!!t?.length,F=n.find(e=>e.id===h.titleField),M=n.find(e=>e.id===h.mediaField),O=n.find(e=>e.id===h.descriptionField),L=h.groupByField?n.find(e=>e.id===h.groupByField):null,P=L?dt(t,L):null,{showTitle:A=!0,showMedia:D=!0,showDescription:T=!0}=h,B=F&&A||M&&D||O&&T,z=h.fields??[],H=(e,t)=>n=>{n?y.current.set(e,{node:n,fallback:z[t>0?t-1:1]}):y.current.delete(e)},R=h.infiniteScrollEnabled&&!P;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("table",{className:k("dataviews-view-table",g,{[`has-${h.layout?.density}-density`]:h.layout?.density&&["compact","comfortable"].includes(h.layout.density)}),"aria-busy":o,"aria-describedby":I,role:R?"feed":void 0,children:[(0,c.jsx)("thead",{children:(0,c.jsxs)("tr",{className:"dataviews-view-table__row",children:[S&&(0,c.jsx)("th",{className:"dataviews-view-table__checkbox-column",scope:"col",children:(0,c.jsx)(Ue,{selection:d,onChangeSelection:u,data:t,actions:e,getItemId:i})}),B&&(0,c.jsx)("th",{scope:"col",children:F&&(0,c.jsx)(lt,{ref:H(F.id,0),fieldId:F.id,view:h,fields:n,onChangeView:l,onHide:E,setOpenedFilter:f,canMove:!1})}),z.map((e,t)=>{const{width:i,maxWidth:r,minWidth:a,align:s}=h.layout?.styles?.[e]??{};return(0,c.jsx)("th",{style:{width:i,maxWidth:r,minWidth:a,textAlign:s},"aria-sort":h.sort?.direction&&h.sort?.field===e?we[h.sort.direction]:void 0,scope:"col",children:(0,c.jsx)(lt,{ref:H(e,t),fieldId:e,view:h,fields:n,onChangeView:l,onHide:E,setOpenedFilter:f,canMove:h.layout?.enableMoving??!0})},e)}),!!e?.length&&(0,c.jsx)("th",{className:k("dataviews-view-table__actions-column",{"dataviews-view-table__actions-column--sticky":!0,"dataviews-view-table__actions-column--stuck":!V}),children:(0,c.jsx)("span",{className:"dataviews-view-table-header",children:(0,b.__)("Actions")})})]})}),N&&L&&P?Array.from(P.entries()).map(([t,a])=>(0,c.jsxs)("tbody",{children:[(0,c.jsx)("tr",{className:"dataviews-view-table__group-header-row",children:(0,c.jsx)("td",{colSpan:z.length+(B?1:0)+(S?1:0)+(e?.length?1:0),className:"dataviews-view-table__group-header-cell",children:(0,b.sprintf)( +(0,Ut.__)("%1$s: %2$s"),t.label,e)}),n]},e)}const Va=[{value:120,breakpoint:1},{value:170,breakpoint:1},{value:230,breakpoint:1},{value:290,breakpoint:1112},{value:350,breakpoint:1636},{value:430,breakpoint:588}];function Na(){const e=(0,o.useContext)(Ls),t=e.view,n=Va.filter(t=>e.containerWidth>=t.breakpoint),r=t.layout?.previewSize??230,i=n.map((e,t)=>({...e,index:t})).filter(e=>e.value<=r).sort((e,t)=>t.value-e.value)[0]?.index??0,l=n.map((e,t)=>({value:t}));return(0,a.jsx)(s.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,showTooltip:!1,label:(0,Ut.__)("Preview size"),value:i,min:0,max:n.length-1,withInputField:!1,onChange:(r=0)=>{e.onChangeView({...t,layout:{...t.layout,previewSize:n[r].value}})},step:1,marks:l})}const Oa=[{type:Ms,label:(0,Ut.__)("Table"),component:function({actions:e,data:t,fields:n,getItemId:r,getItemLevel:i,isLoading:l=!1,onChangeView:c,onChangeSelection:u,selection:d,setOpenedFilter:f,onClickItem:h,isItemClickable:p,renderItemLink:m,view:g,className:v,empty:w}){const{containerRef:b}=(0,o.useContext)(Ls),x=(0,o.useRef)(new Map),y=(0,o.useRef)(),[_,S]=(0,o.useState)(),C=Qs(e,t);(0,o.useEffect)(()=>{y.current&&(y.current.focus(),y.current=void 0)});const j=(0,o.useId)(),k=function({scrollContainerRef:e,enabled:t=!1}){const[n,r]=(0,o.useState)(!1),i=(0,So.useDebounce)((0,o.useCallback)(()=>{const t=e.current;var n;t&&r((n=t,(0,Ut.isRTL)()?Math.abs(n.scrollLeft)<=1:n.scrollLeft+n.clientWidth>=n.scrollWidth-1))},[e,r]),200);return(0,o.useEffect)(()=>"undefined"!=typeof window&&t&&e.current?(i(),e.current.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{e.current?.removeEventListener("scroll",i),window.removeEventListener("resize",i)}):()=>{},[e,t]),n}({scrollContainerRef:b,enabled:!!e?.length});if(_)return y.current=_,void S(void 0);const I=e=>{const t=x.current.get(e.id),n=t?x.current.get(t.fallback):void 0;S(n?.node)},M=!!t?.length,E=n.find(e=>e.id===g.titleField),P=n.find(e=>e.id===g.mediaField),L=n.find(e=>e.id===g.descriptionField),V=g.groupByField?n.find(e=>e.id===g.groupByField):null,N=V?va(t,V):null,{showTitle:O=!0,showMedia:R=!0,showDescription:F=!0}=g,T=E&&O||P&&R||L&&F,A=g.fields??[],D=(e,t)=>n=>{n?x.current.set(e,{node:n,fallback:A[t>0?t-1:1]}):x.current.delete(e)},B=g.infiniteScrollEnabled&&!N;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("table",{className:ro("dataviews-view-table",v,{[`has-${g.layout?.density}-density`]:g.layout?.density&&["compact","comfortable"].includes(g.layout.density)}),"aria-busy":l,"aria-describedby":j,role:B?"feed":void 0,children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"dataviews-view-table__row",children:[C&&(0,a.jsx)("th",{className:"dataviews-view-table__checkbox-column",scope:"col",children:(0,a.jsx)(ea,{selection:d,onChangeSelection:u,data:t,actions:e,getItemId:r})}),T&&(0,a.jsx)("th",{scope:"col",children:E&&(0,a.jsx)(pa,{ref:D(E.id,0),fieldId:E.id,view:g,fields:n,onChangeView:c,onHide:I,setOpenedFilter:f,canMove:!1})}),A.map((e,t)=>{const{width:r,maxWidth:i,minWidth:o,align:s}=g.layout?.styles?.[e]??{};return(0,a.jsx)("th",{style:{width:r,maxWidth:i,minWidth:o,textAlign:s},"aria-sort":g.sort?.direction&&g.sort?.field===e?js[g.sort.direction]:void 0,scope:"col",children:(0,a.jsx)(pa,{ref:D(e,t),fieldId:e,view:g,fields:n,onChangeView:c,onHide:I,setOpenedFilter:f,canMove:g.layout?.enableMoving??!0})},e)}),!!e?.length&&(0,a.jsx)("th",{className:ro("dataviews-view-table__actions-column",{"dataviews-view-table__actions-column--sticky":!0,"dataviews-view-table__actions-column--stuck":!k}),children:(0,a.jsx)("span",{className:"dataviews-view-table-header",children:(0,Ut.__)("Actions")})})]})}),M&&V&&N?Array.from(N.entries()).map(([t,o])=>(0,a.jsxs)("tbody",{children:[(0,a.jsx)("tr",{className:"dataviews-view-table__group-header-row",children:(0,a.jsx)("td",{colSpan:A.length+(T?1:0)+(C?1:0)+(e?.length?1:0),className:"dataviews-view-table__group-header-cell",children:(0,Ut.sprintf)( // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". -(0,b.__)("%1$s: %2$s"),L.label,t)})}),a.map((t,a)=>(0,c.jsx)(mt,{item:t,level:h.showLevels&&"function"==typeof r?r(t):void 0,hasBulkActions:S,actions:e,fields:n,id:i(t)||a.toString(),view:h,titleField:F,mediaField:M,descriptionField:O,selection:d,getItemId:i,onChangeSelection:u,onClickItem:m,renderItemLink:p,isItemClickable:v,isActionsColumnSticky:!V},i(t)))]},`group-${t}`)):(0,c.jsx)("tbody",{children:N&&t.map((t,a)=>(0,c.jsx)(mt,{item:t,level:h.showLevels&&"function"==typeof r?r(t):void 0,hasBulkActions:S,actions:e,fields:n,id:i(t)||a.toString(),view:h,titleField:F,mediaField:M,descriptionField:O,selection:d,getItemId:i,onChangeSelection:u,onClickItem:m,renderItemLink:p,isItemClickable:v,isActionsColumnSticky:!V,posinset:R?a+1:void 0},i(t)))})]}),(0,c.jsxs)("div",{className:k({"dataviews-loading":o,"dataviews-no-results":!N&&!o}),id:I,children:[!N&&(o?(0,c.jsx)("p",{children:(0,c.jsx)(s.Spinner,{})}):w),N&&o&&(0,c.jsx)("p",{className:"dataviews-loading-more",children:(0,c.jsx)(s.Spinner,{})})]})]})},icon:ke,viewConfigOptions:function(){const e=(0,a.useContext)(Se),t=e.view;return(0,c.jsxs)(s.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,size:"__unstable-large",label:(0,b.__)("Density"),value:t.layout?.density||"balanced",onChange:n=>{e.onChangeView({...t,layout:{...t.layout,density:n}})},isBlock:!0,children:[(0,c.jsx)(s.__experimentalToggleGroupControlOption,{value:"comfortable",label:(0,b._x)("Comfortable","Density option for DataView layout")},"comfortable"),(0,c.jsx)(s.__experimentalToggleGroupControlOption,{value:"balanced",label:(0,b._x)("Balanced","Density option for DataView layout")},"balanced"),(0,c.jsx)(s.__experimentalToggleGroupControlOption,{value:"compact",label:(0,b._x)("Compact","Density option for DataView layout")},"compact")]})}},{type:je,label:(0,b.__)("Grid"),component:function({actions:e,data:t,fields:n,getItemId:i,isLoading:r,onChangeSelection:o,onClickItem:l,isItemClickable:u,renderItemLink:d,selection:f,view:m,className:v,empty:p}){const{resizeObserverRef:h}=(0,a.useContext)(Se),g=n.find(e=>e.id===m?.titleField),w=n.find(e=>e.id===m?.mediaField),x=n.find(e=>e.id===m?.descriptionField),y=m.fields??[],{regularFields:_,badgeFields:j}=y.reduce((e,t)=>{const i=n.find(e=>e.id===t);return i?(e[m.layout?.badgeFields?.includes(t)?"badgeFields":"regularFields"].push(i),e):e},{regularFields:[],badgeFields:[]}),C=!!t?.length,S=Ke(e,t),I=m.layout?.previewSize,V="900px",E=m.groupByField?n.find(e=>e.id===m.groupByField):null,N=E?dt(t,E):null,F=m.infiniteScrollEnabled&&!N;return(0,c.jsxs)(c.Fragment,{children:[C&&E&&N&&(0,c.jsx)(s.__experimentalVStack,{spacing:4,children:Array.from(N.entries()).map(([t,n])=>(0,c.jsxs)(s.__experimentalVStack,{spacing:2,children:[(0,c.jsx)("h3",{className:"dataviews-view-grid__group-header",children:(0,b.sprintf)( +(0,Ut.__)("%1$s: %2$s"),V.label,t)})}),o.map((t,o)=>(0,a.jsx)(ba,{item:t,level:g.showLevels&&"function"==typeof i?i(t):void 0,hasBulkActions:C,actions:e,fields:n,id:r(t)||o.toString(),view:g,titleField:E,mediaField:P,descriptionField:L,selection:d,getItemId:r,onChangeSelection:u,onClickItem:h,renderItemLink:m,isItemClickable:p,isActionsColumnSticky:!k},r(t)))]},`group-${t}`)):(0,a.jsx)("tbody",{children:M&&t.map((t,o)=>(0,a.jsx)(ba,{item:t,level:g.showLevels&&"function"==typeof i?i(t):void 0,hasBulkActions:C,actions:e,fields:n,id:r(t)||o.toString(),view:g,titleField:E,mediaField:P,descriptionField:L,selection:d,getItemId:r,onChangeSelection:u,onClickItem:h,renderItemLink:m,isItemClickable:p,isActionsColumnSticky:!k,posinset:B?o+1:void 0},r(t)))})]}),(0,a.jsxs)("div",{className:ro({"dataviews-loading":l,"dataviews-no-results":!M&&!l}),id:j,children:[!M&&(l?(0,a.jsx)("p",{children:(0,a.jsx)(s.Spinner,{})}):w),M&&l&&(0,a.jsx)("p",{className:"dataviews-loading-more",children:(0,a.jsx)(s.Spinner,{})})]})]})},icon:Vs,viewConfigOptions:function(){const e=(0,o.useContext)(Ls),t=e.view;return(0,a.jsxs)(s.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,size:"__unstable-large",label:(0,Ut.__)("Density"),value:t.layout?.density||"balanced",onChange:n=>{e.onChangeView({...t,layout:{...t.layout,density:n}})},isBlock:!0,children:[(0,a.jsx)(s.__experimentalToggleGroupControlOption,{value:"comfortable",label:(0,Ut._x)("Comfortable","Density option for DataView layout")},"comfortable"),(0,a.jsx)(s.__experimentalToggleGroupControlOption,{value:"balanced",label:(0,Ut._x)("Balanced","Density option for DataView layout")},"balanced"),(0,a.jsx)(s.__experimentalToggleGroupControlOption,{value:"compact",label:(0,Ut._x)("Compact","Density option for DataView layout")},"compact")]})}},{type:Es,label:(0,Ut.__)("Grid"),component:function({actions:e,data:t,fields:n,getItemId:r,isLoading:i,onChangeSelection:l,onClickItem:c,isItemClickable:u,renderItemLink:d,selection:f,view:h,className:p,empty:m}){const{resizeObserverRef:g}=(0,o.useContext)(Ls),v=n.find(e=>e.id===h?.titleField),w=n.find(e=>e.id===h?.mediaField),b=n.find(e=>e.id===h?.descriptionField),x=h.fields??[],{regularFields:y,badgeFields:_}=x.reduce((e,t)=>{const r=n.find(e=>e.id===t);return r?(e[h.layout?.badgeFields?.includes(t)?"badgeFields":"regularFields"].push(r),e):e},{regularFields:[],badgeFields:[]}),S=!!t?.length,C=Qs(e,t),j=h.layout?.previewSize,k="900px",I=h.groupByField?n.find(e=>e.id===h.groupByField):null,M=I?va(t,I):null,E=h.infiniteScrollEnabled&&!M;return(0,a.jsxs)(a.Fragment,{children:[S&&I&&M&&(0,a.jsx)(s.__experimentalVStack,{spacing:4,children:Array.from(M.entries()).map(([t,n])=>(0,a.jsxs)(s.__experimentalVStack,{spacing:2,children:[(0,a.jsx)("h3",{className:"dataviews-view-grid__group-header",children:(0,Ut.sprintf)( // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". -(0,b.__)("%1$s: %2$s"),E.label,t)}),(0,c.jsx)(vt,{className:k("dataviews-view-grid",v),previewSize:I,"aria-busy":r,ref:h,children:n.map(t=>(0,c.jsx)(ht,{view:m,selection:f,onChangeSelection:o,onClickItem:l,isItemClickable:u,renderItemLink:d,getItemId:i,item:t,actions:e,mediaField:w,titleField:g,descriptionField:x,regularFields:_,badgeFields:j,hasBulkActions:S,config:{sizes:V}},i(t)))})]},t))}),C&&!N&&(0,c.jsx)(vt,{className:k("dataviews-view-grid",v),previewSize:I,"aria-busy":r,ref:h,role:F?"feed":void 0,children:t.map((t,n)=>(0,c.jsx)(ht,{view:m,selection:f,onChangeSelection:o,onClickItem:l,isItemClickable:u,renderItemLink:d,getItemId:i,item:t,actions:e,mediaField:w,titleField:g,descriptionField:x,regularFields:_,badgeFields:j,hasBulkActions:S,config:{sizes:V},posinset:F?n+1:void 0},i(t)))}),!C&&(0,c.jsx)("div",{className:k({"dataviews-loading":r,"dataviews-no-results":!r}),children:r?(0,c.jsx)("p",{children:(0,c.jsx)(s.Spinner,{})}):p}),C&&r&&(0,c.jsx)("p",{className:"dataviews-loading-more",children:(0,c.jsx)(s.Spinner,{})})]})},icon:Ie,viewConfigOptions:It},{type:"list",label:(0,b.__)("List"),component:function e(t){const{actions:n,data:i,fields:r,getItemId:o,isLoading:l,onChangeSelection:u,selection:d,view:f,className:m,empty:v}=t,p=(0,W.useInstanceId)(e,"view-list"),h=i?.findLast(e=>d.includes(o(e))),g=r.find(e=>e.id===f.titleField),w=r.find(e=>e.id===f.mediaField),x=r.find(e=>e.id===f.descriptionField),y=(f?.fields??[]).map(e=>r.find(t=>e===t.id)).filter(_t),_=e=>u([o(e)]),j=(0,a.useCallback)(e=>`${p}-${o(e)}`,[p,o]),C=(0,a.useCallback)((e,t)=>t.startsWith(j(e)),[j]),[S,I]=(0,a.useState)(void 0);(0,a.useEffect)(()=>{h&&I(bt(j(h)))},[h,j]);const V=i.findIndex(e=>C(e,S??"")),E=(0,W.usePrevious)(V),N=-1!==V,F=(0,a.useCallback)((e,t)=>{const n=Math.min(i.length-1,Math.max(0,e));if(!i[n])return;const r=t(j(i[n]));I(r),document.getElementById(r)?.focus()},[i,j]);(0,a.useEffect)(()=>{!N&&void 0!==E&&-1!==E&&F(E,bt)},[N,F,E]);const M=(0,a.useCallback)(e=>{"ArrowDown"===e.key&&(e.preventDefault(),F(V+1,wt)),"ArrowUp"===e.key&&(e.preventDefault(),F(V-1,wt))},[F,V]),O=i?.length;if(!O)return(0,c.jsx)("div",{className:k({"dataviews-loading":l,"dataviews-no-results":!O&&!l}),children:!O&&(l?(0,c.jsx)("p",{children:(0,c.jsx)(s.Spinner,{})}):v)});const L=f.groupByField?r.find(e=>e.id===f.groupByField):null,P=L?dt(i,L):null;return O&&L&&P?(0,c.jsx)(s.Composite,{id:`${p}`,render:(0,c.jsx)("div",{}),className:"dataviews-view-list__group",role:"grid",activeId:S,setActiveId:I,children:(0,c.jsx)(s.__experimentalVStack,{spacing:4,className:k("dataviews-view-list",m),children:Array.from(P.entries()).map(([e,t])=>(0,c.jsxs)(s.__experimentalVStack,{spacing:2,children:[(0,c.jsx)("h3",{className:"dataviews-view-list__group-header",children:(0,b.sprintf)( +(0,Ut.__)("%1$s: %2$s"),I.label,t)}),(0,a.jsx)(xa,{className:ro("dataviews-view-grid",p),previewSize:j,"aria-busy":i,ref:g,children:n.map(t=>(0,a.jsx)(_a,{view:h,selection:f,onChangeSelection:l,onClickItem:c,isItemClickable:u,renderItemLink:d,getItemId:r,item:t,actions:e,mediaField:w,titleField:v,descriptionField:b,regularFields:y,badgeFields:_,hasBulkActions:C,config:{sizes:k}},r(t)))})]},t))}),S&&!M&&(0,a.jsx)(xa,{className:ro("dataviews-view-grid",p),previewSize:j,"aria-busy":i,ref:g,role:E?"feed":void 0,children:t.map((t,n)=>(0,a.jsx)(_a,{view:h,selection:f,onChangeSelection:l,onClickItem:c,isItemClickable:u,renderItemLink:d,getItemId:r,item:t,actions:e,mediaField:w,titleField:v,descriptionField:b,regularFields:y,badgeFields:_,hasBulkActions:C,config:{sizes:k},posinset:E?n+1:void 0},r(t)))}),!S&&(0,a.jsx)("div",{className:ro({"dataviews-loading":i,"dataviews-no-results":!i}),children:i?(0,a.jsx)("p",{children:(0,a.jsx)(s.Spinner,{})}):m}),S&&i&&(0,a.jsx)("p",{className:"dataviews-loading-more",children:(0,a.jsx)(s.Spinner,{})})]})},icon:Ns,viewConfigOptions:Na},{type:"list",label:(0,Ut.__)("List"),component:function e(t){const{actions:n,data:r,fields:i,getItemId:l,isLoading:c,onChangeSelection:u,selection:d,view:f,className:h,empty:p}=t,m=(0,So.useInstanceId)(e,"view-list"),g=r?.findLast(e=>d.includes(l(e))),v=i.find(e=>e.id===f.titleField),w=i.find(e=>e.id===f.mediaField),b=i.find(e=>e.id===f.descriptionField),x=(f?.fields??[]).map(e=>i.find(t=>e===t.id)).filter(Ma),y=e=>u([l(e)]),_=(0,o.useCallback)(e=>`${m}-${l(e)}`,[m,l]),S=(0,o.useCallback)((e,t)=>t.startsWith(_(e)),[_]),[C,j]=(0,o.useState)(void 0);(0,o.useEffect)(()=>{g&&j(Ca(_(g)))},[g,_]);const k=r.findIndex(e=>S(e,C??"")),I=(0,So.usePrevious)(k),M=-1!==k,E=(0,o.useCallback)((e,t)=>{const n=Math.min(r.length-1,Math.max(0,e));if(!r[n])return;const i=t(_(r[n]));j(i),document.getElementById(i)?.focus()},[r,_]);(0,o.useEffect)(()=>{!M&&void 0!==I&&-1!==I&&E(I,Ca)},[M,E,I]);const P=(0,o.useCallback)(e=>{"ArrowDown"===e.key&&(e.preventDefault(),E(k+1,ja)),"ArrowUp"===e.key&&(e.preventDefault(),E(k-1,ja))},[E,k]),L=r?.length;if(!L)return(0,a.jsx)("div",{className:ro({"dataviews-loading":c,"dataviews-no-results":!L&&!c}),children:!L&&(c?(0,a.jsx)("p",{children:(0,a.jsx)(s.Spinner,{})}):p)});const V=f.groupByField?i.find(e=>e.id===f.groupByField):null,N=V?va(r,V):null;return L&&V&&N?(0,a.jsx)(s.Composite,{id:`${m}`,render:(0,a.jsx)("div",{}),className:"dataviews-view-list__group",role:"grid",activeId:C,setActiveId:j,children:(0,a.jsx)(s.__experimentalVStack,{spacing:4,className:ro("dataviews-view-list",h),children:Array.from(N.entries()).map(([e,t])=>(0,a.jsxs)(s.__experimentalVStack,{spacing:2,children:[(0,a.jsx)("h3",{className:"dataviews-view-list__group-header",children:(0,Ut.sprintf)( // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". -(0,b.__)("%1$s: %2$s"),L.label,e)}),t.map(e=>{const t=j(e);return(0,c.jsx)(yt,{view:f,idPrefix:t,actions:n,item:e,isSelected:e===h,onSelect:_,mediaField:w,titleField:g,descriptionField:x,otherFields:y,onDropdownTriggerKeyDown:M},t)})]},e))})}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.Composite,{id:p,render:(0,c.jsx)("div",{}),className:k("dataviews-view-list",m),role:f.infiniteScrollEnabled?"feed":"grid",activeId:S,setActiveId:I,children:i.map((e,t)=>{const i=j(e);return(0,c.jsx)(yt,{view:f,idPrefix:i,actions:n,item:e,isSelected:e===h,onSelect:_,mediaField:w,titleField:g,descriptionField:x,otherFields:y,onDropdownTriggerKeyDown:M,posinset:f.infiniteScrollEnabled?t+1:void 0},i)})}),O&&l&&(0,c.jsx)("p",{className:"dataviews-loading-more",children:(0,c.jsx)(s.Spinner,{})})]})},icon:(0,b.isRTL)()?Ve:Ee},{type:"pickerGrid",label:(0,b.__)("Grid"),component:function({actions:e,data:t,fields:n,getItemId:i,isLoading:r,onChangeSelection:o,selection:l,view:u,className:d,empty:f}){const{resizeObserverRef:m,paginationInfo:v,itemListLabel:p}=(0,a.useContext)(Se),h=n.find(e=>e.id===u?.titleField),g=n.find(e=>e.id===u?.mediaField),b=n.find(e=>e.id===u?.descriptionField),w=u.fields??[],{regularFields:x,badgeFields:y}=w.reduce((e,t)=>{const i=n.find(e=>e.id===t);return i?(e[u.layout?.badgeFields?.includes(t)?"badgeFields":"regularFields"].push(i),e):e},{regularFields:[],badgeFields:[]}),_=!!t?.length,j=u.layout?.previewSize,C=function(e){return(0,a.useMemo)(()=>e?.every(e=>e.supportsBulk),[e])}(e),S="900px",I=u.groupByField?n.find(e=>e.id===u.groupByField):null,V=I?dt(t,I):null,E=u.infiniteScrollEnabled&&!V,N=u?.page??1,F=u?.perPage??0,M=E?v?.totalItems:void 0;return(0,c.jsxs)(c.Fragment,{children:[_&&I&&V&&(0,c.jsx)(s.Composite,{virtualFocus:!0,orientation:"horizontal",role:"listbox","aria-multiselectable":C,className:k("dataviews-view-picker-grid",d),"aria-label":p,render:({children:e,...t})=>(0,c.jsx)(s.__experimentalVStack,{spacing:4,children:e,...t}),children:Array.from(V.entries()).map(([e,n])=>(0,c.jsx)(St,{groupName:e,groupField:I,children:(0,c.jsx)(vt,{previewSize:j,style:{gridTemplateColumns:j&&`repeat(auto-fill, minmax(${j}px, 1fr))`},"aria-busy":r,ref:m,children:n.map(e=>{const n=(N-1)*F+t.indexOf(e)+1;return(0,c.jsx)(Ct,{view:u,multiselect:C,selection:l,onChangeSelection:o,getItemId:i,item:e,mediaField:g,titleField:h,descriptionField:b,regularFields:x,badgeFields:y,config:{sizes:S},posinset:n,setsize:M},i(e))})})},e))}),_&&!V&&(0,c.jsx)(s.Composite,{render:(0,c.jsx)(vt,{className:k("dataviews-view-picker-grid",d),previewSize:j,"aria-busy":r,ref:m}),virtualFocus:!0,orientation:"horizontal",role:"listbox","aria-multiselectable":C,"aria-label":p,children:t.map((e,t)=>{let n=E?t+1:void 0;return E||(n=(N-1)*F+t+1),(0,c.jsx)(Ct,{view:u,multiselect:C,selection:l,onChangeSelection:o,getItemId:i,item:e,mediaField:g,titleField:h,descriptionField:b,regularFields:x,badgeFields:y,config:{sizes:S},posinset:n,setsize:M},i(e))})}),!_&&(0,c.jsx)("div",{className:k({"dataviews-loading":r,"dataviews-no-results":!r}),children:r?(0,c.jsx)("p",{children:(0,c.jsx)(s.Spinner,{})}):f}),_&&r&&(0,c.jsx)("p",{className:"dataviews-loading-more",children:(0,c.jsx)(s.Spinner,{})})]})},icon:Ie,viewConfigOptions:It,isPicker:!0}],{Menu:Et}=Le(s.privateApis);function Nt({filters:e,view:t,onChangeView:n,setOpenedFilter:i,triggerProps:r}){const a=e.filter(e=>!e.isVisible);return(0,c.jsxs)(Et,{children:[(0,c.jsx)(Et.TriggerButton,{...r}),(0,c.jsx)(Et.Popover,{children:a.map(e=>(0,c.jsx)(Et.Item,{onClick:()=>{i(e.field),n({...t,page:1,filters:[...t.filters||[],{field:e.field,value:void 0,operator:e.operators[0]}]})},children:(0,c.jsx)(Et.ItemLabel,{children:e.name})},e.field))})]})}var Ft=(0,a.forwardRef)(function({filters:e,view:t,onChangeView:n,setOpenedFilter:i},r){if(!e.length||e.every(({isPrimary:e})=>e))return null;const a=e.filter(e=>!e.isVisible);return(0,c.jsx)(Nt,{triggerProps:{render:(0,c.jsx)(s.Button,{accessibleWhenDisabled:!0,size:"compact",className:"dataviews-filters-button",variant:"tertiary",disabled:!a.length,ref:r}),children:(0,b.__)("Add filter")},filters:e,view:t,onChangeView:n,setOpenedFilter:i})});function Mt({buttonRef:e,filtersCount:t,children:n}){return(0,a.useEffect)(()=>()=>{e.current?.focus()},[e]),(0,c.jsxs)(c.Fragment,{children:[n,!!t&&(0,c.jsx)("span",{className:"dataviews-filters-toggle__count",children:t})]})}var Ot=function(){const{filters:e,view:t,onChangeView:n,setOpenedFilter:i,isShowingFilter:r,setIsShowingFilter:o}=(0,a.useContext)(Se),l=(0,a.useRef)(null),u=(0,a.useCallback)(e=>{n(e),o(!0)},[n,o]),d=!!e.filter(e=>e.isVisible).length;if(0===e.length)return null;const f={label:(0,b.__)("Add filter"),"aria-expanded":!1,isPressed:!1},m={label:(0,b._x)("Filter","verb"),"aria-expanded":r,isPressed:r,onClick:()=>{r||i(null),o(!r)}},v=(0,c.jsx)(s.Button,{ref:l,className:"dataviews-filters__visibility-toggle",size:"compact",icon:tt,...d?m:f});return(0,c.jsx)("div",{className:"dataviews-filters__container-visibility-toggle",children:d?(0,c.jsx)(Mt,{buttonRef:l,filtersCount:t.filters?.length,children:v}):(0,c.jsx)(Nt,{filters:e,view:t,onChangeView:u,setOpenedFilter:i,triggerProps:{render:v}})})},Lt=Object.defineProperty,Pt=Object.defineProperties,At=Object.getOwnPropertyDescriptors,Dt=Object.getOwnPropertySymbols,Tt=Object.prototype.hasOwnProperty,Bt=Object.prototype.propertyIsEnumerable,zt=(e,t,n)=>t in e?Lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ht=(e,t)=>{for(var n in t||(t={}))Tt.call(t,n)&&zt(e,n,t[n]);if(Dt)for(var n of Dt(t))Bt.call(t,n)&&zt(e,n,t[n]);return e},Rt=(e,t)=>Pt(e,At(t)),Wt=(e,t)=>{var n={};for(var i in e)Tt.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&Dt)for(var i of Dt(e))t.indexOf(i)<0&&Bt.call(e,i)&&(n[i]=e[i]);return n},$t=Object.defineProperty,qt=Object.defineProperties,Gt=Object.getOwnPropertyDescriptors,Kt=Object.getOwnPropertySymbols,Ut=Object.prototype.hasOwnProperty,Yt=Object.prototype.propertyIsEnumerable,Zt=(e,t,n)=>t in e?$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xt=(e,t)=>{for(var n in t||(t={}))Ut.call(t,n)&&Zt(e,n,t[n]);if(Kt)for(var n of Kt(t))Yt.call(t,n)&&Zt(e,n,t[n]);return e},Qt=(e,t)=>qt(e,Gt(t)),Jt=(e,t)=>{var n={};for(var i in e)Ut.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&Kt)for(var i of Kt(e))t.indexOf(i)<0&&Yt.call(e,i)&&(n[i]=e[i]);return n};function en(...e){}function tn(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function nn(...e){return(...t)=>{for(const n of e)"function"==typeof n&&n(...t)}}function rn(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function an(e){return e}function sn(e,t){if(!e){if("string"!=typeof t)throw new Error("Invariant failed");throw new Error(t)}}function on(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function ln(e){const t={};for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}function cn(...e){for(const t of e)if(void 0!==t)return t}function un(e,t){"function"==typeof e?e(t):e&&(e.current=t)}var dn,fn="undefined"!=typeof window&&!!(null==(dn=window.document)?void 0:dn.createElement);function mn(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function vn(e,t=!1){const{activeElement:n}=mn(e);if(!(null==n?void 0:n.nodeName))return null;if("IFRAME"===n.tagName&&n.contentDocument)return vn(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=mn(n).getElementById(e);if(t)return t}}return n}function pn(e,t){return e===t||e.contains(t)}function hn(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==gn.indexOf(e.type)}var gn=["button","color","file","image","reset","submit"];function bn(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName;return t||n||!1}catch(e){return!1}}function wn(e){return e.isContentEditable||bn(e)}function xn(e){let t=0,n=0;if(bn(e))t=e.selectionStart||0,n=e.selectionEnd||0;else if(e.isContentEditable){const i=mn(e).getSelection();if((null==i?void 0:i.rangeCount)&&i.anchorNode&&pn(e,i.anchorNode)&&i.focusNode&&pn(e,i.focusNode)){const r=i.getRangeAt(0),a=r.cloneRange();a.selectNodeContents(e),a.setEnd(r.startContainer,r.startOffset),t=a.toString().length,a.setEnd(r.endContainer,r.endOffset),n=a.toString().length}}return{start:t,end:n}}function yn(e,t){const n=null==e?void 0:e.getAttribute("role");return n&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(n)?n:t}function jn(e){if(!e)return null;const t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){const{overflowY:n}=getComputedStyle(e);if(t(n))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){const{overflowX:n}=getComputedStyle(e);if(t(n))return e}return jn(e.parentElement)||document.scrollingElement||document.body}function Cn(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function Sn(){return!!fn&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function kn(){return fn&&Sn()&&/apple/i.test(navigator.vendor)}function In(e){return Boolean(e.currentTarget&&!pn(e.currentTarget,e.target))}function Vn(e){return e.target===e.currentTarget}function En(e,t){const n=new FocusEvent("blur",t),i=e.dispatchEvent(n),r=Qt(Xt({},t),{bubbles:!0});return e.dispatchEvent(new FocusEvent("focusout",r)),i}function Nn(e,t){const n=new MouseEvent("click",t);return e.dispatchEvent(n)}function Fn(e,t){const n=t||e.currentTarget,i=e.relatedTarget;return!i||!pn(n,i)}function Mn(e,t,n,i){const r=(e=>{if(i){const t=setTimeout(e,i);return()=>clearTimeout(t)}const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,a,!0),n()}),a=()=>{r(),n()};return e.addEventListener(t,a,{once:!0,capture:!0}),r}function On(e,t,n,i=window){const r=[];try{i.document.addEventListener(e,t,n);for(const a of Array.from(i.frames))r.push(On(e,t,n,a))}catch(e){}return()=>{try{i.document.removeEventListener(e,t,n)}catch(e){}for(const e of r)e()}}var Ln=Ht({},r),Pn=Ln.useId,An=(Ln.useDeferredValue,Ln.useInsertionEffect),Dn=fn?i.useLayoutEffect:i.useEffect;function Tn(e){const t=(0,i.useRef)(()=>{throw new Error("Cannot call an event handler while rendering.")});return An?An(()=>{t.current=e}):t.current=e,(0,i.useCallback)((...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)},[])}function Bn(...e){return(0,i.useMemo)(()=>{if(e.some(Boolean))return t=>{for(const n of e)un(n,t)}},e)}function zn(e){if(Pn){const t=Pn();return e||t}const[t,n]=(0,i.useState)(e);return Dn(()=>{if(e||t)return;const i=Math.random().toString(36).slice(2,8);n(`id-${i}`)},[e,t]),e||t}function Hn(e,t){const n=(0,i.useRef)(!1);(0,i.useEffect)(()=>{if(n.current)return e();n.current=!0},t),(0,i.useEffect)(()=>()=>{n.current=!1},[])}function Rn(e){return Tn("function"==typeof e?e:()=>e)}function Wn(e,t,n=[]){const r=(0,i.useCallback)(n=>(e.wrapElement&&(n=e.wrapElement(n)),t(n)),[...n,e.wrapElement]);return Rt(Ht({},e),{wrapElement:r})}var $n=!1,qn=!1,Gn=0,Kn=0;function Un(e){(function(e){const t=e.movementX||e.screenX-Gn,n=e.movementY||e.screenY-Kn;return Gn=e.screenX,Kn=e.screenY,t||n||!1})(e)&&(qn=!0)}function Yn(){qn=!1}function Zn(e){const t=i.forwardRef((t,n)=>e(Rt(Ht({},t),{ref:n})));return t.displayName=e.displayName||e.name,t}function Xn(e,t){return i.memo(e,t)}function Qn(e,t){const n=t,{wrapElement:r,render:a}=n,s=Wt(n,["wrapElement","render"]),o=Bn(t.ref,function(e){return function(e){return!!e&&!!(0,i.isValidElement)(e)&&("ref"in e.props||"ref"in e)}(e)?Ht({},e.props).ref||e.ref:null}(a));let l;if(i.isValidElement(a)){const e=Rt(Ht({},a.props),{ref:o});l=i.cloneElement(a,function(e,t){const n=Ht({},e);for(const i in t){if(!tn(t,i))continue;if("className"===i){const i="className";n[i]=e[i]?`${e[i]} ${t[i]}`:t[i];continue}if("style"===i){const i="style";n[i]=e[i]?Ht(Ht({},e[i]),t[i]):t[i];continue}const r=t[i];if("function"==typeof r&&i.startsWith("on")){const t=e[i];if("function"==typeof t){n[i]=(...e)=>{r(...e),t(...e)};continue}}n[i]=r}return n}(s,e))}else l=a?a(s):(0,c.jsx)(e,Ht({},s));return r?r(l):l}function Jn(e){const t=(t={})=>e(t);return t.displayName=e.name,t}function ei(e=[],t=[]){const n=i.createContext(void 0),r=i.createContext(void 0),a=()=>i.useContext(n),s=t=>e.reduceRight((e,n)=>(0,c.jsx)(n,Rt(Ht({},t),{children:e})),(0,c.jsx)(n.Provider,Ht({},t)));return{context:n,scopedContext:r,useContext:a,useScopedContext:(e=!1)=>{const t=i.useContext(r),n=a();return e?t:t||n},useProviderContext:()=>{const e=i.useContext(r),t=a();if(!e||e!==t)return t},ContextProvider:s,ScopedContextProvider:e=>(0,c.jsx)(s,Rt(Ht({},e),{children:t.reduceRight((t,n)=>(0,c.jsx)(n,Rt(Ht({},e),{children:t})),(0,c.jsx)(r.Provider,Ht({},e)))}))}}var ti=ei(),ni=ti.useContext,ii=(ti.useScopedContext,ti.useProviderContext,ei([ti.ContextProvider],[ti.ScopedContextProvider])),ri=ii.useContext,ai=(ii.useScopedContext,ii.useProviderContext),si=ii.ContextProvider,oi=ii.ScopedContextProvider,li=(0,i.createContext)(void 0),ci=(0,i.createContext)(void 0),ui=((0,i.createContext)(null),(0,i.createContext)(null),ei([si],[oi])),di=ui.useContext;function fi(e,t){const n=e.__unstableInternals;return sn(n,"Invalid store"),n[t]}function mi(e,...t){let n=e,i=n,r=Symbol(),a=en;const s=new Set,o=new Set,l=new Set,c=new Set,u=new Set,d=new WeakMap,f=new WeakMap,m=(e,t,n=c)=>(n.add(t),f.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),f.delete(t),n.delete(t)}),v=(e,a,s=!1)=>{var l;if(!tn(n,e))return;const m=(v=a,p=n[e],function(e){return"function"==typeof e}(v)?v(function(e){return"function"==typeof e}(p)?p():p):v);var v,p;if(m===n[e])return;if(!s)for(const n of t)null==(l=null==n?void 0:n.setState)||l.call(n,e,m);const h=n;n=Qt(Xt({},n),{[e]:m});const g=Symbol();r=g,o.add(e);const b=(t,i,r)=>{var a;const s=f.get(t);s&&!s.some(t=>r?r.has(t):t===e)||(null==(a=d.get(t))||a(),d.set(t,t(n,i)))};for(const e of c)b(e,h);queueMicrotask(()=>{if(r!==g)return;const e=n;for(const e of u)b(e,i,o);i=e,o.clear()})},p={getState:()=>n,setState:v,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{const e=s.size,i=Symbol();s.add(i);const r=()=>{s.delete(i),s.size||a()};if(e)return r;const o=(c=n,Object.keys(c)).map(e=>nn(...t.map(t=>{var n;const i=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);if(i&&tn(i,e))return gi(t,[e],t=>{v(e,t[e],!0)})})));var c;const u=[];for(const e of l)u.push(e());const d=t.map(pi);return a=nn(...o,...u,...d),r},subscribe:(e,t)=>m(e,t),sync:(e,t)=>(d.set(t,t(n,n)),m(e,t)),batch:(e,t)=>(d.set(t,t(n,i)),m(e,t,u)),pick:e=>mi(function(e,t){const n={};for(const i of t)tn(e,i)&&(n[i]=e[i]);return n}(n,e),p),omit:e=>mi(function(e,t){const n=Xt({},e);for(const e of t)tn(n,e)&&delete n[e];return n}(n,e),p)}};return p}function vi(e,...t){if(e)return fi(e,"setup")(...t)}function pi(e,...t){if(e)return fi(e,"init")(...t)}function hi(e,...t){if(e)return fi(e,"subscribe")(...t)}function gi(e,...t){if(e)return fi(e,"sync")(...t)}function bi(e,...t){if(e)return fi(e,"batch")(...t)}function wi(e,...t){if(e)return fi(e,"omit")(...t)}function xi(...e){var t;const n={};for(const i of e){const e=null==(t=null==i?void 0:i.getState)?void 0:t.call(i);e&&Object.assign(n,e)}const i=mi(n,...e);return Object.assign({},...e,i)}ui.useScopedContext,ui.useProviderContext,ui.ContextProvider,ui.ScopedContextProvider;var yi=n(888),{useSyncExternalStore:_i}=yi;function ji(e,t=an){const n=i.useCallback(t=>e?hi(e,null,t):()=>{},[e]),r=()=>{const n="string"==typeof t?t:null,i="function"==typeof t?t:null,r=null==e?void 0:e.getState();return i?i(r):r&&n&&tn(r,n)?r[n]:void 0};return _i(n,r,r)}function Ci(e,t){const n=i.useRef({}),r=i.useCallback(t=>e?hi(e,null,t):()=>{},[e]),a=()=>{const i=null==e?void 0:e.getState();let r=!1;const a=n.current;for(const e in t){const n=t[e];if("function"==typeof n){const t=n(i);t!==a[e]&&(a[e]=t,r=!0)}if("string"==typeof n){if(!i)continue;if(!tn(i,n))continue;const t=i[n];t!==a[e]&&(a[e]=t,r=!0)}}return r&&(n.current=Ht({},a)),n.current};return _i(r,a,a)}function Si(e,t,n,r){const a=tn(t,n)?t[n]:void 0,s=r?t[r]:void 0,o=function(e){const t=(0,i.useRef)(e);return Dn(()=>{t.current=e}),t}({value:a,setValue:s});Dn(()=>gi(e,[n],(e,t)=>{const{value:i,setValue:r}=o.current;r&&e[n]!==t[n]&&e[n]!==i&&r(e[n])}),[e,n]),Dn(()=>{if(void 0!==a)return e.setState(n,a),bi(e,[n],()=>{void 0!==a&&e.setState(n,a)})})}function ki(e,t,n){return function(e,t,n){return Hn(t,[n.store,n.disclosure]),Si(e,n,"open","setOpen"),Si(e,n,"mounted","setMounted"),Si(e,n,"animated"),Object.assign(e,{disclosure:n.disclosure})}(e,t,n)}function Ii(e,t,n){return Si(e=function(e,t,n){return Hn(t,[n.store]),Si(e,n,"items","setItems"),e}(e,t,n),n,"activeId","setActiveId"),Si(e,n,"includesBaseElement"),Si(e,n,"virtualFocus"),Si(e,n,"orientation"),Si(e,n,"rtl"),Si(e,n,"focusLoop"),Si(e,n,"focusWrap"),Si(e,n,"focusShift"),e}function Vi(e){const t=[];for(const n of e)t.push(...n);return t}function Ei(e){return e.slice().reverse()}function Ni(e={}){var t;e.store;const n=null==(t=e.store)?void 0:t.getState(),i=cn(e.items,null==n?void 0:n.items,e.defaultItems,[]),r=new Map(i.map(e=>[e.id,e])),a={items:i,renderedItems:cn(null==n?void 0:n.renderedItems,[])},s=function(e){return null==e?void 0:e.__unstablePrivateStore}(e.store),o=mi({items:i,renderedItems:a.renderedItems},s),l=mi(a,e.store),c=e=>{const t=function(e,t){const n=e.map((e,t)=>[t,e]);let i=!1;return n.sort(([e,n],[r,a])=>{const s=t(n),o=t(a);return s===o?0:s&&o?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(s,o)?(e>r&&(i=!0),-1):(et):e}(e,e=>e.element);o.setState("renderedItems",t),l.setState("renderedItems",t)};vi(l,()=>pi(o)),vi(o,()=>bi(o,["items"],e=>{l.setState("items",e.items)})),vi(o,()=>bi(o,["renderedItems"],e=>{let t=!0,n=requestAnimationFrame(()=>{const{renderedItems:t}=l.getState();e.renderedItems!==t&&c(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(n);const i=function(e){var t;const n=e.find(e=>!!e.element),i=[...e].reverse().find(e=>!!e.element);let r=null==(t=null==n?void 0:n.element)?void 0:t.parentElement;for(;r&&(null==i?void 0:i.element);){if(i&&r.contains(i.element))return r;r=r.parentElement}return mn(r).body}(e.renderedItems),r=new IntersectionObserver(()=>{t?t=!1:(cancelAnimationFrame(n),n=requestAnimationFrame(()=>c(e.renderedItems)))},{root:i});for(const t of e.renderedItems)t.element&&r.observe(t.element);return()=>{cancelAnimationFrame(n),r.disconnect()}}));const u=(e,t,n=!1)=>{let i;return t(t=>{const n=t.findIndex(({id:t})=>t===e.id),a=t.slice();if(-1!==n){i=t[n];const s=Xt(Xt({},i),e);a[n]=s,r.set(e.id,s)}else a.push(e),r.set(e.id,e);return a}),()=>{t(t=>{if(!i)return n&&r.delete(e.id),t.filter(({id:t})=>t!==e.id);const a=t.findIndex(({id:t})=>t===e.id);if(-1===a)return t;const s=t.slice();return s[a]=i,r.set(e.id,i),s})}},d=e=>u(e,e=>o.setState("items",e),!0);return Qt(Xt({},l),{registerItem:d,renderItem:e=>nn(d(e),u(e,e=>o.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=r.get(e);if(!t){const{items:n}=o.getState();t=n.find(t=>t.id===e),t&&r.set(e,t)}return t||null},__unstablePrivateStore:o})}var Fi={id:null};function Mi(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function Oi(e,t){return e.filter(e=>e.rowId===t)}function Li(e){const t=[];for(const n of e){const e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId});e?e.push(n):t.push([n])}return t}function Pi(e){let t=0;for(const{length:n}of e)n>t&&(t=n);return t}function Ai(e){return{id:"__EMPTY_ITEM__",disabled:!0,rowId:e}}var Di=kn()&&fn&&!!navigator.maxTouchPoints;function Ti(e={}){var t=e,{tag:n}=t,i=Jt(t,["tag"]);const r=xi(i.store,function(e,...t){if(e)return fi(e,"pick")(...t)}(n,["value","rtl"])),a=null==n?void 0:n.getState(),s=null==r?void 0:r.getState(),o=cn(i.activeId,null==s?void 0:s.activeId,i.defaultActiveId,null),l=function(e={}){var t;const n=null==(t=e.store)?void 0:t.getState(),i=Ni(e),r=cn(e.activeId,null==n?void 0:n.activeId,e.defaultActiveId),a=mi(Qt(Xt({},i.getState()),{id:cn(e.id,null==n?void 0:n.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:r,baseElement:cn(null==n?void 0:n.baseElement,null),includesBaseElement:cn(e.includesBaseElement,null==n?void 0:n.includesBaseElement,null===r),moves:cn(null==n?void 0:n.moves,0),orientation:cn(e.orientation,null==n?void 0:n.orientation,"both"),rtl:cn(e.rtl,null==n?void 0:n.rtl,!1),virtualFocus:cn(e.virtualFocus,null==n?void 0:n.virtualFocus,!1),focusLoop:cn(e.focusLoop,null==n?void 0:n.focusLoop,!1),focusWrap:cn(e.focusWrap,null==n?void 0:n.focusWrap,!1),focusShift:cn(e.focusShift,null==n?void 0:n.focusShift,!1)}),i,e.store);vi(a,()=>gi(a,["renderedItems","activeId"],e=>{a.setState("activeId",t=>{var n;return void 0!==t?t:null==(n=Mi(e.renderedItems))?void 0:n.id})}));const s=(e="next",t={})=>{var n,i;const r=a.getState(),{skip:s=0,activeId:o=r.activeId,focusShift:l=r.focusShift,focusLoop:c=r.focusLoop,focusWrap:u=r.focusWrap,includesBaseElement:d=r.includesBaseElement,renderedItems:f=r.renderedItems,rtl:m=r.rtl}=t,v="up"===e||"down"===e,p="next"===e||"down"===e,h=p?m&&!v:!m||v,g=l&&!s;let b=v?Vi(function(e,t,n){const i=Pi(e);for(const r of e)for(let e=0;ee.id===o);if(!w)return null==(i=Mi(b))?void 0:i.id;const x=b.some(e=>e.rowId),y=b.indexOf(w),_=b.slice(y+1),j=Oi(_,w.rowId);if(s){const e=function(e,t){return e.filter(e=>t?!e.disabled&&e.id!==t:!e.disabled)}(j,o),t=e.slice(s)[0]||e[e.length-1];return null==t?void 0:t.id}const C=c&&(v?"horizontal"!==c:"vertical"!==c),S=x&&u&&(v?"horizontal"!==u:"vertical"!==u),k=p?(!x||v)&&C&&d:!!v&&d;if(C){const e=function(e,t,n=!1){const i=e.findIndex(e=>e.id===t);return[...e.slice(i+1),...n?[Fi]:[],...e.slice(0,i)]}(S&&!k?b:Oi(b,w.rowId),o,k),t=Mi(e,o);return null==t?void 0:t.id}if(S){const e=Mi(k?j:_,o);return k?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const I=Mi(j,o);return!I&&k?null:null==I?void 0:I.id};return Qt(Xt(Xt({},i),a),{setBaseElement:e=>a.setState("baseElement",e),setActiveId:e=>a.setState("activeId",e),move:e=>{void 0!==e&&(a.setState("activeId",e),a.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=Mi(a.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=Mi(Ei(a.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("up",e))})}(Qt(Xt({},i),{activeId:o,includesBaseElement:cn(i.includesBaseElement,null==s?void 0:s.includesBaseElement,!0),orientation:cn(i.orientation,null==s?void 0:s.orientation,"vertical"),focusLoop:cn(i.focusLoop,null==s?void 0:s.focusLoop,!0),focusWrap:cn(i.focusWrap,null==s?void 0:s.focusWrap,!0),virtualFocus:cn(i.virtualFocus,null==s?void 0:s.virtualFocus,!0)})),c=function(e={}){var t=e,{popover:n}=t,i=Jt(t,["popover"]);const r=xi(i.store,wi(n,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),a=null==r?void 0:r.getState(),s=function(e={}){return function(e={}){const t=xi(e.store,wi(e.disclosure,["contentElement","disclosureElement"])),n=null==t?void 0:t.getState(),i=cn(e.open,null==n?void 0:n.open,e.defaultOpen,!1),r=cn(e.animated,null==n?void 0:n.animated,!1),a=mi({open:i,animated:r,animating:!!r&&i,mounted:i,contentElement:cn(null==n?void 0:n.contentElement,null),disclosureElement:cn(null==n?void 0:n.disclosureElement,null)},t);return vi(a,()=>gi(a,["animated","animating"],e=>{e.animated||a.setState("animating",!1)})),vi(a,()=>hi(a,["open"],()=>{a.getState().animated&&a.setState("animating",!0)})),vi(a,()=>gi(a,["open","animating"],e=>{a.setState("mounted",e.open||e.animating)})),Qt(Xt({},a),{disclosure:e.disclosure,setOpen:e=>a.setState("open",e),show:()=>a.setState("open",!0),hide:()=>a.setState("open",!1),toggle:()=>a.setState("open",e=>!e),stopAnimation:()=>a.setState("animating",!1),setContentElement:e=>a.setState("contentElement",e),setDisclosureElement:e=>a.setState("disclosureElement",e)})}(e)}(Qt(Xt({},i),{store:r})),o=cn(i.placement,null==a?void 0:a.placement,"bottom"),l=mi(Qt(Xt({},s.getState()),{placement:o,currentPlacement:o,anchorElement:cn(null==a?void 0:a.anchorElement,null),popoverElement:cn(null==a?void 0:a.popoverElement,null),arrowElement:cn(null==a?void 0:a.arrowElement,null),rendered:Symbol("rendered")}),s,r);return Qt(Xt(Xt({},s),l),{setAnchorElement:e=>l.setState("anchorElement",e),setPopoverElement:e=>l.setState("popoverElement",e),setArrowElement:e=>l.setState("arrowElement",e),render:()=>l.setState("rendered",Symbol("rendered"))})}(Qt(Xt({},i),{placement:cn(i.placement,null==s?void 0:s.placement,"bottom-start")})),u=cn(i.value,null==s?void 0:s.value,i.defaultValue,""),d=cn(i.selectedValue,null==s?void 0:s.selectedValue,null==a?void 0:a.values,i.defaultSelectedValue,""),f=Array.isArray(d),m=Qt(Xt(Xt({},l.getState()),c.getState()),{value:u,selectedValue:d,resetValueOnSelect:cn(i.resetValueOnSelect,null==s?void 0:s.resetValueOnSelect,f),resetValueOnHide:cn(i.resetValueOnHide,null==s?void 0:s.resetValueOnHide,f&&!n),activeValue:null==s?void 0:s.activeValue}),v=mi(m,l,c,r);return Di&&vi(v,()=>gi(v,["virtualFocus"],()=>{v.setState("virtualFocus",!1)})),vi(v,()=>{if(n)return nn(gi(v,["selectedValue"],e=>{Array.isArray(e.selectedValue)&&n.setValues(e.selectedValue)}),gi(n,["values"],e=>{v.setState("selectedValue",e.values)}))}),vi(v,()=>gi(v,["resetValueOnHide","mounted"],e=>{e.resetValueOnHide&&(e.mounted||v.setState("value",u))})),vi(v,()=>gi(v,["open"],e=>{e.open||(v.setState("activeId",o),v.setState("moves",0))})),vi(v,()=>gi(v,["moves","activeId"],(e,t)=>{e.moves===t.moves&&v.setState("activeValue",void 0)})),vi(v,()=>bi(v,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;const{activeId:n}=v.getState(),i=l.item(n);v.setState("activeValue",null==i?void 0:i.value)})),Qt(Xt(Xt(Xt({},c),l),v),{tag:n,setValue:e=>v.setState("value",e),resetValue:()=>v.setState("value",m.value),setSelectedValue:e=>v.setState("selectedValue",e)})}function Bi(e={}){e=function(e){const t=di();return function(e){const t=zn(e.id);return Ht({id:t},e)}(e=Rt(Ht({},e),{tag:void 0!==e.tag?e.tag:t}))}(e);const[t,n]=function(e,t){const[n,r]=i.useState(()=>e(t));Dn(()=>pi(n),[n]);const a=i.useCallback(e=>ji(n,e),[n]);return[i.useMemo(()=>Rt(Ht({},n),{useState:a}),[n,a]),Tn(()=>{r(n=>e(Ht(Ht({},t),n.getState())))})]}(Ti,e);return function(e,t,n){return Hn(t,[n.tag]),Si(e,n,"value","setValue"),Si(e,n,"selectedValue","setSelectedValue"),Si(e,n,"resetValueOnHide"),Si(e,n,"resetValueOnSelect"),Object.assign(Ii(function(e,t,n){return Hn(t,[n.popover]),Si(e,n,"placement"),ki(e,t,n)}(e,t,n),t,n),{tag:n.tag})}(t,n,e)}var zi=ei(),Hi=(zi.useContext,zi.useScopedContext,zi.useProviderContext),Ri=ei([zi.ContextProvider],[zi.ScopedContextProvider]),Wi=(Ri.useContext,Ri.useScopedContext,Ri.useProviderContext,Ri.ContextProvider),$i=Ri.ScopedContextProvider,qi=((0,i.createContext)(void 0),(0,i.createContext)(void 0),ei([Wi],[$i])),Gi=(qi.useContext,qi.useScopedContext,qi.useProviderContext),Ki=qi.ContextProvider,Ui=qi.ScopedContextProvider,Yi=(0,i.createContext)(void 0),Zi=ei([Ki,si],[Ui,oi]),Xi=Zi.useContext,Qi=Zi.useScopedContext,Ji=Zi.useProviderContext,er=Zi.ContextProvider,tr=Zi.ScopedContextProvider,nr=(0,i.createContext)(void 0),ir=(0,i.createContext)(!1);function rr(e={}){const t=Bi(e);return(0,c.jsx)(er,{value:t,children:e.children})}var ar=Jn(function(e){var t=e,{store:n}=t,i=Wt(t,["store"]);const r=Ji();sn(n=n||r,!1);const a=n.useState(e=>{var t;return null==(t=e.baseElement)?void 0:t.id});return ln(i=Ht({htmlFor:a},i))}),sr=Xn(Zn(function(e){return Qn("label",ar(e))}));function or(e,t){return t&&e.item(t)||null}var lr=Symbol("FOCUS_SILENTLY");function cr(e,t,n){if(!t)return!1;if(t===n)return!1;const i=e.item(t.id);return!(!i||n&&i.element===n)}var ur=(0,i.createContext)(!0),dr="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function fr(e){return!!e.matches(dr)&&!!function(e){if("function"==typeof e.checkVisibility)return e.checkVisibility();const t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)&&!e.closest("[inert]")}function mr(e){const t=vn(e);if(!t)return!1;if(t===e)return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function vr(e){const t=vn(e);if(!t)return!1;if(pn(e,t))return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&"id"in e&&(n===e.id||!!e.querySelector(`#${CSS.escape(n)}`))}var pr=kn(),hr=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],gr=Symbol("safariFocusAncestor");function br(e,t){e&&(e[gr]=t)}function wr(e){return!("input"!==e.tagName.toLowerCase()||!e.type||"radio"!==e.type&&"checkbox"!==e.type)}function xr(e,t,n,i,r){return e?t?n&&!i?-1:void 0:n?r:r||0:r}function yr(e,t){return Tn(n=>{null==e||e(n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())})}var _r=!1,jr=!0;function Cr(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(jr=!1))}function Sr(e){e.metaKey||e.ctrlKey||e.altKey||(jr=!0)}var kr=Jn(function(e){var t=e,{focusable:n=!0,accessibleWhenDisabled:r,autoFocus:a,onFocusVisible:s}=t,o=Wt(t,["focusable","accessibleWhenDisabled","autoFocus","onFocusVisible"]);const l=(0,i.useRef)(null);(0,i.useEffect)(()=>{n&&(_r||(On("mousedown",Cr,!0),On("keydown",Sr,!0),_r=!0))},[n]),pr&&(0,i.useEffect)(()=>{if(!n)return;const e=l.current;if(!e)return;if(!wr(e))return;const t=function(e){return"labels"in e?e.labels:null}(e);if(!t)return;const i=()=>queueMicrotask(()=>e.focus());for(const e of t)e.addEventListener("mouseup",i);return()=>{for(const e of t)e.removeEventListener("mouseup",i)}},[n]);const c=n&&on(o),u=!!c&&!r,[d,f]=(0,i.useState)(!1);(0,i.useEffect)(()=>{n&&u&&d&&f(!1)},[n,u,d]),(0,i.useEffect)(()=>{if(!n)return;if(!d)return;const e=l.current;if(!e)return;if("undefined"==typeof IntersectionObserver)return;const t=new IntersectionObserver(()=>{fr(e)||f(!1)});return t.observe(e),()=>t.disconnect()},[n,d]);const m=yr(o.onKeyPressCapture,c),v=yr(o.onMouseDownCapture,c),p=yr(o.onClickCapture,c),h=o.onMouseDown,g=Tn(e=>{if(null==h||h(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget;if(!pr)return;if(In(e))return;if(!hn(t)&&!wr(t))return;let i=!1;const r=()=>{i=!0};t.addEventListener("focusin",r,{capture:!0,once:!0});const a=function(e){for(;e&&!fr(e);)e=e.closest(dr);return e||null}(t.parentElement);br(a,!0),Mn(t,"mouseup",()=>{t.removeEventListener("focusin",r,!0),br(a,!1),i||function(e){!vr(e)&&fr(e)&&e.focus()}(t)})}),b=(e,t)=>{if(t&&(e.currentTarget=t),!n)return;const i=e.currentTarget;i&&mr(i)&&(null==s||s(e),e.defaultPrevented||(i.dataset.focusVisible="true",f(!0)))},w=o.onKeyDownCapture,x=Tn(e=>{if(null==w||w(e),e.defaultPrevented)return;if(!n)return;if(d)return;if(e.metaKey)return;if(e.altKey)return;if(e.ctrlKey)return;if(!Vn(e))return;const t=e.currentTarget;Mn(t,"focusout",()=>b(e,t))}),y=o.onFocusCapture,_=Tn(e=>{if(null==y||y(e),e.defaultPrevented)return;if(!n)return;if(!Vn(e))return void f(!1);const t=e.currentTarget;jr||function(e){const{tagName:t,readOnly:n,type:i}=e;return"TEXTAREA"===t&&!n||"SELECT"===t&&!n||("INPUT"!==t||n?!!e.isContentEditable||!("combobox"!==e.getAttribute("role")||!e.dataset.name):hr.includes(i))}(e.target)?Mn(e.target,"focusout",()=>b(e,t)):f(!1)}),j=o.onBlur,C=Tn(e=>{null==j||j(e),n&&Fn(e)&&(e.currentTarget.removeAttribute("data-focus-visible"),f(!1))}),S=(0,i.useContext)(ur),k=Tn(e=>{n&&a&&e&&S&&queueMicrotask(()=>{mr(e)||fr(e)&&e.focus()})}),I=function(e,t){const n=e=>{if("string"==typeof e)return e},[r,a]=(0,i.useState)(()=>n(t));return Dn(()=>{const i=e&&"current"in e?e.current:e;a((null==i?void 0:i.tagName.toLowerCase())||n(t))},[e,t]),r}(l),V=n&&function(e){return!e||"button"===e||"summary"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(I),E=n&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(I),N=o.style,F=(0,i.useMemo)(()=>u?Ht({pointerEvents:"none"},N):N,[u,N]);return ln(o=Rt(Ht({"data-focus-visible":n&&d||void 0,"data-autofocus":a||void 0,"aria-disabled":c||void 0},o),{ref:Bn(l,k,o.ref),style:F,tabIndex:xr(n,u,V,E,o.tabIndex),disabled:!(!E||!u)||void 0,contentEditable:c?void 0:o.contentEditable,onKeyPressCapture:m,onClickCapture:p,onMouseDownCapture:v,onMouseDown:g,onKeyDownCapture:x,onFocusCapture:_,onBlur:C}))});function Ir(e,t,n){return Tn(i=>{var r;if(null==t||t(i),i.defaultPrevented)return;if(i.isPropagationStopped())return;if(!Vn(i))return;if(function(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}(i))return;if(function(e){const t=e.target;return!(t&&!bn(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(i))return;const a=e.getState(),s=null==(r=or(e,a.activeId))?void 0:r.element;if(!s)return;const o=i,{view:l}=o,c=Wt(o,["view"]);s!==(null==n?void 0:n.current)&&s.focus(),function(e,t,n){const i=new KeyboardEvent(t,n);return e.dispatchEvent(i)}(s,i.type,c)||i.preventDefault(),i.currentTarget.contains(s)&&i.stopPropagation()})}Zn(function(e){return Qn("div",kr(e))});var Vr=Jn(function(e){var t=e,{store:n,composite:r=!0,focusOnMove:a=r,moveOnKeyPress:s=!0}=t,o=Wt(t,["store","composite","focusOnMove","moveOnKeyPress"]);const l=ai();sn(n=n||l,!1);const u=(0,i.useRef)(null),d=(0,i.useRef)(null),f=function(e){const[t,n]=(0,i.useState)(!1),r=(0,i.useCallback)(()=>n(!0),[]),a=e.useState(t=>or(e,t.activeId));return(0,i.useEffect)(()=>{const e=null==a?void 0:a.element;t&&e&&(n(!1),e.focus({preventScroll:!0}))},[a,t]),r}(n),m=n.useState("moves"),[,v]=function(e){const[t,n]=(0,i.useState)(null);return Dn(()=>{if(null==t)return;if(!e)return;let n=null;return e(e=>(n=e,t)),()=>{e(n)}},[t,e]),[t,n]}(r?n.setBaseElement:null);(0,i.useEffect)(()=>{var e;if(!n)return;if(!m)return;if(!r)return;if(!a)return;const{activeId:t}=n.getState(),i=null==(e=or(n,t))?void 0:e.element;var s;i&&("scrollIntoView"in(s=i)?(s.focus({preventScroll:!0}),s.scrollIntoView(Xt({block:"nearest",inline:"nearest"},undefined))):s.focus())},[n,m,r,a]),Dn(()=>{if(!n)return;if(!m)return;if(!r)return;const{baseElement:e,activeId:t}=n.getState();if(null!==t)return;if(!e)return;const i=d.current;d.current=null,i&&En(i,{relatedTarget:e}),mr(e)||e.focus()},[n,m,r]);const p=n.useState("activeId"),h=n.useState("virtualFocus");Dn(()=>{var e;if(!n)return;if(!r)return;if(!h)return;const t=d.current;if(d.current=null,!t)return;const i=(null==(e=or(n,p))?void 0:e.element)||vn(t);i!==t&&En(t,{relatedTarget:i})},[n,p,h,r]);const g=Ir(n,o.onKeyDownCapture,d),b=Ir(n,o.onKeyUpCapture,d),w=o.onFocusCapture,x=Tn(e=>{if(null==w||w(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:t}=n.getState();if(!t)return;const i=e.relatedTarget,r=function(e){const t=e[lr];return delete e[lr],t}(e.currentTarget);Vn(e)&&r&&(e.stopPropagation(),d.current=i)}),y=o.onFocus,_=Tn(e=>{if(null==y||y(e),e.defaultPrevented)return;if(!r)return;if(!n)return;const{relatedTarget:t}=e,{virtualFocus:i}=n.getState();i?Vn(e)&&!cr(n,t)&&queueMicrotask(f):Vn(e)&&n.setActiveId(null)}),j=o.onBlurCapture,C=Tn(e=>{var t;if(null==j||j(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:i,activeId:r}=n.getState();if(!i)return;const a=null==(t=or(n,r))?void 0:t.element,s=e.relatedTarget,o=cr(n,s),l=d.current;d.current=null,Vn(e)&&o?(s===a?l&&l!==s&&En(l,e):a?En(a,e):l&&En(l,e),e.stopPropagation()):!cr(n,e.target)&&a&&En(a,e)}),S=o.onKeyDown,k=Rn(s),I=Tn(e=>{var t;if(null==S||S(e),e.nativeEvent.isComposing)return;if(e.defaultPrevented)return;if(!n)return;if(!Vn(e))return;const{orientation:i,renderedItems:r,activeId:a}=n.getState(),s=or(n,a);if(null==(t=null==s?void 0:s.element)?void 0:t.isConnected)return;const o="horizontal"!==i,l="vertical"!==i,c=r.some(e=>!!e.rowId);if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&bn(e.currentTarget))return;const u={ArrowUp:(c||o)&&(()=>{if(c){const e=function(e){return e.find(e=>!e.disabled)}(Vi(Ei(function(e){const t=[];for(const n of e){const e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId});e?e.push(n):t.push([n])}return t}(r))));return null==e?void 0:e.id}return null==n?void 0:n.last()}),ArrowRight:(c||l)&&n.first,ArrowDown:(c||o)&&n.first,ArrowLeft:(c||l)&&n.last,Home:n.first,End:n.last,PageUp:n.first,PageDown:n.last},d=u[e.key];if(d){const t=d();if(void 0!==t){if(!k(e))return;e.preventDefault(),n.move(t)}}});o=Wn(o,e=>(0,c.jsx)(si,{value:n,children:e}),[n]);const V=n.useState(e=>{var t;if(n&&r&&e.virtualFocus)return null==(t=or(n,e.activeId))?void 0:t.id});o=Rt(Ht({"aria-activedescendant":V},o),{ref:Bn(u,v,o.ref),onKeyDownCapture:g,onKeyUpCapture:b,onFocusCapture:x,onFocus:_,onBlurCapture:C,onKeyDown:I});const E=n.useState(e=>r&&(e.virtualFocus||null===e.activeId));return kr(Ht({focusable:E},o))}),Er=(Zn(function(e){return Qn("div",Vr(e))}),Jn(function(e){var t=e,{store:n}=t,i=Wt(t,["store"]);const r=Gi();return n=n||r,Rt(Ht({},i),{ref:Bn(null==n?void 0:n.setAnchorElement,i.ref)})}));function Nr(e,t,n){if(!n)return!1;const i=e.find(e=>!e.disabled&&e.value);return(null==i?void 0:i.value)===t}function Fr(e,t){return!!t&&null!=e&&(e=rn(e),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase()))}Zn(function(e){return Qn("div",Er(e))});var Mr=Jn(function(e){var t=e,{store:n,focusable:r=!0,autoSelect:a=!1,getAutoSelectId:s,setValueOnChange:o,showMinLength:l=0,showOnChange:c,showOnMouseDown:u,showOnClick:d=u,showOnKeyDown:f,showOnKeyPress:m=f,blurActiveItemOnClick:v,setValueOnClick:p=!0,moveOnKeyPress:h=!0,autoComplete:g="list"}=t,b=Wt(t,["store","focusable","autoSelect","getAutoSelectId","setValueOnChange","showMinLength","showOnChange","showOnMouseDown","showOnClick","showOnKeyDown","showOnKeyPress","blurActiveItemOnClick","setValueOnClick","moveOnKeyPress","autoComplete"]);const w=Ji();sn(n=n||w,!1);const x=(0,i.useRef)(null),[y,_]=(0,i.useReducer)(()=>[],[]),j=(0,i.useRef)(!1),C=(0,i.useRef)(!1),S=n.useState(e=>e.virtualFocus&&a),k="inline"===g||"both"===g,[I,V]=(0,i.useState)(k);!function(e,t){const n=(0,i.useRef)(!1);Dn(()=>{n.current?k&&V(!0):n.current=!0},t),Dn(()=>()=>{n.current=!1},[])}(0,[k]);const E=n.useState("value"),N=(0,i.useRef)();(0,i.useEffect)(()=>gi(n,["selectedValue","activeId"],(e,t)=>{N.current=t.selectedValue}),[]);const F=n.useState(e=>{var t;if(k&&I){if(e.activeValue&&Array.isArray(e.selectedValue)){if(e.selectedValue.includes(e.activeValue))return;if(null==(t=N.current)?void 0:t.includes(e.activeValue))return}return e.activeValue}}),M=n.useState("renderedItems"),O=n.useState("open"),L=n.useState("contentElement"),P=(0,i.useMemo)(()=>{if(!k)return E;if(!I)return E;if(Nr(M,F,S)){if(Fr(E,F)){const e=(null==F?void 0:F.slice(E.length))||"";return E+e}return E}return F||E},[k,I,M,F,S,E]);(0,i.useEffect)(()=>{const e=x.current;if(!e)return;const t=()=>V(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,i.useEffect)(()=>{if(!k)return;if(!I)return;if(!F)return;if(!Nr(M,F,S))return;if(!Fr(E,F))return;let e=en;return queueMicrotask(()=>{const t=x.current;if(!t)return;const{start:n,end:i}=xn(t),r=E.length,a=F.length;Cn(t,r,a),e=()=>{if(!mr(t))return;const{start:e,end:s}=xn(t);e===r&&s===a&&Cn(t,n,i)}}),()=>e()},[y,k,I,F,M,S,E]);const A=(0,i.useRef)(null),D=Tn(s),T=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(!O)return;if(!L)return;const e=jn(L);if(!e)return;A.current=e;const t=()=>{j.current=!1},i=()=>{if(!n)return;if(!j.current)return;const{activeId:e}=n.getState();null!==e&&e!==T.current&&(j.current=!1)},r={passive:!0,capture:!0};return e.addEventListener("wheel",t,r),e.addEventListener("touchmove",t,r),e.addEventListener("scroll",i,r),()=>{e.removeEventListener("wheel",t,!0),e.removeEventListener("touchmove",t,!0),e.removeEventListener("scroll",i,!0)}},[O,L,n]),Dn(()=>{E&&(C.current||(j.current=!0))},[E]),Dn(()=>{"always"!==S&&O||(j.current=O)},[S,O]);const B=n.useState("resetValueOnSelect");Hn(()=>{var e,t;const i=j.current;if(!n)return;if(!O)return;if(!i&&!B)return;const{baseElement:r,contentElement:a,activeId:s}=n.getState();if(!r||mr(r)){if(null==a?void 0:a.hasAttribute("data-placing")){const e=new MutationObserver(_);return e.observe(a,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(S&&i){const t=D(M),i=void 0!==t?t:null!=(e=function(e){const t=e.find(e=>{var t;return!e.disabled&&"tab"!==(null==(t=e.element)?void 0:t.getAttribute("role"))});return null==t?void 0:t.id}(M))?e:n.first();T.current=i,n.move(null!=i?i:null)}else{const e=null==(t=n.item(s||n.first()))?void 0:t.element;e&&"scrollIntoView"in e&&e.scrollIntoView({block:"nearest",inline:"nearest"})}}},[n,O,y,E,S,B,D,M]),(0,i.useEffect)(()=>{if(!k)return;const e=x.current;if(!e)return;const t=[e,L].filter(e=>!!e),i=e=>{t.every(t=>Fn(e,t))&&(null==n||n.setValue(P))};for(const e of t)e.addEventListener("focusout",i);return()=>{for(const e of t)e.removeEventListener("focusout",i)}},[k,L,n,P]);const z=e=>e.currentTarget.value.length>=l,H=b.onChange,R=Rn(null!=c?c:z),W=Rn(null!=o?o:!n.tag),$=Tn(e=>{if(null==H||H(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget,{value:i,selectionStart:r,selectionEnd:a}=t,s=e.nativeEvent;if(j.current=!0,function(e){return"input"===e.type}(s)&&(s.isComposing&&(j.current=!1,C.current=!0),k)){const e="insertText"===s.inputType||"insertCompositionText"===s.inputType,t=r===i.length;V(e&&t)}if(W(e)){const e=i===n.getState().value;n.setValue(i),queueMicrotask(()=>{Cn(t,r,a)}),k&&S&&e&&_()}R(e)&&n.show(),S&&j.current||n.setActiveId(null)}),q=b.onCompositionEnd,G=Tn(e=>{j.current=!0,C.current=!1,null==q||q(e),e.defaultPrevented||S&&_()}),K=b.onMouseDown,U=Rn(null!=v?v:()=>!!(null==n?void 0:n.getState().includesBaseElement)),Y=Rn(p),Z=Rn(null!=d?d:z),X=Tn(e=>{null==K||K(e),e.defaultPrevented||e.button||e.ctrlKey||n&&(U(e)&&n.setActiveId(null),Y(e)&&n.setValue(P),Z(e)&&Mn(e.currentTarget,"mouseup",n.show))}),Q=b.onKeyDown,J=Rn(null!=m?m:z),ee=Tn(e=>{if(null==Q||Q(e),e.repeat||(j.current=!1),e.defaultPrevented)return;if(e.ctrlKey)return;if(e.altKey)return;if(e.shiftKey)return;if(e.metaKey)return;if(!n)return;const{open:t}=n.getState();t||"ArrowUp"!==e.key&&"ArrowDown"!==e.key||J(e)&&(e.preventDefault(),n.show())}),te=b.onBlur,ne=Tn(e=>{j.current=!1,null==te||te(e),e.defaultPrevented}),ie=zn(b.id),re=function(e){return"inline"===e||"list"===e||"both"===e||"none"===e}(g)?g:void 0,ae=n.useState(e=>null===e.activeId);return b=Rt(Ht({id:ie,role:"combobox","aria-autocomplete":re,"aria-haspopup":yn(L,"listbox"),"aria-expanded":O,"aria-controls":null==L?void 0:L.id,"data-active-item":ae||void 0,value:P},b),{ref:Bn(x,b.ref),onChange:$,onCompositionEnd:G,onMouseDown:X,onKeyDown:ee,onBlur:ne}),b=Vr(Rt(Ht({store:n,focusable:r},b),{moveOnKeyPress:e=>!function(e,...t){const n="function"==typeof e?e(...t):e;return null!=n&&!n}(h,e)&&(k&&V(!0),!0)})),b=Er(Ht({store:n},b)),Ht({autoComplete:"off"},b)}),Or=Zn(function(e){return Qn("input",Mr(e))});const Lr=window.ReactDOM;function Pr(e,t){const n=setTimeout(t,e);return()=>clearTimeout(n)}function Ar(...e){return e.join(", ").split(", ").reduce((e,t)=>{const n=t.endsWith("ms")?1:1e3,i=Number.parseFloat(t||"0s")*n;return i>e?i:e},0)}function Dr(e,t,n){return!(n||!1===t||e&&!t)}var Tr=Jn(function(e){var t=e,{store:n,alwaysVisible:r}=t,a=Wt(t,["store","alwaysVisible"]);const s=Hi();sn(n=n||s,!1);const o=(0,i.useRef)(null),l=zn(a.id),[u,d]=(0,i.useState)(null),f=n.useState("open"),m=n.useState("mounted"),v=n.useState("animated"),p=n.useState("contentElement"),h=ji(n.disclosure,"contentElement");Dn(()=>{o.current&&(null==n||n.setContentElement(o.current))},[n]),Dn(()=>{let e;return null==n||n.setState("animated",t=>(e=t,!0)),()=>{void 0!==e&&(null==n||n.setState("animated",e))}},[n]),Dn(()=>{if(v){if(null==p?void 0:p.isConnected)return function(e){let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)}(()=>{d(f?"enter":m?"leave":null)});d(null)}},[v,p,f,m]),Dn(()=>{if(!n)return;if(!v)return;if(!u)return;if(!p)return;const e=()=>null==n?void 0:n.setState("animating",!1),t=()=>(0,Lr.flushSync)(e);if("leave"===u&&f)return;if("enter"===u&&!f)return;if("number"==typeof v)return Pr(v,t);const{transitionDuration:i,animationDuration:r,transitionDelay:a,animationDelay:s}=getComputedStyle(p),{transitionDuration:o="0",animationDuration:l="0",transitionDelay:c="0",animationDelay:d="0"}=h?getComputedStyle(h):{},m=Ar(a,s,c,d)+Ar(i,r,o,l);return m?Pr(Math.max(m-1e3/60,0),t):("enter"===u&&n.setState("animated",!1),void e())},[n,v,p,h,f,u]),a=Wn(a,e=>(0,c.jsx)($i,{value:n,children:e}),[n]);const g=Dr(m,a.hidden,r),b=a.style,w=(0,i.useMemo)(()=>g?Rt(Ht({},b),{display:"none"}):b,[g,b]);return ln(a=Rt(Ht({id:l,"data-open":f||void 0,"data-enter":"enter"===u||void 0,"data-leave":"leave"===u||void 0,hidden:g},a),{ref:Bn(l?n.setContentElement:null,o,a.ref),style:w}))}),Br=Zn(function(e){return Qn("div",Tr(e))}),zr=(Zn(function(e){var t=e,{unmountOnHide:n}=t,i=Wt(t,["unmountOnHide"]);const r=Hi();return!1===ji(i.store||r,e=>!n||(null==e?void 0:e.mounted))?null:(0,c.jsx)(Br,Ht({},i))}),Jn(function(e){var t=e,{store:n,alwaysVisible:r}=t,a=Wt(t,["store","alwaysVisible"]);const s=Qi(!0),o=Xi(),l=!!(n=n||o)&&n===s;sn(n,!1);const u=(0,i.useRef)(null),d=zn(a.id),f=n.useState("mounted"),m=Dr(f,a.hidden,r),v=m?Rt(Ht({},a.style),{display:"none"}):a.style,p=n.useState(e=>Array.isArray(e.selectedValue)),h=function(e,t,n){const r=function(e){const[t]=(0,i.useState)(e);return t}(n),[a,s]=(0,i.useState)(r);return(0,i.useEffect)(()=>{const n=e&&"current"in e?e.current:e;if(!n)return;const i=()=>{const e=n.getAttribute(t);s(null==e?r:e)},a=new MutationObserver(i);return a.observe(n,{attributeFilter:[t]}),i(),()=>a.disconnect()},[e,t,r]),a}(u,"role",a.role),g=("listbox"===h||"tree"===h||"grid"===h)&&p||void 0,[b,w]=(0,i.useState)(!1),x=n.useState("contentElement");Dn(()=>{if(!f)return;const e=u.current;if(!e)return;if(x!==e)return;const t=()=>{w(!!e.querySelector("[role='listbox']"))},n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>n.disconnect()},[f,x]),b||(a=Ht({role:"listbox","aria-multiselectable":g},a)),a=Wn(a,e=>(0,c.jsx)(tr,{value:n,children:(0,c.jsx)(Yi.Provider,{value:h,children:e})}),[n,h]);const y=!d||s&&l?null:n.setContentElement;return ln(a=Rt(Ht({id:d,hidden:m},a),{ref:Bn(y,u,a.ref),style:v}))})),Hr=Zn(function(e){return Qn("div",zr(e))});function Rr(e){const t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var Wr=Symbol("composite-hover"),$r=Jn(function(e){var t=e,{store:n,focusOnHover:r=!0,blurOnHoverEnd:a=!!r}=t,s=Wt(t,["store","focusOnHover","blurOnHoverEnd"]);const o=ri();sn(n=n||o,!1);const l=((0,i.useEffect)(()=>{$n||(On("mousemove",Un,!0),On("mousedown",Yn,!0),On("mouseup",Yn,!0),On("keydown",Yn,!0),On("scroll",Yn,!0),$n=!0)},[]),Tn(()=>qn)),c=s.onMouseMove,u=Rn(r),d=Tn(e=>{if(null==c||c(e),!e.defaultPrevented&&l()&&u(e)){if(!vr(e.currentTarget)){const e=null==n?void 0:n.getState().baseElement;e&&!mr(e)&&e.focus()}null==n||n.setActiveId(e.currentTarget.id)}}),f=s.onMouseLeave,m=Rn(a),v=Tn(e=>{var t;null==f||f(e),e.defaultPrevented||l()&&(function(e){const t=Rr(e);return!!t&&pn(e.currentTarget,t)}(e)||function(e){let t=Rr(e);if(!t)return!1;do{if(tn(t,Wr)&&t[Wr])return!0;t=t.parentElement}while(t);return!1}(e)||u(e)&&m(e)&&(null==n||n.setActiveId(null),null==(t=null==n?void 0:n.getState().baseElement)||t.focus()))}),p=(0,i.useCallback)(e=>{e&&(e[Wr]=!0)},[]);return ln(s=Rt(Ht({},s),{ref:Bn(p,s.ref),onMouseMove:d,onMouseLeave:v}))}),qr=(Xn(Zn(function(e){return Qn("div",$r(e))})),Jn(function(e){var t=e,{store:n,shouldRegisterItem:r=!0,getItem:a=an,element:s}=t,o=Wt(t,["store","shouldRegisterItem","getItem","element"]);const l=ni();n=n||l;const c=zn(o.id),u=(0,i.useRef)(s);return(0,i.useEffect)(()=>{const e=u.current;if(!c)return;if(!e)return;if(!r)return;const t=a({id:c,element:e});return null==n?void 0:n.renderItem(t)},[c,r,a,n]),ln(o=Rt(Ht({},o),{ref:Bn(u,o.ref)}))}));function Gr(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?hn(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(hn(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}Zn(function(e){return Qn("div",qr(e))});var Kr=Symbol("command"),Ur=Jn(function(e){var t=e,{clickOnEnter:n=!0,clickOnSpace:r=!0}=t,a=Wt(t,["clickOnEnter","clickOnSpace"]);const s=(0,i.useRef)(null),[o,l]=(0,i.useState)(!1);(0,i.useEffect)(()=>{s.current&&l(hn(s.current))},[]);const[c,u]=(0,i.useState)(!1),d=(0,i.useRef)(!1),f=on(a),[m,v]=function(e,t,n){const r=e.onLoadedMetadataCapture,a=(0,i.useMemo)(()=>Object.assign(()=>{},Rt(Ht({},r),{[t]:n})),[r,t,n]);return[null==r?void 0:r[t],{onLoadedMetadataCapture:a}]}(a,Kr,!0),p=a.onKeyDown,h=Tn(e=>{null==p||p(e);const t=e.currentTarget;if(e.defaultPrevented)return;if(m)return;if(f)return;if(!Vn(e))return;if(bn(t))return;if(t.isContentEditable)return;const i=n&&"Enter"===e.key,a=r&&" "===e.key,s="Enter"===e.key&&!n,o=" "===e.key&&!r;if(s||o)e.preventDefault();else if(i||a){const n=Gr(e);if(i){if(!n){e.preventDefault();const n=e,{view:i}=n,r=Wt(n,["view"]),a=()=>Nn(t,r);fn&&/firefox\//i.test(navigator.userAgent)?Mn(t,"keyup",a):queueMicrotask(a)}}else a&&(d.current=!0,n||(e.preventDefault(),u(!0)))}}),g=a.onKeyUp,b=Tn(e=>{if(null==g||g(e),e.defaultPrevented)return;if(m)return;if(f)return;if(e.metaKey)return;const t=r&&" "===e.key;if(d.current&&t&&(d.current=!1,!Gr(e))){e.preventDefault(),u(!1);const t=e.currentTarget,n=e,{view:i}=n,r=Wt(n,["view"]);queueMicrotask(()=>Nn(t,r))}});return a=Rt(Ht(Ht({"data-active":c||void 0,type:o?"button":void 0},v),a),{ref:Bn(s,a.ref),onKeyDown:h,onKeyUp:b}),kr(a)});function Yr(e,t=!1){const{top:n}=e.getBoundingClientRect();return t?n+e.clientHeight:n}function Zr(e,t,n,i=!1){var r;if(!t)return;if(!n)return;const{renderedItems:a}=t.getState(),s=jn(e);if(!s)return;const o=function(e,t=!1){const n=e.clientHeight,{top:i}=e.getBoundingClientRect(),r=1.5*Math.max(.875*n,n-40),a=t?n-r+i:r+i;return"HTML"===e.tagName?a+e.scrollTop:a}(s,i);let l,c;for(let e=0;e=0){void 0!==c&&cr||(e&&(null==h?void 0:h.baseElement)&&h.baseElement===e.baseElement?h.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===v,ariaSetSize:e=>null!=u?u:e&&(null==h?void 0:h.ariaSetSize)&&h.baseElement===e.baseElement?h.ariaSetSize:void 0,ariaPosInSet(e){if(null!=d)return d;if(!e)return;if(!(null==h?void 0:h.ariaPosInSet))return;if(h.baseElement!==e.baseElement)return;const t=e.renderedItems.filter(e=>e.rowId===b);return h.ariaPosInSet+t.findIndex(e=>e.id===v)},isTabbable(e){if(!(null==e?void 0:e.renderedItems.length))return!0;if(e.virtualFocus)return!1;if(o)return!0;if(null===e.activeId)return!1;const t=null==n?void 0:n.item(e.activeId);return!!(null==t?void 0:t.disabled)||!(null==t?void 0:t.element)||e.activeId===v}}),C=(0,i.useCallback)(e=>{var t;const n=Rt(Ht({},e),{id:v||e.id,rowId:b,disabled:!!g,children:null==(t=e.element)?void 0:t.textContent});return l?l(n):n},[v,b,g,l]),S=f.onFocus,k=(0,i.useRef)(!1),I=Tn(e=>{if(null==S||S(e),e.defaultPrevented)return;if(In(e))return;if(!v)return;if(!n)return;if(function(e,t){return!Vn(e)&&cr(t,e.target)}(e,n))return;const{virtualFocus:t,baseElement:i}=n.getState();var r;(n.setActiveId(v),wn(e.currentTarget)&&function(e,t=!1){if(bn(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){const n=mn(e).getSelection();null==n||n.selectAllChildren(e),t&&(null==n||n.collapseToEnd())}}(e.currentTarget),t)&&(Vn(e)&&(wn(r=e.currentTarget)||"INPUT"===r.tagName&&!hn(r)||(null==i?void 0:i.isConnected)&&(kn()&&e.currentTarget.hasAttribute("data-autofocus")&&e.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),k.current=!0,e.relatedTarget===i||cr(n,e.relatedTarget)?function(e){e[lr]=!0,e.focus({preventScroll:!0})}(i):i.focus())))}),V=f.onBlurCapture,E=Tn(e=>{if(null==V||V(e),e.defaultPrevented)return;const t=null==n?void 0:n.getState();(null==t?void 0:t.virtualFocus)&&k.current&&(k.current=!1,e.preventDefault(),e.stopPropagation())}),N=f.onKeyDown,F=Rn(a),M=Rn(s),O=Tn(e=>{if(null==N||N(e),e.defaultPrevented)return;if(!Vn(e))return;if(!n)return;const{currentTarget:t}=e,i=n.getState(),r=n.item(v),a=!!(null==r?void 0:r.rowId),s="horizontal"!==i.orientation,o="vertical"!==i.orientation,l=()=>!(!a&&!o&&i.baseElement&&bn(i.baseElement)),c={ArrowUp:(a||s)&&n.up,ArrowRight:(a||o)&&n.next,ArrowDown:(a||s)&&n.down,ArrowLeft:(a||o)&&n.previous,Home:()=>{if(l())return!a||e.ctrlKey?null==n?void 0:n.first():null==n?void 0:n.previous(-1)},End:()=>{if(l())return!a||e.ctrlKey?null==n?void 0:n.last():null==n?void 0:n.next(-1)},PageUp:()=>Zr(t,n,null==n?void 0:n.up,!0),PageDown:()=>Zr(t,n,null==n?void 0:n.down)}[e.key];if(c){if(wn(t)){const n=xn(t),i=o&&"ArrowLeft"===e.key,r=o&&"ArrowRight"===e.key,a=s&&"ArrowUp"===e.key,l=s&&"ArrowDown"===e.key;if(r||l){const{length:e}=function(e){if(bn(e))return e.value;if(e.isContentEditable){const t=mn(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(t);if(n.end!==e)return}else if((i||a)&&0!==n.start)return}const i=c();if(F(e)||void 0!==i){if(!M(e))return;e.preventDefault(),n.move(i)}}}),L=(0,i.useMemo)(()=>({id:v,baseElement:w}),[v,w]);return f=Wn(f,e=>(0,c.jsx)(li.Provider,{value:L,children:e}),[L]),f=Rt(Ht({id:v,"data-active-item":x||void 0},f),{ref:Bn(p,f.ref),tabIndex:j?f.tabIndex:-1,onFocus:I,onBlurCapture:E,onKeyDown:O}),f=Ur(f),f=qr(Rt(Ht({store:n},f),{getItem:C,shouldRegisterItem:!!v&&f.shouldRegisterItem})),ln(Rt(Ht({},f),{"aria-setsize":y,"aria-posinset":_}))});function Qr(e){var t;return null!=(t={menu:"menuitem",listbox:"option",tree:"treeitem"}[e])?t:"option"}Xn(Zn(function(e){return Qn("button",Xr(e))}));var Jr=Jn(function(e){var t,n=e,{store:r,value:a,hideOnClick:s,setValueOnClick:o,selectValueOnClick:l=!0,resetValueOnSelect:u,focusOnHover:d=!1,moveOnKeyPress:f=!0,getItem:m}=n,v=Wt(n,["store","value","hideOnClick","setValueOnClick","selectValueOnClick","resetValueOnSelect","focusOnHover","moveOnKeyPress","getItem"]);const p=Qi();sn(r=r||p,!1);const{resetValueOnSelectState:h,multiSelectable:g,selected:b}=Ci(r,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)}(e.selectedValue,a)}),w=(0,i.useCallback)(e=>{const t=Rt(Ht({},e),{value:a});return m?m(t):t},[a,m]);o=null!=o?o:!g,s=null!=s?s:null!=a&&!g;const x=v.onClick,y=Rn(o),_=Rn(l),j=Rn(null!=(t=null!=u?u:h)?t:g),C=Rn(s),S=Tn(e=>{null==x||x(e),e.defaultPrevented||function(e){const t=e.currentTarget;if(!t)return!1;const n=t.tagName.toLowerCase();return!!e.altKey&&("a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type)}(e)||function(e){const t=e.currentTarget;if(!t)return!1;const n=Sn();if(n&&!e.metaKey)return!1;if(!n&&!e.ctrlKey)return!1;const i=t.tagName.toLowerCase();return"a"===i||"button"===i&&"submit"===t.type||"input"===i&&"submit"===t.type}(e)||(null!=a&&(_(e)&&(j(e)&&(null==r||r.resetValue()),null==r||r.setSelectedValue(e=>Array.isArray(e)?e.includes(a)?e.filter(e=>e!==a):[...e,a]:a)),y(e)&&(null==r||r.setValue(a))),C(e)&&(null==r||r.hide()))}),k=v.onKeyDown,I=Tn(e=>{if(null==k||k(e),e.defaultPrevented)return;const t=null==r?void 0:r.getState().baseElement;t&&(mr(t)||(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&(queueMicrotask(()=>t.focus()),bn(t)&&(null==r||r.setValue(t.value))))});g&&null!=b&&(v=Ht({"aria-selected":b},v)),v=Wn(v,e=>(0,c.jsx)(nr.Provider,{value:a,children:(0,c.jsx)(ir.Provider,{value:null!=b&&b,children:e})}),[a,b]);const V=(0,i.useContext)(Yi);v=Rt(Ht({role:Qr(V),children:a},v),{onClick:S,onKeyDown:I});const E=Rn(f);return v=Xr(Rt(Ht({store:r},v),{getItem:w,moveOnKeyPress:e=>{if(!E(e))return!1;const t=new Event("combobox-item-move"),n=null==r?void 0:r.getState().baseElement;return null==n||n.dispatchEvent(t),!0}})),$r(Ht({store:r,focusOnHover:d},v))}),ea=Xn(Zn(function(e){return Qn("div",Jr(e))}));function ta(e){return rn(e).toLowerCase()}var na=Jn(function(e){var t=e,{store:n,value:r,userValue:a}=t,s=Wt(t,["store","value","userValue"]);const o=Qi();n=n||o;const l=(0,i.useContext)(nr),u=null!=r?r:l,d=ji(n,e=>null!=a?a:null==e?void 0:e.value),f=(0,i.useMemo)(()=>{if(u)return d?function(e,t){if(!e)return e;if(!t)return e;const n=(i=t,Array.isArray(i)?i:void 0!==i?[i]:[]).filter(Boolean).map(ta);var i;const r=[],a=(e,t=!1)=>(0,c.jsx)("span",{"data-autocomplete-value":t?"":void 0,"data-user-value":t?void 0:"",children:e},r.length),s=function(e){return e.sort(([e],[t])=>e-t)}(function(e){return e.filter(([e,t],n,i)=>!i.some(([i,r],a)=>a!==n&&i<=e&&i+r>=e+t))}(function(e,t){const n=[];for(const i of t){let t=0;const r=i.length;for(;-1!==e.indexOf(i,t);){const a=e.indexOf(i,t);-1!==a&&n.push([a,r]),t=a+1}}return n}(ta(e),new Set(n))));if(!s.length)return r.push(a(e,!0)),r;const[o]=s[0],l=[e.slice(0,o),...s.flatMap(([t,n],i)=>{var r;const a=e.slice(t,t+n),o=null==(r=s[i+1])?void 0:r[0];return[a,e.slice(t+n,o)]})];return l.forEach((e,t)=>{e&&r.push(a(e,t%2==0))}),r}(u,d):u},[u,d]);return ln(s=Ht({children:f},s))}),ia=Zn(function(e){return Qn("span",na(e))}),ra=n(731),aa=n.n(ra),sa=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z"})});const oa=[],la=(e,t)=>e.singleSelection?t?.value:Array.isArray(t?.value)?t.value:!Array.isArray(t?.value)&&t?.value?[t.value]:oa,ca=[];function ua({elements:e,getElements:t}){const n=Array.isArray(e)&&e.length>0?e:ca,[i,r]=(0,a.useState)(n),[s,o]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if(!t)return void r(n);let e=!1;return o(!0),t().then(t=>{if(!e){const e=Array.isArray(t)&&t.length>0?t:n;r(e)}}).catch(()=>{e||r(n)}).finally(()=>{e||o(!1)}),()=>{e=!0}},[t,n]),{elements:i,isLoading:s}}function da(e=""){return aa()(e.trim().toLowerCase())}const fa=(e,t,n)=>e.singleSelection?n:Array.isArray(t?.value)?t.value.includes(n)?t.value.filter(e=>e!==n):[...t.value,n]:[n];function ma(e,t){return`${e}-${t}`}const va=({selected:e})=>(0,c.jsx)("span",{className:k("dataviews-filters__search-widget-listitem-multi-selection",{"is-selected":e}),children:e&&(0,c.jsx)(s.Icon,{icon:sa})}),pa=({selected:e})=>(0,c.jsx)("span",{className:k("dataviews-filters__search-widget-listitem-single-selection",{"is-selected":e})});function ha({view:e,filter:t,onChangeView:n}){const i=(0,W.useInstanceId)(ha,"dataviews-filter-list-box"),[r,o]=(0,a.useState)(1===t.operators?.length?void 0:null),l=e.filters?.find(e=>e.field===t.field),u=la(t,l);return(0,c.jsx)(s.Composite,{virtualFocus:!0,focusLoop:!0,activeId:r,setActiveId:o,role:"listbox",className:"dataviews-filters__search-widget-listbox","aria-label":(0,b.sprintf)( +(0,Ut.__)("%1$s: %2$s"),V.label,e)}),t.map(e=>{const t=_(e);return(0,a.jsx)(Ia,{view:f,idPrefix:t,actions:n,item:e,isSelected:e===g,onSelect:y,mediaField:w,titleField:v,descriptionField:b,otherFields:x,onDropdownTriggerKeyDown:P},t)})]},e))})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.Composite,{id:m,render:(0,a.jsx)("div",{}),className:ro("dataviews-view-list",h),role:f.infiniteScrollEnabled?"feed":"grid",activeId:C,setActiveId:j,children:r.map((e,t)=>{const r=_(e);return(0,a.jsx)(Ia,{view:f,idPrefix:r,actions:n,item:e,isSelected:e===g,onSelect:y,mediaField:w,titleField:v,descriptionField:b,otherFields:x,onDropdownTriggerKeyDown:P,posinset:f.infiniteScrollEnabled?t+1:void 0},r)})}),L&&c&&(0,a.jsx)("p",{className:"dataviews-loading-more",children:(0,a.jsx)(s.Spinner,{})})]})},icon:(0,Ut.isRTL)()?Os:Rs},{type:"pickerGrid",label:(0,Ut.__)("Grid"),component:function({actions:e,data:t,fields:n,getItemId:r,isLoading:i,onChangeSelection:l,selection:c,view:u,className:d,empty:f}){const{resizeObserverRef:h,paginationInfo:p,itemListLabel:m}=(0,o.useContext)(Ls),g=n.find(e=>e.id===u?.titleField),v=n.find(e=>e.id===u?.mediaField),w=n.find(e=>e.id===u?.descriptionField),b=u.fields??[],{regularFields:x,badgeFields:y}=b.reduce((e,t)=>{const r=n.find(e=>e.id===t);return r?(e[u.layout?.badgeFields?.includes(t)?"badgeFields":"regularFields"].push(r),e):e},{regularFields:[],badgeFields:[]}),_=!!t?.length,S=u.layout?.previewSize,C=function(e){return(0,o.useMemo)(()=>e?.every(e=>e.supportsBulk),[e])}(e),j="900px",k=u.groupByField?n.find(e=>e.id===u.groupByField):null,I=k?va(t,k):null,M=u.infiniteScrollEnabled&&!I,E=u?.page??1,P=u?.perPage??0,L=M?p?.totalItems:void 0;return(0,a.jsxs)(a.Fragment,{children:[_&&k&&I&&(0,a.jsx)(s.Composite,{virtualFocus:!0,orientation:"horizontal",role:"listbox","aria-multiselectable":C,className:ro("dataviews-view-picker-grid",d),"aria-label":m,render:({children:e,...t})=>(0,a.jsx)(s.__experimentalVStack,{spacing:4,children:e,...t}),children:Array.from(I.entries()).map(([e,n])=>(0,a.jsx)(La,{groupName:e,groupField:k,children:(0,a.jsx)(xa,{previewSize:S,style:{gridTemplateColumns:S&&`repeat(auto-fill, minmax(${S}px, 1fr))`},"aria-busy":i,ref:h,children:n.map(e=>{const n=(E-1)*P+t.indexOf(e)+1;return(0,a.jsx)(Pa,{view:u,multiselect:C,selection:c,onChangeSelection:l,getItemId:r,item:e,mediaField:v,titleField:g,descriptionField:w,regularFields:x,badgeFields:y,config:{sizes:j},posinset:n,setsize:L},r(e))})})},e))}),_&&!I&&(0,a.jsx)(s.Composite,{render:(0,a.jsx)(xa,{className:ro("dataviews-view-picker-grid",d),previewSize:S,"aria-busy":i,ref:h}),virtualFocus:!0,orientation:"horizontal",role:"listbox","aria-multiselectable":C,"aria-label":m,children:t.map((e,t)=>{let n=M?t+1:void 0;return M||(n=(E-1)*P+t+1),(0,a.jsx)(Pa,{view:u,multiselect:C,selection:c,onChangeSelection:l,getItemId:r,item:e,mediaField:v,titleField:g,descriptionField:w,regularFields:x,badgeFields:y,config:{sizes:j},posinset:n,setsize:L},r(e))})}),!_&&(0,a.jsx)("div",{className:ro({"dataviews-loading":i,"dataviews-no-results":!i}),children:i?(0,a.jsx)("p",{children:(0,a.jsx)(s.Spinner,{})}):f}),_&&i&&(0,a.jsx)("p",{className:"dataviews-loading-more",children:(0,a.jsx)(s.Spinner,{})})]})},icon:Ns,viewConfigOptions:Na,isPicker:!0}],{Menu:Ra}=Bs(s.privateApis);function Fa({filters:e,view:t,onChangeView:n,setOpenedFilter:r,triggerProps:i}){const o=e.filter(e=>!e.isVisible);return(0,a.jsxs)(Ra,{children:[(0,a.jsx)(Ra.TriggerButton,{...i}),(0,a.jsx)(Ra.Popover,{children:o.map(e=>(0,a.jsx)(Ra.Item,{onClick:()=>{r(e.field),n({...t,page:1,filters:[...t.filters||[],{field:e.field,value:void 0,operator:e.operators[0]}]})},children:(0,a.jsx)(Ra.ItemLabel,{children:e.name})},e.field))})]})}var Ta=(0,o.forwardRef)(function({filters:e,view:t,onChangeView:n,setOpenedFilter:r},i){if(!e.length||e.every(({isPrimary:e})=>e))return null;const o=e.filter(e=>!e.isVisible);return(0,a.jsx)(Fa,{triggerProps:{render:(0,a.jsx)(s.Button,{accessibleWhenDisabled:!0,size:"compact",className:"dataviews-filters-button",variant:"tertiary",disabled:!o.length,ref:i}),children:(0,Ut.__)("Add filter")},filters:e,view:t,onChangeView:n,setOpenedFilter:r})});function Aa({buttonRef:e,filtersCount:t,children:n}){return(0,o.useEffect)(()=>()=>{e.current?.focus()},[e]),(0,a.jsxs)(a.Fragment,{children:[n,!!t&&(0,a.jsx)("span",{className:"dataviews-filters-toggle__count",children:t})]})}var Da=function(){const{filters:e,view:t,onChangeView:n,setOpenedFilter:r,isShowingFilter:i,setIsShowingFilter:l}=(0,o.useContext)(Ls),c=(0,o.useRef)(null),u=(0,o.useCallback)(e=>{n(e),l(!0)},[n,l]),d=!!e.filter(e=>e.isVisible).length;if(0===e.length)return null;const f={label:(0,Ut.__)("Add filter"),"aria-expanded":!1,isPressed:!1},h={label:(0,Ut._x)("Filter","verb"),"aria-expanded":i,isPressed:i,onClick:()=>{i||r(null),l(!i)}},p=(0,a.jsx)(s.Button,{ref:c,className:"dataviews-filters__visibility-toggle",size:"compact",icon:aa,...d?h:f});return(0,a.jsx)("div",{className:"dataviews-filters__container-visibility-toggle",children:d?(0,a.jsx)(Aa,{buttonRef:c,filtersCount:t.filters?.length,children:p}):(0,a.jsx)(Fa,{filters:e,view:t,onChangeView:u,setOpenedFilter:r,triggerProps:{render:p}})})},Ba=Object.defineProperty,za=Object.defineProperties,$a=Object.getOwnPropertyDescriptors,Ha=Object.getOwnPropertySymbols,Wa=Object.prototype.hasOwnProperty,qa=Object.prototype.propertyIsEnumerable,Ua=(e,t,n)=>t in e?Ba(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ga=(e,t)=>{for(var n in t||(t={}))Wa.call(t,n)&&Ua(e,n,t[n]);if(Ha)for(var n of Ha(t))qa.call(t,n)&&Ua(e,n,t[n]);return e},Ka=(e,t)=>za(e,$a(t)),Ya=(e,t)=>{var n={};for(var r in e)Wa.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&Ha)for(var r of Ha(e))t.indexOf(r)<0&&qa.call(e,r)&&(n[r]=e[r]);return n},Za=Object.defineProperty,Xa=Object.defineProperties,Ja=Object.getOwnPropertyDescriptors,Qa=Object.getOwnPropertySymbols,el=Object.prototype.hasOwnProperty,tl=Object.prototype.propertyIsEnumerable,nl=(e,t,n)=>t in e?Za(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rl=(e,t)=>{for(var n in t||(t={}))el.call(t,n)&&nl(e,n,t[n]);if(Qa)for(var n of Qa(t))tl.call(t,n)&&nl(e,n,t[n]);return e},il=(e,t)=>Xa(e,Ja(t)),ol=(e,t)=>{var n={};for(var r in e)el.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&Qa)for(var r of Qa(e))t.indexOf(r)<0&&tl.call(e,r)&&(n[r]=e[r]);return n};function sl(...e){}function al(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function ll(...e){return(...t)=>{for(const n of e)"function"==typeof n&&n(...t)}}function cl(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function ul(e){return e}function dl(e,t){if(!e){if("string"!=typeof t)throw new Error("Invariant failed");throw new Error(t)}}function fl(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function hl(e){const t={};for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}function pl(...e){for(const t of e)if(void 0!==t)return t}function ml(e,t){"function"==typeof e?e(t):e&&(e.current=t)}var gl,vl="undefined"!=typeof window&&!!(null==(gl=window.document)?void 0:gl.createElement);function wl(e){return e?"self"in e?e.document:e.ownerDocument||document:document}function bl(e,t=!1){const{activeElement:n}=wl(e);if(!(null==n?void 0:n.nodeName))return null;if("IFRAME"===n.tagName&&n.contentDocument)return bl(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=wl(n).getElementById(e);if(t)return t}}return n}function xl(e,t){return e===t||e.contains(t)}function yl(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==_l.indexOf(e.type)}var _l=["button","color","file","image","reset","submit"];function Sl(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName;return t||n||!1}catch(e){return!1}}function Cl(e){return e.isContentEditable||Sl(e)}function jl(e){let t=0,n=0;if(Sl(e))t=e.selectionStart||0,n=e.selectionEnd||0;else if(e.isContentEditable){const r=wl(e).getSelection();if((null==r?void 0:r.rangeCount)&&r.anchorNode&&xl(e,r.anchorNode)&&r.focusNode&&xl(e,r.focusNode)){const i=r.getRangeAt(0),o=i.cloneRange();o.selectNodeContents(e),o.setEnd(i.startContainer,i.startOffset),t=o.toString().length,o.setEnd(i.endContainer,i.endOffset),n=o.toString().length}}return{start:t,end:n}}function kl(e,t){const n=null==e?void 0:e.getAttribute("role");return n&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(n)?n:t}function Il(e){if(!e)return null;const t=e=>"auto"===e||"scroll"===e;if(e.clientHeight&&e.scrollHeight>e.clientHeight){const{overflowY:n}=getComputedStyle(e);if(t(n))return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){const{overflowX:n}=getComputedStyle(e);if(t(n))return e}return Il(e.parentElement)||document.scrollingElement||document.body}function Ml(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function El(){return!!vl&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function Pl(){return vl&&El()&&/apple/i.test(navigator.vendor)}function Ll(e){return Boolean(e.currentTarget&&!xl(e.currentTarget,e.target))}function Vl(e){return e.target===e.currentTarget}function Nl(e,t){const n=new FocusEvent("blur",t),r=e.dispatchEvent(n),i=il(rl({},t),{bubbles:!0});return e.dispatchEvent(new FocusEvent("focusout",i)),r}function Ol(e,t){const n=new MouseEvent("click",t);return e.dispatchEvent(n)}function Rl(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!xl(n,r)}function Fl(e,t,n,r){const i=(e=>{if(r){const t=setTimeout(e,r);return()=>clearTimeout(t)}const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})(()=>{e.removeEventListener(t,o,!0),n()}),o=()=>{i(),n()};return e.addEventListener(t,o,{once:!0,capture:!0}),i}function Tl(e,t,n,r=window){const i=[];try{r.document.addEventListener(e,t,n);for(const o of Array.from(r.frames))i.push(Tl(e,t,n,o))}catch(e){}return()=>{try{r.document.removeEventListener(e,t,n)}catch(e){}for(const e of i)e()}}var Al=Ga({},$),Dl=Al.useId,Bl=(Al.useDeferredValue,Al.useInsertionEffect),zl=vl?z.useLayoutEffect:z.useEffect;function $l(e){const t=(0,z.useRef)(()=>{throw new Error("Cannot call an event handler while rendering.")});return Bl?Bl(()=>{t.current=e}):t.current=e,(0,z.useCallback)((...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)},[])}function Hl(...e){return(0,z.useMemo)(()=>{if(e.some(Boolean))return t=>{for(const n of e)ml(n,t)}},e)}function Wl(e){if(Dl){const t=Dl();return e||t}const[t,n]=(0,z.useState)(e);return zl(()=>{if(e||t)return;const r=Math.random().toString(36).slice(2,8);n(`id-${r}`)},[e,t]),e||t}function ql(e,t){const n=(0,z.useRef)(!1);(0,z.useEffect)(()=>{if(n.current)return e();n.current=!0},t),(0,z.useEffect)(()=>()=>{n.current=!1},[])}function Ul(e){return $l("function"==typeof e?e:()=>e)}function Gl(e,t,n=[]){const r=(0,z.useCallback)(n=>(e.wrapElement&&(n=e.wrapElement(n)),t(n)),[...n,e.wrapElement]);return Ka(Ga({},e),{wrapElement:r})}var Kl=!1,Yl=!1,Zl=0,Xl=0;function Jl(e){(function(e){const t=e.movementX||e.screenX-Zl,n=e.movementY||e.screenY-Xl;return Zl=e.screenX,Xl=e.screenY,t||n||!1})(e)&&(Yl=!0)}function Ql(){Yl=!1}function ec(e){const t=z.forwardRef((t,n)=>e(Ka(Ga({},t),{ref:n})));return t.displayName=e.displayName||e.name,t}function tc(e,t){return z.memo(e,t)}function nc(e,t){const n=t,{wrapElement:r,render:i}=n,o=Ya(n,["wrapElement","render"]),s=Hl(t.ref,function(e){return function(e){return!!e&&!!(0,z.isValidElement)(e)&&("ref"in e.props||"ref"in e)}(e)?Ga({},e.props).ref||e.ref:null}(i));let l;if(z.isValidElement(i)){const e=Ka(Ga({},i.props),{ref:s});l=z.cloneElement(i,function(e,t){const n=Ga({},e);for(const r in t){if(!al(t,r))continue;if("className"===r){const r="className";n[r]=e[r]?`${e[r]} ${t[r]}`:t[r];continue}if("style"===r){const r="style";n[r]=e[r]?Ga(Ga({},e[r]),t[r]):t[r];continue}const i=t[r];if("function"==typeof i&&r.startsWith("on")){const t=e[r];if("function"==typeof t){n[r]=(...e)=>{i(...e),t(...e)};continue}}n[r]=i}return n}(o,e))}else l=i?i(o):(0,a.jsx)(e,Ga({},o));return r?r(l):l}function rc(e){const t=(t={})=>e(t);return t.displayName=e.name,t}function ic(e=[],t=[]){const n=z.createContext(void 0),r=z.createContext(void 0),i=()=>z.useContext(n),o=t=>e.reduceRight((e,n)=>(0,a.jsx)(n,Ka(Ga({},t),{children:e})),(0,a.jsx)(n.Provider,Ga({},t)));return{context:n,scopedContext:r,useContext:i,useScopedContext:(e=!1)=>{const t=z.useContext(r),n=i();return e?t:t||n},useProviderContext:()=>{const e=z.useContext(r),t=i();if(!e||e!==t)return t},ContextProvider:o,ScopedContextProvider:e=>(0,a.jsx)(o,Ka(Ga({},e),{children:t.reduceRight((t,n)=>(0,a.jsx)(n,Ka(Ga({},e),{children:t})),(0,a.jsx)(r.Provider,Ga({},e)))}))}}var oc=ic(),sc=oc.useContext,ac=(oc.useScopedContext,oc.useProviderContext,ic([oc.ContextProvider],[oc.ScopedContextProvider])),lc=ac.useContext,cc=(ac.useScopedContext,ac.useProviderContext),uc=ac.ContextProvider,dc=ac.ScopedContextProvider,fc=(0,z.createContext)(void 0),hc=(0,z.createContext)(void 0),pc=((0,z.createContext)(null),(0,z.createContext)(null),ic([uc],[dc])),mc=pc.useContext;function gc(e,t){const n=e.__unstableInternals;return dl(n,"Invalid store"),n[t]}function vc(e,...t){let n=e,r=n,i=Symbol(),o=sl;const s=new Set,a=new Set,l=new Set,c=new Set,u=new Set,d=new WeakMap,f=new WeakMap,h=(e,t,n=c)=>(n.add(t),f.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),f.delete(t),n.delete(t)}),p=(e,o,s=!1)=>{var l;if(!al(n,e))return;const h=(p=o,m=n[e],function(e){return"function"==typeof e}(p)?p(function(e){return"function"==typeof e}(m)?m():m):p);var p,m;if(h===n[e])return;if(!s)for(const n of t)null==(l=null==n?void 0:n.setState)||l.call(n,e,h);const g=n;n=il(rl({},n),{[e]:h});const v=Symbol();i=v,a.add(e);const w=(t,r,i)=>{var o;const s=f.get(t);s&&!s.some(t=>i?i.has(t):t===e)||(null==(o=d.get(t))||o(),d.set(t,t(n,r)))};for(const e of c)w(e,g);queueMicrotask(()=>{if(i!==v)return;const e=n;for(const e of u)w(e,r,a);r=e,a.clear()})},m={getState:()=>n,setState:p,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{const e=s.size,r=Symbol();s.add(r);const i=()=>{s.delete(r),s.size||o()};if(e)return i;const a=(c=n,Object.keys(c)).map(e=>ll(...t.map(t=>{var n;const r=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);if(r&&al(r,e))return yc(t,[e],t=>{p(e,t[e],!0)})})));var c;const u=[];for(const e of l)u.push(e());const d=t.map(bc);return o=ll(...a,...u,...d),i},subscribe:(e,t)=>h(e,t),sync:(e,t)=>(d.set(t,t(n,n)),h(e,t)),batch:(e,t)=>(d.set(t,t(n,r)),h(e,t,u)),pick:e=>vc(function(e,t){const n={};for(const r of t)al(e,r)&&(n[r]=e[r]);return n}(n,e),m),omit:e=>vc(function(e,t){const n=rl({},e);for(const e of t)al(n,e)&&delete n[e];return n}(n,e),m)}};return m}function wc(e,...t){if(e)return gc(e,"setup")(...t)}function bc(e,...t){if(e)return gc(e,"init")(...t)}function xc(e,...t){if(e)return gc(e,"subscribe")(...t)}function yc(e,...t){if(e)return gc(e,"sync")(...t)}function _c(e,...t){if(e)return gc(e,"batch")(...t)}function Sc(e,...t){if(e)return gc(e,"omit")(...t)}function Cc(...e){var t;const n={};for(const r of e){const e=null==(t=null==r?void 0:r.getState)?void 0:t.call(r);e&&Object.assign(n,e)}const r=vc(n,...e);return Object.assign({},...e,r)}pc.useScopedContext,pc.useProviderContext,pc.ContextProvider,pc.ScopedContextProvider;var jc=n(888),{useSyncExternalStore:kc}=jc;function Ic(e,t=ul){const n=z.useCallback(t=>e?xc(e,null,t):()=>{},[e]),r=()=>{const n="string"==typeof t?t:null,r="function"==typeof t?t:null,i=null==e?void 0:e.getState();return r?r(i):i&&n&&al(i,n)?i[n]:void 0};return kc(n,r,r)}function Mc(e,t){const n=z.useRef({}),r=z.useCallback(t=>e?xc(e,null,t):()=>{},[e]),i=()=>{const r=null==e?void 0:e.getState();let i=!1;const o=n.current;for(const e in t){const n=t[e];if("function"==typeof n){const t=n(r);t!==o[e]&&(o[e]=t,i=!0)}if("string"==typeof n){if(!r)continue;if(!al(r,n))continue;const t=r[n];t!==o[e]&&(o[e]=t,i=!0)}}return i&&(n.current=Ga({},o)),n.current};return kc(r,i,i)}function Ec(e,t,n,r){const i=al(t,n)?t[n]:void 0,o=r?t[r]:void 0,s=function(e){const t=(0,z.useRef)(e);return zl(()=>{t.current=e}),t}({value:i,setValue:o});zl(()=>yc(e,[n],(e,t)=>{const{value:r,setValue:i}=s.current;i&&e[n]!==t[n]&&e[n]!==r&&i(e[n])}),[e,n]),zl(()=>{if(void 0!==i)return e.setState(n,i),_c(e,[n],()=>{void 0!==i&&e.setState(n,i)})})}function Pc(e,t,n){return function(e,t,n){return ql(t,[n.store,n.disclosure]),Ec(e,n,"open","setOpen"),Ec(e,n,"mounted","setMounted"),Ec(e,n,"animated"),Object.assign(e,{disclosure:n.disclosure})}(e,t,n)}function Lc(e,t,n){return Ec(e=function(e,t,n){return ql(t,[n.store]),Ec(e,n,"items","setItems"),e}(e,t,n),n,"activeId","setActiveId"),Ec(e,n,"includesBaseElement"),Ec(e,n,"virtualFocus"),Ec(e,n,"orientation"),Ec(e,n,"rtl"),Ec(e,n,"focusLoop"),Ec(e,n,"focusWrap"),Ec(e,n,"focusShift"),e}function Vc(e){const t=[];for(const n of e)t.push(...n);return t}function Nc(e){return e.slice().reverse()}function Oc(e={}){var t;e.store;const n=null==(t=e.store)?void 0:t.getState(),r=pl(e.items,null==n?void 0:n.items,e.defaultItems,[]),i=new Map(r.map(e=>[e.id,e])),o={items:r,renderedItems:pl(null==n?void 0:n.renderedItems,[])},s=function(e){return null==e?void 0:e.__unstablePrivateStore}(e.store),a=vc({items:r,renderedItems:o.renderedItems},s),l=vc(o,e.store),c=e=>{const t=function(e,t){const n=e.map((e,t)=>[t,e]);let r=!1;return n.sort(([e,n],[i,o])=>{const s=t(n),a=t(o);return s===a?0:s&&a?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(s,a)?(e>i&&(r=!0),-1):(et):e}(e,e=>e.element);a.setState("renderedItems",t),l.setState("renderedItems",t)};wc(l,()=>bc(a)),wc(a,()=>_c(a,["items"],e=>{l.setState("items",e.items)})),wc(a,()=>_c(a,["renderedItems"],e=>{let t=!0,n=requestAnimationFrame(()=>{const{renderedItems:t}=l.getState();e.renderedItems!==t&&c(e.renderedItems)});if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(n);const r=function(e){var t;const n=e.find(e=>!!e.element),r=[...e].reverse().find(e=>!!e.element);let i=null==(t=null==n?void 0:n.element)?void 0:t.parentElement;for(;i&&(null==r?void 0:r.element);){if(r&&i.contains(r.element))return i;i=i.parentElement}return wl(i).body}(e.renderedItems),i=new IntersectionObserver(()=>{t?t=!1:(cancelAnimationFrame(n),n=requestAnimationFrame(()=>c(e.renderedItems)))},{root:r});for(const t of e.renderedItems)t.element&&i.observe(t.element);return()=>{cancelAnimationFrame(n),i.disconnect()}}));const u=(e,t,n=!1)=>{let r;return t(t=>{const n=t.findIndex(({id:t})=>t===e.id),o=t.slice();if(-1!==n){r=t[n];const s=rl(rl({},r),e);o[n]=s,i.set(e.id,s)}else o.push(e),i.set(e.id,e);return o}),()=>{t(t=>{if(!r)return n&&i.delete(e.id),t.filter(({id:t})=>t!==e.id);const o=t.findIndex(({id:t})=>t===e.id);if(-1===o)return t;const s=t.slice();return s[o]=r,i.set(e.id,r),s})}},d=e=>u(e,e=>a.setState("items",e),!0);return il(rl({},l),{registerItem:d,renderItem:e=>ll(d(e),u(e,e=>a.setState("renderedItems",e))),item:e=>{if(!e)return null;let t=i.get(e);if(!t){const{items:n}=a.getState();t=n.find(t=>t.id===e),t&&i.set(e,t)}return t||null},__unstablePrivateStore:a})}var Rc={id:null};function Fc(e,t){return e.find(e=>t?!e.disabled&&e.id!==t:!e.disabled)}function Tc(e,t){return e.filter(e=>e.rowId===t)}function Ac(e){const t=[];for(const n of e){const e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId});e?e.push(n):t.push([n])}return t}function Dc(e){let t=0;for(const{length:n}of e)n>t&&(t=n);return t}function Bc(e){return{id:"__EMPTY_ITEM__",disabled:!0,rowId:e}}var zc=Pl()&&vl&&!!navigator.maxTouchPoints;function $c(e={}){var t=e,{tag:n}=t,r=ol(t,["tag"]);const i=Cc(r.store,function(e,...t){if(e)return gc(e,"pick")(...t)}(n,["value","rtl"])),o=null==n?void 0:n.getState(),s=null==i?void 0:i.getState(),a=pl(r.activeId,null==s?void 0:s.activeId,r.defaultActiveId,null),l=function(e={}){var t;const n=null==(t=e.store)?void 0:t.getState(),r=Oc(e),i=pl(e.activeId,null==n?void 0:n.activeId,e.defaultActiveId),o=vc(il(rl({},r.getState()),{id:pl(e.id,null==n?void 0:n.id,`id-${Math.random().toString(36).slice(2,8)}`),activeId:i,baseElement:pl(null==n?void 0:n.baseElement,null),includesBaseElement:pl(e.includesBaseElement,null==n?void 0:n.includesBaseElement,null===i),moves:pl(null==n?void 0:n.moves,0),orientation:pl(e.orientation,null==n?void 0:n.orientation,"both"),rtl:pl(e.rtl,null==n?void 0:n.rtl,!1),virtualFocus:pl(e.virtualFocus,null==n?void 0:n.virtualFocus,!1),focusLoop:pl(e.focusLoop,null==n?void 0:n.focusLoop,!1),focusWrap:pl(e.focusWrap,null==n?void 0:n.focusWrap,!1),focusShift:pl(e.focusShift,null==n?void 0:n.focusShift,!1)}),r,e.store);wc(o,()=>yc(o,["renderedItems","activeId"],e=>{o.setState("activeId",t=>{var n;return void 0!==t?t:null==(n=Fc(e.renderedItems))?void 0:n.id})}));const s=(e="next",t={})=>{var n,r;const i=o.getState(),{skip:s=0,activeId:a=i.activeId,focusShift:l=i.focusShift,focusLoop:c=i.focusLoop,focusWrap:u=i.focusWrap,includesBaseElement:d=i.includesBaseElement,renderedItems:f=i.renderedItems,rtl:h=i.rtl}=t,p="up"===e||"down"===e,m="next"===e||"down"===e,g=m?h&&!p:!h||p,v=l&&!s;let w=p?Vc(function(e,t,n){const r=Dc(e);for(const i of e)for(let e=0;ee.id===a);if(!b)return null==(r=Fc(w))?void 0:r.id;const x=w.some(e=>e.rowId),y=w.indexOf(b),_=w.slice(y+1),S=Tc(_,b.rowId);if(s){const e=function(e,t){return e.filter(e=>t?!e.disabled&&e.id!==t:!e.disabled)}(S,a),t=e.slice(s)[0]||e[e.length-1];return null==t?void 0:t.id}const C=c&&(p?"horizontal"!==c:"vertical"!==c),j=x&&u&&(p?"horizontal"!==u:"vertical"!==u),k=m?(!x||p)&&C&&d:!!p&&d;if(C){const e=function(e,t,n=!1){const r=e.findIndex(e=>e.id===t);return[...e.slice(r+1),...n?[Rc]:[],...e.slice(0,r)]}(j&&!k?w:Tc(w,b.rowId),a,k),t=Fc(e,a);return null==t?void 0:t.id}if(j){const e=Fc(k?S:_,a);return k?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const I=Fc(S,a);return!I&&k?null:null==I?void 0:I.id};return il(rl(rl({},r),o),{setBaseElement:e=>o.setState("baseElement",e),setActiveId:e=>o.setState("activeId",e),move:e=>{void 0!==e&&(o.setState("activeId",e),o.setState("moves",e=>e+1))},first:()=>{var e;return null==(e=Fc(o.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=Fc(Nc(o.getState().renderedItems)))?void 0:e.id},next:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("next",e)),previous:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("previous",e)),down:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("down",e)),up:e=>(void 0!==e&&"number"==typeof e&&(e={skip:e}),s("up",e))})}(il(rl({},r),{activeId:a,includesBaseElement:pl(r.includesBaseElement,null==s?void 0:s.includesBaseElement,!0),orientation:pl(r.orientation,null==s?void 0:s.orientation,"vertical"),focusLoop:pl(r.focusLoop,null==s?void 0:s.focusLoop,!0),focusWrap:pl(r.focusWrap,null==s?void 0:s.focusWrap,!0),virtualFocus:pl(r.virtualFocus,null==s?void 0:s.virtualFocus,!0)})),c=function(e={}){var t=e,{popover:n}=t,r=ol(t,["popover"]);const i=Cc(r.store,Sc(n,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),o=null==i?void 0:i.getState(),s=function(e={}){return function(e={}){const t=Cc(e.store,Sc(e.disclosure,["contentElement","disclosureElement"])),n=null==t?void 0:t.getState(),r=pl(e.open,null==n?void 0:n.open,e.defaultOpen,!1),i=pl(e.animated,null==n?void 0:n.animated,!1),o=vc({open:r,animated:i,animating:!!i&&r,mounted:r,contentElement:pl(null==n?void 0:n.contentElement,null),disclosureElement:pl(null==n?void 0:n.disclosureElement,null)},t);return wc(o,()=>yc(o,["animated","animating"],e=>{e.animated||o.setState("animating",!1)})),wc(o,()=>xc(o,["open"],()=>{o.getState().animated&&o.setState("animating",!0)})),wc(o,()=>yc(o,["open","animating"],e=>{o.setState("mounted",e.open||e.animating)})),il(rl({},o),{disclosure:e.disclosure,setOpen:e=>o.setState("open",e),show:()=>o.setState("open",!0),hide:()=>o.setState("open",!1),toggle:()=>o.setState("open",e=>!e),stopAnimation:()=>o.setState("animating",!1),setContentElement:e=>o.setState("contentElement",e),setDisclosureElement:e=>o.setState("disclosureElement",e)})}(e)}(il(rl({},r),{store:i})),a=pl(r.placement,null==o?void 0:o.placement,"bottom"),l=vc(il(rl({},s.getState()),{placement:a,currentPlacement:a,anchorElement:pl(null==o?void 0:o.anchorElement,null),popoverElement:pl(null==o?void 0:o.popoverElement,null),arrowElement:pl(null==o?void 0:o.arrowElement,null),rendered:Symbol("rendered")}),s,i);return il(rl(rl({},s),l),{setAnchorElement:e=>l.setState("anchorElement",e),setPopoverElement:e=>l.setState("popoverElement",e),setArrowElement:e=>l.setState("arrowElement",e),render:()=>l.setState("rendered",Symbol("rendered"))})}(il(rl({},r),{placement:pl(r.placement,null==s?void 0:s.placement,"bottom-start")})),u=pl(r.value,null==s?void 0:s.value,r.defaultValue,""),d=pl(r.selectedValue,null==s?void 0:s.selectedValue,null==o?void 0:o.values,r.defaultSelectedValue,""),f=Array.isArray(d),h=il(rl(rl({},l.getState()),c.getState()),{value:u,selectedValue:d,resetValueOnSelect:pl(r.resetValueOnSelect,null==s?void 0:s.resetValueOnSelect,f),resetValueOnHide:pl(r.resetValueOnHide,null==s?void 0:s.resetValueOnHide,f&&!n),activeValue:null==s?void 0:s.activeValue}),p=vc(h,l,c,i);return zc&&wc(p,()=>yc(p,["virtualFocus"],()=>{p.setState("virtualFocus",!1)})),wc(p,()=>{if(n)return ll(yc(p,["selectedValue"],e=>{Array.isArray(e.selectedValue)&&n.setValues(e.selectedValue)}),yc(n,["values"],e=>{p.setState("selectedValue",e.values)}))}),wc(p,()=>yc(p,["resetValueOnHide","mounted"],e=>{e.resetValueOnHide&&(e.mounted||p.setState("value",u))})),wc(p,()=>yc(p,["open"],e=>{e.open||(p.setState("activeId",a),p.setState("moves",0))})),wc(p,()=>yc(p,["moves","activeId"],(e,t)=>{e.moves===t.moves&&p.setState("activeValue",void 0)})),wc(p,()=>_c(p,["moves","renderedItems"],(e,t)=>{if(e.moves===t.moves)return;const{activeId:n}=p.getState(),r=l.item(n);p.setState("activeValue",null==r?void 0:r.value)})),il(rl(rl(rl({},c),l),p),{tag:n,setValue:e=>p.setState("value",e),resetValue:()=>p.setState("value",h.value),setSelectedValue:e=>p.setState("selectedValue",e)})}function Hc(e={}){e=function(e){const t=mc();return function(e){const t=Wl(e.id);return Ga({id:t},e)}(e=Ka(Ga({},e),{tag:void 0!==e.tag?e.tag:t}))}(e);const[t,n]=function(e,t){const[n,r]=z.useState(()=>e(t));zl(()=>bc(n),[n]);const i=z.useCallback(e=>Ic(n,e),[n]);return[z.useMemo(()=>Ka(Ga({},n),{useState:i}),[n,i]),$l(()=>{r(n=>e(Ga(Ga({},t),n.getState())))})]}($c,e);return function(e,t,n){return ql(t,[n.tag]),Ec(e,n,"value","setValue"),Ec(e,n,"selectedValue","setSelectedValue"),Ec(e,n,"resetValueOnHide"),Ec(e,n,"resetValueOnSelect"),Object.assign(Lc(function(e,t,n){return ql(t,[n.popover]),Ec(e,n,"placement"),Pc(e,t,n)}(e,t,n),t,n),{tag:n.tag})}(t,n,e)}var Wc=ic(),qc=(Wc.useContext,Wc.useScopedContext,Wc.useProviderContext),Uc=ic([Wc.ContextProvider],[Wc.ScopedContextProvider]),Gc=(Uc.useContext,Uc.useScopedContext,Uc.useProviderContext,Uc.ContextProvider),Kc=Uc.ScopedContextProvider,Yc=((0,z.createContext)(void 0),(0,z.createContext)(void 0),ic([Gc],[Kc])),Zc=(Yc.useContext,Yc.useScopedContext,Yc.useProviderContext),Xc=Yc.ContextProvider,Jc=Yc.ScopedContextProvider,Qc=(0,z.createContext)(void 0),eu=ic([Xc,uc],[Jc,dc]),tu=eu.useContext,nu=eu.useScopedContext,ru=eu.useProviderContext,iu=eu.ContextProvider,ou=eu.ScopedContextProvider,su=(0,z.createContext)(void 0),au=(0,z.createContext)(!1);function lu(e={}){const t=Hc(e);return(0,a.jsx)(iu,{value:t,children:e.children})}var cu=rc(function(e){var t=e,{store:n}=t,r=Ya(t,["store"]);const i=ru();dl(n=n||i,!1);const o=n.useState(e=>{var t;return null==(t=e.baseElement)?void 0:t.id});return hl(r=Ga({htmlFor:o},r))}),uu=tc(ec(function(e){return nc("label",cu(e))}));function du(e,t){return t&&e.item(t)||null}var fu=Symbol("FOCUS_SILENTLY");function hu(e,t,n){if(!t)return!1;if(t===n)return!1;const r=e.item(t.id);return!(!r||n&&r.element===n)}var pu=(0,z.createContext)(!0),mu="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function gu(e){return!!e.matches(mu)&&!!function(e){if("function"==typeof e.checkVisibility)return e.checkVisibility();const t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)&&!e.closest("[inert]")}function vu(e){const t=bl(e);if(!t)return!1;if(t===e)return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function wu(e){const t=bl(e);if(!t)return!1;if(xl(e,t))return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&"id"in e&&(n===e.id||!!e.querySelector(`#${CSS.escape(n)}`))}var bu=Pl(),xu=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"],yu=Symbol("safariFocusAncestor");function _u(e,t){e&&(e[yu]=t)}function Su(e){return!("input"!==e.tagName.toLowerCase()||!e.type||"radio"!==e.type&&"checkbox"!==e.type)}function Cu(e,t,n,r,i){return e?t?n&&!r?-1:void 0:n?i:i||0:i}function ju(e,t){return $l(n=>{null==e||e(n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())})}var ku=!1,Iu=!0;function Mu(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(Iu=!1))}function Eu(e){e.metaKey||e.ctrlKey||e.altKey||(Iu=!0)}var Pu=rc(function(e){var t=e,{focusable:n=!0,accessibleWhenDisabled:r,autoFocus:i,onFocusVisible:o}=t,s=Ya(t,["focusable","accessibleWhenDisabled","autoFocus","onFocusVisible"]);const a=(0,z.useRef)(null);(0,z.useEffect)(()=>{n&&(ku||(Tl("mousedown",Mu,!0),Tl("keydown",Eu,!0),ku=!0))},[n]),bu&&(0,z.useEffect)(()=>{if(!n)return;const e=a.current;if(!e)return;if(!Su(e))return;const t=function(e){return"labels"in e?e.labels:null}(e);if(!t)return;const r=()=>queueMicrotask(()=>e.focus());for(const e of t)e.addEventListener("mouseup",r);return()=>{for(const e of t)e.removeEventListener("mouseup",r)}},[n]);const l=n&&fl(s),c=!!l&&!r,[u,d]=(0,z.useState)(!1);(0,z.useEffect)(()=>{n&&c&&u&&d(!1)},[n,c,u]),(0,z.useEffect)(()=>{if(!n)return;if(!u)return;const e=a.current;if(!e)return;if("undefined"==typeof IntersectionObserver)return;const t=new IntersectionObserver(()=>{gu(e)||d(!1)});return t.observe(e),()=>t.disconnect()},[n,u]);const f=ju(s.onKeyPressCapture,l),h=ju(s.onMouseDownCapture,l),p=ju(s.onClickCapture,l),m=s.onMouseDown,g=$l(e=>{if(null==m||m(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget;if(!bu)return;if(Ll(e))return;if(!yl(t)&&!Su(t))return;let r=!1;const i=()=>{r=!0};t.addEventListener("focusin",i,{capture:!0,once:!0});const o=function(e){for(;e&&!gu(e);)e=e.closest(mu);return e||null}(t.parentElement);_u(o,!0),Fl(t,"mouseup",()=>{t.removeEventListener("focusin",i,!0),_u(o,!1),r||function(e){!wu(e)&&gu(e)&&e.focus()}(t)})}),v=(e,t)=>{if(t&&(e.currentTarget=t),!n)return;const r=e.currentTarget;r&&vu(r)&&(null==o||o(e),e.defaultPrevented||(r.dataset.focusVisible="true",d(!0)))},w=s.onKeyDownCapture,b=$l(e=>{if(null==w||w(e),e.defaultPrevented)return;if(!n)return;if(u)return;if(e.metaKey)return;if(e.altKey)return;if(e.ctrlKey)return;if(!Vl(e))return;const t=e.currentTarget;Fl(t,"focusout",()=>v(e,t))}),x=s.onFocusCapture,y=$l(e=>{if(null==x||x(e),e.defaultPrevented)return;if(!n)return;if(!Vl(e))return void d(!1);const t=e.currentTarget;Iu||function(e){const{tagName:t,readOnly:n,type:r}=e;return"TEXTAREA"===t&&!n||"SELECT"===t&&!n||("INPUT"!==t||n?!!e.isContentEditable||!("combobox"!==e.getAttribute("role")||!e.dataset.name):xu.includes(r))}(e.target)?Fl(e.target,"focusout",()=>v(e,t)):d(!1)}),_=s.onBlur,S=$l(e=>{null==_||_(e),n&&Rl(e)&&(e.currentTarget.removeAttribute("data-focus-visible"),d(!1))}),C=(0,z.useContext)(pu),j=$l(e=>{n&&i&&e&&C&&queueMicrotask(()=>{vu(e)||gu(e)&&e.focus()})}),k=function(e,t){const n=e=>{if("string"==typeof e)return e},[r,i]=(0,z.useState)(()=>n(t));return zl(()=>{const r=e&&"current"in e?e.current:e;i((null==r?void 0:r.tagName.toLowerCase())||n(t))},[e,t]),r}(a),I=n&&function(e){return!e||"button"===e||"summary"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(k),M=n&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(k),E=s.style,P=(0,z.useMemo)(()=>c?Ga({pointerEvents:"none"},E):E,[c,E]);return hl(s=Ka(Ga({"data-focus-visible":n&&u||void 0,"data-autofocus":i||void 0,"aria-disabled":l||void 0},s),{ref:Hl(a,j,s.ref),style:P,tabIndex:Cu(n,c,I,M,s.tabIndex),disabled:!(!M||!c)||void 0,contentEditable:l?void 0:s.contentEditable,onKeyPressCapture:f,onClickCapture:p,onMouseDownCapture:h,onMouseDown:g,onKeyDownCapture:b,onFocusCapture:y,onBlur:S}))});function Lu(e,t,n){return $l(r=>{var i;if(null==t||t(r),r.defaultPrevented)return;if(r.isPropagationStopped())return;if(!Vl(r))return;if(function(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}(r))return;if(function(e){const t=e.target;return!(t&&!Sl(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(r))return;const o=e.getState(),s=null==(i=du(e,o.activeId))?void 0:i.element;if(!s)return;const a=r,{view:l}=a,c=Ya(a,["view"]);s!==(null==n?void 0:n.current)&&s.focus(),function(e,t,n){const r=new KeyboardEvent(t,n);return e.dispatchEvent(r)}(s,r.type,c)||r.preventDefault(),r.currentTarget.contains(s)&&r.stopPropagation()})}ec(function(e){return nc("div",Pu(e))});var Vu=rc(function(e){var t=e,{store:n,composite:r=!0,focusOnMove:i=r,moveOnKeyPress:o=!0}=t,s=Ya(t,["store","composite","focusOnMove","moveOnKeyPress"]);const l=cc();dl(n=n||l,!1);const c=(0,z.useRef)(null),u=(0,z.useRef)(null),d=function(e){const[t,n]=(0,z.useState)(!1),r=(0,z.useCallback)(()=>n(!0),[]),i=e.useState(t=>du(e,t.activeId));return(0,z.useEffect)(()=>{const e=null==i?void 0:i.element;t&&e&&(n(!1),e.focus({preventScroll:!0}))},[i,t]),r}(n),f=n.useState("moves"),[,h]=function(e){const[t,n]=(0,z.useState)(null);return zl(()=>{if(null==t)return;if(!e)return;let n=null;return e(e=>(n=e,t)),()=>{e(n)}},[t,e]),[t,n]}(r?n.setBaseElement:null);(0,z.useEffect)(()=>{var e;if(!n)return;if(!f)return;if(!r)return;if(!i)return;const{activeId:t}=n.getState(),o=null==(e=du(n,t))?void 0:e.element;var s;o&&("scrollIntoView"in(s=o)?(s.focus({preventScroll:!0}),s.scrollIntoView(rl({block:"nearest",inline:"nearest"},undefined))):s.focus())},[n,f,r,i]),zl(()=>{if(!n)return;if(!f)return;if(!r)return;const{baseElement:e,activeId:t}=n.getState();if(null!==t)return;if(!e)return;const i=u.current;u.current=null,i&&Nl(i,{relatedTarget:e}),vu(e)||e.focus()},[n,f,r]);const p=n.useState("activeId"),m=n.useState("virtualFocus");zl(()=>{var e;if(!n)return;if(!r)return;if(!m)return;const t=u.current;if(u.current=null,!t)return;const i=(null==(e=du(n,p))?void 0:e.element)||bl(t);i!==t&&Nl(t,{relatedTarget:i})},[n,p,m,r]);const g=Lu(n,s.onKeyDownCapture,u),v=Lu(n,s.onKeyUpCapture,u),w=s.onFocusCapture,b=$l(e=>{if(null==w||w(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:t}=n.getState();if(!t)return;const r=e.relatedTarget,i=function(e){const t=e[fu];return delete e[fu],t}(e.currentTarget);Vl(e)&&i&&(e.stopPropagation(),u.current=r)}),x=s.onFocus,y=$l(e=>{if(null==x||x(e),e.defaultPrevented)return;if(!r)return;if(!n)return;const{relatedTarget:t}=e,{virtualFocus:i}=n.getState();i?Vl(e)&&!hu(n,t)&&queueMicrotask(d):Vl(e)&&n.setActiveId(null)}),_=s.onBlurCapture,S=$l(e=>{var t;if(null==_||_(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:r,activeId:i}=n.getState();if(!r)return;const o=null==(t=du(n,i))?void 0:t.element,s=e.relatedTarget,a=hu(n,s),l=u.current;u.current=null,Vl(e)&&a?(s===o?l&&l!==s&&Nl(l,e):o?Nl(o,e):l&&Nl(l,e),e.stopPropagation()):!hu(n,e.target)&&o&&Nl(o,e)}),C=s.onKeyDown,j=Ul(o),k=$l(e=>{var t;if(null==C||C(e),e.nativeEvent.isComposing)return;if(e.defaultPrevented)return;if(!n)return;if(!Vl(e))return;const{orientation:r,renderedItems:i,activeId:o}=n.getState(),s=du(n,o);if(null==(t=null==s?void 0:s.element)?void 0:t.isConnected)return;const a="horizontal"!==r,l="vertical"!==r,c=i.some(e=>!!e.rowId);if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&Sl(e.currentTarget))return;const u={ArrowUp:(c||a)&&(()=>{if(c){const e=function(e){return e.find(e=>!e.disabled)}(Vc(Nc(function(e){const t=[];for(const n of e){const e=t.find(e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId});e?e.push(n):t.push([n])}return t}(i))));return null==e?void 0:e.id}return null==n?void 0:n.last()}),ArrowRight:(c||l)&&n.first,ArrowDown:(c||a)&&n.first,ArrowLeft:(c||l)&&n.last,Home:n.first,End:n.last,PageUp:n.first,PageDown:n.last},d=u[e.key];if(d){const t=d();if(void 0!==t){if(!j(e))return;e.preventDefault(),n.move(t)}}});s=Gl(s,e=>(0,a.jsx)(uc,{value:n,children:e}),[n]);const I=n.useState(e=>{var t;if(n&&r&&e.virtualFocus)return null==(t=du(n,e.activeId))?void 0:t.id});s=Ka(Ga({"aria-activedescendant":I},s),{ref:Hl(c,h,s.ref),onKeyDownCapture:g,onKeyUpCapture:v,onFocusCapture:b,onFocus:y,onBlurCapture:S,onKeyDown:k});const M=n.useState(e=>r&&(e.virtualFocus||null===e.activeId));return Pu(Ga({focusable:M},s))}),Nu=(ec(function(e){return nc("div",Vu(e))}),rc(function(e){var t=e,{store:n}=t,r=Ya(t,["store"]);const i=Zc();return n=n||i,Ka(Ga({},r),{ref:Hl(null==n?void 0:n.setAnchorElement,r.ref)})}));function Ou(e,t,n){if(!n)return!1;const r=e.find(e=>!e.disabled&&e.value);return(null==r?void 0:r.value)===t}function Ru(e,t){return!!t&&null!=e&&(e=cl(e),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase()))}ec(function(e){return nc("div",Nu(e))});var Fu=rc(function(e){var t=e,{store:n,focusable:r=!0,autoSelect:i=!1,getAutoSelectId:o,setValueOnChange:s,showMinLength:a=0,showOnChange:l,showOnMouseDown:c,showOnClick:u=c,showOnKeyDown:d,showOnKeyPress:f=d,blurActiveItemOnClick:h,setValueOnClick:p=!0,moveOnKeyPress:m=!0,autoComplete:g="list"}=t,v=Ya(t,["store","focusable","autoSelect","getAutoSelectId","setValueOnChange","showMinLength","showOnChange","showOnMouseDown","showOnClick","showOnKeyDown","showOnKeyPress","blurActiveItemOnClick","setValueOnClick","moveOnKeyPress","autoComplete"]);const w=ru();dl(n=n||w,!1);const b=(0,z.useRef)(null),[x,y]=(0,z.useReducer)(()=>[],[]),_=(0,z.useRef)(!1),S=(0,z.useRef)(!1),C=n.useState(e=>e.virtualFocus&&i),j="inline"===g||"both"===g,[k,I]=(0,z.useState)(j);!function(e,t){const n=(0,z.useRef)(!1);zl(()=>{n.current?j&&I(!0):n.current=!0},t),zl(()=>()=>{n.current=!1},[])}(0,[j]);const M=n.useState("value"),E=(0,z.useRef)();(0,z.useEffect)(()=>yc(n,["selectedValue","activeId"],(e,t)=>{E.current=t.selectedValue}),[]);const P=n.useState(e=>{var t;if(j&&k){if(e.activeValue&&Array.isArray(e.selectedValue)){if(e.selectedValue.includes(e.activeValue))return;if(null==(t=E.current)?void 0:t.includes(e.activeValue))return}return e.activeValue}}),L=n.useState("renderedItems"),V=n.useState("open"),N=n.useState("contentElement"),O=(0,z.useMemo)(()=>{if(!j)return M;if(!k)return M;if(Ou(L,P,C)){if(Ru(M,P)){const e=(null==P?void 0:P.slice(M.length))||"";return M+e}return M}return P||M},[j,k,L,P,C,M]);(0,z.useEffect)(()=>{const e=b.current;if(!e)return;const t=()=>I(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}},[]),(0,z.useEffect)(()=>{if(!j)return;if(!k)return;if(!P)return;if(!Ou(L,P,C))return;if(!Ru(M,P))return;let e=sl;return queueMicrotask(()=>{const t=b.current;if(!t)return;const{start:n,end:r}=jl(t),i=M.length,o=P.length;Ml(t,i,o),e=()=>{if(!vu(t))return;const{start:e,end:s}=jl(t);e===i&&s===o&&Ml(t,n,r)}}),()=>e()},[x,j,k,P,L,C,M]);const R=(0,z.useRef)(null),F=$l(o),T=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!V)return;if(!N)return;const e=Il(N);if(!e)return;R.current=e;const t=()=>{_.current=!1},r=()=>{if(!n)return;if(!_.current)return;const{activeId:e}=n.getState();null!==e&&e!==T.current&&(_.current=!1)},i={passive:!0,capture:!0};return e.addEventListener("wheel",t,i),e.addEventListener("touchmove",t,i),e.addEventListener("scroll",r,i),()=>{e.removeEventListener("wheel",t,!0),e.removeEventListener("touchmove",t,!0),e.removeEventListener("scroll",r,!0)}},[V,N,n]),zl(()=>{M&&(S.current||(_.current=!0))},[M]),zl(()=>{"always"!==C&&V||(_.current=V)},[C,V]);const A=n.useState("resetValueOnSelect");ql(()=>{var e,t;const r=_.current;if(!n)return;if(!V)return;if(!r&&!A)return;const{baseElement:i,contentElement:o,activeId:s}=n.getState();if(!i||vu(i)){if(null==o?void 0:o.hasAttribute("data-placing")){const e=new MutationObserver(y);return e.observe(o,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(C&&r){const t=F(L),r=void 0!==t?t:null!=(e=function(e){const t=e.find(e=>{var t;return!e.disabled&&"tab"!==(null==(t=e.element)?void 0:t.getAttribute("role"))});return null==t?void 0:t.id}(L))?e:n.first();T.current=r,n.move(null!=r?r:null)}else{const e=null==(t=n.item(s||n.first()))?void 0:t.element;e&&"scrollIntoView"in e&&e.scrollIntoView({block:"nearest",inline:"nearest"})}}},[n,V,x,M,C,A,F,L]),(0,z.useEffect)(()=>{if(!j)return;const e=b.current;if(!e)return;const t=[e,N].filter(e=>!!e),r=e=>{t.every(t=>Rl(e,t))&&(null==n||n.setValue(O))};for(const e of t)e.addEventListener("focusout",r);return()=>{for(const e of t)e.removeEventListener("focusout",r)}},[j,N,n,O]);const D=e=>e.currentTarget.value.length>=a,B=v.onChange,$=Ul(null!=l?l:D),H=Ul(null!=s?s:!n.tag),W=$l(e=>{if(null==B||B(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget,{value:r,selectionStart:i,selectionEnd:o}=t,s=e.nativeEvent;if(_.current=!0,function(e){return"input"===e.type}(s)&&(s.isComposing&&(_.current=!1,S.current=!0),j)){const e="insertText"===s.inputType||"insertCompositionText"===s.inputType,t=i===r.length;I(e&&t)}if(H(e)){const e=r===n.getState().value;n.setValue(r),queueMicrotask(()=>{Ml(t,i,o)}),j&&C&&e&&y()}$(e)&&n.show(),C&&_.current||n.setActiveId(null)}),q=v.onCompositionEnd,U=$l(e=>{_.current=!0,S.current=!1,null==q||q(e),e.defaultPrevented||C&&y()}),G=v.onMouseDown,K=Ul(null!=h?h:()=>!!(null==n?void 0:n.getState().includesBaseElement)),Y=Ul(p),Z=Ul(null!=u?u:D),X=$l(e=>{null==G||G(e),e.defaultPrevented||e.button||e.ctrlKey||n&&(K(e)&&n.setActiveId(null),Y(e)&&n.setValue(O),Z(e)&&Fl(e.currentTarget,"mouseup",n.show))}),J=v.onKeyDown,Q=Ul(null!=f?f:D),ee=$l(e=>{if(null==J||J(e),e.repeat||(_.current=!1),e.defaultPrevented)return;if(e.ctrlKey)return;if(e.altKey)return;if(e.shiftKey)return;if(e.metaKey)return;if(!n)return;const{open:t}=n.getState();t||"ArrowUp"!==e.key&&"ArrowDown"!==e.key||Q(e)&&(e.preventDefault(),n.show())}),te=v.onBlur,ne=$l(e=>{_.current=!1,null==te||te(e),e.defaultPrevented}),re=Wl(v.id),ie=function(e){return"inline"===e||"list"===e||"both"===e||"none"===e}(g)?g:void 0,oe=n.useState(e=>null===e.activeId);return v=Ka(Ga({id:re,role:"combobox","aria-autocomplete":ie,"aria-haspopup":kl(N,"listbox"),"aria-expanded":V,"aria-controls":null==N?void 0:N.id,"data-active-item":oe||void 0,value:O},v),{ref:Hl(b,v.ref),onChange:W,onCompositionEnd:U,onMouseDown:X,onKeyDown:ee,onBlur:ne}),v=Vu(Ka(Ga({store:n,focusable:r},v),{moveOnKeyPress:e=>!function(e,...t){const n="function"==typeof e?e(...t):e;return null!=n&&!n}(m,e)&&(j&&I(!0),!0)})),v=Nu(Ga({store:n},v)),Ga({autoComplete:"off"},v)}),Tu=ec(function(e){return nc("input",Fu(e))});function Au(e,t){const n=setTimeout(t,e);return()=>clearTimeout(n)}function Du(...e){return e.join(", ").split(", ").reduce((e,t)=>{const n=t.endsWith("ms")?1:1e3,r=Number.parseFloat(t||"0s")*n;return r>e?r:e},0)}function Bu(e,t,n){return!(n||!1===t||e&&!t)}var zu=rc(function(e){var t=e,{store:n,alwaysVisible:r}=t,i=Ya(t,["store","alwaysVisible"]);const o=qc();dl(n=n||o,!1);const s=(0,z.useRef)(null),l=Wl(i.id),[c,u]=(0,z.useState)(null),d=n.useState("open"),f=n.useState("mounted"),h=n.useState("animated"),p=n.useState("contentElement"),m=Ic(n.disclosure,"contentElement");zl(()=>{s.current&&(null==n||n.setContentElement(s.current))},[n]),zl(()=>{let e;return null==n||n.setState("animated",t=>(e=t,!0)),()=>{void 0!==e&&(null==n||n.setState("animated",e))}},[n]),zl(()=>{if(h){if(null==p?void 0:p.isConnected)return function(e){let t=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>cancelAnimationFrame(t)}(()=>{u(d?"enter":f?"leave":null)});u(null)}},[h,p,d,f]),zl(()=>{if(!n)return;if(!h)return;if(!c)return;if(!p)return;const e=()=>null==n?void 0:n.setState("animating",!1),t=()=>(0,ie.flushSync)(e);if("leave"===c&&d)return;if("enter"===c&&!d)return;if("number"==typeof h)return Au(h,t);const{transitionDuration:r,animationDuration:i,transitionDelay:o,animationDelay:s}=getComputedStyle(p),{transitionDuration:a="0",animationDuration:l="0",transitionDelay:u="0",animationDelay:f="0"}=m?getComputedStyle(m):{},g=Du(o,s,u,f)+Du(r,i,a,l);return g?Au(Math.max(g-1e3/60,0),t):("enter"===c&&n.setState("animated",!1),void e())},[n,h,p,m,d,c]),i=Gl(i,e=>(0,a.jsx)(Kc,{value:n,children:e}),[n]);const g=Bu(f,i.hidden,r),v=i.style,w=(0,z.useMemo)(()=>g?Ka(Ga({},v),{display:"none"}):v,[g,v]);return hl(i=Ka(Ga({id:l,"data-open":d||void 0,"data-enter":"enter"===c||void 0,"data-leave":"leave"===c||void 0,hidden:g},i),{ref:Hl(l?n.setContentElement:null,s,i.ref),style:w}))}),$u=ec(function(e){return nc("div",zu(e))}),Hu=(ec(function(e){var t=e,{unmountOnHide:n}=t,r=Ya(t,["unmountOnHide"]);const i=qc();return!1===Ic(r.store||i,e=>!n||(null==e?void 0:e.mounted))?null:(0,a.jsx)($u,Ga({},r))}),rc(function(e){var t=e,{store:n,alwaysVisible:r}=t,i=Ya(t,["store","alwaysVisible"]);const o=nu(!0),s=tu(),l=!!(n=n||s)&&n===o;dl(n,!1);const c=(0,z.useRef)(null),u=Wl(i.id),d=n.useState("mounted"),f=Bu(d,i.hidden,r),h=f?Ka(Ga({},i.style),{display:"none"}):i.style,p=n.useState(e=>Array.isArray(e.selectedValue)),m=function(e,t,n){const r=function(e){const[t]=(0,z.useState)(e);return t}(n),[i,o]=(0,z.useState)(r);return(0,z.useEffect)(()=>{const n=e&&"current"in e?e.current:e;if(!n)return;const i=()=>{const e=n.getAttribute(t);o(null==e?r:e)},s=new MutationObserver(i);return s.observe(n,{attributeFilter:[t]}),i(),()=>s.disconnect()},[e,t,r]),i}(c,"role",i.role),g=("listbox"===m||"tree"===m||"grid"===m)&&p||void 0,[v,w]=(0,z.useState)(!1),b=n.useState("contentElement");zl(()=>{if(!d)return;const e=c.current;if(!e)return;if(b!==e)return;const t=()=>{w(!!e.querySelector("[role='listbox']"))},n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributeFilter:["role"]}),t(),()=>n.disconnect()},[d,b]),v||(i=Ga({role:"listbox","aria-multiselectable":g},i)),i=Gl(i,e=>(0,a.jsx)(ou,{value:n,children:(0,a.jsx)(Qc.Provider,{value:m,children:e})}),[n,m]);const x=!u||o&&l?null:n.setContentElement;return hl(i=Ka(Ga({id:u,hidden:f},i),{ref:Hl(x,c,i.ref),style:h}))})),Wu=ec(function(e){return nc("div",Hu(e))});function qu(e){const t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var Uu=Symbol("composite-hover"),Gu=rc(function(e){var t=e,{store:n,focusOnHover:r=!0,blurOnHoverEnd:i=!!r}=t,o=Ya(t,["store","focusOnHover","blurOnHoverEnd"]);const s=lc();dl(n=n||s,!1);const a=((0,z.useEffect)(()=>{Kl||(Tl("mousemove",Jl,!0),Tl("mousedown",Ql,!0),Tl("mouseup",Ql,!0),Tl("keydown",Ql,!0),Tl("scroll",Ql,!0),Kl=!0)},[]),$l(()=>Yl)),l=o.onMouseMove,c=Ul(r),u=$l(e=>{if(null==l||l(e),!e.defaultPrevented&&a()&&c(e)){if(!wu(e.currentTarget)){const e=null==n?void 0:n.getState().baseElement;e&&!vu(e)&&e.focus()}null==n||n.setActiveId(e.currentTarget.id)}}),d=o.onMouseLeave,f=Ul(i),h=$l(e=>{var t;null==d||d(e),e.defaultPrevented||a()&&(function(e){const t=qu(e);return!!t&&xl(e.currentTarget,t)}(e)||function(e){let t=qu(e);if(!t)return!1;do{if(al(t,Uu)&&t[Uu])return!0;t=t.parentElement}while(t);return!1}(e)||c(e)&&f(e)&&(null==n||n.setActiveId(null),null==(t=null==n?void 0:n.getState().baseElement)||t.focus()))}),p=(0,z.useCallback)(e=>{e&&(e[Uu]=!0)},[]);return hl(o=Ka(Ga({},o),{ref:Hl(p,o.ref),onMouseMove:u,onMouseLeave:h}))}),Ku=(tc(ec(function(e){return nc("div",Gu(e))})),rc(function(e){var t=e,{store:n,shouldRegisterItem:r=!0,getItem:i=ul,element:o}=t,s=Ya(t,["store","shouldRegisterItem","getItem","element"]);const a=sc();n=n||a;const l=Wl(s.id),c=(0,z.useRef)(o);return(0,z.useEffect)(()=>{const e=c.current;if(!l)return;if(!e)return;if(!r)return;const t=i({id:l,element:e});return null==n?void 0:n.renderItem(t)},[l,r,i,n]),hl(s=Ka(Ga({},s),{ref:Hl(c,s.ref)}))}));function Yu(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?yl(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(yl(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}ec(function(e){return nc("div",Ku(e))});var Zu=Symbol("command"),Xu=rc(function(e){var t=e,{clickOnEnter:n=!0,clickOnSpace:r=!0}=t,i=Ya(t,["clickOnEnter","clickOnSpace"]);const o=(0,z.useRef)(null),[s,a]=(0,z.useState)(!1);(0,z.useEffect)(()=>{o.current&&a(yl(o.current))},[]);const[l,c]=(0,z.useState)(!1),u=(0,z.useRef)(!1),d=fl(i),[f,h]=function(e,t,n){const r=e.onLoadedMetadataCapture,i=(0,z.useMemo)(()=>Object.assign(()=>{},Ka(Ga({},r),{[t]:n})),[r,t,n]);return[null==r?void 0:r[t],{onLoadedMetadataCapture:i}]}(i,Zu,!0),p=i.onKeyDown,m=$l(e=>{null==p||p(e);const t=e.currentTarget;if(e.defaultPrevented)return;if(f)return;if(d)return;if(!Vl(e))return;if(Sl(t))return;if(t.isContentEditable)return;const i=n&&"Enter"===e.key,o=r&&" "===e.key,s="Enter"===e.key&&!n,a=" "===e.key&&!r;if(s||a)e.preventDefault();else if(i||o){const n=Yu(e);if(i){if(!n){e.preventDefault();const n=e,{view:r}=n,i=Ya(n,["view"]),o=()=>Ol(t,i);vl&&/firefox\//i.test(navigator.userAgent)?Fl(t,"keyup",o):queueMicrotask(o)}}else o&&(u.current=!0,n||(e.preventDefault(),c(!0)))}}),g=i.onKeyUp,v=$l(e=>{if(null==g||g(e),e.defaultPrevented)return;if(f)return;if(d)return;if(e.metaKey)return;const t=r&&" "===e.key;if(u.current&&t&&(u.current=!1,!Yu(e))){e.preventDefault(),c(!1);const t=e.currentTarget,n=e,{view:r}=n,i=Ya(n,["view"]);queueMicrotask(()=>Ol(t,i))}});return i=Ka(Ga(Ga({"data-active":l||void 0,type:s?"button":void 0},h),i),{ref:Hl(o,i.ref),onKeyDown:m,onKeyUp:v}),Pu(i)});function Ju(e,t=!1){const{top:n}=e.getBoundingClientRect();return t?n+e.clientHeight:n}function Qu(e,t,n,r=!1){var i;if(!t)return;if(!n)return;const{renderedItems:o}=t.getState(),s=Il(e);if(!s)return;const a=function(e,t=!1){const n=e.clientHeight,{top:r}=e.getBoundingClientRect(),i=1.5*Math.max(.875*n,n-40),o=t?n-i+r:i+r;return"HTML"===e.tagName?o+e.scrollTop:o}(s,r);let l,c;for(let e=0;e=0){void 0!==c&&cr||(e&&(null==m?void 0:m.baseElement)&&m.baseElement===e.baseElement?m.id:void 0),baseElement:e=>(null==e?void 0:e.baseElement)||void 0,isActiveItem:e=>!!e&&e.activeId===h,ariaSetSize:e=>null!=c?c:e&&(null==m?void 0:m.ariaSetSize)&&m.baseElement===e.baseElement?m.ariaSetSize:void 0,ariaPosInSet(e){if(null!=u)return u;if(!e)return;if(!(null==m?void 0:m.ariaPosInSet))return;if(m.baseElement!==e.baseElement)return;const t=e.renderedItems.filter(e=>e.rowId===v);return m.ariaPosInSet+t.findIndex(e=>e.id===h)},isTabbable(e){if(!(null==e?void 0:e.renderedItems.length))return!0;if(e.virtualFocus)return!1;if(s)return!0;if(null===e.activeId)return!1;const t=null==n?void 0:n.item(e.activeId);return!!(null==t?void 0:t.disabled)||!(null==t?void 0:t.element)||e.activeId===h}}),S=(0,z.useCallback)(e=>{var t;const n=Ka(Ga({},e),{id:h||e.id,rowId:v,disabled:!!g,children:null==(t=e.element)?void 0:t.textContent});return l?l(n):n},[h,v,g,l]),C=d.onFocus,j=(0,z.useRef)(!1),k=$l(e=>{if(null==C||C(e),e.defaultPrevented)return;if(Ll(e))return;if(!h)return;if(!n)return;if(function(e,t){return!Vl(e)&&hu(t,e.target)}(e,n))return;const{virtualFocus:t,baseElement:r}=n.getState();var i;(n.setActiveId(h),Cl(e.currentTarget)&&function(e,t=!1){if(Sl(e))e.setSelectionRange(t?e.value.length:0,e.value.length);else if(e.isContentEditable){const n=wl(e).getSelection();null==n||n.selectAllChildren(e),t&&(null==n||n.collapseToEnd())}}(e.currentTarget),t)&&(Vl(e)&&(Cl(i=e.currentTarget)||"INPUT"===i.tagName&&!yl(i)||(null==r?void 0:r.isConnected)&&(Pl()&&e.currentTarget.hasAttribute("data-autofocus")&&e.currentTarget.scrollIntoView({block:"nearest",inline:"nearest"}),j.current=!0,e.relatedTarget===r||hu(n,e.relatedTarget)?function(e){e[fu]=!0,e.focus({preventScroll:!0})}(r):r.focus())))}),I=d.onBlurCapture,M=$l(e=>{if(null==I||I(e),e.defaultPrevented)return;const t=null==n?void 0:n.getState();(null==t?void 0:t.virtualFocus)&&j.current&&(j.current=!1,e.preventDefault(),e.stopPropagation())}),E=d.onKeyDown,P=Ul(i),L=Ul(o),V=$l(e=>{if(null==E||E(e),e.defaultPrevented)return;if(!Vl(e))return;if(!n)return;const{currentTarget:t}=e,r=n.getState(),i=n.item(h),o=!!(null==i?void 0:i.rowId),s="horizontal"!==r.orientation,a="vertical"!==r.orientation,l=()=>!(!o&&!a&&r.baseElement&&Sl(r.baseElement)),c={ArrowUp:(o||s)&&n.up,ArrowRight:(o||a)&&n.next,ArrowDown:(o||s)&&n.down,ArrowLeft:(o||a)&&n.previous,Home:()=>{if(l())return!o||e.ctrlKey?null==n?void 0:n.first():null==n?void 0:n.previous(-1)},End:()=>{if(l())return!o||e.ctrlKey?null==n?void 0:n.last():null==n?void 0:n.next(-1)},PageUp:()=>Qu(t,n,null==n?void 0:n.up,!0),PageDown:()=>Qu(t,n,null==n?void 0:n.down)}[e.key];if(c){if(Cl(t)){const n=jl(t),r=a&&"ArrowLeft"===e.key,i=a&&"ArrowRight"===e.key,o=s&&"ArrowUp"===e.key,l=s&&"ArrowDown"===e.key;if(i||l){const{length:e}=function(e){if(Sl(e))return e.value;if(e.isContentEditable){const t=wl(e).createRange();return t.selectNodeContents(e),t.toString()}return""}(t);if(n.end!==e)return}else if((r||o)&&0!==n.start)return}const r=c();if(P(e)||void 0!==r){if(!L(e))return;e.preventDefault(),n.move(r)}}}),N=(0,z.useMemo)(()=>({id:h,baseElement:w}),[h,w]);return d=Gl(d,e=>(0,a.jsx)(fc.Provider,{value:N,children:e}),[N]),d=Ka(Ga({id:h,"data-active-item":b||void 0},d),{ref:Hl(p,d.ref),tabIndex:_?d.tabIndex:-1,onFocus:k,onBlurCapture:M,onKeyDown:V}),d=Xu(d),d=Ku(Ka(Ga({store:n},d),{getItem:S,shouldRegisterItem:!!h&&d.shouldRegisterItem})),hl(Ka(Ga({},d),{"aria-setsize":x,"aria-posinset":y}))});function td(e){var t;return null!=(t={menu:"menuitem",listbox:"option",tree:"treeitem"}[e])?t:"option"}tc(ec(function(e){return nc("button",ed(e))}));var nd=rc(function(e){var t,n=e,{store:r,value:i,hideOnClick:o,setValueOnClick:s,selectValueOnClick:l=!0,resetValueOnSelect:c,focusOnHover:u=!1,moveOnKeyPress:d=!0,getItem:f}=n,h=Ya(n,["store","value","hideOnClick","setValueOnClick","selectValueOnClick","resetValueOnSelect","focusOnHover","moveOnKeyPress","getItem"]);const p=nu();dl(r=r||p,!1);const{resetValueOnSelectState:m,multiSelectable:g,selected:v}=Mc(r,{resetValueOnSelectState:"resetValueOnSelect",multiSelectable:e=>Array.isArray(e.selectedValue),selected:e=>function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)}(e.selectedValue,i)}),w=(0,z.useCallback)(e=>{const t=Ka(Ga({},e),{value:i});return f?f(t):t},[i,f]);s=null!=s?s:!g,o=null!=o?o:null!=i&&!g;const b=h.onClick,x=Ul(s),y=Ul(l),_=Ul(null!=(t=null!=c?c:m)?t:g),S=Ul(o),C=$l(e=>{null==b||b(e),e.defaultPrevented||function(e){const t=e.currentTarget;if(!t)return!1;const n=t.tagName.toLowerCase();return!!e.altKey&&("a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type)}(e)||function(e){const t=e.currentTarget;if(!t)return!1;const n=El();if(n&&!e.metaKey)return!1;if(!n&&!e.ctrlKey)return!1;const r=t.tagName.toLowerCase();return"a"===r||"button"===r&&"submit"===t.type||"input"===r&&"submit"===t.type}(e)||(null!=i&&(y(e)&&(_(e)&&(null==r||r.resetValue()),null==r||r.setSelectedValue(e=>Array.isArray(e)?e.includes(i)?e.filter(e=>e!==i):[...e,i]:i)),x(e)&&(null==r||r.setValue(i))),S(e)&&(null==r||r.hide()))}),j=h.onKeyDown,k=$l(e=>{if(null==j||j(e),e.defaultPrevented)return;const t=null==r?void 0:r.getState().baseElement;t&&(vu(t)||(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&(queueMicrotask(()=>t.focus()),Sl(t)&&(null==r||r.setValue(t.value))))});g&&null!=v&&(h=Ga({"aria-selected":v},h)),h=Gl(h,e=>(0,a.jsx)(su.Provider,{value:i,children:(0,a.jsx)(au.Provider,{value:null!=v&&v,children:e})}),[i,v]);const I=(0,z.useContext)(Qc);h=Ka(Ga({role:td(I),children:i},h),{onClick:C,onKeyDown:k});const M=Ul(d);return h=ed(Ka(Ga({store:r},h),{getItem:w,moveOnKeyPress:e=>{if(!M(e))return!1;const t=new Event("combobox-item-move"),n=null==r?void 0:r.getState().baseElement;return null==n||n.dispatchEvent(t),!0}})),Gu(Ga({store:r,focusOnHover:u},h))}),rd=tc(ec(function(e){return nc("div",nd(e))}));function id(e){return cl(e).toLowerCase()}var od=rc(function(e){var t=e,{store:n,value:r,userValue:i}=t,o=Ya(t,["store","value","userValue"]);const s=nu();n=n||s;const l=(0,z.useContext)(su),c=null!=r?r:l,u=Ic(n,e=>null!=i?i:null==e?void 0:e.value),d=(0,z.useMemo)(()=>{if(c)return u?function(e,t){if(!e)return e;if(!t)return e;const n=(r=t,Array.isArray(r)?r:void 0!==r?[r]:[]).filter(Boolean).map(id);var r;const i=[],o=(e,t=!1)=>(0,a.jsx)("span",{"data-autocomplete-value":t?"":void 0,"data-user-value":t?void 0:"",children:e},i.length),s=function(e){return e.sort(([e],[t])=>e-t)}(function(e){return e.filter(([e,t],n,r)=>!r.some(([r,i],o)=>o!==n&&r<=e&&r+i>=e+t))}(function(e,t){const n=[];for(const r of t){let t=0;const i=r.length;for(;-1!==e.indexOf(r,t);){const o=e.indexOf(r,t);-1!==o&&n.push([o,i]),t=o+1}}return n}(id(e),new Set(n))));if(!s.length)return i.push(o(e,!0)),i;const[l]=s[0],c=[e.slice(0,l),...s.flatMap(([t,n],r)=>{var i;const o=e.slice(t,t+n),a=null==(i=s[r+1])?void 0:i[0];return[o,e.slice(t+n,a)]})];return c.forEach((e,t)=>{e&&i.push(o(e,t%2==0))}),i}(c,u):c},[c,u]);return hl(o=Ga({children:d},o))}),sd=ec(function(e){return nc("span",od(e))}),ad=n(731),ld=n.n(ad),cd=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z"})});const ud=[],dd=(e,t)=>e.singleSelection?t?.value:Array.isArray(t?.value)?t.value:!Array.isArray(t?.value)&&t?.value?[t.value]:ud,fd=[];function hd({elements:e,getElements:t}){const n=Array.isArray(e)&&e.length>0?e:fd,[r,i]=(0,o.useState)(n),[s,a]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(!t)return void i(n);let e=!1;return a(!0),t().then(t=>{if(!e){const e=Array.isArray(t)&&t.length>0?t:n;i(e)}}).catch(()=>{e||i(n)}).finally(()=>{e||a(!1)}),()=>{e=!0}},[t,n]),{elements:r,isLoading:s}}function pd(e=""){return ld()(e.trim().toLowerCase())}const md=(e,t,n)=>e.singleSelection?n:Array.isArray(t?.value)?t.value.includes(n)?t.value.filter(e=>e!==n):[...t.value,n]:[n];function gd(e,t){return`${e}-${t}`}const vd=({selected:e})=>(0,a.jsx)("span",{className:ro("dataviews-filters__search-widget-listitem-multi-selection",{"is-selected":e}),children:e&&(0,a.jsx)(s.Icon,{icon:cd})}),wd=({selected:e})=>(0,a.jsx)("span",{className:ro("dataviews-filters__search-widget-listitem-single-selection",{"is-selected":e})});function bd({view:e,filter:t,onChangeView:n}){const r=(0,So.useInstanceId)(bd,"dataviews-filter-list-box"),[i,l]=(0,o.useState)(1===t.operators?.length?void 0:null),c=e.filters?.find(e=>e.field===t.field),u=dd(t,c);return(0,a.jsx)(s.Composite,{virtualFocus:!0,focusLoop:!0,activeId:i,setActiveId:l,role:"listbox",className:"dataviews-filters__search-widget-listbox","aria-label":(0,Ut.sprintf)( /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ -(0,b.__)("List of: %1$s"),t.name),onFocusVisible:()=>{!r&&t.elements.length&&o(ma(i,t.elements[0].value))},render:(0,c.jsx)(s.Composite.Typeahead,{}),children:t.elements.map(r=>(0,c.jsxs)(s.Composite.Hover,{render:(0,c.jsx)(s.Composite.Item,{id:ma(i,r.value),render:(0,c.jsx)("div",{"aria-label":r.label,role:"option",className:"dataviews-filters__search-widget-listitem"}),onClick:()=>{const i=l?[...(e.filters??[]).map(e=>e.field===t.field?{...e,operator:l.operator||t.operators[0],value:fa(t,l,r.value)}:e)]:[...e.filters??[],{field:t.field,operator:t.operators[0],value:fa(t,l,r.value)}];n({...e,page:1,filters:i})}}),children:[t.singleSelection&&(0,c.jsx)(pa,{selected:u===r.value}),!t.singleSelection&&(0,c.jsx)(va,{selected:u.includes(r.value)}),(0,c.jsx)("span",{children:r.label})]},r.value))})}function ga({view:e,filter:t,onChangeView:n}){const[i,r]=(0,a.useState)(""),o=(0,a.useDeferredValue)(i),l=e.filters?.find(e=>e.field===t.field),u=la(t,l),d=(0,a.useMemo)(()=>{const e=da(o);return t.elements.filter(t=>da(t.label).includes(e))},[t.elements,o]);return(0,c.jsxs)(rr,{selectedValue:u,setSelectedValue:i=>{const r=l?[...(e.filters??[]).map(e=>e.field===t.field?{...e,operator:l.operator||t.operators[0],value:i}:e)]:[...e.filters??[],{field:t.field,operator:t.operators[0],value:i}];n({...e,page:1,filters:r})},setValue:r,children:[(0,c.jsxs)("div",{className:"dataviews-filters__search-widget-filter-combobox__wrapper",children:[(0,c.jsx)(sr,{render:(0,c.jsx)(s.VisuallyHidden,{children:(0,b.__)("Search items")}),children:(0,b.__)("Search items")}),(0,c.jsx)(Or,{autoSelect:"always",placeholder:(0,b.__)("Search"),className:"dataviews-filters__search-widget-filter-combobox__input"}),(0,c.jsx)("div",{className:"dataviews-filters__search-widget-filter-combobox__icon",children:(0,c.jsx)(s.Icon,{icon:y})})]}),(0,c.jsxs)(Hr,{className:"dataviews-filters__search-widget-filter-combobox-list",alwaysVisible:!0,children:[d.map(e=>(0,c.jsxs)(ea,{resetValueOnSelect:!1,value:e.value,className:"dataviews-filters__search-widget-listitem",hideOnClick:!1,setValueOnClick:!1,focusOnHover:!0,children:[t.singleSelection&&(0,c.jsx)(pa,{selected:u===e.value}),!t.singleSelection&&(0,c.jsx)(va,{selected:u.includes(e.value)}),(0,c.jsxs)("span",{children:[(0,c.jsx)(ia,{className:"dataviews-filters__search-widget-filter-combobox-item-value",value:e.label}),!!e.description&&(0,c.jsx)("span",{className:"dataviews-filters__search-widget-listitem-description",children:e.description})]})]},e.value)),!d.length&&(0,c.jsx)("p",{children:(0,b.__)("No results found")})]})]})}function ba(e){const{elements:t,isLoading:n}=ua({elements:e.filter.elements,getElements:e.filter.getElements});if(n)return(0,c.jsx)("div",{className:"dataviews-filters__search-widget-no-elements",children:(0,c.jsx)(s.Spinner,{})});if(0===t.length)return(0,c.jsx)("div",{className:"dataviews-filters__search-widget-no-elements",children:(0,b.__)("No elements found")});const i=t.length>10?ga:ha;return(0,c.jsx)(i,{...e,filter:{...e.filter,elements:t}})}var wa=n(252),xa=n.n(wa);function ya({filter:e,view:t,onChangeView:n,fields:i}){const r=t.filters?.find(t=>t.field===e.field),o=la(e,r),l=(0,a.useMemo)(()=>{const t=i.find(t=>t.id===e.field);return t?{...t,isValid:{required:!1,custom:()=>null},getValue:({item:e})=>e[t.id],setValue:({value:e})=>({[t.id]:e})}:t},[i,e.field]),u=(0,a.useMemo)(()=>(t.filters??[]).reduce((e,t)=>(e[t.field]=t.value,e),{}),[t.filters]),d=(0,W.useEvent)(i=>{if(!l||!r)return;const a=l.getValue({item:i});xa()(a,o)||n({...t,filters:(t.filters??[]).map(t=>t.field===e.field?{...t,operator:r.operator||e.operators[0],value:""===a?void 0:a}:t)})});return l&&l.Edit&&r?(0,c.jsx)(s.Flex,{className:"dataviews-filters__user-input-widget",gap:2.5,direction:"column",children:(0,c.jsx)(l.Edit,{hideLabelFromVision:!0,data:u,field:l,operator:r.operator,onChange:d})}):null}const _a="Enter",ja=" ",Ca=({activeElements:e,filterInView:t,filter:n})=>{if(void 0===e||0===e.length)return n.name;const i={Name:(0,c.jsx)("span",{className:"dataviews-filters__summary-filter-text-name"}),Value:(0,c.jsx)("span",{className:"dataviews-filters__summary-filter-text-value"})};if(t?.operator===U)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("List of: %1$s"),t.name),onFocusVisible:()=>{!i&&t.elements.length&&l(gd(r,t.elements[0].value))},render:(0,a.jsx)(s.Composite.Typeahead,{}),children:t.elements.map(i=>(0,a.jsxs)(s.Composite.Hover,{render:(0,a.jsx)(s.Composite.Item,{id:gd(r,i.value),render:(0,a.jsx)("div",{"aria-label":i.label,role:"option",className:"dataviews-filters__search-widget-listitem"}),onClick:()=>{const r=c?[...(e.filters??[]).map(e=>e.field===t.field?{...e,operator:c.operator||t.operators[0],value:md(t,c,i.value)}:e)]:[...e.filters??[],{field:t.field,operator:t.operators[0],value:md(t,c,i.value)}];n({...e,page:1,filters:r})}}),children:[t.singleSelection&&(0,a.jsx)(wd,{selected:u===i.value}),!t.singleSelection&&(0,a.jsx)(vd,{selected:u.includes(i.value)}),(0,a.jsx)("span",{children:i.label})]},i.value))})}function xd({view:e,filter:t,onChangeView:n}){const[r,i]=(0,o.useState)(""),l=(0,o.useDeferredValue)(r),c=e.filters?.find(e=>e.field===t.field),u=dd(t,c),d=(0,o.useMemo)(()=>{const e=pd(l);return t.elements.filter(t=>pd(t.label).includes(e))},[t.elements,l]);return(0,a.jsxs)(lu,{selectedValue:u,setSelectedValue:r=>{const i=c?[...(e.filters??[]).map(e=>e.field===t.field?{...e,operator:c.operator||t.operators[0],value:r}:e)]:[...e.filters??[],{field:t.field,operator:t.operators[0],value:r}];n({...e,page:1,filters:i})},setValue:i,children:[(0,a.jsxs)("div",{className:"dataviews-filters__search-widget-filter-combobox__wrapper",children:[(0,a.jsx)(uu,{render:(0,a.jsx)(s.VisuallyHidden,{children:(0,Ut.__)("Search items")}),children:(0,Ut.__)("Search items")}),(0,a.jsx)(Tu,{autoSelect:"always",placeholder:(0,Ut.__)("Search"),className:"dataviews-filters__search-widget-filter-combobox__input"}),(0,a.jsx)("div",{className:"dataviews-filters__search-widget-filter-combobox__icon",children:(0,a.jsx)(s.Icon,{icon:Qi})})]}),(0,a.jsxs)(Wu,{className:"dataviews-filters__search-widget-filter-combobox-list",alwaysVisible:!0,children:[d.map(e=>(0,a.jsxs)(rd,{resetValueOnSelect:!1,value:e.value,className:"dataviews-filters__search-widget-listitem",hideOnClick:!1,setValueOnClick:!1,focusOnHover:!0,children:[t.singleSelection&&(0,a.jsx)(wd,{selected:u===e.value}),!t.singleSelection&&(0,a.jsx)(vd,{selected:u.includes(e.value)}),(0,a.jsxs)("span",{children:[(0,a.jsx)(sd,{className:"dataviews-filters__search-widget-filter-combobox-item-value",value:e.label}),!!e.description&&(0,a.jsx)("span",{className:"dataviews-filters__search-widget-listitem-description",children:e.description})]})]},e.value)),!d.length&&(0,a.jsx)("p",{children:(0,Ut.__)("No results found")})]})]})}function yd(e){const{elements:t,isLoading:n}=hd({elements:e.filter.elements,getElements:e.filter.getElements});if(n)return(0,a.jsx)("div",{className:"dataviews-filters__search-widget-no-elements",children:(0,a.jsx)(s.Spinner,{})});if(0===t.length)return(0,a.jsx)("div",{className:"dataviews-filters__search-widget-no-elements",children:(0,Ut.__)("No elements found")});const r=t.length>10?xd:bd;return(0,a.jsx)(r,{...e,filter:{...e.filter,elements:t}})}var _d=n(252),Sd=n.n(_d);function Cd({filter:e,view:t,onChangeView:n,fields:r}){const i=t.filters?.find(t=>t.field===e.field),l=dd(e,i),c=(0,o.useMemo)(()=>{const t=r.find(t=>t.id===e.field);return t?{...t,isValid:{required:!1,custom:()=>null},getValue:({item:e})=>e[t.id],setValue:({value:e})=>({[t.id]:e})}:t},[r,e.field]),u=(0,o.useMemo)(()=>(t.filters??[]).reduce((e,t)=>(e[t.field]=t.value,e),{}),[t.filters]),d=(0,So.useEvent)(r=>{if(!c||!i)return;const o=c.getValue({item:r});Sd()(o,l)||n({...t,filters:(t.filters??[]).map(t=>t.field===e.field?{...t,operator:i.operator||e.operators[0],value:""===o?void 0:o}:t)})});return c&&c.Edit&&i?(0,a.jsx)(s.Flex,{className:"dataviews-filters__user-input-widget",gap:2.5,direction:"column",children:(0,a.jsx)(c.Edit,{hideLabelFromVision:!0,data:u,field:c,operator:i.operator,onChange:d})}):null}const jd="Enter",kd=" ",Id=({activeElements:e,filterInView:t,filter:n})=>{if(void 0===e||0===e.length)return n.name;const r={Name:(0,a.jsx)("span",{className:"dataviews-filters__summary-filter-text-name"}),Value:(0,a.jsx)("span",{className:"dataviews-filters__summary-filter-text-value"})};if(t?.operator===es)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is any: Admin, Editor". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is any: Admin, Editor". */ -(0,b.__)("%1$s is any: %2$s"),n.name,e.map(e=>e.label).join(", ")),i);if(t?.operator===Y)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is any: %2$s"),n.name,e.map(e=>e.label).join(", ")),r);if(t?.operator===ts)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is none: Admin, Editor". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is none: Admin, Editor". */ -(0,b.__)("%1$s is none: %2$s"),n.name,e.map(e=>e.label).join(", ")),i);if(t?.operator===Z)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is none: %2$s"),n.name,e.map(e=>e.label).join(", ")),r);if(t?.operator===ns)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is all: Admin, Editor". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is all: Admin, Editor". */ -(0,b.__)("%1$s is all: %2$s"),n.name,e.map(e=>e.label).join(", ")),i);if(t?.operator===X)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is all: %2$s"),n.name,e.map(e=>e.label).join(", ")),r);if(t?.operator===rs)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not all: Admin, Editor". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not all: Admin, Editor". */ -(0,b.__)("%1$s is not all: %2$s"),n.name,e.map(e=>e.label).join(", ")),i);if(t?.operator===G)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is not all: %2$s"),n.name,e.map(e=>e.label).join(", ")),r);if(t?.operator===Jo)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is: Admin". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is: Admin". */ -(0,b.__)("%1$s is: %2$s"),n.name,e[0].label),i);if(t?.operator===K)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is: %2$s"),n.name,e[0].label),r);if(t?.operator===Qo)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not: Admin". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Author is not: Admin". */ -(0,b.__)("%1$s is not: %2$s"),n.name,e[0].label),i);if(t?.operator===Q)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is not: %2$s"),n.name,e[0].label),r);if(t?.operator===is)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is less than: 10". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is less than: 10". */ -(0,b.__)("%1$s is less than: %2$s"),n.name,e[0].label),i);if(t?.operator===J)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is less than: %2$s"),n.name,e[0].label),r);if(t?.operator===os)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is greater than: 10". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is greater than: 10". */ -(0,b.__)("%1$s is greater than: %2$s"),n.name,e[0].label),i);if(t?.operator===ee)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is greater than: %2$s"),n.name,e[0].label),r);if(t?.operator===ss)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is less than or equal to: 10". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is less than or equal to: 10". */ -(0,b.__)("%1$s is less than or equal to: %2$s"),n.name,e[0].label),i);if(t?.operator===te)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is less than or equal to: %2$s"),n.name,e[0].label),r);if(t?.operator===as)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is greater than or equal to: 10". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Price is greater than or equal to: 10". */ -(0,b.__)("%1$s is greater than or equal to: %2$s"),n.name,e[0].label),i);if(t?.operator===se)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is greater than or equal to: %2$s"),n.name,e[0].label),r);if(t?.operator===fs)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Title contains: Mars". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Title contains: Mars". */ -(0,b.__)("%1$s contains: %2$s"),n.name,e[0].label),i);if(t?.operator===oe)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s contains: %2$s"),n.name,e[0].label),r);if(t?.operator===hs)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Description doesn't contain: photo". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Description doesn't contain: photo". */ -(0,b.__)("%1$s doesn't contain: %2$s"),n.name,e[0].label),i);if(t?.operator===le)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s doesn't contain: %2$s"),n.name,e[0].label),r);if(t?.operator===ps)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Title starts with: Mar". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Title starts with: Mar". */ -(0,b.__)("%1$s starts with: %2$s"),n.name,e[0].label),i);if(t?.operator===ne)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s starts with: %2$s"),n.name,e[0].label),r);if(t?.operator===ls)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is before: 2024-01-01". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is before: 2024-01-01". */ -(0,b.__)("%1$s is before: %2$s"),n.name,e[0].label),i);if(t?.operator===ie)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is before: %2$s"),n.name,e[0].label),r);if(t?.operator===cs)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is after: 2024-01-01". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is after: 2024-01-01". */ -(0,b.__)("%1$s is after: %2$s"),n.name,e[0].label),i);if(t?.operator===re)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is after: %2$s"),n.name,e[0].label),r);if(t?.operator===us)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is on or before: 2024-01-01". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is on or before: 2024-01-01". */ -(0,b.__)("%1$s is on or before: %2$s"),n.name,e[0].label),i);if(t?.operator===ae)return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is on or before: %2$s"),n.name,e[0].label),r);if(t?.operator===ds)return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is on or after: 2024-01-01". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is on or after: 2024-01-01". */ -(0,b.__)("%1$s is on or after: %2$s"),n.name,e[0].label),i);if(t?.operator===ce){const{label:t}=e[0];return(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is on or after: %2$s"),n.name,e[0].label),r);if(t?.operator===ms){const{label:t}=e[0];return(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Min value. 3: Max value. e.g.: "Item count between (inc): 10 and 180". */ /* translators: 1: Filter name. 2: Min value. 3: Max value. e.g.: "Item count between (inc): 10 and 180". */ -(0,b.__)("%1$s between (inc): %2$s and %3$s"),n.name,t[0],t[1]),i)}return t?.operator===ue?(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s between (inc): %2$s and %3$s"),n.name,t[0],t[1]),r)}return t?.operator===gs?(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is: 2024-01-01". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is: 2024-01-01". */ -(0,b.__)("%1$s is: %2$s"),n.name,e[0].label),i):t?.operator===de?(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is: %2$s"),n.name,e[0].label),r):t?.operator===vs?(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is not: 2024-01-01". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is not: 2024-01-01". */ -(0,b.__)("%1$s is not: %2$s"),n.name,e[0].label),i):t?.operator===fe?(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is not: %2$s"),n.name,e[0].label),r):t?.operator===ws?(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is in the past: 1 days". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is in the past: 1 days". */ -(0,b.__)("%1$s is in the past: %2$s"),n.name,`${e[0].value.value} ${e[0].value.unit}`),i):t?.operator===me?(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("%1$s is in the past: %2$s"),n.name,`${e[0].value.value} ${e[0].value.unit}`),r):t?.operator===bs?(0,o.createInterpolateElement)((0,Ut.sprintf)( /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is over: 1 days ago". */ /* translators: 1: Filter name. 2: Filter value. e.g.: "Date is over: 1 days ago". */ -(0,b.__)("%1$s is over: %2$s ago"),n.name,`${e[0].value.value} ${e[0].value.unit}`),i):(0,b.sprintf)( +(0,Ut.__)("%1$s is over: %2$s ago"),n.name,`${e[0].value.value} ${e[0].value.unit}`),r):(0,Ut.sprintf)( /* translators: 1: Filter name e.g.: "Unknown status for Author". */ /* translators: 1: Filter name e.g.: "Unknown status for Author". */ -(0,b.__)("Unknown status for %1$s"),n.name)};function Sa({filter:e,view:t,onChangeView:n}){const i=e.operators?.map(e=>({value:e,label:he[e]?.label})),r=t.filters?.find(t=>t.field===e.field),a=r?.operator||e.operators[0];return i.length>1&&(0,c.jsxs)(s.__experimentalHStack,{spacing:2,justify:"flex-start",className:"dataviews-filters__summary-operators-container",children:[(0,c.jsx)(s.FlexItem,{className:"dataviews-filters__summary-operators-filter-name",children:e.name}),(0,c.jsx)(s.SelectControl,{className:"dataviews-filters__summary-operators-filter-select",label:(0,b.__)("Conditions"),value:a,options:i,onChange:i=>{const a=i,s=r?.operator,o=r?[...(t.filters??[]).map(t=>{if(t.field===e.field){const e=[ce,fe,me],n=s&&(e.includes(s)||e.includes(a));return{...t,value:n?void 0:t.value,operator:a}}return t})]:[...t.filters??[],{field:e.field,operator:a,value:void 0}];n({...t,page:1,filters:o})},size:"small",variant:"minimal",__nextHasNoMarginBottom:!0,hideLabelFromVision:!0})]})}function ka({addFilterRef:e,openedFilter:t,fields:n,...i}){const r=(0,a.useRef)(null),{filter:o,view:l,onChangeView:u}=i,d=l.filters?.find(e=>e.field===o.field);let f=[];const{elements:m}=ua({elements:o.elements,getElements:o.getElements});m.length>0?f=m.filter(e=>o.singleSelection?e.value===d?.value:d?.value?.includes(e.value)):void 0!==d?.value&&(f=[{value:d.value,label:d.value}]);const v=o.isPrimary,p=d?.isLocked,h=!p&&void 0!==d?.value,g=!p&&(!v||h);return(0,c.jsx)(s.Dropdown,{defaultOpen:t===o.field,contentClassName:"dataviews-filters__summary-popover",popoverProps:{placement:"bottom-start",role:"dialog"},onClose:()=>{r.current?.focus()},renderToggle:({isOpen:t,onToggle:n})=>(0,c.jsxs)("div",{className:"dataviews-filters__summary-chip-container",children:[(0,c.jsx)(s.Tooltip,{text:(0,b.sprintf)( +(0,Ut.__)("Unknown status for %1$s"),n.name)};function Md({filter:e,view:t,onChangeView:n}){const r=e.operators?.map(e=>({value:e,label:_s[e]?.label})),i=t.filters?.find(t=>t.field===e.field),o=i?.operator||e.operators[0];return r.length>1&&(0,a.jsxs)(s.__experimentalHStack,{spacing:2,justify:"flex-start",className:"dataviews-filters__summary-operators-container",children:[(0,a.jsx)(s.FlexItem,{className:"dataviews-filters__summary-operators-filter-name",children:e.name}),(0,a.jsx)(s.SelectControl,{className:"dataviews-filters__summary-operators-filter-select",label:(0,Ut.__)("Conditions"),value:o,options:r,onChange:r=>{const o=r,s=i?.operator,a=i?[...(t.filters??[]).map(t=>{if(t.field===e.field){const e=[ms,ws,bs],n=s&&(e.includes(s)||e.includes(o));return{...t,value:n?void 0:t.value,operator:o}}return t})]:[...t.filters??[],{field:e.field,operator:o,value:void 0}];n({...t,page:1,filters:a})},size:"small",variant:"minimal",__nextHasNoMarginBottom:!0,hideLabelFromVision:!0})]})}function Ed({addFilterRef:e,openedFilter:t,fields:n,...r}){const i=(0,o.useRef)(null),{filter:l,view:c,onChangeView:u}=r,d=c.filters?.find(e=>e.field===l.field);let f=[];const{elements:h}=hd({elements:l.elements,getElements:l.getElements});h.length>0?f=h.filter(e=>l.singleSelection?e.value===d?.value:d?.value?.includes(e.value)):void 0!==d?.value&&(f=[{value:d.value,label:d.value}]);const p=l.isPrimary,m=d?.isLocked,g=!m&&void 0!==d?.value,v=!m&&(!p||g);return(0,a.jsx)(s.Dropdown,{defaultOpen:t===l.field,contentClassName:"dataviews-filters__summary-popover",popoverProps:{placement:"bottom-start",role:"dialog"},onClose:()=>{i.current?.focus()},renderToggle:({isOpen:t,onToggle:n})=>(0,a.jsxs)("div",{className:"dataviews-filters__summary-chip-container",children:[(0,a.jsx)(s.Tooltip,{text:(0,Ut.sprintf)( /* translators: 1: Filter name. */ /* translators: 1: Filter name. */ -(0,b.__)("Filter by: %1$s"),o.name.toLowerCase()),placement:"top",children:(0,c.jsx)("div",{className:k("dataviews-filters__summary-chip",{"has-reset":g,"has-values":h,"is-not-clickable":p}),role:"button",tabIndex:p?-1:0,onClick:()=>{p||n()},onKeyDown:e=>{!p&&[_a,ja].includes(e.key)&&(n(),e.preventDefault())},"aria-disabled":p,"aria-pressed":t,"aria-expanded":t,ref:r,children:(0,c.jsx)(Ca,{activeElements:f,filterInView:d,filter:o})})}),g&&(0,c.jsx)(s.Tooltip,{text:v?(0,b.__)("Reset"):(0,b.__)("Remove"),placement:"top",children:(0,c.jsx)("button",{className:k("dataviews-filters__summary-chip-remove",{"has-values":h}),onClick:()=>{u({...l,page:1,filters:l.filters?.filter(e=>e.field!==o.field)}),v?r.current?.focus():e.current?.focus()},children:(0,c.jsx)(s.Icon,{icon:$e})})})]}),renderContent:()=>(0,c.jsxs)(s.__experimentalVStack,{spacing:0,justify:"flex-start",children:[(0,c.jsx)(Sa,{...i}),i.filter.hasElements?(0,c.jsx)(ba,{...i,filter:{...i.filter,elements:m}}):(0,c.jsx)(ya,{...i,fields:n})]})})}function Ia({filters:e,view:t,onChangeView:n}){const i=!t.search&&!t.filters?.some(t=>{return!(t.isLocked||void 0===t.value&&(n=t.field,e.some(e=>e.field===n&&e.isPrimary)));var n});return(0,c.jsx)(s.Button,{disabled:i,accessibleWhenDisabled:!0,size:"compact",variant:"tertiary",className:"dataviews-filters__reset-button",onClick:()=>{n({...t,page:1,search:"",filters:t.filters?.filter(e=>!!e.isLocked)||[]})},children:(0,b.__)("Reset")})}var Va=function(e,t){return(0,a.useMemo)(()=>{const n=[];return e.forEach(e=>{if(!1===e.filterBy||!e.hasElements&&!e.Edit)return;const i=e.filterBy.operators,r=!!e.filterBy?.isPrimary,a=t.filters?.some(t=>t.field===e.id&&!!t.isLocked)??!1;n.push({field:e.id,name:e.label,elements:e.elements,getElements:e.getElements,hasElements:e.hasElements,singleSelection:i.some(e=>pe.includes(e)),operators:i,isVisible:a||r||!!t.filters?.some(t=>t.field===e.id&&ve.includes(t.operator)),isPrimary:r,isLocked:a})}),n.sort((e,t)=>e.isLocked&&!t.isLocked?-1:!e.isLocked&&t.isLocked?1:e.isPrimary&&!t.isPrimary?-1:!e.isPrimary&&t.isPrimary?1:e.name.localeCompare(t.name)),n},[e,t])},Ea=(0,a.memo)(function({className:e}){const{fields:t,view:n,onChangeView:i,openedFilter:r,setOpenedFilter:o}=(0,a.useContext)(Se),l=(0,a.useRef)(null),u=Va(t,n),d=(0,c.jsx)(Ft,{filters:u,view:n,onChangeView:i,ref:l,setOpenedFilter:o},"add-filter"),f=u.filter(e=>e.isVisible);if(0===f.length)return null;const m=[...f.map(e=>(0,c.jsx)(ka,{filter:e,view:n,fields:t,onChangeView:i,addFilterRef:l,openedFilter:r},e.field)),d];return m.push((0,c.jsx)(Ia,{filters:u,view:n,onChangeView:i},"reset-filters")),(0,c.jsx)(s.__experimentalHStack,{justify:"flex-start",style:{width:"fit-content"},wrap:!0,className:e,children:m})}),Na=function(e){const{isShowingFilter:t}=(0,a.useContext)(Se);return t?(0,c.jsx)(Ea,{...e}):null};function Fa({className:e}){const{actions:t=[],data:n,fields:i,getItemId:r,getItemLevel:s,isLoading:o,view:l,onChangeView:u,selection:d,onChangeSelection:f,setOpenedFilter:m,onClickItem:v,isItemClickable:p,renderItemLink:h,defaultLayouts:g,empty:w=(0,c.jsx)("p",{children:(0,b.__)("No results")})}=(0,a.useContext)(Se),x=Vt.find(e=>e.type===l.type&&g[e.type])?.component;return(0,c.jsx)(x,{className:e,actions:t,data:n,fields:i,getItemId:r,getItemLevel:s,isLoading:o,onChangeView:u,onChangeSelection:f,selection:d,setOpenedFilter:m,onClickItem:v,renderItemLink:h,isItemClickable:p,view:l,empty:w})}var Ma=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"})}),Oa=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"})});function La(){const{view:e,onChangeView:t,paginationInfo:{totalItems:n=0,totalPages:i}}=(0,a.useContext)(Se);if(!n||!i||e.infiniteScrollEnabled)return null;const r=e.page??1,o=Array.from(Array(i)).map((e,t)=>{const n=t+1;return{value:n.toString(),label:n.toString(),"aria-label":r===n?(0,b.sprintf)( +(0,Ut.__)("Filter by: %1$s"),l.name.toLowerCase()),placement:"top",children:(0,a.jsx)("div",{className:ro("dataviews-filters__summary-chip",{"has-reset":v,"has-values":g,"is-not-clickable":m}),role:"button",tabIndex:m?-1:0,onClick:()=>{m||n()},onKeyDown:e=>{!m&&[jd,kd].includes(e.key)&&(n(),e.preventDefault())},"aria-disabled":m,"aria-pressed":t,"aria-expanded":t,ref:i,children:(0,a.jsx)(Id,{activeElements:f,filterInView:d,filter:l})})}),v&&(0,a.jsx)(s.Tooltip,{text:p?(0,Ut.__)("Reset"):(0,Ut.__)("Remove"),placement:"top",children:(0,a.jsx)("button",{className:ro("dataviews-filters__summary-chip-remove",{"has-values":g}),onClick:()=>{u({...c,page:1,filters:c.filters?.filter(e=>e.field!==l.field)}),p?i.current?.focus():e.current?.focus()},children:(0,a.jsx)(s.Icon,{icon:Zs})})})]}),renderContent:()=>(0,a.jsxs)(s.__experimentalVStack,{spacing:0,justify:"flex-start",children:[(0,a.jsx)(Md,{...r}),r.filter.hasElements?(0,a.jsx)(yd,{...r,filter:{...r.filter,elements:h}}):(0,a.jsx)(Cd,{...r,fields:n})]})})}function Pd({filters:e,view:t,onChangeView:n}){const r=!t.search&&!t.filters?.some(t=>{return!(t.isLocked||void 0===t.value&&(n=t.field,e.some(e=>e.field===n&&e.isPrimary)));var n});return(0,a.jsx)(s.Button,{disabled:r,accessibleWhenDisabled:!0,size:"compact",variant:"tertiary",className:"dataviews-filters__reset-button",onClick:()=>{n({...t,page:1,search:"",filters:t.filters?.filter(e=>!!e.isLocked)||[]})},children:(0,Ut.__)("Reset")})}var Ld=function(e,t){return(0,o.useMemo)(()=>{const n=[];return e.forEach(e=>{if(!1===e.filterBy||!e.hasElements&&!e.Edit)return;const r=e.filterBy.operators,i=!!e.filterBy?.isPrimary,o=t.filters?.some(t=>t.field===e.id&&!!t.isLocked)??!1;n.push({field:e.id,name:e.label,elements:e.elements,getElements:e.getElements,hasElements:e.hasElements,singleSelection:r.some(e=>ys.includes(e)),operators:r,isVisible:o||i||!!t.filters?.some(t=>t.field===e.id&&xs.includes(t.operator)),isPrimary:i,isLocked:o})}),n.sort((e,t)=>e.isLocked&&!t.isLocked?-1:!e.isLocked&&t.isLocked?1:e.isPrimary&&!t.isPrimary?-1:!e.isPrimary&&t.isPrimary?1:e.name.localeCompare(t.name)),n},[e,t])},Vd=(0,o.memo)(function({className:e}){const{fields:t,view:n,onChangeView:r,openedFilter:i,setOpenedFilter:l}=(0,o.useContext)(Ls),c=(0,o.useRef)(null),u=Ld(t,n),d=(0,a.jsx)(Ta,{filters:u,view:n,onChangeView:r,ref:c,setOpenedFilter:l},"add-filter"),f=u.filter(e=>e.isVisible);if(0===f.length)return null;const h=[...f.map(e=>(0,a.jsx)(Ed,{filter:e,view:n,fields:t,onChangeView:r,addFilterRef:c,openedFilter:i},e.field)),d];return h.push((0,a.jsx)(Pd,{filters:u,view:n,onChangeView:r},"reset-filters")),(0,a.jsx)(s.__experimentalHStack,{justify:"flex-start",style:{width:"fit-content"},wrap:!0,className:e,children:h})}),Nd=function(e){const{isShowingFilter:t}=(0,o.useContext)(Ls);return t?(0,a.jsx)(Vd,{...e}):null};function Od({className:e}){const{actions:t=[],data:n,fields:r,getItemId:i,getItemLevel:s,isLoading:l,view:c,onChangeView:u,selection:d,onChangeSelection:f,setOpenedFilter:h,onClickItem:p,isItemClickable:m,renderItemLink:g,defaultLayouts:v,empty:w=(0,a.jsx)("p",{children:(0,Ut.__)("No results")})}=(0,o.useContext)(Ls),b=Oa.find(e=>e.type===c.type&&v[e.type])?.component;return(0,a.jsx)(b,{className:e,actions:t,data:n,fields:r,getItemId:i,getItemLevel:s,isLoading:l,onChangeView:u,onChangeSelection:f,selection:d,setOpenedFilter:h,onClickItem:p,renderItemLink:g,isItemClickable:m,view:c,empty:w})}var Rd=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"})}),Fd=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"})});function Td(){const{view:e,onChangeView:t,paginationInfo:{totalItems:n=0,totalPages:r}}=(0,o.useContext)(Ls);if(!n||!r||e.infiniteScrollEnabled)return null;const i=e.page??1,l=Array.from(Array(r)).map((e,t)=>{const n=t+1;return{value:n.toString(),label:n.toString(),"aria-label":i===n?(0,Ut.sprintf)( // translators: 1: current page number. 2: total number of pages. // translators: 1: current page number. 2: total number of pages. -(0,b.__)("Page %1$d of %2$d"),r,i):n.toString()}});return!!n&&1!==i&&(0,c.jsxs)(s.__experimentalHStack,{expanded:!1,className:"dataviews-pagination",justify:"end",spacing:6,children:[(0,c.jsx)(s.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:1,className:"dataviews-pagination__page-select",children:(0,a.createInterpolateElement)((0,b.sprintf)( +(0,Ut.__)("Page %1$d of %2$d"),i,r):n.toString()}});return!!n&&1!==r&&(0,a.jsxs)(s.__experimentalHStack,{expanded:!1,className:"dataviews-pagination",justify:"end",spacing:6,children:[(0,a.jsx)(s.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:1,className:"dataviews-pagination__page-select",children:(0,o.createInterpolateElement)((0,Ut.sprintf)( // translators: 1: Current page number, 2: Total number of pages. // translators: 1: Current page number, 2: Total number of pages. -(0,b._x)("
Page
%1$s
of %2$d
","paging"),"",i),{div:(0,c.jsx)("div",{"aria-hidden":!0}),CurrentPage:(0,c.jsx)(s.SelectControl,{"aria-label":(0,b.__)("Current page"),value:r.toString(),options:o,onChange:n=>{t({...e,page:+n})},size:"small",__nextHasNoMarginBottom:!0,variant:"minimal"})})}),(0,c.jsxs)(s.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,c.jsx)(s.Button,{onClick:()=>t({...e,page:r-1}),disabled:1===r,accessibleWhenDisabled:!0,label:(0,b.__)("Previous page"),icon:(0,b.isRTL)()?Ma:Oa,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,c.jsx)(s.Button,{onClick:()=>t({...e,page:r+1}),disabled:r>=i,accessibleWhenDisabled:!0,label:(0,b.__)("Next page"),icon:(0,b.isRTL)()?Oa:Ma,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})}var Pa=(0,a.memo)(La);const Aa=[];function Da(){const{view:e,paginationInfo:{totalItems:t=0,totalPages:n},data:i,actions:r=Aa}=(0,a.useContext)(Se),o=Ke(r,i)&&[_e,je].includes(e.type);return!t||!n||n<=1&&!o?null:!!t&&(0,c.jsxs)(s.__experimentalHStack,{expanded:!1,justify:"end",className:"dataviews-footer",children:[o&&(0,c.jsx)(et,{}),(0,c.jsx)(Pa,{})]})}var Ta=(0,a.memo)(function({label:e}){const{view:t,onChangeView:n}=(0,a.useContext)(Se),[i,r,o]=(0,W.useDebouncedInput)(t.search);(0,a.useEffect)(()=>{r(t.search??"")},[t.search,r]);const l=(0,a.useRef)(n),u=(0,a.useRef)(t);(0,a.useEffect)(()=>{l.current=n,u.current=t},[n,t]),(0,a.useEffect)(()=>{o!==u.current?.search&&l.current({...u.current,page:1,search:o})},[o]);const d=e||(0,b.__)("Search");return(0,c.jsx)(s.SearchControl,{className:"dataviews-search",__nextHasNoMarginBottom:!0,onChange:r,value:i,label:d,placeholder:d,size:"compact"})}),Ba=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{d:"M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z"})}),za=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),Ha=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),Ra=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{d:"M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"})}),Wa=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"})});const $a=window.wp.warning;var qa=n.n($a);function Ga(){const e=(0,a.useContext)(Se),{view:t,onChangeView:n}=e,i=t.infiniteScrollEnabled??!1;return e.hasInfiniteScrollHandler?(0,c.jsx)(s.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Enable infinite scroll"),help:(0,b.__)("Automatically load more content as you scroll, instead of showing pagination links."),checked:i,onChange:e=>{n({...t,infiniteScrollEnabled:e})}}):null}const{Menu:Ka}=Le(s.privateApis),Ua={className:"dataviews-config__popover",placement:"bottom-end",offset:9};function Ya(){const{view:e,onChangeView:t,defaultLayouts:n}=(0,a.useContext)(Se),i=Object.keys(n);if(i.length<=1)return null;const r=Vt.find(t=>e.type===t.type);return(0,c.jsxs)(Ka,{children:[(0,c.jsx)(Ka.TriggerButton,{render:(0,c.jsx)(s.Button,{size:"compact",icon:r?.icon,label:(0,b.__)("Layout")})}),(0,c.jsx)(Ka.Popover,{children:i.map(i=>{const r=Vt.find(e=>e.type===i);return r?(0,c.jsx)(Ka.RadioItem,{value:i,name:"view-actions-available-view",checked:i===e.type,hideOnClick:!0,onChange:i=>{switch(i.target.value){case"list":case"grid":case"table":case"pickerGrid":const r={...e};return"layout"in r&&delete r.layout,t({...r,type:i.target.value,...n[i.target.value]})}qa()("Invalid dataview")},children:(0,c.jsx)(Ka.ItemLabel,{children:r.label})},i):null})})]})}function Za(){const{view:e,fields:t,onChangeView:n}=(0,a.useContext)(Se),i=(0,a.useMemo)(()=>t.filter(e=>!1!==e.enableSorting).map(e=>({label:e.label,value:e.id})),[t]);return(0,c.jsx)(s.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,b.__)("Sort by"),value:e.sort?.field,options:i,onChange:t=>{n({...e,sort:{direction:e?.sort?.direction||"desc",field:t},showLevels:!1})}})}function Xa(){const{view:e,fields:t,onChangeView:n}=(0,a.useContext)(Se);if(0===t.filter(e=>!1!==e.enableSorting).length)return null;let i=e.sort?.direction;return!i&&e.sort?.field&&(i="desc"),(0,c.jsx)(s.__experimentalToggleGroupControl,{className:"dataviews-view-config__sort-direction",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,b.__)("Order"),value:i,onChange:i=>{"asc"!==i&&"desc"!==i?qa()("Invalid direction"):n({...e,sort:{direction:i,field:e.sort?.field||t.find(e=>!1!==e.enableSorting)?.id||""},showLevels:!1})},children:ge.map(e=>(0,c.jsx)(s.__experimentalToggleGroupControlOptionIcon,{value:e,icon:ye[e],label:xe[e]},e))})}function Qa(){const{view:e,config:t,onChangeView:n}=(0,a.useContext)(Se),{infiniteScrollEnabled:i}=e;return!t||!t.perPageSizes||t.perPageSizes.length<2||t.perPageSizes.length>6||i?null:(0,c.jsx)(s.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,b.__)("Items per page"),value:e.perPage||10,disabled:!e?.sort?.field,onChange:t=>{const i="number"==typeof t||void 0===t?t:parseInt(t,10);n({...e,perPage:i,page:1})},children:t.perPageSizes.map(e=>(0,c.jsx)(s.__experimentalToggleGroupControlOption,{value:e,label:e.toString()},e))})}function Ja({previewOptions:e,onChangePreviewOption:t,onMenuOpenChange:n,activeOption:i}){return(0,c.jsxs)(Ka,{onOpenChange:n,children:[(0,c.jsx)(Ka.TriggerButton,{render:(0,c.jsx)(s.Button,{className:"dataviews-field-control__field-preview-options-button",size:"compact",icon:Fe,label:(0,b.__)("Preview")})}),(0,c.jsx)(Ka.Popover,{children:e?.map(({id:e,label:n})=>(0,c.jsx)(Ka.RadioItem,{value:e,checked:e===i,onChange:()=>{t?.(e),(e=>{setTimeout(()=>{const t=document.querySelector(`.dataviews-field-control__field-${e} .dataviews-field-control__field-preview-options-button`);t instanceof HTMLElement&&t.focus()},50)})(e)},children:(0,c.jsx)(Ka.ItemLabel,{children:n})},e))})]})}function es({field:e,label:t,description:n,isVisible:i,isFirst:r,isLast:o,canMove:l=!0,onToggleVisibility:u,onMoveUp:d,onMoveDown:f,previewOptions:m,onChangePreviewOption:v}){const[p,h]=(0,a.useState)(!1);return(0,c.jsx)(s.__experimentalItem,{children:(0,c.jsxs)(s.__experimentalHStack,{expanded:!0,className:k("dataviews-field-control__field",`dataviews-field-control__field-${e.id}`,{"is-interacting":p}),justify:"flex-start",children:[(0,c.jsx)("span",{className:"dataviews-field-control__icon",children:!l&&!e.enableHiding&&(0,c.jsx)(s.Icon,{icon:Ba})}),(0,c.jsxs)("span",{className:"dataviews-field-control__label-sub-label-container",children:[(0,c.jsx)("span",{className:"dataviews-field-control__label",children:t||e.label}),n&&(0,c.jsx)("span",{className:"dataviews-field-control__sub-label",children:n})]}),(0,c.jsxs)(s.__experimentalHStack,{justify:"flex-end",expanded:!1,className:"dataviews-field-control__actions",children:[i&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.Button,{disabled:r||!l,accessibleWhenDisabled:!0,size:"compact",onClick:d,icon:za,label:r||!l?(0,b.__)("This field can't be moved up"):(0,b.sprintf)( +(0,Ut._x)("
Page
%1$s
of %2$d
","paging"),"",r),{div:(0,a.jsx)("div",{"aria-hidden":!0}),CurrentPage:(0,a.jsx)(s.SelectControl,{"aria-label":(0,Ut.__)("Current page"),value:i.toString(),options:l,onChange:n=>{t({...e,page:+n})},size:"small",__nextHasNoMarginBottom:!0,variant:"minimal"})})}),(0,a.jsxs)(s.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,a.jsx)(s.Button,{onClick:()=>t({...e,page:i-1}),disabled:1===i,accessibleWhenDisabled:!0,label:(0,Ut.__)("Previous page"),icon:(0,Ut.isRTL)()?Rd:Fd,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,a.jsx)(s.Button,{onClick:()=>t({...e,page:i+1}),disabled:i>=r,accessibleWhenDisabled:!0,label:(0,Ut.__)("Next page"),icon:(0,Ut.isRTL)()?Fd:Rd,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})}var Ad=(0,o.memo)(Td);const Dd=[];function Bd(){const{view:e,paginationInfo:{totalItems:t=0,totalPages:n},data:r,actions:i=Dd}=(0,o.useContext)(Ls),l=Qs(i,r)&&[Ms,Es].includes(e.type);return!t||!n||n<=1&&!l?null:!!t&&(0,a.jsxs)(s.__experimentalHStack,{expanded:!1,justify:"end",className:"dataviews-footer",children:[l&&(0,a.jsx)(sa,{}),(0,a.jsx)(Ad,{})]})}var zd=(0,o.memo)(function({label:e}){const{view:t,onChangeView:n}=(0,o.useContext)(Ls),[r,i,l]=(0,So.useDebouncedInput)(t.search);(0,o.useEffect)(()=>{i(t.search??"")},[t.search,i]);const c=(0,o.useRef)(n),u=(0,o.useRef)(t);(0,o.useEffect)(()=>{c.current=n,u.current=t},[n,t]),(0,o.useEffect)(()=>{l!==u.current?.search&&c.current({...u.current,page:1,search:l})},[l]);const d=e||(0,Ut.__)("Search");return(0,a.jsx)(s.SearchControl,{className:"dataviews-search",__nextHasNoMarginBottom:!0,onChange:i,value:r,label:d,placeholder:d,size:"compact"})}),$d=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"M17 10h-1.2V7c0-2.1-1.7-3.8-3.8-3.8-2.1 0-3.8 1.7-3.8 3.8v3H7c-.6 0-1 .4-1 1v8c0 .6.4 1 1 1h10c.6 0 1-.4 1-1v-8c0-.6-.4-1-1-1zm-2.8 0H9.8V7c0-1.2 1-2.2 2.2-2.2s2.2 1 2.2 2.2v3z"})}),Hd=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),Wd=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),qd=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"})}),Ud=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"})});const Gd=window.wp.warning;var Kd=n.n(Gd);function Yd(){const e=(0,o.useContext)(Ls),{view:t,onChangeView:n}=e,r=t.infiniteScrollEnabled??!1;return e.hasInfiniteScrollHandler?(0,a.jsx)(s.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,Ut.__)("Enable infinite scroll"),help:(0,Ut.__)("Automatically load more content as you scroll, instead of showing pagination links."),checked:r,onChange:e=>{n({...t,infiniteScrollEnabled:e})}}):null}const{Menu:Zd}=Bs(s.privateApis),Xd={className:"dataviews-config__popover",placement:"bottom-end",offset:9};function Jd(){const{view:e,onChangeView:t,defaultLayouts:n}=(0,o.useContext)(Ls),r=Object.keys(n);if(r.length<=1)return null;const i=Oa.find(t=>e.type===t.type);return(0,a.jsxs)(Zd,{children:[(0,a.jsx)(Zd.TriggerButton,{render:(0,a.jsx)(s.Button,{size:"compact",icon:i?.icon,label:(0,Ut.__)("Layout")})}),(0,a.jsx)(Zd.Popover,{children:r.map(r=>{const i=Oa.find(e=>e.type===r);return i?(0,a.jsx)(Zd.RadioItem,{value:r,name:"view-actions-available-view",checked:r===e.type,hideOnClick:!0,onChange:r=>{switch(r.target.value){case"list":case"grid":case"table":case"pickerGrid":const i={...e};return"layout"in i&&delete i.layout,t({...i,type:r.target.value,...n[r.target.value]})}Kd()("Invalid dataview")},children:(0,a.jsx)(Zd.ItemLabel,{children:i.label})},r):null})})]})}function Qd(){const{view:e,fields:t,onChangeView:n}=(0,o.useContext)(Ls),r=(0,o.useMemo)(()=>t.filter(e=>!1!==e.enableSorting).map(e=>({label:e.label,value:e.id})),[t]);return(0,a.jsx)(s.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,Ut.__)("Sort by"),value:e.sort?.field,options:r,onChange:t=>{n({...e,sort:{direction:e?.sort?.direction||"desc",field:t},showLevels:!1})}})}function ef(){const{view:e,fields:t,onChangeView:n}=(0,o.useContext)(Ls);if(0===t.filter(e=>!1!==e.enableSorting).length)return null;let r=e.sort?.direction;return!r&&e.sort?.field&&(r="desc"),(0,a.jsx)(s.__experimentalToggleGroupControl,{className:"dataviews-view-config__sort-direction",__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,Ut.__)("Order"),value:r,onChange:r=>{"asc"!==r&&"desc"!==r?Kd()("Invalid direction"):n({...e,sort:{direction:r,field:e.sort?.field||t.find(e=>!1!==e.enableSorting)?.id||""},showLevels:!1})},children:Ss.map(e=>(0,a.jsx)(s.__experimentalToggleGroupControlOptionIcon,{value:e,icon:Is[e],label:ks[e]},e))})}function tf(){const{view:e,config:t,onChangeView:n}=(0,o.useContext)(Ls),{infiniteScrollEnabled:r}=e;return!t||!t.perPageSizes||t.perPageSizes.length<2||t.perPageSizes.length>6||r?null:(0,a.jsx)(s.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,isBlock:!0,label:(0,Ut.__)("Items per page"),value:e.perPage||10,disabled:!e?.sort?.field,onChange:t=>{const r="number"==typeof t||void 0===t?t:parseInt(t,10);n({...e,perPage:r,page:1})},children:t.perPageSizes.map(e=>(0,a.jsx)(s.__experimentalToggleGroupControlOption,{value:e,label:e.toString()},e))})}function nf({previewOptions:e,onChangePreviewOption:t,onMenuOpenChange:n,activeOption:r}){return(0,a.jsxs)(Zd,{onOpenChange:n,children:[(0,a.jsx)(Zd.TriggerButton,{render:(0,a.jsx)(s.Button,{className:"dataviews-field-control__field-preview-options-button",size:"compact",icon:Ts,label:(0,Ut.__)("Preview")})}),(0,a.jsx)(Zd.Popover,{children:e?.map(({id:e,label:n})=>(0,a.jsx)(Zd.RadioItem,{value:e,checked:e===r,onChange:()=>{t?.(e),(e=>{setTimeout(()=>{const t=document.querySelector(`.dataviews-field-control__field-${e} .dataviews-field-control__field-preview-options-button`);t instanceof HTMLElement&&t.focus()},50)})(e)},children:(0,a.jsx)(Zd.ItemLabel,{children:n})},e))})]})}function rf({field:e,label:t,description:n,isVisible:r,isFirst:i,isLast:l,canMove:c=!0,onToggleVisibility:u,onMoveUp:d,onMoveDown:f,previewOptions:h,onChangePreviewOption:p}){const[m,g]=(0,o.useState)(!1);return(0,a.jsx)(s.__experimentalItem,{children:(0,a.jsxs)(s.__experimentalHStack,{expanded:!0,className:ro("dataviews-field-control__field",`dataviews-field-control__field-${e.id}`,{"is-interacting":m}),justify:"flex-start",children:[(0,a.jsx)("span",{className:"dataviews-field-control__icon",children:!c&&!e.enableHiding&&(0,a.jsx)(s.Icon,{icon:$d})}),(0,a.jsxs)("span",{className:"dataviews-field-control__label-sub-label-container",children:[(0,a.jsx)("span",{className:"dataviews-field-control__label",children:t||e.label}),n&&(0,a.jsx)("span",{className:"dataviews-field-control__sub-label",children:n})]}),(0,a.jsxs)(s.__experimentalHStack,{justify:"flex-end",expanded:!1,className:"dataviews-field-control__actions",children:[r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.Button,{disabled:i||!c,accessibleWhenDisabled:!0,size:"compact",onClick:d,icon:Hd,label:i||!c?(0,Ut.__)("This field can't be moved up"):(0,Ut.sprintf)( /* translators: %s: field label */ /* translators: %s: field label */ -(0,b.__)("Move %s up"),e.label)}),(0,c.jsx)(s.Button,{disabled:o||!l,accessibleWhenDisabled:!0,size:"compact",onClick:f,icon:Ha,label:o||!l?(0,b.__)("This field can't be moved down"):(0,b.sprintf)( +(0,Ut.__)("Move %s up"),e.label)}),(0,a.jsx)(s.Button,{disabled:l||!c,accessibleWhenDisabled:!0,size:"compact",onClick:f,icon:Wd,label:l||!c?(0,Ut.__)("This field can't be moved down"):(0,Ut.sprintf)( /* translators: %s: field label */ /* translators: %s: field label */ -(0,b.__)("Move %s down"),e.label)})]}),u&&(0,c.jsx)(s.Button,{className:"dataviews-field-control__field-visibility-button",disabled:!e.enableHiding,accessibleWhenDisabled:!0,size:"compact",onClick:()=>{u(),setTimeout(()=>{const t=document.querySelector(`.dataviews-field-control__field-${e.id} .dataviews-field-control__field-visibility-button`);t instanceof HTMLElement&&t.focus()},50)},icon:i?rt:Ra,label:i?(0,b.sprintf)( +(0,Ut.__)("Move %s down"),e.label)})]}),u&&(0,a.jsx)(s.Button,{className:"dataviews-field-control__field-visibility-button",disabled:!e.enableHiding,accessibleWhenDisabled:!0,size:"compact",onClick:()=>{u(),setTimeout(()=>{const t=document.querySelector(`.dataviews-field-control__field-${e.id} .dataviews-field-control__field-visibility-button`);t instanceof HTMLElement&&t.focus()},50)},icon:r?ua:qd,label:r?(0,Ut.sprintf)( /* translators: %s: field label */ /* translators: %s: field label */ -(0,b._x)("Hide %s","field"),e.label):(0,b.sprintf)( +(0,Ut._x)("Hide %s","field"),e.label):(0,Ut.sprintf)( /* translators: %s: field label */ /* translators: %s: field label */ -(0,b._x)("Show %s","field"),e.label)}),m&&(0,c.jsx)(Ja,{previewOptions:m,onChangePreviewOption:v,onMenuOpenChange:h,activeOption:e.id})]})]})})}function ts({index:e,field:t,view:n,onChangeView:i}){const r=n.fields??[],a=void 0!==e&&r.includes(t.id);return(0,c.jsx)(es,{field:t,isVisible:a,isFirst:void 0!==e&&e<1,isLast:void 0!==e&&e===r.length-1,onToggleVisibility:()=>{i({...n,fields:a?r.filter(e=>e!==t.id):[...r,t.id]})},onMoveUp:void 0!==e?()=>{i({...n,fields:[...r.slice(0,e-1)??[],t.id,r[e-1],...r.slice(e+1)]})}:void 0,onMoveDown:void 0!==e?()=>{i({...n,fields:[...r.slice(0,e)??[],r[e+1],t.id,...r.slice(e+2)]})}:void 0})}function ns(e){return!!e}function is(){const{view:e,fields:t,onChangeView:n}=(0,a.useContext)(Se),i=[e?.titleField,e?.mediaField,e?.descriptionField].filter(Boolean),r=e.fields??[],o=t.filter(e=>!r.includes(e.id)&&!i.includes(e.id)&&"media"!==e.type&&!1!==e.enableHiding);let l=r.map(e=>t.find(t=>t.id===e)).filter(ns);if(!l?.length&&!o?.length)return null;const u=t.find(t=>t.id===e.titleField),d=t.find(t=>t.id===e.mediaField),f=t.find(t=>t.id===e.descriptionField),m=t.filter(e=>"media"===e.type);let v;if(m.length>1){const t=ns(d)&&(e.showMedia??!0);v=ns(d)&&(0,c.jsx)(es,{field:d,label:(0,b.__)("Preview"),description:d.label,isVisible:t,onToggleVisibility:()=>{n({...e,showMedia:!t})},canMove:!1,previewOptions:m.map(e=>({label:e.label,id:e.id})),onChangePreviewOption:t=>n({...e,mediaField:t})},d.id)}const p=[{field:u,isVisibleFlag:"showTitle"},{field:d,isVisibleFlag:"showMedia",ui:v},{field:f,isVisibleFlag:"showDescription"}].filter(({field:e})=>ns(e));let h=p.filter(({field:t,isVisibleFlag:n})=>ns(t)&&(e[n]??!0));1===h.length&&(h=h.map(e=>({...e,field:{...e.field,enableHiding:!1}}))),0===h.length&&1===l.length&&(l=[{...l[0],enableHiding:!1}]);const g=p.filter(({field:t,isVisibleFlag:n})=>ns(t)&&!(e[n]??1));return(0,c.jsxs)(s.__experimentalVStack,{className:"dataviews-field-control",spacing:6,children:[(0,c.jsx)(s.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(h.length>0||!!l?.length)&&(0,c.jsxs)(s.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[h.map(({field:t,isVisibleFlag:i,ui:r})=>r??(0,c.jsx)(es,{field:t,isVisible:!0,onToggleVisibility:()=>{n({...e,[i]:!1})},canMove:!1},t.id)),l.map((t,i)=>(0,c.jsx)(ts,{field:t,view:e,onChangeView:n,index:i},t.id))]})}),(!!o?.length||!!g.length)&&(0,c.jsxs)(s.__experimentalVStack,{spacing:4,children:[(0,c.jsx)(s.BaseControl.VisualLabel,{style:{margin:0},children:(0,b.__)("Hidden")}),(0,c.jsx)(s.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(0,c.jsxs)(s.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[g.length>0&&g.map(({field:t,isVisibleFlag:i,ui:r})=>r??(0,c.jsx)(es,{field:t,isVisible:!1,onToggleVisibility:()=>{n({...e,[i]:!0})},canMove:!1},t.id)),o.map(t=>(0,c.jsx)(ts,{field:t,view:e,onChangeView:n},t.id))]})})]})]})}function rs({title:e,description:t,children:n}){return(0,c.jsxs)(s.__experimentalGrid,{columns:12,className:"dataviews-settings-section",gap:4,children:[(0,c.jsxs)("div",{className:"dataviews-settings-section__sidebar",children:[(0,c.jsx)(s.__experimentalHeading,{level:2,className:"dataviews-settings-section__title",children:e}),t&&(0,c.jsx)(s.__experimentalText,{variant:"muted",className:"dataviews-settings-section__description",children:t})]}),(0,c.jsx)(s.__experimentalGrid,{columns:8,gap:4,className:"dataviews-settings-section__content",children:n})]})}function as(){const{view:e}=(0,a.useContext)(Se),t=(0,W.useInstanceId)(ss,"dataviews-view-config-dropdown"),n=Vt.find(t=>t.type===e.type);return(0,c.jsx)(s.Dropdown,{expandOnMobile:!0,popoverProps:{...Ua,id:t},renderToggle:({onToggle:e,isOpen:n})=>(0,c.jsx)(s.Button,{size:"compact",icon:Wa,label:(0,b._x)("View options","View is used as a noun"),onClick:e,"aria-expanded":n?"true":"false","aria-controls":t}),renderContent:()=>(0,c.jsx)(s.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"dataviews-config__popover-content-wrapper",children:(0,c.jsxs)(s.__experimentalVStack,{className:"dataviews-view-config",spacing:6,children:[(0,c.jsxs)(rs,{title:(0,b.__)("Appearance"),children:[(0,c.jsxs)(s.__experimentalHStack,{expanded:!0,className:"is-divided-in-two",children:[(0,c.jsx)(Za,{}),(0,c.jsx)(Xa,{})]}),!!n?.viewConfigOptions&&(0,c.jsx)(n.viewConfigOptions,{}),(0,c.jsx)(Ga,{}),(0,c.jsx)(Qa,{})]}),(0,c.jsx)(rs,{title:(0,b.__)("Properties"),children:(0,c.jsx)(is,{})})]})})})}function ss(){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Ya,{}),(0,c.jsx)(as,{})]})}var os=(0,a.memo)(ss);function ls({item:e,field:t}){const{elements:n,isLoading:i}=ua({elements:t.elements,getElements:t.getElements}),r=t.getValue({item:e});return i||0===n.length?r:n?.find(e=>e.value===r)?.label||t.getValue({item:e})}const cs=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;var us={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||cs.test(n)?null:(0,b.__)("Value must be a valid email address.")}},Edit:"email",render:({item:e,field:t})=>t.hasElements?(0,c.jsx)(ls,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[U,Y],validOperators:[G,K,se,oe,le,U,Y,Z,X]}},ds={sort:function(e,t,n){return"asc"===n?e-t:t-e},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||Number.isInteger(n)?null:(0,b.__)("Value must be an integer.")}},Edit:"integer",render:({item:e,field:t})=>t.hasElements?(0,c.jsx)(ls,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[G,K,Q,J,ee,te,ce],validOperators:[G,K,Q,J,ee,te,ce,U,Y,Z,X]}},fs={sort:function(e,t,n){return"asc"===n?e-t:t-e},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return function(e){return""===e||null==e}(n)||Number.isFinite(n)?null:(0,b.__)("Value must be a number.")}},Edit:"number",render:({item:e,field:t})=>{t.hasElements;const n=t.getValue({item:e});return[null,void 0].includes(n)?null:Number(n).toFixed(2)},enableSorting:!0,filterBy:{defaultOperators:[G,K,Q,J,ee,te,ce],validOperators:[G,K,Q,J,ee,te,ce,U,Y,Z,X]}},ms={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:()=>null},Edit:"text",render:({item:e,field:t})=>t.hasElements?(0,c.jsx)(ls,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[U,Y],validOperators:[G,K,se,oe,le,U,Y,Z,X]}},vs={sort:function(e,t,n){const i=new Date(e).getTime(),r=new Date(t).getTime();return"asc"===n?i-r:r-i},isValid:{elements:!0,custom:()=>null},Edit:"datetime",render:({item:e,field:t})=>t.hasElements?(0,c.jsx)(ls,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[ue,de,ne,ie,re,ae,fe,me],validOperators:[ue,de,ne,ie,re,ae,fe,me]}};const ps=window.wp.date;var hs={sort:function(e,t,n){const i=new Date(e).getTime(),r=new Date(t).getTime();return"asc"===n?i-r:r-i},Edit:"date",isValid:{elements:!0,custom:()=>null},render:({item:e,field:t})=>{if(t.hasElements)return(0,c.jsx)(ls,{item:e,field:t});const n=t.getValue({item:e});return n?(i=n,(0,ps.dateI18n)((0,ps.getSettings)().formats.date,(0,ps.getDate)(i))):"";var i},enableSorting:!0,filterBy:{defaultOperators:[ue,de,ne,ie,re,ae,fe,me,ce],validOperators:[ue,de,ne,ie,re,ae,fe,me,ce]}},gs={sort:function(e,t,n){const i=Boolean(e);return i===Boolean(t)?0:"asc"===n?i?1:-1:i?-1:1},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||[!0,!1].includes(n)?null:(0,b.__)("Value must be true, false, or undefined")}},Edit:"checkbox",render:({item:e,field:t})=>t.hasElements?(0,c.jsx)(ls,{item:e,field:t}):!0===t.getValue({item:e})?(0,b.__)("True"):!1===t.getValue({item:e})?(0,b.__)("False"):null,enableSorting:!0,filterBy:{defaultOperators:[G,K],validOperators:[G,K]}},bs={sort:function(){return 0},isValid:{elements:!0,custom:()=>null},Edit:null,render:()=>null,enableSorting:!1,filterBy:!1};const ws={sort:function(e,t,n){const i=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(i.length!==r.length)return"asc"===n?i.length-r.length:r.length-i.length;const a=i.join(","),s=r.join(",");return"asc"===n?a.localeCompare(s):s.localeCompare(a)},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||Array.isArray(n)?n.every(e=>"string"==typeof e)?null:(0,b.__)("Every value must be a string."):(0,b.__)("Value must be an array.")}},Edit:"array",render:function({item:e,field:t}){return(t.getValue({item:e})||[]).join(", ")},enableSorting:!0,filterBy:{defaultOperators:[U,Y],validOperators:[U,Y,Z,X]}};var xs=ws,ys={sort:function(e,t,n){return 0},isValid:{elements:!0,custom:()=>null},Edit:"password",render:({item:e,field:t})=>t.hasElements?(0,c.jsx)(ls,{item:e,field:t}):"••••••••",enableSorting:!1,filterBy:!1},_s={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:()=>null},Edit:"telephone",render:({item:e,field:t})=>t.hasElements?(0,c.jsx)(ls,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[U,Y],validOperators:[G,K,se,oe,le,U,Y,Z,X]}},js={grad:.9,turn:360,rad:360/(2*Math.PI)},Cs=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},Ss=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},ks=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},Is=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Vs=function(e){return{r:ks(e.r,0,255),g:ks(e.g,0,255),b:ks(e.b,0,255),a:ks(e.a)}},Es=function(e){return{r:Ss(e.r),g:Ss(e.g),b:Ss(e.b),a:Ss(e.a,3)}},Ns=/^#([0-9a-f]{3,8})$/i,Fs=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Ms=function(e){var t=e.r,n=e.g,i=e.b,r=e.a,a=Math.max(t,n,i),s=a-Math.min(t,n,i),o=s?a===t?(n-i)/s:a===n?2+(i-t)/s:4+(t-n)/s:0;return{h:60*(o<0?o+6:o),s:a?s/a*100:0,v:a/255*100,a:r}},Os=function(e){var t=e.h,n=e.s,i=e.v,r=e.a;t=t/360*6,n/=100,i/=100;var a=Math.floor(t),s=i*(1-n),o=i*(1-(t-a)*n),l=i*(1-(1-t+a)*n),c=a%6;return{r:255*[i,o,s,s,l,i][c],g:255*[l,i,i,o,s,s][c],b:255*[s,s,l,i,i,o][c],a:r}},Ls=function(e){return{h:Is(e.h),s:ks(e.s,0,100),l:ks(e.l,0,100),a:ks(e.a)}},Ps=function(e){return{h:Ss(e.h),s:Ss(e.s),l:Ss(e.l),a:Ss(e.a,3)}},As=function(e){return Os((n=(t=e).s,{h:t.h,s:(n*=((i=t.l)<50?i:100-i)/100)>0?2*n/(i+n)*100:0,v:i+n,a:t.a}));var t,n,i},Ds=function(e){return{h:(t=Ms(e)).h,s:(r=(200-(n=t.s))*(i=t.v)/100)>0&&r<200?n*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,n,i,r},Ts=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bs=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,zs=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Hs=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Rs={string:[[function(e){var t=Ns.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?Ss(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?Ss(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=zs.exec(e)||Hs.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Vs({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=Ts.exec(e)||Bs.exec(e);if(!t)return null;var n,i,r=Ls({h:(n=t[1],i=t[2],void 0===i&&(i="deg"),Number(n)*(js[i]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return As(r)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,i=e.b,r=e.a,a=void 0===r?1:r;return Cs(t)&&Cs(n)&&Cs(i)?Vs({r:Number(t),g:Number(n),b:Number(i),a:Number(a)}):null},"rgb"],[function(e){var t=e.h,n=e.s,i=e.l,r=e.a,a=void 0===r?1:r;if(!Cs(t)||!Cs(n)||!Cs(i))return null;var s=Ls({h:Number(t),s:Number(n),l:Number(i),a:Number(a)});return As(s)},"hsl"],[function(e){var t=e.h,n=e.s,i=e.v,r=e.a,a=void 0===r?1:r;if(!Cs(t)||!Cs(n)||!Cs(i))return null;var s=function(e){return{h:Is(e.h),s:ks(e.s,0,100),v:ks(e.v,0,100),a:ks(e.a)}}({h:Number(t),s:Number(n),v:Number(i),a:Number(a)});return Os(s)},"hsv"]]},Ws=function(e,t){for(var n=0;n=.5},e.prototype.toHex=function(){return t=(e=Es(this.rgba)).r,n=e.g,i=e.b,a=(r=e.a)<1?Fs(Ss(255*r)):"","#"+Fs(t)+Fs(n)+Fs(i)+a;var e,t,n,i,r,a},e.prototype.toRgb=function(){return Es(this.rgba)},e.prototype.toRgbString=function(){return t=(e=Es(this.rgba)).r,n=e.g,i=e.b,(r=e.a)<1?"rgba("+t+", "+n+", "+i+", "+r+")":"rgb("+t+", "+n+", "+i+")";var e,t,n,i,r},e.prototype.toHsl=function(){return Ps(Ds(this.rgba))},e.prototype.toHslString=function(){return t=(e=Ps(Ds(this.rgba))).h,n=e.s,i=e.l,(r=e.a)<1?"hsla("+t+", "+n+"%, "+i+"%, "+r+")":"hsl("+t+", "+n+"%, "+i+"%)";var e,t,n,i,r},e.prototype.toHsv=function(){return e=Ms(this.rgba),{h:Ss(e.h),s:Ss(e.s),v:Ss(e.v),a:Ss(e.a,3)};var e},e.prototype.invert=function(){return Us({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Us($s(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Us($s(this.rgba,-e))},e.prototype.grayscale=function(){return Us($s(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Us(Gs(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Us(Gs(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Us({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Ss(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=Ds(this.rgba);return"number"==typeof e?Us({h:e,s:t.s,l:t.l,a:t.a}):Ss(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Us(e).toHex()},e}(),Us=function(e){return e instanceof Ks?e:new Ks(e)},Ys={sort:function(e,t,n){const i=Us(e),r=Us(t);if(!i.isValid()&&!r.isValid())return 0;if(!i.isValid())return"asc"===n?1:-1;if(!r.isValid())return"asc"===n?-1:1;const a=i.toHsl(),s=r.toHsl();return a.h!==s.h?"asc"===n?a.h-s.h:s.h-a.h:a.s!==s.s?"asc"===n?a.s-s.s:s.s-a.s:"asc"===n?a.l-s.l:s.l-a.l},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||Us(n).isValid()?null:(0,b.__)("Value must be a valid color.")}},Edit:"color",render:({item:e,field:t})=>{if(t.hasElements)return(0,c.jsx)(ls,{item:e,field:t});const n=t.getValue({item:e});return n&&Us(n).isValid()?(0,c.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,c.jsx)("div",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:n,border:"1px solid #ddd",flexShrink:0}}),(0,c.jsx)("span",{children:n})]}):n},enableSorting:!0,filterBy:{defaultOperators:[U,Y],validOperators:[G,K]}},Zs={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:()=>null},Edit:"url",render:({item:e,field:t})=>t.hasElements?(0,c.jsx)(ls,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[U,Y],validOperators:[G,K,se,oe,le,U,Y,Z,X]}};function Xs(e,t){let n;return e?.required&&t?.required?n=t?.required?.message?t.required:void 0:e?.elements&&t?.elements?n=t.elements:t?.custom&&(n=t.custom),n}const{ValidatedCheckboxControl:Qs}=Le(s.privateApis);Math.pow(10,8);const Js=6048e5,eo=Symbol.for("constructDateFrom");function to(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&eo in e?e[eo](t):e instanceof Date?new e.constructor(t):new Date(t)}function no(e,t){return to(t||e,e)}function io(e){return!(!((t=e)instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))&&"number"!=typeof e||isNaN(+no(e)));var t}const ro={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function ao(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const so={date:ao({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:ao({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:ao({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},oo={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function lo(e){return(t,n)=>{let i;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{const t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}return i[e.argumentCallback?e.argumentCallback(t):t]}}function co(e){return(t,n={})=>{const i=n.width,r=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],a=t.match(r);if(!a)return null;const s=a[0],o=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(o)?function(e,t){for(let n=0;ne.test(s)):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}(o,e=>e.test(s));let c;return c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c,{value:c,rest:t.slice(s.length)}}}var uo;const fo={code:"en-US",formatDistance:(e,t,n)=>{let i;const r=ro[e];return i="string"==typeof r?r:1===t?r.one:r.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i},formatLong:so,formatRelative:(e,t,n,i)=>oo[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:lo({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:lo({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:lo({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:lo({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:lo({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(uo={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(uo.matchPattern);if(!n)return null;const i=n[0],r=e.match(uo.parsePattern);if(!r)return null;let a=uo.valueCallback?uo.valueCallback(r[0]):r[0];return a=t.valueCallback?t.valueCallback(a):a,{value:a,rest:e.slice(i.length)}}),era:co({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:co({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:co({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:co({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:co({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};let mo={};function vo(){return mo}function po(e){const t=no(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function ho(e,t){const n=no(e,t?.in);return n.setHours(0,0,0,0),n}function go(e,t){const n=no(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function bo(e,t){const n=no(e,t?.in);return function(e,t,n){const[i,r]=function(e,...t){const n=to.bind(null,e||t.find(e=>"object"==typeof e));return t.map(n)}(n?.in,e,t),a=ho(i),s=ho(r),o=+a-po(a),l=+s-po(s);return Math.round((o-l)/864e5)}(n,go(n))+1}function wo(e,t){const n=vo(),i=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=no(e,t?.in),a=r.getDay(),s=(a=a.getTime()?i+1:n.getTime()>=o.getTime()?i:i-1}function _o(e,t){const n=no(e,t?.in),i=+xo(n)-+function(e,t){const n=yo(e,t),i=to(t?.in||e,0);return i.setFullYear(n,0,4),i.setHours(0,0,0,0),xo(i)}(n);return Math.round(i/Js)+1}function jo(e,t){const n=no(e,t?.in),i=n.getFullYear(),r=vo(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=to(t?.in||e,0);s.setFullYear(i+1,0,a),s.setHours(0,0,0,0);const o=wo(s,t),l=to(t?.in||e,0);l.setFullYear(i,0,a),l.setHours(0,0,0,0);const c=wo(l,t);return+n>=+o?i+1:+n>=+c?i:i-1}function Co(e,t){const n=no(e,t?.in),i=+wo(n,t)-+function(e,t){const n=vo(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=jo(e,t),a=to(t?.in||e,0);return a.setFullYear(r,0,i),a.setHours(0,0,0,0),wo(a,t)}(n,t);return Math.round(i/Js)+1}function So(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const ko={y(e,t){const n=e.getFullYear(),i=n>0?n:1-n;return So("yy"===t?i%100:i,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):So(n+1,2)},d:(e,t)=>So(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>So(e.getHours()%12||12,t.length),H:(e,t)=>So(e.getHours(),t.length),m:(e,t)=>So(e.getMinutes(),t.length),s:(e,t)=>So(e.getSeconds(),t.length),S(e,t){const n=t.length,i=e.getMilliseconds();return So(Math.trunc(i*Math.pow(10,n-3)),t.length)}},Io={G:function(e,t,n){const i=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});default:return n.era(i,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),i=t>0?t:1-t;return n.ordinalNumber(i,{unit:"year"})}return ko.y(e,t)},Y:function(e,t,n,i){const r=jo(e,i),a=r>0?r:1-r;return"YY"===t?So(a%100,2):"Yo"===t?n.ordinalNumber(a,{unit:"year"}):So(a,t.length)},R:function(e,t){return So(yo(e),t.length)},u:function(e,t){return So(e.getFullYear(),t.length)},Q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return So(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});default:return n.quarter(i,{width:"wide",context:"formatting"})}},q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return So(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});default:return n.quarter(i,{width:"wide",context:"standalone"})}},M:function(e,t,n){const i=e.getMonth();switch(t){case"M":case"MM":return ko.M(e,t);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});default:return n.month(i,{width:"wide",context:"formatting"})}},L:function(e,t,n){const i=e.getMonth();switch(t){case"L":return String(i+1);case"LL":return So(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});default:return n.month(i,{width:"wide",context:"standalone"})}},w:function(e,t,n,i){const r=Co(e,i);return"wo"===t?n.ordinalNumber(r,{unit:"week"}):So(r,t.length)},I:function(e,t,n){const i=_o(e);return"Io"===t?n.ordinalNumber(i,{unit:"week"}):So(i,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):ko.d(e,t)},D:function(e,t,n){const i=bo(e);return"Do"===t?n.ordinalNumber(i,{unit:"dayOfYear"}):So(i,t.length)},E:function(e,t,n){const i=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},e:function(e,t,n,i){const r=e.getDay(),a=(r-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return So(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,n,i){const r=e.getDay(),a=(r-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return So(a,t.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){const i=e.getDay(),r=0===i?7:i;switch(t){case"i":return String(r);case"ii":return So(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const i=e.getHours();let r;switch(r=12===i?"noon":0===i?"midnight":i/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){const i=e.getHours();let r;switch(r=i>=17?"evening":i>=12?"afternoon":i>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return ko.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):ko.H(e,t)},K:function(e,t,n){const i=e.getHours()%12;return"Ko"===t?n.ordinalNumber(i,{unit:"hour"}):So(i,t.length)},k:function(e,t,n){let i=e.getHours();return 0===i&&(i=24),"ko"===t?n.ordinalNumber(i,{unit:"hour"}):So(i,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):ko.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):ko.s(e,t)},S:function(e,t){return ko.S(e,t)},X:function(e,t,n){const i=e.getTimezoneOffset();if(0===i)return"Z";switch(t){case"X":return Eo(i);case"XXXX":case"XX":return No(i);default:return No(i,":")}},x:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"x":return Eo(i);case"xxxx":case"xx":return No(i);default:return No(i,":")}},O:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Vo(i,":");default:return"GMT"+No(i,":")}},z:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Vo(i,":");default:return"GMT"+No(i,":")}},t:function(e,t,n){return So(Math.trunc(+e/1e3),t.length)},T:function(e,t,n){return So(+e,t.length)}};function Vo(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),r=Math.trunc(i/60),a=i%60;return 0===a?n+String(r):n+String(r)+t+So(a,2)}function Eo(e,t){return e%60==0?(e>0?"-":"+")+So(Math.abs(e)/60,2):No(e,t)}function No(e,t=""){const n=e>0?"-":"+",i=Math.abs(e);return n+So(Math.trunc(i/60),2)+t+So(i%60,2)}const Fo=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Mo=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Oo={p:Mo,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],i=n[1],r=n[2];if(!r)return Fo(e,t);let a;switch(i){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;default:a=t.dateTime({width:"full"})}return a.replace("{{date}}",Fo(i,t)).replace("{{time}}",Mo(r,t))}},Lo=/^D+$/,Po=/^Y+$/,Ao=["D","DD","YY","YYYY"],Do=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,To=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bo=/^'([^]*?)'?$/,zo=/''/g,Ho=/[a-zA-Z]/;function Ro(e,t,n){const i=vo(),r=n?.locale??i.locale??fo,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,o=no(e,n?.in);if(!io(o))throw new RangeError("Invalid time value");let l=t.match(To).map(e=>{const t=e[0];return"p"===t||"P"===t?(0,Oo[t])(e,r.formatLong):e}).join("").match(Do).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Wo(e)};if(Io[t])return{isToken:!0,value:e};if(t.match(Ho))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});r.localize.preprocessor&&(l=r.localize.preprocessor(o,l));const c={firstWeekContainsDate:a,weekStartsOn:s,locale:r};return l.map(i=>{if(!i.isToken)return i.value;const a=i.value;return(!n?.useAdditionalWeekYearTokens&&function(e){return Po.test(e)}(a)||!n?.useAdditionalDayOfYearTokens&&function(e){return Lo.test(e)}(a))&&function(e,t,n){const i=function(e,t,n){const i="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${i} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(i),Ao.includes(e))throw new RangeError(i)}(a,t,String(e)),(0,Io[a[0]])(o,a,r.localize,c)}).join("")}function Wo(e){const t=e.match(Bo);return t?t[1].replace(zo,"'"):e}const $o={[fe]:[{value:"days",label:(0,b.__)("Days")},{value:"weeks",label:(0,b.__)("Weeks")},{value:"months",label:(0,b.__)("Months")},{value:"years",label:(0,b.__)("Years")}],[me]:[{value:"days",label:(0,b.__)("Days ago")},{value:"weeks",label:(0,b.__)("Weeks ago")},{value:"months",label:(0,b.__)("Months ago")},{value:"years",label:(0,b.__)("Years ago")}]};function qo({className:e,data:t,field:n,onChange:i,hideLabelFromVision:r,operator:o}){const l=$o[o===fe?"inThePast":"over"],{id:u,label:d,getValue:f,setValue:m}=n,v=f({item:t}),{value:p="",unit:h=l[0].value}=v&&"object"==typeof v?v:{},g=(0,a.useCallback)(e=>i(m({item:t,value:{value:Number(e),unit:h}})),[i,m,t,h]),w=(0,a.useCallback)(e=>i(m({item:t,value:{value:p,unit:e}})),[i,m,t,p]);return(0,c.jsx)(s.BaseControl,{id:u,__nextHasNoMarginBottom:!0,className:k(e,"dataviews-controls__relative-date"),label:d,hideLabelFromVision:r,children:(0,c.jsxs)(s.__experimentalHStack,{spacing:2.5,children:[(0,c.jsx)(s.__experimentalNumberControl,{__next40pxDefaultSize:!0,className:"dataviews-controls__relative-date-number",spinControls:"none",min:1,step:1,value:p,onChange:g}),(0,c.jsx)(s.SelectControl,{className:"dataviews-controls__relative-date-unit",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,b.__)("Unit"),value:h,options:l,onChange:w,hideLabelFromVision:!0})]})})}const{DateCalendar:Go,ValidatedInputControl:Ko}=Le(s.privateApis),Uo=e=>{if(!e)return null;const t=(0,ps.getDate)(e);return t&&io(t)?t:null};function Yo({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){const{id:o,label:l,description:u,setValue:d,getValue:f,isValid:m}=t,v=f({item:e}),p="string"==typeof v?v:void 0,[h,g]=(0,a.useState)(()=>Uo(p)||new Date),w=(0,a.useRef)(null),x=(0,a.useRef)(),y=(0,a.useRef)(null),_=(0,a.useCallback)(t=>n(d({item:e,value:t})),[e,n,d]);(0,a.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);const j=(0,a.useCallback)(e=>{let t;if(e){let n=e;if(p){const t=Uo(p);t&&(n=new Date(e),n.setHours(t.getHours()),n.setMinutes(t.getMinutes()))}t=n.toISOString(),_(t),x.current&&clearTimeout(x.current)}else _(void 0);y.current=w.current&&w.current.ownerDocument.activeElement,x.current=setTimeout(()=>{w.current&&(w.current.focus(),w.current.blur(),_(t),y.current&&y.current instanceof HTMLElement&&y.current.focus())},0)},[_,p]),C=(0,a.useCallback)(e=>{if(e){const t=new Date(e);_(t.toISOString());const n=Uo(t.toISOString());n&&g(n)}else _(void 0)},[_]),{timezone:{string:S},l10n:{startOfWeek:k}}=(0,ps.getSettings)(),I=m?.required&&!i?`${l} (${(0,b.__)("Required")})`:l;return(0,c.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,id:o,label:I,help:u,hideLabelFromVision:i,children:(0,c.jsxs)(s.__experimentalVStack,{spacing:4,children:[(0,c.jsx)(Go,{style:{width:"100%"},selected:p&&Uo(p)||void 0,onSelect:j,month:h,onMonthChange:g,timeZone:S||void 0,weekStartsOn:k}),(0,c.jsx)(Ko,{ref:w,__next40pxDefaultSize:!0,required:!!m?.required,customValidity:Xs(m,r),type:"datetime-local",label:(0,b.__)("Date time"),hideLabelFromVision:!0,value:p?(V=Uo(p)||void 0,V?"string"==typeof V?V:Ro(V,"yyyy-MM-dd'T'HH:mm"):""):"",onChange:C})]})});var V}function Zo(e,t,n){return function(e,t,n){const i=no(e,n?.in);return isNaN(t)?to(n?.in||e,NaN):t?(i.setDate(i.getDate()+t),i):i}(e,-t,n)}function Xo(e,t,n){const i=no(e,n?.in);if(isNaN(t))return to(n?.in||e,NaN);if(!t)return i;const r=i.getDate(),a=to(n?.in||e,i.getTime());return a.setMonth(i.getMonth()+t+1,0),r>=a.getDate()?a:(i.setFullYear(a.getFullYear(),a.getMonth(),r),i)}function Qo(e,t){const n=no(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Jo(e,t,n){return function(e,t,n){return Xo(e,12*t,n)}(e,-t,n)}var el=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z"})});const{DateCalendar:tl,DateRangeCalendar:nl}=Le(s.privateApis),il=[{id:"today",label:(0,b.__)("Today"),getValue:()=>(0,ps.getDate)(null)},{id:"yesterday",label:(0,b.__)("Yesterday"),getValue:()=>Zo((0,ps.getDate)(null),1)},{id:"past-week",label:(0,b.__)("Past week"),getValue:()=>Zo((0,ps.getDate)(null),7)},{id:"past-month",label:(0,b.__)("Past month"),getValue:()=>{return Xo((0,ps.getDate)(null),-1,e);var e}}],rl=[{id:"last-7-days",label:(0,b.__)("Last 7 days"),getValue:()=>{const e=(0,ps.getDate)(null);return[Zo(e,7),e]}},{id:"last-30-days",label:(0,b.__)("Last 30 days"),getValue:()=>{const e=(0,ps.getDate)(null);return[Zo(e,30),e]}},{id:"month-to-date",label:(0,b.__)("Month to date"),getValue:()=>{const e=(0,ps.getDate)(null);return[Qo(e),e]}},{id:"last-year",label:(0,b.__)("Last year"),getValue:()=>{const e=(0,ps.getDate)(null);return[Jo(e,1),e]}},{id:"year-to-date",label:(0,b.__)("Year to date"),getValue:()=>{const e=(0,ps.getDate)(null);return[go(e),e]}}],al=e=>{if(!e)return null;const t=(0,ps.getDate)(e);return t&&io(t)?t:null},sl=e=>e?"string"==typeof e?e:Ro(e,"yyyy-MM-dd"):"";function ol({field:e,validity:t,inputRefs:n,isTouched:i,setIsTouched:r,children:o}){const{isValid:l}=e,[u,d]=(0,a.useState)(void 0),f=(0,a.useCallback)(()=>{const e=Array.isArray(n)?n:[n];for(const t of e){const e=t.current;if(e&&!e.validity.valid)return void d({type:"invalid",message:e.validationMessage})}d(void 0)},[n]);return(0,a.useEffect)(()=>{if(i){const e=setTimeout(()=>{t?d(Xs(l,t)):f()},0);return()=>clearTimeout(e)}},[i,l,t,f]),(0,c.jsxs)("div",{onBlur:e=>{i||e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||r(!0)},children:[o,(0,c.jsx)("div",{"aria-live":"polite",children:u&&(0,c.jsxs)("p",{className:k("components-validated-control__indicator","invalid"===u.type?"is-invalid":void 0,"valid"===u.type?"is-valid":void 0),children:[(0,c.jsx)(s.Icon,{className:"components-validated-control__indicator-icon",icon:el,size:16,fill:"currentColor"}),u.message]})})]})}function ll({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){const{id:o,label:l,setValue:u,getValue:d,isValid:f}=t,[m,v]=(0,a.useState)(null),p=d({item:e}),h="string"==typeof p?p:void 0,[g,w]=(0,a.useState)(()=>al(h)||new Date),[x,y]=(0,a.useState)(!1),_=(0,a.useRef)(null),j=(0,a.useCallback)(t=>n(u({item:e,value:t})),[e,n,u]),C=(0,a.useCallback)(e=>{const t=e?Ro(e,"yyyy-MM-dd"):void 0;j(t),v(null),y(!0)},[j]),S=(0,a.useCallback)(e=>{const t=e.getValue(),n=sl(t);w(t),j(n),v(e.id),y(!0)},[j]),k=(0,a.useCallback)(e=>{if(j(e),e){const t=al(e);t&&w(t)}v(null),y(!0)},[j]),{timezone:{string:I},l10n:{startOfWeek:V}}=(0,ps.getSettings)(),E=f?.required?`${l} (${(0,b.__)("Required")})`:l;return(0,c.jsx)(ol,{field:t,validity:r,inputRefs:_,isTouched:x,setIsTouched:y,children:(0,c.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,id:o,className:"dataviews-controls__date",label:E,hideLabelFromVision:i,children:(0,c.jsxs)(s.__experimentalVStack,{spacing:4,children:[(0,c.jsxs)(s.__experimentalHStack,{spacing:2,wrap:!0,justify:"flex-start",children:[il.map(e=>{const t=m===e.id;return(0,c.jsx)(s.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:t,size:"small",onClick:()=>S(e),children:e.label},e.id)}),(0,c.jsx)(s.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:!m,size:"small",disabled:!!m,accessibleWhenDisabled:!1,children:(0,b.__)("Custom")})]}),(0,c.jsx)(s.__experimentalInputControl,{__next40pxDefaultSize:!0,ref:_,type:"date",label:(0,b.__)("Date"),hideLabelFromVision:!0,value:h,onChange:k,required:!!t.isValid?.required}),(0,c.jsx)(tl,{style:{width:"100%"},selected:h&&al(h)||void 0,onSelect:C,month:g,onMonthChange:w,timeZone:I||void 0,weekStartsOn:V})]})})})}function cl({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){const{id:o,label:l,getValue:u,setValue:d}=t;let f;const m=u({item:e});Array.isArray(m)&&2===m.length&&m.every(e=>"string"==typeof e)&&(f=m);const v=(0,a.useCallback)(t=>{n(d({item:e,value:t}))},[e,n,d]),[p,h]=(0,a.useState)(null),g=(0,a.useMemo)(()=>{if(!f)return{from:void 0,to:void 0};const[e,t]=f;return{from:al(e)||void 0,to:al(t)||void 0}},[f]),[w,x]=(0,a.useState)(()=>g.from||new Date),[y,_]=(0,a.useState)(!1),j=(0,a.useRef)(null),C=(0,a.useRef)(null),S=(0,a.useCallback)((e,t)=>{e&&t?v([sl(e),sl(t)]):e||t||v(void 0)},[v]),k=(0,a.useCallback)(e=>{S(e?.from,e?.to),h(null),_(!0)},[S]),I=(0,a.useCallback)(e=>{const[t,n]=e.getValue();x(t),S(t,n),h(e.id),_(!0)},[S]),V=(0,a.useCallback)((e,t)=>{const[n,i]=f||[void 0,void 0];if(S("from"===e?t:n,"to"===e?t:i),t){const e=al(t);e&&x(e)}h(null),_(!0)},[f,S]),{timezone:E,l10n:N}=(0,ps.getSettings)(),F=t.isValid?.required?`${l} (${(0,b.__)("Required")})`:l;return(0,c.jsx)(ol,{field:t,validity:r,inputRefs:[j,C],isTouched:y,setIsTouched:_,children:(0,c.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,id:o,className:"dataviews-controls__date",label:F,hideLabelFromVision:i,children:(0,c.jsxs)(s.__experimentalVStack,{spacing:4,children:[(0,c.jsxs)(s.__experimentalHStack,{spacing:2,wrap:!0,justify:"flex-start",children:[rl.map(e=>{const t=p===e.id;return(0,c.jsx)(s.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:t,size:"small",onClick:()=>I(e),children:e.label},e.id)}),(0,c.jsx)(s.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:!p,size:"small",accessibleWhenDisabled:!1,disabled:!!p,children:(0,b.__)("Custom")})]}),(0,c.jsxs)(s.__experimentalHStack,{spacing:2,children:[(0,c.jsx)(s.__experimentalInputControl,{__next40pxDefaultSize:!0,ref:j,type:"date",label:(0,b.__)("From"),hideLabelFromVision:!0,value:f?.[0],onChange:e=>V("from",e),required:!!t.isValid?.required}),(0,c.jsx)(s.__experimentalInputControl,{__next40pxDefaultSize:!0,ref:C,type:"date",label:(0,b.__)("To"),hideLabelFromVision:!0,value:f?.[1],onChange:e=>V("to",e),required:!!t.isValid?.required})]}),(0,c.jsx)(nl,{style:{width:"100%"},selected:g,onSelect:k,month:w,onMonthChange:x,timeZone:E.string||void 0,weekStartsOn:N.startOfWeek})]})})})}var ul=(0,c.jsx)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,c.jsx)(u.Path,{d:"M12.5939 21C14.1472 21 16.1269 20.5701 17.0711 20.1975L16.6447 18.879C16.0964 19.051 14.3299 19.6242 12.6548 19.6242C7.4467 19.6242 4.67513 16.8726 4.67513 12C4.67513 7.21338 7.50762 4.34713 12.2893 4.34713C17.132 4.34713 19.4162 7.55732 19.4162 10.7675C19.4162 14.035 19.0508 15.4968 17.4975 15.4968C16.5838 15.4968 16.0964 14.7803 16.0964 13.9777V7.5H14.4822V8.30255H14.3909C14.1777 7.67198 12.9898 7.12739 11.467 7.2707C9.18274 7.5 7.4467 9.27707 7.4467 11.8567C7.4467 14.5796 8.81726 16.672 11.467 16.758C13.203 16.8153 14.1168 16.0127 14.4822 15.1815H14.5736C14.7563 16.414 16.401 16.8439 17.467 16.8439C20.6954 16.8439 21 13.5764 21 10.7962C21 6.86943 18.0761 3 12.3807 3C6.50254 3 3 6.3535 3 11.9427C3 17.7325 6.38071 21 12.5939 21ZM11.7107 15.2962C9.73096 15.2962 9.03046 13.6051 9.03046 11.7707C9.03046 10.1083 10.0355 8.67516 11.7716 8.67516C13.599 8.67516 14.5736 9.36306 14.5736 11.7707C14.5736 14.1497 13.7513 15.2962 11.7107 15.2962Z"})});const{ValidatedInputControl:dl}=Le(s.privateApis);function fl({data:e,field:t,onChange:n,hideLabelFromVision:i,type:r,prefix:s,suffix:o,validity:l}){const{label:u,placeholder:d,description:f,getValue:m,setValue:v,isValid:p}=t,h=m({item:e}),g=(0,a.useCallback)(t=>n(v({item:e,value:t})),[e,v,n]);return(0,c.jsx)(dl,{required:!!p?.required,customValidity:Xs(p,l),label:u,placeholder:d,value:h??"",help:f,onChange:g,hideLabelFromVision:i,type:r,prefix:s,suffix:o,__next40pxDefaultSize:!0})}var ml=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z"})}),vl=(0,c.jsx)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,c.jsx)(u.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})});const{ValidatedNumberControl:pl}=Le(s.privateApis);function hl(e){if(""===e||void 0===e)return"";const t=Number(e);return Number.isFinite(t)?t:""}function gl({value:e,onChange:t,hideLabelFromVision:n,step:i}){const[r="",o=""]=e,l=(0,a.useCallback)(e=>t([hl(e),o]),[t,o]),u=(0,a.useCallback)(e=>t([r,hl(e)]),[t,r]);return(0,c.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,help:(0,b.__)("The max. value must be greater than the min. value."),children:(0,c.jsxs)(s.Flex,{direction:"row",gap:4,children:[(0,c.jsx)(s.__experimentalNumberControl,{label:(0,b.__)("Min."),value:r,max:o?Number(o)-i:void 0,onChange:l,__next40pxDefaultSize:!0,hideLabelFromVision:n,step:i}),(0,c.jsx)(s.__experimentalNumberControl,{label:(0,b.__)("Max."),value:o,min:r?Number(r)+i:void 0,onChange:u,__next40pxDefaultSize:!0,hideLabelFromVision:n,step:i})]})})}function bl({data:e,field:t,onChange:n,hideLabelFromVision:i,operator:r,decimals:s,validity:o}){const l=Math.pow(10,-1*Math.abs(s)),{label:u,description:d,getValue:f,setValue:m,isValid:v}=t,p=f({item:e})??"",h=(0,a.useCallback)(t=>{n(m({item:e,value:["",void 0].includes(t)?void 0:Number(t)}))},[e,n,m]),g=(0,a.useCallback)(t=>{n(m({item:e,value:t}))},[e,n,m]);if(r===ce){let e=["",""];return Array.isArray(p)&&2===p.length&&p.every(e=>"number"==typeof e||""===e)&&(e=p),(0,c.jsx)(gl,{value:e,onChange:g,hideLabelFromVision:i,step:l})}return(0,c.jsx)(pl,{required:!!v?.required,customValidity:Xs(v,o),label:u,help:d,value:p,onChange:h,__next40pxDefaultSize:!0,hideLabelFromVision:i,step:l})}const{ValidatedRadioControl:wl}=Le(s.privateApis),{ValidatedSelectControl:xl}=Le(s.privateApis),{ValidatedToggleControl:yl}=Le(s.privateApis),{ValidatedTextareaControl:_l}=Le(s.privateApis),{ValidatedToggleGroupControl:jl}=Le(s.privateApis),{ValidatedFormTokenField:Cl}=Le(s.privateApis),{ValidatedInputControl:Sl,Picker:kl}=Le(s.privateApis),Il=({color:e,onColorChange:t})=>{const n=e&&Us(e).isValid()?e:"#ffffff";return(0,c.jsx)(s.Dropdown,{renderToggle:({onToggle:e,isOpen:t})=>(0,c.jsx)(s.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,c.jsx)("button",{type:"button",onClick:e,style:{width:"24px",height:"24px",borderRadius:"50%",backgroundColor:n,border:"1px solid #ddd",cursor:"pointer",outline:t?"2px solid #007cba":"none",outlineOffset:"2px",display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0},"aria-label":"Open color picker"})}),renderContent:()=>(0,c.jsx)("div",{style:{padding:"16px"},children:(0,c.jsx)(kl,{color:Us(n),onChange:t,enableAlpha:!0})})})};function Vl(e){return Array.isArray(e.elements)&&e.elements.length>0||"function"==typeof e.getElements}const El={array:function({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){const{label:o,placeholder:l,getValue:u,setValue:d,isValid:f}=t,m=u({item:e}),{elements:v,isLoading:p}=ua({elements:t.elements,getElements:t.getElements}),h=(0,a.useMemo)(()=>Array.isArray(m)?m.map(e=>{const t=v?.find(t=>t.value===e);return t||{value:e,label:e}}):[],[m,v]),g=(0,a.useCallback)(t=>{const i=t.map(e=>"object"==typeof e&&"value"in e?e.value:e);n(d({item:e,value:i}))},[n,d,e]);return p?(0,c.jsx)(s.Spinner,{}):(0,c.jsx)(Cl,{required:!!f?.required,customValidity:Xs(f,r),label:i?void 0:o,value:h,onChange:g,placeholder:l,suggestions:v?.map(e=>e.value),__experimentalValidateInput:e=>!t.isValid?.elements||!v||v.some(t=>t.value===e||t.label===e),__experimentalExpandOnFocus:v&&v.length>0,__experimentalShowHowTo:!t.isValid?.elements,displayTransform:e=>{if("object"==typeof e&&"label"in e)return e.label;if("string"==typeof e&&v){const t=v.find(t=>t.value===e);return t?.label||e}return e},__experimentalRenderItem:({item:e})=>{if("string"==typeof e&&v){const t=v.find(t=>t.value===e);return(0,c.jsx)("span",{children:t?.label||e})}return(0,c.jsx)("span",{children:e})}})},checkbox:function({field:e,onChange:t,data:n,hideLabelFromVision:i,validity:r}){const{getValue:s,setValue:o,label:l,description:u,isValid:d}=e,f=(0,a.useCallback)(()=>{t(o({item:n,value:!s({item:n})}))},[n,s,t,o]);return(0,c.jsx)(Qs,{required:!!e.isValid?.required,customValidity:Xs(d,r),hidden:i,label:l,help:u,checked:s({item:n}),onChange:f})},color:function({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){const{label:s,placeholder:o,description:l,setValue:u,isValid:d}=t,f=t.getValue({item:e})||"",m=(0,a.useCallback)(t=>{n(u({item:e,value:t.toHex()}))},[e,n,u]),v=(0,a.useCallback)(t=>{n(u({item:e,value:t||""}))},[e,n,u]);return(0,c.jsx)(Sl,{required:!!t.isValid?.required,customValidity:Xs(d,r),label:s,placeholder:o,value:f,help:l,onChange:v,hideLabelFromVision:i,type:"text",prefix:(0,c.jsx)(Il,{color:f,onColorChange:m})})},datetime:function({data:e,field:t,onChange:n,hideLabelFromVision:i,operator:r,validity:a}){return r===fe||r===me?(0,c.jsx)(qo,{className:"dataviews-controls__datetime",data:e,field:t,onChange:n,hideLabelFromVision:i,operator:r}):(0,c.jsx)(Yo,{data:e,field:t,onChange:n,hideLabelFromVision:i,validity:a})},date:function({data:e,field:t,onChange:n,hideLabelFromVision:i,operator:r,validity:a}){return r===fe||r===me?(0,c.jsx)(qo,{className:"dataviews-controls__date",data:e,field:t,onChange:n,hideLabelFromVision:i,operator:r}):r===ce?(0,c.jsx)(cl,{data:e,field:t,onChange:n,hideLabelFromVision:i,validity:a}):(0,c.jsx)(ll,{data:e,field:t,onChange:n,hideLabelFromVision:i,validity:a})},email:function({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){return(0,c.jsx)(fl,{data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r,type:"email",prefix:(0,c.jsx)(s.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,c.jsx)(s.Icon,{icon:ul})})})},telephone:function({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){return(0,c.jsx)(fl,{data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r,type:"tel",prefix:(0,c.jsx)(s.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,c.jsx)(s.Icon,{icon:ml})})})},url:function({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){return(0,c.jsx)(fl,{data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r,type:"url",prefix:(0,c.jsx)(s.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,c.jsx)(s.Icon,{icon:vl})})})},integer:function(e){return(0,c.jsx)(bl,{...e,decimals:0})},number:function(e){return(0,c.jsx)(bl,{...e,decimals:2})},password:function({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){const[o,l]=(0,a.useState)(!1),u=(0,a.useCallback)(()=>{l(e=>!e)},[]);return(0,c.jsx)(fl,{data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r,type:o?"text":"password",suffix:(0,c.jsx)(s.__experimentalInputControlSuffixWrapper,{variant:"control",children:(0,c.jsx)(s.Button,{icon:o?rt:Ra,onClick:u,size:"small",label:o?(0,b.__)("Hide password"):(0,b.__)("Show password")})})})},radio:function({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){const{label:o,description:l,getValue:u,setValue:d,isValid:f}=t,{elements:m,isLoading:v}=ua({elements:t.elements,getElements:t.getElements}),p=u({item:e}),h=(0,a.useCallback)(t=>n(d({item:e,value:t})),[e,n,d]);return v?(0,c.jsx)(s.Spinner,{}):(0,c.jsx)(wl,{required:!!t.isValid?.required,customValidity:Xs(f,r),label:o,help:l,onChange:h,options:m,selected:p,hideLabelFromVision:i})},select:function({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){const{type:o,label:l,description:u,getValue:d,setValue:f,isValid:m}=t,v="array"===o,p=d({item:e})??(v?[]:""),h=(0,a.useCallback)(t=>n(f({item:e,value:t})),[e,n,f]),{elements:g,isLoading:b}=ua({elements:t.elements,getElements:t.getElements});return b?(0,c.jsx)(s.Spinner,{}):(0,c.jsx)(xl,{required:!!t.isValid?.required,customValidity:Xs(m,r),label:l,value:p,help:u,options:g,onChange:h,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:i,multiple:v})},text:function({data:e,field:t,onChange:n,hideLabelFromVision:i,config:r,validity:s}){const{prefix:o,suffix:l}=r||{};return(0,c.jsx)(fl,{data:e,field:t,onChange:n,hideLabelFromVision:i,validity:s,prefix:o?(0,a.createElement)(o):void 0,suffix:l?(0,a.createElement)(l):void 0})},toggle:function({field:e,onChange:t,data:n,hideLabelFromVision:i,validity:r}){const{label:s,description:o,getValue:l,setValue:u,isValid:d}=e,f=(0,a.useCallback)(()=>{t(u({item:n,value:!l({item:n})}))},[t,u,n,l]);return(0,c.jsx)(yl,{required:!!d.required,customValidity:Xs(d,r),hidden:i,__nextHasNoMarginBottom:!0,label:s,help:o,checked:l({item:n}),onChange:f})},textarea:function({data:e,field:t,onChange:n,hideLabelFromVision:i,config:r,validity:s}){const{rows:o=4}=r||{},{label:l,placeholder:u,description:d,setValue:f,isValid:m}=t,v=t.getValue({item:e}),p=(0,a.useCallback)(t=>n(f({item:e,value:t})),[e,n,f]);return(0,c.jsx)(_l,{required:!!m?.required,customValidity:Xs(m,s),label:l,placeholder:u,value:v??"",help:d,onChange:p,rows:o,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:i})},toggleGroup:function({data:e,field:t,onChange:n,hideLabelFromVision:i,validity:r}){const{getValue:o,setValue:l,isValid:u}=t,d=o({item:e}),f=(0,a.useCallback)(t=>n(l({item:e,value:t})),[e,n,l]),{elements:m,isLoading:v}=ua({elements:t.elements,getElements:t.getElements});if(v)return(0,c.jsx)(s.Spinner,{});if(0===m.length)return null;const p=m.find(e=>e.value===d);return(0,c.jsx)(jl,{required:!!t.isValid?.required,customValidity:Xs(u,r),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,isBlock:!0,label:t.label,help:p?.description||t.description,onChange:f,value:d,hideLabelFromVision:i,children:m.map(e=>(0,c.jsx)(s.__experimentalToggleGroupControlOption,{label:e.label,value:e.value},e.value))})}};function Nl(e){return e&&"object"==typeof e&&"string"==typeof e.control}function Fl(e){const{control:t,...n}=e,i=Ml(t);return function(e){return(0,c.jsx)(i,{...e,config:n})}}function Ml(e){if(Object.keys(El).includes(e))return El[e];throw"Control "+e+" not found"}const Ol=e=>e.id,Ll=()=>!0,Pl=[],Al=Vt.filter(e=>!e.isPicker);function Dl({header:e,search:t=!0,searchLabel:n}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(s.__experimentalHStack,{alignment:"top",justify:"space-between",className:"dataviews__view-actions",spacing:1,children:[(0,c.jsxs)(s.__experimentalHStack,{justify:"start",expanded:!1,className:"dataviews__search",children:[t&&(0,c.jsx)(Ta,{label:n}),(0,c.jsx)(Ot,{})]}),(0,c.jsxs)(s.__experimentalHStack,{spacing:1,expanded:!1,style:{flexShrink:0},children:[(0,c.jsx)(os,{}),e]})]}),(0,c.jsx)(Na,{className:"dataviews-filters__container"}),(0,c.jsx)(Fa,{}),(0,c.jsx)(Da,{})]})}const Tl=function({view:e,onChangeView:t,fields:n,search:i=!0,searchLabel:r,actions:s=Pl,data:o,getItemId:l=Ol,getItemLevel:u,isLoading:d=!1,paginationInfo:f,defaultLayouts:m,selection:v,onChangeSelection:p,onClickItem:h,renderItemLink:g,isItemClickable:b=Ll,header:w,children:x,config:y={perPageSizes:[10,20,50,100]},empty:_}){const{infiniteScrollHandler:j}=f,C=(0,a.useRef)(null),[S,k]=(0,a.useState)(0),I=(0,W.useResizeObserver)(e=>{k(e[0].borderBoxSize[0].inlineSize)},{box:"border-box"}),[V,E]=(0,a.useState)([]),N=void 0===v||void 0===p,F=N?V:v,[M,O]=(0,a.useState)(null),L=(0,a.useMemo)(()=>function(e){return e.map(e=>{const t="email"===(n=e.type)?us:"integer"===n?ds:"number"===n?fs:"text"===n?ms:"datetime"===n?vs:"date"===n?hs:"boolean"===n?gs:"media"===n?bs:"array"===n?xs:"password"===n?ys:"telephone"===n?_s:"color"===n?Ys:"url"===n?Zs:{sort:(e,t,n)=>"number"==typeof e&&"number"==typeof t?"asc"===n?e-t:t-e:"asc"===n?e.localeCompare(t):t.localeCompare(e),isValid:{elements:!0,custom:()=>null},Edit:null,render:({item:e,field:t})=>t.hasElements?(0,c.jsx)(ls,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[G,K],validOperators:ve}};var n;const i=e.getValue||(r=e.id,({item:e})=>{const t=r.split(".");let n=e;for(const e of t)n=n.hasOwnProperty(e)?n[e]:void 0;return n});var r;const a=e.setValue||(e=>({value:t})=>{const n=e.split("."),i={};let r=i;for(const e of n.slice(0,-1))r[e]={},r=r[e];return r[n.at(-1)]=t,i})(e.id),s=e.sort??function(e,n,r){return t.sort(i({item:e}),i({item:n}),r)},o={...t.isValid,...e.isValid},l=function(e,t){return"function"==typeof e.Edit?e.Edit:"string"==typeof e.Edit?Ml(e.Edit):Nl(e.Edit)?Fl(e.Edit):Vl(e)&&"array"!==e.type?Ml("select"):"string"==typeof t.Edit?Ml(t.Edit):Nl(t.Edit)?Fl(t.Edit):t.Edit}(e,t),u=e.render??function({item:e,field:n}){return t.render({item:e,field:n})},d=function(e,t){if(!1===e.filterBy)return!1;if("object"==typeof e.filterBy){let n=e.filterBy.operators;n&&Array.isArray(n)||(n=t.filterBy?t.filterBy.defaultOperators:[]);let i=ve;return"object"==typeof t.filterBy&&(i=t.filterBy.validOperators),n=n.filter(e=>i.includes(e)),Vl(e)&&n.includes(ce)&&(n=n.filter(e=>e!==ce)),n.some(e=>pe.includes(e))&&(n=n.filter(e=>[...pe,ce].includes(e))),0!==n.length&&{isPrimary:!!e.filterBy.isPrimary,operators:n}}if(!1===t.filterBy)return!1;let n=t.filterBy.defaultOperators;return Vl(e)&&n.includes(ce)&&(n=n.filter(e=>e!==ce)),{operators:n}}(e,t);return{...e,label:e.label||e.id,header:e.header||e.label||e.id,getValue:i,setValue:a,render:u,sort:s,isValid:o,Edit:l,hasElements:Vl(e),enableHiding:e.enableHiding??!0,enableSorting:e.enableSorting??t.enableSorting??!0,filterBy:d,readOnly:e.readOnly??t.readOnly??!1}})}(n),[n]),P=(0,a.useMemo)(()=>F.filter(e=>o.some(t=>l(t)===e)),[F,o,l]),A=Va(L,e),D=(0,a.useMemo)(()=>(A||[]).some(e=>e.isPrimary||e.isLocked),[A]),[T,B]=(0,a.useState)(D);(0,a.useEffect)(()=>{D&&!T&&B(!0)},[D,T]),(0,a.useEffect)(()=>{if(!e.infiniteScrollEnabled||!C.current)return;const t=(0,W.throttle)(e=>{const t=e.target,n=t.scrollTop,i=t.scrollHeight;n+t.clientHeight>=i-100&&j?.()},100),n=C.current;return n.addEventListener("scroll",t),()=>{n.removeEventListener("scroll",t),t.cancel()}},[j,e.infiniteScrollEnabled]);const z=(0,a.useMemo)(()=>Object.fromEntries(Object.entries(m).filter(([e])=>Al.some(t=>t.type===e))),[m]);return z[e.type]?(0,c.jsx)(Se.Provider,{value:{view:e,onChangeView:t,fields:L,actions:s,data:o,isLoading:d,paginationInfo:f,selection:P,onChangeSelection:function(e){const t="function"==typeof e?e(F):e;N&&E(t),p&&p(t)},openedFilter:M,setOpenedFilter:O,getItemId:l,getItemLevel:u,isItemClickable:b,onClickItem:h,renderItemLink:g,containerWidth:S,containerRef:C,resizeObserverRef:I,defaultLayouts:z,filters:A,isShowingFilter:T,setIsShowingFilter:B,config:y,empty:_,hasInfiniteScrollHandler:!!j},children:(0,c.jsx)("div",{className:"dataviews-wrapper",ref:C,children:x??(0,c.jsx)(Dl,{header:w,search:i,searchLabel:r})})}):null};Tl.BulkActionToolbar=et,Tl.Filters=Ea,Tl.FiltersToggled=Na,Tl.FiltersToggle=Ot,Tl.Layout=Fa,Tl.LayoutSwitcher=Ya,Tl.Pagination=La,Tl.Search=Ta,Tl.ViewConfig=as,Tl.Footer=Da;var Bl=Tl;function zl({onSelectItem:e}){const{items:t,isLoading:n}=H("followers"),[i,r]=(0,a.useState)({type:"table",perPage:20,page:1}),o=[{id:"name",label:"Name",enableSorting:!0,render:({item:t})=>(0,c.jsx)("button",{onClick:()=>e(t.id),style:{background:"none",border:"none",color:"var(--wpds-color-bg-interactive-brand, #3858e9)",cursor:"pointer",textAlign:"left"},children:t.name})},{id:"url",label:"URL",enableSorting:!1},{id:"followers",label:"Followers",enableSorting:!0}];return(0,c.jsx)(O,{title:"Followers",subTitle:"Manage and view your followers",hasPadding:!1,actions:(0,c.jsx)(s.Button,{variant:"primary",children:"Add Follower"}),children:(0,c.jsx)(Bl,{data:t||[],fields:o,view:i,onChangeView:r,isLoading:n,paginationInfo:{totalItems:t?.length||0,totalPages:1}})})}function Hl({onSelectItem:e}){return(0,c.jsx)(O,{title:"Following",subTitle:"Accounts you follow",hasPadding:!0,contentWidth:"constrained",children:(0,c.jsx)("p",{children:"Following list coming soon..."})})}function Rl({onSelectItem:e}){return(0,c.jsx)(O,{title:"Interactions",subTitle:"Your ActivityPub interactions",hasPadding:!0,contentWidth:"constrained",children:(0,c.jsx)("p",{children:"Interactions list coming soon..."})})}function Wl({id:e,onClose:t}){const{items:n,isLoading:i}=H("followers",e);return i?(0,c.jsx)("div",{children:"Loading..."}):n?(0,c.jsxs)(O,{title:n.name,hasPadding:!0,actions:(0,c.jsx)(s.Button,{size:"small",onClick:t,children:"Close"}),children:[(0,c.jsx)(s.Card,{children:(0,c.jsxs)(s.CardBody,{children:[(0,c.jsx)("h3",{children:"Overview"}),(0,c.jsxs)("p",{children:[(0,c.jsx)("strong",{children:"URL:"})," ",n.url]}),(0,c.jsxs)("p",{children:[(0,c.jsx)("strong",{children:"Followers:"})," ",n.followers]})]})}),(0,c.jsx)(s.Card,{children:(0,c.jsxs)(s.CardBody,{children:[(0,c.jsx)("h3",{children:"Recent Activity"}),(0,c.jsx)("p",{children:"Activity timeline coming soon..."})]})})]}):(0,c.jsx)("div",{children:"Follower not found"})}function $l({id:e,onClose:t}){return(0,c.jsx)(O,{title:"Following Details",hasPadding:!0,actions:(0,c.jsx)(s.Button,{size:"small",onClick:t,children:"Close"}),children:(0,c.jsxs)("p",{children:["Following details for ID: ",e]})})}function ql({id:e,onClose:t}){return(0,c.jsx)(O,{title:"Interaction Details",hasPadding:!0,actions:(0,c.jsx)(s.Button,{size:"small",onClick:t,children:"Close"}),children:(0,c.jsxs)("p",{children:["Interaction details for ID: ",e]})})}function Gl(){const e=window.location.hash.slice(1);if(!e||"/"===e)return{section:"dashboard",itemId:null};const t=e.split("/").filter(Boolean);return{section:t[0]||"dashboard",itemId:t[1]||null}}function Kl(e,t){const n=t?`#/${e}/${t}`:`#/${e}`;window.history.pushState(null,"",n)}function Ul(){const[e,t]=(0,a.useState)("dashboard"),[n,i]=(0,a.useState)(null);(0,a.useEffect)(()=>{const{section:e,itemId:n}=Gl();t(e),i(n)},[]),(0,a.useEffect)(()=>{const e=()=>{const{section:e,itemId:n}=Gl();t(e),i(n)};return window.addEventListener("hashchange",e),()=>{window.removeEventListener("hashchange",e)}},[]),(0,a.useEffect)(()=>(document.body.classList.add("is-fullscreen-mode"),()=>{document.body.classList.remove("is-fullscreen-mode")}),[]);const r=t=>{i(t),Kl(e,t)},s=()=>{i(null),Kl(e)},o=!!n;return(0,c.jsxs)("div",{className:"app-layout",children:[(0,c.jsx)(l.CommandMenu,{}),(0,c.jsxs)("div",{className:"app-content",children:[(0,c.jsx)("div",{className:"sidebar-region",children:(0,c.jsx)(N,{activeSection:e,onNavigate:e=>{t(e),i(null),Kl(e)}})}),(0,c.jsx)("div",{className:"stage-region",children:(0,c.jsx)(M,{children:(()=>{const t={onSelectItem:r};switch(e){case"dashboard":default:return(0,c.jsx)(R,{});case"followers":return(0,c.jsx)(zl,{...t});case"following":return(0,c.jsx)(Hl,{...t});case"interactions":return(0,c.jsx)(Rl,{...t})}})()})}),o&&(0,c.jsx)("div",{className:"inspector-region",children:(0,c.jsx)(M,{children:(()=>{if(!n)return null;const t={id:n,onClose:s};switch(e){case"followers":return(0,c.jsx)(Wl,{...t});case"following":return(0,c.jsx)($l,{...t});case"interactions":return(0,c.jsx)(ql,{...t});default:return null}})()})})]})]})}window.wp=window.wp||{},window.wp.activitypubSocialWeb={initialize:function(e,t){const n=document.getElementById(e);n&&(0,a.createRoot)(n).render((0,c.jsx)(o.ShortcutProvider,{children:(0,c.jsx)(s.SlotFillProvider,{children:(0,c.jsx)(Ul,{})})}))}}},493:(e,t,n)=>{"use strict";var i=n(609),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=i.useState,s=i.useEffect,o=i.useLayoutEffect,l=i.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),i=a({inst:{value:n,getSnapshot:t}}),r=i[0].inst,u=i[1];return o(function(){r.value=n,r.getSnapshot=t,c(r)&&u({inst:r})},[e,n,t]),s(function(){return c(r)&&u({inst:r}),e(function(){c(r)&&u({inst:r})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:u},609:e=>{"use strict";e.exports=window.React},731:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),i=new RegExp(n,"g"),r=new RegExp(n,"");function a(e){return t[e]}var s=function(e){return e.replace(i,a)};e.exports=s,e.exports.has=function(e){return!!e.match(r)},e.exports.remove=s},888:(e,t,n)=>{"use strict";e.exports=n(493)}},r={};function a(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return i[e](n,n.exports,a),n.exports}a.m=i,e=[],a.O=(t,n,i,r)=>{if(!n){var s=1/0;for(u=0;u=r)&&Object.keys(a.O).every(e=>a.O[e](n[l]))?n.splice(l--,1):(o=!1,r0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[n,i,r]},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(e,i){if(1&i&&(e=this(e)),8&i)return e;if("object"==typeof e&&e){if(4&i&&e.__esModule)return e;if(16&i&&"function"==typeof e.then)return e}var r=Object.create(null);a.r(r);var s={};t=t||[null,n({}),n([]),n(n)];for(var o=2&i&&e;("object"==typeof o||"function"==typeof o)&&!~t.indexOf(o);o=n(o))Object.getOwnPropertyNames(o).forEach(t=>s[t]=()=>e[t]);return s.default=()=>e,a.d(r,s),r},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={994:0,982:0};a.O.j=t=>0===e[t];var t=(t,n)=>{var i,r,[s,o,l]=n,c=0;if(s.some(t=>0!==e[t])){for(i in o)a.o(o,i)&&(a.m[i]=o[i]);if(l)var u=l(a)}for(t&&t(n);ca(436));s=a.O(s)})(); \ No newline at end of file +(0,Ut._x)("Show %s","field"),e.label)}),h&&(0,a.jsx)(nf,{previewOptions:h,onChangePreviewOption:p,onMenuOpenChange:g,activeOption:e.id})]})]})})}function of({index:e,field:t,view:n,onChangeView:r}){const i=n.fields??[],o=void 0!==e&&i.includes(t.id);return(0,a.jsx)(rf,{field:t,isVisible:o,isFirst:void 0!==e&&e<1,isLast:void 0!==e&&e===i.length-1,onToggleVisibility:()=>{r({...n,fields:o?i.filter(e=>e!==t.id):[...i,t.id]})},onMoveUp:void 0!==e?()=>{r({...n,fields:[...i.slice(0,e-1)??[],t.id,i[e-1],...i.slice(e+1)]})}:void 0,onMoveDown:void 0!==e?()=>{r({...n,fields:[...i.slice(0,e)??[],i[e+1],t.id,...i.slice(e+2)]})}:void 0})}function sf(e){return!!e}function af(){const{view:e,fields:t,onChangeView:n}=(0,o.useContext)(Ls),r=[e?.titleField,e?.mediaField,e?.descriptionField].filter(Boolean),i=e.fields??[],l=t.filter(e=>!i.includes(e.id)&&!r.includes(e.id)&&"media"!==e.type&&!1!==e.enableHiding);let c=i.map(e=>t.find(t=>t.id===e)).filter(sf);if(!c?.length&&!l?.length)return null;const u=t.find(t=>t.id===e.titleField),d=t.find(t=>t.id===e.mediaField),f=t.find(t=>t.id===e.descriptionField),h=t.filter(e=>"media"===e.type);let p;if(h.length>1){const t=sf(d)&&(e.showMedia??!0);p=sf(d)&&(0,a.jsx)(rf,{field:d,label:(0,Ut.__)("Preview"),description:d.label,isVisible:t,onToggleVisibility:()=>{n({...e,showMedia:!t})},canMove:!1,previewOptions:h.map(e=>({label:e.label,id:e.id})),onChangePreviewOption:t=>n({...e,mediaField:t})},d.id)}const m=[{field:u,isVisibleFlag:"showTitle"},{field:d,isVisibleFlag:"showMedia",ui:p},{field:f,isVisibleFlag:"showDescription"}].filter(({field:e})=>sf(e));let g=m.filter(({field:t,isVisibleFlag:n})=>sf(t)&&(e[n]??!0));1===g.length&&(g=g.map(e=>({...e,field:{...e.field,enableHiding:!1}}))),0===g.length&&1===c.length&&(c=[{...c[0],enableHiding:!1}]);const v=m.filter(({field:t,isVisibleFlag:n})=>sf(t)&&!(e[n]??1));return(0,a.jsxs)(s.__experimentalVStack,{className:"dataviews-field-control",spacing:6,children:[(0,a.jsx)(s.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(g.length>0||!!c?.length)&&(0,a.jsxs)(s.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[g.map(({field:t,isVisibleFlag:r,ui:i})=>i??(0,a.jsx)(rf,{field:t,isVisible:!0,onToggleVisibility:()=>{n({...e,[r]:!1})},canMove:!1},t.id)),c.map((t,r)=>(0,a.jsx)(of,{field:t,view:e,onChangeView:n,index:r},t.id))]})}),(!!l?.length||!!v.length)&&(0,a.jsxs)(s.__experimentalVStack,{spacing:4,children:[(0,a.jsx)(s.BaseControl.VisualLabel,{style:{margin:0},children:(0,Ut.__)("Hidden")}),(0,a.jsx)(s.__experimentalVStack,{className:"dataviews-view-config__properties",spacing:0,children:(0,a.jsxs)(s.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[v.length>0&&v.map(({field:t,isVisibleFlag:r,ui:i})=>i??(0,a.jsx)(rf,{field:t,isVisible:!1,onToggleVisibility:()=>{n({...e,[r]:!0})},canMove:!1},t.id)),l.map(t=>(0,a.jsx)(of,{field:t,view:e,onChangeView:n},t.id))]})})]})]})}function lf({title:e,description:t,children:n}){return(0,a.jsxs)(s.__experimentalGrid,{columns:12,className:"dataviews-settings-section",gap:4,children:[(0,a.jsxs)("div",{className:"dataviews-settings-section__sidebar",children:[(0,a.jsx)(s.__experimentalHeading,{level:2,className:"dataviews-settings-section__title",children:e}),t&&(0,a.jsx)(s.__experimentalText,{variant:"muted",className:"dataviews-settings-section__description",children:t})]}),(0,a.jsx)(s.__experimentalGrid,{columns:8,gap:4,className:"dataviews-settings-section__content",children:n})]})}function cf(){const{view:e}=(0,o.useContext)(Ls),t=(0,So.useInstanceId)(uf,"dataviews-view-config-dropdown"),n=Oa.find(t=>t.type===e.type);return(0,a.jsx)(s.Dropdown,{expandOnMobile:!0,popoverProps:{...Xd,id:t},renderToggle:({onToggle:e,isOpen:n})=>(0,a.jsx)(s.Button,{size:"compact",icon:Ud,label:(0,Ut._x)("View options","View is used as a noun"),onClick:e,"aria-expanded":n?"true":"false","aria-controls":t}),renderContent:()=>(0,a.jsx)(s.__experimentalDropdownContentWrapper,{paddingSize:"medium",className:"dataviews-config__popover-content-wrapper",children:(0,a.jsxs)(s.__experimentalVStack,{className:"dataviews-view-config",spacing:6,children:[(0,a.jsxs)(lf,{title:(0,Ut.__)("Appearance"),children:[(0,a.jsxs)(s.__experimentalHStack,{expanded:!0,className:"is-divided-in-two",children:[(0,a.jsx)(Qd,{}),(0,a.jsx)(ef,{})]}),!!n?.viewConfigOptions&&(0,a.jsx)(n.viewConfigOptions,{}),(0,a.jsx)(Yd,{}),(0,a.jsx)(tf,{})]}),(0,a.jsx)(lf,{title:(0,Ut.__)("Properties"),children:(0,a.jsx)(af,{})})]})})})}function uf(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Jd,{}),(0,a.jsx)(cf,{})]})}var df=(0,o.memo)(uf);function ff({item:e,field:t}){const{elements:n,isLoading:r}=hd({elements:t.elements,getElements:t.getElements}),i=t.getValue({item:e});return r||0===n.length?i:n?.find(e=>e.value===i)?.label||t.getValue({item:e})}const hf=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;var pf={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||hf.test(n)?null:(0,Ut.__)("Value must be a valid email address.")}},Edit:"email",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(ff,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[es,ts],validOperators:[Jo,Qo,fs,hs,ps,es,ts,ns,rs]}},mf={sort:function(e,t,n){return"asc"===n?e-t:t-e},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||Number.isInteger(n)?null:(0,Ut.__)("Value must be an integer.")}},Edit:"integer",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(ff,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[Jo,Qo,is,os,ss,as,ms],validOperators:[Jo,Qo,is,os,ss,as,ms,es,ts,ns,rs]}},gf={sort:function(e,t,n){return"asc"===n?e-t:t-e},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return function(e){return""===e||null==e}(n)||Number.isFinite(n)?null:(0,Ut.__)("Value must be a number.")}},Edit:"number",render:({item:e,field:t})=>{t.hasElements;const n=t.getValue({item:e});return[null,void 0].includes(n)?null:Number(n).toFixed(2)},enableSorting:!0,filterBy:{defaultOperators:[Jo,Qo,is,os,ss,as,ms],validOperators:[Jo,Qo,is,os,ss,as,ms,es,ts,ns,rs]}},vf={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:()=>null},Edit:"text",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(ff,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[es,ts],validOperators:[Jo,Qo,fs,hs,ps,es,ts,ns,rs]}},wf={sort:function(e,t,n){const r=new Date(e).getTime(),i=new Date(t).getTime();return"asc"===n?r-i:i-r},isValid:{elements:!0,custom:()=>null},Edit:"datetime",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(ff,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[gs,vs,ls,cs,us,ds,ws,bs],validOperators:[gs,vs,ls,cs,us,ds,ws,bs]}};const bf=window.wp.date;var xf={sort:function(e,t,n){const r=new Date(e).getTime(),i=new Date(t).getTime();return"asc"===n?r-i:i-r},Edit:"date",isValid:{elements:!0,custom:()=>null},render:({item:e,field:t})=>{if(t.hasElements)return(0,a.jsx)(ff,{item:e,field:t});const n=t.getValue({item:e});return n?(r=n,(0,bf.dateI18n)((0,bf.getSettings)().formats.date,(0,bf.getDate)(r))):"";var r},enableSorting:!0,filterBy:{defaultOperators:[gs,vs,ls,cs,us,ds,ws,bs,ms],validOperators:[gs,vs,ls,cs,us,ds,ws,bs,ms]}},yf={sort:function(e,t,n){const r=Boolean(e);return r===Boolean(t)?0:"asc"===n?r?1:-1:r?-1:1},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||[!0,!1].includes(n)?null:(0,Ut.__)("Value must be true, false, or undefined")}},Edit:"checkbox",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(ff,{item:e,field:t}):!0===t.getValue({item:e})?(0,Ut.__)("True"):!1===t.getValue({item:e})?(0,Ut.__)("False"):null,enableSorting:!0,filterBy:{defaultOperators:[Jo,Qo],validOperators:[Jo,Qo]}},_f={sort:function(){return 0},isValid:{elements:!0,custom:()=>null},Edit:null,render:()=>null,enableSorting:!1,filterBy:!1};const Sf={sort:function(e,t,n){const r=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];if(r.length!==i.length)return"asc"===n?r.length-i.length:i.length-r.length;const o=r.join(","),s=i.join(",");return"asc"===n?o.localeCompare(s):s.localeCompare(o)},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||Array.isArray(n)?n.every(e=>"string"==typeof e)?null:(0,Ut.__)("Every value must be a string."):(0,Ut.__)("Value must be an array.")}},Edit:"array",render:function({item:e,field:t}){return(t.getValue({item:e})||[]).join(", ")},enableSorting:!0,filterBy:{defaultOperators:[es,ts],validOperators:[es,ts,ns,rs]}};var Cf=Sf,jf={sort:function(e,t,n){return 0},isValid:{elements:!0,custom:()=>null},Edit:"password",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(ff,{item:e,field:t}):"••••••••",enableSorting:!1,filterBy:!1},kf={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:()=>null},Edit:"telephone",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(ff,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[es,ts],validOperators:[Jo,Qo,fs,hs,ps,es,ts,ns,rs]}},If={grad:.9,turn:360,rad:360/(2*Math.PI)},Mf=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},Ef=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Pf=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},Lf=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Vf=function(e){return{r:Pf(e.r,0,255),g:Pf(e.g,0,255),b:Pf(e.b,0,255),a:Pf(e.a)}},Nf=function(e){return{r:Ef(e.r),g:Ef(e.g),b:Ef(e.b),a:Ef(e.a,3)}},Of=/^#([0-9a-f]{3,8})$/i,Rf=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Ff=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,o=Math.max(t,n,r),s=o-Math.min(t,n,r),a=s?o===t?(n-r)/s:o===n?2+(r-t)/s:4+(t-n)/s:0;return{h:60*(a<0?a+6:a),s:o?s/o*100:0,v:o/255*100,a:i}},Tf=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var o=Math.floor(t),s=r*(1-n),a=r*(1-(t-o)*n),l=r*(1-(1-t+o)*n),c=o%6;return{r:255*[r,a,s,s,l,r][c],g:255*[l,r,r,a,s,s][c],b:255*[s,s,l,r,r,a][c],a:i}},Af=function(e){return{h:Lf(e.h),s:Pf(e.s,0,100),l:Pf(e.l,0,100),a:Pf(e.a)}},Df=function(e){return{h:Ef(e.h),s:Ef(e.s),l:Ef(e.l),a:Ef(e.a,3)}},Bf=function(e){return Tf((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},zf=function(e){return{h:(t=Ff(e)).h,s:(i=(200-(n=t.s))*(r=t.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,r,i},$f=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Hf=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Wf=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,qf=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Uf={string:[[function(e){var t=Of.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?Ef(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?Ef(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Wf.exec(e)||qf.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Vf({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=$f.exec(e)||Hf.exec(e);if(!t)return null;var n,r,i=Af({h:(n=t[1],r=t[2],void 0===r&&(r="deg"),Number(n)*(If[r]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return Bf(i)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,r=e.b,i=e.a,o=void 0===i?1:i;return Mf(t)&&Mf(n)&&Mf(r)?Vf({r:Number(t),g:Number(n),b:Number(r),a:Number(o)}):null},"rgb"],[function(e){var t=e.h,n=e.s,r=e.l,i=e.a,o=void 0===i?1:i;if(!Mf(t)||!Mf(n)||!Mf(r))return null;var s=Af({h:Number(t),s:Number(n),l:Number(r),a:Number(o)});return Bf(s)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,i=e.a,o=void 0===i?1:i;if(!Mf(t)||!Mf(n)||!Mf(r))return null;var s=function(e){return{h:Lf(e.h),s:Pf(e.s,0,100),v:Pf(e.v,0,100),a:Pf(e.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(o)});return Tf(s)},"hsv"]]},Gf=function(e,t){for(var n=0;n=.5},e.prototype.toHex=function(){return t=(e=Nf(this.rgba)).r,n=e.g,r=e.b,o=(i=e.a)<1?Rf(Ef(255*i)):"","#"+Rf(t)+Rf(n)+Rf(r)+o;var e,t,n,r,i,o},e.prototype.toRgb=function(){return Nf(this.rgba)},e.prototype.toRgbString=function(){return t=(e=Nf(this.rgba)).r,n=e.g,r=e.b,(i=e.a)<1?"rgba("+t+", "+n+", "+r+", "+i+")":"rgb("+t+", "+n+", "+r+")";var e,t,n,r,i},e.prototype.toHsl=function(){return Df(zf(this.rgba))},e.prototype.toHslString=function(){return t=(e=Df(zf(this.rgba))).h,n=e.s,r=e.l,(i=e.a)<1?"hsla("+t+", "+n+"%, "+r+"%, "+i+")":"hsl("+t+", "+n+"%, "+r+"%)";var e,t,n,r,i},e.prototype.toHsv=function(){return e=Ff(this.rgba),{h:Ef(e.h),s:Ef(e.s),v:Ef(e.v),a:Ef(e.a,3)};var e},e.prototype.invert=function(){return Jf({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Jf(Kf(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Jf(Kf(this.rgba,-e))},e.prototype.grayscale=function(){return Jf(Kf(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Jf(Zf(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Jf(Zf(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Jf({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Ef(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=zf(this.rgba);return"number"==typeof e?Jf({h:e,s:t.s,l:t.l,a:t.a}):Ef(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Jf(e).toHex()},e}(),Jf=function(e){return e instanceof Xf?e:new Xf(e)},Qf={sort:function(e,t,n){const r=Jf(e),i=Jf(t);if(!r.isValid()&&!i.isValid())return 0;if(!r.isValid())return"asc"===n?1:-1;if(!i.isValid())return"asc"===n?-1:1;const o=r.toHsl(),s=i.toHsl();return o.h!==s.h?"asc"===n?o.h-s.h:s.h-o.h:o.s!==s.s?"asc"===n?o.s-s.s:s.s-o.s:"asc"===n?o.l-s.l:s.l-o.l},isValid:{elements:!0,custom:(e,t)=>{const n=t.getValue({item:e});return[void 0,"",null].includes(n)||Jf(n).isValid()?null:(0,Ut.__)("Value must be a valid color.")}},Edit:"color",render:({item:e,field:t})=>{if(t.hasElements)return(0,a.jsx)(ff,{item:e,field:t});const n=t.getValue({item:e});return n&&Jf(n).isValid()?(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,a.jsx)("div",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:n,border:"1px solid #ddd",flexShrink:0}}),(0,a.jsx)("span",{children:n})]}):n},enableSorting:!0,filterBy:{defaultOperators:[es,ts],validOperators:[Jo,Qo]}},eh={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:{elements:!0,custom:()=>null},Edit:"url",render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(ff,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[es,ts],validOperators:[Jo,Qo,fs,hs,ps,es,ts,ns,rs]}};function th(e,t){let n;return e?.required&&t?.required?n=t?.required?.message?t.required:void 0:e?.elements&&t?.elements?n=t.elements:t?.custom&&(n=t.custom),n}const{ValidatedCheckboxControl:nh}=Bs(s.privateApis);Math.pow(10,8);const rh=6048e5,ih=Symbol.for("constructDateFrom");function oh(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&ih in e?e[ih](t):e instanceof Date?new e.constructor(t):new Date(t)}function sh(e,t){return oh(t||e,e)}function ah(e){return!(!((t=e)instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))&&"number"!=typeof e||isNaN(+sh(e)));var t}const lh={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function ch(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const uh={date:ch({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:ch({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:ch({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},dh={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function fh(e){return(t,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;r=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;r=e.values[i]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}const hh={ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:fh({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:fh({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:fh({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:fh({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:fh({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function ph(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const s=o[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?function(e,t){for(let n=0;ne.test(s)):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}(a,e=>e.test(s));let c;return c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c,{value:c,rest:t.slice(s.length)}}}const mh={ordinalNumber:(gh={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(gh.matchPattern);if(!n)return null;const r=n[0],i=e.match(gh.parsePattern);if(!i)return null;let o=gh.valueCallback?gh.valueCallback(i[0]):i[0];return o=t.valueCallback?t.valueCallback(o):o,{value:o,rest:e.slice(r.length)}}),era:ph({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:ph({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:ph({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:ph({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:ph({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})};var gh;const vh={code:"en-US",formatDistance:(e,t,n)=>{let r;const i=lh[e];return r="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:uh,formatRelative:(e,t,n,r)=>dh[e],localize:hh,match:mh,options:{weekStartsOn:0,firstWeekContainsDate:1}};let wh={};function bh(){return wh}function xh(e){const t=sh(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function yh(e,t){const n=sh(e,t?.in);return n.setHours(0,0,0,0),n}function _h(e,t){const n=sh(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Sh(e,t){const n=sh(e,t?.in);return function(e,t,n){const[r,i]=function(e,...t){const n=oh.bind(null,e||t.find(e=>"object"==typeof e));return t.map(n)}(n?.in,e,t),o=yh(r),s=yh(i),a=+o-xh(o),l=+s-xh(s);return Math.round((a-l)/864e5)}(n,_h(n))+1}function Ch(e,t){const n=bh(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=sh(e,t?.in),o=i.getDay(),s=(o=o.getTime()?r+1:n.getTime()>=a.getTime()?r:r-1}function Ih(e,t){const n=sh(e,t?.in),r=+jh(n)-+function(e,t){const n=kh(e,t),r=oh(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),jh(r)}(n);return Math.round(r/rh)+1}function Mh(e,t){const n=sh(e,t?.in),r=n.getFullYear(),i=bh(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=oh(t?.in||e,0);s.setFullYear(r+1,0,o),s.setHours(0,0,0,0);const a=Ch(s,t),l=oh(t?.in||e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=Ch(l,t);return+n>=+a?r+1:+n>=+c?r:r-1}function Eh(e,t){const n=sh(e,t?.in),r=+Ch(n,t)-+function(e,t){const n=bh(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Mh(e,t),o=oh(t?.in||e,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),Ch(o,t)}(n,t);return Math.round(r/rh)+1}function Ph(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const Lh={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Ph("yy"===t?r%100:r,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):Ph(n+1,2)},d:(e,t)=>Ph(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>Ph(e.getHours()%12||12,t.length),H:(e,t)=>Ph(e.getHours(),t.length),m:(e,t)=>Ph(e.getMinutes(),t.length),s:(e,t)=>Ph(e.getSeconds(),t.length),S(e,t){const n=t.length,r=e.getMilliseconds();return Ph(Math.trunc(r*Math.pow(10,n-3)),t.length)}},Vh={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:"year"})}return Lh.y(e,t)},Y:function(e,t,n,r){const i=Mh(e,r),o=i>0?i:1-i;return"YY"===t?Ph(o%100,2):"Yo"===t?n.ordinalNumber(o,{unit:"year"}):Ph(o,t.length)},R:function(e,t){return Ph(kh(e),t.length)},u:function(e,t){return Ph(e.getFullYear(),t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Ph(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Ph(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Lh.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Ph(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=Eh(e,r);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):Ph(i,t.length)},I:function(e,t,n){const r=Ih(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):Ph(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):Lh.d(e,t)},D:function(e,t,n){const r=Sh(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):Ph(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return Ph(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return Ph(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=0===r?7:r;switch(t){case"i":return String(i);case"ii":return Ph(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(i=12===r?"noon":0===r?"midnight":r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(i=r>=17?"evening":r>=12?"afternoon":r>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return Lh.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):Lh.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):Ph(r,t.length)},k:function(e,t,n){let r=e.getHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):Ph(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Lh.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Lh.s(e,t)},S:function(e,t){return Lh.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return Oh(r);case"XXXX":case"XX":return Rh(r);default:return Rh(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return Oh(r);case"xxxx":case"xx":return Rh(r);default:return Rh(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Nh(r,":");default:return"GMT"+Rh(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Nh(r,":");default:return"GMT"+Rh(r,":")}},t:function(e,t,n){return Ph(Math.trunc(+e/1e3),t.length)},T:function(e,t,n){return Ph(+e,t.length)}};function Nh(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),o=r%60;return 0===o?n+String(i):n+String(i)+t+Ph(o,2)}function Oh(e,t){return e%60==0?(e>0?"-":"+")+Ph(Math.abs(e)/60,2):Rh(e,t)}function Rh(e,t=""){const n=e>0?"-":"+",r=Math.abs(e);return n+Ph(Math.trunc(r/60),2)+t+Ph(r%60,2)}const Fh=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Th=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ah={p:Th,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Fh(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"})}return o.replace("{{date}}",Fh(r,t)).replace("{{time}}",Th(i,t))}},Dh=/^D+$/,Bh=/^Y+$/,zh=["D","DD","YY","YYYY"],$h=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hh=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Wh=/^'([^]*?)'?$/,qh=/''/g,Uh=/[a-zA-Z]/;function Gh(e,t,n){const r=bh(),i=n?.locale??r.locale??vh,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=sh(e,n?.in);if(!ah(a))throw new RangeError("Invalid time value");let l=t.match(Hh).map(e=>{const t=e[0];return"p"===t||"P"===t?(0,Ah[t])(e,i.formatLong):e}).join("").match($h).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Kh(e)};if(Vh[t])return{isToken:!0,value:e};if(t.match(Uh))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:o,weekStartsOn:s,locale:i};return l.map(r=>{if(!r.isToken)return r.value;const o=r.value;return(!n?.useAdditionalWeekYearTokens&&function(e){return Bh.test(e)}(o)||!n?.useAdditionalDayOfYearTokens&&function(e){return Dh.test(e)}(o))&&function(e,t,n){const r=function(e,t,n){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(r),zh.includes(e))throw new RangeError(r)}(o,t,String(e)),(0,Vh[o[0]])(a,o,i.localize,c)}).join("")}function Kh(e){const t=e.match(Wh);return t?t[1].replace(qh,"'"):e}const Yh={[ws]:[{value:"days",label:(0,Ut.__)("Days")},{value:"weeks",label:(0,Ut.__)("Weeks")},{value:"months",label:(0,Ut.__)("Months")},{value:"years",label:(0,Ut.__)("Years")}],[bs]:[{value:"days",label:(0,Ut.__)("Days ago")},{value:"weeks",label:(0,Ut.__)("Weeks ago")},{value:"months",label:(0,Ut.__)("Months ago")},{value:"years",label:(0,Ut.__)("Years ago")}]};function Zh({className:e,data:t,field:n,onChange:r,hideLabelFromVision:i,operator:l}){const c=Yh[l===ws?"inThePast":"over"],{id:u,label:d,getValue:f,setValue:h}=n,p=f({item:t}),{value:m="",unit:g=c[0].value}=p&&"object"==typeof p?p:{},v=(0,o.useCallback)(e=>r(h({item:t,value:{value:Number(e),unit:g}})),[r,h,t,g]),w=(0,o.useCallback)(e=>r(h({item:t,value:{value:m,unit:e}})),[r,h,t,m]);return(0,a.jsx)(s.BaseControl,{id:u,__nextHasNoMarginBottom:!0,className:ro(e,"dataviews-controls__relative-date"),label:d,hideLabelFromVision:i,children:(0,a.jsxs)(s.__experimentalHStack,{spacing:2.5,children:[(0,a.jsx)(s.__experimentalNumberControl,{__next40pxDefaultSize:!0,className:"dataviews-controls__relative-date-number",spinControls:"none",min:1,step:1,value:m,onChange:v}),(0,a.jsx)(s.SelectControl,{className:"dataviews-controls__relative-date-unit",__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,Ut.__)("Unit"),value:g,options:c,onChange:w,hideLabelFromVision:!0})]})})}const{DateCalendar:Xh,ValidatedInputControl:Jh}=Bs(s.privateApis),Qh=e=>{if(!e)return null;const t=(0,bf.getDate)(e);return t&&ah(t)?t:null};function ep({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){const{id:l,label:c,description:u,setValue:d,getValue:f,isValid:h}=t,p=f({item:e}),m="string"==typeof p?p:void 0,[g,v]=(0,o.useState)(()=>Qh(m)||new Date),w=(0,o.useRef)(null),b=(0,o.useRef)(),x=(0,o.useRef)(null),y=(0,o.useCallback)(t=>n(d({item:e,value:t})),[e,n,d]);(0,o.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]);const _=(0,o.useCallback)(e=>{let t;if(e){let n=e;if(m){const t=Qh(m);t&&(n=new Date(e),n.setHours(t.getHours()),n.setMinutes(t.getMinutes()))}t=n.toISOString(),y(t),b.current&&clearTimeout(b.current)}else y(void 0);x.current=w.current&&w.current.ownerDocument.activeElement,b.current=setTimeout(()=>{w.current&&(w.current.focus(),w.current.blur(),y(t),x.current&&x.current instanceof HTMLElement&&x.current.focus())},0)},[y,m]),S=(0,o.useCallback)(e=>{if(e){const t=new Date(e);y(t.toISOString());const n=Qh(t.toISOString());n&&v(n)}else y(void 0)},[y]),{timezone:{string:C},l10n:{startOfWeek:j}}=(0,bf.getSettings)(),k=h?.required&&!r?`${c} (${(0,Ut.__)("Required")})`:c;return(0,a.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,id:l,label:k,help:u,hideLabelFromVision:r,children:(0,a.jsxs)(s.__experimentalVStack,{spacing:4,children:[(0,a.jsx)(Xh,{style:{width:"100%"},selected:m&&Qh(m)||void 0,onSelect:_,month:g,onMonthChange:v,timeZone:C||void 0,weekStartsOn:j}),(0,a.jsx)(Jh,{ref:w,__next40pxDefaultSize:!0,required:!!h?.required,customValidity:th(h,i),type:"datetime-local",label:(0,Ut.__)("Date time"),hideLabelFromVision:!0,value:m?(I=Qh(m)||void 0,I?"string"==typeof I?I:Gh(I,"yyyy-MM-dd'T'HH:mm"):""):"",onChange:S})]})});var I}function tp(e,t,n){return function(e,t,n){const r=sh(e,n?.in);return isNaN(t)?oh(n?.in||e,NaN):t?(r.setDate(r.getDate()+t),r):r}(e,-t,n)}function np(e,t,n){const r=sh(e,n?.in);if(isNaN(t))return oh(n?.in||e,NaN);if(!t)return r;const i=r.getDate(),o=oh(n?.in||e,r.getTime());return o.setMonth(r.getMonth()+t+1,0),i>=o.getDate()?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}function rp(e,t){const n=sh(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function ip(e,t,n){return function(e,t,n){return np(e,12*t,n)}(e,-t,n)}var op=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z"})});const{DateCalendar:sp,DateRangeCalendar:ap}=Bs(s.privateApis),lp=[{id:"today",label:(0,Ut.__)("Today"),getValue:()=>(0,bf.getDate)(null)},{id:"yesterday",label:(0,Ut.__)("Yesterday"),getValue:()=>tp((0,bf.getDate)(null),1)},{id:"past-week",label:(0,Ut.__)("Past week"),getValue:()=>tp((0,bf.getDate)(null),7)},{id:"past-month",label:(0,Ut.__)("Past month"),getValue:()=>{return np((0,bf.getDate)(null),-1,e);var e}}],cp=[{id:"last-7-days",label:(0,Ut.__)("Last 7 days"),getValue:()=>{const e=(0,bf.getDate)(null);return[tp(e,7),e]}},{id:"last-30-days",label:(0,Ut.__)("Last 30 days"),getValue:()=>{const e=(0,bf.getDate)(null);return[tp(e,30),e]}},{id:"month-to-date",label:(0,Ut.__)("Month to date"),getValue:()=>{const e=(0,bf.getDate)(null);return[rp(e),e]}},{id:"last-year",label:(0,Ut.__)("Last year"),getValue:()=>{const e=(0,bf.getDate)(null);return[ip(e,1),e]}},{id:"year-to-date",label:(0,Ut.__)("Year to date"),getValue:()=>{const e=(0,bf.getDate)(null);return[_h(e),e]}}],up=e=>{if(!e)return null;const t=(0,bf.getDate)(e);return t&&ah(t)?t:null},dp=e=>e?"string"==typeof e?e:Gh(e,"yyyy-MM-dd"):"";function fp({field:e,validity:t,inputRefs:n,isTouched:r,setIsTouched:i,children:l}){const{isValid:c}=e,[u,d]=(0,o.useState)(void 0),f=(0,o.useCallback)(()=>{const e=Array.isArray(n)?n:[n];for(const t of e){const e=t.current;if(e&&!e.validity.valid)return void d({type:"invalid",message:e.validationMessage})}d(void 0)},[n]);return(0,o.useEffect)(()=>{if(r){const e=setTimeout(()=>{t?d(th(c,t)):f()},0);return()=>clearTimeout(e)}},[r,c,t,f]),(0,a.jsxs)("div",{onBlur:e=>{r||e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||i(!0)},children:[l,(0,a.jsx)("div",{"aria-live":"polite",children:u&&(0,a.jsxs)("p",{className:ro("components-validated-control__indicator","invalid"===u.type?"is-invalid":void 0,"valid"===u.type?"is-valid":void 0),children:[(0,a.jsx)(s.Icon,{className:"components-validated-control__indicator-icon",icon:op,size:16,fill:"currentColor"}),u.message]})})]})}function hp({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){const{id:l,label:c,setValue:u,getValue:d,isValid:f}=t,[h,p]=(0,o.useState)(null),m=d({item:e}),g="string"==typeof m?m:void 0,[v,w]=(0,o.useState)(()=>up(g)||new Date),[b,x]=(0,o.useState)(!1),y=(0,o.useRef)(null),_=(0,o.useCallback)(t=>n(u({item:e,value:t})),[e,n,u]),S=(0,o.useCallback)(e=>{const t=e?Gh(e,"yyyy-MM-dd"):void 0;_(t),p(null),x(!0)},[_]),C=(0,o.useCallback)(e=>{const t=e.getValue(),n=dp(t);w(t),_(n),p(e.id),x(!0)},[_]),j=(0,o.useCallback)(e=>{if(_(e),e){const t=up(e);t&&w(t)}p(null),x(!0)},[_]),{timezone:{string:k},l10n:{startOfWeek:I}}=(0,bf.getSettings)(),M=f?.required?`${c} (${(0,Ut.__)("Required")})`:c;return(0,a.jsx)(fp,{field:t,validity:i,inputRefs:y,isTouched:b,setIsTouched:x,children:(0,a.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,id:l,className:"dataviews-controls__date",label:M,hideLabelFromVision:r,children:(0,a.jsxs)(s.__experimentalVStack,{spacing:4,children:[(0,a.jsxs)(s.__experimentalHStack,{spacing:2,wrap:!0,justify:"flex-start",children:[lp.map(e=>{const t=h===e.id;return(0,a.jsx)(s.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:t,size:"small",onClick:()=>C(e),children:e.label},e.id)}),(0,a.jsx)(s.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:!h,size:"small",disabled:!!h,accessibleWhenDisabled:!1,children:(0,Ut.__)("Custom")})]}),(0,a.jsx)(s.__experimentalInputControl,{__next40pxDefaultSize:!0,ref:y,type:"date",label:(0,Ut.__)("Date"),hideLabelFromVision:!0,value:g,onChange:j,required:!!t.isValid?.required}),(0,a.jsx)(sp,{style:{width:"100%"},selected:g&&up(g)||void 0,onSelect:S,month:v,onMonthChange:w,timeZone:k||void 0,weekStartsOn:I})]})})})}function pp({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){const{id:l,label:c,getValue:u,setValue:d}=t;let f;const h=u({item:e});Array.isArray(h)&&2===h.length&&h.every(e=>"string"==typeof e)&&(f=h);const p=(0,o.useCallback)(t=>{n(d({item:e,value:t}))},[e,n,d]),[m,g]=(0,o.useState)(null),v=(0,o.useMemo)(()=>{if(!f)return{from:void 0,to:void 0};const[e,t]=f;return{from:up(e)||void 0,to:up(t)||void 0}},[f]),[w,b]=(0,o.useState)(()=>v.from||new Date),[x,y]=(0,o.useState)(!1),_=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useCallback)((e,t)=>{e&&t?p([dp(e),dp(t)]):e||t||p(void 0)},[p]),j=(0,o.useCallback)(e=>{C(e?.from,e?.to),g(null),y(!0)},[C]),k=(0,o.useCallback)(e=>{const[t,n]=e.getValue();b(t),C(t,n),g(e.id),y(!0)},[C]),I=(0,o.useCallback)((e,t)=>{const[n,r]=f||[void 0,void 0];if(C("from"===e?t:n,"to"===e?t:r),t){const e=up(t);e&&b(e)}g(null),y(!0)},[f,C]),{timezone:M,l10n:E}=(0,bf.getSettings)(),P=t.isValid?.required?`${c} (${(0,Ut.__)("Required")})`:c;return(0,a.jsx)(fp,{field:t,validity:i,inputRefs:[_,S],isTouched:x,setIsTouched:y,children:(0,a.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,id:l,className:"dataviews-controls__date",label:P,hideLabelFromVision:r,children:(0,a.jsxs)(s.__experimentalVStack,{spacing:4,children:[(0,a.jsxs)(s.__experimentalHStack,{spacing:2,wrap:!0,justify:"flex-start",children:[cp.map(e=>{const t=m===e.id;return(0,a.jsx)(s.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:t,size:"small",onClick:()=>k(e),children:e.label},e.id)}),(0,a.jsx)(s.Button,{className:"dataviews-controls__date-preset",variant:"tertiary",isPressed:!m,size:"small",accessibleWhenDisabled:!1,disabled:!!m,children:(0,Ut.__)("Custom")})]}),(0,a.jsxs)(s.__experimentalHStack,{spacing:2,children:[(0,a.jsx)(s.__experimentalInputControl,{__next40pxDefaultSize:!0,ref:_,type:"date",label:(0,Ut.__)("From"),hideLabelFromVision:!0,value:f?.[0],onChange:e=>I("from",e),required:!!t.isValid?.required}),(0,a.jsx)(s.__experimentalInputControl,{__next40pxDefaultSize:!0,ref:S,type:"date",label:(0,Ut.__)("To"),hideLabelFromVision:!0,value:f?.[1],onChange:e=>I("to",e),required:!!t.isValid?.required})]}),(0,a.jsx)(ap,{style:{width:"100%"},selected:v,onSelect:j,month:w,onMonthChange:b,timeZone:M.string||void 0,weekStartsOn:E.startOfWeek})]})})})}var mp=(0,a.jsx)(Ji.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)(Ji.Path,{d:"M12.5939 21C14.1472 21 16.1269 20.5701 17.0711 20.1975L16.6447 18.879C16.0964 19.051 14.3299 19.6242 12.6548 19.6242C7.4467 19.6242 4.67513 16.8726 4.67513 12C4.67513 7.21338 7.50762 4.34713 12.2893 4.34713C17.132 4.34713 19.4162 7.55732 19.4162 10.7675C19.4162 14.035 19.0508 15.4968 17.4975 15.4968C16.5838 15.4968 16.0964 14.7803 16.0964 13.9777V7.5H14.4822V8.30255H14.3909C14.1777 7.67198 12.9898 7.12739 11.467 7.2707C9.18274 7.5 7.4467 9.27707 7.4467 11.8567C7.4467 14.5796 8.81726 16.672 11.467 16.758C13.203 16.8153 14.1168 16.0127 14.4822 15.1815H14.5736C14.7563 16.414 16.401 16.8439 17.467 16.8439C20.6954 16.8439 21 13.5764 21 10.7962C21 6.86943 18.0761 3 12.3807 3C6.50254 3 3 6.3535 3 11.9427C3 17.7325 6.38071 21 12.5939 21ZM11.7107 15.2962C9.73096 15.2962 9.03046 13.6051 9.03046 11.7707C9.03046 10.1083 10.0355 8.67516 11.7716 8.67516C13.599 8.67516 14.5736 9.36306 14.5736 11.7707C14.5736 14.1497 13.7513 15.2962 11.7107 15.2962Z"})});const{ValidatedInputControl:gp}=Bs(s.privateApis);function vp({data:e,field:t,onChange:n,hideLabelFromVision:r,type:i,prefix:s,suffix:l,validity:c}){const{label:u,placeholder:d,description:f,getValue:h,setValue:p,isValid:m}=t,g=h({item:e}),v=(0,o.useCallback)(t=>n(p({item:e,value:t})),[e,p,n]);return(0,a.jsx)(gp,{required:!!m?.required,customValidity:th(m,c),label:u,placeholder:d,value:g??"",help:f,onChange:v,hideLabelFromVision:r,type:i,prefix:s,suffix:l,__next40pxDefaultSize:!0})}var wp=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z"})}),bp=(0,a.jsx)(Ji.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(Ji.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})});const{ValidatedNumberControl:xp}=Bs(s.privateApis);function yp(e){if(""===e||void 0===e)return"";const t=Number(e);return Number.isFinite(t)?t:""}function _p({value:e,onChange:t,hideLabelFromVision:n,step:r}){const[i="",l=""]=e,c=(0,o.useCallback)(e=>t([yp(e),l]),[t,l]),u=(0,o.useCallback)(e=>t([i,yp(e)]),[t,i]);return(0,a.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,help:(0,Ut.__)("The max. value must be greater than the min. value."),children:(0,a.jsxs)(s.Flex,{direction:"row",gap:4,children:[(0,a.jsx)(s.__experimentalNumberControl,{label:(0,Ut.__)("Min."),value:i,max:l?Number(l)-r:void 0,onChange:c,__next40pxDefaultSize:!0,hideLabelFromVision:n,step:r}),(0,a.jsx)(s.__experimentalNumberControl,{label:(0,Ut.__)("Max."),value:l,min:i?Number(i)+r:void 0,onChange:u,__next40pxDefaultSize:!0,hideLabelFromVision:n,step:r})]})})}function Sp({data:e,field:t,onChange:n,hideLabelFromVision:r,operator:i,decimals:s,validity:l}){const c=Math.pow(10,-1*Math.abs(s)),{label:u,description:d,getValue:f,setValue:h,isValid:p}=t,m=f({item:e})??"",g=(0,o.useCallback)(t=>{n(h({item:e,value:["",void 0].includes(t)?void 0:Number(t)}))},[e,n,h]),v=(0,o.useCallback)(t=>{n(h({item:e,value:t}))},[e,n,h]);if(i===ms){let e=["",""];return Array.isArray(m)&&2===m.length&&m.every(e=>"number"==typeof e||""===e)&&(e=m),(0,a.jsx)(_p,{value:e,onChange:v,hideLabelFromVision:r,step:c})}return(0,a.jsx)(xp,{required:!!p?.required,customValidity:th(p,l),label:u,help:d,value:m,onChange:g,__next40pxDefaultSize:!0,hideLabelFromVision:r,step:c})}const{ValidatedRadioControl:Cp}=Bs(s.privateApis),{ValidatedSelectControl:jp}=Bs(s.privateApis),{ValidatedToggleControl:kp}=Bs(s.privateApis),{ValidatedTextareaControl:Ip}=Bs(s.privateApis),{ValidatedToggleGroupControl:Mp}=Bs(s.privateApis),{ValidatedFormTokenField:Ep}=Bs(s.privateApis),{ValidatedInputControl:Pp,Picker:Lp}=Bs(s.privateApis),Vp=({color:e,onColorChange:t})=>{const n=e&&Jf(e).isValid()?e:"#ffffff";return(0,a.jsx)(s.Dropdown,{renderToggle:({onToggle:e,isOpen:t})=>(0,a.jsx)(s.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,a.jsx)("button",{type:"button",onClick:e,style:{width:"24px",height:"24px",borderRadius:"50%",backgroundColor:n,border:"1px solid #ddd",cursor:"pointer",outline:t?"2px solid #007cba":"none",outlineOffset:"2px",display:"flex",alignItems:"center",justifyContent:"center",padding:0,margin:0},"aria-label":"Open color picker"})}),renderContent:()=>(0,a.jsx)("div",{style:{padding:"16px"},children:(0,a.jsx)(Lp,{color:Jf(n),onChange:t,enableAlpha:!0})})})};function Np(e){return Array.isArray(e.elements)&&e.elements.length>0||"function"==typeof e.getElements}const Op={array:function({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){const{label:l,placeholder:c,getValue:u,setValue:d,isValid:f}=t,h=u({item:e}),{elements:p,isLoading:m}=hd({elements:t.elements,getElements:t.getElements}),g=(0,o.useMemo)(()=>Array.isArray(h)?h.map(e=>{const t=p?.find(t=>t.value===e);return t||{value:e,label:e}}):[],[h,p]),v=(0,o.useCallback)(t=>{const r=t.map(e=>"object"==typeof e&&"value"in e?e.value:e);n(d({item:e,value:r}))},[n,d,e]);return m?(0,a.jsx)(s.Spinner,{}):(0,a.jsx)(Ep,{required:!!f?.required,customValidity:th(f,i),label:r?void 0:l,value:g,onChange:v,placeholder:c,suggestions:p?.map(e=>e.value),__experimentalValidateInput:e=>!t.isValid?.elements||!p||p.some(t=>t.value===e||t.label===e),__experimentalExpandOnFocus:p&&p.length>0,__experimentalShowHowTo:!t.isValid?.elements,displayTransform:e=>{if("object"==typeof e&&"label"in e)return e.label;if("string"==typeof e&&p){const t=p.find(t=>t.value===e);return t?.label||e}return e},__experimentalRenderItem:({item:e})=>{if("string"==typeof e&&p){const t=p.find(t=>t.value===e);return(0,a.jsx)("span",{children:t?.label||e})}return(0,a.jsx)("span",{children:e})}})},checkbox:function({field:e,onChange:t,data:n,hideLabelFromVision:r,validity:i}){const{getValue:s,setValue:l,label:c,description:u,isValid:d}=e,f=(0,o.useCallback)(()=>{t(l({item:n,value:!s({item:n})}))},[n,s,t,l]);return(0,a.jsx)(nh,{required:!!e.isValid?.required,customValidity:th(d,i),hidden:r,label:c,help:u,checked:s({item:n}),onChange:f})},color:function({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){const{label:s,placeholder:l,description:c,setValue:u,isValid:d}=t,f=t.getValue({item:e})||"",h=(0,o.useCallback)(t=>{n(u({item:e,value:t.toHex()}))},[e,n,u]),p=(0,o.useCallback)(t=>{n(u({item:e,value:t||""}))},[e,n,u]);return(0,a.jsx)(Pp,{required:!!t.isValid?.required,customValidity:th(d,i),label:s,placeholder:l,value:f,help:c,onChange:p,hideLabelFromVision:r,type:"text",prefix:(0,a.jsx)(Vp,{color:f,onColorChange:h})})},datetime:function({data:e,field:t,onChange:n,hideLabelFromVision:r,operator:i,validity:o}){return i===ws||i===bs?(0,a.jsx)(Zh,{className:"dataviews-controls__datetime",data:e,field:t,onChange:n,hideLabelFromVision:r,operator:i}):(0,a.jsx)(ep,{data:e,field:t,onChange:n,hideLabelFromVision:r,validity:o})},date:function({data:e,field:t,onChange:n,hideLabelFromVision:r,operator:i,validity:o}){return i===ws||i===bs?(0,a.jsx)(Zh,{className:"dataviews-controls__date",data:e,field:t,onChange:n,hideLabelFromVision:r,operator:i}):i===ms?(0,a.jsx)(pp,{data:e,field:t,onChange:n,hideLabelFromVision:r,validity:o}):(0,a.jsx)(hp,{data:e,field:t,onChange:n,hideLabelFromVision:r,validity:o})},email:function({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){return(0,a.jsx)(vp,{data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i,type:"email",prefix:(0,a.jsx)(s.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,a.jsx)(s.Icon,{icon:mp})})})},telephone:function({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){return(0,a.jsx)(vp,{data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i,type:"tel",prefix:(0,a.jsx)(s.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,a.jsx)(s.Icon,{icon:wp})})})},url:function({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){return(0,a.jsx)(vp,{data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i,type:"url",prefix:(0,a.jsx)(s.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,a.jsx)(s.Icon,{icon:bp})})})},integer:function(e){return(0,a.jsx)(Sp,{...e,decimals:0})},number:function(e){return(0,a.jsx)(Sp,{...e,decimals:2})},password:function({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){const[l,c]=(0,o.useState)(!1),u=(0,o.useCallback)(()=>{c(e=>!e)},[]);return(0,a.jsx)(vp,{data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i,type:l?"text":"password",suffix:(0,a.jsx)(s.__experimentalInputControlSuffixWrapper,{variant:"control",children:(0,a.jsx)(s.Button,{icon:l?ua:qd,onClick:u,size:"small",label:l?(0,Ut.__)("Hide password"):(0,Ut.__)("Show password")})})})},radio:function({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){const{label:l,description:c,getValue:u,setValue:d,isValid:f}=t,{elements:h,isLoading:p}=hd({elements:t.elements,getElements:t.getElements}),m=u({item:e}),g=(0,o.useCallback)(t=>n(d({item:e,value:t})),[e,n,d]);return p?(0,a.jsx)(s.Spinner,{}):(0,a.jsx)(Cp,{required:!!t.isValid?.required,customValidity:th(f,i),label:l,help:c,onChange:g,options:h,selected:m,hideLabelFromVision:r})},select:function({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){const{type:l,label:c,description:u,getValue:d,setValue:f,isValid:h}=t,p="array"===l,m=d({item:e})??(p?[]:""),g=(0,o.useCallback)(t=>n(f({item:e,value:t})),[e,n,f]),{elements:v,isLoading:w}=hd({elements:t.elements,getElements:t.getElements});return w?(0,a.jsx)(s.Spinner,{}):(0,a.jsx)(jp,{required:!!t.isValid?.required,customValidity:th(h,i),label:c,value:m,help:u,options:v,onChange:g,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:r,multiple:p})},text:function({data:e,field:t,onChange:n,hideLabelFromVision:r,config:i,validity:s}){const{prefix:l,suffix:c}=i||{};return(0,a.jsx)(vp,{data:e,field:t,onChange:n,hideLabelFromVision:r,validity:s,prefix:l?(0,o.createElement)(l):void 0,suffix:c?(0,o.createElement)(c):void 0})},toggle:function({field:e,onChange:t,data:n,hideLabelFromVision:r,validity:i}){const{label:s,description:l,getValue:c,setValue:u,isValid:d}=e,f=(0,o.useCallback)(()=>{t(u({item:n,value:!c({item:n})}))},[t,u,n,c]);return(0,a.jsx)(kp,{required:!!d.required,customValidity:th(d,i),hidden:r,__nextHasNoMarginBottom:!0,label:s,help:l,checked:c({item:n}),onChange:f})},textarea:function({data:e,field:t,onChange:n,hideLabelFromVision:r,config:i,validity:s}){const{rows:l=4}=i||{},{label:c,placeholder:u,description:d,setValue:f,isValid:h}=t,p=t.getValue({item:e}),m=(0,o.useCallback)(t=>n(f({item:e,value:t})),[e,n,f]);return(0,a.jsx)(Ip,{required:!!h?.required,customValidity:th(h,s),label:c,placeholder:u,value:p??"",help:d,onChange:m,rows:l,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:r})},toggleGroup:function({data:e,field:t,onChange:n,hideLabelFromVision:r,validity:i}){const{getValue:l,setValue:c,isValid:u}=t,d=l({item:e}),f=(0,o.useCallback)(t=>n(c({item:e,value:t})),[e,n,c]),{elements:h,isLoading:p}=hd({elements:t.elements,getElements:t.getElements});if(p)return(0,a.jsx)(s.Spinner,{});if(0===h.length)return null;const m=h.find(e=>e.value===d);return(0,a.jsx)(Mp,{required:!!t.isValid?.required,customValidity:th(u,i),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,isBlock:!0,label:t.label,help:m?.description||t.description,onChange:f,value:d,hideLabelFromVision:r,children:h.map(e=>(0,a.jsx)(s.__experimentalToggleGroupControlOption,{label:e.label,value:e.value},e.value))})}};function Rp(e){return e&&"object"==typeof e&&"string"==typeof e.control}function Fp(e){const{control:t,...n}=e,r=Tp(t);return function(e){return(0,a.jsx)(r,{...e,config:n})}}function Tp(e){if(Object.keys(Op).includes(e))return Op[e];throw"Control "+e+" not found"}const Ap=e=>e.id,Dp=()=>!0,Bp=[],zp=Oa.filter(e=>!e.isPicker);function $p({header:e,search:t=!0,searchLabel:n}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(s.__experimentalHStack,{alignment:"top",justify:"space-between",className:"dataviews__view-actions",spacing:1,children:[(0,a.jsxs)(s.__experimentalHStack,{justify:"start",expanded:!1,className:"dataviews__search",children:[t&&(0,a.jsx)(zd,{label:n}),(0,a.jsx)(Da,{})]}),(0,a.jsxs)(s.__experimentalHStack,{spacing:1,expanded:!1,style:{flexShrink:0},children:[(0,a.jsx)(df,{}),e]})]}),(0,a.jsx)(Nd,{className:"dataviews-filters__container"}),(0,a.jsx)(Od,{}),(0,a.jsx)(Bd,{})]})}const Hp=function({view:e,onChangeView:t,fields:n,search:r=!0,searchLabel:i,actions:s=Bp,data:l,getItemId:c=Ap,getItemLevel:u,isLoading:d=!1,paginationInfo:f,defaultLayouts:h,selection:p,onChangeSelection:m,onClickItem:g,renderItemLink:v,isItemClickable:w=Dp,header:b,children:x,config:y={perPageSizes:[10,20,50,100]},empty:_}){const{infiniteScrollHandler:S}=f,C=(0,o.useRef)(null),[j,k]=(0,o.useState)(0),I=(0,So.useResizeObserver)(e=>{k(e[0].borderBoxSize[0].inlineSize)},{box:"border-box"}),[M,E]=(0,o.useState)([]),P=void 0===p||void 0===m,L=P?M:p,[V,N]=(0,o.useState)(null),O=(0,o.useMemo)(()=>function(e){return e.map(e=>{const t=function(e){return"email"===e?pf:"integer"===e?mf:"number"===e?gf:"text"===e?vf:"datetime"===e?wf:"date"===e?xf:"boolean"===e?yf:"media"===e?_f:"array"===e?Cf:"password"===e?jf:"telephone"===e?kf:"color"===e?Qf:"url"===e?eh:{sort:(e,t,n)=>"number"==typeof e&&"number"==typeof t?"asc"===n?e-t:t-e:"asc"===n?e.localeCompare(t):t.localeCompare(e),isValid:{elements:!0,custom:()=>null},Edit:null,render:({item:e,field:t})=>t.hasElements?(0,a.jsx)(ff,{item:e,field:t}):t.getValue({item:e}),enableSorting:!0,filterBy:{defaultOperators:[Jo,Qo],validOperators:xs}}}(e.type),n=e.getValue||(r=e.id,({item:e})=>{const t=r.split(".");let n=e;for(const e of t)n=n.hasOwnProperty(e)?n[e]:void 0;return n});var r;const i=e.setValue||(e=>({value:t})=>{const n=e.split("."),r={};let i=r;for(const e of n.slice(0,-1))i[e]={},i=i[e];return i[n.at(-1)]=t,r})(e.id),o=e.sort??function(e,r,i){return t.sort(n({item:e}),n({item:r}),i)},s={...t.isValid,...e.isValid},l=function(e,t){return"function"==typeof e.Edit?e.Edit:"string"==typeof e.Edit?Tp(e.Edit):Rp(e.Edit)?Fp(e.Edit):Np(e)&&"array"!==e.type?Tp("select"):"string"==typeof t.Edit?Tp(t.Edit):Rp(t.Edit)?Fp(t.Edit):t.Edit}(e,t),c=e.render??function({item:e,field:n}){return t.render({item:e,field:n})},u=function(e,t){if(!1===e.filterBy)return!1;if("object"==typeof e.filterBy){let n=e.filterBy.operators;n&&Array.isArray(n)||(n=t.filterBy?t.filterBy.defaultOperators:[]);let r=xs;return"object"==typeof t.filterBy&&(r=t.filterBy.validOperators),n=n.filter(e=>r.includes(e)),Np(e)&&n.includes(ms)&&(n=n.filter(e=>e!==ms)),n.some(e=>ys.includes(e))&&(n=n.filter(e=>[...ys,ms].includes(e))),0!==n.length&&{isPrimary:!!e.filterBy.isPrimary,operators:n}}if(!1===t.filterBy)return!1;let n=t.filterBy.defaultOperators;return Np(e)&&n.includes(ms)&&(n=n.filter(e=>e!==ms)),{operators:n}}(e,t);return{...e,label:e.label||e.id,header:e.header||e.label||e.id,getValue:n,setValue:i,render:c,sort:o,isValid:s,Edit:l,hasElements:Np(e),enableHiding:e.enableHiding??!0,enableSorting:e.enableSorting??t.enableSorting??!0,filterBy:u,readOnly:e.readOnly??t.readOnly??!1}})}(n),[n]),R=(0,o.useMemo)(()=>L.filter(e=>l.some(t=>c(t)===e)),[L,l,c]),F=Ld(O,e),T=(0,o.useMemo)(()=>(F||[]).some(e=>e.isPrimary||e.isLocked),[F]),[A,D]=(0,o.useState)(T);(0,o.useEffect)(()=>{T&&!A&&D(!0)},[T,A]),(0,o.useEffect)(()=>{if(!e.infiniteScrollEnabled||!C.current)return;const t=(0,So.throttle)(e=>{const t=e.target,n=t.scrollTop,r=t.scrollHeight;n+t.clientHeight>=r-100&&S?.()},100),n=C.current;return n.addEventListener("scroll",t),()=>{n.removeEventListener("scroll",t),t.cancel()}},[S,e.infiniteScrollEnabled]);const B=(0,o.useMemo)(()=>Object.fromEntries(Object.entries(h).filter(([e])=>zp.some(t=>t.type===e))),[h]);return B[e.type]?(0,a.jsx)(Ls.Provider,{value:{view:e,onChangeView:t,fields:O,actions:s,data:l,isLoading:d,paginationInfo:f,selection:R,onChangeSelection:function(e){const t="function"==typeof e?e(L):e;P&&E(t),m&&m(t)},openedFilter:V,setOpenedFilter:N,getItemId:c,getItemLevel:u,isItemClickable:w,onClickItem:g,renderItemLink:v,containerWidth:j,containerRef:C,resizeObserverRef:I,defaultLayouts:B,filters:F,isShowingFilter:A,setIsShowingFilter:D,config:y,empty:_,hasInfiniteScrollHandler:!!S},children:(0,a.jsx)("div",{className:"dataviews-wrapper",ref:C,children:x??(0,a.jsx)($p,{header:b,search:r,searchLabel:i})})}):null};Hp.BulkActionToolbar=sa,Hp.Filters=Vd,Hp.FiltersToggled=Nd,Hp.FiltersToggle=Da,Hp.Layout=Od,Hp.LayoutSwitcher=Jd,Hp.Pagination=Td,Hp.Search=zd,Hp.ViewConfig=cf,Hp.Footer=Bd;var Wp=Hp;function qp({onSelectItem:e}){const{items:t,isLoading:n}=Ko("followers"),[r,i]=(0,o.useState)({type:"table",perPage:20,page:1}),l=[{id:"name",label:"Name",enableSorting:!0,render:({item:t})=>(0,a.jsx)("button",{onClick:()=>e(t.id),style:{background:"none",border:"none",color:"var(--wpds-color-bg-interactive-brand, #3858e9)",cursor:"pointer",textAlign:"left"},children:t.name})},{id:"url",label:"URL",enableSorting:!1},{id:"followers",label:"Followers",enableSorting:!0}];return(0,a.jsx)(Bo,{title:"Followers",subTitle:"Manage and view your followers",hasPadding:!1,actions:(0,a.jsx)(s.Button,{variant:"primary",children:"Add Follower"}),children:(0,a.jsx)(Wp,{data:t||[],fields:l,view:r,onChangeView:i,isLoading:n,paginationInfo:{totalItems:t?.length||0,totalPages:1}})})}function Up({id:e,onClose:t}){const{items:n,isLoading:r}=Ko("followers",e);return r?(0,a.jsx)("div",{children:"Loading..."}):n?(0,a.jsxs)(Bo,{title:n.name,hasPadding:!0,actions:(0,a.jsx)(s.Button,{size:"small",onClick:t,children:"Close"}),children:[(0,a.jsx)(s.Card,{children:(0,a.jsxs)(s.CardBody,{children:[(0,a.jsx)("h3",{children:"Overview"}),(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:"URL:"})," ",n.url]}),(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{children:"Followers:"})," ",n.followers]})]})}),(0,a.jsx)(s.Card,{children:(0,a.jsxs)(s.CardBody,{children:[(0,a.jsx)("h3",{children:"Recent Activity"}),(0,a.jsx)("p",{children:"Activity timeline coming soon..."})]})})]}):(0,a.jsx)("div",{children:"Follower not found"})}function Gp({onSelectItem:e}){return(0,a.jsx)(Bo,{title:"Following",subTitle:"Accounts you follow",hasPadding:!0,contentWidth:"constrained",children:(0,a.jsx)("p",{children:"Following list coming soon..."})})}function Kp({id:e,onClose:t}){return(0,a.jsx)(Bo,{title:"Following Details",hasPadding:!0,actions:(0,a.jsx)(s.Button,{size:"small",onClick:t,children:"Close"}),children:(0,a.jsxs)("p",{children:["Following details for ID: ",e]})})}function Yp({onSelectItem:e}){return(0,a.jsx)(Bo,{title:"Interactions",subTitle:"Your ActivityPub interactions",hasPadding:!0,contentWidth:"constrained",children:(0,a.jsx)("p",{children:"Interactions list coming soon..."})})}function Zp({id:e,onClose:t}){return(0,a.jsx)(Bo,{title:"Interaction Details",hasPadding:!0,actions:(0,a.jsx)(s.Button,{size:"small",onClick:t,children:"Close"}),children:(0,a.jsxs)("p",{children:["Interaction details for ID: ",e]})})}const Xp=[{id:"home",path:"/",label:(0,Ut.__)("Dashboard"),icon:Fo,component:function(){return(0,a.jsx)(Yo,{})}},{id:"followers",path:"/followers",label:(0,Ut.__)("Followers"),icon:To,component:function(){const[e,t]=(0,o.useState)(null);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(qp,{onSelectItem:t}),e&&(0,a.jsx)("div",{className:"inspector-region",children:(0,a.jsx)(Up,{id:e,onClose:()=>t(null)})})]})}},{id:"following",path:"/following",label:(0,Ut.__)("Following"),icon:Ao,component:function(){const[e,t]=(0,o.useState)(null);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Gp,{onSelectItem:t}),e&&(0,a.jsx)("div",{className:"inspector-region",children:(0,a.jsx)(Kp,{id:e,onClose:()=>t(null)})})]})}},{id:"interactions",path:"/interactions",label:(0,Ut.__)("Interactions"),icon:Do,component:function(){const[e,t]=(0,o.useState)(null);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Yp,{onSelectItem:t}),e&&(0,a.jsx)("div",{className:"inspector-region",children:(0,a.jsx)(Zp,{id:e,onClose:()=>t(null)})})]})}}];Xp.map(e=>({id:e.id,label:e.label,to:e.path,icon:e.icon})).forEach(e=>{(0,Gt.dispatch)(ho).registerMenuItem(e.id,e)});const Jp=new we({component:function(){return(0,a.jsx)(Ro,{isRoot:!0,color:{bg:"#f8f8f8",primary:"#3858e9"},children:(0,a.jsx)(Ro,{color:{bg:"#1e1e1e",primary:"#3858e9"},children:(0,a.jsxs)("div",{className:"boot-layout",children:[(0,a.jsx)(Kt.CommandMenu,{}),(0,a.jsxs)("div",{className:"boot-layout__content",children:[(0,a.jsx)("div",{className:"boot-layout__sidebar-region",children:(0,a.jsx)("div",{className:"boot-layout__sidebar",children:(0,a.jsx)(Oo,{})})}),(0,a.jsx)(Ro,{color:{bg:"#ffffff",primary:"#3858e9"},children:(0,a.jsx)("div",{className:"boot-layout__stage",children:(0,a.jsx)(zt,{})})})]})]})})})}}),Qp=function(e){return Xp.map(t=>ve({getParentRoute:()=>e,path:t.path,component:t.component}))}(Jp),em=Jp.addChildren(Qp);const tm=Se({parseLocation:()=>{const e=new URL(window.location.href);return Ce(`${e.searchParams.get("p")||"/"}${e.hash}`,window.history.state)},createHref:e=>{const t=new URLSearchParams(window.location.search);return t.set("p",e),`${window.location.pathname}?${t}`}}),nm=new class extends wt{constructor(e){super(e)}}({history:tm,routeTree:em,defaultNotFoundComponent:function(){return(0,a.jsx)("div",{className:"boot-layout__stage",style:{padding:"24px"},children:(0,a.jsx)("h1",{children:(0,Ut.__)("Route not found")})})}});function rm(){return(0,a.jsx)(qt,{router:nm})}window.wp=window.wp||{},window.wp.activitypubSocialWeb={initialize:function(e){const t=document.getElementById(e);t&&(0,o.createRoot)(t).render((0,a.jsx)(o.StrictMode,{children:(0,a.jsx)(s.SlotFillProvider,{children:(0,a.jsx)(rm,{})})}))}}},493:(e,t,n)=>{"use strict";var r=n(609),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useState,s=r.useEffect,a=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=o({inst:{value:n,getSnapshot:t}}),i=r[0].inst,u=r[1];return a(function(){i.value=n,i.getSnapshot=t,c(i)&&u({inst:i})},[e,n,t]),s(function(){return c(i)&&u({inst:i}),e(function(){c(i)&&u({inst:i})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},609:e=>{"use strict";e.exports=window.React},731:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),r=new RegExp(n,"g"),i=new RegExp(n,"");function o(e){return t[e]}var s=function(e){return e.replace(r,o)};e.exports=s,e.exports.has=function(e){return!!e.match(i)},e.exports.remove=s},888:(e,t,n)=>{"use strict";e.exports=n(493)}},i={};function o(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.m=r,e=[],o.O=(t,n,r,i)=>{if(!n){var s=1/0;for(u=0;u=i)&&Object.keys(o.O).every(e=>o.O[e](n[l]))?n.splice(l--,1):(a=!1,i0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,r,i]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var i=Object.create(null);o.r(i);var s={};t=t||[null,n({}),n([]),n(n)];for(var a=2&r&&e;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach(t=>s[t]=()=>e[t]);return s.default=()=>e,o.d(i,s),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={994:0,982:0};o.O.j=t=>0===e[t];var t=(t,n)=>{var r,i,[s,a,l]=n,c=0;if(s.some(t=>0!==e[t])){for(r in a)o.o(a,r)&&(o.m[r]=a[r]);if(l)var u=l(o)}for(t&&t(n);co(427));s=o.O(s)})(); \ No newline at end of file diff --git a/build/social-web/style-index-rtl.css b/build/social-web/style-index-rtl.css index ab1ccd88d..9832d069e 100644 --- a/build/social-web/style-index-rtl.css +++ b/build/social-web/style-index-rtl.css @@ -1,7 +1,11 @@ -.site-hub{align-items:center;display:flex;gap:var(--wpds-spacing-20,8px);height:var(--wpds-spacing-160,64px);justify-content:space-between;margin-left:var(--wpds-spacing-30,12px)}.site-hub__actions{flex-shrink:0}.site-hub__icon-container{flex-shrink:0;height:var(--wpds-spacing-160,64px);width:var(--wpds-spacing-160,64px)}.site-hub__icon-container.has-transparent-background .site-hub__icon-container{background:transparent}.site-hub__icon-button.components-button{align-items:center;background:var(--wpds-color-bg-surface-neutral-weak,#1e1e1e);border-radius:0;display:flex;height:var(--wpds-spacing-160,64px);justify-content:center;overflow:hidden;padding:0;position:relative;view-transition-name:toggle;width:var(--wpds-spacing-160,64px)}.site-hub__icon-button.components-button,.site-hub__icon-button.components-button:active,.site-hub__icon-button.components-button:hover{color:var(--wpds-color-fg-inverted-primary,#fff)}.site-hub__icon-button.components-button:focus,.site-hub__icon-button.components-button:focus-visible{box-shadow:0 0 0 3px #1e1e1e,0 0 0 6px var(--wp-admin-theme-color);outline:4px solid transparent;outline-offset:4px}.site-hub__icon-button.components-button:before{border-radius:var(--wpds-border-radius-large,8px);bottom:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px));box-shadow:none;content:"";display:block;right:calc(var(--wpds-spacing-40, 16px) + var(--wpds-border-width-focus, 1px));position:absolute;left:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px));top:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px))}@media not (prefers-reduced-motion){.site-hub__icon-button.components-button:before{transition:box-shadow .1s ease}}.site-hub__icon-button.components-button .site-icon{align-items:center;display:flex;height:var(--wpds-spacing-160,64px);justify-content:center;width:var(--wpds-spacing-160,64px)}.site-hub__icon-button.components-button .site-icon__icon{fill:currentColor;height:100%;width:100%}.site-hub__title .components-button{display:block;flex-grow:1;font-size:var(--wpds-font-size-medium,15px);font-weight:var(--wpds-font-weight-medium,500);margin-right:-4px;overflow:hidden;padding-left:var(--wpds-spacing-40,16px);position:relative;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.site-hub__title .components-button,.site-hub__title .components-button:active,.site-hub__title .components-button:focus,.site-hub__title .components-button:hover{color:var(--wpds-color-fg-inverted-secondary,#e0e0e0)}.site-hub__title .components-button:focus{box-shadow:none;outline:none}.site-hub__title .components-button:focus-visible{box-shadow:0 0 0 var(--wp-admin-border-width-focus) #1e1e1e,0 0 0 calc(var(--wp-admin-border-width-focus)*2) var(--wpds-color-stroke-focus-brand,#0675c4);outline:2px solid transparent;outline-offset:2px}.site-hub__title .components-button:after{content:"↗";font-weight:400;opacity:0;position:absolute;left:0}@media not (prefers-reduced-motion){.site-hub__title .components-button:after{transition:opacity .1s linear}}.site-hub__title .components-button:active:after,.site-hub__title .components-button:focus:after,.site-hub__title .components-button:hover:after{opacity:1}.site-hub__command-button{color:var(--wpds-color-fg-inverted-secondary,#e0e0e0)}.site-hub__command-button:active svg,.site-hub__command-button:hover svg{fill:var(--wpds-color-private-bg-fg-fill,#f0f0f0)} -.sidebar{color:var(--wpds-color-fg-inverted-secondary,#ccc);display:flex;flex:1;flex-direction:column}.sidebar .nav{flex:1;overflow-y:auto;padding:0 var(--wpds-spacing-30,12px)}.sidebar .sidebar-navigation__icon-title{background:var(--wpds-color-bg-surface-neutral-weak,#1e1e1e);margin-bottom:var(--wpds-spacing-20,8px);padding-bottom:var(--wpds-spacing-20,8px);padding-top:var(--wpds-spacing-120,48px);position:sticky;top:0}.sidebar .sidebar-navigation__button{color:var(--wpds-color-fg-inverted-secondary,#e0e0e0);flex-shrink:0}.sidebar .sidebar-navigation__button:focus:not(:disabled){box-shadow:none;outline:none}.sidebar .sidebar-navigation__button:focus-visible:not(:disabled){box-shadow:0 0 0 var(--wpds-border-width-focus,1.5px) var(--wp-admin-theme-color);outline:3px solid transparent}.sidebar .sidebar-navigation__button:focus,.sidebar .sidebar-navigation__button:focus-visible,.sidebar .sidebar-navigation__button:hover:not(:disabled,[aria-disabled=true]),.sidebar .sidebar-navigation__button:not(:disabled,[aria-disabled=true]):active,.sidebar .sidebar-navigation__button[aria-expanded=true]{color:var(--wpds-color-private-bg-fg-fill,#f0f0f0)}.sidebar .sidebar-navigation__title{color:var(--wpds-color-fg-inverted-secondary,#e0e0e0);flex-grow:1;line-height:var(--wpds-spacing-80,32px);overflow-wrap:break-word}.sidebar .menu-item{align-items:center;color:var(--wpds-color-fg-inverted-secondary,#e0e0e0);display:flex;gap:var(--wpds-spacing-20,8px)}.sidebar .menu-item:hover{background-color:var(--wpds-color-bg-interactive-neutral-hover,hsla(0,0%,100%,.1));color:var(--wpds-color-fg-inverted-primary,#fff)}.sidebar .menu-item.is-selected{background-color:var(--wpds-color-bg-interactive-neutral-active,hsla(0,0%,100%,.15));color:var(--wpds-color-fg-inverted-primary,#fff)}.sidebar .menu-item svg{flex-shrink:0}.sidebar .footer{border-top:1px solid var(--wpds-color-stroke-inverted,hsla(0,0%,100%,.1));padding:var(--wpds-spacing-40,16px)} -.themed-surface{background:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-large,8px);display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden} -.panel{display:flex;flex:1;flex-direction:column;margin:var(--wpds-spacing-40,16px) 0 var(--wpds-spacing-40,16px) var(--wpds-spacing-40,16px);min-height:0} -#activitypub-social-web-root>div{height:100%}.app-layout{flex-direction:column}.app-content,.app-layout{background-color:var(--wpds-color-bg-surface-neutral-weak,#1e1e1e);display:flex;height:100%;overflow:hidden;width:100%}.app-content{flex-grow:1}.sidebar-region{flex-shrink:0;width:300px}.sidebar-region,.stage-region{display:flex;flex-direction:column}.stage-region{flex-grow:1;min-width:400px}.inspector-region{display:flex;flex-direction:column;flex-shrink:0;width:var(--sw-inspector-width)}@media(max-width:782px){.app-content{flex-direction:column}.inspector-region,.sidebar-region{width:100%}} +.oCdkMr1YS5uhKiwZlTit{display:contents} +.boot-site-icon{display:flex}.boot-site-icon__icon{color:var(--wpds-color-fg-content-neutral,#1e1e1e);height:32px;width:32px}.boot-site-icon__image{aspect-ratio:1/1;border-radius:var(--wpds-border-radius-medium,4px);height:32px;-o-object-fit:cover;object-fit:cover;width:32px} +.boot-site-icon-link{align-items:center;background:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);display:inline-flex;height:64px;justify-content:center;text-decoration:none;width:64px}@media not (prefers-reduced-motion){.boot-site-icon-link{transition:outline .1s ease-out}}.boot-site-icon-link:focus:not(:active){outline:var(--wpds-border-width-focus,2px) solid var(--wpds-color-stroke-focus-brand,#0073aa);outline-offset:calc(var(--wpds-border-width-focus, 2px)*-1)} +.boot-site-hub{align-items:center;background-color:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);display:grid;flex-shrink:0;grid-template-columns:60px 1fr auto;padding-left:16px;position:sticky;top:0;z-index:1}.boot-site-hub__actions{flex-shrink:0}.boot-site-hub__title{color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-size:13px;font-weight:499;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.boot-site-hub__title .components-external-link__contents{margin-inline-start:4px;text-decoration:none}.boot-site-hub__title .components-external-link__icon{opacity:0;transition:opacity .1s ease-out}.boot-site-hub__title:hover .components-external-link__icon{opacity:1}@media not (prefers-reduced-motion){.boot-site-hub__title{transition:outline .1s ease-out}}.boot-site-hub__title:focus:not(:active){outline:var(--wpds-border-width-focus,2px) solid var(--wpds-color-stroke-focus-brand,#0073aa);outline-offset:calc(var(--wpds-border-width-focus, 2px)*-1)} +.boot-navigation-item.components-item{align-items:center;border:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);display:flex;font-family:-apple-system,"system-ui",Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:400;line-height:20px;margin-block-end:4px;margin-inline:12px;min-height:32px;padding-block:0;padding-inline:4px;width:calc(100% - 24px)}.boot-dropdown-item__children .boot-navigation-item.components-item{min-height:24px}.boot-navigation-item.components-item{border-radius:var(--wpds-border-radius-small,2px)}.boot-navigation-item.components-item.active,.boot-navigation-item.components-item:focus,.boot-navigation-item.components-item:hover,.boot-navigation-item.components-item[aria-current=true]{color:var(--wpds-color-fg-interactive-brand-active,#0073aa)}.boot-navigation-item.components-item.active{font-weight:499}.boot-navigation-item.components-item svg:last-child{padding:4px}.boot-navigation-item.components-item[aria-current=true]{color:var(--wpds-color-fg-interactive-brand-active,#0073aa);font-weight:499}.boot-navigation-item.components-item:focus-visible{transform:translateZ(0)}.boot-navigation-item.components-item.with-suffix{padding-left:16px} +.boot-dropdown-item__children{display:flex;flex-direction:column;margin-block-end:2px;margin-block-start:-2px;margin-inline-start:30px;overflow:hidden;padding:2px}.boot-dropdown-item__chevron.is-up{transform:rotate(-180deg)} +.boot-navigation-screen{padding-block-end:4px}.boot-navigation-screen .components-text{color:var(--wpds-color-fg-content-neutral,#1e1e1e)}.boot-navigation-screen__title-icon{padding:12px 16px 8px;position:sticky;top:0}.boot-navigation-screen__title{flex-grow:1;overflow-wrap:break-word}.boot-navigation-screen__title.boot-navigation-screen__title,.boot-navigation-screen__title.boot-navigation-screen__title .boot-navigation-screen__title{color:var(--wpds-color-fg-content-neutral,#1e1e1e);line-height:32px}.boot-navigation-screen__actions{display:flex;flex-shrink:0} +.boot-sidebar__scrollable{display:flex;flex-direction:column;height:100%;overflow:auto;position:relative}.boot-sidebar__content{contain:content;flex-grow:1;position:relative} +.boot-layout{background:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;height:100%;isolation:isolate}.boot-layout__content{display:flex;flex-grow:1;height:100%}.boot-layout__sidebar-region{flex-shrink:0;width:240px}.boot-layout__sidebar{height:100%;overflow:hidden;position:relative}.boot-layout__stage{background:var(--wpds-color-bg-surface-neutral,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#ddd);border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.1);color:var(--wpds-color-fg-content-neutral,#1e1e1e);flex:1;margin:8px;overflow-y:auto} .page{display:flex;flex-direction:column;height:100%}.header{flex-shrink:0;padding:var(--wpds-spacing-60,24px)}.header.has-border{border-bottom:var(--wpds-border-width-focus,1px) solid var(--wpds-color-stroke-surface-neutral,#ddd)}.title-row{gap:var(--wpds-spacing-40,16px);justify-content:space-between}.title-group,.title-row{align-items:center;display:flex}.title-group{gap:var(--wpds-spacing-30,12px)}.title{color:var(--wpds-color-fg-primary,#1e1e1e);font-size:var(--wpds-font-size-large,20px);font-weight:500;margin:0}.sub-title{color:var(--wpds-color-fg-secondary,#757575);font-size:var(--wpds-font-size-small,13px);margin:var(--wpds-spacing-20,8px) 0 0}.content{display:flex;flex:1;flex-direction:column;gap:var(--wpds-spacing-60,24px);overflow:auto}.content.padded{padding:var(--wpds-spacing-60,24px)}.content.constrained{margin:0 auto;max-width:960px;width:100%}.content.full{padding:0} :root{--sw-sidebar-width:300px;--sw-inspector-width:380px}.activitypub-social-web-layout{bottom:0;right:0;position:fixed;left:0;top:0}#wpfooter{display:none} diff --git a/build/social-web/style-index.css b/build/social-web/style-index.css index 8bc03a001..9bdd6862e 100644 --- a/build/social-web/style-index.css +++ b/build/social-web/style-index.css @@ -1,7 +1,11 @@ -.site-hub{align-items:center;display:flex;gap:var(--wpds-spacing-20,8px);height:var(--wpds-spacing-160,64px);justify-content:space-between;margin-right:var(--wpds-spacing-30,12px)}.site-hub__actions{flex-shrink:0}.site-hub__icon-container{flex-shrink:0;height:var(--wpds-spacing-160,64px);width:var(--wpds-spacing-160,64px)}.site-hub__icon-container.has-transparent-background .site-hub__icon-container{background:transparent}.site-hub__icon-button.components-button{align-items:center;background:var(--wpds-color-bg-surface-neutral-weak,#1e1e1e);border-radius:0;display:flex;height:var(--wpds-spacing-160,64px);justify-content:center;overflow:hidden;padding:0;position:relative;view-transition-name:toggle;width:var(--wpds-spacing-160,64px)}.site-hub__icon-button.components-button,.site-hub__icon-button.components-button:active,.site-hub__icon-button.components-button:hover{color:var(--wpds-color-fg-inverted-primary,#fff)}.site-hub__icon-button.components-button:focus,.site-hub__icon-button.components-button:focus-visible{box-shadow:0 0 0 3px #1e1e1e,0 0 0 6px var(--wp-admin-theme-color);outline:4px solid transparent;outline-offset:4px}.site-hub__icon-button.components-button:before{border-radius:var(--wpds-border-radius-large,8px);bottom:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px));box-shadow:none;content:"";display:block;left:calc(var(--wpds-spacing-40, 16px) + var(--wpds-border-width-focus, 1px));position:absolute;right:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px));top:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px))}@media not (prefers-reduced-motion){.site-hub__icon-button.components-button:before{transition:box-shadow .1s ease}}.site-hub__icon-button.components-button .site-icon{align-items:center;display:flex;height:var(--wpds-spacing-160,64px);justify-content:center;width:var(--wpds-spacing-160,64px)}.site-hub__icon-button.components-button .site-icon__icon{fill:currentColor;height:100%;width:100%}.site-hub__title .components-button{display:block;flex-grow:1;font-size:var(--wpds-font-size-medium,15px);font-weight:var(--wpds-font-weight-medium,500);margin-left:-4px;overflow:hidden;padding-right:var(--wpds-spacing-40,16px);position:relative;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.site-hub__title .components-button,.site-hub__title .components-button:active,.site-hub__title .components-button:focus,.site-hub__title .components-button:hover{color:var(--wpds-color-fg-inverted-secondary,#e0e0e0)}.site-hub__title .components-button:focus{box-shadow:none;outline:none}.site-hub__title .components-button:focus-visible{box-shadow:0 0 0 var(--wp-admin-border-width-focus) #1e1e1e,0 0 0 calc(var(--wp-admin-border-width-focus)*2) var(--wpds-color-stroke-focus-brand,#0675c4);outline:2px solid transparent;outline-offset:2px}.site-hub__title .components-button:after{content:"↗";font-weight:400;opacity:0;position:absolute;right:0}@media not (prefers-reduced-motion){.site-hub__title .components-button:after{transition:opacity .1s linear}}.site-hub__title .components-button:active:after,.site-hub__title .components-button:focus:after,.site-hub__title .components-button:hover:after{opacity:1}.site-hub__command-button{color:var(--wpds-color-fg-inverted-secondary,#e0e0e0)}.site-hub__command-button:active svg,.site-hub__command-button:hover svg{fill:var(--wpds-color-private-bg-fg-fill,#f0f0f0)} -.sidebar{color:var(--wpds-color-fg-inverted-secondary,#ccc);display:flex;flex:1;flex-direction:column}.sidebar .nav{flex:1;overflow-y:auto;padding:0 var(--wpds-spacing-30,12px)}.sidebar .sidebar-navigation__icon-title{background:var(--wpds-color-bg-surface-neutral-weak,#1e1e1e);margin-bottom:var(--wpds-spacing-20,8px);padding-bottom:var(--wpds-spacing-20,8px);padding-top:var(--wpds-spacing-120,48px);position:sticky;top:0}.sidebar .sidebar-navigation__button{color:var(--wpds-color-fg-inverted-secondary,#e0e0e0);flex-shrink:0}.sidebar .sidebar-navigation__button:focus:not(:disabled){box-shadow:none;outline:none}.sidebar .sidebar-navigation__button:focus-visible:not(:disabled){box-shadow:0 0 0 var(--wpds-border-width-focus,1.5px) var(--wp-admin-theme-color);outline:3px solid transparent}.sidebar .sidebar-navigation__button:focus,.sidebar .sidebar-navigation__button:focus-visible,.sidebar .sidebar-navigation__button:hover:not(:disabled,[aria-disabled=true]),.sidebar .sidebar-navigation__button:not(:disabled,[aria-disabled=true]):active,.sidebar .sidebar-navigation__button[aria-expanded=true]{color:var(--wpds-color-private-bg-fg-fill,#f0f0f0)}.sidebar .sidebar-navigation__title{color:var(--wpds-color-fg-inverted-secondary,#e0e0e0);flex-grow:1;line-height:var(--wpds-spacing-80,32px);overflow-wrap:break-word}.sidebar .menu-item{align-items:center;color:var(--wpds-color-fg-inverted-secondary,#e0e0e0);display:flex;gap:var(--wpds-spacing-20,8px)}.sidebar .menu-item:hover{background-color:var(--wpds-color-bg-interactive-neutral-hover,hsla(0,0%,100%,.1));color:var(--wpds-color-fg-inverted-primary,#fff)}.sidebar .menu-item.is-selected{background-color:var(--wpds-color-bg-interactive-neutral-active,hsla(0,0%,100%,.15));color:var(--wpds-color-fg-inverted-primary,#fff)}.sidebar .menu-item svg{flex-shrink:0}.sidebar .footer{border-top:1px solid var(--wpds-color-stroke-inverted,hsla(0,0%,100%,.1));padding:var(--wpds-spacing-40,16px)} -.themed-surface{background:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-large,8px);display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden} -.panel{display:flex;flex:1;flex-direction:column;margin:var(--wpds-spacing-40,16px) var(--wpds-spacing-40,16px) var(--wpds-spacing-40,16px) 0;min-height:0} -#activitypub-social-web-root>div{height:100%}.app-layout{flex-direction:column}.app-content,.app-layout{background-color:var(--wpds-color-bg-surface-neutral-weak,#1e1e1e);display:flex;height:100%;overflow:hidden;width:100%}.app-content{flex-grow:1}.sidebar-region{flex-shrink:0;width:300px}.sidebar-region,.stage-region{display:flex;flex-direction:column}.stage-region{flex-grow:1;min-width:400px}.inspector-region{display:flex;flex-direction:column;flex-shrink:0;width:var(--sw-inspector-width)}@media(max-width:782px){.app-content{flex-direction:column}.inspector-region,.sidebar-region{width:100%}} +.oCdkMr1YS5uhKiwZlTit{display:contents} +.boot-site-icon{display:flex}.boot-site-icon__icon{color:var(--wpds-color-fg-content-neutral,#1e1e1e);height:32px;width:32px}.boot-site-icon__image{aspect-ratio:1/1;border-radius:var(--wpds-border-radius-medium,4px);height:32px;-o-object-fit:cover;object-fit:cover;width:32px} +.boot-site-icon-link{align-items:center;background:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);display:inline-flex;height:64px;justify-content:center;text-decoration:none;width:64px}@media not (prefers-reduced-motion){.boot-site-icon-link{transition:outline .1s ease-out}}.boot-site-icon-link:focus:not(:active){outline:var(--wpds-border-width-focus,2px) solid var(--wpds-color-stroke-focus-brand,#0073aa);outline-offset:calc(var(--wpds-border-width-focus, 2px)*-1)} +.boot-site-hub{align-items:center;background-color:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);display:grid;flex-shrink:0;grid-template-columns:60px 1fr auto;padding-right:16px;position:sticky;top:0;z-index:1}.boot-site-hub__actions{flex-shrink:0}.boot-site-hub__title{color:var(--wpds-color-fg-content-neutral,#1e1e1e);font-size:13px;font-weight:499;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.boot-site-hub__title .components-external-link__contents{margin-inline-start:4px;text-decoration:none}.boot-site-hub__title .components-external-link__icon{opacity:0;transition:opacity .1s ease-out}.boot-site-hub__title:hover .components-external-link__icon{opacity:1}@media not (prefers-reduced-motion){.boot-site-hub__title{transition:outline .1s ease-out}}.boot-site-hub__title:focus:not(:active){outline:var(--wpds-border-width-focus,2px) solid var(--wpds-color-stroke-focus-brand,#0073aa);outline-offset:calc(var(--wpds-border-width-focus, 2px)*-1)} +.boot-navigation-item.components-item{align-items:center;border:none;color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);display:flex;font-family:-apple-system,"system-ui",Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;font-weight:400;line-height:20px;margin-block-end:4px;margin-inline:12px;min-height:32px;padding-block:0;padding-inline:4px;width:calc(100% - 24px)}.boot-dropdown-item__children .boot-navigation-item.components-item{min-height:24px}.boot-navigation-item.components-item{border-radius:var(--wpds-border-radius-small,2px)}.boot-navigation-item.components-item.active,.boot-navigation-item.components-item:focus,.boot-navigation-item.components-item:hover,.boot-navigation-item.components-item[aria-current=true]{color:var(--wpds-color-fg-interactive-brand-active,#0073aa)}.boot-navigation-item.components-item.active{font-weight:499}.boot-navigation-item.components-item svg:last-child{padding:4px}.boot-navigation-item.components-item[aria-current=true]{color:var(--wpds-color-fg-interactive-brand-active,#0073aa);font-weight:499}.boot-navigation-item.components-item:focus-visible{transform:translateZ(0)}.boot-navigation-item.components-item.with-suffix{padding-right:16px} +.boot-dropdown-item__children{display:flex;flex-direction:column;margin-block-end:2px;margin-block-start:-2px;margin-inline-start:30px;overflow:hidden;padding:2px}.boot-dropdown-item__chevron.is-up{transform:rotate(180deg)} +.boot-navigation-screen{padding-block-end:4px}.boot-navigation-screen .components-text{color:var(--wpds-color-fg-content-neutral,#1e1e1e)}.boot-navigation-screen__title-icon{padding:12px 16px 8px;position:sticky;top:0}.boot-navigation-screen__title{flex-grow:1;overflow-wrap:break-word}.boot-navigation-screen__title.boot-navigation-screen__title,.boot-navigation-screen__title.boot-navigation-screen__title .boot-navigation-screen__title{color:var(--wpds-color-fg-content-neutral,#1e1e1e);line-height:32px}.boot-navigation-screen__actions{display:flex;flex-shrink:0} +.boot-sidebar__scrollable{display:flex;flex-direction:column;height:100%;overflow:auto;position:relative}.boot-sidebar__content{contain:content;flex-grow:1;position:relative} +.boot-layout{background:var(--wpds-color-bg-surface-neutral-weak,#f0f0f0);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;height:100%;isolation:isolate}.boot-layout__content{display:flex;flex-grow:1;height:100%}.boot-layout__sidebar-region{flex-shrink:0;width:240px}.boot-layout__sidebar{height:100%;overflow:hidden;position:relative}.boot-layout__stage{background:var(--wpds-color-bg-surface-neutral,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#ddd);border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.1);color:var(--wpds-color-fg-content-neutral,#1e1e1e);flex:1;margin:8px;overflow-y:auto} .page{display:flex;flex-direction:column;height:100%}.header{flex-shrink:0;padding:var(--wpds-spacing-60,24px)}.header.has-border{border-bottom:var(--wpds-border-width-focus,1px) solid var(--wpds-color-stroke-surface-neutral,#ddd)}.title-row{gap:var(--wpds-spacing-40,16px);justify-content:space-between}.title-group,.title-row{align-items:center;display:flex}.title-group{gap:var(--wpds-spacing-30,12px)}.title{color:var(--wpds-color-fg-primary,#1e1e1e);font-size:var(--wpds-font-size-large,20px);font-weight:500;margin:0}.sub-title{color:var(--wpds-color-fg-secondary,#757575);font-size:var(--wpds-font-size-small,13px);margin:var(--wpds-spacing-20,8px) 0 0}.content{display:flex;flex:1;flex-direction:column;gap:var(--wpds-spacing-60,24px);overflow:auto}.content.padded{padding:var(--wpds-spacing-60,24px)}.content.constrained{margin:0 auto;max-width:960px;width:100%}.content.full{padding:0} :root{--sw-sidebar-width:300px;--sw-inspector-width:380px}.activitypub-social-web-layout{bottom:0;left:0;position:fixed;right:0;top:0}#wpfooter{display:none} diff --git a/includes/wp-admin/class-social-web.php b/includes/wp-admin/class-social-web.php index 51a9e30e1..ca458f274 100644 --- a/includes/wp-admin/class-social-web.php +++ b/includes/wp-admin/class-social-web.php @@ -32,12 +32,42 @@ static function ( $classes ) { * Enqueue scripts and styles for the Social Web page. */ public static function enqueue_scripts() { + // Define paths to preload - must match exact fields from entities.js. + $preload_paths = array( + '/?_fields=description,gmt_offset,home,name,site_icon,site_icon_url,site_logo,timezone_string,url,page_for_posts,page_on_front,show_on_front', + array( '/wp/v2/settings', 'OPTIONS' ), + ); + + // Use rest_preload_api_request to gather the preloaded data. + $preload_data = array_reduce( + $preload_paths, + 'rest_preload_api_request', + array() + ); + + // Register the preloading middleware with wp-api-fetch. + \wp_add_inline_script( + 'wp-api-fetch', + sprintf( + 'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );', + wp_json_encode( $preload_data ) + ) + ); + $asset_file = include \plugin_dir_path( ACTIVITYPUB_PLUGIN_FILE ) . 'build/social-web/index.asset.php'; + // Filter out dependencies that aren't registered (like wp-theme in core WP). + $dependencies = array_filter( + $asset_file['dependencies'], + function ( $dependency ) { + return \wp_script_is( $dependency, 'registered' ); + } + ); + \wp_enqueue_script( 'activitypub-social-web', \plugins_url( 'build/social-web/index.js', ACTIVITYPUB_PLUGIN_FILE ), - $asset_file['dependencies'], + $dependencies, $asset_file['version'], true ); @@ -51,20 +81,9 @@ public static function enqueue_scripts() { \wp_add_inline_script( 'activitypub-social-web', - sprintf( - 'wp.domReady( function() { - wp.activitypubSocialWeb.initialize( "activitypub-social-web-root", %s ); - } );', - \wp_json_encode( - array( - 'siteUrl' => \site_url(), - 'siteTitle' => \get_bloginfo( 'name' ), - 'adminUrl' => \admin_url(), - 'restUrl' => \rest_url(), - 'nonce' => \wp_create_nonce( 'wp_rest' ), - ) - ) - ) + 'wp.domReady( function() { + wp.activitypubSocialWeb.initialize( "activitypub-social-web-root" ); + } );' ); } diff --git a/package-lock.json b/package-lock.json index d036f1b32..9654794bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,10 @@ "name": "wordpress-activitypub", "license": "MIT", "dependencies": { + "@tanstack/history": "^1.133.28", + "@tanstack/react-router": "^1.120.5", + "@wordpress/private-apis": "^1.34.0", + "@wordpress/theme": "^0.1.0", "clsx": "^2.1.1" }, "devDependencies": { @@ -6111,6 +6115,94 @@ "dev": true, "license": "MIT" }, + "node_modules/@tanstack/history": { + "version": "1.133.28", + "resolved": "https://registry.npmjs.org/@tanstack/history/-/history-1.133.28.tgz", + "integrity": "sha512-B7+x7eP2FFvi3fgd3rNH9o/Eixt+pp0zCIdGhnQbAJjFrlwIKGjGnwyJjhWJ5fMQlGks/E2LdDTqEV4W9Plx7g==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/react-router": { + "version": "1.134.12", + "resolved": "https://registry.npmjs.org/@tanstack/react-router/-/react-router-1.134.12.tgz", + "integrity": "sha512-79TUNkSpaJgQorMUNo2cKTa7GnhicmXvCUIxadeQyd1xmsL/A4rg4yxW7TYtvJMCOCDq0q0Ga2eYyJ+Brsvr8A==", + "license": "MIT", + "dependencies": { + "@tanstack/history": "1.133.28", + "@tanstack/react-store": "^0.8.0", + "@tanstack/router-core": "1.134.12", + "isbot": "^5.1.22", + "tiny-invariant": "^1.3.3", + "tiny-warning": "^1.0.3" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": ">=18.0.0 || >=19.0.0", + "react-dom": ">=18.0.0 || >=19.0.0" + } + }, + "node_modules/@tanstack/react-store": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@tanstack/react-store/-/react-store-0.8.0.tgz", + "integrity": "sha512-1vG9beLIuB7q69skxK9r5xiLN3ztzIPfSQSs0GfeqWGO2tGIyInZx0x1COhpx97RKaONSoAb8C3dxacWksm1ow==", + "license": "MIT", + "dependencies": { + "@tanstack/store": "0.8.0", + "use-sync-external-store": "^1.6.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@tanstack/router-core": { + "version": "1.134.12", + "resolved": "https://registry.npmjs.org/@tanstack/router-core/-/router-core-1.134.12.tgz", + "integrity": "sha512-Nxc/SS5bZMJP2ZIoK6qi/WZBNp9kV1aJH1tqz/ruetHBoFPyrmIYo1Yu6SGqHMLXSdeS5QaVdtUMSjTeytr2Lg==", + "license": "MIT", + "dependencies": { + "@tanstack/history": "1.133.28", + "@tanstack/store": "^0.8.0", + "cookie-es": "^2.0.0", + "seroval": "^1.3.2", + "seroval-plugins": "^1.3.2", + "tiny-invariant": "^1.3.3", + "tiny-warning": "^1.0.3" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/store": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@tanstack/store/-/store-0.8.0.tgz", + "integrity": "sha512-Om+BO0YfMZe//X2z0uLF2j+75nQga6TpTJgLJQBiq85aOyZNIhkCgleNcud2KQg4k4v9Y9l+Uhru3qWMPGTOzQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, "node_modules/@testing-library/dom": { "version": "10.4.1", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz", @@ -6638,7 +6730,6 @@ "version": "15.7.15", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", - "dev": true, "license": "MIT" }, "node_modules/@types/qs": { @@ -6659,7 +6750,6 @@ "version": "18.3.26", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.26.tgz", "integrity": "sha512-RFA/bURkcKzx/X9oumPG9Vp3D3JUgus/d0b67KB0t5S/raciymilkOa66olh78MUI92QLbEJevO7rvqU/kjwKA==", - "dev": true, "license": "MIT", "dependencies": { "@types/prop-types": "*", @@ -6670,7 +6760,6 @@ "version": "18.3.7", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", - "dev": true, "license": "MIT", "peerDependencies": { "@types/react": "^18.0.0" @@ -8281,7 +8370,6 @@ "version": "6.34.0", "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-6.34.0.tgz", "integrity": "sha512-WoCBhGa7fTd9NB0B1XS+hF64vmglI90tEskQxxfqtgby1IiLj7TjG+zyVeW1UdrKja3zSAhZTqZc1wjpEtbcoQ==", - "dev": true, "license": "GPL-2.0-or-later", "dependencies": { "@types/react": "^18.2.79", @@ -8329,7 +8417,6 @@ "version": "3.34.0", "resolved": "https://registry.npmjs.org/@wordpress/escape-html/-/escape-html-3.34.0.tgz", "integrity": "sha512-uDkh9w970Lnh43GTw/8csw0BkWY08tzYo2gqIF1I26N7YnpwRbVnv1Swet8PFvv8YDxpfejWBFfA7so4nciKfw==", - "dev": true, "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -8930,7 +9017,6 @@ "version": "1.34.0", "resolved": "https://registry.npmjs.org/@wordpress/private-apis/-/private-apis-1.34.0.tgz", "integrity": "sha512-6AgwgkVZOlXu6kJpQrAtC5WiRfUfxCu/oOKMeN3m8YddJTKj8eRNO7hHfQa0TCOZi7dEEtnnmrREMb0EFIzmPQ==", - "dev": true, "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -9216,6 +9302,25 @@ "npm": ">=8.19.2" } }, + "node_modules/@wordpress/theme": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@wordpress/theme/-/theme-0.1.0.tgz", + "integrity": "sha512-tRN0iGv59AJ+NAPSCy/SNg3gVN3ByXB2SmVeqtRbFn3mxPm+OSz6josgv/8pNXJOreFbGjoNqmk9D5caJpvOig==", + "license": "GPL-2.0-or-later", + "dependencies": { + "@wordpress/element": "^6.34.0", + "@wordpress/private-apis": "^1.34.0", + "colorjs.io": "^0.5.2" + }, + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" + }, + "peerDependencies": { + "react": "^18.0.0", + "react-dom": "^18.0.0" + } + }, "node_modules/@wordpress/token-list": { "version": "3.34.0", "resolved": "https://registry.npmjs.org/@wordpress/token-list/-/token-list-3.34.0.tgz", @@ -10768,7 +10873,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", - "dev": true, "license": "MIT", "dependencies": { "pascal-case": "^3.1.2", @@ -10864,7 +10968,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", "integrity": "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==", - "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -10893,7 +10996,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", - "dev": true, "license": "MIT", "dependencies": { "camel-case": "^4.1.2", @@ -11270,6 +11372,12 @@ "dev": true, "license": "MIT" }, + "node_modules/colorjs.io": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/colorjs.io/-/colorjs.io-0.5.2.tgz", + "integrity": "sha512-twmVoizEW7ylZSN32OgKdXRmo1qg+wT5/6C3xu5b9QsWzSFAhHLn2xd8ro0diCsKfCj1RdaTP/nrcW+vAoQPIw==", + "license": "MIT" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -11421,7 +11529,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", - "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -11469,6 +11576,12 @@ "node": ">= 0.6" } }, + "node_modules/cookie-es": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-2.0.0.tgz", + "integrity": "sha512-RAj4E421UYRgqokKUmotqAwuplYw15qtdXfY+hGzgCJ/MBjCVZcSoHK/kH9kocfjRjcDME7IiDWR/1WX1TM2Pg==", + "license": "MIT" + }, "node_modules/cookie-signature": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", @@ -11966,7 +12079,6 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true, "license": "MIT" }, "node_modules/cwd": { @@ -12575,7 +12687,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", - "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -15474,7 +15585,6 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", - "dev": true, "license": "MIT", "dependencies": { "capital-case": "^1.0.4", @@ -16458,7 +16568,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -16679,6 +16788,15 @@ "dev": true, "license": "MIT" }, + "node_modules/isbot": { + "version": "5.1.32", + "resolved": "https://registry.npmjs.org/isbot/-/isbot-5.1.32.tgz", + "integrity": "sha512-VNfjM73zz2IBZmdShMfAUg10prm6t7HFUQmNAEOAVS4YH92ZrZcvkMcGX6cIgBJAzWDzPent/EeAtYEHNPNPBQ==", + "license": "Unlicense", + "engines": { + "node": ">=18" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -18084,7 +18202,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, "license": "MIT" }, "node_modules/js-yaml": { @@ -18773,7 +18890,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, "license": "MIT", "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" @@ -18786,7 +18902,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -19581,7 +19696,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dev": true, "license": "MIT", "dependencies": { "lower-case": "^2.0.2", @@ -20381,7 +20495,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", - "dev": true, "license": "MIT", "dependencies": { "dot-case": "^3.0.4", @@ -20493,7 +20606,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", - "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -20504,7 +20616,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", - "dev": true, "license": "MIT", "dependencies": { "dot-case": "^3.0.4", @@ -22085,7 +22196,6 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", - "dev": true, "license": "MIT", "dependencies": { "loose-envify": "^1.1.0" @@ -22158,7 +22268,6 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", - "dev": true, "license": "MIT", "dependencies": { "loose-envify": "^1.1.0", @@ -23091,7 +23200,6 @@ "version": "0.23.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", - "dev": true, "license": "MIT", "dependencies": { "loose-envify": "^1.1.0" @@ -23261,7 +23369,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", - "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -23279,6 +23386,27 @@ "randombytes": "^2.1.0" } }, + "node_modules/seroval": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/seroval/-/seroval-1.3.2.tgz", + "integrity": "sha512-RbcPH1n5cfwKrru7v7+zrZvjLurgHhGyso3HTyGtRivGWgYjbOmGuivCQaORNELjNONoK35nj28EoWul9sb1zQ==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/seroval-plugins": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/seroval-plugins/-/seroval-plugins-1.3.3.tgz", + "integrity": "sha512-16OL3NnUBw8JG1jBLUoZJsLnQq0n5Ua6aHalhJK4fMQkz1lqR7Osz1sA30trBtd9VUDc2NgkuRCn8+/pBwqZ+w==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "seroval": "^1.0" + } + }, "node_modules/serve-index": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", @@ -23987,7 +24115,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", - "dev": true, "license": "MIT", "dependencies": { "dot-case": "^3.0.4", @@ -25542,6 +25669,18 @@ "dev": true, "license": "MIT" }, + "node_modules/tiny-invariant": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "license": "MIT" + }, + "node_modules/tiny-warning": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", + "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==", + "license": "MIT" + }, "node_modules/tldts-core": { "version": "7.0.17", "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.0.17.tgz", @@ -25724,7 +25863,6 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "dev": true, "license": "0BSD" }, "node_modules/tsutils": { @@ -26075,7 +26213,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -26085,7 +26222,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -26218,7 +26354,6 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz", "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==", - "dev": true, "license": "MIT", "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" diff --git a/package.json b/package.json index 91a8d47e0..9109435f4 100644 --- a/package.json +++ b/package.json @@ -60,8 +60,8 @@ "@wordpress/icons": "^11.0.0", "@wordpress/interactivity": "^6.33.0", "@wordpress/interface": "^9.17.0", - "@wordpress/keycodes": "^4.32.0", "@wordpress/keyboard-shortcuts": "^5.34.0", + "@wordpress/keycodes": "^4.32.0", "@wordpress/plugins": "^7.22.0", "@wordpress/preferences": "^4.32.0", "@wordpress/prettier-config": "^4.31.0", @@ -72,6 +72,10 @@ "prettier": "npm:wp-prettier@^3.0.3" }, "dependencies": { + "@tanstack/history": "^1.133.28", + "@tanstack/react-router": "^1.120.5", + "@wordpress/private-apis": "^1.34.0", + "@wordpress/theme": "^0.1.0", "clsx": "^2.1.1" } } diff --git a/src/packages/boot/components/app/index.tsx b/src/packages/boot/components/app/index.tsx new file mode 100644 index 000000000..e6a54480d --- /dev/null +++ b/src/packages/boot/components/app/index.tsx @@ -0,0 +1,35 @@ +/** + * WordPress dependencies + */ +import { createRoot, StrictMode } from '@wordpress/element'; +import { dispatch } from '@wordpress/data'; + +/** + * Internal dependencies + */ +import Router from './router'; +import { STORE_NAME } from '../../store'; +import type { MenuItem } from '../../store/types'; + +function App() { + return ; +} + +export async function init( menuItems: MenuItem[] ) { + // Register menu items + menuItems.forEach( ( menuItem ) => { + // @ts-ignore + dispatch( STORE_NAME ).registerMenuItem( menuItem.id, menuItem ); + } ); + + // Render the app + const rootElement = document.getElementById( 'gutenberg-boot-app' ); + if ( rootElement ) { + const root = createRoot( rootElement ); + root.render( + + + + ); + } +} diff --git a/src/packages/boot/components/app/router.tsx b/src/packages/boot/components/app/router.tsx new file mode 100644 index 000000000..f806707f1 --- /dev/null +++ b/src/packages/boot/components/app/router.tsx @@ -0,0 +1,76 @@ +/** + * External dependencies + */ +import { + createRouter, + createRootRoute, + createRoute, + RouterProvider, + createBrowserHistory, +} from '@tanstack/react-router'; +import { parseHref } from '@tanstack/history'; + +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; + +/** + * Internal dependencies + */ +import Root from '../root'; +import Home from '../home'; + +// Not found component +function NotFoundComponent() { + return ( +
+

{ __( 'Route not found' ) }

+
+ ); +} + +// Create root route +const rootRoute = createRootRoute( { + component: Root, +} ); + +// Create home route +const homeRoute = createRoute( { + getParentRoute: () => rootRoute, + path: '/', + component: Home, +} ); + +// Create route tree +const routeTree = rootRoute.addChildren( [ homeRoute ] ); + +// Create custom history that parses ?p= query parameter +function createPathHistory() { + return createBrowserHistory( { + parseLocation: () => { + const url = new URL( window.location.href ); + const path = url.searchParams.get( 'p' ) || '/'; + const pathHref = `${ path }${ url.hash }`; + return parseHref( pathHref, window.history.state ); + }, + createHref: ( href ) => { + const searchParams = new URLSearchParams( window.location.search ); + searchParams.set( 'p', href ); + return `${ window.location.pathname }?${ searchParams }`; + }, + } ); +} + +const history = createPathHistory(); + +// Create router +const router = createRouter( { + history, + routeTree, + defaultNotFoundComponent: NotFoundComponent, +} ); + +export default function Router() { + return ; +} diff --git a/src/packages/boot/components/home/index.tsx b/src/packages/boot/components/home/index.tsx new file mode 100644 index 000000000..398c9a24b --- /dev/null +++ b/src/packages/boot/components/home/index.tsx @@ -0,0 +1,13 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; +import { Page } from '@wordpress/admin-ui'; + +export default function Home() { + return ( + +

{ __( 'Welcome to the minimal boot package!' ) }

+
+ ); +} diff --git a/src/packages/boot/components/navigation/drilldown-item/index.tsx b/src/packages/boot/components/navigation/drilldown-item/index.tsx new file mode 100644 index 000000000..8c9bcc13a --- /dev/null +++ b/src/packages/boot/components/navigation/drilldown-item/index.tsx @@ -0,0 +1,75 @@ +/** + * External dependencies + */ +import clsx from 'clsx'; +import type { ReactNode } from 'react'; + +/** + * WordPress dependencies + */ +import { + FlexBlock, + __experimentalItem as Item, + // @ts-ignore + __experimentalHStack as HStack, + Icon, +} from '@wordpress/components'; +import { isRTL } from '@wordpress/i18n'; +import { chevronRightSmall, chevronLeftSmall } from '@wordpress/icons'; + +/** + * Internal dependencies + */ +import { wrapIcon } from '../items'; +import type { IconType } from '../../../store/types'; + +interface DrilldownItemProps { + /** + * Optional CSS class name. + */ + className?: string; + /** + * Identifier of the navigation item. + */ + id: string; + /** + * Icon to display with the navigation item. + */ + icon?: IconType; + /** + * Whether to show placeholder icons for alignment. + */ + shouldShowPlaceholder?: boolean; + /** + * Content to display inside the navigation item. + */ + children: ReactNode; + /** + * Function to handle sidebar navigation when the item is clicked. + */ + onNavigate: ( { id, direction }: { id?: string; direction: 'forward' | 'backward' } ) => void; +} + +export default function DrilldownItem( { + className, + id, + icon, + shouldShowPlaceholder = true, + children, + onNavigate, +}: DrilldownItemProps ) { + const handleClick = ( e: React.MouseEvent ) => { + e.preventDefault(); + onNavigate( { id, direction: 'forward' } ); + }; + + return ( + + + { wrapIcon( icon, shouldShowPlaceholder ) } + { children } + + + + ); +} diff --git a/src/packages/boot/components/navigation/dropdown-item/index.tsx b/src/packages/boot/components/navigation/dropdown-item/index.tsx new file mode 100644 index 000000000..d32431f6a --- /dev/null +++ b/src/packages/boot/components/navigation/dropdown-item/index.tsx @@ -0,0 +1,119 @@ +/** + * External dependencies + */ +import clsx from 'clsx'; +import type { ReactNode } from 'react'; + +/** + * WordPress dependencies + */ +import { + FlexBlock, + __experimentalItem as Item, + // @ts-ignore + __experimentalHStack as HStack, + Icon, + __unstableMotion as motion, + __unstableAnimatePresence as AnimatePresence, +} from '@wordpress/components'; +import { chevronDownSmall } from '@wordpress/icons'; +import { useReducedMotion } from '@wordpress/compose'; +import { useSelect } from '@wordpress/data'; + +/** + * Internal dependencies + */ +import { STORE_NAME } from '../../../store'; +import NavigationItem from '../navigation-item'; +import { wrapIcon } from '../items'; +import type { IconType, MenuItem } from '../../../store/types'; +import './style.scss'; + +const ANIMATION_DURATION = 0.2; + +interface DropdownItemProps { + /** + * Optional CSS class name. + */ + className?: string; + /** + * Identifier of the parent menu item. + */ + id: string; + /** + * Icon to display with the dropdown item. + */ + icon?: IconType; + /** + * Whether to show placeholder icons for alignment. + */ + shouldShowPlaceholder?: boolean; + /** + * Content to display inside the dropdown item. + */ + children: ReactNode; + /** + * Whether this dropdown is currently expanded. + */ + isExpanded: boolean; + /** + * Function to toggle this dropdown's expanded state. + */ + onToggle: () => void; +} + +export default function DropdownItem( { className, id, icon, children, isExpanded, onToggle }: DropdownItemProps ) { + const menuItems: MenuItem[] = useSelect( + ( select ) => + // @ts-ignore + select( STORE_NAME ).getMenuItems(), + [] + ); + const items = menuItems.filter( ( item ) => item.parent === id ); + const disableMotion = useReducedMotion(); + return ( +
+ { + e.preventDefault(); + e.stopPropagation(); + onToggle(); + } } + onMouseDown={ ( e ) => e.preventDefault() } + > + + { wrapIcon( icon, false ) } + { children } + + + + + { isExpanded && ( + + { items.map( ( item, index ) => ( + + { item.label } + + ) ) } + + ) } + +
+ ); +} diff --git a/src/packages/boot/components/navigation/dropdown-item/style.scss b/src/packages/boot/components/navigation/dropdown-item/style.scss new file mode 100644 index 000000000..49c520f26 --- /dev/null +++ b/src/packages/boot/components/navigation/dropdown-item/style.scss @@ -0,0 +1,23 @@ +@use "@wordpress/base-styles/variables"; + +.boot-dropdown-item__children { + display: flex; + flex-direction: column; + + // In order to avoid the focus ring of each list item from being cut off, + // we add padding around the menu items. + // At the same time, we use the same value to tweak margins so that + // the items still retain the same position and footprint. + $padding-to-avoid-cutting-focus-ring: 2px; + padding: $padding-to-avoid-cutting-focus-ring; + margin-block-start: -$padding-to-avoid-cutting-focus-ring; + margin-block-end: $padding-to-avoid-cutting-focus-ring; + margin-inline-start: + variables.$grid-unit-40 - + $padding-to-avoid-cutting-focus-ring; + overflow: hidden; +} + +.boot-dropdown-item__chevron.is-up { + transform: rotate(180deg); +} diff --git a/src/packages/boot/components/navigation/index.tsx b/src/packages/boot/components/navigation/index.tsx new file mode 100644 index 000000000..c08039c3e --- /dev/null +++ b/src/packages/boot/components/navigation/index.tsx @@ -0,0 +1,107 @@ +/** + * WordPress dependencies + */ +import { useState, useMemo, useRef } from '@wordpress/element'; +import { useSelect } from '@wordpress/data'; + +/** + * Internal dependencies + */ +import { STORE_NAME } from '../../store'; +import NavigationItem from './navigation-item'; +import DrilldownItem from './drilldown-item'; +import DropdownItem from './dropdown-item'; +import NavigationScreen from './navigation-screen'; +import { useSidebarParent } from './use-sidebar-parent'; +import type { MenuItem } from '../../store/types'; + +function Navigation() { + const backButtonRef = useRef< HTMLButtonElement >( null ); + const [ animationDirection, setAnimationDirection ] = useState< 'forward' | 'backward' | null >( null ); + const [ parentId, setParentId, parentDropdownId, setParentDropdownId ] = useSidebarParent(); + const menuItems = useSelect( + ( select ) => + // @ts-ignore + select( STORE_NAME ).getMenuItems() as MenuItem[], + [] + ); + const parent = useMemo( () => menuItems.find( ( item ) => item.id === parentId ), [ menuItems, parentId ] ); + // Create a unique key for the current navigation state + // The sidebar will animate when the key changes. + const navigationKey = parent ? `drilldown-${ parent.id }` : 'root'; + + // We use transitions to handle navigation clicks + // This allows smooth animations and non blocking navigation. + const handleNavigate = ( { id, direction }: { id?: string; direction: 'forward' | 'backward' } ) => { + setAnimationDirection( direction ); + setParentId( id ); + }; + + const handleDropdownToggle = ( dropdownId: string ) => { + setParentDropdownId( parentDropdownId === dropdownId ? undefined : dropdownId ); + }; + + const items = useMemo( () => menuItems.filter( ( item ) => item.parent === parentId ), [ menuItems, parentId ] ); + + const hasRealIcons = items.some( ( item ) => !! item.icon ); + + return ( + + { items.map( ( item: MenuItem ) => { + if ( item.parent_type === 'dropdown' ) { + return ( + handleDropdownToggle( item.id ) } + > + { item.label } + + ); + } + + if ( item.parent_type === 'drilldown' ) { + return ( + + { item.label } + + ); + } + + return ( + + { item.label } + + ); + } ) } + + } + /> + ); +} + +export default Navigation; diff --git a/src/packages/boot/components/navigation/items.tsx b/src/packages/boot/components/navigation/items.tsx new file mode 100644 index 000000000..42e5f4abe --- /dev/null +++ b/src/packages/boot/components/navigation/items.tsx @@ -0,0 +1,73 @@ +/** + * WordPress dependencies + */ +import { isValidElement } from '@wordpress/element'; +import { Dashicon, Icon } from '@wordpress/components'; +import { SVG } from '@wordpress/primitives'; + +/** + * Internal dependencies + */ +import type { IconType } from '../../store/types'; + +/** + * Type guard for verifying whether a given element + * is a valid SVG element for the Icon component. + * + * @param element - The element to check + */ +function isSvg( element: unknown ): element is JSX.Element { + return isValidElement( element ) && ( element.type === SVG || element.type === 'svg' ); +} + +/** + * Converts the given IconType into a renderable component: + * - Dashicon string into a Dashicon component + * - JSX SVG element into an Icon component + * - Data URL into an img element + * + * @param icon - The icon to convert + * @param shouldShowPlaceholder - Whether to show placeholder when no icon is provided + * @return The converted icon as a JSX element + */ +export function wrapIcon( icon?: IconType, shouldShowPlaceholder: boolean = true ) { + if ( isSvg( icon ) ) { + return ; + } + + if ( typeof icon === 'string' && icon.startsWith( 'dashicons-' ) ) { + const iconKey = icon.replace( /^dashicons-/, '' ) as React.ComponentProps< typeof Dashicon >[ 'icon' ]; + + return