sanity-plugin-workspace-home 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6154,8 +6154,8 @@ function deepEqual(a,b){if(a===b){return true;}if(typeof a!==typeof b){return fa
6154
6154
  "--card-shadow-outline-color":base.shadow.outline,"--card-shadow-umbra-color":base.shadow.umbra,"--card-shadow-penumbra-color":base.shadow.penumbra,"--card-shadow-ambient-color":base.shadow.ambient,"--card-focus-ring-color":base.focusRing,// Card
6155
6155
  "--card-bg-color":color.bg,"--card-bg-image":checkered?"repeating-conic-gradient(".concat(color.bg," 0% 25%, ").concat(color.bg2||color.bg," 0% 50%)"):void 0,"--card-fg-color":color.fg,"--card-border-color":color.border,"--card-muted-fg-color":(_a=color.muted)==null?void 0:_a.fg,"--card-accent-fg-color":(_b=color.accent)==null?void 0:_b.fg,"--card-link-fg-color":(_c=color.link)==null?void 0:_c.fg,"--card-code-bg-color":(_d=color.code)==null?void 0:_d.bg,"--card-code-fg-color":(_e=color.code)==null?void 0:_e.fg,"--card-skeleton-color-from":(_f=color.skeleton)==null?void 0:_f.from,"--card-skeleton-color-to":(_g=color.skeleton)==null?void 0:_g.to,// @todo: deprecate
6156
6156
  "--card-link-color":(_h=color.link)==null?void 0:_h.fg,"--card-hairline-soft-color":color.border,"--card-hairline-hard-color":color.border};}function buttonBaseStyles(){return styled.css(_templateObject16||(_templateObject16=_taggedTemplateLiteral(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])));}const buttonTheme={border:{width:1}};function buttonColorStyles(props){var _a,_b;const{$mode,theme}=props;const{focusRing}=theme.sanity;const base=theme.sanity.color.base;const mode=theme.sanity.color.button[$mode]||theme.sanity.color.button.default;const color=mode[props.$tone]||mode.default;const border={width:buttonTheme.border.width,color:"var(--card-border-color)"};return[_colorVarsStyle(base,color.enabled),{backgroundColor:"var(--card-bg-color)",color:"var(--card-fg-color)",boxShadow:focusRingBorderStyle(border),'&:disabled, &[data-disabled="true"]':_colorVarsStyle(base,color.disabled),"&:not([data-disabled='true'])":{"&:focus":{boxShadow:focusRingStyle({base,border,focusRing})},"&:focus:not(:focus-visible)":{boxShadow:focusRingBorderStyle(border)},"@media (hover: hover)":{"&:hover":_colorVarsStyle(base,color.hovered),"&:active":_colorVarsStyle(base,color.pressed),"&[data-hovered]":_colorVarsStyle(base,color.hovered)},"&[data-selected]":_colorVarsStyle(base,color.pressed)}},(_b=(_a=theme.sanity.styles)==null?void 0:_a.button)==null?void 0:_b.root].filter(Boolean);}const Root$v=styled__default.default.button(responsiveRadiusStyle,buttonBaseStyles,buttonColorStyles);const LoadingBox=styled__default.default.div(_templateObject17||(_templateObject17=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--card-bg-color);\n border-radius: inherit;\n z-index: 1;\n box-shadow: inherit;\n"])));const Button=React$2.forwardRef(function Button2(props,ref){const{children,disabled,fontSize,icon,iconRight,justify:justifyProp="center",loading,mode="default",padding:paddingProp=3,paddingX:paddingXProp,paddingY:paddingYProp,paddingTop:paddingTopProp,paddingBottom:paddingBottomProp,paddingLeft:paddingLeftProp,paddingRight:paddingRightProp,radius:radiusProp=2,selected,space:spaceProp=3,text,textAlign,tone="default",type="button",...restProps}=props;const justify=useArrayProp(justifyProp);const padding=useArrayProp(paddingProp);const paddingX=useArrayProp(paddingXProp);const paddingY=useArrayProp(paddingYProp);const paddingTop=useArrayProp(paddingTopProp);const paddingBottom=useArrayProp(paddingBottomProp);const paddingLeft=useArrayProp(paddingLeftProp);const paddingRight=useArrayProp(paddingRightProp);const radius=useArrayProp(radiusProp);const space=useArrayProp(spaceProp);const theme=useTheme();const boxProps=React$2.useMemo(()=>({// flex: 1,
6157
- padding,paddingX,paddingY,paddingTop,paddingBottom,paddingLeft,paddingRight}),[padding,paddingX,paddingY,paddingTop,paddingBottom,paddingLeft,paddingRight]);return/* @__PURE__ */jsxRuntime.jsxs(Root$v,{"data-ui":"Button",...restProps,$mode:mode,$radius:radius,$tone:tone,"data-disabled":Boolean(loading||disabled),"data-selected":selected?"":void 0,disabled:Boolean(loading||disabled),ref,type,children:[Boolean(loading)&&/* @__PURE__ */jsxRuntime.jsx(LoadingBox,{children:/* @__PURE__ */jsxRuntime.jsx(Spinner,{})}),(icon||text||iconRight)&&/* @__PURE__ */jsxRuntime.jsx(Box,{as:"span",...boxProps,children:/* @__PURE__ */jsxRuntime.jsxs(Flex,{as:"span",justify,children:[icon&&/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(icon)&&icon,reactIsExports$1.isValidElementType(icon)&&React$2.createElement(icon)]}),text&&/* @__PURE__ */jsxRuntime.jsx(Box,{flex:iconRight?1:void 0,marginLeft:icon?space:void 0,marginRight:iconRight?space:void 0,children:/* @__PURE__ */jsxRuntime.jsx(Text,{align:textAlign,size:fontSize,textOverflow:"ellipsis",weight:theme.sanity.button.textWeight,children:text})}),iconRight&&/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(iconRight)&&iconRight,reactIsExports$1.isValidElementType(iconRight)&&React$2.createElement(iconRight)]})]})}),children&&/* @__PURE__ */jsxRuntime.jsx(Box,{as:"span",...boxProps,children})]});});function cardStyle(props){return[cardBaseStyle(props),cardColorStyle(props)];}function cardBaseStyle(props){const{$checkered,theme}=props;const space=theme.sanity.space;return styled.css(_templateObject18||(_templateObject18=_taggedTemplateLiteral(["\n ","\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])),$checkered&&styled.css(_templateObject19||(_templateObject19=_taggedTemplateLiteral(["\n background-size: ","px ","px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])),space[3],space[3]));}function cardColorStyle(props){var _a,_b;const{$checkered,$focusRing,theme}=props;const{focusRing}=theme.sanity;const{base,card,dark}=theme.sanity.color;const border={width:0,color:"var(--card-border-color)"};return styled.css(_templateObject20||(_templateObject20=_taggedTemplateLiteral(["\n color-scheme: ",";\n\n ","\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n\n /* &:is(button) */\n &[data-as='button'] {\n --card-focus-ring-box-shadow: none;\n\n cursor: default;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &:disabled {\n ","\n }\n\n &:not(:disabled) {\n &[data-pressed] {\n ","\n }\n\n &[data-selected] {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &[data-hovered],\n &:hover {\n ","\n }\n\n &:active {\n ","\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ",";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ",";\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n cursor: pointer;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &[data-disabled] {\n ","\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ","\n }\n\n &[data-selected] {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &[data-hovered],\n &:hover {\n ","\n }\n\n &:active {\n ","\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ",";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ",";\n }\n }\n }\n\n ","\n "])),dark?"dark":"light",_colorVarsStyle(base,card.enabled,$checkered),_colorVarsStyle(base,card.disabled,$checkered),_colorVarsStyle(base,card.pressed,$checkered),_colorVarsStyle(base,card.selected,$checkered),_colorVarsStyle(base,card.hovered,$checkered),_colorVarsStyle(base,card.pressed,$checkered),$focusRing?focusRingStyle({base,border,focusRing}):void 0,$focusRing?focusRingBorderStyle(border):void 0,_colorVarsStyle(base,card.disabled,$checkered),_colorVarsStyle(base,card.pressed,$checkered),_colorVarsStyle(base,card.selected,$checkered),_colorVarsStyle(base,card.hovered,$checkered),_colorVarsStyle(base,card.pressed,$checkered),$focusRing?focusRingStyle({base,border,focusRing}):void 0,$focusRing?focusRingBorderStyle(border):void 0,(_b=(_a=theme.sanity.styles)==null?void 0:_a.card)==null?void 0:_b.root);}const Root$u=styled__default.default(Box)(responsiveBorderStyle,responsiveRadiusStyle,responsiveShadowStyle,cardStyle);const Card=React$2.forwardRef(function Card2(props,ref){const{__unstable_checkered:checkered=false,__unstable_focusRing:focusRing=false,as:asProp,border,borderTop,borderRight,borderBottom,borderLeft,pressed,radius=0,scheme,selected,shadow,tone:toneProp="default",...restProps}=props;const as=reactIsExports$1.isValidElementType(asProp)?asProp:"div";const rootTheme=useRootTheme();const tone=toneProp==="inherit"?rootTheme.tone:toneProp;return/* @__PURE__ */jsxRuntime.jsx(ThemeColorProvider,{scheme,tone,children:/* @__PURE__ */jsxRuntime.jsx(Root$u,{"data-as":typeof as==="string"?as:void 0,"data-scheme":rootTheme.scheme,"data-ui":"Card","data-tone":tone,...restProps,$border:useArrayProp(border),$borderTop:useArrayProp(borderTop),$borderRight:useArrayProp(borderRight),$borderBottom:useArrayProp(borderBottom),$borderLeft:useArrayProp(borderLeft),$checkered:checkered,$focusRing:focusRing,$radius:useArrayProp(radius),$shadow:useArrayProp(shadow),$tone:tone,"data-checkered":checkered?"":void 0,"data-pressed":pressed?"":void 0,"data-selected":selected?"":void 0,forwardedAs:as,ref,selected})});});function checkboxBaseStyles(){return styled.css(_templateObject21||(_templateObject21=_taggedTemplateLiteral(["\n position: relative;\n display: inline-block;\n "])));}function inputElementStyles(props){const{theme}=props;const color=theme.sanity.color.input;const{focusRing,input,radius}=theme.sanity;return styled.css(_templateObject22||(_templateObject22=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n outline: none;\n opacity: 0;\n z-index: 1;\n padding: 0;\n margin: 0;\n\n & + span {\n position: relative;\n display: block;\n height: ",";\n width: ",";\n box-sizing: border-box;\n box-shadow: ",";\n border-radius: ",";\n line-height: 1;\n background-color: ",";\n\n & > svg {\n display: block;\n position: absolute;\n opacity: 0;\n height: 100%;\n width: 100%;\n\n & > path {\n vector-effect: non-scaling-stroke;\n stroke-width: 2 !important;\n }\n }\n }\n\n &:not(:disabled):focus + span {\n box-shadow: ",";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ",";\n }\n\n &:checked + span > svg:first-child {\n opacity: 1;\n }\n\n &[data-read-only] + span {\n background-color: ",";\n box-shadow: ",";\n color: ",";\n }\n\n &:not([data-read-only]):disabled + span {\n background-color: ",";\n box-shadow: ",";\n color: ",";\n }\n\n &:indeterminate + span > svg:last-child {\n opacity: 1;\n }\n "])),rem(input.checkbox.size),rem(input.checkbox.size),focusRingBorderStyle({color:color.default.enabled.border,width:input.border.width}),rem(radius[2]),color.default.enabled.bg,focusRingStyle({border:{width:input.border.width,color:color.default.enabled.border},focusRing}),focusRingBorderStyle({color:color.default.enabled.border,width:input.border.width}),color.default.readOnly.bg,focusRingBorderStyle({width:input.border.width,color:color.default.readOnly.border}),color.default.readOnly.fg,color.default.disabled.bg,focusRingBorderStyle({width:input.border.width,color:color.default.disabled.border}),color.default.disabled.fg);}const Root$t=styled__default.default.div(checkboxBaseStyles);const Input$5=styled__default.default.input(inputElementStyles);React$2.forwardRef(function Checkbox2(props,forwardedRef){const{checked,className,disabled,indeterminate,customValidity,readOnly,style,...restProps}=props;const ref=useForwardedRef(forwardedRef);useCustomValidity(ref,customValidity);React$2.useEffect(()=>{if(ref.current){ref.current.indeterminate=indeterminate||false;}},[indeterminate,ref]);return/* @__PURE__ */jsxRuntime.jsxs(Root$t,{className,"data-ui":"Checkbox",style,children:[/* @__PURE__ */jsxRuntime.jsx(Input$5,{"data-read-only":!disabled&&readOnly?"":void 0,...restProps,checked,disabled:disabled||readOnly,type:"checkbox",readOnly,ref}),/* @__PURE__ */jsxRuntime.jsxs("span",{children:[/* @__PURE__ */jsxRuntime.jsx(CheckmarkIcon,{}),/* @__PURE__ */jsxRuntime.jsx(RemoveIcon,{})]})]});});function codeSyntaxHighlightingStyle(_ref20){let{theme}=_ref20;const color=theme.sanity.color.syntax;return{"&.atrule":{color:color.atrule},"&.attr-name":{color:color.attrName},"&.attr-value":{color:color.attrValue},"&.attribute":{color:color.attribute},"&.boolean":{color:color.boolean},"&.builtin":{color:color.builtin},"&.cdata":{color:color.cdata},"&.char":{color:color.char},"&.class":{color:color.class},"&.class-name":{color:color.className},"&.comment":{color:color.comment},"&.constant":{color:color.constant},"&.deleted":{color:color.deleted},"&.doctype":{color:color.doctype},"&.entity":{color:color.entity},"&.function":{color:color.function},"&.hexcode":{color:color.hexcode},"&.id":{color:color.id},"&.important":{color:color.important},"&.inserted":{color:color.inserted},"&.keyword":{color:color.keyword},"&.number":{color:color.number},"&.operator":{color:color.operator},"&.prolog":{color:color.prolog},"&.property":{color:color.property},"&.pseudo-class":{color:color.pseudoClass},"&.pseudo-element":{color:color.pseudoElement},"&.punctuation":{color:color.punctuation},"&.regex":{color:color.regex},"&.selector":{color:color.selector},"&.string":{color:color.string},"&.symbol":{color:color.symbol},"&.tag":{color:color.tag},"&.unit":{color:color.unit},"&.url":{color:color.url},"&.variable":{color:color.variable}};}function codeBaseStyle(){return styled.css(_templateObject23||(_templateObject23=_taggedTemplateLiteral(["\n color: var(--card-code-fg-color);\n\n & code {\n font-family: inherit;\n\n &.refractor .token {\n ","\n }\n }\n\n & a {\n color: inherit;\n text-decoration: underline;\n border-radius: 1px;\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])),codeSyntaxHighlightingStyle);}const Root$s=styled__default.default.pre(codeBaseStyle,responsiveCodeFontStyle);const Code=React$2.forwardRef(function Code2(props,ref){const{children,language:languageProp,size=2,weight,...restProps}=props;const language=typeof languageProp==="string"?languageProp:void 0;const registered=language?Refractor_1.hasLanguage(language):false;return/* @__PURE__ */jsxRuntime.jsxs(Root$s,{"data-ui":"Code",...restProps,$size:useArrayProp(size),$weight:weight,ref,children:[!(language&&registered)&&/* @__PURE__ */jsxRuntime.jsx("code",{children}),language&&registered&&/* @__PURE__ */jsxRuntime.jsx(Refractor_1,{inline:true,language,value:String(children)})]});});const BASE_STYLE$1={width:"100%",margin:"0 auto"};function containerBaseStyle(){return BASE_STYLE$1;}function responsiveContainerWidthStyle(props){const{theme}=props;const{container,media}=theme.sanity;return _responsive(media,props.$width,val=>({maxWidth:val==="auto"?"none":rem(container[val])}));}const Root$r=styled__default.default(Box)(containerBaseStyle,responsiveContainerWidthStyle);const Container=React$2.forwardRef(function Container2(props,ref){const{as,width=2,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$r,{"data-ui":"Container",...restProps,$width:useArrayProp(width),forwardedAs:as,ref});});const Root$q=styled__default.default(Box)(responsiveGridStyle);React$2.forwardRef(function Grid2(props,ref){const{as,autoRows,autoCols,autoFlow,columns,gap,gapX,gapY,rows,children,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$q,{"data-as":typeof as==="string"?as:void 0,"data-ui":"Grid",...restProps,$autoRows:useArrayProp(autoRows),$autoCols:useArrayProp(autoCols),$autoFlow:useArrayProp(autoFlow),$columns:useArrayProp(columns),$gap:useArrayProp(gap),$gapX:useArrayProp(gapX),$gapY:useArrayProp(gapY),$rows:useArrayProp(rows),forwardedAs:as,ref,children});});function headingBaseStyle(props){const{$accent,$muted,theme}=props;return styled.css(_templateObject24||(_templateObject24=_taggedTemplateLiteral(["\n ","\n\n ","\n\n & code {\n font-family: ",";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])),$accent&&styled.css(_templateObject25||(_templateObject25=_taggedTemplateLiteral(["\n color: var(--card-accent-fg-color);\n "]))),$muted&&styled.css(_templateObject26||(_templateObject26=_taggedTemplateLiteral(["\n color: var(--card-muted-fg-color);\n "]))),theme.sanity.fonts.code.family);}const Root$p=styled__default.default.div(headingBaseStyle,responsiveTextAlignStyle,responsiveHeadingFont);const SpanWithTextOverflow=styled__default.default.span(_templateObject27||(_templateObject27=_taggedTemplateLiteral(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));const Heading=React$2.forwardRef(function Heading2(props,ref){const{accent=false,align,children:childrenProp,muted=false,size=2,textOverflow,weight,...restProps}=props;let children=childrenProp;if(textOverflow==="ellipsis"){children=/* @__PURE__ */jsxRuntime.jsx(SpanWithTextOverflow,{children});}return/* @__PURE__ */jsxRuntime.jsx(Root$p,{"data-ui":"Heading",...restProps,$accent:accent,$align:useArrayProp(align),$muted:muted,$size:useArrayProp(size),$weight:weight,ref,children:/* @__PURE__ */jsxRuntime.jsx("span",{children})});});function inlineBaseStyle(){return{lineHeight:0,"&&:not([hidden])":{display:"block"},"& > div":{display:"inline-block",verticalAlign:"middle"}};}function inlineSpaceStyle(props){const{theme}=props;return _responsive(theme.sanity.media,props.$space,spaceIndex=>{const space=rem(theme.sanity.space[spaceIndex]);return{margin:"-".concat(space," 0 0 -").concat(space),"& > div":{padding:"".concat(space," 0 0 ").concat(space)}};});}const Root$o=styled__default.default(Box)(inlineBaseStyle,inlineSpaceStyle);const Inline=React$2.forwardRef(function Inline2(props,ref){const{as,children:childrenProp,space,...restProps}=props;const children=React$2.useMemo(()=>childrenToElementArray(childrenProp).filter(Boolean).map((child,idx)=>/* @__PURE__ */jsxRuntime.jsx("div",{children:child},idx)),[childrenProp]);return/* @__PURE__ */jsxRuntime.jsx(Root$o,{"data-ui":"Inline",...restProps,$space:useArrayProp(space),forwardedAs:as,ref,children});});function kbdStyle(){return styled.css(_templateObject28||(_templateObject28=_taggedTemplateLiteral(["\n background: var(--card-bg-color);\n font: inherit;\n box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));}const Root$n=styled__default.default.kbd(responsiveRadiusStyle,kbdStyle);const KBD=React$2.forwardRef(function KBD2(props,ref){const{children,fontSize=1,padding=1,radius=2,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$n,{"data-ui":"KBD",...restProps,$radius:useArrayProp(radius),ref,children:/* @__PURE__ */jsxRuntime.jsx(Box,{as:"span",padding,children:/* @__PURE__ */jsxRuntime.jsx(Code,{as:"span",muted:true,size:fontSize,children})})});});const key$6=Symbol.for("@sanity/ui/context/boundaryElement");globalScope[key$6]=globalScope[key$6]||React$2.createContext(null);const BoundaryElementContext=globalScope[key$6];const DEFAULT_VALUE={version:0,element:null};function useBoundaryElement(){const value=React$2.useContext(BoundaryElementContext);if(value&&(!isRecord(value)||value.version!==0)){throw new Error("useBoundaryElement(): the context value is not compatible");}return value||DEFAULT_VALUE;}function findMaxBreakpoints(media,width){const ret=[];for(let i=0;i<media.length;i+=1){const bp=media[i];if(bp>width){ret.push(i);}}return ret;}function findMinBreakpoints(media,width){const ret=[];for(let i=0;i<media.length;i+=1){const bp=media[i];if(bp<=width){ret.push(i);}}return ret;}React$2.forwardRef(function ElementQuery2(props,ref){const theme=useTheme();const{children,media=theme.sanity.media,...restProps}=props;const forwardedRef=useForwardedRef(ref);const[element,setElement]=React$2.useState(null);const elementSize=useElementSize(element);const width=React$2.useMemo(()=>{var _a;return(_a=elementSize==null?void 0:elementSize.border.width)!=null?_a:window.innerWidth;},[elementSize]);const max=React$2.useMemo(()=>findMaxBreakpoints(media,width),[media,width]);const min=React$2.useMemo(()=>findMinBreakpoints(media,width),[media,width]);const setRef=React$2.useCallback(el=>{forwardedRef.current=el;setElement(el);},[forwardedRef]);return/* @__PURE__ */jsxRuntime.jsx("div",{"data-ui":"ElementQuery",...restProps,"data-eq-max":max.length?max.join(" "):void 0,"data-eq-min":min.length?min.join(" "):void 0,ref:setRef,children});});function getLayerContext(contextValue){if(!isRecord(contextValue)||contextValue.version!==0){throw new Error("the context value is not compatible");}if(!contextValue){throw new Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");}if(contextValue.version===0){return contextValue;}throw new Error("could not get layer context");}const key$5=Symbol.for("@sanity/ui/context/layer");globalScope[key$5]=globalScope[key$5]||React$2.createContext(null);const LayerContext=globalScope[key$5];function useLayer(){const value=React$2.useContext(LayerContext);if(!value){throw new Error("useLayer(): missing context value");}try{return getLayerContext(value);}catch(err){if(err instanceof Error){throw new Error("useLayer(): ".concat(err.message));}else{throw new Error("useLayer(): ".concat(err));}}}function _raf(fn){const frameId=requestAnimationFrame(fn);return()=>{cancelAnimationFrame(frameId);};}function _isEnterToClickElement(element){return isHTMLAnchorElement(element)||isHTMLButtonElement(element);}function isHTMLElement(node){return node instanceof Node&&node.nodeType===Node.ELEMENT_NODE;}function isHTMLAnchorElement(element){return isHTMLElement(element)&&element.nodeName==="A";}function isHTMLInputElement(element){return isHTMLElement(element)&&element.nodeName==="INPUT";}function isHTMLButtonElement(element){return isHTMLElement(element)&&element.nodeName==="BUTTON";}function isHTMLSelectElement(element){return isHTMLElement(element)&&element.nodeName==="SELECT";}function isHTMLTextAreaElement(element){return isHTMLElement(element)&&element.nodeName==="TEXTAREA";}function containsOrEqualsElement(element,node){return element.contains(node)||element===node;}function _hasFocus(element){return Boolean(document.activeElement)&&element.contains(document.activeElement);}function isFocusable(element){if(element.tabIndex>0||element.tabIndex===0&&element.getAttribute("tabIndex")!==null){return true;}if(isHTMLAnchorElement(element)){return Boolean(element.href)&&element.rel!=="ignore";}if(isHTMLInputElement(element)){return element.type!=="hidden"&&element.type!=="file"&&!element.disabled;}if(isHTMLButtonElement(element)||isHTMLSelectElement(element)||isHTMLTextAreaElement(element)){return!element.disabled;}return false;}function attemptFocus(element){if(!isFocusable(element)){return false;}try{element.focus();}catch(_){}return document.activeElement===element;}function focusFirstDescendant(element){for(let i=0;i<element.childNodes.length;i++){const child=element.childNodes[i];if(isHTMLElement(child)&&(attemptFocus(child)||focusFirstDescendant(child))){return true;}}return false;}function focusLastDescendant(element){for(let i=element.childNodes.length-1;i>=0;i--){const child=element.childNodes[i];if(isHTMLElement(child)&&(attemptFocus(child)||focusLastDescendant(child))){return true;}}return false;}function _isScrollable(el){if(!(el instanceof Element))return false;const style=window.getComputedStyle(el);return style.overflowX.includes("auto")||style.overflowX.includes("scroll")||style.overflowY.includes("auto")||style.overflowY.includes("scroll");}function LayerProvider(props){var _a;const{children,zOffset:zOffsetProp=0}=props;const parentContextValue=React$2.useContext(LayerContext);const parent=parentContextValue&&getLayerContext(parentContextValue);const parentRegisterChild=parent==null?void 0:parent.registerChild;const parentLevel=(_a=parent==null?void 0:parent.level)!=null?_a:0;const level=parentLevel+1;const zOffset=useArrayProp(zOffsetProp);const maxMediaIndex=zOffset.length-1;const mediaIndex=Math.min(useMediaIndex(),maxMediaIndex);const zIndex=parent?parent.zIndex+zOffset[mediaIndex]:zOffset[mediaIndex];const[,setChildLayers]=React$2.useState({});const[size,setSize]=React$2.useState(0);const isTopLayer=size===0;const registerChild=React$2.useCallback(childLevel=>{const parentDispose=parentRegisterChild==null?void 0:parentRegisterChild(childLevel);if(childLevel!==void 0){setChildLayers(state=>{var _a2;const prevLen=(_a2=state[childLevel])!=null?_a2:0;const nextState={...state,[childLevel]:prevLen+1};setSize(Object.keys(nextState).length);return nextState;});}else{setSize(v=>v+1);}return()=>{if(childLevel!==void 0){setChildLayers(state=>{const nextState={...state};if(nextState[childLevel]===1){delete nextState[childLevel];setSize(Object.keys(nextState).length);}else{nextState[childLevel]-=1;}return nextState;});}else{setSize(v=>v-1);}parentDispose==null?void 0:parentDispose();};},[parentRegisterChild]);React$2.useEffect(()=>parentRegisterChild==null?void 0:parentRegisterChild(level),[level,parentRegisterChild]);const value=React$2.useMemo(()=>({version:0,isTopLayer,level,registerChild,size,zIndex}),[isTopLayer,level,registerChild,size,zIndex]);return/* @__PURE__ */jsxRuntime.jsx(LayerContext.Provider,{value,children});}const Root$m=styled__default.default.div({position:"relative"});const LayerChildren=React$2.forwardRef(function LayerChildren2(props,ref){const{children,onActivate,onFocus,style=EMPTY_RECORD,...restProps}=props;const{zIndex,isTopLayer}=useLayer();const lastFocusedRef=React$2.useRef(null);const forwardedRef=useForwardedRef(ref);const isTopLayerRef=React$2.useRef(isTopLayer);React$2.useEffect(()=>{const becameTopLayer=isTopLayerRef.current!==isTopLayer&&isTopLayer;if(becameTopLayer){onActivate==null?void 0:onActivate({activeElement:lastFocusedRef.current});}isTopLayerRef.current=isTopLayer;},[isTopLayer,onActivate]);const handleFocus=React$2.useCallback(event=>{onFocus==null?void 0:onFocus(event);const rootElement=forwardedRef.current;const target=document.activeElement;if(!isTopLayer||!rootElement||!target)return;if(isHTMLElement(target)&&containsOrEqualsElement(rootElement,target)){lastFocusedRef.current=target;}},[forwardedRef,isTopLayer,onFocus]);return/* @__PURE__ */jsxRuntime.jsx(Root$m,{...restProps,"data-ui":"Layer",onFocus:handleFocus,ref:forwardedRef,style:{...style,zIndex},children});});const Layer=React$2.forwardRef(function Layer2(props,ref){const{children,zOffset=1,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(LayerProvider,{zOffset,children:/* @__PURE__ */jsxRuntime.jsx(LayerChildren,{...restProps,ref,children})});});const key$4=Symbol.for("@sanity/ui/context/portal");const elementKey=Symbol.for("@sanity/ui/context/portal/element");globalScope[elementKey]=null;const defaultContextValue={version:0,boundaryElement:null,get element(){if(typeof document==="undefined"){return null;}if(globalScope[elementKey]){return globalScope[elementKey];}globalScope[elementKey]=document.createElement("div");globalScope[elementKey].setAttribute("data-portal","");document.body.appendChild(globalScope[elementKey]);return globalScope[elementKey];}};globalScope[key$4]=globalScope[key$4]||React$2.createContext(defaultContextValue);const PortalContext=globalScope[key$4];function usePortal(){const value=React$2.useContext(PortalContext);if(!value){throw new Error("usePortal(): missing context value");}if(!isRecord(value)||value.version!==0){throw new Error("usePortal(): the context value is not compatible");}return value;}function Portal(props){var _a;const{children,__unstable_name:name}=props;const portal=usePortal();const portalElement=(name?portal.elements&&portal.elements[name]:portal.element)||((_a=portal.elements)==null?void 0:_a.default);if(!portalElement){return null;}return reactDomExports.createPortal(children,portalElement);}const Root$l=styled__default.default.div(_templateObject29||(_templateObject29=_taggedTemplateLiteral(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));React$2.forwardRef(function SrOnly2(props,ref){const{as,children}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$l,{"aria-hidden":true,as,"data-ui":"SrOnly",ref,children});});const Root$k=styled__default.default.div(_templateObject30||(_templateObject30=_taggedTemplateLiteral(["\n position: relative;\n"])));const ItemWrapper=styled__default.default.div(_templateObject31||(_templateObject31=_taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n"])));React$2.forwardRef(function VirtualList2(props,ref){const{as="div",gap=0,getItemKey,items=[],onChange,renderItem,...restProps}=props;const{space}=useTheme().sanity;const forwardedRef=useForwardedRef(ref);const wrapperRef=React$2.useRef(null);const[scrollTop,setScrollTop]=React$2.useState(0);const[scrollHeight,setScrollHeight]=React$2.useState(0);const[itemHeight,setItemHeight]=React$2.useState(-1);React$2.useEffect(()=>{if(!wrapperRef.current)return;const firstElement=wrapperRef.current.firstChild;if(firstElement instanceof HTMLElement){setItemHeight(firstElement.offsetHeight);}},[renderItem]);React$2.useEffect(()=>{if(!forwardedRef.current)return;let _scrollEl=forwardedRef.current.parentNode;while(_scrollEl&&!_isScrollable(_scrollEl)){_scrollEl=_scrollEl.parentNode;}if(_scrollEl){const scrollEl=_scrollEl;if(!(scrollEl instanceof HTMLElement))return;const handleScroll2=()=>{setScrollTop(scrollEl.scrollTop);};scrollEl.addEventListener("scroll",handleScroll2,{passive:true});const ro=new _ResizeObserver(entries=>{setScrollHeight(entries[0].contentRect.height);});ro.observe(scrollEl);handleScroll2();return()=>{scrollEl.removeEventListener("scroll",handleScroll2);ro.unobserve(scrollEl);ro.disconnect();};}const handleScroll=()=>{setScrollTop(window.scrollY);};const handleResize=()=>{setScrollHeight(window.innerHeight);};window.addEventListener("scroll",handleScroll,{passive:true});window.addEventListener("resize",handleResize);setScrollHeight(window.innerHeight);handleScroll();return()=>{window.removeEventListener("scroll",handleScroll);window.removeEventListener("resize",handleResize);};},[forwardedRef]);const len=items.length;const height=itemHeight?len*(itemHeight+space[gap])-space[gap]:0;const fromIndex=height?Math.max(Math.floor(scrollTop/height*len)-2,0):0;const toIndex=height?Math.ceil((scrollTop+scrollHeight)/height*len)+1:0;React$2.useEffect(()=>{if(!onChange)return;onChange({fromIndex,gap:space[gap],itemHeight,scrollHeight,scrollTop,toIndex});},[fromIndex,gap,itemHeight,onChange,scrollHeight,scrollTop,space,toIndex]);const children=React$2.useMemo(()=>{if(!renderItem||items.length===0)return null;if(itemHeight===-1){return[/* @__PURE__ */jsxRuntime.jsx(ItemWrapper,{children:renderItem(items[0])},0)];}return items.slice(fromIndex,toIndex).map((item,_itemIndex)=>{const itemIndex=fromIndex+_itemIndex;const node=renderItem(item);const key=getItemKey?getItemKey(item,itemIndex):itemIndex;return/* @__PURE__ */jsxRuntime.jsx(ItemWrapper,{style:{top:itemIndex*(itemHeight+space[gap])},children:node},key);});},[fromIndex,gap,getItemKey,itemHeight,items,renderItem,space,toIndex]);const wrapperStyle=React$2.useMemo(()=>({height}),[height]);return/* @__PURE__ */jsxRuntime.jsx(Root$k,{as,"data-ui":"VirtualList",...restProps,ref:forwardedRef,children:/* @__PURE__ */jsxRuntime.jsx("div",{ref:wrapperRef,style:wrapperStyle,children})});});const DEFAULT_POPOVER_DISTANCE=4;const DEFAULT_POPOVER_PADDING=4;const DEFAULT_POPOVER_ARROW_WIDTH=27;const DEFAULT_POPOVER_ARROW_HEIGHT=11;const DEFAULT_POPOVER_MARGINS=[0,0,0,0];function size(options){const{apply,margins,padding=0}=options;return{name:"@sanity/ui/size",async fn(args){const{elements,placement,platform,rects}=args;const{floating,reference}=rects;const overflow=await detectOverflow(args,{altBoundary:true,boundary:options.boundaryElement||void 0,elementContext:"floating",padding,rootBoundary:"viewport"});let maxWidth=Infinity;let maxHeight=Infinity;const floatingW=floating.width;const floatingH=floating.height;if(placement.includes("top")){maxWidth=floatingW-(overflow.left+overflow.right);maxHeight=floatingH-overflow.top;}if(placement.includes("right")){maxWidth=floatingW-overflow.right;maxHeight=floatingH-(overflow.top+overflow.bottom);}if(placement.includes("bottom")){maxWidth=floatingW-(overflow.left+overflow.right);maxHeight=floatingH-overflow.bottom;}if(placement.includes("left")){maxWidth=floatingW-overflow.left;maxHeight=floatingH-(overflow.top+overflow.bottom);}apply({availableWidth:maxWidth-margins[1]-margins[3],availableHeight:maxHeight-margins[0]-margins[2],elements,referenceWidth:reference.width-margins[1]-margins[3]});const nextDimensions=await platform.getDimensions(elements.floating);const targetH=nextDimensions.height;const targetW=nextDimensions.width;if(floatingW!==targetW||floatingH!==targetH){return{reset:{rects:true}};}return{};}};}const Root$j=styled__default.default.div(_templateObject32||(_templateObject32=_taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: ","px;\n height: ","px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: ","px ","px;\n }\n\n [data-placement^='top'] > & {\n bottom: -","px;\n }\n\n [data-placement^='right'] > & {\n left: -","px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -","px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -","px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])),DEFAULT_POPOVER_ARROW_WIDTH,DEFAULT_POPOVER_ARROW_WIDTH,DEFAULT_POPOVER_ARROW_WIDTH/2,DEFAULT_POPOVER_ARROW_WIDTH/2,DEFAULT_POPOVER_ARROW_WIDTH,DEFAULT_POPOVER_ARROW_WIDTH,DEFAULT_POPOVER_ARROW_WIDTH,DEFAULT_POPOVER_ARROW_WIDTH);const BorderPath=styled__default.default.path(_templateObject33||(_templateObject33=_taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));const ShapePath=styled__default.default.path(_templateObject34||(_templateObject34=_taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));const PopoverArrow=React$2.forwardRef(function PopoverArrow2(props,ref){return/* @__PURE__ */jsxRuntime.jsx(Root$j,{"data-ui":"Popover__arrow",...props,ref,children:/* @__PURE__ */jsxRuntime.jsxs("svg",{width:DEFAULT_POPOVER_ARROW_WIDTH,height:DEFAULT_POPOVER_ARROW_HEIGHT,viewBox:"0 0 27 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[/* @__PURE__ */jsxRuntime.jsx(BorderPath,{d:"M1.18708 1C3.29803 1.0011 5.29585 1.95479 6.62414 3.59561L11.1683 9.20895C12.369 10.6922 14.631 10.6922 15.8317 9.20894L20.3759 3.59561C21.7042 1.95478 23.702 1.0011 25.8129 1H21.9436C21.0533 1.49255 20.2545 2.15618 19.5986 2.96641L15.0545 8.57975C14.254 9.56855 12.746 9.56855 11.9455 8.57975L7.40139 2.96642C6.74548 2.15618 5.94673 1.49255 5.05643 1H1.18708Z"}),/* @__PURE__ */jsxRuntime.jsx(ShapePath,{d:"M1.18342 0C3.59749 0 5.88246 1.0901 7.40138 2.96642L11.9455 8.57975C12.746 9.56855 14.254 9.56855 15.0545 8.57975L19.5986 2.96641C21.1175 1.0901 23.4025 0 25.8166 0H27H0H1.18342Z"})]})});});function popoverCardStyle(props){const{$boundaryWidth}=props;return{"&:not([hidden])":{display:"flex"},flexDirection:"column",width:"max-content",minWidth:"min-content",maxWidth:typeof $boundaryWidth==="number"?"".concat($boundaryWidth-DEFAULT_POPOVER_PADDING*2,"px"):void 0};}const Root$i=React$2.memo(styled__default.default(Card)(popoverCardStyle));const PopoverContainer=React$2.memo(styled__default.default(Container)(_templateObject35||(_templateObject35=_taggedTemplateLiteral(["\n max-height: inherit;\n max-width: inherit;\n"]))));const PopoverCard=React$2.memo(React$2.forwardRef(function PopoverCard2(props,ref){const{__unstable_margins:marginsProp,arrow,arrowRef,arrowX,arrowY,boundaryWidth,children,padding,placement,overflow,radius,scheme,shadow,strategy,style,tone,width="auto",x:xProp,y:yProp,...restProps}=props;const{zIndex}=useLayer();const margins=React$2.useMemo(()=>marginsProp||DEFAULT_POPOVER_MARGINS,[marginsProp]);const x=(xProp!=null?xProp:0)+margins[3];const y=(yProp!=null?yProp:0)+margins[0];const rootStyle=React$2.useMemo(()=>({position:strategy,top:y,left:x,zIndex,...style}),[strategy,style,x,y,zIndex]);const staticSide=placement&&FLOATING_STATIC_SIDES[placement.split("-")[0]];const arrowStyle=React$2.useMemo(()=>{const style2={left:arrowX!==null?arrowX:void 0,top:arrowY!==null?arrowY:void 0,right:void 0,bottom:void 0};if(staticSide)style2[staticSide]=0-DEFAULT_POPOVER_ARROW_WIDTH;return style2;},[arrowX,arrowY,staticSide]);return/* @__PURE__ */jsxRuntime.jsxs(Root$i,{...restProps,$boundaryWidth:boundaryWidth,"data-placement":placement,"data-ui":"Popover",radius,ref,scheme,shadow,sizing:"border",style:rootStyle,tone,children:[/* @__PURE__ */jsxRuntime.jsx(PopoverContainer,{"data-ui":"Popover__wrapper",flex:1,overflow,padding,sizing:"border",width,children}),arrow&&/* @__PURE__ */jsxRuntime.jsx(PopoverArrow,{ref:arrowRef,style:arrowStyle})]});}));PopoverCard.displayName="PopoverCard";const Popover=React$2.memo(React$2.forwardRef(function Popover2(props,ref){var _a,_b,_c,_d,_e;const theme=useTheme();const boundaryElementContext=useBoundaryElement();const{__unstable_margins:margins=DEFAULT_POPOVER_MARGINS,arrow:arrowProp=true,boundaryElement=boundaryElementContext.element,children:childProp,constrainSize=false,content,disabled,fallbackPlacements,matchReferenceWidth:matchReferenceWidthProp,open,overflow="hidden",padding:paddingProp,placement:placementProp="bottom",portal,preventOverflow=true,radius:radiusProp=3,referenceElement,scheme,shadow:shadowProp=3,tone="inherit",width:widthProp="auto",zOffset:zOffsetProp=(_a=theme.sanity.layer)==null?void 0:_a.popover.zOffset,...restProps}=props;const boundarySize=(_b=useElementSize(boundaryElement))==null?void 0:_b.border;const padding=useArrayProp(paddingProp);const radius=useArrayProp(radiusProp);const shadow=useArrayProp(shadowProp);const width=useArrayProp(widthProp);const zOffset=useArrayProp(zOffsetProp);const forwardedRef=useForwardedRef(ref);const arrowRef=React$2.useRef(null);const rootBoundary="viewport";const middleware=React$2.useMemo(()=>{const ret=[];if(constrainSize||preventOverflow){ret.push(flip({boundary:boundaryElement||void 0,fallbackPlacements,padding:DEFAULT_POPOVER_PADDING,rootBoundary}));}ret.push(offset({mainAxis:arrowProp?DEFAULT_POPOVER_DISTANCE:0}));if(constrainSize||matchReferenceWidthProp){ret.push(size({apply(_ref21){let{availableWidth,availableHeight,elements,referenceWidth}=_ref21;if(matchReferenceWidthProp){elements.floating.style.width="".concat(referenceWidth,"px");}if(constrainSize){elements.floating.style.maxWidth="".concat(availableWidth,"px");elements.floating.style.maxHeight="".concat(availableHeight,"px");}},boundaryElement,constrainSize,margins,matchReferenceWidth:matchReferenceWidthProp,padding:DEFAULT_POPOVER_PADDING}));}if(preventOverflow){ret.push(shift({boundary:boundaryElement||void 0,rootBoundary,padding:DEFAULT_POPOVER_PADDING}));}if(arrowProp){ret.push(arrow({element:arrowRef,padding:DEFAULT_POPOVER_PADDING}));}ret.push(hide({boundary:boundaryElement||void 0,padding:DEFAULT_POPOVER_PADDING,strategy:"referenceHidden"}));return ret;},[arrowProp,boundaryElement,constrainSize,fallbackPlacements,margins,matchReferenceWidthProp,preventOverflow]);const floatingProps=React$2.useMemo(()=>({middleware,placement:placementProp,whileElementsMounted:autoUpdate}),[middleware,placementProp]);const{x,y,placement,reference:referenceRef,floating:floatingRef,middlewareData,strategy}=useFloating(floatingProps);const referenceHidden=(_c=middlewareData.hide)==null?void 0:_c.referenceHidden;const arrowX=(_d=middlewareData.arrow)==null?void 0:_d.x;const arrowY=(_e=middlewareData.arrow)==null?void 0:_e.y;const setArrow=React$2.useCallback(arrowEl=>{arrowRef.current=arrowEl;},[]);const setFloating=React$2.useCallback(node=>{forwardedRef.current=node;floatingRef(node);},[floatingRef,forwardedRef]);const setReference=React$2.useCallback(node=>{referenceRef(node);const childRef=childProp==null?void 0:childProp.ref;if(typeof childRef==="function"){childRef(node);}else if(childRef){childRef.current=node;}},[childProp,referenceRef]);const child=React$2.useMemo(()=>{if(!childProp||referenceElement)return null;return React$2.cloneElement(childProp,{ref:setReference});},[childProp,referenceElement,setReference]);React$2.useEffect(()=>{referenceRef(referenceElement||null);},[referenceRef,referenceElement]);if(disabled){return childProp||/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{});}const popover=/* @__PURE__ */jsxRuntime.jsx(LayerProvider,{zOffset,children:/* @__PURE__ */jsxRuntime.jsx(PopoverCard,{...restProps,__unstable_margins:margins,arrow:arrowProp,arrowRef:setArrow,arrowX,arrowY,boundaryWidth:preventOverflow?boundarySize==null?void 0:boundarySize.width:void 0,hidden:referenceHidden,overflow,padding,placement,radius,ref:setFloating,scheme,shadow,strategy,tone,x,y,width,children:content})});return/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[open&&/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{children:portal?/* @__PURE__ */jsxRuntime.jsx(Portal,{__unstable_name:typeof portal==="string"?portal:void 0,children:popover}):popover}),child]});}));Popover.displayName="Popover";function radioBaseStyle(){return styled.css(_templateObject36||(_templateObject36=_taggedTemplateLiteral(["\n position: relative;\n\n &:not([hidden]) {\n display: inline-block;\n }\n\n &[data-read-only] {\n outline: 1px solid red;\n }\n "])));}function inputElementStyle(props){const{theme}=props;const{focusRing,input}=theme.sanity;const color=theme.sanity.color.input;const dist=(input.radio.size-input.radio.markSize)/2;return styled.css(_templateObject37||(_templateObject37=_taggedTemplateLiteral(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ",";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ",";\n width: ",";\n border-radius: ",";\n background: ",";\n box-shadow: ",";\n\n &::after {\n content: '';\n position: absolute;\n top: ",";\n left: ",";\n height: ",";\n width: ",";\n border-radius: ",";\n background: ",";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ",";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ",";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ",";\n background: ",";\n\n &::after {\n background: ",";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ",";\n background: ",";\n\n &::after {\n background: ",";\n }\n }\n "])),rem(input.radio.size/2),rem(input.radio.size),rem(input.radio.size),rem(input.radio.size/2),color.default.enabled.bg,focusRingBorderStyle({color:color.default.enabled.border,width:input.border.width}),rem(dist),rem(dist),rem(input.radio.markSize),rem(input.radio.markSize),rem(input.radio.markSize/2),color.default.enabled.fg,focusRingStyle({border:{width:input.border.width,color:color.default.enabled.border},focusRing}),focusRingBorderStyle({color:color.default.enabled.border,width:input.border.width}),color.default.readOnly.border,color.default.readOnly.bg,color.default.readOnly.fg,color.default.disabled.border,color.default.disabled.bg,color.default.disabled.fg);}const Root$h=styled__default.default.div(radioBaseStyle);const Input$4=styled__default.default.input(inputElementStyle);React$2.forwardRef(function Radio2(props,forwardedRef){const{className,disabled,style,customValidity,readOnly,...restProps}=props;const ref=useForwardedRef(forwardedRef);useCustomValidity(ref,customValidity);return/* @__PURE__ */jsxRuntime.jsxs(Root$h,{className,"data-ui":"Radio",style,children:[/* @__PURE__ */jsxRuntime.jsx(Input$4,{"data-read-only":!disabled&&readOnly?"":void 0,...restProps,disabled:disabled||readOnly,readOnly,ref,type:"radio"}),/* @__PURE__ */jsxRuntime.jsx("span",{})]});});function rootStyle(){return styled.css(_templateObject38||(_templateObject38=_taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));}function inputBaseStyle(props){const{theme}=props;const font=theme.sanity.fonts.text;return styled.css(_templateObject39||(_templateObject39=_taggedTemplateLiteral(["\n -webkit-font-smoothing: antialiased;\n appearance: none;\n border: 0;\n font-family: ",";\n color: inherit;\n width: 100%;\n outline: none;\n margin: 0;\n\n &:disabled {\n opacity: 1;\n }\n "])),font.family);}function inputColorStyle(props){const{theme}=props;const{focusRing,input}=theme.sanity;const color=theme.sanity.color.input;return styled.css(_templateObject40||(_templateObject40=_taggedTemplateLiteral(["\n /* enabled */\n background-color: ",";\n color: ",";\n box-shadow: ",";\n\n /* hovered */\n @media (hover: hover) {\n &:not(:disabled):hover {\n background-color: ",";\n color: ",";\n box-shadow: ",";\n }\n }\n\n /* focused */\n &:not(:disabled):focus {\n box-shadow: ",";\n }\n\n /* read-only */\n &[data-read-only] {\n background-color: ",";\n color: ",";\n box-shadow: ",";\n }\n\n /* disabled */\n &:not([data-read-only]):disabled {\n background-color: ",";\n color: ",";\n box-shadow: ",";\n }\n "])),color.default.enabled.bg,color.default.enabled.fg,focusRingBorderStyle({color:color.default.enabled.border,width:input.border.width}),color.default.hovered.bg,color.default.hovered.fg,focusRingBorderStyle({color:color.default.hovered.border,width:input.border.width}),focusRingStyle({border:{width:input.border.width,color:color.default.enabled.border},focusRing}),color.default.readOnly.bg,color.default.readOnly.fg,focusRingBorderStyle({color:color.default.readOnly.border,width:input.border.width}),color.default.disabled.bg,color.default.disabled.fg,focusRingBorderStyle({color:color.default.disabled.border,width:input.border.width}));}function textSize(size){return{fontSize:rem(size.fontSize),lineHeight:rem(size.lineHeight)};}function inputTextSizeStyle(props){const{theme,$fontSize}=props;const{sizes}=theme.sanity.fonts.text;return _responsive(theme.sanity.media,$fontSize,sizeIndex=>textSize(sizes[sizeIndex]||sizes[2]));}function inputStyle(){return[responsiveRadiusStyle,inputBaseStyle,inputColorStyle,inputTextSizeStyle,responsiveInputPaddingIconRightStyle];}function iconBoxStyle(props){const{theme}=props;const color=theme.sanity.color.input;return styled.css(_templateObject41||(_templateObject41=_taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n --card-fg-color: ",";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n --card-fg-color: ",";\n }\n }\n\n /* disabled */\n select:disabled + && {\n --card-fg-color: ",";\n }\n\n /* read-only */\n select[data-read-only] + && {\n --card-fg-color: ",";\n }\n "])),color.default.enabled.fg,color.default.hovered.fg,color.default.disabled.fg,color.default.readOnly.fg);}const selectStyle={root:rootStyle,input:inputStyle,iconBox:iconBoxStyle};const Root$g=styled__default.default.div(selectStyle.root);const Input$3=styled__default.default.select(selectStyle.input);const IconBox=styled__default.default(Box)(selectStyle.iconBox);React$2.forwardRef(function Select2(props,forwardedRef){const{children,customValidity,disabled,fontSize=2,padding=3,radius=1,readOnly,space=3,...restProps}=props;const ref=useForwardedRef(forwardedRef);useCustomValidity(ref,customValidity);return/* @__PURE__ */jsxRuntime.jsxs(Root$g,{"data-ui":"Select",children:[/* @__PURE__ */jsxRuntime.jsx(Input$3,{"data-read-only":!disabled&&readOnly?"":void 0,"data-ui":"Select",...restProps,$fontSize:useArrayProp(fontSize),$padding:useArrayProp(padding),$radius:useArrayProp(radius),$space:useArrayProp(space),disabled:disabled||readOnly,ref,children}),/* @__PURE__ */jsxRuntime.jsx(IconBox,{padding,children:/* @__PURE__ */jsxRuntime.jsx(Text,{size:fontSize,children:/* @__PURE__ */jsxRuntime.jsx(SelectIcon,{})})})]});});const BASE_STYLE={"&&:not([hidden])":{display:"grid"},'&[data-as="ul"],&[data-as="ol"]':{listStyle:"none"},gridTemplateColumns:"minmax(0, 1fr)",gridAutoRows:"min-content"};function stackBaseStyle(){return BASE_STYLE;}function responsiveStackSpaceStyle(props){const{theme}=props;const{media,space}=theme.sanity;return _responsive(media,props.$space,spaceIndex=>({gridGap:rem(space[spaceIndex])}));}const Root$f=styled__default.default(Box)(stackBaseStyle,responsiveStackSpaceStyle);const Stack=React$2.forwardRef(function Stack2(props,ref){const{as,space,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$f,{"data-as":typeof as==="string"?as:void 0,"data-ui":"Stack",...restProps,$space:useArrayProp(space),forwardedAs:as,ref});});function switchBaseStyles(){return styled.css(_templateObject42||(_templateObject42=_taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));}function switchInputStyles(){return styled.css(_templateObject43||(_templateObject43=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n padding: 0;\n margin: 0;\n\n /* Place the input element above the representation element */\n z-index: 1;\n "])));}function switchRepresentationStyles(props){const{theme}=props;const{focusRing,input}=theme.sanity;const color=theme.sanity.color.button.default;return styled.css(_templateObject44||(_templateObject44=_taggedTemplateLiteral(["\n --switch-bg-color: ",";\n --switch-fg-color: ",";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ",";\n height: ",";\n border-radius: ",";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ",";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ",";\n --switch-fg-color: ",";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ",";\n --switch-fg-color: ",";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ",";\n --switch-fg-color: ",";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ",";\n --switch-fg-color: ",";\n }\n "])),color.default.enabled.bg,color.default.enabled.fg,rem(input.switch.width),rem(input.switch.height),rem(input.switch.height/2),focusRingStyle({focusRing}),color.positive.enabled.bg,color.positive.enabled.fg,color.default.hovered.bg,color.default.hovered.fg,color.positive.hovered.bg,color.positive.hovered.fg,color.default.disabled.bg,color.default.disabled.fg);}function switchTrackStyles(props){const{theme}=props;const{input}=theme.sanity;return styled.css(_templateObject45||(_templateObject45=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n background-color: var(--switch-bg-color);\n position: absolute;\n left: 0;\n top: 0;\n width: ",";\n height: ",";\n border-radius: ",";\n "])),rem(input.switch.width),rem(input.switch.height),rem(input.switch.height/2));}function switchThumbStyles(props){const{$indeterminate,theme}=props;const{input}=theme.sanity;const trackWidth=input.switch.width;const trackHeight=input.switch.height;const trackPadding=input.switch.padding;const size=trackHeight-input.switch.padding*2;const checkedOffset=trackWidth-trackPadding*2-size;const indeterminateOffset=trackWidth/2-size/2-trackPadding;const checked=$indeterminate!==true&&props.$checked===true;return styled.css(_templateObject46||(_templateObject46=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n position: absolute;\n left: ",";\n top: ",";\n height: ",";\n width: ",";\n border-radius: ",";\n transition-property: transform;\n transition-duration: ","ms;\n transition-timing-function: ",";\n background: var(--switch-fg-color);\n transform: translate3d(0, 0, 0);\n\n ","\n\n ","\n "])),rem(trackPadding),rem(trackPadding),rem(size),rem(size),rem(size/2),input.switch.transitionDurationMs,input.switch.transitionTimingFunction,checked&&styled.css(_templateObject47||(_templateObject47=_taggedTemplateLiteral(["\n transform: translate3d(","px, 0, 0);\n "])),checkedOffset),$indeterminate&&styled.css(_templateObject48||(_templateObject48=_taggedTemplateLiteral(["\n transform: translate3d(","px, 0, 0);\n "])),indeterminateOffset));}const Root$e=styled__default.default.span(switchBaseStyles);const Input$2=styled__default.default.input(switchInputStyles);const Representation=styled__default.default.span(switchRepresentationStyles);const Track=styled__default.default.span(switchTrackStyles);const Thumb=styled__default.default.span(switchThumbStyles);React$2.forwardRef(function Switch2(props,forwardedRef){const{checked,className,disabled,indeterminate,readOnly,style,...restProps}=props;const ref=useForwardedRef(forwardedRef);React$2.useEffect(()=>{if(ref.current){ref.current.indeterminate=indeterminate||false;}},[indeterminate,ref]);return/* @__PURE__ */jsxRuntime.jsxs(Root$e,{className,"data-ui":"Switch",style,children:[/* @__PURE__ */jsxRuntime.jsx(Input$2,{"data-read-only":!disabled&&readOnly?"":void 0,...restProps,checked:indeterminate!==true&&checked,disabled:disabled||readOnly,type:"checkbox",ref}),/* @__PURE__ */jsxRuntime.jsxs(Representation,{"aria-hidden":true,"data-name":"representation",children:[/* @__PURE__ */jsxRuntime.jsx(Track,{}),/* @__PURE__ */jsxRuntime.jsx(Thumb,{$checked:checked,$indeterminate:indeterminate})]})]});});const Root$d=styled__default.default.span(textInputRootStyle);const InputRoot$1=styled__default.default.span(_templateObject49||(_templateObject49=_taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));const Input$1=styled__default.default.textarea(responsiveInputPaddingStyle,textInputBaseStyle,textInputFontSizeStyle);const Presentation$1=styled__default.default.div(responsiveRadiusStyle,textInputRepresentationStyle);React$2.forwardRef(function TextArea2(props,forwardedRef){const{border=true,customValidity,disabled=false,fontSize=2,padding=3,radius=1,weight,...restProps}=props;const ref=useForwardedRef(forwardedRef);const rootTheme=useRootTheme();useCustomValidity(ref,customValidity);return/* @__PURE__ */jsxRuntime.jsx(Root$d,{"data-ui":"TextArea",children:/* @__PURE__ */jsxRuntime.jsxs(InputRoot$1,{children:[/* @__PURE__ */jsxRuntime.jsx(Input$1,{"data-as":"textarea","data-scheme":rootTheme.scheme,"data-tone":rootTheme.tone,...restProps,$fontSize:useArrayProp(fontSize),$padding:useArrayProp(padding),$scheme:rootTheme.scheme,$space:useArrayProp(0),$tone:rootTheme.tone,$weight:weight,disabled,ref}),/* @__PURE__ */jsxRuntime.jsx(Presentation$1,{$radius:useArrayProp(radius),$scheme:rootTheme.scheme,$tone:rootTheme.tone,"data-border":border?"":void 0,"data-scheme":rootTheme.scheme,"data-tone":rootTheme.tone})]})});});const CLEAR_BUTTON_BOX_STYLE={zIndex:2};const Root$c=styled__default.default(Card).attrs({forwardedAs:"span"})(textInputRootStyle);const InputRoot=styled__default.default.span(_templateObject50||(_templateObject50=_taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));const Prefix=styled__default.default(Card).attrs({forwardedAs:"span"})(_templateObject51||(_templateObject51=_taggedTemplateLiteral(["\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));const Suffix=styled__default.default(Card).attrs({forwardedAs:"span"})(_templateObject52||(_templateObject52=_taggedTemplateLiteral(["\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));const Input=styled__default.default.input(responsiveInputPaddingStyle,textInputBaseStyle,textInputFontSizeStyle);const Presentation=styled__default.default.span(responsiveRadiusStyle,textInputRepresentationStyle);const LeftBox=styled__default.default(Box)(_templateObject53||(_templateObject53=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));const RightBox=styled__default.default(Box)(_templateObject54||(_templateObject54=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));const RightCard=styled__default.default(Card)(_templateObject55||(_templateObject55=_taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));const TextInput=React$2.forwardRef(function TextInput2(props,forwardedRef){const{border=true,clearButton,disabled=false,fontSize:fontSizeProp=2,icon,iconRight,onClear,padding:paddingProp=3,prefix,radius:radiusProp=1,readOnly,space:spaceProp=3,suffix,customValidity,type="text",weight,...restProps}=props;const ref=useForwardedRef(forwardedRef);const rootTheme=useRootTheme();const fontSize=useArrayProp(fontSizeProp);const padding=useArrayProp(paddingProp);const radius=useArrayProp(radiusProp);const space=useArrayProp(spaceProp);const $hasClearButton=Boolean(clearButton);const $hasIcon=Boolean(icon);const $hasIconRight=Boolean(iconRight);const $hasSuffix=Boolean(suffix);const $hasPrefix=Boolean(prefix);useCustomValidity(ref,customValidity);const handleClearMouseDown=React$2.useCallback(event=>{event.preventDefault();event.stopPropagation();},[]);const handleClearClick=React$2.useCallback(event=>{var _a;event.preventDefault();event.stopPropagation();if(onClear)onClear();(_a=ref.current)==null?void 0:_a.focus();},[onClear,ref]);const prefixNode=React$2.useMemo(()=>prefix&&/* @__PURE__ */jsxRuntime.jsx(Prefix,{borderTop:true,borderLeft:true,borderBottom:true,radius,sizing:"border",tone:"inherit",children:/* @__PURE__ */jsxRuntime.jsx("span",{children:prefix})}),[prefix,radius]);const presentationNode=React$2.useMemo(()=>/* @__PURE__ */jsxRuntime.jsxs(Presentation,{$hasPrefix,$hasSuffix,$radius:radius,$scheme:rootTheme.scheme,$tone:rootTheme.tone,"data-border":border?"":void 0,"data-scheme":rootTheme.scheme,"data-tone":rootTheme.tone,children:[icon&&/* @__PURE__ */jsxRuntime.jsx(LeftBox,{padding,children:/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(icon)&&icon,reactIsExports$1.isValidElementType(icon)&&React$2.createElement(icon)]})}),!$hasClearButton&&iconRight&&/* @__PURE__ */jsxRuntime.jsx(RightBox,{padding,children:/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(iconRight)&&iconRight,reactIsExports$1.isValidElementType(iconRight)&&React$2.createElement(iconRight)]})})]}),[border,fontSize,icon,iconRight,padding,radius,rootTheme,$hasClearButton,$hasPrefix,$hasSuffix]);const clearButtonBoxPadding=React$2.useMemo(()=>padding.map(v=>{if(v===0)return 0;if(v===1)return 1;if(v===2)return 1;return v-2;}),[padding]);const clearButtonPadding=React$2.useMemo(()=>padding.map(v=>{if(v===0)return 0;if(v===1)return 0;if(v===2)return 1;return v-1;}),[padding]);const clearButtonProps=React$2.useMemo(()=>typeof clearButton==="object"?clearButton:EMPTY_RECORD,[clearButton]);const clearButtonNode=React$2.useMemo(()=>!disabled&&!readOnly&&clearButton&&/* @__PURE__ */jsxRuntime.jsx(RightCard,{forwardedAs:"span",padding:clearButtonBoxPadding,style:CLEAR_BUTTON_BOX_STYLE,tone:customValidity?"critical":"inherit",children:/* @__PURE__ */jsxRuntime.jsx(Button,{"aria-label":"Clear","data-qa":"clear-button",fontSize,icon:CloseIcon,mode:"bleed",padding:clearButtonPadding,radius,...clearButtonProps,onClick:handleClearClick,onMouseDown:handleClearMouseDown})}),[clearButton,clearButtonBoxPadding,clearButtonPadding,clearButtonProps,customValidity,disabled,fontSize,handleClearClick,handleClearMouseDown,radius,readOnly]);const suffixNode=React$2.useMemo(()=>suffix&&/* @__PURE__ */jsxRuntime.jsx(Suffix,{borderTop:true,borderRight:true,borderBottom:true,radius,sizing:"border",tone:"inherit",children:/* @__PURE__ */jsxRuntime.jsx("span",{children:suffix})}),[radius,suffix]);return/* @__PURE__ */jsxRuntime.jsxs(Root$c,{"data-ui":"TextInput",tone:rootTheme.tone,children:[prefixNode,/* @__PURE__ */jsxRuntime.jsxs(InputRoot,{children:[/* @__PURE__ */jsxRuntime.jsx(Input,{"data-as":"input","data-scheme":rootTheme.scheme,"data-tone":rootTheme.tone,...restProps,$fontSize:fontSize,$iconLeft:$hasIcon,$iconRight:$hasIconRight||$hasClearButton,$padding:padding,$scheme:rootTheme.scheme,$space:space,$tone:rootTheme.tone,$weight:weight,disabled,readOnly,ref,type}),presentationNode,clearButtonNode]}),suffixNode]});});const Root$b=styled__default.default.div(_templateObject56||(_templateObject56=_taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 7.5px 7.5px;\n }\n\n /* position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n } */\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));const Border=styled__default.default.path(_templateObject57||(_templateObject57=_taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));const Shape=styled__default.default.path(_templateObject58||(_templateObject58=_taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));const TooltipArrow=React$2.forwardRef(function TooltipArrow2(props,ref){const{...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$b,{"data-ui":"Tooltip__arrow",...restProps,ref,children:/* @__PURE__ */jsxRuntime.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",children:[/* @__PURE__ */jsxRuntime.jsx(Border,{d:"M11.5266 1C11.032 1.32802 10.5837 1.73105 10.1995 2.20057L9.04792 3.6081C8.24771 4.58614 6.7523 4.58614 5.95209 3.6081L4.80047 2.20057C4.41632 1.73105 3.96796 1.32802 3.47341 1H0.156727C1.65639 1 3.07687 1.67313 4.02651 2.83381L5.17813 4.24134C6.37844 5.70839 8.62156 5.70839 9.82187 4.24134L10.9735 2.83381C11.9231 1.67313 13.3436 1 14.8433 1H11.5266Z"}),/* @__PURE__ */jsxRuntime.jsx(Shape,{d:"M0.156725 0C1.95632 0 3.66089 0.80776 4.80047 2.20057L5.95209 3.6081C6.75229 4.58614 8.24771 4.58614 9.04791 3.6081L10.1995 2.20057C11.3391 0.80776 13.0437 0 14.8433 0H15H0H0.156725Z"})]})});});const Root$a=styled__default.default(Layer)(_templateObject59||(_templateObject59=_taggedTemplateLiteral(["\n pointer-events: none;\n"])));React$2.forwardRef(function Tooltip2(props,ref){var _a,_b,_c;const boundaryElementContext=useBoundaryElement();const theme=useTheme();const{boundaryElement=boundaryElementContext==null?void 0:boundaryElementContext.element,children:childProp,content,disabled,fallbackPlacements:fallbackPlacementsProp,padding,placement:placementProp="bottom",portal,scheme,shadow=2,zOffset=(_a=theme.sanity.layer)==null?void 0:_a.tooltip.zOffset,...restProps}=props;const fallbackPlacements=useArrayProp(fallbackPlacementsProp);const forwardedRef=useForwardedRef(ref);const[referenceElement,setReferenceElement]=React$2.useState(null);const arrowRef=React$2.useRef(null);const rootBoundary="viewport";const middleware=React$2.useMemo(()=>{const ret=[];ret.push(flip({boundary:boundaryElement||void 0,fallbackPlacements,padding:4,rootBoundary}));ret.push(offset({mainAxis:3}));ret.push(shift({boundary:boundaryElement||void 0,rootBoundary,padding:4}));ret.push(arrow({element:arrowRef,padding:2}));return ret;},[boundaryElement,fallbackPlacements]);const{x,y,placement,reference,floating,middlewareData,update,strategy}=useFloating({middleware,placement:placementProp,whileElementsMounted:autoUpdate});const rootStyle=React$2.useMemo(()=>({position:strategy,top:y!=null?y:0,left:x!=null?x:0}),[strategy,x,y]);const staticSide=placement&&FLOATING_STATIC_SIDES[placement.split("-")[0]];const arrowX=(_b=middlewareData.arrow)==null?void 0:_b.x;const arrowY=(_c=middlewareData.arrow)==null?void 0:_c.y;const arrowStyle=React$2.useMemo(()=>{const style={left:arrowX!==null?arrowX:void 0,top:arrowY!==null?arrowY:void 0,right:void 0,bottom:void 0};if(staticSide)style[staticSide]=-15;return style;},[arrowX,arrowY,staticSide]);const[isOpen,setIsOpen]=React$2.useState(false);const handleBlur=React$2.useCallback(()=>setIsOpen(false),[]);const handleFocus=React$2.useCallback(()=>setIsOpen(true),[]);const handleMouseEnter=React$2.useCallback(()=>setIsOpen(true),[]);const handleMouseLeave=React$2.useCallback(()=>setIsOpen(false),[]);React$2.useEffect(()=>{if(!isOpen)return;function handleWindowMouseMove(event){if(!referenceElement)return;const isHoveringReference=referenceElement===event.target||event.target instanceof Node&&referenceElement.contains(event.target);if(!isHoveringReference){setIsOpen(false);window.removeEventListener("mousemove",handleWindowMouseMove);}}window.addEventListener("mousemove",handleWindowMouseMove);return()=>{window.removeEventListener("mousemove",handleWindowMouseMove);};},[isOpen,referenceElement]);React$2.useEffect(()=>{if(disabled)setIsOpen(false);},[disabled]);React$2.useEffect(()=>{if(!content)setIsOpen(false);},[content]);React$2.useEffect(()=>reference(referenceElement),[reference,referenceElement]);const setArrow=React$2.useCallback(arrowEl=>{arrowRef.current=arrowEl;update();},[update]);const setFloating=React$2.useCallback(node=>{forwardedRef.current=node;floating(node);},[floating,forwardedRef]);const childRef=childProp==null?void 0:childProp.ref;const setReference=React$2.useCallback(node=>{if(typeof childRef==="function"){childRef(node);}else if(childRef){childRef.current=node;}setReferenceElement(node);},[childRef]);const child=React$2.useMemo(()=>{if(!childProp)return null;return React$2.cloneElement(childProp,{onBlur:handleBlur,onFocus:handleFocus,onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,ref:setReference});},[childProp,handleBlur,handleFocus,handleMouseEnter,handleMouseLeave,setReference]);if(!child)return/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{});if(disabled)return child;const root=/* @__PURE__ */jsxRuntime.jsx(Root$a,{"data-ui":"Tooltip",...restProps,ref:setFloating,style:rootStyle,zOffset,children:/* @__PURE__ */jsxRuntime.jsxs(Card,{"data-ui":"Tooltip__card","data-placement":placement,padding,radius:2,scheme,shadow,children:[content,/* @__PURE__ */jsxRuntime.jsx(TooltipArrow,{ref:setArrow,style:arrowStyle})]})});return/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[child,isOpen&&/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{children:portal?/* @__PURE__ */jsxRuntime.jsx(Portal,{__unstable_name:typeof portal==="string"?portal:void 0,children:root}):root})]});});const Root$9=styled__default.default.div(_templateObject60||(_templateObject60=_taggedTemplateLiteral(["\n line-height: 0;\n"])));const ListBox=styled__default.default(Box)(_templateObject61||(_templateObject61=_taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));const rotate=styled.keyframes(_templateObject62||(_templateObject62=_taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));const AnimatedSpinnerIcon=styled__default.default(SpinnerIcon)(_templateObject63||(_templateObject63=_taggedTemplateLiteral(["\n animation: "," 500ms linear infinite;\n"])),rotate);function AutocompleteOption(props){const{children,id,onSelect,selected,value}=props;const handleClick=React$2.useCallback(()=>{setTimeout(()=>{onSelect(value);},0);},[onSelect,value]);const handleKeyDown=React$2.useCallback(event=>{if(event.key==="Enter"&&!_isEnterToClickElement(event.currentTarget)){handleClick();}},[handleClick]);return/* @__PURE__ */jsxRuntime.jsx("li",{"aria-selected":selected,"data-ui":"AutocompleteOption",id,role:"option",onClick:handleClick,onKeyDown:handleKeyDown,children});}function autocompleteReducer(state,msg){if(msg.type==="input/change"){return{...state,activeValue:null,focused:true,query:msg.query};}if(msg.type==="input/focus"){return{...state,focused:true};}if(msg.type==="root/blur"){return{...state,focused:false,query:null};}if(msg.type==="root/clear"){return{...state,activeValue:null,query:null,value:null};}if(msg.type==="root/escape"){return{...state,focused:false,query:null};}if(msg.type==="root/open"){return{...state,query:state.query||msg.query};}if(msg.type==="root/setActiveValue"){return{...state,activeValue:msg.value,listFocused:msg.listFocused||state.listFocused};}if(msg.type==="root/setListFocused"){return{...state,listFocused:msg.listFocused};}if(msg.type==="value/change"){return{...state,activeValue:msg.value,query:null,value:msg.value};}return state;}const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS=["Control","Shift","Alt","Enter","Home","End","PageUp","PageDown","Meta","Tab","CapsLock"];const AUTOCOMPLETE_POPOVER_PLACEMENT="bottom-start";const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS=["bottom-start","top-start"];const DEFAULT_RENDER_VALUE=(value,option)=>option?option.value:value;const DEFAULT_FILTER_OPTION=(query,option)=>option.value.toLowerCase().indexOf(query.toLowerCase())>-1;React$2.forwardRef(function InnerAutocomplete2(props,ref){const{border=true,customValidity,disabled,filterOption:filterOptionProp,fontSize=2,icon,id,listBox=EMPTY_RECORD,loading,onBlur,onChange,onFocus,onQueryChange,onSelect,openButton,options:optionsProp,padding:paddingProp=3,popover=EMPTY_RECORD,prefix,radius=3,readOnly,relatedElements,renderOption:renderOptionProp,renderPopover,renderValue=DEFAULT_RENDER_VALUE,suffix,value:valueProp,...restProps}=props;const[state,dispatch]=React$2.useReducer(autocompleteReducer,{activeValue:valueProp||null,focused:false,listFocused:false,query:null,value:valueProp||null});const{activeValue,focused,listFocused,query,value}=state;const defaultRenderOption=React$2.useCallback(_ref22=>{let{value:value2}=_ref22;return/* @__PURE__ */jsxRuntime.jsx(Card,{"data-as":"button",padding:paddingProp,radius:2,tone:"inherit",children:/* @__PURE__ */jsxRuntime.jsx(Text,{size:fontSize,textOverflow:"ellipsis",children:value2})});},[fontSize,paddingProp]);const renderOption=typeof renderOptionProp==="function"?renderOptionProp:defaultRenderOption;const filterOption=typeof filterOptionProp==="function"?filterOptionProp:DEFAULT_FILTER_OPTION;const rootElementRef=React$2.useRef(null);const resultsPopoverElementRef=React$2.useRef(null);const inputElementRef=React$2.useRef(null);const listBoxElementRef=React$2.useRef(null);const listFocusedRef=React$2.useRef(false);const valueRef=React$2.useRef(value);const valuePropRef=React$2.useRef(valueProp);const popoverMouseWithinRef=React$2.useRef(false);const forwardedRef=useForwardedRef(ref);const listBoxId="".concat(id,"-listbox");const options=Array.isArray(optionsProp)?optionsProp:EMPTY_ARRAY;const padding=useArrayProp(paddingProp);const currentOption=React$2.useMemo(()=>value!==null?options.find(o=>o.value===value):void 0,[options,value]);const filteredOptions=React$2.useMemo(()=>options.filter(option=>query?filterOption(query,option):true),[filterOption,options,query]);const filteredOptionsLen=filteredOptions.length;const activeItemId=activeValue?"".concat(id,"-option-").concat(activeValue):void 0;const expanded=query!==null&&loading||focused&&query!==null;const handleRootBlur=React$2.useCallback(event=>{setTimeout(()=>{if(popoverMouseWithinRef.current){return;}const elements=(relatedElements||[]).concat(rootElementRef.current?[rootElementRef.current]:[],resultsPopoverElementRef.current?[resultsPopoverElementRef.current]:[]);let focusInside=false;if(document.activeElement){for(const e of elements){if(e===document.activeElement||e.contains(document.activeElement)){focusInside=true;break;}}}if(focusInside===false){dispatch({type:"root/blur"});popoverMouseWithinRef.current=false;if(onQueryChange)onQueryChange(null);if(onBlur)onBlur(event);}},0);},[onBlur,onQueryChange,relatedElements]);const handleRootFocus=React$2.useCallback(event=>{const listBoxElement=listBoxElementRef.current;const focusedElement=event.target instanceof HTMLElement?event.target:null;const listFocused2=(listBoxElement==null?void 0:listBoxElement.contains(focusedElement))||false;if(listFocused2!==listFocusedRef.current){listFocusedRef.current=listFocused2;dispatch({type:"root/setListFocused",listFocused:listFocused2});}},[]);const handleOptionSelect=React$2.useCallback(v=>{var _a;dispatch({type:"value/change",value:v});popoverMouseWithinRef.current=false;if(onSelect)onSelect(v);valueRef.current=v;if(onChange)onChange(v);if(onQueryChange)onQueryChange(null);(_a=inputElementRef.current)==null?void 0:_a.focus();},[onChange,onSelect,onQueryChange]);const handleRootKeyDown=React$2.useCallback(event=>{var _a,_b;if(event.key==="ArrowDown"){event.preventDefault();if(!filteredOptionsLen)return;const activeOption=filteredOptions.find(o=>o.value===activeValue);const activeIndex=activeOption?filteredOptions.indexOf(activeOption):-1;const nextActiveOption=filteredOptions[(activeIndex+1)%filteredOptionsLen];if(nextActiveOption){dispatch({type:"root/setActiveValue",value:nextActiveOption.value,listFocused:true});}return;}if(event.key==="ArrowUp"){event.preventDefault();if(!filteredOptionsLen)return;const activeOption=filteredOptions.find(o=>o.value===activeValue);const activeIndex=activeOption?filteredOptions.indexOf(activeOption):-1;const nextActiveOption=filteredOptions[activeIndex===-1?filteredOptionsLen-1:(filteredOptionsLen+activeIndex-1)%filteredOptionsLen];if(nextActiveOption){dispatch({type:"root/setActiveValue",value:nextActiveOption.value,listFocused:true});}return;}if(event.key==="Escape"){dispatch({type:"root/escape"});popoverMouseWithinRef.current=false;if(onQueryChange)onQueryChange(null);(_a=inputElementRef.current)==null?void 0:_a.focus();return;}const target=event.target;const listEl=listBoxElementRef.current;if((listEl===target||(listEl==null?void 0:listEl.contains(target)))&&!AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event.key)){(_b=inputElementRef.current)==null?void 0:_b.focus();return;}},[activeValue,filteredOptions,filteredOptionsLen,onQueryChange]);const handleInputChange=React$2.useCallback(event=>{const nextQuery=event.currentTarget.value;dispatch({type:"input/change",query:nextQuery});if(onQueryChange)onQueryChange(nextQuery);},[onQueryChange]);const handleInputFocus=React$2.useCallback(event=>{if(!focused){dispatch({type:"input/focus"});if(onFocus)onFocus(event);}},[focused,onFocus]);const handlePopoverMouseEnter=React$2.useCallback(()=>{popoverMouseWithinRef.current=true;},[]);const handlePopoverMouseLeave=React$2.useCallback(()=>{popoverMouseWithinRef.current=false;},[]);const handleClearButtonClick=React$2.useCallback(()=>{var _a;dispatch({type:"root/clear"});valueRef.current="";if(onChange)onChange("");if(onQueryChange)onQueryChange(null);(_a=inputElementRef.current)==null?void 0:_a.focus();},[onChange,onQueryChange]);const handleClearButtonFocus=React$2.useCallback(()=>{dispatch({type:"input/focus"});},[]);React$2.useEffect(()=>{if(valueProp!==valuePropRef.current){valuePropRef.current=valueProp;if(valueProp!==void 0){dispatch({type:"value/change",value:valueProp});valueRef.current=valueProp;}return;}if(valueProp!==valueRef.current){valueRef.current=valueProp||null;dispatch({type:"value/change",value:valueProp||null});}},[valueProp]);React$2.useEffect(()=>{if(!focused&&valueRef.current){dispatch({type:"root/setActiveValue",value:valueRef.current});}},[focused]);React$2.useEffect(()=>{const listElement=listBoxElementRef.current;if(!listElement)return;const activeOption=filteredOptions.find(o=>o.value===activeValue);if(activeOption){const activeIndex=filteredOptions.indexOf(activeOption);const activeItemElement=listElement.childNodes[activeIndex];if(activeItemElement){if(_hasFocus(activeItemElement)){return;}focusFirstDescendant(activeItemElement);}}},[activeValue,filteredOptions]);const setRef=React$2.useCallback(el=>{inputElementRef.current=el;forwardedRef.current=el;},[forwardedRef]);const clearButton=React$2.useMemo(()=>{if(!loading&&!disabled&&value){return{"aria-label":"Clear",onFocus:handleClearButtonFocus};}return void 0;},[disabled,handleClearButtonFocus,loading,value]);const openButtonBoxPadding=React$2.useMemo(()=>padding.map(v=>{if(v===0)return 0;if(v===1)return 1;if(v===2)return 1;return v-2;}),[padding]);const openButtonPadding=React$2.useMemo(()=>padding.map(v=>Math.max(v-1,0)),[padding]);const openButtonProps=React$2.useMemo(()=>typeof openButton==="object"?openButton:EMPTY_RECORD,[openButton]);const handleOpenClick=React$2.useCallback(event=>{dispatch({type:"root/open",query:value?renderValue(value,currentOption):""});if(openButtonProps.onClick)openButtonProps.onClick(event);_raf(()=>{var _a;return(_a=inputElementRef.current)==null?void 0:_a.focus();});},[currentOption,openButtonProps,renderValue,value]);const openButtonNode=React$2.useMemo(()=>!disabled&&!readOnly&&openButton?/* @__PURE__ */jsxRuntime.jsx(Box,{"aria-hidden":expanded,padding:openButtonBoxPadding,children:/* @__PURE__ */jsxRuntime.jsx(Button,{"aria-label":"Open",disabled:expanded,fontSize,icon:ChevronDownIcon,mode:"bleed",padding:openButtonPadding,...openButtonProps,onClick:handleOpenClick})}):void 0,[disabled,expanded,fontSize,handleOpenClick,openButton,openButtonBoxPadding,openButtonPadding,openButtonProps,readOnly]);const inputValue=React$2.useMemo(()=>{if(query===null){if(value!==null){return renderValue(value,currentOption);}return"";}return query;},[currentOption,query,renderValue,value]);const input=/* @__PURE__ */jsxRuntime.jsx(TextInput,{...restProps,"aria-activedescendant":activeItemId,"aria-autocomplete":"list","aria-expanded":expanded,"aria-owns":listBoxId,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",border,clearButton,customValidity,disabled,fontSize,icon,iconRight:loading&&AnimatedSpinnerIcon,id,inputMode:"search",onChange:handleInputChange,onClear:handleClearButtonClick,onFocus:handleInputFocus,padding,prefix,radius,readOnly,ref:setRef,role:"combobox",spellCheck:false,suffix:suffix||openButtonNode,value:inputValue});const handleListBoxKeyDown=React$2.useCallback(event=>{var _a;if(event.key==="Tab"){if(listFocused)(_a=inputElementRef.current)==null?void 0:_a.focus();}},[listFocused]);const content=React$2.useMemo(()=>{if(filteredOptions.length===0)return null;return/* @__PURE__ */jsxRuntime.jsx(ListBox,{"data-ui":"AutoComplete__results",onKeyDown:handleListBoxKeyDown,padding:1,...listBox,tabIndex:-1,children:/* @__PURE__ */jsxRuntime.jsx(Stack,{as:"ul","aria-multiselectable":false,"data-ui":"AutoComplete__resultsList",id:listBoxId,ref:listBoxElementRef,role:"listbox",space:1,children:filteredOptions.map(option=>{const active=activeValue!==null?option.value===activeValue:currentOption===option;return/* @__PURE__ */jsxRuntime.jsx(AutocompleteOption,{id:"".concat(id,"-option-").concat(option.value),onSelect:handleOptionSelect,selected:active,value:option.value,children:React$2.cloneElement(renderOption(option),{disabled:loading,selected:active,tabIndex:listFocused&&active?0:-1})},option.value);})})});},[activeValue,currentOption,filteredOptions,handleOptionSelect,handleListBoxKeyDown,id,listBox,listBoxId,listFocused,loading,renderOption]);const results=React$2.useMemo(()=>{if(renderPopover){return renderPopover({content,hidden:!expanded,inputElement:inputElementRef.current,onMouseEnter:handlePopoverMouseEnter,onMouseLeave:handlePopoverMouseLeave},resultsPopoverElementRef);}if(filteredOptionsLen===0){return null;}return/* @__PURE__ */jsxRuntime.jsx(Popover,{arrow:false,constrainSize:true,content,fallbackPlacements:AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS,matchReferenceWidth:true,onMouseEnter:handlePopoverMouseEnter,onMouseLeave:handlePopoverMouseLeave,open:expanded,overflow:"auto",placement:AUTOCOMPLETE_POPOVER_PLACEMENT,portal:true,radius,ref:resultsPopoverElementRef,referenceElement:inputElementRef.current,...popover});},[content,expanded,filteredOptionsLen,handlePopoverMouseEnter,handlePopoverMouseLeave,popover,radius,renderPopover]);return/* @__PURE__ */jsxRuntime.jsxs(Root$9,{"data-ui":"Autocomplete",onBlur:handleRootBlur,onFocus:handleRootFocus,onKeyDown:handleRootKeyDown,ref:rootElementRef,children:[input,results]});});const Root$8=styled__default.default.ol(_templateObject64||(_templateObject64=_taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n display: flex;\n list-style: none;\n align-items: center;\n white-space: nowrap;\n line-height: 0;\n"])));const ExpandButton=styled__default.default(Button)(_templateObject65||(_templateObject65=_taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));React$2.forwardRef(function Breadcrumbs2(props,ref){const{children,maxLength,separator,space:spaceRaw=2,...restProps}=props;const space=useArrayProp(spaceRaw);const[open,setOpen]=React$2.useState(false);const[expandElement,setExpandElement]=React$2.useState(null);const[popoverElement,setPopoverElement]=React$2.useState(null);const collapse=React$2.useCallback(()=>setOpen(false),[]);const expand=React$2.useCallback(()=>setOpen(true),[]);useClickOutside(collapse,[expandElement,popoverElement]);const rawItems=React$2.useMemo(()=>React$2.Children.toArray(children).filter(child=>{return React$2.isValidElement(child);}),[children]);const items=React$2.useMemo(()=>{const len=rawItems.length;if(maxLength&&len>maxLength){const beforeLength=Math.ceil(maxLength/2);const afterLength=Math.floor(maxLength/2);return[...rawItems.slice(0,beforeLength-1),/* @__PURE__ */jsxRuntime.jsx(Popover,{constrainSize:true,content:/* @__PURE__ */jsxRuntime.jsx(Stack,{as:"ol",overflow:"auto",padding:space,space,children:rawItems.slice(beforeLength-1,len-afterLength)}),open,placement:"top",portal:true,ref:setPopoverElement,children:/* @__PURE__ */jsxRuntime.jsx(ExpandButton,{fontSize:1,mode:"bleed",onClick:open?collapse:expand,padding:1,ref:setExpandElement,selected:open,text:"\u2026"})},"button"),...rawItems.slice(len-afterLength)];}return rawItems;},[collapse,expand,maxLength,open,rawItems,space]);return/* @__PURE__ */jsxRuntime.jsx(Root$8,{"data-ui":"Breadcrumbs",...restProps,ref,children:items.map((item,itemIndex)=>/* @__PURE__ */jsxRuntime.jsxs(React$2.Fragment,{children:[itemIndex>0&&/* @__PURE__ */jsxRuntime.jsx(Box,{"aria-hidden":true,as:"li",paddingX:space,children:separator||/* @__PURE__ */jsxRuntime.jsx(Text,{muted:true,children:"/"})}),/* @__PURE__ */jsxRuntime.jsx(Box,{as:"li",children:item})]},itemIndex))});});function dialogStyle(_ref23){let{theme}=_ref23;const color=theme.sanity.color.base;return{"&:not([hidden])":{display:"flex"},top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center",outline:"none",background:color.shadow.umbra};}function responsiveDialogPositionStyle(props){const{theme}=props;const{media}=theme.sanity;return _responsive(media,props.$position,position=>({"&&":{position}}));}const key$3=Symbol.for("@sanity/ui/context/dialog");globalScope[key$3]=globalScope[key$3]||React$2.createContext({version:0});const DialogContext=globalScope[key$3];function useDialog(){return React$2.useContext(DialogContext);}function isTargetWithinScope(boundaryElement,portalElement,target){if(!boundaryElement||!portalElement)return true;return containsOrEqualsElement(boundaryElement,target)||containsOrEqualsElement(portalElement,target);}const Root$7=styled__default.default(Layer)(responsivePaddingStyle,dialogStyle,responsiveDialogPositionStyle);const DialogContainer=styled__default.default(Container)(_templateObject66||(_templateObject66=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));const DialogCardRoot=styled__default.default(Card)(_templateObject67||(_templateObject67=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n"])));const DialogLayout=styled__default.default(Flex)(_templateObject68||(_templateObject68=_taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));const DialogHeader=styled__default.default(Card)(_templateObject69||(_templateObject69=_taggedTemplateLiteral(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n"])));const DialogContent=styled__default.default(Box)(_templateObject70||(_templateObject70=_taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));const DialogFooter=styled__default.default(Box)(_templateObject71||(_templateObject71=_taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));const DialogCard=React$2.forwardRef(function DialogCard2(props,ref){var _a;const{__unstable_autoFocus:autoFocus,__unstable_hideCloseButton:hideCloseButton,children,contentRef,footer,header,id,onClickOutside,onClose,portal:portalProp,radius:radiusProp,scheme,shadow:shadowProp,width:widthProp}=props;const portal=usePortal();const portalElement=portalProp?((_a=portal.elements)==null?void 0:_a[portalProp])||null:portal.element;const boundaryElement=useBoundaryElement().element;const radius=useArrayProp(radiusProp);const shadow=useArrayProp(shadowProp);const width=useArrayProp(widthProp);const forwardedRef=useForwardedRef(ref);const[rootElement,setRootElement]=React$2.useState(null);const localContentRef=React$2.useRef(null);const layer=useLayer();const{isTopLayer}=layer;const labelId="".concat(id,"_label");const showCloseButton=Boolean(onClose)&&hideCloseButton===false;const showHeader=Boolean(header)||showCloseButton;React$2.useEffect(()=>{if(!autoFocus)return;if(forwardedRef.current){focusFirstDescendant(forwardedRef.current);}},[autoFocus,forwardedRef]);useGlobalKeyDown(React$2.useCallback(event=>{if(!isTopLayer||!onClose)return;const target=document.activeElement;if(target&&!isTargetWithinScope(boundaryElement,portalElement,target)){return;}if(event.key==="Escape"){event.preventDefault();event.stopPropagation();onClose();}},[boundaryElement,isTopLayer,onClose,portalElement]));useClickOutside(React$2.useCallback(event=>{if(!isTopLayer||!onClickOutside)return;const target=event.target;if(target&&!isTargetWithinScope(boundaryElement,portalElement,target)){return;}onClickOutside();},[boundaryElement,isTopLayer,onClickOutside,portalElement]),[rootElement]);const setRef=React$2.useCallback(el=>{setRootElement(el);forwardedRef.current=el;},[forwardedRef]);const setContentRef=React$2.useCallback(el=>{localContentRef.current=el;if(typeof contentRef==="function")contentRef(el);else if(contentRef)contentRef.current=el;},[contentRef]);return/* @__PURE__ */jsxRuntime.jsx(DialogContainer,{"data-ui":"DialogCard",width,children:/* @__PURE__ */jsxRuntime.jsx(DialogCardRoot,{radius,ref:setRef,scheme,shadow,children:/* @__PURE__ */jsxRuntime.jsxs(DialogLayout,{direction:"column",children:[showHeader&&/* @__PURE__ */jsxRuntime.jsx(DialogHeader,{children:/* @__PURE__ */jsxRuntime.jsxs(Flex,{children:[/* @__PURE__ */jsxRuntime.jsx(Box,{flex:1,padding:4,children:header&&/* @__PURE__ */jsxRuntime.jsx(Text,{id:labelId,weight:"semibold",children:header})}),showCloseButton&&/* @__PURE__ */jsxRuntime.jsx(Box,{padding:2,children:/* @__PURE__ */jsxRuntime.jsx(Button,{"aria-label":"Close dialog",disabled:!onClose,icon:CloseIcon,mode:"bleed",onClick:onClose,padding:3})})]})}),/* @__PURE__ */jsxRuntime.jsx(DialogContent,{flex:1,ref:setContentRef,tabIndex:-1,children}),footer&&/* @__PURE__ */jsxRuntime.jsx(DialogFooter,{children:footer})]})})});});React$2.forwardRef(function Dialog2(props,ref){var _a,_b;const dialog=useDialog();const theme=useTheme();const{__unstable_autoFocus:autoFocus=true,__unstable_hideCloseButton:hideCloseButton=false,cardRadius:cardRadiusProp=3,cardShadow=4,children,contentRef,footer,header,id,onActivate,onClickOutside,onClose,onFocus,padding:paddingProp=4,portal:portalProp,position:positionProp=dialog.position||"fixed",scheme,width:widthProp=0,zOffset:zOffsetProp=dialog.zOffset||((_a=theme.sanity.layer)==null?void 0:_a.dialog.zOffset),...restProps}=props;const portal=usePortal();const portalElement=portalProp?((_b=portal.elements)==null?void 0:_b[portalProp])||null:portal.element;const boundaryElement=useBoundaryElement().element;const cardRadius=useArrayProp(cardRadiusProp);const padding=useArrayProp(paddingProp);const position=useArrayProp(positionProp);const width=useArrayProp(widthProp);const zOffset=useArrayProp(zOffsetProp);const preDivRef=React$2.useRef(null);const postDivRef=React$2.useRef(null);const cardRef=React$2.useRef(null);const focusedElementRef=React$2.useRef(null);const handleFocus=React$2.useCallback(event=>{onFocus==null?void 0:onFocus(event);const target=event.target;const cardElement=cardRef.current;if(cardElement&&target===preDivRef.current){focusLastDescendant(cardElement);return;}if(cardElement&&target===postDivRef.current){focusFirstDescendant(cardElement);return;}if(isHTMLElement(event.target)){focusedElementRef.current=event.target;}},[onFocus]);const labelId="".concat(id,"_label");const rootClickTimeoutRef=React$2.useRef();const handleRootClick=React$2.useCallback(()=>{if(rootClickTimeoutRef.current){clearTimeout(rootClickTimeoutRef.current);}rootClickTimeoutRef.current=setTimeout(()=>{const activeElement=document.activeElement;if(activeElement&&!isTargetWithinScope(boundaryElement,portalElement,activeElement)){const target=focusedElementRef.current;if(!target||!document.body.contains(target)){const cardElement=cardRef.current;if(cardElement)focusFirstDescendant(cardElement);return;}target.focus();}},0);},[boundaryElement,portalElement]);return/* @__PURE__ */jsxRuntime.jsx(Portal,{__unstable_name:portalProp,children:/* @__PURE__ */jsxRuntime.jsxs(Root$7,{...restProps,$padding:padding,$position:position,"aria-labelledby":labelId,"aria-modal":true,"data-ui":"Dialog",id,onActivate,onClick:handleRootClick,onFocus:handleFocus,ref,role:"dialog",zOffset,children:[/* @__PURE__ */jsxRuntime.jsx("div",{ref:preDivRef,tabIndex:0}),/* @__PURE__ */jsxRuntime.jsx(DialogCard,{__unstable_autoFocus:autoFocus,__unstable_hideCloseButton:hideCloseButton,contentRef,footer,header,id,onClickOutside,onClose,portal:portalProp,radius:cardRadius,ref:cardRef,scheme,shadow:cardShadow,width,children}),/* @__PURE__ */jsxRuntime.jsx("div",{ref:postDivRef,tabIndex:0})]})});});const Root$6=styled__default.default.kbd(_templateObject72||(_templateObject72=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));const Key=styled__default.default(KBD)(_templateObject73||(_templateObject73=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));const Hotkeys=React$2.forwardRef(function Hotkeys2(props,ref){const{fontSize,keys,padding,radius,space:spaceProp=1,...restProps}=props;const space=useArrayProp(spaceProp);if(!keys||keys.length===0){return/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{});}return/* @__PURE__ */jsxRuntime.jsx(Root$6,{"data-ui":"Hotkeys",...restProps,ref,children:/* @__PURE__ */jsxRuntime.jsx(Inline,{as:"span",space,children:keys.map((key,i)=>/* @__PURE__ */jsxRuntime.jsx(Key,{fontSize,padding,radius,children:key},i))})});});const key$2=Symbol.for("@sanity/ui/context/menu");globalScope[key$2]=globalScope[key$2]||React$2.createContext(null);const MenuContext=globalScope[key$2];function _isFocusable(element){return isHTMLAnchorElement(element)&&element.getAttribute("data-disabled")!=="true"||isHTMLButtonElement(element)&&!element.disabled;}function _getFocusableElements(elements){return elements.filter(_isFocusable);}function _getDOMPath(rootElement,el){const path=[];let e=el;while(e!==rootElement){const parentElement=e.parentElement;if(!parentElement)return path;const children=Array.from(parentElement.childNodes);const index=children.indexOf(e);path.unshift(index);if(parentElement===rootElement){return path;}e=parentElement;}return path;}const EMPTY_PATH=[];function _sortElements(rootElement,elements){if(!rootElement)return;const map=/* @__PURE__ */new WeakMap();for(const el of elements){map.set(el,_getDOMPath(rootElement,el));}const _sort=(a,b)=>{const _a=map.get(a)||EMPTY_PATH;const _b=map.get(b)||EMPTY_PATH;const len=Math.max(_a.length,_b.length);for(let i=0;i<len;i+=1){const aIndex=_a[i]||-1;const bIndex=_b[i]||-1;if(aIndex!==bIndex){return aIndex-bIndex;}}return 0;};elements.sort(_sort);}function useMenuController(props){const{onKeyDown,originElement,shouldFocus}=props;const elementsRef=React$2.useRef([]);const[rootElement,setRootElement]=React$2.useState(null);const[activeIndex,_setActiveIndex]=React$2.useState(-1);const activeIndexRef=React$2.useRef(activeIndex);const activeElement=elementsRef.current[activeIndex]||null;const mounted=Boolean(rootElement);const setActiveIndex=React$2.useCallback(nextActiveIndex=>{_setActiveIndex(nextActiveIndex);activeIndexRef.current=nextActiveIndex;},[]);const mount=React$2.useCallback((element,selected)=>{if(!element)return()=>void 0;if(elementsRef.current.indexOf(element)===-1){elementsRef.current.push(element);_sortElements(rootElement,elementsRef.current);}if(selected){const selectedIndex=elementsRef.current.indexOf(element);setActiveIndex(selectedIndex);}return()=>{const idx=elementsRef.current.indexOf(element);if(idx>-1){elementsRef.current.splice(idx,1);}};},[rootElement,setActiveIndex]);const handleKeyDown=React$2.useCallback(event=>{if(event.key==="Tab"){if(originElement){originElement.focus();}return;}if(event.key==="Home"){event.preventDefault();event.stopPropagation();const focusableElements=_getFocusableElements(elementsRef.current);const el=focusableElements[0];if(!el)return;const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);return;}if(event.key==="End"){event.preventDefault();event.stopPropagation();const focusableElements=_getFocusableElements(elementsRef.current);const el=focusableElements[focusableElements.length-1];if(!el)return;const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);return;}if(event.key==="ArrowUp"){event.preventDefault();event.stopPropagation();const focusableElements=_getFocusableElements(elementsRef.current);const focusableLen=focusableElements.length;if(focusableLen===0)return;const focusedElement=elementsRef.current[activeIndexRef.current];let focusedIndex=focusableElements.indexOf(focusedElement);focusedIndex=(focusedIndex-1+focusableLen)%focusableLen;const el=focusableElements[focusedIndex];const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);return;}if(event.key==="ArrowDown"){event.preventDefault();event.stopPropagation();const focusableElements=_getFocusableElements(elementsRef.current);const focusableLen=focusableElements.length;if(focusableLen===0)return;const focusedElement=elementsRef.current[activeIndexRef.current];let focusedIndex=focusableElements.indexOf(focusedElement);focusedIndex=(focusedIndex+1)%focusableLen;const el=focusableElements[focusedIndex];const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);return;}if(onKeyDown){onKeyDown(event);}},[onKeyDown,originElement,setActiveIndex]);const handleItemMouseEnter=React$2.useCallback(event=>{const element=event.currentTarget;const currentIndex=elementsRef.current.indexOf(element);setActiveIndex(currentIndex);},[setActiveIndex]);const handleItemMouseLeave=React$2.useCallback(()=>{rootElement==null?void 0:rootElement.focus();setActiveIndex(-1);},[rootElement,setActiveIndex]);React$2.useEffect(()=>{if(!mounted)return;const rafId=window.requestAnimationFrame(()=>{const _activeIndex=activeIndexRef.current;if(_activeIndex===-1){if(shouldFocus==="first"){const focusableElements=_getFocusableElements(elementsRef.current);const el=focusableElements[0];if(el){const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);activeIndexRef.current=currentIndex;}}if(shouldFocus==="last"){const focusableElements=_getFocusableElements(elementsRef.current);const el=focusableElements[focusableElements.length-1];if(el){const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);activeIndexRef.current=currentIndex;}}return;}const element=elementsRef.current[_activeIndex]||null;element==null?void 0:element.focus();});return()=>{window.cancelAnimationFrame(rafId);};},[activeIndex,mounted,setActiveIndex,shouldFocus]);return{activeElement,activeIndex,handleItemMouseEnter,handleItemMouseLeave,handleKeyDown,mount,rootElement,setRootElement};}const Root$5=styled__default.default(Box)(_templateObject74||(_templateObject74=_taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));React$2.forwardRef(function Menu2(props,ref){const{children,// eslint-disable-next-line @typescript-eslint/no-unused-vars
6157
+ padding,paddingX,paddingY,paddingTop,paddingBottom,paddingLeft,paddingRight}),[padding,paddingX,paddingY,paddingTop,paddingBottom,paddingLeft,paddingRight]);return/* @__PURE__ */jsxRuntime.jsxs(Root$v,{"data-ui":"Button",...restProps,$mode:mode,$radius:radius,$tone:tone,"data-disabled":Boolean(loading||disabled),"data-selected":selected?"":void 0,disabled:Boolean(loading||disabled),ref,type,children:[Boolean(loading)&&/* @__PURE__ */jsxRuntime.jsx(LoadingBox,{children:/* @__PURE__ */jsxRuntime.jsx(Spinner,{})}),(icon||text||iconRight)&&/* @__PURE__ */jsxRuntime.jsx(Box,{as:"span",...boxProps,children:/* @__PURE__ */jsxRuntime.jsxs(Flex,{as:"span",justify,children:[icon&&/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(icon)&&icon,reactIsExports$1.isValidElementType(icon)&&React$2.createElement(icon)]}),text&&/* @__PURE__ */jsxRuntime.jsx(Box,{flex:iconRight?1:void 0,marginLeft:icon?space:void 0,marginRight:iconRight?space:void 0,children:/* @__PURE__ */jsxRuntime.jsx(Text,{align:textAlign,size:fontSize,textOverflow:"ellipsis",weight:theme.sanity.button.textWeight,children:text})}),iconRight&&/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(iconRight)&&iconRight,reactIsExports$1.isValidElementType(iconRight)&&React$2.createElement(iconRight)]})]})}),children&&/* @__PURE__ */jsxRuntime.jsx(Box,{as:"span",...boxProps,children})]});});function cardStyle(props){return[cardBaseStyle(props),cardColorStyle(props)];}function cardBaseStyle(props){const{$checkered,theme}=props;const space=theme.sanity.space;return styled.css(_templateObject18||(_templateObject18=_taggedTemplateLiteral(["\n ","\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])),$checkered&&styled.css(_templateObject19||(_templateObject19=_taggedTemplateLiteral(["\n background-size: ","px ","px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])),space[3],space[3]));}function cardColorStyle(props){var _a,_b;const{$checkered,$focusRing,theme}=props;const{focusRing}=theme.sanity;const{base,card,dark}=theme.sanity.color;const border={width:0,color:"var(--card-border-color)"};return styled.css(_templateObject20||(_templateObject20=_taggedTemplateLiteral(["\n color-scheme: ",";\n\n ","\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n\n /* &:is(button) */\n &[data-as='button'] {\n --card-focus-ring-box-shadow: none;\n\n cursor: default;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &:disabled {\n ","\n }\n\n &:not(:disabled) {\n &[data-pressed] {\n ","\n }\n\n &[data-selected] {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &[data-hovered],\n &:hover {\n ","\n }\n\n &:active {\n ","\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ",";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ",";\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n cursor: pointer;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &[data-disabled] {\n ","\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ","\n }\n\n &[data-selected] {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &[data-hovered],\n &:hover {\n ","\n }\n\n &:active {\n ","\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ",";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ",";\n }\n }\n }\n\n ","\n "])),dark?"dark":"light",_colorVarsStyle(base,card.enabled,$checkered),_colorVarsStyle(base,card.disabled,$checkered),_colorVarsStyle(base,card.pressed,$checkered),_colorVarsStyle(base,card.selected,$checkered),_colorVarsStyle(base,card.hovered,$checkered),_colorVarsStyle(base,card.pressed,$checkered),$focusRing?focusRingStyle({base,border,focusRing}):void 0,$focusRing?focusRingBorderStyle(border):void 0,_colorVarsStyle(base,card.disabled,$checkered),_colorVarsStyle(base,card.pressed,$checkered),_colorVarsStyle(base,card.selected,$checkered),_colorVarsStyle(base,card.hovered,$checkered),_colorVarsStyle(base,card.pressed,$checkered),$focusRing?focusRingStyle({base,border,focusRing}):void 0,$focusRing?focusRingBorderStyle(border):void 0,(_b=(_a=theme.sanity.styles)==null?void 0:_a.card)==null?void 0:_b.root);}const Root$u=styled__default.default(Box)(responsiveBorderStyle,responsiveRadiusStyle,responsiveShadowStyle,cardStyle);const Card=React$2.forwardRef(function Card2(props,ref){const{__unstable_checkered:checkered=false,__unstable_focusRing:focusRing=false,as:asProp,border,borderTop,borderRight,borderBottom,borderLeft,pressed,radius=0,scheme,selected,shadow,tone:toneProp="default",...restProps}=props;const as=reactIsExports$1.isValidElementType(asProp)?asProp:"div";const rootTheme=useRootTheme();const tone=toneProp==="inherit"?rootTheme.tone:toneProp;return/* @__PURE__ */jsxRuntime.jsx(ThemeColorProvider,{scheme,tone,children:/* @__PURE__ */jsxRuntime.jsx(Root$u,{"data-as":typeof as==="string"?as:void 0,"data-scheme":rootTheme.scheme,"data-ui":"Card","data-tone":tone,...restProps,$border:useArrayProp(border),$borderTop:useArrayProp(borderTop),$borderRight:useArrayProp(borderRight),$borderBottom:useArrayProp(borderBottom),$borderLeft:useArrayProp(borderLeft),$checkered:checkered,$focusRing:focusRing,$radius:useArrayProp(radius),$shadow:useArrayProp(shadow),$tone:tone,"data-checkered":checkered?"":void 0,"data-pressed":pressed?"":void 0,"data-selected":selected?"":void 0,forwardedAs:as,ref,selected})});});function checkboxBaseStyles(){return styled.css(_templateObject21||(_templateObject21=_taggedTemplateLiteral(["\n position: relative;\n display: inline-block;\n "])));}function inputElementStyles(props){const{theme}=props;const color=theme.sanity.color.input;const{focusRing,input,radius}=theme.sanity;return styled.css(_templateObject22||(_templateObject22=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n outline: none;\n opacity: 0;\n z-index: 1;\n padding: 0;\n margin: 0;\n\n & + span {\n position: relative;\n display: block;\n height: ",";\n width: ",";\n box-sizing: border-box;\n box-shadow: ",";\n border-radius: ",";\n line-height: 1;\n background-color: ",";\n\n & > svg {\n display: block;\n position: absolute;\n opacity: 0;\n height: 100%;\n width: 100%;\n\n & > path {\n vector-effect: non-scaling-stroke;\n stroke-width: 2 !important;\n }\n }\n }\n\n &:not(:disabled):focus + span {\n box-shadow: ",";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ",";\n }\n\n &:checked + span > svg:first-child {\n opacity: 1;\n }\n\n &[data-read-only] + span {\n background-color: ",";\n box-shadow: ",";\n color: ",";\n }\n\n &:not([data-read-only]):disabled + span {\n background-color: ",";\n box-shadow: ",";\n color: ",";\n }\n\n &:indeterminate + span > svg:last-child {\n opacity: 1;\n }\n "])),rem(input.checkbox.size),rem(input.checkbox.size),focusRingBorderStyle({color:color.default.enabled.border,width:input.border.width}),rem(radius[2]),color.default.enabled.bg,focusRingStyle({border:{width:input.border.width,color:color.default.enabled.border},focusRing}),focusRingBorderStyle({color:color.default.enabled.border,width:input.border.width}),color.default.readOnly.bg,focusRingBorderStyle({width:input.border.width,color:color.default.readOnly.border}),color.default.readOnly.fg,color.default.disabled.bg,focusRingBorderStyle({width:input.border.width,color:color.default.disabled.border}),color.default.disabled.fg);}const Root$t=styled__default.default.div(checkboxBaseStyles);const Input$5=styled__default.default.input(inputElementStyles);React$2.forwardRef(function Checkbox2(props,forwardedRef){const{checked,className,disabled,indeterminate,customValidity,readOnly,style,...restProps}=props;const ref=useForwardedRef(forwardedRef);useCustomValidity(ref,customValidity);React$2.useEffect(()=>{if(ref.current){ref.current.indeterminate=indeterminate||false;}},[indeterminate,ref]);return/* @__PURE__ */jsxRuntime.jsxs(Root$t,{className,"data-ui":"Checkbox",style,children:[/* @__PURE__ */jsxRuntime.jsx(Input$5,{"data-read-only":!disabled&&readOnly?"":void 0,...restProps,checked,disabled:disabled||readOnly,type:"checkbox",readOnly,ref}),/* @__PURE__ */jsxRuntime.jsxs("span",{children:[/* @__PURE__ */jsxRuntime.jsx(CheckmarkIcon,{}),/* @__PURE__ */jsxRuntime.jsx(RemoveIcon,{})]})]});});function codeSyntaxHighlightingStyle(_ref20){let{theme}=_ref20;const color=theme.sanity.color.syntax;return{"&.atrule":{color:color.atrule},"&.attr-name":{color:color.attrName},"&.attr-value":{color:color.attrValue},"&.attribute":{color:color.attribute},"&.boolean":{color:color.boolean},"&.builtin":{color:color.builtin},"&.cdata":{color:color.cdata},"&.char":{color:color.char},"&.class":{color:color.class},"&.class-name":{color:color.className},"&.comment":{color:color.comment},"&.constant":{color:color.constant},"&.deleted":{color:color.deleted},"&.doctype":{color:color.doctype},"&.entity":{color:color.entity},"&.function":{color:color.function},"&.hexcode":{color:color.hexcode},"&.id":{color:color.id},"&.important":{color:color.important},"&.inserted":{color:color.inserted},"&.keyword":{color:color.keyword},"&.number":{color:color.number},"&.operator":{color:color.operator},"&.prolog":{color:color.prolog},"&.property":{color:color.property},"&.pseudo-class":{color:color.pseudoClass},"&.pseudo-element":{color:color.pseudoElement},"&.punctuation":{color:color.punctuation},"&.regex":{color:color.regex},"&.selector":{color:color.selector},"&.string":{color:color.string},"&.symbol":{color:color.symbol},"&.tag":{color:color.tag},"&.unit":{color:color.unit},"&.url":{color:color.url},"&.variable":{color:color.variable}};}function codeBaseStyle(){return styled.css(_templateObject23||(_templateObject23=_taggedTemplateLiteral(["\n color: var(--card-code-fg-color);\n\n & code {\n font-family: inherit;\n\n &.refractor .token {\n ","\n }\n }\n\n & a {\n color: inherit;\n text-decoration: underline;\n border-radius: 1px;\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])),codeSyntaxHighlightingStyle);}const Root$s=styled__default.default.pre(codeBaseStyle,responsiveCodeFontStyle);const Code=React$2.forwardRef(function Code2(props,ref){const{children,language:languageProp,size=2,weight,...restProps}=props;const language=typeof languageProp==="string"?languageProp:void 0;const registered=language?Refractor_1.hasLanguage(language):false;return/* @__PURE__ */jsxRuntime.jsxs(Root$s,{"data-ui":"Code",...restProps,$size:useArrayProp(size),$weight:weight,ref,children:[!(language&&registered)&&/* @__PURE__ */jsxRuntime.jsx("code",{children}),language&&registered&&/* @__PURE__ */jsxRuntime.jsx(Refractor_1,{inline:true,language,value:String(children)})]});});const BASE_STYLE$1={width:"100%",margin:"0 auto"};function containerBaseStyle(){return BASE_STYLE$1;}function responsiveContainerWidthStyle(props){const{theme}=props;const{container,media}=theme.sanity;return _responsive(media,props.$width,val=>({maxWidth:val==="auto"?"none":rem(container[val])}));}const Root$r=styled__default.default(Box)(containerBaseStyle,responsiveContainerWidthStyle);const Container=React$2.forwardRef(function Container2(props,ref){const{as,width=2,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$r,{"data-ui":"Container",...restProps,$width:useArrayProp(width),forwardedAs:as,ref});});const Root$q=styled__default.default(Box)(responsiveGridStyle);const Grid=React$2.forwardRef(function Grid2(props,ref){const{as,autoRows,autoCols,autoFlow,columns,gap,gapX,gapY,rows,children,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$q,{"data-as":typeof as==="string"?as:void 0,"data-ui":"Grid",...restProps,$autoRows:useArrayProp(autoRows),$autoCols:useArrayProp(autoCols),$autoFlow:useArrayProp(autoFlow),$columns:useArrayProp(columns),$gap:useArrayProp(gap),$gapX:useArrayProp(gapX),$gapY:useArrayProp(gapY),$rows:useArrayProp(rows),forwardedAs:as,ref,children});});function headingBaseStyle(props){const{$accent,$muted,theme}=props;return styled.css(_templateObject24||(_templateObject24=_taggedTemplateLiteral(["\n ","\n\n ","\n\n & code {\n font-family: ",";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])),$accent&&styled.css(_templateObject25||(_templateObject25=_taggedTemplateLiteral(["\n color: var(--card-accent-fg-color);\n "]))),$muted&&styled.css(_templateObject26||(_templateObject26=_taggedTemplateLiteral(["\n color: var(--card-muted-fg-color);\n "]))),theme.sanity.fonts.code.family);}const Root$p=styled__default.default.div(headingBaseStyle,responsiveTextAlignStyle,responsiveHeadingFont);const SpanWithTextOverflow=styled__default.default.span(_templateObject27||(_templateObject27=_taggedTemplateLiteral(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));const Heading=React$2.forwardRef(function Heading2(props,ref){const{accent=false,align,children:childrenProp,muted=false,size=2,textOverflow,weight,...restProps}=props;let children=childrenProp;if(textOverflow==="ellipsis"){children=/* @__PURE__ */jsxRuntime.jsx(SpanWithTextOverflow,{children});}return/* @__PURE__ */jsxRuntime.jsx(Root$p,{"data-ui":"Heading",...restProps,$accent:accent,$align:useArrayProp(align),$muted:muted,$size:useArrayProp(size),$weight:weight,ref,children:/* @__PURE__ */jsxRuntime.jsx("span",{children})});});function inlineBaseStyle(){return{lineHeight:0,"&&:not([hidden])":{display:"block"},"& > div":{display:"inline-block",verticalAlign:"middle"}};}function inlineSpaceStyle(props){const{theme}=props;return _responsive(theme.sanity.media,props.$space,spaceIndex=>{const space=rem(theme.sanity.space[spaceIndex]);return{margin:"-".concat(space," 0 0 -").concat(space),"& > div":{padding:"".concat(space," 0 0 ").concat(space)}};});}const Root$o=styled__default.default(Box)(inlineBaseStyle,inlineSpaceStyle);const Inline=React$2.forwardRef(function Inline2(props,ref){const{as,children:childrenProp,space,...restProps}=props;const children=React$2.useMemo(()=>childrenToElementArray(childrenProp).filter(Boolean).map((child,idx)=>/* @__PURE__ */jsxRuntime.jsx("div",{children:child},idx)),[childrenProp]);return/* @__PURE__ */jsxRuntime.jsx(Root$o,{"data-ui":"Inline",...restProps,$space:useArrayProp(space),forwardedAs:as,ref,children});});function kbdStyle(){return styled.css(_templateObject28||(_templateObject28=_taggedTemplateLiteral(["\n background: var(--card-bg-color);\n font: inherit;\n box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));}const Root$n=styled__default.default.kbd(responsiveRadiusStyle,kbdStyle);const KBD=React$2.forwardRef(function KBD2(props,ref){const{children,fontSize=1,padding=1,radius=2,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$n,{"data-ui":"KBD",...restProps,$radius:useArrayProp(radius),ref,children:/* @__PURE__ */jsxRuntime.jsx(Box,{as:"span",padding,children:/* @__PURE__ */jsxRuntime.jsx(Code,{as:"span",muted:true,size:fontSize,children})})});});const key$6=Symbol.for("@sanity/ui/context/boundaryElement");globalScope[key$6]=globalScope[key$6]||React$2.createContext(null);const BoundaryElementContext=globalScope[key$6];const DEFAULT_VALUE={version:0,element:null};function useBoundaryElement(){const value=React$2.useContext(BoundaryElementContext);if(value&&(!isRecord(value)||value.version!==0)){throw new Error("useBoundaryElement(): the context value is not compatible");}return value||DEFAULT_VALUE;}function findMaxBreakpoints(media,width){const ret=[];for(let i=0;i<media.length;i+=1){const bp=media[i];if(bp>width){ret.push(i);}}return ret;}function findMinBreakpoints(media,width){const ret=[];for(let i=0;i<media.length;i+=1){const bp=media[i];if(bp<=width){ret.push(i);}}return ret;}React$2.forwardRef(function ElementQuery2(props,ref){const theme=useTheme();const{children,media=theme.sanity.media,...restProps}=props;const forwardedRef=useForwardedRef(ref);const[element,setElement]=React$2.useState(null);const elementSize=useElementSize(element);const width=React$2.useMemo(()=>{var _a;return(_a=elementSize==null?void 0:elementSize.border.width)!=null?_a:window.innerWidth;},[elementSize]);const max=React$2.useMemo(()=>findMaxBreakpoints(media,width),[media,width]);const min=React$2.useMemo(()=>findMinBreakpoints(media,width),[media,width]);const setRef=React$2.useCallback(el=>{forwardedRef.current=el;setElement(el);},[forwardedRef]);return/* @__PURE__ */jsxRuntime.jsx("div",{"data-ui":"ElementQuery",...restProps,"data-eq-max":max.length?max.join(" "):void 0,"data-eq-min":min.length?min.join(" "):void 0,ref:setRef,children});});function getLayerContext(contextValue){if(!isRecord(contextValue)||contextValue.version!==0){throw new Error("the context value is not compatible");}if(!contextValue){throw new Error("components using `useLayer()` should be wrapped in a <LayerProvider>.");}if(contextValue.version===0){return contextValue;}throw new Error("could not get layer context");}const key$5=Symbol.for("@sanity/ui/context/layer");globalScope[key$5]=globalScope[key$5]||React$2.createContext(null);const LayerContext=globalScope[key$5];function useLayer(){const value=React$2.useContext(LayerContext);if(!value){throw new Error("useLayer(): missing context value");}try{return getLayerContext(value);}catch(err){if(err instanceof Error){throw new Error("useLayer(): ".concat(err.message));}else{throw new Error("useLayer(): ".concat(err));}}}function _raf(fn){const frameId=requestAnimationFrame(fn);return()=>{cancelAnimationFrame(frameId);};}function _isEnterToClickElement(element){return isHTMLAnchorElement(element)||isHTMLButtonElement(element);}function isHTMLElement(node){return node instanceof Node&&node.nodeType===Node.ELEMENT_NODE;}function isHTMLAnchorElement(element){return isHTMLElement(element)&&element.nodeName==="A";}function isHTMLInputElement(element){return isHTMLElement(element)&&element.nodeName==="INPUT";}function isHTMLButtonElement(element){return isHTMLElement(element)&&element.nodeName==="BUTTON";}function isHTMLSelectElement(element){return isHTMLElement(element)&&element.nodeName==="SELECT";}function isHTMLTextAreaElement(element){return isHTMLElement(element)&&element.nodeName==="TEXTAREA";}function containsOrEqualsElement(element,node){return element.contains(node)||element===node;}function _hasFocus(element){return Boolean(document.activeElement)&&element.contains(document.activeElement);}function isFocusable(element){if(element.tabIndex>0||element.tabIndex===0&&element.getAttribute("tabIndex")!==null){return true;}if(isHTMLAnchorElement(element)){return Boolean(element.href)&&element.rel!=="ignore";}if(isHTMLInputElement(element)){return element.type!=="hidden"&&element.type!=="file"&&!element.disabled;}if(isHTMLButtonElement(element)||isHTMLSelectElement(element)||isHTMLTextAreaElement(element)){return!element.disabled;}return false;}function attemptFocus(element){if(!isFocusable(element)){return false;}try{element.focus();}catch(_){}return document.activeElement===element;}function focusFirstDescendant(element){for(let i=0;i<element.childNodes.length;i++){const child=element.childNodes[i];if(isHTMLElement(child)&&(attemptFocus(child)||focusFirstDescendant(child))){return true;}}return false;}function focusLastDescendant(element){for(let i=element.childNodes.length-1;i>=0;i--){const child=element.childNodes[i];if(isHTMLElement(child)&&(attemptFocus(child)||focusLastDescendant(child))){return true;}}return false;}function _isScrollable(el){if(!(el instanceof Element))return false;const style=window.getComputedStyle(el);return style.overflowX.includes("auto")||style.overflowX.includes("scroll")||style.overflowY.includes("auto")||style.overflowY.includes("scroll");}function LayerProvider(props){var _a;const{children,zOffset:zOffsetProp=0}=props;const parentContextValue=React$2.useContext(LayerContext);const parent=parentContextValue&&getLayerContext(parentContextValue);const parentRegisterChild=parent==null?void 0:parent.registerChild;const parentLevel=(_a=parent==null?void 0:parent.level)!=null?_a:0;const level=parentLevel+1;const zOffset=useArrayProp(zOffsetProp);const maxMediaIndex=zOffset.length-1;const mediaIndex=Math.min(useMediaIndex(),maxMediaIndex);const zIndex=parent?parent.zIndex+zOffset[mediaIndex]:zOffset[mediaIndex];const[,setChildLayers]=React$2.useState({});const[size,setSize]=React$2.useState(0);const isTopLayer=size===0;const registerChild=React$2.useCallback(childLevel=>{const parentDispose=parentRegisterChild==null?void 0:parentRegisterChild(childLevel);if(childLevel!==void 0){setChildLayers(state=>{var _a2;const prevLen=(_a2=state[childLevel])!=null?_a2:0;const nextState={...state,[childLevel]:prevLen+1};setSize(Object.keys(nextState).length);return nextState;});}else{setSize(v=>v+1);}return()=>{if(childLevel!==void 0){setChildLayers(state=>{const nextState={...state};if(nextState[childLevel]===1){delete nextState[childLevel];setSize(Object.keys(nextState).length);}else{nextState[childLevel]-=1;}return nextState;});}else{setSize(v=>v-1);}parentDispose==null?void 0:parentDispose();};},[parentRegisterChild]);React$2.useEffect(()=>parentRegisterChild==null?void 0:parentRegisterChild(level),[level,parentRegisterChild]);const value=React$2.useMemo(()=>({version:0,isTopLayer,level,registerChild,size,zIndex}),[isTopLayer,level,registerChild,size,zIndex]);return/* @__PURE__ */jsxRuntime.jsx(LayerContext.Provider,{value,children});}const Root$m=styled__default.default.div({position:"relative"});const LayerChildren=React$2.forwardRef(function LayerChildren2(props,ref){const{children,onActivate,onFocus,style=EMPTY_RECORD,...restProps}=props;const{zIndex,isTopLayer}=useLayer();const lastFocusedRef=React$2.useRef(null);const forwardedRef=useForwardedRef(ref);const isTopLayerRef=React$2.useRef(isTopLayer);React$2.useEffect(()=>{const becameTopLayer=isTopLayerRef.current!==isTopLayer&&isTopLayer;if(becameTopLayer){onActivate==null?void 0:onActivate({activeElement:lastFocusedRef.current});}isTopLayerRef.current=isTopLayer;},[isTopLayer,onActivate]);const handleFocus=React$2.useCallback(event=>{onFocus==null?void 0:onFocus(event);const rootElement=forwardedRef.current;const target=document.activeElement;if(!isTopLayer||!rootElement||!target)return;if(isHTMLElement(target)&&containsOrEqualsElement(rootElement,target)){lastFocusedRef.current=target;}},[forwardedRef,isTopLayer,onFocus]);return/* @__PURE__ */jsxRuntime.jsx(Root$m,{...restProps,"data-ui":"Layer",onFocus:handleFocus,ref:forwardedRef,style:{...style,zIndex},children});});const Layer=React$2.forwardRef(function Layer2(props,ref){const{children,zOffset=1,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(LayerProvider,{zOffset,children:/* @__PURE__ */jsxRuntime.jsx(LayerChildren,{...restProps,ref,children})});});const key$4=Symbol.for("@sanity/ui/context/portal");const elementKey=Symbol.for("@sanity/ui/context/portal/element");globalScope[elementKey]=null;const defaultContextValue={version:0,boundaryElement:null,get element(){if(typeof document==="undefined"){return null;}if(globalScope[elementKey]){return globalScope[elementKey];}globalScope[elementKey]=document.createElement("div");globalScope[elementKey].setAttribute("data-portal","");document.body.appendChild(globalScope[elementKey]);return globalScope[elementKey];}};globalScope[key$4]=globalScope[key$4]||React$2.createContext(defaultContextValue);const PortalContext=globalScope[key$4];function usePortal(){const value=React$2.useContext(PortalContext);if(!value){throw new Error("usePortal(): missing context value");}if(!isRecord(value)||value.version!==0){throw new Error("usePortal(): the context value is not compatible");}return value;}function Portal(props){var _a;const{children,__unstable_name:name}=props;const portal=usePortal();const portalElement=(name?portal.elements&&portal.elements[name]:portal.element)||((_a=portal.elements)==null?void 0:_a.default);if(!portalElement){return null;}return reactDomExports.createPortal(children,portalElement);}const Root$l=styled__default.default.div(_templateObject29||(_templateObject29=_taggedTemplateLiteral(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));React$2.forwardRef(function SrOnly2(props,ref){const{as,children}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$l,{"aria-hidden":true,as,"data-ui":"SrOnly",ref,children});});const Root$k=styled__default.default.div(_templateObject30||(_templateObject30=_taggedTemplateLiteral(["\n position: relative;\n"])));const ItemWrapper=styled__default.default.div(_templateObject31||(_templateObject31=_taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n right: 0;\n"])));React$2.forwardRef(function VirtualList2(props,ref){const{as="div",gap=0,getItemKey,items=[],onChange,renderItem,...restProps}=props;const{space}=useTheme().sanity;const forwardedRef=useForwardedRef(ref);const wrapperRef=React$2.useRef(null);const[scrollTop,setScrollTop]=React$2.useState(0);const[scrollHeight,setScrollHeight]=React$2.useState(0);const[itemHeight,setItemHeight]=React$2.useState(-1);React$2.useEffect(()=>{if(!wrapperRef.current)return;const firstElement=wrapperRef.current.firstChild;if(firstElement instanceof HTMLElement){setItemHeight(firstElement.offsetHeight);}},[renderItem]);React$2.useEffect(()=>{if(!forwardedRef.current)return;let _scrollEl=forwardedRef.current.parentNode;while(_scrollEl&&!_isScrollable(_scrollEl)){_scrollEl=_scrollEl.parentNode;}if(_scrollEl){const scrollEl=_scrollEl;if(!(scrollEl instanceof HTMLElement))return;const handleScroll2=()=>{setScrollTop(scrollEl.scrollTop);};scrollEl.addEventListener("scroll",handleScroll2,{passive:true});const ro=new _ResizeObserver(entries=>{setScrollHeight(entries[0].contentRect.height);});ro.observe(scrollEl);handleScroll2();return()=>{scrollEl.removeEventListener("scroll",handleScroll2);ro.unobserve(scrollEl);ro.disconnect();};}const handleScroll=()=>{setScrollTop(window.scrollY);};const handleResize=()=>{setScrollHeight(window.innerHeight);};window.addEventListener("scroll",handleScroll,{passive:true});window.addEventListener("resize",handleResize);setScrollHeight(window.innerHeight);handleScroll();return()=>{window.removeEventListener("scroll",handleScroll);window.removeEventListener("resize",handleResize);};},[forwardedRef]);const len=items.length;const height=itemHeight?len*(itemHeight+space[gap])-space[gap]:0;const fromIndex=height?Math.max(Math.floor(scrollTop/height*len)-2,0):0;const toIndex=height?Math.ceil((scrollTop+scrollHeight)/height*len)+1:0;React$2.useEffect(()=>{if(!onChange)return;onChange({fromIndex,gap:space[gap],itemHeight,scrollHeight,scrollTop,toIndex});},[fromIndex,gap,itemHeight,onChange,scrollHeight,scrollTop,space,toIndex]);const children=React$2.useMemo(()=>{if(!renderItem||items.length===0)return null;if(itemHeight===-1){return[/* @__PURE__ */jsxRuntime.jsx(ItemWrapper,{children:renderItem(items[0])},0)];}return items.slice(fromIndex,toIndex).map((item,_itemIndex)=>{const itemIndex=fromIndex+_itemIndex;const node=renderItem(item);const key=getItemKey?getItemKey(item,itemIndex):itemIndex;return/* @__PURE__ */jsxRuntime.jsx(ItemWrapper,{style:{top:itemIndex*(itemHeight+space[gap])},children:node},key);});},[fromIndex,gap,getItemKey,itemHeight,items,renderItem,space,toIndex]);const wrapperStyle=React$2.useMemo(()=>({height}),[height]);return/* @__PURE__ */jsxRuntime.jsx(Root$k,{as,"data-ui":"VirtualList",...restProps,ref:forwardedRef,children:/* @__PURE__ */jsxRuntime.jsx("div",{ref:wrapperRef,style:wrapperStyle,children})});});const DEFAULT_POPOVER_DISTANCE=4;const DEFAULT_POPOVER_PADDING=4;const DEFAULT_POPOVER_ARROW_WIDTH=27;const DEFAULT_POPOVER_ARROW_HEIGHT=11;const DEFAULT_POPOVER_MARGINS=[0,0,0,0];function size(options){const{apply,margins,padding=0}=options;return{name:"@sanity/ui/size",async fn(args){const{elements,placement,platform,rects}=args;const{floating,reference}=rects;const overflow=await detectOverflow(args,{altBoundary:true,boundary:options.boundaryElement||void 0,elementContext:"floating",padding,rootBoundary:"viewport"});let maxWidth=Infinity;let maxHeight=Infinity;const floatingW=floating.width;const floatingH=floating.height;if(placement.includes("top")){maxWidth=floatingW-(overflow.left+overflow.right);maxHeight=floatingH-overflow.top;}if(placement.includes("right")){maxWidth=floatingW-overflow.right;maxHeight=floatingH-(overflow.top+overflow.bottom);}if(placement.includes("bottom")){maxWidth=floatingW-(overflow.left+overflow.right);maxHeight=floatingH-overflow.bottom;}if(placement.includes("left")){maxWidth=floatingW-overflow.left;maxHeight=floatingH-(overflow.top+overflow.bottom);}apply({availableWidth:maxWidth-margins[1]-margins[3],availableHeight:maxHeight-margins[0]-margins[2],elements,referenceWidth:reference.width-margins[1]-margins[3]});const nextDimensions=await platform.getDimensions(elements.floating);const targetH=nextDimensions.height;const targetW=nextDimensions.width;if(floatingW!==targetW||floatingH!==targetH){return{reset:{rects:true}};}return{};}};}const Root$j=styled__default.default.div(_templateObject32||(_templateObject32=_taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: ","px;\n height: ","px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: ","px ","px;\n }\n\n [data-placement^='top'] > & {\n bottom: -","px;\n }\n\n [data-placement^='right'] > & {\n left: -","px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -","px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -","px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])),DEFAULT_POPOVER_ARROW_WIDTH,DEFAULT_POPOVER_ARROW_WIDTH,DEFAULT_POPOVER_ARROW_WIDTH/2,DEFAULT_POPOVER_ARROW_WIDTH/2,DEFAULT_POPOVER_ARROW_WIDTH,DEFAULT_POPOVER_ARROW_WIDTH,DEFAULT_POPOVER_ARROW_WIDTH,DEFAULT_POPOVER_ARROW_WIDTH);const BorderPath=styled__default.default.path(_templateObject33||(_templateObject33=_taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));const ShapePath=styled__default.default.path(_templateObject34||(_templateObject34=_taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));const PopoverArrow=React$2.forwardRef(function PopoverArrow2(props,ref){return/* @__PURE__ */jsxRuntime.jsx(Root$j,{"data-ui":"Popover__arrow",...props,ref,children:/* @__PURE__ */jsxRuntime.jsxs("svg",{width:DEFAULT_POPOVER_ARROW_WIDTH,height:DEFAULT_POPOVER_ARROW_HEIGHT,viewBox:"0 0 27 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[/* @__PURE__ */jsxRuntime.jsx(BorderPath,{d:"M1.18708 1C3.29803 1.0011 5.29585 1.95479 6.62414 3.59561L11.1683 9.20895C12.369 10.6922 14.631 10.6922 15.8317 9.20894L20.3759 3.59561C21.7042 1.95478 23.702 1.0011 25.8129 1H21.9436C21.0533 1.49255 20.2545 2.15618 19.5986 2.96641L15.0545 8.57975C14.254 9.56855 12.746 9.56855 11.9455 8.57975L7.40139 2.96642C6.74548 2.15618 5.94673 1.49255 5.05643 1H1.18708Z"}),/* @__PURE__ */jsxRuntime.jsx(ShapePath,{d:"M1.18342 0C3.59749 0 5.88246 1.0901 7.40138 2.96642L11.9455 8.57975C12.746 9.56855 14.254 9.56855 15.0545 8.57975L19.5986 2.96641C21.1175 1.0901 23.4025 0 25.8166 0H27H0H1.18342Z"})]})});});function popoverCardStyle(props){const{$boundaryWidth}=props;return{"&:not([hidden])":{display:"flex"},flexDirection:"column",width:"max-content",minWidth:"min-content",maxWidth:typeof $boundaryWidth==="number"?"".concat($boundaryWidth-DEFAULT_POPOVER_PADDING*2,"px"):void 0};}const Root$i=React$2.memo(styled__default.default(Card)(popoverCardStyle));const PopoverContainer=React$2.memo(styled__default.default(Container)(_templateObject35||(_templateObject35=_taggedTemplateLiteral(["\n max-height: inherit;\n max-width: inherit;\n"]))));const PopoverCard=React$2.memo(React$2.forwardRef(function PopoverCard2(props,ref){const{__unstable_margins:marginsProp,arrow,arrowRef,arrowX,arrowY,boundaryWidth,children,padding,placement,overflow,radius,scheme,shadow,strategy,style,tone,width="auto",x:xProp,y:yProp,...restProps}=props;const{zIndex}=useLayer();const margins=React$2.useMemo(()=>marginsProp||DEFAULT_POPOVER_MARGINS,[marginsProp]);const x=(xProp!=null?xProp:0)+margins[3];const y=(yProp!=null?yProp:0)+margins[0];const rootStyle=React$2.useMemo(()=>({position:strategy,top:y,left:x,zIndex,...style}),[strategy,style,x,y,zIndex]);const staticSide=placement&&FLOATING_STATIC_SIDES[placement.split("-")[0]];const arrowStyle=React$2.useMemo(()=>{const style2={left:arrowX!==null?arrowX:void 0,top:arrowY!==null?arrowY:void 0,right:void 0,bottom:void 0};if(staticSide)style2[staticSide]=0-DEFAULT_POPOVER_ARROW_WIDTH;return style2;},[arrowX,arrowY,staticSide]);return/* @__PURE__ */jsxRuntime.jsxs(Root$i,{...restProps,$boundaryWidth:boundaryWidth,"data-placement":placement,"data-ui":"Popover",radius,ref,scheme,shadow,sizing:"border",style:rootStyle,tone,children:[/* @__PURE__ */jsxRuntime.jsx(PopoverContainer,{"data-ui":"Popover__wrapper",flex:1,overflow,padding,sizing:"border",width,children}),arrow&&/* @__PURE__ */jsxRuntime.jsx(PopoverArrow,{ref:arrowRef,style:arrowStyle})]});}));PopoverCard.displayName="PopoverCard";const Popover=React$2.memo(React$2.forwardRef(function Popover2(props,ref){var _a,_b,_c,_d,_e;const theme=useTheme();const boundaryElementContext=useBoundaryElement();const{__unstable_margins:margins=DEFAULT_POPOVER_MARGINS,arrow:arrowProp=true,boundaryElement=boundaryElementContext.element,children:childProp,constrainSize=false,content,disabled,fallbackPlacements,matchReferenceWidth:matchReferenceWidthProp,open,overflow="hidden",padding:paddingProp,placement:placementProp="bottom",portal,preventOverflow=true,radius:radiusProp=3,referenceElement,scheme,shadow:shadowProp=3,tone="inherit",width:widthProp="auto",zOffset:zOffsetProp=(_a=theme.sanity.layer)==null?void 0:_a.popover.zOffset,...restProps}=props;const boundarySize=(_b=useElementSize(boundaryElement))==null?void 0:_b.border;const padding=useArrayProp(paddingProp);const radius=useArrayProp(radiusProp);const shadow=useArrayProp(shadowProp);const width=useArrayProp(widthProp);const zOffset=useArrayProp(zOffsetProp);const forwardedRef=useForwardedRef(ref);const arrowRef=React$2.useRef(null);const rootBoundary="viewport";const middleware=React$2.useMemo(()=>{const ret=[];if(constrainSize||preventOverflow){ret.push(flip({boundary:boundaryElement||void 0,fallbackPlacements,padding:DEFAULT_POPOVER_PADDING,rootBoundary}));}ret.push(offset({mainAxis:arrowProp?DEFAULT_POPOVER_DISTANCE:0}));if(constrainSize||matchReferenceWidthProp){ret.push(size({apply(_ref21){let{availableWidth,availableHeight,elements,referenceWidth}=_ref21;if(matchReferenceWidthProp){elements.floating.style.width="".concat(referenceWidth,"px");}if(constrainSize){elements.floating.style.maxWidth="".concat(availableWidth,"px");elements.floating.style.maxHeight="".concat(availableHeight,"px");}},boundaryElement,constrainSize,margins,matchReferenceWidth:matchReferenceWidthProp,padding:DEFAULT_POPOVER_PADDING}));}if(preventOverflow){ret.push(shift({boundary:boundaryElement||void 0,rootBoundary,padding:DEFAULT_POPOVER_PADDING}));}if(arrowProp){ret.push(arrow({element:arrowRef,padding:DEFAULT_POPOVER_PADDING}));}ret.push(hide({boundary:boundaryElement||void 0,padding:DEFAULT_POPOVER_PADDING,strategy:"referenceHidden"}));return ret;},[arrowProp,boundaryElement,constrainSize,fallbackPlacements,margins,matchReferenceWidthProp,preventOverflow]);const floatingProps=React$2.useMemo(()=>({middleware,placement:placementProp,whileElementsMounted:autoUpdate}),[middleware,placementProp]);const{x,y,placement,reference:referenceRef,floating:floatingRef,middlewareData,strategy}=useFloating(floatingProps);const referenceHidden=(_c=middlewareData.hide)==null?void 0:_c.referenceHidden;const arrowX=(_d=middlewareData.arrow)==null?void 0:_d.x;const arrowY=(_e=middlewareData.arrow)==null?void 0:_e.y;const setArrow=React$2.useCallback(arrowEl=>{arrowRef.current=arrowEl;},[]);const setFloating=React$2.useCallback(node=>{forwardedRef.current=node;floatingRef(node);},[floatingRef,forwardedRef]);const setReference=React$2.useCallback(node=>{referenceRef(node);const childRef=childProp==null?void 0:childProp.ref;if(typeof childRef==="function"){childRef(node);}else if(childRef){childRef.current=node;}},[childProp,referenceRef]);const child=React$2.useMemo(()=>{if(!childProp||referenceElement)return null;return React$2.cloneElement(childProp,{ref:setReference});},[childProp,referenceElement,setReference]);React$2.useEffect(()=>{referenceRef(referenceElement||null);},[referenceRef,referenceElement]);if(disabled){return childProp||/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{});}const popover=/* @__PURE__ */jsxRuntime.jsx(LayerProvider,{zOffset,children:/* @__PURE__ */jsxRuntime.jsx(PopoverCard,{...restProps,__unstable_margins:margins,arrow:arrowProp,arrowRef:setArrow,arrowX,arrowY,boundaryWidth:preventOverflow?boundarySize==null?void 0:boundarySize.width:void 0,hidden:referenceHidden,overflow,padding,placement,radius,ref:setFloating,scheme,shadow,strategy,tone,x,y,width,children:content})});return/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[open&&/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{children:portal?/* @__PURE__ */jsxRuntime.jsx(Portal,{__unstable_name:typeof portal==="string"?portal:void 0,children:popover}):popover}),child]});}));Popover.displayName="Popover";function radioBaseStyle(){return styled.css(_templateObject36||(_templateObject36=_taggedTemplateLiteral(["\n position: relative;\n\n &:not([hidden]) {\n display: inline-block;\n }\n\n &[data-read-only] {\n outline: 1px solid red;\n }\n "])));}function inputElementStyle(props){const{theme}=props;const{focusRing,input}=theme.sanity;const color=theme.sanity.color.input;const dist=(input.radio.size-input.radio.markSize)/2;return styled.css(_templateObject37||(_templateObject37=_taggedTemplateLiteral(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ",";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ",";\n width: ",";\n border-radius: ",";\n background: ",";\n box-shadow: ",";\n\n &::after {\n content: '';\n position: absolute;\n top: ",";\n left: ",";\n height: ",";\n width: ",";\n border-radius: ",";\n background: ",";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ",";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ",";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ",";\n background: ",";\n\n &::after {\n background: ",";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ",";\n background: ",";\n\n &::after {\n background: ",";\n }\n }\n "])),rem(input.radio.size/2),rem(input.radio.size),rem(input.radio.size),rem(input.radio.size/2),color.default.enabled.bg,focusRingBorderStyle({color:color.default.enabled.border,width:input.border.width}),rem(dist),rem(dist),rem(input.radio.markSize),rem(input.radio.markSize),rem(input.radio.markSize/2),color.default.enabled.fg,focusRingStyle({border:{width:input.border.width,color:color.default.enabled.border},focusRing}),focusRingBorderStyle({color:color.default.enabled.border,width:input.border.width}),color.default.readOnly.border,color.default.readOnly.bg,color.default.readOnly.fg,color.default.disabled.border,color.default.disabled.bg,color.default.disabled.fg);}const Root$h=styled__default.default.div(radioBaseStyle);const Input$4=styled__default.default.input(inputElementStyle);React$2.forwardRef(function Radio2(props,forwardedRef){const{className,disabled,style,customValidity,readOnly,...restProps}=props;const ref=useForwardedRef(forwardedRef);useCustomValidity(ref,customValidity);return/* @__PURE__ */jsxRuntime.jsxs(Root$h,{className,"data-ui":"Radio",style,children:[/* @__PURE__ */jsxRuntime.jsx(Input$4,{"data-read-only":!disabled&&readOnly?"":void 0,...restProps,disabled:disabled||readOnly,readOnly,ref,type:"radio"}),/* @__PURE__ */jsxRuntime.jsx("span",{})]});});function rootStyle(){return styled.css(_templateObject38||(_templateObject38=_taggedTemplateLiteral(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));}function inputBaseStyle(props){const{theme}=props;const font=theme.sanity.fonts.text;return styled.css(_templateObject39||(_templateObject39=_taggedTemplateLiteral(["\n -webkit-font-smoothing: antialiased;\n appearance: none;\n border: 0;\n font-family: ",";\n color: inherit;\n width: 100%;\n outline: none;\n margin: 0;\n\n &:disabled {\n opacity: 1;\n }\n "])),font.family);}function inputColorStyle(props){const{theme}=props;const{focusRing,input}=theme.sanity;const color=theme.sanity.color.input;return styled.css(_templateObject40||(_templateObject40=_taggedTemplateLiteral(["\n /* enabled */\n background-color: ",";\n color: ",";\n box-shadow: ",";\n\n /* hovered */\n @media (hover: hover) {\n &:not(:disabled):hover {\n background-color: ",";\n color: ",";\n box-shadow: ",";\n }\n }\n\n /* focused */\n &:not(:disabled):focus {\n box-shadow: ",";\n }\n\n /* read-only */\n &[data-read-only] {\n background-color: ",";\n color: ",";\n box-shadow: ",";\n }\n\n /* disabled */\n &:not([data-read-only]):disabled {\n background-color: ",";\n color: ",";\n box-shadow: ",";\n }\n "])),color.default.enabled.bg,color.default.enabled.fg,focusRingBorderStyle({color:color.default.enabled.border,width:input.border.width}),color.default.hovered.bg,color.default.hovered.fg,focusRingBorderStyle({color:color.default.hovered.border,width:input.border.width}),focusRingStyle({border:{width:input.border.width,color:color.default.enabled.border},focusRing}),color.default.readOnly.bg,color.default.readOnly.fg,focusRingBorderStyle({color:color.default.readOnly.border,width:input.border.width}),color.default.disabled.bg,color.default.disabled.fg,focusRingBorderStyle({color:color.default.disabled.border,width:input.border.width}));}function textSize(size){return{fontSize:rem(size.fontSize),lineHeight:rem(size.lineHeight)};}function inputTextSizeStyle(props){const{theme,$fontSize}=props;const{sizes}=theme.sanity.fonts.text;return _responsive(theme.sanity.media,$fontSize,sizeIndex=>textSize(sizes[sizeIndex]||sizes[2]));}function inputStyle(){return[responsiveRadiusStyle,inputBaseStyle,inputColorStyle,inputTextSizeStyle,responsiveInputPaddingIconRightStyle];}function iconBoxStyle(props){const{theme}=props;const color=theme.sanity.color.input;return styled.css(_templateObject41||(_templateObject41=_taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n --card-fg-color: ",";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n --card-fg-color: ",";\n }\n }\n\n /* disabled */\n select:disabled + && {\n --card-fg-color: ",";\n }\n\n /* read-only */\n select[data-read-only] + && {\n --card-fg-color: ",";\n }\n "])),color.default.enabled.fg,color.default.hovered.fg,color.default.disabled.fg,color.default.readOnly.fg);}const selectStyle={root:rootStyle,input:inputStyle,iconBox:iconBoxStyle};const Root$g=styled__default.default.div(selectStyle.root);const Input$3=styled__default.default.select(selectStyle.input);const IconBox=styled__default.default(Box)(selectStyle.iconBox);React$2.forwardRef(function Select2(props,forwardedRef){const{children,customValidity,disabled,fontSize=2,padding=3,radius=1,readOnly,space=3,...restProps}=props;const ref=useForwardedRef(forwardedRef);useCustomValidity(ref,customValidity);return/* @__PURE__ */jsxRuntime.jsxs(Root$g,{"data-ui":"Select",children:[/* @__PURE__ */jsxRuntime.jsx(Input$3,{"data-read-only":!disabled&&readOnly?"":void 0,"data-ui":"Select",...restProps,$fontSize:useArrayProp(fontSize),$padding:useArrayProp(padding),$radius:useArrayProp(radius),$space:useArrayProp(space),disabled:disabled||readOnly,ref,children}),/* @__PURE__ */jsxRuntime.jsx(IconBox,{padding,children:/* @__PURE__ */jsxRuntime.jsx(Text,{size:fontSize,children:/* @__PURE__ */jsxRuntime.jsx(SelectIcon,{})})})]});});const BASE_STYLE={"&&:not([hidden])":{display:"grid"},'&[data-as="ul"],&[data-as="ol"]':{listStyle:"none"},gridTemplateColumns:"minmax(0, 1fr)",gridAutoRows:"min-content"};function stackBaseStyle(){return BASE_STYLE;}function responsiveStackSpaceStyle(props){const{theme}=props;const{media,space}=theme.sanity;return _responsive(media,props.$space,spaceIndex=>({gridGap:rem(space[spaceIndex])}));}const Root$f=styled__default.default(Box)(stackBaseStyle,responsiveStackSpaceStyle);const Stack=React$2.forwardRef(function Stack2(props,ref){const{as,space,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$f,{"data-as":typeof as==="string"?as:void 0,"data-ui":"Stack",...restProps,$space:useArrayProp(space),forwardedAs:as,ref});});function switchBaseStyles(){return styled.css(_templateObject42||(_templateObject42=_taggedTemplateLiteral(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));}function switchInputStyles(){return styled.css(_templateObject43||(_templateObject43=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n padding: 0;\n margin: 0;\n\n /* Place the input element above the representation element */\n z-index: 1;\n "])));}function switchRepresentationStyles(props){const{theme}=props;const{focusRing,input}=theme.sanity;const color=theme.sanity.color.button.default;return styled.css(_templateObject44||(_templateObject44=_taggedTemplateLiteral(["\n --switch-bg-color: ",";\n --switch-fg-color: ",";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ",";\n height: ",";\n border-radius: ",";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ",";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ",";\n --switch-fg-color: ",";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ",";\n --switch-fg-color: ",";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ",";\n --switch-fg-color: ",";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ",";\n --switch-fg-color: ",";\n }\n "])),color.default.enabled.bg,color.default.enabled.fg,rem(input.switch.width),rem(input.switch.height),rem(input.switch.height/2),focusRingStyle({focusRing}),color.positive.enabled.bg,color.positive.enabled.fg,color.default.hovered.bg,color.default.hovered.fg,color.positive.hovered.bg,color.positive.hovered.fg,color.default.disabled.bg,color.default.disabled.fg);}function switchTrackStyles(props){const{theme}=props;const{input}=theme.sanity;return styled.css(_templateObject45||(_templateObject45=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n background-color: var(--switch-bg-color);\n position: absolute;\n left: 0;\n top: 0;\n width: ",";\n height: ",";\n border-radius: ",";\n "])),rem(input.switch.width),rem(input.switch.height),rem(input.switch.height/2));}function switchThumbStyles(props){const{$indeterminate,theme}=props;const{input}=theme.sanity;const trackWidth=input.switch.width;const trackHeight=input.switch.height;const trackPadding=input.switch.padding;const size=trackHeight-input.switch.padding*2;const checkedOffset=trackWidth-trackPadding*2-size;const indeterminateOffset=trackWidth/2-size/2-trackPadding;const checked=$indeterminate!==true&&props.$checked===true;return styled.css(_templateObject46||(_templateObject46=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n position: absolute;\n left: ",";\n top: ",";\n height: ",";\n width: ",";\n border-radius: ",";\n transition-property: transform;\n transition-duration: ","ms;\n transition-timing-function: ",";\n background: var(--switch-fg-color);\n transform: translate3d(0, 0, 0);\n\n ","\n\n ","\n "])),rem(trackPadding),rem(trackPadding),rem(size),rem(size),rem(size/2),input.switch.transitionDurationMs,input.switch.transitionTimingFunction,checked&&styled.css(_templateObject47||(_templateObject47=_taggedTemplateLiteral(["\n transform: translate3d(","px, 0, 0);\n "])),checkedOffset),$indeterminate&&styled.css(_templateObject48||(_templateObject48=_taggedTemplateLiteral(["\n transform: translate3d(","px, 0, 0);\n "])),indeterminateOffset));}const Root$e=styled__default.default.span(switchBaseStyles);const Input$2=styled__default.default.input(switchInputStyles);const Representation=styled__default.default.span(switchRepresentationStyles);const Track=styled__default.default.span(switchTrackStyles);const Thumb=styled__default.default.span(switchThumbStyles);React$2.forwardRef(function Switch2(props,forwardedRef){const{checked,className,disabled,indeterminate,readOnly,style,...restProps}=props;const ref=useForwardedRef(forwardedRef);React$2.useEffect(()=>{if(ref.current){ref.current.indeterminate=indeterminate||false;}},[indeterminate,ref]);return/* @__PURE__ */jsxRuntime.jsxs(Root$e,{className,"data-ui":"Switch",style,children:[/* @__PURE__ */jsxRuntime.jsx(Input$2,{"data-read-only":!disabled&&readOnly?"":void 0,...restProps,checked:indeterminate!==true&&checked,disabled:disabled||readOnly,type:"checkbox",ref}),/* @__PURE__ */jsxRuntime.jsxs(Representation,{"aria-hidden":true,"data-name":"representation",children:[/* @__PURE__ */jsxRuntime.jsx(Track,{}),/* @__PURE__ */jsxRuntime.jsx(Thumb,{$checked:checked,$indeterminate:indeterminate})]})]});});const Root$d=styled__default.default.span(textInputRootStyle);const InputRoot$1=styled__default.default.span(_templateObject49||(_templateObject49=_taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));const Input$1=styled__default.default.textarea(responsiveInputPaddingStyle,textInputBaseStyle,textInputFontSizeStyle);const Presentation$1=styled__default.default.div(responsiveRadiusStyle,textInputRepresentationStyle);React$2.forwardRef(function TextArea2(props,forwardedRef){const{border=true,customValidity,disabled=false,fontSize=2,padding=3,radius=1,weight,...restProps}=props;const ref=useForwardedRef(forwardedRef);const rootTheme=useRootTheme();useCustomValidity(ref,customValidity);return/* @__PURE__ */jsxRuntime.jsx(Root$d,{"data-ui":"TextArea",children:/* @__PURE__ */jsxRuntime.jsxs(InputRoot$1,{children:[/* @__PURE__ */jsxRuntime.jsx(Input$1,{"data-as":"textarea","data-scheme":rootTheme.scheme,"data-tone":rootTheme.tone,...restProps,$fontSize:useArrayProp(fontSize),$padding:useArrayProp(padding),$scheme:rootTheme.scheme,$space:useArrayProp(0),$tone:rootTheme.tone,$weight:weight,disabled,ref}),/* @__PURE__ */jsxRuntime.jsx(Presentation$1,{$radius:useArrayProp(radius),$scheme:rootTheme.scheme,$tone:rootTheme.tone,"data-border":border?"":void 0,"data-scheme":rootTheme.scheme,"data-tone":rootTheme.tone})]})});});const CLEAR_BUTTON_BOX_STYLE={zIndex:2};const Root$c=styled__default.default(Card).attrs({forwardedAs:"span"})(textInputRootStyle);const InputRoot=styled__default.default.span(_templateObject50||(_templateObject50=_taggedTemplateLiteral(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));const Prefix=styled__default.default(Card).attrs({forwardedAs:"span"})(_templateObject51||(_templateObject51=_taggedTemplateLiteral(["\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));const Suffix=styled__default.default(Card).attrs({forwardedAs:"span"})(_templateObject52||(_templateObject52=_taggedTemplateLiteral(["\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));const Input=styled__default.default.input(responsiveInputPaddingStyle,textInputBaseStyle,textInputFontSizeStyle);const Presentation=styled__default.default.span(responsiveRadiusStyle,textInputRepresentationStyle);const LeftBox=styled__default.default(Box)(_templateObject53||(_templateObject53=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n"])));const RightBox=styled__default.default(Box)(_templateObject54||(_templateObject54=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n right: 0;\n"])));const RightCard=styled__default.default(Card)(_templateObject55||(_templateObject55=_taggedTemplateLiteral(["\n background-color: transparent;\n position: absolute;\n top: 0;\n right: 0;\n"])));const TextInput=React$2.forwardRef(function TextInput2(props,forwardedRef){const{border=true,clearButton,disabled=false,fontSize:fontSizeProp=2,icon,iconRight,onClear,padding:paddingProp=3,prefix,radius:radiusProp=1,readOnly,space:spaceProp=3,suffix,customValidity,type="text",weight,...restProps}=props;const ref=useForwardedRef(forwardedRef);const rootTheme=useRootTheme();const fontSize=useArrayProp(fontSizeProp);const padding=useArrayProp(paddingProp);const radius=useArrayProp(radiusProp);const space=useArrayProp(spaceProp);const $hasClearButton=Boolean(clearButton);const $hasIcon=Boolean(icon);const $hasIconRight=Boolean(iconRight);const $hasSuffix=Boolean(suffix);const $hasPrefix=Boolean(prefix);useCustomValidity(ref,customValidity);const handleClearMouseDown=React$2.useCallback(event=>{event.preventDefault();event.stopPropagation();},[]);const handleClearClick=React$2.useCallback(event=>{var _a;event.preventDefault();event.stopPropagation();if(onClear)onClear();(_a=ref.current)==null?void 0:_a.focus();},[onClear,ref]);const prefixNode=React$2.useMemo(()=>prefix&&/* @__PURE__ */jsxRuntime.jsx(Prefix,{borderTop:true,borderLeft:true,borderBottom:true,radius,sizing:"border",tone:"inherit",children:/* @__PURE__ */jsxRuntime.jsx("span",{children:prefix})}),[prefix,radius]);const presentationNode=React$2.useMemo(()=>/* @__PURE__ */jsxRuntime.jsxs(Presentation,{$hasPrefix,$hasSuffix,$radius:radius,$scheme:rootTheme.scheme,$tone:rootTheme.tone,"data-border":border?"":void 0,"data-scheme":rootTheme.scheme,"data-tone":rootTheme.tone,children:[icon&&/* @__PURE__ */jsxRuntime.jsx(LeftBox,{padding,children:/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(icon)&&icon,reactIsExports$1.isValidElementType(icon)&&React$2.createElement(icon)]})}),!$hasClearButton&&iconRight&&/* @__PURE__ */jsxRuntime.jsx(RightBox,{padding,children:/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(iconRight)&&iconRight,reactIsExports$1.isValidElementType(iconRight)&&React$2.createElement(iconRight)]})})]}),[border,fontSize,icon,iconRight,padding,radius,rootTheme,$hasClearButton,$hasPrefix,$hasSuffix]);const clearButtonBoxPadding=React$2.useMemo(()=>padding.map(v=>{if(v===0)return 0;if(v===1)return 1;if(v===2)return 1;return v-2;}),[padding]);const clearButtonPadding=React$2.useMemo(()=>padding.map(v=>{if(v===0)return 0;if(v===1)return 0;if(v===2)return 1;return v-1;}),[padding]);const clearButtonProps=React$2.useMemo(()=>typeof clearButton==="object"?clearButton:EMPTY_RECORD,[clearButton]);const clearButtonNode=React$2.useMemo(()=>!disabled&&!readOnly&&clearButton&&/* @__PURE__ */jsxRuntime.jsx(RightCard,{forwardedAs:"span",padding:clearButtonBoxPadding,style:CLEAR_BUTTON_BOX_STYLE,tone:customValidity?"critical":"inherit",children:/* @__PURE__ */jsxRuntime.jsx(Button,{"aria-label":"Clear","data-qa":"clear-button",fontSize,icon:CloseIcon,mode:"bleed",padding:clearButtonPadding,radius,...clearButtonProps,onClick:handleClearClick,onMouseDown:handleClearMouseDown})}),[clearButton,clearButtonBoxPadding,clearButtonPadding,clearButtonProps,customValidity,disabled,fontSize,handleClearClick,handleClearMouseDown,radius,readOnly]);const suffixNode=React$2.useMemo(()=>suffix&&/* @__PURE__ */jsxRuntime.jsx(Suffix,{borderTop:true,borderRight:true,borderBottom:true,radius,sizing:"border",tone:"inherit",children:/* @__PURE__ */jsxRuntime.jsx("span",{children:suffix})}),[radius,suffix]);return/* @__PURE__ */jsxRuntime.jsxs(Root$c,{"data-ui":"TextInput",tone:rootTheme.tone,children:[prefixNode,/* @__PURE__ */jsxRuntime.jsxs(InputRoot,{children:[/* @__PURE__ */jsxRuntime.jsx(Input,{"data-as":"input","data-scheme":rootTheme.scheme,"data-tone":rootTheme.tone,...restProps,$fontSize:fontSize,$iconLeft:$hasIcon,$iconRight:$hasIconRight||$hasClearButton,$padding:padding,$scheme:rootTheme.scheme,$space:space,$tone:rootTheme.tone,$weight:weight,disabled,readOnly,ref,type}),presentationNode,clearButtonNode]}),suffixNode]});});const Root$b=styled__default.default.div(_templateObject56||(_templateObject56=_taggedTemplateLiteral(["\n position: absolute;\n pointer-events: none;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 7.5px 7.5px;\n }\n\n /* position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n } */\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));const Border=styled__default.default.path(_templateObject57||(_templateObject57=_taggedTemplateLiteral(["\n fill: var(--card-shadow-outline-color);\n"])));const Shape=styled__default.default.path(_templateObject58||(_templateObject58=_taggedTemplateLiteral(["\n fill: var(--card-bg-color);\n"])));const TooltipArrow=React$2.forwardRef(function TooltipArrow2(props,ref){const{...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Root$b,{"data-ui":"Tooltip__arrow",...restProps,ref,children:/* @__PURE__ */jsxRuntime.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",children:[/* @__PURE__ */jsxRuntime.jsx(Border,{d:"M11.5266 1C11.032 1.32802 10.5837 1.73105 10.1995 2.20057L9.04792 3.6081C8.24771 4.58614 6.7523 4.58614 5.95209 3.6081L4.80047 2.20057C4.41632 1.73105 3.96796 1.32802 3.47341 1H0.156727C1.65639 1 3.07687 1.67313 4.02651 2.83381L5.17813 4.24134C6.37844 5.70839 8.62156 5.70839 9.82187 4.24134L10.9735 2.83381C11.9231 1.67313 13.3436 1 14.8433 1H11.5266Z"}),/* @__PURE__ */jsxRuntime.jsx(Shape,{d:"M0.156725 0C1.95632 0 3.66089 0.80776 4.80047 2.20057L5.95209 3.6081C6.75229 4.58614 8.24771 4.58614 9.04791 3.6081L10.1995 2.20057C11.3391 0.80776 13.0437 0 14.8433 0H15H0H0.156725Z"})]})});});const Root$a=styled__default.default(Layer)(_templateObject59||(_templateObject59=_taggedTemplateLiteral(["\n pointer-events: none;\n"])));React$2.forwardRef(function Tooltip2(props,ref){var _a,_b,_c;const boundaryElementContext=useBoundaryElement();const theme=useTheme();const{boundaryElement=boundaryElementContext==null?void 0:boundaryElementContext.element,children:childProp,content,disabled,fallbackPlacements:fallbackPlacementsProp,padding,placement:placementProp="bottom",portal,scheme,shadow=2,zOffset=(_a=theme.sanity.layer)==null?void 0:_a.tooltip.zOffset,...restProps}=props;const fallbackPlacements=useArrayProp(fallbackPlacementsProp);const forwardedRef=useForwardedRef(ref);const[referenceElement,setReferenceElement]=React$2.useState(null);const arrowRef=React$2.useRef(null);const rootBoundary="viewport";const middleware=React$2.useMemo(()=>{const ret=[];ret.push(flip({boundary:boundaryElement||void 0,fallbackPlacements,padding:4,rootBoundary}));ret.push(offset({mainAxis:3}));ret.push(shift({boundary:boundaryElement||void 0,rootBoundary,padding:4}));ret.push(arrow({element:arrowRef,padding:2}));return ret;},[boundaryElement,fallbackPlacements]);const{x,y,placement,reference,floating,middlewareData,update,strategy}=useFloating({middleware,placement:placementProp,whileElementsMounted:autoUpdate});const rootStyle=React$2.useMemo(()=>({position:strategy,top:y!=null?y:0,left:x!=null?x:0}),[strategy,x,y]);const staticSide=placement&&FLOATING_STATIC_SIDES[placement.split("-")[0]];const arrowX=(_b=middlewareData.arrow)==null?void 0:_b.x;const arrowY=(_c=middlewareData.arrow)==null?void 0:_c.y;const arrowStyle=React$2.useMemo(()=>{const style={left:arrowX!==null?arrowX:void 0,top:arrowY!==null?arrowY:void 0,right:void 0,bottom:void 0};if(staticSide)style[staticSide]=-15;return style;},[arrowX,arrowY,staticSide]);const[isOpen,setIsOpen]=React$2.useState(false);const handleBlur=React$2.useCallback(()=>setIsOpen(false),[]);const handleFocus=React$2.useCallback(()=>setIsOpen(true),[]);const handleMouseEnter=React$2.useCallback(()=>setIsOpen(true),[]);const handleMouseLeave=React$2.useCallback(()=>setIsOpen(false),[]);React$2.useEffect(()=>{if(!isOpen)return;function handleWindowMouseMove(event){if(!referenceElement)return;const isHoveringReference=referenceElement===event.target||event.target instanceof Node&&referenceElement.contains(event.target);if(!isHoveringReference){setIsOpen(false);window.removeEventListener("mousemove",handleWindowMouseMove);}}window.addEventListener("mousemove",handleWindowMouseMove);return()=>{window.removeEventListener("mousemove",handleWindowMouseMove);};},[isOpen,referenceElement]);React$2.useEffect(()=>{if(disabled)setIsOpen(false);},[disabled]);React$2.useEffect(()=>{if(!content)setIsOpen(false);},[content]);React$2.useEffect(()=>reference(referenceElement),[reference,referenceElement]);const setArrow=React$2.useCallback(arrowEl=>{arrowRef.current=arrowEl;update();},[update]);const setFloating=React$2.useCallback(node=>{forwardedRef.current=node;floating(node);},[floating,forwardedRef]);const childRef=childProp==null?void 0:childProp.ref;const setReference=React$2.useCallback(node=>{if(typeof childRef==="function"){childRef(node);}else if(childRef){childRef.current=node;}setReferenceElement(node);},[childRef]);const child=React$2.useMemo(()=>{if(!childProp)return null;return React$2.cloneElement(childProp,{onBlur:handleBlur,onFocus:handleFocus,onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,ref:setReference});},[childProp,handleBlur,handleFocus,handleMouseEnter,handleMouseLeave,setReference]);if(!child)return/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{});if(disabled)return child;const root=/* @__PURE__ */jsxRuntime.jsx(Root$a,{"data-ui":"Tooltip",...restProps,ref:setFloating,style:rootStyle,zOffset,children:/* @__PURE__ */jsxRuntime.jsxs(Card,{"data-ui":"Tooltip__card","data-placement":placement,padding,radius:2,scheme,shadow,children:[content,/* @__PURE__ */jsxRuntime.jsx(TooltipArrow,{ref:setArrow,style:arrowStyle})]})});return/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[child,isOpen&&/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{children:portal?/* @__PURE__ */jsxRuntime.jsx(Portal,{__unstable_name:typeof portal==="string"?portal:void 0,children:root}):root})]});});const Root$9=styled__default.default.div(_templateObject60||(_templateObject60=_taggedTemplateLiteral(["\n line-height: 0;\n"])));const ListBox=styled__default.default(Box)(_templateObject61||(_templateObject61=_taggedTemplateLiteral(["\n & > ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n"])));const rotate=styled.keyframes(_templateObject62||(_templateObject62=_taggedTemplateLiteral(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));const AnimatedSpinnerIcon=styled__default.default(SpinnerIcon)(_templateObject63||(_templateObject63=_taggedTemplateLiteral(["\n animation: "," 500ms linear infinite;\n"])),rotate);function AutocompleteOption(props){const{children,id,onSelect,selected,value}=props;const handleClick=React$2.useCallback(()=>{setTimeout(()=>{onSelect(value);},0);},[onSelect,value]);const handleKeyDown=React$2.useCallback(event=>{if(event.key==="Enter"&&!_isEnterToClickElement(event.currentTarget)){handleClick();}},[handleClick]);return/* @__PURE__ */jsxRuntime.jsx("li",{"aria-selected":selected,"data-ui":"AutocompleteOption",id,role:"option",onClick:handleClick,onKeyDown:handleKeyDown,children});}function autocompleteReducer(state,msg){if(msg.type==="input/change"){return{...state,activeValue:null,focused:true,query:msg.query};}if(msg.type==="input/focus"){return{...state,focused:true};}if(msg.type==="root/blur"){return{...state,focused:false,query:null};}if(msg.type==="root/clear"){return{...state,activeValue:null,query:null,value:null};}if(msg.type==="root/escape"){return{...state,focused:false,query:null};}if(msg.type==="root/open"){return{...state,query:state.query||msg.query};}if(msg.type==="root/setActiveValue"){return{...state,activeValue:msg.value,listFocused:msg.listFocused||state.listFocused};}if(msg.type==="root/setListFocused"){return{...state,listFocused:msg.listFocused};}if(msg.type==="value/change"){return{...state,activeValue:msg.value,query:null,value:msg.value};}return state;}const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS=["Control","Shift","Alt","Enter","Home","End","PageUp","PageDown","Meta","Tab","CapsLock"];const AUTOCOMPLETE_POPOVER_PLACEMENT="bottom-start";const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS=["bottom-start","top-start"];const DEFAULT_RENDER_VALUE=(value,option)=>option?option.value:value;const DEFAULT_FILTER_OPTION=(query,option)=>option.value.toLowerCase().indexOf(query.toLowerCase())>-1;React$2.forwardRef(function InnerAutocomplete2(props,ref){const{border=true,customValidity,disabled,filterOption:filterOptionProp,fontSize=2,icon,id,listBox=EMPTY_RECORD,loading,onBlur,onChange,onFocus,onQueryChange,onSelect,openButton,options:optionsProp,padding:paddingProp=3,popover=EMPTY_RECORD,prefix,radius=3,readOnly,relatedElements,renderOption:renderOptionProp,renderPopover,renderValue=DEFAULT_RENDER_VALUE,suffix,value:valueProp,...restProps}=props;const[state,dispatch]=React$2.useReducer(autocompleteReducer,{activeValue:valueProp||null,focused:false,listFocused:false,query:null,value:valueProp||null});const{activeValue,focused,listFocused,query,value}=state;const defaultRenderOption=React$2.useCallback(_ref22=>{let{value:value2}=_ref22;return/* @__PURE__ */jsxRuntime.jsx(Card,{"data-as":"button",padding:paddingProp,radius:2,tone:"inherit",children:/* @__PURE__ */jsxRuntime.jsx(Text,{size:fontSize,textOverflow:"ellipsis",children:value2})});},[fontSize,paddingProp]);const renderOption=typeof renderOptionProp==="function"?renderOptionProp:defaultRenderOption;const filterOption=typeof filterOptionProp==="function"?filterOptionProp:DEFAULT_FILTER_OPTION;const rootElementRef=React$2.useRef(null);const resultsPopoverElementRef=React$2.useRef(null);const inputElementRef=React$2.useRef(null);const listBoxElementRef=React$2.useRef(null);const listFocusedRef=React$2.useRef(false);const valueRef=React$2.useRef(value);const valuePropRef=React$2.useRef(valueProp);const popoverMouseWithinRef=React$2.useRef(false);const forwardedRef=useForwardedRef(ref);const listBoxId="".concat(id,"-listbox");const options=Array.isArray(optionsProp)?optionsProp:EMPTY_ARRAY;const padding=useArrayProp(paddingProp);const currentOption=React$2.useMemo(()=>value!==null?options.find(o=>o.value===value):void 0,[options,value]);const filteredOptions=React$2.useMemo(()=>options.filter(option=>query?filterOption(query,option):true),[filterOption,options,query]);const filteredOptionsLen=filteredOptions.length;const activeItemId=activeValue?"".concat(id,"-option-").concat(activeValue):void 0;const expanded=query!==null&&loading||focused&&query!==null;const handleRootBlur=React$2.useCallback(event=>{setTimeout(()=>{if(popoverMouseWithinRef.current){return;}const elements=(relatedElements||[]).concat(rootElementRef.current?[rootElementRef.current]:[],resultsPopoverElementRef.current?[resultsPopoverElementRef.current]:[]);let focusInside=false;if(document.activeElement){for(const e of elements){if(e===document.activeElement||e.contains(document.activeElement)){focusInside=true;break;}}}if(focusInside===false){dispatch({type:"root/blur"});popoverMouseWithinRef.current=false;if(onQueryChange)onQueryChange(null);if(onBlur)onBlur(event);}},0);},[onBlur,onQueryChange,relatedElements]);const handleRootFocus=React$2.useCallback(event=>{const listBoxElement=listBoxElementRef.current;const focusedElement=event.target instanceof HTMLElement?event.target:null;const listFocused2=(listBoxElement==null?void 0:listBoxElement.contains(focusedElement))||false;if(listFocused2!==listFocusedRef.current){listFocusedRef.current=listFocused2;dispatch({type:"root/setListFocused",listFocused:listFocused2});}},[]);const handleOptionSelect=React$2.useCallback(v=>{var _a;dispatch({type:"value/change",value:v});popoverMouseWithinRef.current=false;if(onSelect)onSelect(v);valueRef.current=v;if(onChange)onChange(v);if(onQueryChange)onQueryChange(null);(_a=inputElementRef.current)==null?void 0:_a.focus();},[onChange,onSelect,onQueryChange]);const handleRootKeyDown=React$2.useCallback(event=>{var _a,_b;if(event.key==="ArrowDown"){event.preventDefault();if(!filteredOptionsLen)return;const activeOption=filteredOptions.find(o=>o.value===activeValue);const activeIndex=activeOption?filteredOptions.indexOf(activeOption):-1;const nextActiveOption=filteredOptions[(activeIndex+1)%filteredOptionsLen];if(nextActiveOption){dispatch({type:"root/setActiveValue",value:nextActiveOption.value,listFocused:true});}return;}if(event.key==="ArrowUp"){event.preventDefault();if(!filteredOptionsLen)return;const activeOption=filteredOptions.find(o=>o.value===activeValue);const activeIndex=activeOption?filteredOptions.indexOf(activeOption):-1;const nextActiveOption=filteredOptions[activeIndex===-1?filteredOptionsLen-1:(filteredOptionsLen+activeIndex-1)%filteredOptionsLen];if(nextActiveOption){dispatch({type:"root/setActiveValue",value:nextActiveOption.value,listFocused:true});}return;}if(event.key==="Escape"){dispatch({type:"root/escape"});popoverMouseWithinRef.current=false;if(onQueryChange)onQueryChange(null);(_a=inputElementRef.current)==null?void 0:_a.focus();return;}const target=event.target;const listEl=listBoxElementRef.current;if((listEl===target||(listEl==null?void 0:listEl.contains(target)))&&!AUTOCOMPLETE_LISTBOX_IGNORE_KEYS.includes(event.key)){(_b=inputElementRef.current)==null?void 0:_b.focus();return;}},[activeValue,filteredOptions,filteredOptionsLen,onQueryChange]);const handleInputChange=React$2.useCallback(event=>{const nextQuery=event.currentTarget.value;dispatch({type:"input/change",query:nextQuery});if(onQueryChange)onQueryChange(nextQuery);},[onQueryChange]);const handleInputFocus=React$2.useCallback(event=>{if(!focused){dispatch({type:"input/focus"});if(onFocus)onFocus(event);}},[focused,onFocus]);const handlePopoverMouseEnter=React$2.useCallback(()=>{popoverMouseWithinRef.current=true;},[]);const handlePopoverMouseLeave=React$2.useCallback(()=>{popoverMouseWithinRef.current=false;},[]);const handleClearButtonClick=React$2.useCallback(()=>{var _a;dispatch({type:"root/clear"});valueRef.current="";if(onChange)onChange("");if(onQueryChange)onQueryChange(null);(_a=inputElementRef.current)==null?void 0:_a.focus();},[onChange,onQueryChange]);const handleClearButtonFocus=React$2.useCallback(()=>{dispatch({type:"input/focus"});},[]);React$2.useEffect(()=>{if(valueProp!==valuePropRef.current){valuePropRef.current=valueProp;if(valueProp!==void 0){dispatch({type:"value/change",value:valueProp});valueRef.current=valueProp;}return;}if(valueProp!==valueRef.current){valueRef.current=valueProp||null;dispatch({type:"value/change",value:valueProp||null});}},[valueProp]);React$2.useEffect(()=>{if(!focused&&valueRef.current){dispatch({type:"root/setActiveValue",value:valueRef.current});}},[focused]);React$2.useEffect(()=>{const listElement=listBoxElementRef.current;if(!listElement)return;const activeOption=filteredOptions.find(o=>o.value===activeValue);if(activeOption){const activeIndex=filteredOptions.indexOf(activeOption);const activeItemElement=listElement.childNodes[activeIndex];if(activeItemElement){if(_hasFocus(activeItemElement)){return;}focusFirstDescendant(activeItemElement);}}},[activeValue,filteredOptions]);const setRef=React$2.useCallback(el=>{inputElementRef.current=el;forwardedRef.current=el;},[forwardedRef]);const clearButton=React$2.useMemo(()=>{if(!loading&&!disabled&&value){return{"aria-label":"Clear",onFocus:handleClearButtonFocus};}return void 0;},[disabled,handleClearButtonFocus,loading,value]);const openButtonBoxPadding=React$2.useMemo(()=>padding.map(v=>{if(v===0)return 0;if(v===1)return 1;if(v===2)return 1;return v-2;}),[padding]);const openButtonPadding=React$2.useMemo(()=>padding.map(v=>Math.max(v-1,0)),[padding]);const openButtonProps=React$2.useMemo(()=>typeof openButton==="object"?openButton:EMPTY_RECORD,[openButton]);const handleOpenClick=React$2.useCallback(event=>{dispatch({type:"root/open",query:value?renderValue(value,currentOption):""});if(openButtonProps.onClick)openButtonProps.onClick(event);_raf(()=>{var _a;return(_a=inputElementRef.current)==null?void 0:_a.focus();});},[currentOption,openButtonProps,renderValue,value]);const openButtonNode=React$2.useMemo(()=>!disabled&&!readOnly&&openButton?/* @__PURE__ */jsxRuntime.jsx(Box,{"aria-hidden":expanded,padding:openButtonBoxPadding,children:/* @__PURE__ */jsxRuntime.jsx(Button,{"aria-label":"Open",disabled:expanded,fontSize,icon:ChevronDownIcon,mode:"bleed",padding:openButtonPadding,...openButtonProps,onClick:handleOpenClick})}):void 0,[disabled,expanded,fontSize,handleOpenClick,openButton,openButtonBoxPadding,openButtonPadding,openButtonProps,readOnly]);const inputValue=React$2.useMemo(()=>{if(query===null){if(value!==null){return renderValue(value,currentOption);}return"";}return query;},[currentOption,query,renderValue,value]);const input=/* @__PURE__ */jsxRuntime.jsx(TextInput,{...restProps,"aria-activedescendant":activeItemId,"aria-autocomplete":"list","aria-expanded":expanded,"aria-owns":listBoxId,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",border,clearButton,customValidity,disabled,fontSize,icon,iconRight:loading&&AnimatedSpinnerIcon,id,inputMode:"search",onChange:handleInputChange,onClear:handleClearButtonClick,onFocus:handleInputFocus,padding,prefix,radius,readOnly,ref:setRef,role:"combobox",spellCheck:false,suffix:suffix||openButtonNode,value:inputValue});const handleListBoxKeyDown=React$2.useCallback(event=>{var _a;if(event.key==="Tab"){if(listFocused)(_a=inputElementRef.current)==null?void 0:_a.focus();}},[listFocused]);const content=React$2.useMemo(()=>{if(filteredOptions.length===0)return null;return/* @__PURE__ */jsxRuntime.jsx(ListBox,{"data-ui":"AutoComplete__results",onKeyDown:handleListBoxKeyDown,padding:1,...listBox,tabIndex:-1,children:/* @__PURE__ */jsxRuntime.jsx(Stack,{as:"ul","aria-multiselectable":false,"data-ui":"AutoComplete__resultsList",id:listBoxId,ref:listBoxElementRef,role:"listbox",space:1,children:filteredOptions.map(option=>{const active=activeValue!==null?option.value===activeValue:currentOption===option;return/* @__PURE__ */jsxRuntime.jsx(AutocompleteOption,{id:"".concat(id,"-option-").concat(option.value),onSelect:handleOptionSelect,selected:active,value:option.value,children:React$2.cloneElement(renderOption(option),{disabled:loading,selected:active,tabIndex:listFocused&&active?0:-1})},option.value);})})});},[activeValue,currentOption,filteredOptions,handleOptionSelect,handleListBoxKeyDown,id,listBox,listBoxId,listFocused,loading,renderOption]);const results=React$2.useMemo(()=>{if(renderPopover){return renderPopover({content,hidden:!expanded,inputElement:inputElementRef.current,onMouseEnter:handlePopoverMouseEnter,onMouseLeave:handlePopoverMouseLeave},resultsPopoverElementRef);}if(filteredOptionsLen===0){return null;}return/* @__PURE__ */jsxRuntime.jsx(Popover,{arrow:false,constrainSize:true,content,fallbackPlacements:AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS,matchReferenceWidth:true,onMouseEnter:handlePopoverMouseEnter,onMouseLeave:handlePopoverMouseLeave,open:expanded,overflow:"auto",placement:AUTOCOMPLETE_POPOVER_PLACEMENT,portal:true,radius,ref:resultsPopoverElementRef,referenceElement:inputElementRef.current,...popover});},[content,expanded,filteredOptionsLen,handlePopoverMouseEnter,handlePopoverMouseLeave,popover,radius,renderPopover]);return/* @__PURE__ */jsxRuntime.jsxs(Root$9,{"data-ui":"Autocomplete",onBlur:handleRootBlur,onFocus:handleRootFocus,onKeyDown:handleRootKeyDown,ref:rootElementRef,children:[input,results]});});const Root$8=styled__default.default.ol(_templateObject64||(_templateObject64=_taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n display: flex;\n list-style: none;\n align-items: center;\n white-space: nowrap;\n line-height: 0;\n"])));const ExpandButton=styled__default.default(Button)(_templateObject65||(_templateObject65=_taggedTemplateLiteral(["\n appearance: none;\n margin: -4px;\n"])));React$2.forwardRef(function Breadcrumbs2(props,ref){const{children,maxLength,separator,space:spaceRaw=2,...restProps}=props;const space=useArrayProp(spaceRaw);const[open,setOpen]=React$2.useState(false);const[expandElement,setExpandElement]=React$2.useState(null);const[popoverElement,setPopoverElement]=React$2.useState(null);const collapse=React$2.useCallback(()=>setOpen(false),[]);const expand=React$2.useCallback(()=>setOpen(true),[]);useClickOutside(collapse,[expandElement,popoverElement]);const rawItems=React$2.useMemo(()=>React$2.Children.toArray(children).filter(child=>{return React$2.isValidElement(child);}),[children]);const items=React$2.useMemo(()=>{const len=rawItems.length;if(maxLength&&len>maxLength){const beforeLength=Math.ceil(maxLength/2);const afterLength=Math.floor(maxLength/2);return[...rawItems.slice(0,beforeLength-1),/* @__PURE__ */jsxRuntime.jsx(Popover,{constrainSize:true,content:/* @__PURE__ */jsxRuntime.jsx(Stack,{as:"ol",overflow:"auto",padding:space,space,children:rawItems.slice(beforeLength-1,len-afterLength)}),open,placement:"top",portal:true,ref:setPopoverElement,children:/* @__PURE__ */jsxRuntime.jsx(ExpandButton,{fontSize:1,mode:"bleed",onClick:open?collapse:expand,padding:1,ref:setExpandElement,selected:open,text:"\u2026"})},"button"),...rawItems.slice(len-afterLength)];}return rawItems;},[collapse,expand,maxLength,open,rawItems,space]);return/* @__PURE__ */jsxRuntime.jsx(Root$8,{"data-ui":"Breadcrumbs",...restProps,ref,children:items.map((item,itemIndex)=>/* @__PURE__ */jsxRuntime.jsxs(React$2.Fragment,{children:[itemIndex>0&&/* @__PURE__ */jsxRuntime.jsx(Box,{"aria-hidden":true,as:"li",paddingX:space,children:separator||/* @__PURE__ */jsxRuntime.jsx(Text,{muted:true,children:"/"})}),/* @__PURE__ */jsxRuntime.jsx(Box,{as:"li",children:item})]},itemIndex))});});function dialogStyle(_ref23){let{theme}=_ref23;const color=theme.sanity.color.base;return{"&:not([hidden])":{display:"flex"},top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center",outline:"none",background:color.shadow.umbra};}function responsiveDialogPositionStyle(props){const{theme}=props;const{media}=theme.sanity;return _responsive(media,props.$position,position=>({"&&":{position}}));}const key$3=Symbol.for("@sanity/ui/context/dialog");globalScope[key$3]=globalScope[key$3]||React$2.createContext({version:0});const DialogContext=globalScope[key$3];function useDialog(){return React$2.useContext(DialogContext);}function isTargetWithinScope(boundaryElement,portalElement,target){if(!boundaryElement||!portalElement)return true;return containsOrEqualsElement(boundaryElement,target)||containsOrEqualsElement(portalElement,target);}const Root$7=styled__default.default(Layer)(responsivePaddingStyle,dialogStyle,responsiveDialogPositionStyle);const DialogContainer=styled__default.default(Container)(_templateObject66||(_templateObject66=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));const DialogCardRoot=styled__default.default(Card)(_templateObject67||(_templateObject67=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n"])));const DialogLayout=styled__default.default(Flex)(_templateObject68||(_templateObject68=_taggedTemplateLiteral(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));const DialogHeader=styled__default.default(Card)(_templateObject69||(_templateObject69=_taggedTemplateLiteral(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n"])));const DialogContent=styled__default.default(Box)(_templateObject70||(_templateObject70=_taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));const DialogFooter=styled__default.default(Box)(_templateObject71||(_templateObject71=_taggedTemplateLiteral(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));const DialogCard=React$2.forwardRef(function DialogCard2(props,ref){var _a;const{__unstable_autoFocus:autoFocus,__unstable_hideCloseButton:hideCloseButton,children,contentRef,footer,header,id,onClickOutside,onClose,portal:portalProp,radius:radiusProp,scheme,shadow:shadowProp,width:widthProp}=props;const portal=usePortal();const portalElement=portalProp?((_a=portal.elements)==null?void 0:_a[portalProp])||null:portal.element;const boundaryElement=useBoundaryElement().element;const radius=useArrayProp(radiusProp);const shadow=useArrayProp(shadowProp);const width=useArrayProp(widthProp);const forwardedRef=useForwardedRef(ref);const[rootElement,setRootElement]=React$2.useState(null);const localContentRef=React$2.useRef(null);const layer=useLayer();const{isTopLayer}=layer;const labelId="".concat(id,"_label");const showCloseButton=Boolean(onClose)&&hideCloseButton===false;const showHeader=Boolean(header)||showCloseButton;React$2.useEffect(()=>{if(!autoFocus)return;if(forwardedRef.current){focusFirstDescendant(forwardedRef.current);}},[autoFocus,forwardedRef]);useGlobalKeyDown(React$2.useCallback(event=>{if(!isTopLayer||!onClose)return;const target=document.activeElement;if(target&&!isTargetWithinScope(boundaryElement,portalElement,target)){return;}if(event.key==="Escape"){event.preventDefault();event.stopPropagation();onClose();}},[boundaryElement,isTopLayer,onClose,portalElement]));useClickOutside(React$2.useCallback(event=>{if(!isTopLayer||!onClickOutside)return;const target=event.target;if(target&&!isTargetWithinScope(boundaryElement,portalElement,target)){return;}onClickOutside();},[boundaryElement,isTopLayer,onClickOutside,portalElement]),[rootElement]);const setRef=React$2.useCallback(el=>{setRootElement(el);forwardedRef.current=el;},[forwardedRef]);const setContentRef=React$2.useCallback(el=>{localContentRef.current=el;if(typeof contentRef==="function")contentRef(el);else if(contentRef)contentRef.current=el;},[contentRef]);return/* @__PURE__ */jsxRuntime.jsx(DialogContainer,{"data-ui":"DialogCard",width,children:/* @__PURE__ */jsxRuntime.jsx(DialogCardRoot,{radius,ref:setRef,scheme,shadow,children:/* @__PURE__ */jsxRuntime.jsxs(DialogLayout,{direction:"column",children:[showHeader&&/* @__PURE__ */jsxRuntime.jsx(DialogHeader,{children:/* @__PURE__ */jsxRuntime.jsxs(Flex,{children:[/* @__PURE__ */jsxRuntime.jsx(Box,{flex:1,padding:4,children:header&&/* @__PURE__ */jsxRuntime.jsx(Text,{id:labelId,weight:"semibold",children:header})}),showCloseButton&&/* @__PURE__ */jsxRuntime.jsx(Box,{padding:2,children:/* @__PURE__ */jsxRuntime.jsx(Button,{"aria-label":"Close dialog",disabled:!onClose,icon:CloseIcon,mode:"bleed",onClick:onClose,padding:3})})]})}),/* @__PURE__ */jsxRuntime.jsx(DialogContent,{flex:1,ref:setContentRef,tabIndex:-1,children}),footer&&/* @__PURE__ */jsxRuntime.jsx(DialogFooter,{children:footer})]})})});});React$2.forwardRef(function Dialog2(props,ref){var _a,_b;const dialog=useDialog();const theme=useTheme();const{__unstable_autoFocus:autoFocus=true,__unstable_hideCloseButton:hideCloseButton=false,cardRadius:cardRadiusProp=3,cardShadow=4,children,contentRef,footer,header,id,onActivate,onClickOutside,onClose,onFocus,padding:paddingProp=4,portal:portalProp,position:positionProp=dialog.position||"fixed",scheme,width:widthProp=0,zOffset:zOffsetProp=dialog.zOffset||((_a=theme.sanity.layer)==null?void 0:_a.dialog.zOffset),...restProps}=props;const portal=usePortal();const portalElement=portalProp?((_b=portal.elements)==null?void 0:_b[portalProp])||null:portal.element;const boundaryElement=useBoundaryElement().element;const cardRadius=useArrayProp(cardRadiusProp);const padding=useArrayProp(paddingProp);const position=useArrayProp(positionProp);const width=useArrayProp(widthProp);const zOffset=useArrayProp(zOffsetProp);const preDivRef=React$2.useRef(null);const postDivRef=React$2.useRef(null);const cardRef=React$2.useRef(null);const focusedElementRef=React$2.useRef(null);const handleFocus=React$2.useCallback(event=>{onFocus==null?void 0:onFocus(event);const target=event.target;const cardElement=cardRef.current;if(cardElement&&target===preDivRef.current){focusLastDescendant(cardElement);return;}if(cardElement&&target===postDivRef.current){focusFirstDescendant(cardElement);return;}if(isHTMLElement(event.target)){focusedElementRef.current=event.target;}},[onFocus]);const labelId="".concat(id,"_label");const rootClickTimeoutRef=React$2.useRef();const handleRootClick=React$2.useCallback(()=>{if(rootClickTimeoutRef.current){clearTimeout(rootClickTimeoutRef.current);}rootClickTimeoutRef.current=setTimeout(()=>{const activeElement=document.activeElement;if(activeElement&&!isTargetWithinScope(boundaryElement,portalElement,activeElement)){const target=focusedElementRef.current;if(!target||!document.body.contains(target)){const cardElement=cardRef.current;if(cardElement)focusFirstDescendant(cardElement);return;}target.focus();}},0);},[boundaryElement,portalElement]);return/* @__PURE__ */jsxRuntime.jsx(Portal,{__unstable_name:portalProp,children:/* @__PURE__ */jsxRuntime.jsxs(Root$7,{...restProps,$padding:padding,$position:position,"aria-labelledby":labelId,"aria-modal":true,"data-ui":"Dialog",id,onActivate,onClick:handleRootClick,onFocus:handleFocus,ref,role:"dialog",zOffset,children:[/* @__PURE__ */jsxRuntime.jsx("div",{ref:preDivRef,tabIndex:0}),/* @__PURE__ */jsxRuntime.jsx(DialogCard,{__unstable_autoFocus:autoFocus,__unstable_hideCloseButton:hideCloseButton,contentRef,footer,header,id,onClickOutside,onClose,portal:portalProp,radius:cardRadius,ref:cardRef,scheme,shadow:cardShadow,width,children}),/* @__PURE__ */jsxRuntime.jsx("div",{ref:postDivRef,tabIndex:0})]})});});const Root$6=styled__default.default.kbd(_templateObject72||(_templateObject72=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));const Key=styled__default.default(KBD)(_templateObject73||(_templateObject73=_taggedTemplateLiteral(["\n &:not([hidden]) {\n display: block;\n }\n"])));const Hotkeys=React$2.forwardRef(function Hotkeys2(props,ref){const{fontSize,keys,padding,radius,space:spaceProp=1,...restProps}=props;const space=useArrayProp(spaceProp);if(!keys||keys.length===0){return/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{});}return/* @__PURE__ */jsxRuntime.jsx(Root$6,{"data-ui":"Hotkeys",...restProps,ref,children:/* @__PURE__ */jsxRuntime.jsx(Inline,{as:"span",space,children:keys.map((key,i)=>/* @__PURE__ */jsxRuntime.jsx(Key,{fontSize,padding,radius,children:key},i))})});});const key$2=Symbol.for("@sanity/ui/context/menu");globalScope[key$2]=globalScope[key$2]||React$2.createContext(null);const MenuContext=globalScope[key$2];function _isFocusable(element){return isHTMLAnchorElement(element)&&element.getAttribute("data-disabled")!=="true"||isHTMLButtonElement(element)&&!element.disabled;}function _getFocusableElements(elements){return elements.filter(_isFocusable);}function _getDOMPath(rootElement,el){const path=[];let e=el;while(e!==rootElement){const parentElement=e.parentElement;if(!parentElement)return path;const children=Array.from(parentElement.childNodes);const index=children.indexOf(e);path.unshift(index);if(parentElement===rootElement){return path;}e=parentElement;}return path;}const EMPTY_PATH=[];function _sortElements(rootElement,elements){if(!rootElement)return;const map=/* @__PURE__ */new WeakMap();for(const el of elements){map.set(el,_getDOMPath(rootElement,el));}const _sort=(a,b)=>{const _a=map.get(a)||EMPTY_PATH;const _b=map.get(b)||EMPTY_PATH;const len=Math.max(_a.length,_b.length);for(let i=0;i<len;i+=1){const aIndex=_a[i]||-1;const bIndex=_b[i]||-1;if(aIndex!==bIndex){return aIndex-bIndex;}}return 0;};elements.sort(_sort);}function useMenuController(props){const{onKeyDown,originElement,shouldFocus}=props;const elementsRef=React$2.useRef([]);const[rootElement,setRootElement]=React$2.useState(null);const[activeIndex,_setActiveIndex]=React$2.useState(-1);const activeIndexRef=React$2.useRef(activeIndex);const activeElement=elementsRef.current[activeIndex]||null;const mounted=Boolean(rootElement);const setActiveIndex=React$2.useCallback(nextActiveIndex=>{_setActiveIndex(nextActiveIndex);activeIndexRef.current=nextActiveIndex;},[]);const mount=React$2.useCallback((element,selected)=>{if(!element)return()=>void 0;if(elementsRef.current.indexOf(element)===-1){elementsRef.current.push(element);_sortElements(rootElement,elementsRef.current);}if(selected){const selectedIndex=elementsRef.current.indexOf(element);setActiveIndex(selectedIndex);}return()=>{const idx=elementsRef.current.indexOf(element);if(idx>-1){elementsRef.current.splice(idx,1);}};},[rootElement,setActiveIndex]);const handleKeyDown=React$2.useCallback(event=>{if(event.key==="Tab"){if(originElement){originElement.focus();}return;}if(event.key==="Home"){event.preventDefault();event.stopPropagation();const focusableElements=_getFocusableElements(elementsRef.current);const el=focusableElements[0];if(!el)return;const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);return;}if(event.key==="End"){event.preventDefault();event.stopPropagation();const focusableElements=_getFocusableElements(elementsRef.current);const el=focusableElements[focusableElements.length-1];if(!el)return;const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);return;}if(event.key==="ArrowUp"){event.preventDefault();event.stopPropagation();const focusableElements=_getFocusableElements(elementsRef.current);const focusableLen=focusableElements.length;if(focusableLen===0)return;const focusedElement=elementsRef.current[activeIndexRef.current];let focusedIndex=focusableElements.indexOf(focusedElement);focusedIndex=(focusedIndex-1+focusableLen)%focusableLen;const el=focusableElements[focusedIndex];const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);return;}if(event.key==="ArrowDown"){event.preventDefault();event.stopPropagation();const focusableElements=_getFocusableElements(elementsRef.current);const focusableLen=focusableElements.length;if(focusableLen===0)return;const focusedElement=elementsRef.current[activeIndexRef.current];let focusedIndex=focusableElements.indexOf(focusedElement);focusedIndex=(focusedIndex+1)%focusableLen;const el=focusableElements[focusedIndex];const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);return;}if(onKeyDown){onKeyDown(event);}},[onKeyDown,originElement,setActiveIndex]);const handleItemMouseEnter=React$2.useCallback(event=>{const element=event.currentTarget;const currentIndex=elementsRef.current.indexOf(element);setActiveIndex(currentIndex);},[setActiveIndex]);const handleItemMouseLeave=React$2.useCallback(()=>{rootElement==null?void 0:rootElement.focus();setActiveIndex(-1);},[rootElement,setActiveIndex]);React$2.useEffect(()=>{if(!mounted)return;const rafId=window.requestAnimationFrame(()=>{const _activeIndex=activeIndexRef.current;if(_activeIndex===-1){if(shouldFocus==="first"){const focusableElements=_getFocusableElements(elementsRef.current);const el=focusableElements[0];if(el){const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);activeIndexRef.current=currentIndex;}}if(shouldFocus==="last"){const focusableElements=_getFocusableElements(elementsRef.current);const el=focusableElements[focusableElements.length-1];if(el){const currentIndex=elementsRef.current.indexOf(el);setActiveIndex(currentIndex);activeIndexRef.current=currentIndex;}}return;}const element=elementsRef.current[_activeIndex]||null;element==null?void 0:element.focus();});return()=>{window.cancelAnimationFrame(rafId);};},[activeIndex,mounted,setActiveIndex,shouldFocus]);return{activeElement,activeIndex,handleItemMouseEnter,handleItemMouseLeave,handleKeyDown,mount,rootElement,setRootElement};}const Root$5=styled__default.default(Box)(_templateObject74||(_templateObject74=_taggedTemplateLiteral(["\n outline: none;\n overflow: auto;\n"])));React$2.forwardRef(function Menu2(props,ref){const{children,// eslint-disable-next-line @typescript-eslint/no-unused-vars
6158
6158
  focusFirst,// eslint-disable-next-line @typescript-eslint/no-unused-vars
6159
6159
  focusLast,onClickOutside,onEscape,onItemClick,onItemSelect,onKeyDown,originElement,padding=1,registerElement,shouldFocus=props.focusFirst&&"first"||props.focusLast&&"last"||null,space=1,...restProps}=props;const forwardedRef=useForwardedRef(ref);const{isTopLayer}=useLayer();const{activeElement,activeIndex,handleItemMouseEnter,handleItemMouseLeave,handleKeyDown,mount,rootElement,setRootElement}=useMenuController({onKeyDown,originElement,shouldFocus});const handleRefChange=React$2.useCallback(el=>{setRootElement(el);forwardedRef.current=el;},[forwardedRef,setRootElement]);React$2.useEffect(()=>{if(onItemSelect)onItemSelect(activeIndex);},[activeIndex,onItemSelect]);useClickOutside(React$2.useCallback(event=>isTopLayer&&onClickOutside&&onClickOutside(event),[isTopLayer,onClickOutside]),[rootElement]);useGlobalKeyDown(React$2.useCallback(event=>{if(!isTopLayer)return;if(event.key==="Escape"){event.stopPropagation();if(onEscape)onEscape();}},[isTopLayer,onEscape]));React$2.useEffect(()=>{if(!rootElement||!registerElement)return;return registerElement(rootElement);},[registerElement,rootElement]);const value=React$2.useMemo(()=>({version:0,activeElement,activeIndex,mount,onClickOutside,onEscape,onItemClick,onItemMouseEnter:handleItemMouseEnter,onItemMouseLeave:handleItemMouseLeave,registerElement,// deprecated
6160
- onMouseEnter:handleItemMouseEnter,onMouseLeave:handleItemMouseLeave}),[activeElement,activeIndex,mount,handleItemMouseEnter,handleItemMouseLeave,onClickOutside,onEscape,onItemClick,registerElement]);return/* @__PURE__ */jsxRuntime.jsx(MenuContext.Provider,{value,children:/* @__PURE__ */jsxRuntime.jsx(Root$5,{"data-ui":"Menu",...restProps,onKeyDown:handleKeyDown,padding,ref:handleRefChange,role:"menu",tabIndex:-1,children:/* @__PURE__ */jsxRuntime.jsx(Stack,{space,children})})});});React$2.forwardRef(function MenuButton2(props,ref){const{__unstable_disableRestoreFocusOnClose:disableRestoreFocusOnClose=false,boundaryElement:deprecated_boundaryElement,button:buttonProp,id,menu:menuProp,onClose,placement:deprecated_placement,popoverScheme:deprecated_popoverScheme,portal:deprecated_portal=true,popover,popoverRadius:deprecated_popoverRadius,preventOverflow:deprecated_preventOverflow}=props;const[open,setOpen]=React$2.useState(false);const[shouldFocus,setShouldFocus]=React$2.useState(null);const[buttonElement,setButtonElement]=React$2.useState(null);const[menuElements,setChildMenuElements]=React$2.useState([]);const openRef=React$2.useRef(open);React$2.useEffect(()=>{if(onClose&&!open&&openRef.current){onClose();}},[onClose,open]);React$2.useEffect(()=>{openRef.current=open;},[open]);const handleButtonClick=React$2.useCallback(()=>{setOpen(v=>!v);setShouldFocus(null);},[]);const handleButtonKeyDown=React$2.useCallback(event=>{if(event.key==="ArrowDown"||event.key==="Enter"||event.key===" "){event.preventDefault();setOpen(true);setShouldFocus("first");return;}if(event.key==="ArrowUp"){event.preventDefault();setOpen(true);setShouldFocus("last");return;}},[]);const handleMenuClickOutside=React$2.useCallback(event=>{const target=event.target;if(!(target instanceof Node)){return;}if(buttonElement&&(target===buttonElement||buttonElement.contains(target))){return;}for(const el of menuElements){if(target===el||el.contains(target)){return;}}setOpen(false);},[buttonElement,menuElements]);const handleMenuEscape=React$2.useCallback(()=>{setOpen(false);if(disableRestoreFocusOnClose)return;if(buttonElement)buttonElement.focus();},[buttonElement,disableRestoreFocusOnClose]);const handleBlur=React$2.useCallback(event=>{const target=event.relatedTarget;if(!(target instanceof Node)){return;}for(const el of menuElements){if(el===target||el.contains(target)){return;}}setOpen(false);},[menuElements]);const handleItemClick=React$2.useCallback(()=>{setOpen(false);if(disableRestoreFocusOnClose)return;if(buttonElement)buttonElement.focus();},[buttonElement,disableRestoreFocusOnClose]);const registerElement=React$2.useCallback(el=>{setChildMenuElements(els=>els.concat([el]));return()=>{setChildMenuElements(els=>{return els.filter(_el=>_el!==el);});};},[]);const menuProps=React$2.useMemo(()=>({"aria-labelledby":id,onBlurCapture:handleBlur,onClickOutside:handleMenuClickOutside,onEscape:handleMenuEscape,onItemClick:handleItemClick,originElement:buttonElement,registerElement,shouldFocus}),[buttonElement,handleMenuClickOutside,handleMenuEscape,handleItemClick,id,handleBlur,registerElement,shouldFocus]);const menu=reactIsExports$1.isElement(menuProp)?React$2.cloneElement(menuProp,menuProps):null;const setButtonRef=React$2.useCallback(el=>{if(typeof ref==="function"){ref(el);}else if(ref){ref.current=el;}setButtonElement(el);},[ref]);const button=React$2.useMemo(()=>reactIsExports$1.isElement(buttonProp)?React$2.cloneElement(buttonProp,{"data-ui":"MenuButton",id,onClick:handleButtonClick,onKeyDown:handleButtonKeyDown,"aria-haspopup":true,"aria-expanded":open,ref:setButtonRef,selected:open}):null,[buttonProp,handleButtonClick,handleButtonKeyDown,id,open,setButtonRef]);const popoverProps=React$2.useMemo(()=>({boundaryElement:deprecated_boundaryElement,overflow:"auto",placement:deprecated_placement,portal:deprecated_portal,preventOverflow:deprecated_preventOverflow,radius:deprecated_popoverRadius,scheme:deprecated_popoverScheme,...(popover||{})}),[deprecated_boundaryElement,deprecated_placement,deprecated_popoverRadius,deprecated_popoverScheme,deprecated_portal,deprecated_preventOverflow,popover]);return/* @__PURE__ */jsxRuntime.jsx(Popover,{"data-ui":"MenuButton__popover",...popoverProps,content:menu,open,children:button||/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{})});});styled__default.default.hr(_templateObject75||(_templateObject75=_taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));function selectableBaseStyle(){return styled.css(_templateObject76||(_templateObject76=_taggedTemplateLiteral(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));}function selectableColorStyle(props){var _a,_b;const{$tone,theme}=props;const{base,muted,selectable}=theme.sanity.color;const tone=selectable?selectable[$tone]||selectable.default:muted[$tone]||muted.default;return styled.css(_templateObject77||(_templateObject77=_taggedTemplateLiteral(["\n ","\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ","\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ","\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ","\n }\n\n &:active {\n ","\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ","\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ","\n }\n\n &[data-selected] {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ","\n }\n\n &:active {\n ","\n }\n }\n }\n }\n }\n\n ","\n "])),_colorVarsStyle(base,tone.enabled),_colorVarsStyle(base,tone.disabled),_colorVarsStyle(base,tone.pressed),_colorVarsStyle(base,tone.selected),_colorVarsStyle(base,tone.hovered),_colorVarsStyle(base,tone.pressed),_colorVarsStyle(base,tone.disabled),_colorVarsStyle(base,tone.pressed),_colorVarsStyle(base,tone.selected),_colorVarsStyle(base,tone.hovered),_colorVarsStyle(base,tone.pressed),(_b=(_a=theme.sanity.styles)==null?void 0:_a.card)==null?void 0:_b.root);}const Selectable=styled__default.default(Box)(responsiveRadiusStyle,selectableBaseStyle,selectableColorStyle);function useMenu(){const value=React$2.useContext(MenuContext);if(!value){throw new Error("useMenu(): missing context value");}if(!isRecord(value)||value.version!==0){throw new Error("useMenu(): the context value is not compatible");}return value;}React$2.forwardRef(function MenuItem2(props,forwardedRef){const{as="button",children,disabled,fontSize=2,hotkeys,icon,iconRight,onClick,padding=3,paddingX,paddingY,paddingTop,paddingRight,paddingBottom,paddingLeft,pressed,radius=2,selected:selectedProp,space=3,text,tone="default",...restProps}=props;const menu=useMenu();const{activeElement,mount,onItemClick,onItemMouseEnter=menu.onMouseEnter,onItemMouseLeave=menu.onMouseLeave}=menu;const[rootElement,setRootElement]=React$2.useState(null);const active=Boolean(activeElement)&&activeElement===rootElement;React$2.useEffect(()=>mount(rootElement,selectedProp),[mount,rootElement,selectedProp]);const ref=useForwardedRef(forwardedRef);const handleClick=React$2.useCallback(event=>{if(disabled)return;if(onClick)onClick(event);if(onItemClick)onItemClick();},[disabled,onClick,onItemClick]);const paddingProps=React$2.useMemo(()=>({padding,paddingX,paddingY,paddingTop,paddingRight,paddingBottom,paddingLeft}),[padding,paddingX,paddingY,paddingTop,paddingRight,paddingBottom,paddingLeft]);const setRef=React$2.useCallback(el=>{ref.current=el;setRootElement(el);},[ref]);return/* @__PURE__ */jsxRuntime.jsxs(Selectable,{"data-ui":"MenuItem",...restProps,"aria-pressed":as==="button"&&pressed,"data-pressed":as!=="button"&&pressed?"":void 0,"data-selected":active?"":void 0,"data-disabled":disabled?"":void 0,forwardedAs:as,$radius:useArrayProp(radius),$padding:useArrayProp(0),$tone:tone,disabled,onClick:handleClick,onMouseEnter:onItemMouseEnter,onMouseLeave:onItemMouseLeave,ref:setRef,role:"menuitem",tabIndex:-1,type:as==="button"?"button":void 0,children:[(icon||text||iconRight)&&/* @__PURE__ */jsxRuntime.jsx(Box,{as:"span",...paddingProps,children:/* @__PURE__ */jsxRuntime.jsxs(Flex,{as:"span",children:[icon&&/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(icon)&&icon,reactIsExports$1.isValidElementType(icon)&&React$2.createElement(icon)]}),text&&/* @__PURE__ */jsxRuntime.jsx(Box,{flex:1,marginLeft:icon?space:void 0,marginRight:iconRight?space:void 0,children:/* @__PURE__ */jsxRuntime.jsx(Text,{size:fontSize,textOverflow:"ellipsis",children:text})}),hotkeys&&/* @__PURE__ */jsxRuntime.jsx(Box,{marginLeft:space,style:{marginTop:-4,marginBottom:-4},children:/* @__PURE__ */jsxRuntime.jsx(Hotkeys,{fontSize,keys:hotkeys})}),iconRight&&/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(iconRight)&&iconRight,reactIsExports$1.isValidElementType(iconRight)&&React$2.createElement(iconRight)]})]})}),children&&/* @__PURE__ */jsxRuntime.jsx(Box,{as:"span",...paddingProps,children})]});});const keyframe=styled.keyframes(_templateObject78||(_templateObject78=_taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));const animation=styled.css(_templateObject79||(_templateObject79=_taggedTemplateLiteral(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ",";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])),keyframe);const skeletonStyle=styled.css(_templateObject80||(_templateObject80=_taggedTemplateLiteral(["\n opacity: ",";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ","\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])),_ref24=>{let{$visible}=_ref24;return $visible?1:0;},_ref25=>{let{$animated}=_ref25;return $animated?animation:styled.css(_templateObject81||(_templateObject81=_taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));});const Root$4=styled__default.default(Box)(responsiveRadiusStyle,skeletonStyle);const Skeleton=React$2.forwardRef(function Skeleton2(props,ref){const{animated=false,delay,radius,...restProps}=props;const[visible,setVisible]=React$2.useState(delay?false:true);React$2.useEffect(()=>{if(!delay){return setVisible(true);}const timeout=setTimeout(()=>{setVisible(true);},delay);return()=>{clearTimeout(timeout);};},[delay]);return/* @__PURE__ */jsxRuntime.jsx(Root$4,{...restProps,$animated:animated,$radius:useArrayProp(radius),$visible:visible,ref});});const Root$3=styled__default.default(Skeleton)(_ref26=>{let{$size,$style,theme}=_ref26;const{media}=theme.sanity;const font=theme.sanity.fonts[$style];const styles=_responsive(media,$size,sizeIndex=>{const fontSize=font.sizes[sizeIndex];const capHeight=fontSize.lineHeight-fontSize.ascenderHeight-fontSize.descenderHeight;return{height:capHeight};});return styles;});React$2.forwardRef(function TextSkeleton2(props,ref){const{size=2,...restProps}=props;const $size=useArrayProp(size);return/* @__PURE__ */jsxRuntime.jsx(Root$3,{...restProps,$size,ref,$style:"text"});});React$2.forwardRef(function TextSkeleton3(props,ref){const{size=2,...restProps}=props;const $size=useArrayProp(size);return/* @__PURE__ */jsxRuntime.jsx(Root$3,{...restProps,$size,ref,$style:"label"});});React$2.forwardRef(function TextSkeleton4(props,ref){const{size=2,...restProps}=props;const $size=useArrayProp(size);return/* @__PURE__ */jsxRuntime.jsx(Root$3,{...restProps,$size,ref,$style:"heading"});});React$2.forwardRef(function TextSkeleton5(props,ref){const{size=2,...restProps}=props;const $size=useArrayProp(size);return/* @__PURE__ */jsxRuntime.jsx(Root$3,{...restProps,$size,ref,$style:"code"});});React$2.forwardRef(function Tab2(props,forwardedRef){const{icon,id,focused,fontSize,label,onClick,onFocus,padding=2,selected,...restProps}=props;const elementRef=React$2.useRef(null);const focusedRef=React$2.useRef(false);const handleBlur=React$2.useCallback(()=>{focusedRef.current=false;},[]);const handleFocus=React$2.useCallback(event=>{focusedRef.current=true;if(onFocus)onFocus(event);},[onFocus]);const ref=useForwardedRef(forwardedRef);React$2.useEffect(()=>{if(focused&&!focusedRef.current){if(elementRef.current)elementRef.current.focus();focusedRef.current=true;}},[focused]);const setRef=el=>{elementRef.current=el;ref.current=el;};return/* @__PURE__ */jsxRuntime.jsx(Button,{"data-ui":"Tab",...restProps,"aria-selected":selected?"true":"false",fontSize,icon,id,mode:"bleed",onClick,onBlur:handleBlur,onFocus:handleFocus,padding,ref:setRef,role:"tab",selected,tabIndex:selected?0:-1,text:label,type:"button"});});function _isReactElement(node){return Boolean(node);}React$2.forwardRef(function TabList2(props,ref){const{children:childrenProp,...restProps}=props;const[focusedIndex,setFocusedIndex]=React$2.useState(-1);const children=React$2.useMemo(()=>childrenProp.filter(_isReactElement),[childrenProp]);const tabs=children.map((child,childIndex)=>React$2.cloneElement(child,{focused:focusedIndex===childIndex,key:childIndex,onFocus:()=>handleTabFocus(childIndex)}));const numTabs=tabs.length;const handleTabFocus=React$2.useCallback(tabIdx=>{setFocusedIndex(tabIdx);},[]);const handleKeyDown=React$2.useCallback(event=>{if(event.key==="ArrowLeft"){setFocusedIndex(prevIndex=>(prevIndex+numTabs-1)%numTabs);}if(event.key==="ArrowRight"){setFocusedIndex(prevIndex=>(prevIndex+1)%numTabs);}},[numTabs]);return/* @__PURE__ */jsxRuntime.jsx(Inline,{"data-ui":"TabList",...restProps,onKeyDown:handleKeyDown,ref,role:"tablist",children:tabs});});React$2.forwardRef(function TabPanel2(props,ref){const{flex,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Box,{"data-ui":"TabPanel",...restProps,flex,ref,role:"tabpanel",tabIndex:props.tabIndex===void 0?0:props.tabIndex,children:props.children});});styled__default.default(Card)(_templateObject82||(_templateObject82=_taggedTemplateLiteral(["\n pointer-events: all;\n"])));styled__default.default(Flex)(_templateObject83||(_templateObject83=_taggedTemplateLiteral(["\n overflow-x: auto;\n"])));const key$1=Symbol.for("@sanity/ui/context/toast");globalScope[key$1]=globalScope[key$1]||React$2.createContext(null);styled__default.default(Layer)(_templateObject84||(_templateObject84=_taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));styled__default.default.div(_templateObject85||(_templateObject85=_taggedTemplateLiteral(["\n box-sizing: border-box;\n position: absolute;\n right: 0;\n bottom: 0;\n max-width: 420px;\n width: 100%;\n"])));function _findPrevItemElement(state,itemElements,focusedElement){var _a;const idx=itemElements.indexOf(focusedElement);const els=itemElements.slice(0,idx);const len=els.length;for(let i=len-1;i>=0;i-=1){const itemKey=els[i].getAttribute("data-tree-key");if(!itemKey){continue;}const segments=itemKey.split("/");segments.pop();const p=[];let expanded=true;for(let j=0;j<segments.length;j+=1){p.push(segments[j]);const k=p.join("/");if(!((_a=state[k])==null?void 0:_a.expanded)){expanded=false;break;}}if(expanded){return els[i];}}return null;}function _findNextItemElement(state,itemElements,focusedElement){var _a;const idx=itemElements.indexOf(focusedElement);const els=itemElements.slice(idx);const len=itemElements.length;for(let i=1;i<len;i+=1){if(!els[i]){continue;}const itemKey=els[i].getAttribute("data-tree-key");if(!itemKey){continue;}const segments=itemKey.split("/");segments.pop();const p=[];let expanded=true;for(let j=0;j<segments.length;j+=1){p.push(segments[j]);const k=p.join("/");if(!((_a=state[k])==null?void 0:_a.expanded)){expanded=false;break;}}if(expanded){return els[i];}}return null;}function _focusItemElement(el){if(el.getAttribute("role")==="treeitem"){el.focus();}if(el.getAttribute("role")==="none"){const firstChild=el.firstChild;if(firstChild&&firstChild instanceof HTMLElement){firstChild.focus();}}}const key=Symbol.for("@sanity/ui/context/tree");globalScope[key]=globalScope[key]||React$2.createContext(null);const TreeContext=globalScope[key];const Tree=React$2.memo(React$2.forwardRef(function Tree2(props,ref){const{children,space=1,...restProps}=props;const forwardedRef=useForwardedRef(ref);const[focusedElement,setFocusedElement]=React$2.useState(null);const focusedElementRef=React$2.useRef(focusedElement);const path=React$2.useMemo(()=>[],[]);const[itemElements,setItemElements]=React$2.useState([]);const[state,setState]=React$2.useState({});const stateRef=React$2.useRef(state);React$2.useEffect(()=>{focusedElementRef.current=focusedElement;},[focusedElement]);React$2.useEffect(()=>{stateRef.current=state;},[state]);const registerItem=React$2.useCallback((element,path2,expanded,selected)=>{setState(s=>({...s,[path2]:{element,expanded}}));if(selected){setFocusedElement(element);}return()=>{setState(s=>{const newState={...s};delete newState[path2];return newState;});};},[]);const setExpanded=React$2.useCallback((path2,expanded)=>{setState(s=>{const itemState=s[path2];if(!itemState)return s;return{...s,[path2]:{...itemState,expanded}};});},[]);const contextValue=React$2.useMemo(()=>({version:0,focusedElement:focusedElement||itemElements[0]||null,level:0,path,registerItem,setExpanded,setFocusedElement,space,state}),[focusedElement,itemElements,path,registerItem,setExpanded,space,state]);const handleKeyDown=React$2.useCallback(event=>{var _a;if(!focusedElementRef.current)return;if(event.key==="ArrowDown"){event.preventDefault();const nextEl=_findNextItemElement(stateRef.current,itemElements,focusedElementRef.current);if(nextEl){_focusItemElement(nextEl);setFocusedElement(nextEl);}return;}if(event.key==="ArrowUp"){event.preventDefault();const prevEl=_findPrevItemElement(stateRef.current,itemElements,focusedElementRef.current);if(prevEl){_focusItemElement(prevEl);setFocusedElement(prevEl);}return;}if(event.key==="ArrowLeft"){event.preventDefault();const itemKey=focusedElementRef.current.getAttribute("data-tree-key");if(!itemKey)return;const itemState=stateRef.current[itemKey];if(!itemState)return;if(itemState.expanded){setState(s=>{const itemState2=s[itemKey];if(!itemState2)return s;return{...s,[itemKey]:{...itemState2,expanded:false}};});}else{const itemPath=itemKey.split("/");itemPath.pop();const parentKey=itemPath.join("/");const parentState=parentKey&&stateRef.current[parentKey];if(parentState){parentState.element.focus();setFocusedElement(parentState.element);}}return;}if(event.key==="ArrowRight"){event.preventDefault();const focusedKey=focusedElementRef.current.getAttribute("data-tree-key");if(!focusedKey)return;if(!((_a=stateRef.current[focusedKey])==null?void 0:_a.expanded)){setState(s=>{const itemState=s[focusedKey];if(!itemState)return s;return{...s,[focusedKey]:{...itemState,expanded:true}};});}return;}},[itemElements]);React$2.useEffect(()=>{if(!forwardedRef.current)return;const _itemElements=Array.from(forwardedRef.current.querySelectorAll('[data-ui="TreeItem"]'));setItemElements(_itemElements);},[children,forwardedRef]);return/* @__PURE__ */jsxRuntime.jsx(TreeContext.Provider,{value:contextValue,children:/* @__PURE__ */jsxRuntime.jsx(Stack,{as:"ul","data-ui":"Tree",...restProps,onKeyDown:handleKeyDown,ref:forwardedRef,role:"tree",space,children})});}));Tree.displayName="Tree";function treeItemRootStyle(){return styled.css(_templateObject86||(_templateObject86=_taggedTemplateLiteral(["\n &[role='none'] > [role='treeitem'] {\n outline: none;\n cursor: default;\n border-radius: 3px;\n\n &:focus {\n position: relative;\n }\n }\n\n &[role='treeitem'] {\n outline: none;\n\n & > div {\n cursor: default;\n border-radius: 3px;\n }\n\n &:focus > div {\n position: relative;\n }\n }\n "])));}function treeItemRootColorStyle(props){const{theme}=props;const $tone="default";const{base,muted,selectable}=theme.sanity.color;const tone=selectable?selectable[$tone]||selectable.default:muted[$tone]||muted.default;return styled.css(_templateObject87||(_templateObject87=_taggedTemplateLiteral(["\n /* <div role=\"none\"><a data-ui=\"TreeItem__box\" role=\"treeitem\" tabIndex=\"0\"></div> */\n &[role='none'] {\n & > [role='treeitem'] {\n ","\n\n background-color: var(--card-bg-color);\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ","\n }\n\n & > [role='treeitem']:focus {\n ","\n }\n }\n }\n\n /* <div role=\"treeitem\" tabIndex=\"0\"><div data-ui=\"TreeItem__box\"></div> */\n &[role='treeitem'] {\n & > [data-ui='TreeItem__box'] {\n ","\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ","\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ","\n }\n }\n }\n "])),_colorVarsStyle(base,tone.enabled),_colorVarsStyle(base,tone.pressed),_colorVarsStyle(base,tone.hovered),_colorVarsStyle(base,tone.selected),_colorVarsStyle(base,tone.enabled),_colorVarsStyle(base,tone.pressed),_colorVarsStyle(base,tone.hovered),_colorVarsStyle(base,tone.selected));}function treeItemBoxStyle(props){const{$level,theme}=props;const{space}=theme.sanity;return styled.css(_templateObject88||(_templateObject88=_taggedTemplateLiteral(["\n padding-left: ",";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])),rem(space[2]*$level));}function useTree(){const tree=React$2.useContext(TreeContext);if(!tree){throw new Error("Tree: missing context value");}return tree;}const TreeGroup=React$2.memo(function TreeGroup2(props){const{children,expanded=false,...restProps}=props;const tree=useTree();return/* @__PURE__ */jsxRuntime.jsx(Stack,{as:"ul","data-ui":"TreeGroup",...restProps,hidden:!expanded,marginTop:tree.space,role:"group",space:tree.space,children});});const Root=React$2.memo(styled__default.default.li(treeItemRootStyle,treeItemRootColorStyle));const TreeItemBox=styled__default.default(Box).attrs({forwardedAs:"a"})(treeItemBoxStyle);const ToggleArrowText=styled__default.default(Text)(_templateObject89||(_templateObject89=_taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));React$2.memo(function TreeItem2(props){const{children,expanded:expandedProp=false,fontSize,href,icon,id:idProp,muted,onClick,padding=3,selected=false,space=2,text,weight,...restProps}=props;const rootRef=React$2.useRef(null);const treeitemRef=React$2.useRef(null);const tree=useTree();const{path,registerItem,setExpanded,setFocusedElement}=tree;const _id=React$2.useId();const id=idProp||_id;const itemPath=React$2.useMemo(()=>path.concat([id||""]),[id,path]);const itemKey=itemPath.join("/");const itemState=tree.state[itemKey];const focused=tree.focusedElement===rootRef.current;const expanded=(itemState==null?void 0:itemState.expanded)===void 0?expandedProp:(itemState==null?void 0:itemState.expanded)||false;const tabIndex=tree.focusedElement&&tree.focusedElement===rootRef.current?0:-1;const contextValue=React$2.useMemo(()=>({...tree,level:tree.level+1,path:itemPath}),[itemPath,tree]);const handleClick=React$2.useCallback(event=>{if(onClick)onClick(event);const target=event.target;if(target instanceof HTMLElement&&(target.getAttribute("data-ui")==="TreeItem__box"||target.closest('[data-ui="TreeItem__box"]'))){event.stopPropagation();setExpanded(itemKey,!expanded);setFocusedElement(rootRef.current);}},[expanded,itemKey,onClick,setExpanded,setFocusedElement]);const handleKeyDown=React$2.useCallback(event=>{if(focused&&event.key==="Enter"){const el=treeitemRef.current||rootRef.current;el==null?void 0:el.click();}},[focused]);React$2.useEffect(()=>{if(!rootRef.current)return;return registerItem(rootRef.current,itemPath.join("/"),expanded,selected);},[expanded,itemPath,registerItem,selected]);const content=/* @__PURE__ */jsxRuntime.jsxs(Flex,{padding,children:[/* @__PURE__ */jsxRuntime.jsxs(Box,{marginRight:space,style:{visibility:icon||children?"visible":"hidden",pointerEvents:"none"},children:[icon&&/* @__PURE__ */jsxRuntime.jsx(Text,{muted,size:fontSize,weight,children:React$2.createElement(icon)}),!icon&&/* @__PURE__ */jsxRuntime.jsx(ToggleArrowText,{muted,size:fontSize,weight,children:/* @__PURE__ */jsxRuntime.jsx(ToggleArrowRightIcon,{style:{transform:expanded?"rotate(90deg)":void 0}})})]}),/* @__PURE__ */jsxRuntime.jsx(Box,{flex:1,children:/* @__PURE__ */jsxRuntime.jsx(Text,{muted,size:fontSize,textOverflow:"ellipsis",weight,children:text})})]});if(href){return/* @__PURE__ */jsxRuntime.jsxs(Root,{"data-selected":selected?"":void 0,"data-tree-id":id,"data-tree-key":itemKey,"data-ui":"TreeItem",...restProps,onClick:handleClick,ref:rootRef,role:"none",children:[/* @__PURE__ */jsxRuntime.jsx(TreeItemBox,{$level:tree.level,"aria-expanded":expanded,"data-ui":"TreeItem__box",href,ref:treeitemRef,role:"treeitem",tabIndex,children:content}),/* @__PURE__ */jsxRuntime.jsx(TreeContext.Provider,{value:contextValue,children:children&&/* @__PURE__ */jsxRuntime.jsx(TreeGroup,{hidden:!expanded,children})})]});}return/* @__PURE__ */jsxRuntime.jsxs(Root,{"data-selected":selected?"":void 0,"data-ui":"TreeItem","data-tree-id":id,"data-tree-key":itemKey,...restProps,"aria-expanded":expanded,onClick:handleClick,onKeyDown:handleKeyDown,ref:rootRef,role:"treeitem",tabIndex,children:[/* @__PURE__ */jsxRuntime.jsx(TreeItemBox,{$level:tree.level,as:"div","data-ui":"TreeItem__box",children:content}),/* @__PURE__ */jsxRuntime.jsx(TreeContext.Provider,{value:contextValue,children:children&&/* @__PURE__ */jsxRuntime.jsx(TreeGroup,{expanded,children})})]});});const createIcon=icon=>{if(reactIsExports$1.isValidElementType(icon))return React$2.createElement(icon);if(React$2.isValidElement(icon))return icon;return void 0;};const MediaCard=styled__default.default(Card)(_templateObject90||(_templateObject90=_taggedTemplateLiteral2(["\n width: 35px;\n height: 35px;\n\n svg {\n width: 100%;\n height: 100%;\n }\n"])));function WorkspacePreview(props){const{icon,title,name,subtitle}=props.workspace;const{setActiveWorkspace}=sanity.useActiveWorkspace();const iconComponent=React$2.useMemo(()=>createIcon(icon),[icon]);return/* @__PURE__ */jsxRuntime.jsx(Card,{shadow:1,radius:2,children:/* @__PURE__ */jsxRuntime.jsxs(Flex,{align:"center",gap:[2,3,4,4],paddingX:[2,3,4,4],children:[/* @__PURE__ */jsxRuntime.jsx(Hotkeys,{keys:[String(props.index+1)],padding:2}),/* @__PURE__ */jsxRuntime.jsx(Box,{flex:1,children:/* @__PURE__ */jsxRuntime.jsx(Stack,{children:/* @__PURE__ */jsxRuntime.jsx(Button,{mode:"bleed",tone:"default",onClick:()=>setActiveWorkspace(name),children:/* @__PURE__ */jsxRuntime.jsxs(Flex,{align:"center",gap:[2,3,4,4],children:[iconComponent?/* @__PURE__ */jsxRuntime.jsx(MediaCard,{children:createIcon(iconComponent)}):null,/* @__PURE__ */jsxRuntime.jsx(Box,{flex:1,children:/* @__PURE__ */jsxRuntime.jsxs(Stack,{space:[1,2,3,3],children:[/* @__PURE__ */jsxRuntime.jsx(Heading,{children:title||name}),subtitle?/* @__PURE__ */jsxRuntime.jsx(Text,{muted:true,children:subtitle}):null]})})]})})})})]})});}function WorkspaceHome(){const[home,...workspaces]=sanity.useWorkspaces();const{setActiveWorkspace}=sanity.useActiveWorkspace();React$2.useEffect(()=>{const handleKeypress=event=>{const index=parseInt(event.key,10)-1;if(index>=0&&index<workspaces.length){setActiveWorkspace(workspaces[index].name);}};window.addEventListener("keypress",handleKeypress);return()=>{window.removeEventListener("keypress",handleKeypress);};},[workspaces,setActiveWorkspace]);return/* @__PURE__ */jsxRuntime.jsx(Card,{tone:"transparent",height:"fill",children:/* @__PURE__ */jsxRuntime.jsx(Flex,{direction:"column",height:"fill",padding:[4,5,6,6],children:/* @__PURE__ */jsxRuntime.jsx(Container,{children:/* @__PURE__ */jsxRuntime.jsxs(Stack,{space:4,children:[/* @__PURE__ */jsxRuntime.jsx(Heading,{children:"Workspaces"}),workspaces.map((workspace,index)=>/* @__PURE__ */jsxRuntime.jsx(WorkspacePreview,{workspace,index},workspace.name))]})})})});}const workspaceHomeTool={title:"Workspace Home",name:"workspace-home",icon:HomeIcon$1,component:WorkspaceHome};const workspaceHome=sanity.definePlugin(()=>{return{name:"sanity-plugin-workspace-home",tools:[workspaceHomeTool]};});const workspaceHomeConfig=_ref3=>{let{projectId="",dataset=""}=_ref3;return{name:"home",title:"Home",basePath:"/home",projectId,dataset,icon:HomeIcon$1,plugins:[workspaceHome()]};};exports.workspaceHome=workspaceHome;exports.workspaceHomeConfig=workspaceHomeConfig;
6160
+ onMouseEnter:handleItemMouseEnter,onMouseLeave:handleItemMouseLeave}),[activeElement,activeIndex,mount,handleItemMouseEnter,handleItemMouseLeave,onClickOutside,onEscape,onItemClick,registerElement]);return/* @__PURE__ */jsxRuntime.jsx(MenuContext.Provider,{value,children:/* @__PURE__ */jsxRuntime.jsx(Root$5,{"data-ui":"Menu",...restProps,onKeyDown:handleKeyDown,padding,ref:handleRefChange,role:"menu",tabIndex:-1,children:/* @__PURE__ */jsxRuntime.jsx(Stack,{space,children})})});});React$2.forwardRef(function MenuButton2(props,ref){const{__unstable_disableRestoreFocusOnClose:disableRestoreFocusOnClose=false,boundaryElement:deprecated_boundaryElement,button:buttonProp,id,menu:menuProp,onClose,placement:deprecated_placement,popoverScheme:deprecated_popoverScheme,portal:deprecated_portal=true,popover,popoverRadius:deprecated_popoverRadius,preventOverflow:deprecated_preventOverflow}=props;const[open,setOpen]=React$2.useState(false);const[shouldFocus,setShouldFocus]=React$2.useState(null);const[buttonElement,setButtonElement]=React$2.useState(null);const[menuElements,setChildMenuElements]=React$2.useState([]);const openRef=React$2.useRef(open);React$2.useEffect(()=>{if(onClose&&!open&&openRef.current){onClose();}},[onClose,open]);React$2.useEffect(()=>{openRef.current=open;},[open]);const handleButtonClick=React$2.useCallback(()=>{setOpen(v=>!v);setShouldFocus(null);},[]);const handleButtonKeyDown=React$2.useCallback(event=>{if(event.key==="ArrowDown"||event.key==="Enter"||event.key===" "){event.preventDefault();setOpen(true);setShouldFocus("first");return;}if(event.key==="ArrowUp"){event.preventDefault();setOpen(true);setShouldFocus("last");return;}},[]);const handleMenuClickOutside=React$2.useCallback(event=>{const target=event.target;if(!(target instanceof Node)){return;}if(buttonElement&&(target===buttonElement||buttonElement.contains(target))){return;}for(const el of menuElements){if(target===el||el.contains(target)){return;}}setOpen(false);},[buttonElement,menuElements]);const handleMenuEscape=React$2.useCallback(()=>{setOpen(false);if(disableRestoreFocusOnClose)return;if(buttonElement)buttonElement.focus();},[buttonElement,disableRestoreFocusOnClose]);const handleBlur=React$2.useCallback(event=>{const target=event.relatedTarget;if(!(target instanceof Node)){return;}for(const el of menuElements){if(el===target||el.contains(target)){return;}}setOpen(false);},[menuElements]);const handleItemClick=React$2.useCallback(()=>{setOpen(false);if(disableRestoreFocusOnClose)return;if(buttonElement)buttonElement.focus();},[buttonElement,disableRestoreFocusOnClose]);const registerElement=React$2.useCallback(el=>{setChildMenuElements(els=>els.concat([el]));return()=>{setChildMenuElements(els=>{return els.filter(_el=>_el!==el);});};},[]);const menuProps=React$2.useMemo(()=>({"aria-labelledby":id,onBlurCapture:handleBlur,onClickOutside:handleMenuClickOutside,onEscape:handleMenuEscape,onItemClick:handleItemClick,originElement:buttonElement,registerElement,shouldFocus}),[buttonElement,handleMenuClickOutside,handleMenuEscape,handleItemClick,id,handleBlur,registerElement,shouldFocus]);const menu=reactIsExports$1.isElement(menuProp)?React$2.cloneElement(menuProp,menuProps):null;const setButtonRef=React$2.useCallback(el=>{if(typeof ref==="function"){ref(el);}else if(ref){ref.current=el;}setButtonElement(el);},[ref]);const button=React$2.useMemo(()=>reactIsExports$1.isElement(buttonProp)?React$2.cloneElement(buttonProp,{"data-ui":"MenuButton",id,onClick:handleButtonClick,onKeyDown:handleButtonKeyDown,"aria-haspopup":true,"aria-expanded":open,ref:setButtonRef,selected:open}):null,[buttonProp,handleButtonClick,handleButtonKeyDown,id,open,setButtonRef]);const popoverProps=React$2.useMemo(()=>({boundaryElement:deprecated_boundaryElement,overflow:"auto",placement:deprecated_placement,portal:deprecated_portal,preventOverflow:deprecated_preventOverflow,radius:deprecated_popoverRadius,scheme:deprecated_popoverScheme,...(popover||{})}),[deprecated_boundaryElement,deprecated_placement,deprecated_popoverRadius,deprecated_popoverScheme,deprecated_portal,deprecated_preventOverflow,popover]);return/* @__PURE__ */jsxRuntime.jsx(Popover,{"data-ui":"MenuButton__popover",...popoverProps,content:menu,open,children:button||/* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment,{})});});styled__default.default.hr(_templateObject75||(_templateObject75=_taggedTemplateLiteral(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));function selectableBaseStyle(){return styled.css(_templateObject76||(_templateObject76=_taggedTemplateLiteral(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));}function selectableColorStyle(props){var _a,_b;const{$tone,theme}=props;const{base,muted,selectable}=theme.sanity.color;const tone=selectable?selectable[$tone]||selectable.default:muted[$tone]||muted.default;return styled.css(_templateObject77||(_templateObject77=_taggedTemplateLiteral(["\n ","\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ","\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ","\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ","\n }\n\n &:active {\n ","\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ","\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ","\n }\n\n &[data-selected] {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ","\n }\n\n &:active {\n ","\n }\n }\n }\n }\n }\n\n ","\n "])),_colorVarsStyle(base,tone.enabled),_colorVarsStyle(base,tone.disabled),_colorVarsStyle(base,tone.pressed),_colorVarsStyle(base,tone.selected),_colorVarsStyle(base,tone.hovered),_colorVarsStyle(base,tone.pressed),_colorVarsStyle(base,tone.disabled),_colorVarsStyle(base,tone.pressed),_colorVarsStyle(base,tone.selected),_colorVarsStyle(base,tone.hovered),_colorVarsStyle(base,tone.pressed),(_b=(_a=theme.sanity.styles)==null?void 0:_a.card)==null?void 0:_b.root);}const Selectable=styled__default.default(Box)(responsiveRadiusStyle,selectableBaseStyle,selectableColorStyle);function useMenu(){const value=React$2.useContext(MenuContext);if(!value){throw new Error("useMenu(): missing context value");}if(!isRecord(value)||value.version!==0){throw new Error("useMenu(): the context value is not compatible");}return value;}React$2.forwardRef(function MenuItem2(props,forwardedRef){const{as="button",children,disabled,fontSize=2,hotkeys,icon,iconRight,onClick,padding=3,paddingX,paddingY,paddingTop,paddingRight,paddingBottom,paddingLeft,pressed,radius=2,selected:selectedProp,space=3,text,tone="default",...restProps}=props;const menu=useMenu();const{activeElement,mount,onItemClick,onItemMouseEnter=menu.onMouseEnter,onItemMouseLeave=menu.onMouseLeave}=menu;const[rootElement,setRootElement]=React$2.useState(null);const active=Boolean(activeElement)&&activeElement===rootElement;React$2.useEffect(()=>mount(rootElement,selectedProp),[mount,rootElement,selectedProp]);const ref=useForwardedRef(forwardedRef);const handleClick=React$2.useCallback(event=>{if(disabled)return;if(onClick)onClick(event);if(onItemClick)onItemClick();},[disabled,onClick,onItemClick]);const paddingProps=React$2.useMemo(()=>({padding,paddingX,paddingY,paddingTop,paddingRight,paddingBottom,paddingLeft}),[padding,paddingX,paddingY,paddingTop,paddingRight,paddingBottom,paddingLeft]);const setRef=React$2.useCallback(el=>{ref.current=el;setRootElement(el);},[ref]);return/* @__PURE__ */jsxRuntime.jsxs(Selectable,{"data-ui":"MenuItem",...restProps,"aria-pressed":as==="button"&&pressed,"data-pressed":as!=="button"&&pressed?"":void 0,"data-selected":active?"":void 0,"data-disabled":disabled?"":void 0,forwardedAs:as,$radius:useArrayProp(radius),$padding:useArrayProp(0),$tone:tone,disabled,onClick:handleClick,onMouseEnter:onItemMouseEnter,onMouseLeave:onItemMouseLeave,ref:setRef,role:"menuitem",tabIndex:-1,type:as==="button"?"button":void 0,children:[(icon||text||iconRight)&&/* @__PURE__ */jsxRuntime.jsx(Box,{as:"span",...paddingProps,children:/* @__PURE__ */jsxRuntime.jsxs(Flex,{as:"span",children:[icon&&/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(icon)&&icon,reactIsExports$1.isValidElementType(icon)&&React$2.createElement(icon)]}),text&&/* @__PURE__ */jsxRuntime.jsx(Box,{flex:1,marginLeft:icon?space:void 0,marginRight:iconRight?space:void 0,children:/* @__PURE__ */jsxRuntime.jsx(Text,{size:fontSize,textOverflow:"ellipsis",children:text})}),hotkeys&&/* @__PURE__ */jsxRuntime.jsx(Box,{marginLeft:space,style:{marginTop:-4,marginBottom:-4},children:/* @__PURE__ */jsxRuntime.jsx(Hotkeys,{fontSize,keys:hotkeys})}),iconRight&&/* @__PURE__ */jsxRuntime.jsxs(Text,{size:fontSize,children:[React$2.isValidElement(iconRight)&&iconRight,reactIsExports$1.isValidElementType(iconRight)&&React$2.createElement(iconRight)]})]})}),children&&/* @__PURE__ */jsxRuntime.jsx(Box,{as:"span",...paddingProps,children})]});});const keyframe=styled.keyframes(_templateObject78||(_templateObject78=_taggedTemplateLiteral(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));const animation=styled.css(_templateObject79||(_templateObject79=_taggedTemplateLiteral(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ",";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])),keyframe);const skeletonStyle=styled.css(_templateObject80||(_templateObject80=_taggedTemplateLiteral(["\n opacity: ",";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ","\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])),_ref24=>{let{$visible}=_ref24;return $visible?1:0;},_ref25=>{let{$animated}=_ref25;return $animated?animation:styled.css(_templateObject81||(_templateObject81=_taggedTemplateLiteral(["\n background-color: var(--card-skeleton-color-from);\n "])));});const Root$4=styled__default.default(Box)(responsiveRadiusStyle,skeletonStyle);const Skeleton=React$2.forwardRef(function Skeleton2(props,ref){const{animated=false,delay,radius,...restProps}=props;const[visible,setVisible]=React$2.useState(delay?false:true);React$2.useEffect(()=>{if(!delay){return setVisible(true);}const timeout=setTimeout(()=>{setVisible(true);},delay);return()=>{clearTimeout(timeout);};},[delay]);return/* @__PURE__ */jsxRuntime.jsx(Root$4,{...restProps,$animated:animated,$radius:useArrayProp(radius),$visible:visible,ref});});const Root$3=styled__default.default(Skeleton)(_ref26=>{let{$size,$style,theme}=_ref26;const{media}=theme.sanity;const font=theme.sanity.fonts[$style];const styles=_responsive(media,$size,sizeIndex=>{const fontSize=font.sizes[sizeIndex];const capHeight=fontSize.lineHeight-fontSize.ascenderHeight-fontSize.descenderHeight;return{height:capHeight};});return styles;});React$2.forwardRef(function TextSkeleton2(props,ref){const{size=2,...restProps}=props;const $size=useArrayProp(size);return/* @__PURE__ */jsxRuntime.jsx(Root$3,{...restProps,$size,ref,$style:"text"});});React$2.forwardRef(function TextSkeleton3(props,ref){const{size=2,...restProps}=props;const $size=useArrayProp(size);return/* @__PURE__ */jsxRuntime.jsx(Root$3,{...restProps,$size,ref,$style:"label"});});React$2.forwardRef(function TextSkeleton4(props,ref){const{size=2,...restProps}=props;const $size=useArrayProp(size);return/* @__PURE__ */jsxRuntime.jsx(Root$3,{...restProps,$size,ref,$style:"heading"});});React$2.forwardRef(function TextSkeleton5(props,ref){const{size=2,...restProps}=props;const $size=useArrayProp(size);return/* @__PURE__ */jsxRuntime.jsx(Root$3,{...restProps,$size,ref,$style:"code"});});React$2.forwardRef(function Tab2(props,forwardedRef){const{icon,id,focused,fontSize,label,onClick,onFocus,padding=2,selected,...restProps}=props;const elementRef=React$2.useRef(null);const focusedRef=React$2.useRef(false);const handleBlur=React$2.useCallback(()=>{focusedRef.current=false;},[]);const handleFocus=React$2.useCallback(event=>{focusedRef.current=true;if(onFocus)onFocus(event);},[onFocus]);const ref=useForwardedRef(forwardedRef);React$2.useEffect(()=>{if(focused&&!focusedRef.current){if(elementRef.current)elementRef.current.focus();focusedRef.current=true;}},[focused]);const setRef=el=>{elementRef.current=el;ref.current=el;};return/* @__PURE__ */jsxRuntime.jsx(Button,{"data-ui":"Tab",...restProps,"aria-selected":selected?"true":"false",fontSize,icon,id,mode:"bleed",onClick,onBlur:handleBlur,onFocus:handleFocus,padding,ref:setRef,role:"tab",selected,tabIndex:selected?0:-1,text:label,type:"button"});});function _isReactElement(node){return Boolean(node);}React$2.forwardRef(function TabList2(props,ref){const{children:childrenProp,...restProps}=props;const[focusedIndex,setFocusedIndex]=React$2.useState(-1);const children=React$2.useMemo(()=>childrenProp.filter(_isReactElement),[childrenProp]);const tabs=children.map((child,childIndex)=>React$2.cloneElement(child,{focused:focusedIndex===childIndex,key:childIndex,onFocus:()=>handleTabFocus(childIndex)}));const numTabs=tabs.length;const handleTabFocus=React$2.useCallback(tabIdx=>{setFocusedIndex(tabIdx);},[]);const handleKeyDown=React$2.useCallback(event=>{if(event.key==="ArrowLeft"){setFocusedIndex(prevIndex=>(prevIndex+numTabs-1)%numTabs);}if(event.key==="ArrowRight"){setFocusedIndex(prevIndex=>(prevIndex+1)%numTabs);}},[numTabs]);return/* @__PURE__ */jsxRuntime.jsx(Inline,{"data-ui":"TabList",...restProps,onKeyDown:handleKeyDown,ref,role:"tablist",children:tabs});});React$2.forwardRef(function TabPanel2(props,ref){const{flex,...restProps}=props;return/* @__PURE__ */jsxRuntime.jsx(Box,{"data-ui":"TabPanel",...restProps,flex,ref,role:"tabpanel",tabIndex:props.tabIndex===void 0?0:props.tabIndex,children:props.children});});styled__default.default(Card)(_templateObject82||(_templateObject82=_taggedTemplateLiteral(["\n pointer-events: all;\n"])));styled__default.default(Flex)(_templateObject83||(_templateObject83=_taggedTemplateLiteral(["\n overflow-x: auto;\n"])));const key$1=Symbol.for("@sanity/ui/context/toast");globalScope[key$1]=globalScope[key$1]||React$2.createContext(null);styled__default.default(Layer)(_templateObject84||(_templateObject84=_taggedTemplateLiteral(["\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n"])));styled__default.default.div(_templateObject85||(_templateObject85=_taggedTemplateLiteral(["\n box-sizing: border-box;\n position: absolute;\n right: 0;\n bottom: 0;\n max-width: 420px;\n width: 100%;\n"])));function _findPrevItemElement(state,itemElements,focusedElement){var _a;const idx=itemElements.indexOf(focusedElement);const els=itemElements.slice(0,idx);const len=els.length;for(let i=len-1;i>=0;i-=1){const itemKey=els[i].getAttribute("data-tree-key");if(!itemKey){continue;}const segments=itemKey.split("/");segments.pop();const p=[];let expanded=true;for(let j=0;j<segments.length;j+=1){p.push(segments[j]);const k=p.join("/");if(!((_a=state[k])==null?void 0:_a.expanded)){expanded=false;break;}}if(expanded){return els[i];}}return null;}function _findNextItemElement(state,itemElements,focusedElement){var _a;const idx=itemElements.indexOf(focusedElement);const els=itemElements.slice(idx);const len=itemElements.length;for(let i=1;i<len;i+=1){if(!els[i]){continue;}const itemKey=els[i].getAttribute("data-tree-key");if(!itemKey){continue;}const segments=itemKey.split("/");segments.pop();const p=[];let expanded=true;for(let j=0;j<segments.length;j+=1){p.push(segments[j]);const k=p.join("/");if(!((_a=state[k])==null?void 0:_a.expanded)){expanded=false;break;}}if(expanded){return els[i];}}return null;}function _focusItemElement(el){if(el.getAttribute("role")==="treeitem"){el.focus();}if(el.getAttribute("role")==="none"){const firstChild=el.firstChild;if(firstChild&&firstChild instanceof HTMLElement){firstChild.focus();}}}const key=Symbol.for("@sanity/ui/context/tree");globalScope[key]=globalScope[key]||React$2.createContext(null);const TreeContext=globalScope[key];const Tree=React$2.memo(React$2.forwardRef(function Tree2(props,ref){const{children,space=1,...restProps}=props;const forwardedRef=useForwardedRef(ref);const[focusedElement,setFocusedElement]=React$2.useState(null);const focusedElementRef=React$2.useRef(focusedElement);const path=React$2.useMemo(()=>[],[]);const[itemElements,setItemElements]=React$2.useState([]);const[state,setState]=React$2.useState({});const stateRef=React$2.useRef(state);React$2.useEffect(()=>{focusedElementRef.current=focusedElement;},[focusedElement]);React$2.useEffect(()=>{stateRef.current=state;},[state]);const registerItem=React$2.useCallback((element,path2,expanded,selected)=>{setState(s=>({...s,[path2]:{element,expanded}}));if(selected){setFocusedElement(element);}return()=>{setState(s=>{const newState={...s};delete newState[path2];return newState;});};},[]);const setExpanded=React$2.useCallback((path2,expanded)=>{setState(s=>{const itemState=s[path2];if(!itemState)return s;return{...s,[path2]:{...itemState,expanded}};});},[]);const contextValue=React$2.useMemo(()=>({version:0,focusedElement:focusedElement||itemElements[0]||null,level:0,path,registerItem,setExpanded,setFocusedElement,space,state}),[focusedElement,itemElements,path,registerItem,setExpanded,space,state]);const handleKeyDown=React$2.useCallback(event=>{var _a;if(!focusedElementRef.current)return;if(event.key==="ArrowDown"){event.preventDefault();const nextEl=_findNextItemElement(stateRef.current,itemElements,focusedElementRef.current);if(nextEl){_focusItemElement(nextEl);setFocusedElement(nextEl);}return;}if(event.key==="ArrowUp"){event.preventDefault();const prevEl=_findPrevItemElement(stateRef.current,itemElements,focusedElementRef.current);if(prevEl){_focusItemElement(prevEl);setFocusedElement(prevEl);}return;}if(event.key==="ArrowLeft"){event.preventDefault();const itemKey=focusedElementRef.current.getAttribute("data-tree-key");if(!itemKey)return;const itemState=stateRef.current[itemKey];if(!itemState)return;if(itemState.expanded){setState(s=>{const itemState2=s[itemKey];if(!itemState2)return s;return{...s,[itemKey]:{...itemState2,expanded:false}};});}else{const itemPath=itemKey.split("/");itemPath.pop();const parentKey=itemPath.join("/");const parentState=parentKey&&stateRef.current[parentKey];if(parentState){parentState.element.focus();setFocusedElement(parentState.element);}}return;}if(event.key==="ArrowRight"){event.preventDefault();const focusedKey=focusedElementRef.current.getAttribute("data-tree-key");if(!focusedKey)return;if(!((_a=stateRef.current[focusedKey])==null?void 0:_a.expanded)){setState(s=>{const itemState=s[focusedKey];if(!itemState)return s;return{...s,[focusedKey]:{...itemState,expanded:true}};});}return;}},[itemElements]);React$2.useEffect(()=>{if(!forwardedRef.current)return;const _itemElements=Array.from(forwardedRef.current.querySelectorAll('[data-ui="TreeItem"]'));setItemElements(_itemElements);},[children,forwardedRef]);return/* @__PURE__ */jsxRuntime.jsx(TreeContext.Provider,{value:contextValue,children:/* @__PURE__ */jsxRuntime.jsx(Stack,{as:"ul","data-ui":"Tree",...restProps,onKeyDown:handleKeyDown,ref:forwardedRef,role:"tree",space,children})});}));Tree.displayName="Tree";function treeItemRootStyle(){return styled.css(_templateObject86||(_templateObject86=_taggedTemplateLiteral(["\n &[role='none'] > [role='treeitem'] {\n outline: none;\n cursor: default;\n border-radius: 3px;\n\n &:focus {\n position: relative;\n }\n }\n\n &[role='treeitem'] {\n outline: none;\n\n & > div {\n cursor: default;\n border-radius: 3px;\n }\n\n &:focus > div {\n position: relative;\n }\n }\n "])));}function treeItemRootColorStyle(props){const{theme}=props;const $tone="default";const{base,muted,selectable}=theme.sanity.color;const tone=selectable?selectable[$tone]||selectable.default:muted[$tone]||muted.default;return styled.css(_templateObject87||(_templateObject87=_taggedTemplateLiteral(["\n /* <div role=\"none\"><a data-ui=\"TreeItem__box\" role=\"treeitem\" tabIndex=\"0\"></div> */\n &[role='none'] {\n & > [role='treeitem'] {\n ","\n\n background-color: var(--card-bg-color);\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ","\n }\n\n & > [role='treeitem']:focus {\n ","\n }\n }\n }\n\n /* <div role=\"treeitem\" tabIndex=\"0\"><div data-ui=\"TreeItem__box\"></div> */\n &[role='treeitem'] {\n & > [data-ui='TreeItem__box'] {\n ","\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ","\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ","\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ","\n }\n }\n }\n "])),_colorVarsStyle(base,tone.enabled),_colorVarsStyle(base,tone.pressed),_colorVarsStyle(base,tone.hovered),_colorVarsStyle(base,tone.selected),_colorVarsStyle(base,tone.enabled),_colorVarsStyle(base,tone.pressed),_colorVarsStyle(base,tone.hovered),_colorVarsStyle(base,tone.selected));}function treeItemBoxStyle(props){const{$level,theme}=props;const{space}=theme.sanity;return styled.css(_templateObject88||(_templateObject88=_taggedTemplateLiteral(["\n padding-left: ",";\n\n &[data-as='a'] {\n text-decoration: none;\n }\n "])),rem(space[2]*$level));}function useTree(){const tree=React$2.useContext(TreeContext);if(!tree){throw new Error("Tree: missing context value");}return tree;}const TreeGroup=React$2.memo(function TreeGroup2(props){const{children,expanded=false,...restProps}=props;const tree=useTree();return/* @__PURE__ */jsxRuntime.jsx(Stack,{as:"ul","data-ui":"TreeGroup",...restProps,hidden:!expanded,marginTop:tree.space,role:"group",space:tree.space,children});});const Root=React$2.memo(styled__default.default.li(treeItemRootStyle,treeItemRootColorStyle));const TreeItemBox=styled__default.default(Box).attrs({forwardedAs:"a"})(treeItemBoxStyle);const ToggleArrowText=styled__default.default(Text)(_templateObject89||(_templateObject89=_taggedTemplateLiteral(["\n & > svg {\n transition: transform 100ms;\n }\n"])));React$2.memo(function TreeItem2(props){const{children,expanded:expandedProp=false,fontSize,href,icon,id:idProp,muted,onClick,padding=3,selected=false,space=2,text,weight,...restProps}=props;const rootRef=React$2.useRef(null);const treeitemRef=React$2.useRef(null);const tree=useTree();const{path,registerItem,setExpanded,setFocusedElement}=tree;const _id=React$2.useId();const id=idProp||_id;const itemPath=React$2.useMemo(()=>path.concat([id||""]),[id,path]);const itemKey=itemPath.join("/");const itemState=tree.state[itemKey];const focused=tree.focusedElement===rootRef.current;const expanded=(itemState==null?void 0:itemState.expanded)===void 0?expandedProp:(itemState==null?void 0:itemState.expanded)||false;const tabIndex=tree.focusedElement&&tree.focusedElement===rootRef.current?0:-1;const contextValue=React$2.useMemo(()=>({...tree,level:tree.level+1,path:itemPath}),[itemPath,tree]);const handleClick=React$2.useCallback(event=>{if(onClick)onClick(event);const target=event.target;if(target instanceof HTMLElement&&(target.getAttribute("data-ui")==="TreeItem__box"||target.closest('[data-ui="TreeItem__box"]'))){event.stopPropagation();setExpanded(itemKey,!expanded);setFocusedElement(rootRef.current);}},[expanded,itemKey,onClick,setExpanded,setFocusedElement]);const handleKeyDown=React$2.useCallback(event=>{if(focused&&event.key==="Enter"){const el=treeitemRef.current||rootRef.current;el==null?void 0:el.click();}},[focused]);React$2.useEffect(()=>{if(!rootRef.current)return;return registerItem(rootRef.current,itemPath.join("/"),expanded,selected);},[expanded,itemPath,registerItem,selected]);const content=/* @__PURE__ */jsxRuntime.jsxs(Flex,{padding,children:[/* @__PURE__ */jsxRuntime.jsxs(Box,{marginRight:space,style:{visibility:icon||children?"visible":"hidden",pointerEvents:"none"},children:[icon&&/* @__PURE__ */jsxRuntime.jsx(Text,{muted,size:fontSize,weight,children:React$2.createElement(icon)}),!icon&&/* @__PURE__ */jsxRuntime.jsx(ToggleArrowText,{muted,size:fontSize,weight,children:/* @__PURE__ */jsxRuntime.jsx(ToggleArrowRightIcon,{style:{transform:expanded?"rotate(90deg)":void 0}})})]}),/* @__PURE__ */jsxRuntime.jsx(Box,{flex:1,children:/* @__PURE__ */jsxRuntime.jsx(Text,{muted,size:fontSize,textOverflow:"ellipsis",weight,children:text})})]});if(href){return/* @__PURE__ */jsxRuntime.jsxs(Root,{"data-selected":selected?"":void 0,"data-tree-id":id,"data-tree-key":itemKey,"data-ui":"TreeItem",...restProps,onClick:handleClick,ref:rootRef,role:"none",children:[/* @__PURE__ */jsxRuntime.jsx(TreeItemBox,{$level:tree.level,"aria-expanded":expanded,"data-ui":"TreeItem__box",href,ref:treeitemRef,role:"treeitem",tabIndex,children:content}),/* @__PURE__ */jsxRuntime.jsx(TreeContext.Provider,{value:contextValue,children:children&&/* @__PURE__ */jsxRuntime.jsx(TreeGroup,{hidden:!expanded,children})})]});}return/* @__PURE__ */jsxRuntime.jsxs(Root,{"data-selected":selected?"":void 0,"data-ui":"TreeItem","data-tree-id":id,"data-tree-key":itemKey,...restProps,"aria-expanded":expanded,onClick:handleClick,onKeyDown:handleKeyDown,ref:rootRef,role:"treeitem",tabIndex,children:[/* @__PURE__ */jsxRuntime.jsx(TreeItemBox,{$level:tree.level,as:"div","data-ui":"TreeItem__box",children:content}),/* @__PURE__ */jsxRuntime.jsx(TreeContext.Provider,{value:contextValue,children:children&&/* @__PURE__ */jsxRuntime.jsx(TreeGroup,{expanded,children})})]});});const createIcon=icon=>{if(reactIsExports$1.isValidElementType(icon))return React$2.createElement(icon);if(React$2.isValidElement(icon))return icon;return void 0;};const MediaCard=styled__default.default(Card)(_templateObject90||(_templateObject90=_taggedTemplateLiteral2(["\n width: 35px;\n height: 35px;\n\n svg {\n width: 100%;\n height: 100%;\n }\n"])));function WorkspacePreview(props){const{workspace,index,query}=props;const{icon,title,name,subtitle,dataset}=workspace;const{setActiveWorkspace}=sanity.useActiveWorkspace();const iconComponent=React$2.useMemo(()=>createIcon(icon),[icon]);const hotKeyIndex=index+1===10?0:index+1;return/* @__PURE__ */jsxRuntime.jsx(Card,{borderTop:Boolean(index),tone:"default",children:/* @__PURE__ */jsxRuntime.jsxs(Grid,{columns:5,gap:[2,3,4,4],paddingY:1,children:[/* @__PURE__ */jsxRuntime.jsx(Card,{columnStart:1,columnEnd:3,children:/* @__PURE__ */jsxRuntime.jsx(Stack,{children:/* @__PURE__ */jsxRuntime.jsx(Button,{mode:"bleed",tone:"default",onClick:()=>setActiveWorkspace(name),children:/* @__PURE__ */jsxRuntime.jsxs(Flex,{align:"center",gap:[2,3,4,4],children:[iconComponent?/* @__PURE__ */jsxRuntime.jsx(MediaCard,{children:createIcon(iconComponent)}):null,/* @__PURE__ */jsxRuntime.jsx(Box,{flex:1,children:/* @__PURE__ */jsxRuntime.jsxs(Stack,{space:[1,2,3,3],children:[/* @__PURE__ */jsxRuntime.jsx(Text,{size:3,weight:"semibold",children:title||name}),subtitle?/* @__PURE__ */jsxRuntime.jsx(Text,{muted:true,children:subtitle}):null]})})]})})})}),/* @__PURE__ */jsxRuntime.jsx(Card,{columnStart:3,columnEnd:5,children:/* @__PURE__ */jsxRuntime.jsxs(Flex,{height:"fill",align:"center",gap:2,children:[/* @__PURE__ */jsxRuntime.jsx(Text,{size:1,weight:"semibold",children:/* @__PURE__ */jsxRuntime.jsx(DatabaseIcon$1,{})}),/* @__PURE__ */jsxRuntime.jsx(Text,{size:1,weight:"semibold",children:dataset})]})}),/* @__PURE__ */jsxRuntime.jsx(Card,{paddingRight:[2,3,3,3],children:/* @__PURE__ */jsxRuntime.jsx(Flex,{height:"fill",align:"center",justify:"flex-end",children:!query&&hotKeyIndex<10?/* @__PURE__ */jsxRuntime.jsx(Hotkeys,{keys:[String(hotKeyIndex)],padding:2}):null})})]})});}function WorkspaceHome(){const[,...workspaces]=sanity.useWorkspaces();const{setActiveWorkspace}=sanity.useActiveWorkspace();const[query,setQuery]=React$2.useState("");const searchInput=React$2.useRef(null);const handleQuery=React$2.useCallback(e=>{setQuery(e.target.value);},[setQuery]);const filteredWorkspaces=React$2.useMemo(()=>{return workspaces.filter(workspace=>{return workspace.name.toLowerCase().includes(query.toLowerCase())||workspace.dataset.toLowerCase().includes(query.toLowerCase())||workspace.title.toLowerCase().includes(query.toLowerCase());});},[workspaces,query]);React$2.useEffect(()=>{const handleKeypress=event=>{if(query||searchInput.current===document.activeElement){return;}const index=parseInt(event.key,10)-1;if(index>=0&&index<workspaces.length){setActiveWorkspace(workspaces[index].name);}};window.addEventListener("keypress",handleKeypress);return()=>{window.removeEventListener("keypress",handleKeypress);};},[query,workspaces,setActiveWorkspace]);return/* @__PURE__ */jsxRuntime.jsx(Card,{tone:"transparent",height:"fill",children:/* @__PURE__ */jsxRuntime.jsx(Flex,{direction:"column",height:"fill",padding:[4,5,6,6],children:/* @__PURE__ */jsxRuntime.jsx(Container,{children:/* @__PURE__ */jsxRuntime.jsxs(Stack,{space:4,children:[/* @__PURE__ */jsxRuntime.jsx(Heading,{children:"Workspaces"}),/* @__PURE__ */jsxRuntime.jsx(Card,{padding:[2,3,4,4],radius:3,shadow:2,children:/* @__PURE__ */jsxRuntime.jsxs(Stack,{space:3,children:[/* @__PURE__ */jsxRuntime.jsxs(Stack,{space:2,children:[/* @__PURE__ */jsxRuntime.jsx(Text,{size:1,weight:"semibold",children:"Search"}),/* @__PURE__ */jsxRuntime.jsx(TextInput,{ref:searchInput,value:query,onChange:handleQuery})]}),/* @__PURE__ */jsxRuntime.jsx(Box,{children:filteredWorkspaces.map((workspace,index)=>/* @__PURE__ */jsxRuntime.jsx(WorkspacePreview,{workspace,index,query},workspace.name))})]})})]})})})});}const workspaceHomeTool={title:"Workspace Home",name:"workspace-home",icon:HomeIcon$1,component:WorkspaceHome};const workspaceHome=sanity.definePlugin(()=>{return{name:"sanity-plugin-workspace-home",tools:[workspaceHomeTool]};});const workspaceHomeConfig=_ref3=>{let{projectId="",dataset=""}=_ref3;return{name:"home",title:"Home",basePath:"/home",projectId,dataset,icon:HomeIcon$1,plugins:[workspaceHome()]};};exports.workspaceHome=workspaceHome;exports.workspaceHomeConfig=workspaceHomeConfig;
6161
6161
  //# sourceMappingURL=index.js.map