PageSourceSearch

https://franshalsmuseum.nl/_next/static/chunks/7b72a6f9.22914d45f130ad8e.js

js franshalsmuseum.nl collected 2026-10-02 04:55:34 UTC 108,979 bytes, 234 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8ada144c-d3e2-4985-a775-e76fe9e09563",e._sentryDebugIdIdentifier="sentry-dbid-8ada144c-d3e2-4985-a775-e76fe9e09563")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6501],{68262:(e,t,a)=>{a.d(t,{$_:()=>a5,yO:()=>a2});var i,s=a(95155),r=a(81323),n=a(96241),l=a(64509),o=a(59452),d=a(12115),c=a(20031),p=a(1213),u=a(43404),h=a(76069),m=a(81093),g=a(66019),f=a(26335),y=a(34030),x=a(40712),b=a(85755),j=a(86238),v=a(47211),w=a(31536),C=a(45037),I=a(32466),k=a(64711),T=a(60732),z=a(42764),E=a(65333),_=a(77133),A=a(91436),$=a(39209),S=a(25828),R=a(70480),L=a(63704),U=a(43279),D=a(47808),O=a(54152),Z=a(79020),q=a(74559),F=a(15374),B=a(45953),M=a(61543),Y=a(51738),N=a(66942),P=a(22544),Q=a(54879),V=a(82122),H=a(64233),W=a(32893),X=a(87813),J=a(83896),K=a(23844),G=a(62666),ee=a(16977),et={},ea=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(function(){if(i)return et;i=1,Object.defineProperty(et,"__esModule",{value:!0});for(var e="u">typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),t={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},a={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:e?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},s={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=1;r<20;r++)s["f"+r]=111+r;function n(e,t,a){!t||"byKey"in t||(a=t,t=null),Array.isArray(e)||(e=[e]);var i=e.map(function(e){return l(e,t)}),s=function(e){return i.some(function(t){return o(t,e)})};return null==a?s:s(a)}function l(e,i){var r=i&&i.byKey,n={},l=(e=e.replace("++","+add")).split("+"),o=l.length;for(var p in t)n[t[p]]=!1;var u=!0,h=!1,m=void 0;try{for(var g,f=l[Symbol.iterator]();!(u=(g=f.next()).done);u=!0){var y=g.value,x=y.endsWith("?")&&y.length>1;x&&(y=y.slice(0,-1));var b=c(y),j=t[b];if(y.length>1&&!j&&!a[y]&&!s[b])throw TypeError('Unknown modifier: "'+y+'"');1!==o&&j||(r?n.key=b:n.which=d(y)),j&&(n[j]=!x||null)}}catch(e){h=!0,m=e}finally{try{!u&&f.return&&f.return()}finally{if(h)throw m}}return n}function o(e,t){for(var a in e){var i=e[a],s=void 0;if(null!=i&&(null!=(s="key"===a&&null!=t.key?t.key.toLowerCase():"which"===a?91===i&&93===t.which?91:t.which:t[a])||!1!==i)&&s!==i)return!1}return!0}function d(e){return s[e=c(e)]||e.toUpperCase().charCodeAt(0)}function c(e){return a[e=e.toLowerCase()]||e}return et.default=n,et.isHotkey=n,et.isCodeHotkey=function(e,t){return n(e,t)},et.isKeyHotkey=function(e,t){return n(e,{byKey:!0},t)},et.parseHotkey=l,et.compareHotkey=o,et.toKeyCode=d,et.toKeyName=c,et}());let ei=(e,t)=>{let a=(0,d.useRef)(!1),i=(0,d.useCallback)(i=>{ea(e,i)&&(a.current=!0,t&&t())},[e,t]),s=(0,d.useCallback)(()=>{a.current=!1},[]);return(0,d.useEffect)(()=>(window.addEventListener("keydown",i),window.addEventListener("keyup",s),()=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",s)}),[i,s]),a},es=(0,d.createContext)(void 0),er=e=>{let{children:t,onSelect:a}=e;return(0,s.jsx)(es.Provider,{value:{onSelect:a},children:t})},en=()=>{let e=(0,d.useContext)(es);if(void 0===e)throw Error("useAssetSourceActions must be used within an AssetSourceDispatchProvider");return e},el=()=>(0,r.tH7)({apiVersion:"2025-10-02"}),eo=(0,c.AH)`
2  ::-webkit-scrollbar {
3    width: 14px;
4  }
5
6  ::-webkit-scrollbar-thumb {
7    border-radius: 10px;
8    border: 4px solid rgba(0, 0, 0, 0);
9    background: var(--card-border-color);
10    background-clip: padding-box;
11
12    &:hover {
13      background: var(--card-muted-fg-color);
14      background-clip: padding-box;
15    }
16  }
17`,ed=(0,c.DU)`
18  .media__custom-scrollbar {
19    ${eo}
20  }
21
22  // @sanity/ui overrides
23
24  // Custom scrollbar on Box (used in Dialogs)
25  div[data-ui="Box"] {
26    ${eo}
27  }
28
29  // Dialog background color
30  div[data-ui="Dialog"] {
31    background-color: rgba(15, 17, 18, 0.9);
32  }
33
34`,ec=p.d4,ep={_createdAt:{asc:"Last created: Oldest first",desc:"Last created: Newest first"},_updatedAt:{asc:"Last updated: Oldest first",desc:"Last updated: Newest first"},mimeType:{asc:"MIME type: A to Z",desc:"MIME type: Z to A"},originalFilename:{asc:"File name: A to Z",desc:"File name: Z to A"},size:{asc:"File size: Smallest first",desc:"File size: Largest first"}},eu=(e,t)=>ep[e][t],eh={type:"divider"},em={altText:{assetTypes:["file","image"],field:"altText",name:"altText",operatorType:"empty",operatorTypes:["empty","notEmpty",null,"includes","doesNotInclude"],title:"Alt text",type:"string",value:""},creditLine:{assetTypes:["file","image"],field:"creditLine",name:"creditLine",operatorType:"empty",operatorTypes:["empty","notEmpty",null,"includes","doesNotInclude"],title:"Credit",type:"string",value:""},description:{assetTypes:["file","image"],field:"description",name:"description",operatorType:"empty",operatorTypes:["empty","notEmpty",null,"includes","doesNotInclude"],title:"Description",type:"string",value:""},fileName:{assetTypes:["file","image"],field:"originalFilename",name:"filename",operatorType:"includes",operatorTypes:["includes","doesNotInclude"],title:"File name",type:"string",value:""},height:{assetTypes:["image"],field:"metadata.dimensions.height",name:"height",operatorType:"greaterThan",operatorTypes:["greaterThan","greaterThanOrEqualTo","lessThan","lessThanOrEqualTo",null,"equalTo"],title:"Height",type:"number",value:400},inCurrentDocument:{assetTypes:["file","image"],name:"inCurrentDocument",operatorType:"is",options:[{name:"true",title:"True",value:(0,D.A)`_id in $documentAssetIds`},{name:"false",title:"False",value:(0,D.A)`!(_id in $documentAssetIds)`}],selectOnly:!0,title:"In use in current document",type:"select",value:"true"},inUse:{assetTypes:["file","image"],name:"inUse",operatorType:"is",options:[{name:"true",title:"True",value:(0,D.A)`count(*[references(^._id)]) > 0`},{name:"false",title:"False",value:(0,D.A)`count(*[references(^._id)]) == 0`}],title:"In use",type:"select",value:"true"},isOpaque:{assetTypes:["image"],field:"metadata.isOpaque",name:"isOpaque",operatorType:"equalTo",options:[{name:"true",title:"True",value:"false"},{name:"false",title:"False",value:"true"}],title:"Has transparency",type:"select",value:"true"},orientation:{assetTypes:["image"],name:"orientation",operatorType:"is",operatorTypes:["is","isNot"],options:[{name:"portrait",title:"Portrait",value:"metadata.dimensions.aspectRatio < 1"},{name:"landscape",title:"Landscape",value:"metadata.dimensions.aspectRatio > 1"},{name:"square",title:"Square",value:"metadata.dimensions.aspectRatio == 1"}],title:"Orientation",type:"select",value:"portrait"},size:{assetTypes:["file","image"],field:"size",modifier:"kb",modifiers:[{name:"kb",title:"KB",fieldModifier:e=>`round(${e} / 1000)`},{name:"mb",title:"MB",fieldModifier:e=>`round(${e} / 1000000)`}],name:"size",operatorType:"greaterThan",operatorTypes:["greaterThan","greaterThanOrEqualTo","lessThan","lessThanOrEqualTo",null,"equalTo"],title:"File size",type:"number",value:0},tag:{assetTypes:["file","image"],field:"opt.media.tags",name:"tag",operatorType:"references",operatorTypes:["references","doesNotReference",null,"empty","notEmpty"],title:"Tags",type:"searchable"},title:{assetTypes:["file","image"],field:"title",name:"title",operatorType:"empty",operatorTypes:["empty","notEmpty",null,"includes","doesNotInclude"],title:"Title",type:"string",value:""},type:{assetTypes:["file","image"],name:"type",operatorType:"is",operatorTypes:["is","isNot"],options:[{name:"image",title:"Image",value:'mimeType match "image*"'},{name:"video",title:"Video",value:'mimeType match "video*"'},{name:"audio",title:"Audio",value:'mimeType match "audio*"'},{name:"pdf",title:"PDF",value:'mimeType == "application/pdf"'}],title:"File type",type:"select",value:"image"},width:{assetTypes:["image"],field:"metadata.dimensions.width",name:"width",operatorType:"greaterThan",operatorTypes:["greaterThan","greaterThanOrEqualTo","lessThan","lessThanOrEqualTo",null,"equalTo"],title:"Width",type:"number",value:400}},eg={doesNotInclude:{fn:(e,t)=>e?`!(${t} match '*${e}*')`:void 0,label:"does not include"},doesNotReference:{fn:(e,t)=>e?`!references('${e}')`:void 0,label:"does not include"},empty:{fn:(e,t)=>`!defined(${t})`,hideInput:!0,label:"is empty"},equalTo:{fn:(e,t)=>e?`${t} == ${e}`:void 0,label:"is equal to"},greaterThan:{fn:(e,t)=>e?`${t} > ${e}`:void 0,label:"is greater than"},greaterThanOrEqualTo:{fn:(e,t)=>e?`${t} >= ${e}`:void 0,label:"is greater than or equal to"},includes:{fn:(e,t)=>e?`${t} match '*${e}*'`:void 0,label:"includes"},is:{fn:(e,t)=>`${e}`,label:"is"},isNot:{fn:(e,t)=>`!(${e})`,label:"is not"},lessThan:{fn:(e,t)=>e?`${t} < ${e}`:void 0,label:"is less than"},lessThanOrEqualTo:{fn:(e,t)=>e?`${t} <= ${e}`:void 0,label:"is less than or equal to"},notEmpty:{fn:(e,t)=>`defined(${t})`,hideInput:!0,label:"is not empty"},references:{fn:(e,t)=>e?`references('${e}')`:void 0,label:"includes"}},ef=["file","image"],ey=[{direction:"desc",field:"_createdAt"},{direction:"asc",field:"_createdAt"},null,{direction:"desc",field:"_updatedAt"},{direction:"asc",field:"_updatedAt"},null,{direction:"asc",field:"originalFilename"},{direction:"desc",field:"originalFilename"},null,{direction:"desc",field:"size"},{direction:"asc",field:"size"}],ex=[em.tag,eh,em.inUse,em.inCurrentDocument,eh,em.title,em.altText,em.creditLine,em.description,eh,em.isOpaque,eh,em.fileName,em.size,em.type,eh,em.orientation,em.width,em.height],eb={SMALL:"3rem 100px auto 1.5rem",LARGE:"3rem 100px auto 5.5rem 5.5rem 3.5rem 8.5rem 4.75rem 2rem"},ej="media.tag",ev=e=>function(t){return(0,y.T)(()=>!!e,t.pipe((0,k.c)(3e3),(0,T.Z)(e=>Math.random()>.5?(0,x.$)({message:"Test error",statusCode:500}):(0,b.of)(e))),t)},ew=({assetTypes:e,searchFacets:t,searchQuery:a})=>{let i=e.map(e=>`sanity.${e}Asset`),s=(0,D.A)`
35    _type in ${JSON.stringify(i)}
35 && !(_id in path("drafts.**"))
36  `,r=t.reduce((e,t)=>{if("number"===t.type){let{field:a,modifier:i,modifiers:s,operatorType:r,value:n}=t,l=eg[r],o=s?.find(e=>e.name===i),d=o?.fieldModifier?o.fieldModifier(a):a,c=l.fn(n,d);c&&e.push(c)}if("searchable"===t.type){let{field:a,operatorType:i,value:s}=t,r=eg[i].fn(s?.value,a);r&&e.push(r)}if("select"===t.type){let{field:a,operatorType:i,options:s,value:r}=t,n=eg[i],l=s?.find(e=>e.name===r)?.value,o=n.fn(l,a);o&&e.push(o)}if("string"===t.type){let{field:a,operatorType:i,value:s}=t,r=eg[i].fn(s,a);r&&e.push(r)}return e},[]);return[s,...a?[(0,D.A)`[_id, altText, assetId, creditLine, description, originalFilename, title, url] match '*${a.trim()}*'`]:[],...r].join(" && ")},eC=(e,t)=>function(a){return a.pipe((0,T.Z)(()=>(0,j.H)(e.fetch((0,D.A)`count(*[_type == "${ej}" && name.current == $name])`,{name:t}))),(0,T.Z)(e=>e>0?(0,x.$)({message:"Tag already exists",statusCode:409}):(0,b.of)(!0)))},eI=e=>e.reduce((e,t)=>{let a=t?.tag;return a&&e.push({label:a?.name?.current,value:a?._id}),e},[]),ek={tagsAddComplete:(0,u.VP)("actions/tagsAddComplete",function({assets:e,tag:t}){return{payload:{assets:e,tag:t}}}),tagsAddError:(0,u.VP)("actions/tagsAddError",function({assets:e,error:t,tag:a}){return{payload:{assets:e,error:t,tag:a}}}),tagsAddRequest:(0,u.VP)("actions/tagsAddRequest",function({assets:e,tag:t}){return{payload:{assets:e,tag:t}}}),tagsRemoveComplete:(0,u.VP)("actions/tagsRemoveComplete",function({assets:e,tag:t}){return{payload:{assets:e,tag:t}}}),tagsRemoveError:(0,u.VP)("actions/tagsRemoveError",function({assets:e,error:t,tag:a}){return{payload:{assets:e,error:t,tag:a}}}),tagsRemoveRequest:(0,u.VP)("actions/tagsRemoveRequest",function({assets:e,tag:t}){return{payload:{assets:e,tag:t}}})},eT={showTagCreate:(0,u.VP)("dialog/showTagCreate"),showTagEdit:(0,u.VP)("dialog/showTagEdit",function({tagId:e}){return{payload:{tagId:e}}})},ez=(0,u.Z0)({name:"tags",initialState:{allIds:[],byIds:{},creating:!1,creatingError:void 0,fetchCount:-1,fetching:!1,fetchingError:void 0,panelVisible:!0},extraReducers:e=>{e.addCase(eT.showTagCreate,e=>{delete e.creatingError}).addCase(eT.showTagEdit,(e,t)=>{let{tagId:a}=t.payload;delete e.byIds[a].error}).addMatcher((0,u.i0)(ek.tagsAddComplete,ek.tagsAddError,ek.tagsRemoveComplete,ek.tagsRemoveError),(e,t)=>{let{tag:a}=t.payload;e.byIds[a._id].updating=!1}).addMatcher((0,u.i0)(ek.tagsAddRequest,ek.tagsRemoveRequest),(e,t)=>{let{tag:a}=t.payload;e.byIds[a._id].updating=!0})},reducers:{createComplete(e,t){let{tag:a}=t.payload;e.creating=!1,e.allIds.includes(a._id)||e.allIds.push(a._id),e.byIds[a._id]={_type:"tag",picked:!1,tag:a,updating:!1}},createError(e,t){e.creating=!1,e.creatingError=t.payload.error},createRequest(e,t){e.creating=!0,delete e.creatingError},deleteComplete(e,t){let{tagId:a}=t.payload,i=e.allIds.indexOf(a);i>=0&&e.allIds.splice(i,1),delete e.byIds[a]},deleteError(e,t){let{error:a,tag:i}=t.payload,s=i?._id;e.byIds[s].error=a,e.byIds[s].updating=!1},deleteRequest(e,t){let a=t.payload?.tag?._id;e.byIds[a].picked=!1,e.byIds[a].updating=!0,Object.keys(e.byIds).forEach(t=>{delete e.byIds[t].error})},fetchComplete(e,t){let{tags:a}=t.payload;a?.forEach(t=>{e.allIds.push(t._id),e.byIds[t._id]={_type:"tag",picked:!1,tag:t,updating:!1}}),e.fetching=!1,e.fetchCount=a.length||0,delete e.fetchingError},fetchError(e,t){let{error:a}=t.payload;e.fetching=!1,e.fetchingError=a},fetchRequest:{reducer:(e,t)=>{e.fetching=!0,delete e.fetchingError},prepare:()=>({payload:{query:(0,D.A)`
37          {
38            "items": *[
39              _type == "${ej}"
40              && !(_id in path("drafts.**"))
41            ] {
42              _createdAt,
43              _updatedAt,
44              _id,
45              _rev,
46              _type,
47              name
48            } | order(name.current asc),
49          }
50        `}})},listenerCreateQueue(e,t){},listenerCreateQueueComplete(e,t){let{tags:a}=t.payload;a?.forEach(t=>{e.byIds[t._id]={_type:"tag",picked:!1,tag:t,updating:!1},e.allIds.includes(t._id)||e.allIds.push(t._id)})},listenerDeleteQueue(e,t){},listenerDeleteQueueComplete(e,t){let{tagIds:a}=t.payload;a?.forEach(t=>{let a=e.allIds.indexOf(t);a>=0&&e.allIds.splice(a,1),delete e.byIds[t]})},listenerUpdateQueue(e,t){},listenerUpdateQueueComplete(e,t){let{tags:a}=t.payload;a?.forEach(t=>{e.byIds[t._id]&&(e.byIds[t._id].tag=t)})},panelVisibleSet(e,t){let{panelVisible:a}=t.payload;e.panelVisible=a},sort(e){e.allIds.sort((t,a)=>{let i=e.byIds[t].tag.name.current,s=e.byIds[a].tag.name.current;return i<s?-1:+(i>s)})},updateComplete(e,t){let{tag:a}=t.payload;e.byIds[a._id].tag=a,e.byIds[a._id].updating=!1},updateError(e,t){let{error:a,tag:i}=t.payload,s=i?._id;e.byIds[s].error=a,e.byIds[s].updating=!1},updateRequest(e,t){let{tag:a}=t.payload;e.byIds[a?._id].updating=!0}}}),eE=e=>e.tags.byIds,e_=(0,h.Mz)([eE,e=>e.tags.allIds],(e,t)=>t.map(t=>e[t])),eA=(0,h.Mz)([eE,(e,t)=>t],(e,t)=>e[t]),e$={...ez.actions};var eS=ez.reducer;let eR=(0,u.Z0)({name:"search",initialState:{facets:[],query:""},reducers:{facetsAdd(e,t){e.facets.push({...t.payload.facet,id:(0,Z.A)()})},facetsClear(e){e.facets=[]},facetsRemoveByName(e,t){e.facets=e.facets.filter(e=>e.name!==t.payload.facetName)}
50,facetsRemoveByTag(e,t){e.facets=e.facets.filter(e=>"tag"!==e.name||"searchable"!==e.type||"references"!==e.operatorType&&"doesNotReference"!==e.operatorType||e.value?.value!==t.payload.tagId)},facetsRemoveById(e,t){e.facets=e.facets.filter(e=>e.id!==t.payload.facetId)},facetsUpdate(e,t){let{modifier:a,name:i,operatorType:s,value:r}=t.payload,n=e.facets.find(e=>e.name===i);n&&("number"===n.type&&a&&(n.modifier=a),s&&(n.operatorType=s),"u">typeof r&&(n.value=r),e.facets=e.facets.filter(e=>e.name!==n.name||e.id===n.id))},facetsUpdateById(e,t){let{modifier:a,id:i,operatorType:s,value:r}=t.payload;e.facets.forEach((t,n)=>{t.id===i&&("number"===t.type&&a&&(t.modifier=a),s&&(t.operatorType=s),"u">typeof r&&(e.facets[n].value=r))})},querySet(e,t){e.query=t.payload?.searchQuery}}}),eL=(0,h.Mz)([e=>e.search.facets,(e,t)=>t],(e,t)=>e.some(e=>"tag"===e.name&&"searchable"===e.type&&("references"===e.operatorType||"doesNotReference"===e.operatorType)&&e.value?.value===t)),eU={...eR.actions};var eD=eR.reducer;let eO={uploadComplete:(0,u.VP)("uploads/uploadComplete",function({asset:e}){return{payload:{asset:e}}})},eZ=ey[0],eq={allIds:[],assetTypes:[],byIds:{},fetchCount:-1,fetching:!1,fetchingError:void 0,lastPicked:void 0,order:{direction:eZ.direction,field:eZ.field,title:eu(eZ.field,eZ.direction)},pageIndex:0,pageSize:100,view:"grid"},eF=(0,u.Z0)({name:"assets",initialState:eq,extraReducers:e=>{e.addCase(eO.uploadComplete,(e,t)=>{let{asset:a}=t.payload;e.byIds[a._id]={_type:"asset",asset:a,picked:!1,updating:!1}}).addCase(ek.tagsAddComplete,(e,t)=>{let{assets:a}=t.payload;a.forEach(t=>{e.byIds[t.asset._id].updating=!1})}).addCase(ek.tagsAddError,(e,t)=>{let{assets:a}=t.payload;a.forEach(t=>{e.byIds[t.asset._id].updating=!1})}).addCase(ek.tagsAddRequest,(e,t)=>{let{assets:a}=t.payload;a.forEach(t=>{e.byIds[t.asset._id].updating=!0})}).addCase(ek.tagsRemoveComplete,(e,t)=>{let{assets:a}=t.payload;a.forEach(t=>{e.byIds[t.asset._id].updating=!1})}).addCase(ek.tagsRemoveError,(e,t)=>{let{assets:a}=t.payload;a.forEach(t=>{e.byIds[t.asset._id].updating=!1})}).addCase(ek.tagsRemoveRequest,(e,t)=>{let{assets:a}=t.payload;a.forEach(t=>{e.byIds[t.asset._id].updating=!0})})},reducers:{clear(e){e.allIds=[]},deleteComplete(e,t){let{assetIds:a}=t.payload;a?.forEach(t=>{let a=e.allIds.indexOf(t);a>=0&&e.allIds.splice(a,1),delete e.byIds[t]}),e.pageIndex=Math.floor(e.allIds.length/e.pageSize)-1},deleteError(e,t){let{assetIds:a,error:i}=t.payload,s=i?.response?.body?.error?.items?.map(e=>e.error);a?.forEach(t=>{e.byIds[t].updating=!1}),s?.forEach(t=>{e.byIds[t.id].error=t.description})},deleteRequest(e,t){let{assets:a}=t.payload;a.forEach(t=>{e.byIds[t?._id].updating=!0}),Object.keys(e.byIds).forEach(t=>{delete e.byIds[t].error})},fetchComplete(e,t){let a=t.payload?.assets||[];a&&a.forEach(t=>{e.allIds.includes(t._id)||e.allIds.push(t._id),e.byIds[t._id]={_type:"asset",asset:t,picked:!1,updating:!1}}),e.fetching=!1,e.fetchCount=a.length||0,delete e.fetchingError},fetchError(e,t){let a=t.payload;e.fetching=!1,e.fetchingError=a},fetchRequest:{reducer:(e,t)=>{e.fetching=!0,delete e.fetchingError},prepare:({params:e={},queryFilter:t,selector:a="",sort:i=(0,D.A)`order(_updatedAt desc)`})=>({payload:{params:e,query:(0,D.A)`
51          {
52            "items": *[${t}] {
53              _id,
54              _type,
55              _createdAt,
56              _updatedAt,
57              altText,
58              creditLine,
59              description,
60              extension,
61              metadata {
62                dimensions,
63                exif,
64                isOpaque,
65              },
66              mimeType,
67              opt {
68                media
69              },
70              originalFilename,
71              size,
72              source {
73                name,
74                id,
75                url,
76              },
77              title,
78              url
79            } ${i||a?"|":""} ${i} ${a},
80          }
81        `}})},insertUploads(e,t){let{results:a}=t.payload;Object.entries(a).forEach(([t,a])=>{a&&!e.allIds.includes(t)&&e.allIds.push(a)})},listenerCreateQueue(e,t){},listenerCreateQueueComplete(e,t){let{assets:a}=t.payload;a?.forEach(t=>{e.byIds[t?._id]?.asset&&(e.byIds[t._id].asset=t)})},listenerDeleteQueue(e,t){},listenerDeleteQueueComplete(e,t){let{assetIds:a}=t.payload;a?.forEach(t=>{let a=e.allIds.indexOf(t);a>=0&&e.allIds.splice(a,1),delete e.byIds[t]})},listenerUpdateQueue(e,t){},listenerUpdateQueueComplete(e,t){let{assets:a}=t.payload;a?.forEach(t=>{e.byIds[t?._id]?.asset&&(e.byIds[t._id].asset=t)})},loadNextPage(){},loadPageIndex(e,t){e.pageIndex=t.payload.pageIndex},orderSet(e,t){e.order=t.payload?.order,e.pageIndex=0},pick(e,t){let{assetId:a,picked:i}=t.payload;e.byIds[a].picked=i,e.lastPicked=i?a:void 0},pickAll(e){e.allIds.forEach(t=>{e.byIds[t].picked=!0})}
81,pickClear(e){e.lastPicked=void 0,Object.values(e.byIds).forEach(t=>{e.byIds[t.asset._id].picked=!1})},pickRange(e,t){let a=e.allIds.findIndex(e=>e===t.payload.startId),i=e.allIds.findIndex(e=>e===t.payload.endId),s=[a,i].sort((e,t)=>e-t);e.allIds.slice(s[0],s[1]+1).forEach(t=>{e.byIds[t].picked=!0}),e.lastPicked=e.allIds[i]},sort(e){e.allIds.sort((t,a)=>{let i=e.byIds[t].asset[e.order.field],s=e.byIds[a].asset[e.order.field];return i<s?"asc"===e.order.direction?-1:1:i>s?"asc"===e.order.direction?1:-1:0})},updateComplete(e,t){let{asset:a}=t.payload;e.byIds[a._id].updating=!1,e.byIds[a._id].asset=a},updateError(e,t){let{asset:a,error:i}=t.payload,s=a?._id;e.byIds[s].error=i.message,e.byIds[s].updating=!1},updateRequest(e,t){let a=t.payload?.asset?._id;e.byIds[a].updating=!0},viewSet(e,t){e.view=t.payload?.view}}}),eB=(0,h.Mz)([e=>e.assets.byIds,(e,t)=>t],(e,t)=>e[t]||void 0),eM=(0,h.Mz)([e=>e.assets.byIds,e=>e.assets.allIds],(e,t)=>t.map(t=>e[t])),eY=(0,h.Mz)([eM],e=>e.length),eN=(0,h.Mz)([eM],e=>e.filter(e=>e?.picked)),eP=(0,h.Mz)([eN],e=>e.length),eQ={...eF.actions};var eV=eF.reducer;let eH=(0,u.Z0)({name:"dialog",initialState:{items:[]},extraReducers:e=>{e.addCase(eT.showTagCreate,e=>{e.items.push({id:"tagCreate",type:"tagCreate"})}),e.addCase(eT.showTagEdit,(e,t)=>{let{tagId:a}=t.payload;e.items.push({id:a,tagId:a,type:"tagEdit"})})},reducers:{clear(e){e.items=[]},inlineTagCreate(e,t){let{assetId:a,tag:i}=t.payload;e.items.forEach(e=>{"assetEdit"===e.type&&e.assetId===a&&(e.lastCreatedTag={label:i.name.current,value:i._id})})},inlineTagRemove(e,t){let{tagIds:a}=t.payload;e.items.forEach(e=>{"assetEdit"===e.type&&(e.lastRemovedTagIds=a)})},remove(e,t){let a=t.payload?.id;e.items=e.items.filter(e=>e.id!==a)},showConfirmAssetsTagAdd(e,t){let{assetsPicked:a,closeDialogId:i,tag:s}=t.payload,r=`${a.length} ${g("asset",a.length)}`;e.items.push({closeDialogId:i,confirmCallbackAction:ek.tagsAddRequest({assets:a,tag:s}),confirmText:`Yes, add tag to ${r}`,title:`Add tag ${s.name.current} to ${r}?`,id:"confirm",headerTitle:"Confirm tag addition",tone:"primary",type:"confirm"})},showConfirmAssetsTagRemove(e,t){let{assetsPicked:a,closeDialogId:i,tag:s}=t.payload,r=`${a.length} ${g("asset",a.length)}`;e.items.push({closeDialogId:i,confirmCallbackAction:ek.tagsRemoveRequest({assets:a,tag:s}),confirmText:`Yes, remove tag from ${r}`,headerTitle:"Confirm tag removal",id:"confirm",title:`Remove tag ${s.name.current} from ${r}?`,tone:"critical",type:"confirm"})},showConfirmDeleteAssets(e,t){let{assets:a,closeDialogId:i}=t.payload,s=`${a.length} ${g("asset",a.length)}`;e.items.push({closeDialogId:i,confirmCallbackAction:eQ.deleteRequest({assets:a.map(e=>e.asset)}),confirmText:`Yes, delete ${s}`,description:"This operation cannot be reversed. Are you sure you want to continue?",title:`Permanently delete ${s}?`,id:"confirm",headerTitle:"Confirm deletion",tone:"critical",type:"confirm"})},showConfirmDeleteTag(e,t){let{closeDialogId:a,tag:i}=t.payload;e.items.push({closeDialogId:a,confirmCallbackAction:e$.deleteRequest({tag:i}),confirmText:"Yes, delete tag",description:"This operation cannot be reversed. Are you sure you want to continue?",title:"Permanently delete tag?",id:"confirm",headerTitle:"Confirm deletion",tone:"critical",type:"confirm"})},showAssetEdit(e,t){let{assetId:a}=t.payload;e.items.push({assetId:a,id:a,type:"assetEdit"})},showSearchFacets(e){e.items.push({id:"searchFacets",type:"searchFacets"})},showTags(e){e.items.push({id:"tags",type:"tags"})}}}),eW={...eH.actions};var eX=eH.reducer;let eJ=()=>{let e=(0,p.wA)(),t=ec(e=>e.assets.view);return(0,s.jsxs)(l.cV,{space:0,style:{whiteSpace:"nowrap"},children:[(0,s.jsx)(l.$n,{fontSize:1,icon:n.jxC,mode:"grid"===t?"default":"ghost",onClick:()=>e(eQ.viewSet({view:"grid"})),style:{borderBottomRightRadius:0,borderTopRightRadius:0}}),(0,s.jsx)(l.$n,{fontSize:1,icon:n.Ss4,mode:"table"===t?"default":"ghost",onClick:()=>e(eQ.viewSet({view:"table"})),style:{borderBottomLeftRadius:0,borderTopLeftRadius:0}})]})};function eK(){let e=(0,l.WP)();return{animate:!0,constrainSize:!0,floatingBoundary:e.element,portal:!0,referenceBoundary:e.element}}let eG=()=>{let e=(0,p.wA)(),t=ec(e=>e.assets.order),a=eK();return(0,s.jsx)(o.IU,{button:(0,s.jsx)(l.$n,{fontSize:1,icon:n.ycB,mode:"bleed",padding:3,text:eu(t.field,t.direction)}),id:"order",menu:(0,s.jsx)(l.W1,{children:ey?.map((a,i)=>{if(a){let r=t.field===a.field&&t.direction===a.direction;return(0,s.jsx)(l.Dr,{disabled:r,fontSize:1,iconRight:r,onClick:()=>e(eQ.orderSet({order:{direction:a.direction,field:a.field}})),padding:2,selected:r,space:4,style:{minWidth:"200px"},text:eu(a.field,a.direction)},i)}return(0,s.jsx)(l.Nj,{},i)})}),popover:a})},e0=e=>{let{loading:t}=e,{animationDuration:a,isFinished:i,progress:r}=(0,q.vf)({animationDuration:300,isAnimating:t});return(0,s.jsx)(l.az,{style:{opacity:+!i,transition:`opacity ${a}ms linear`},children:(0,s.jsx)(l.az,{style:{height:"1px",background:"rgba(255, 255, 255, 0.5)",position:"absolute",left:0,top:0,transition:`width ${a}ms linear`,width:`${100*r}%`}})})},e1={bg:{dark:F.OZ.gray[950].hex,light:F.OZ.gray[50].hex},bg2:{dark:F.OZ.gray[900].hex,light:F.OZ.gray[100].hex},inputEnabledBorder:{dark:l.Qx.color.dark.default.input.default.enabled.border,light:l.Qx.color.light.default.input.default.enabled.border},inputHoveredBorder:{dark:l.Qx.color.dark.default.input.default.hovered.border,light:l.Qx.color.light.default.input.default.hovered.border},mutedHoveredBg:{dark:l.Qx.color.dark.primary.muted.primary.hovered.bg,light:l.Qx.color.light.primary.muted.primary.hovered.bg}
81,mutedHoveredFg:{dark:l.Qx.color.dark.primary.muted.primary.hovered.fg,light:l.Qx.color.light.primary.muted.primary.hovered.fg},mutedSelectedBg:{dark:l.Qx.color.dark.primary.muted.primary.selected.bg,light:l.Qx.color.light.primary.muted.primary.selected.bg},spotBlue:{dark:l.Qx.color.dark.primary.spot.blue,light:l.Qx.color.light.primary.spot.blue}};function e2(e,t){return e1[t]?.[e]}let e3=(0,c.I4)(l.az)(({$scheme:e,theme:t})=>(0,c.AH)`
82    background: ${e2(e,"bg")};
83    border-radius: ${(0,l.D0)(t.sanity.radius[2])};
84  `),e5=e=>{let{children:t,facet:a}=e,i=(0,r.FEk)(),o=(0,p.wA)();return(0,s.jsx)(e3,{padding:[2,2,1],$scheme:i,children:(0,s.jsxs)(l.so,{align:["flex-start","flex-start","center"],direction:["column","column","row"],children:[(0,s.jsx)(l.az,{paddingBottom:[3,3,0],paddingLeft:1,paddingRight:2,paddingTop:[1,1,0],children:(0,s.jsx)(l.JU,{size:0,style:{whiteSpace:"nowrap"},children:a.title})}),(0,s.jsxs)(l.so,{align:"center",children:[t,(0,s.jsx)(l.az,{marginLeft:1,paddingX:2,children:(0,s.jsx)(l.EY,{muted:!0,size:0,children:(0,s.jsx)(n.USm,{onClick:()=>{o(eU.facetsRemoveById({facetId:a.id}))}})})})]})]})})},e4=e=>{let{onValueChange:t,value:a,...i}=e;return(0,s.jsx)(l.ks,{...i,onChange:e=>{let a=e.target.value;(""===a||/^[0-9\b]+$/.test(a))&&t(parseInt(a,10)||"")},value:a??""})},e8=({facet:e})=>
84{let t=(0,p.wA)(),a=eK(),i=e?.modifiers,r=e?.modifier?i?.find(t=>t.name===e?.modifier):i?.[0],d=e.operatorType??"greaterThan";return(0,s.jsxs)(e5,{facet:e,children:[e?.operatorTypes&&(0,s.jsx)(o.IU,{button:(0,s.jsx)(l.$n,{fontSize:1,iconRight:n.wBL,padding:2,text:eg[d].label}),id:"operators",menu:(0,s.jsx)(l.W1,{children:e.operatorTypes.map((a,i)=>a?(0,s.jsx)(l.Dr,{disabled:a===d,fontSize:1,onClick:()=>{t(eU.facetsUpdateById({id:e.id,operatorType:a}))},padding:2,text:eg[a].label},a):(0,s.jsx)(l.Nj,{},i))}),popover:a}),(0,s.jsx)(l.az,{marginX:1,style:{maxWidth:"50px"},children:(0,s.jsx)(e4,{fontSize:1,onValueChange:a=>{t(eU.facetsUpdateById({id:e.id,value:a}))},padding:2,radius:2,width:2,value:e?.value})}),i&&(0,s.jsx)(o.IU,{button:(0,s.jsx)(l.$n,{fontSize:1,iconRight:n.wBL,padding:2,text:r?.title}),id:"modifier",menu:(0,s.jsx)(l.W1,{children:i.map(a=>{let i=a.name===e.modifier;return(0,s.jsx)(l.Dr,{disabled:i,fontSize:1,onClick:()=>{t(eU.facetsUpdateById({id:e.id,modifier:a.name}))},padding:2,text:a.title},a.name)})}),popover:a})]})},e6=({facet:e})=>{let t=(0,p.wA)(),a=eK(),i=e?.options,r=i?.find(t=>t.name===e?.value),d=e?.operatorType??"is";return(0,s.jsxs)(e5,{facet:e,children:[e?.operatorTypes&&(0,s.jsx)(o.IU,{button:(0,s.jsx)(l.az,{marginRight:1,children:(0,s.jsx)(l.$n,{fontSize:1,iconRight:n.wBL,padding:2,text:eg[d].label})}),id:"operators",menu:(0,s.jsx)(l.W1,{children:e.operatorTypes.map((a,i)=>a?(0,s.jsx)(l.Dr,{disabled:a===d,fontSize:1,onClick:()=>{t(eU.facetsUpdate({name:e.name,operatorType:a}))},padding:2,text:eg[a].label},a):(0,s.jsx)(l.Nj,{},i))}),popover:a}),(0,s.jsx)(o.IU,{button:(0,s.jsx)(l.$n,{fontSize:1,iconRight:n.wBL,padding:2,text:r?.title}),id:"list",menu:(0,s.jsx)(l.W1,{children:i?.map((a,n)=>{let o=a.name===r?.name;return(0,s.jsx)(l.Dr,{disabled:o,fontSize:1,onClick:()=>{var a;return a=i[n],void t(eU.facetsUpdate({name:e.name,value:a.name}))},padding:2,text:a.title},a.name)})}),popover:a})]})},e7=({facet:e})=>{let t=(0,p.wA)(),a=eK(),i=e.operatorType;return(0,s.jsxs)(e5,{facet:e,children:[e?.operatorTypes&&(0,s.jsx)(o.IU,{button:(0,s.jsx)(l.$n,{fontSize:1,iconRight:n.wBL,padding:2,text:eg[i].label}),id:"operators",menu:(0,s.jsx)(l.W1,{children:e.operatorTypes.map((a,r)=>a?(0,s.jsx)(l.Dr,{disabled:a===i,fontSize:1,onClick:()=>{t(eU.facetsUpdateById({id:e.id,operatorType:a}))},padding:2,text:eg[a].label},a):(0,s.jsx)(l.Nj,{},r))}),popover:a}),!eg[i].hideInput&&(0,s.jsx)(l.az,{marginLeft:1,style:{maxWidth:"125px"},children:(0,s.jsx)(l.ks,{fontSize:1,onChange:a=>{t(eU.facetsUpdateById({id:e.id,value:a.target.value}))},padding:2,radius:2,width:2,value:e?.value})})]})},{fonts:{text:{sizes:e9}},radius:te,space:tt}=l.Qx,ta=e=>(0,s.jsx)(l.az,{padding:1,children:(0,s.jsx)(B.c.Option,{...e,children:(0,s.jsx)(l.az,{paddingY:1,children:(0,s.jsx)(l.EY,{size:1,style:{color:"inherit"},textOverflow:"ellipsis",children:e.children})})})}),ti={ClearIndicator:e=>(0,s.jsx)(B.c.ClearIndicator,{...e,children:(0,s.jsx)(l.az,{paddingRight:1,style:{transform:"scale(0.85)"},children:(0,s.jsx)(l.EY,{muted:!0,size:0,children:(0,s.jsx)(n.USm,{})})})}),DropdownIndicator:null,IndicatorSeparator:null,Menu:e=>(0,s.jsx)(B.c.Menu,{...e,children:(0,s.jsx)(l.Zp,{radius:1,shadow:2,children:e.children})}),MenuList:e=>{let{children:t}=e;if(Array.isArray(t)){let e=t.length>5?165:33*t.length;return(0,s.jsx)(Y.aY,{className:"media__custom-scrollbar",itemContent:e=>{let a=t[e];return(0,s.jsx)(ta,{...a.props})},style:{height:e},totalCount:t.length})}return(0,s.jsx)(B.c.MenuList,{...e,children:t})},NoOptionsMessage:e=>(0,s.jsx)(B.c.NoOptionsMessage,{...e,children:e.children}),Option:ta,SingleValue:e=>(0,s.jsx)(B.c.SingleValue,{...e,children:(0,s.jsx)(l.EY,{size:1,textOverflow:"ellipsis",children:e.children})})},ts=({facet:e})=>{let t=(0,r.FEk)(),a=(0,p.wA)(),i=ec(e=>e_(e)),d=ec(e=>e.tags.fetching),c=eI(i),u=eK(),h=e.operatorType;return(0,s.jsxs)(e5,{facet:e,children:[e?.operatorTypes&&(0,s.jsx)(o.IU,{button:(0,s.jsx)(l.$n,{fontSize:1,iconRight:n.wBL,padding:2,text:eg[h].label}),id:"operators",menu:(0,s.jsx)(l.W1,{children:e.operatorTypes.map((t,i)=>t?(0,s.jsx)(l.Dr,{disabled:t===h,fontSize:1,onClick:()=>{a(eU.facetsUpdateById({id:e.id,operatorType:t}))},padding:2,space:4,style:{minWidth:"150px"},text:eg[t].label},t):(0,s.jsx)(l.Nj,{},i))}),popover:u}),!eg[h].hideInput&&(0,s.jsx)(l.az,{marginX:1,style:{width:"160px"},children:(0,s.jsx)(M.Ay,{components:ti,instanceId:"facet-searchable",isClearable:!0,isDisabled:d,isSearchable:!0,name:"tags",noOptionsMessage:()=>"No tags",onChange:t=>{a(eU.facetsUpdateById({id:e.id,value:t}))},options:c,placeholder:d?"Loading...":"Select...",styles:(e=>({control:(t,{isDisabled:a,isFocused:i})=>{let s="inset 0 0 0 1px var(--card-border-color)";return i&&(s=`inset 0 0 0 1px ${e2(e,"inputEnabledBorder")},
85        0 0 0 1px ${e2(e,"bg2")},
86        0 0 0 3px var(--card-focus-ring-color) !important`),{...t,backgroundColor:"var(--card-bg-color)",color:"inherit",border:"none",borderRadius:te[2],boxShadow:s,fontSize:e9[1].fontSize,minHeight:"25px",opacity:a?.5:"inherit",outline:"none",transition:"none","&:hover":{boxShadow:`inset 0 0 0 1px ${e2(e,"inputHoveredBorder")}`}}},input:e=>({...e,color:"var(--card-fg-color)",fontFamily:l.Qx.fonts.text.family,fontSize:e9[1].fontSize,marginLeft:(0,l.D0)(tt[2])}),menuList:e=>({...e,padding:0}),noOptionsMessage:e=>({...e,fontFamily:l.Qx.fonts.text.family,fontSize:e9[1].fontSize,lineHeight:"1em"}),option:(t,{isFocused:a})=>({...t,backgroundColor:a?e2(e,"spotBlue"):"transparent",borderRadius:te[2],color:a?e2(e,"bg"):"inherit",fontSize:e9[1].fontSize,lineHeight:"1em",margin:0,padding:(0,l.D0)(tt[1]),"&:hover":{backgroundColor:e2(e,"spotBlue"),color:e2(e,"bg")}}),placeholder:e=>({...e,fontSize:e9[1].fontSize,marginLeft:(0,l.D0)(tt[2]),paddingLeft:0}),singleValue:e=>({...e,alignItems:"center",display:"inline-flex",height:"100%",marginLeft:(0,l.D0)(tt[2])}),valueContainer:e=>({...e,margin:0,padding:0})}))(t),value:e?.value})})]})},tr=(0,c.I4)(l.so)(({theme:e})=>(0,c.AH)`
87    > * {
88      margin-bottom: ${(0,l.D0)(e.sanity.space[2])};
89    }
90  `),tn=e=>{let{layout:t="inline"}=e,a=ec(e=>e.search.facets),i=a.map(e=>{let t=e.id;return"number"===e.type?(0,s.jsx)(e8,{facet:e},t):"searchable"===e.type?(0,s.jsx)(ts,{facet:e},t):"select"===e.type?(0,s.jsx)(e6,{facet:e}
90,t):"string"===e.type?(0,s.jsx)(e7,{facet:e},t):null});if("inline"===t)return 0===a.length?null:(0,s.jsx)(l.az,{marginBottom:2,children:(0,s.jsx)(l.cV,{space:2,children:i})});if("stack"===t)return(0,s.jsx)(tr,{align:"flex-start",direction:"column",children:i});throw Error("Invalid layout")},tl=(0,d.createContext)(null),to=({options:e,children:t})=>{let a=(0,d.useMemo)(()=>{let t;return e?.creditLine?.excludeSources&&(t=Array.isArray(e?.creditLine?.excludeSources)?e.creditLine.excludeSources:[e?.creditLine?.excludeSources]),{dropzone:{maxSize:e?.maximumUploadSize},components:{details:e?.components?.details},createTagsOnUpload:e?.createTagsOnUpload??!0,creditLine:{enabled:e?.creditLine?.enabled||!1,excludeSources:t},directUploads:e?.directUploads??!0,locales:e?.locales}},[e?.creditLine?.enabled,e?.components,e?.createTagsOnUpload,e?.creditLine?.excludeSources,e?.maximumUploadSize,e?.directUploads,e?.locales]);return(0,s.jsx)(tl.Provider,{value:a,children:t})},td=()=>{let e=(0,d.useContext)(tl);if(!e)throw Error("useToolOptions must be used within an ToolOptionsProvider");return e},tc=()=>{let e=(0,p.wA)(),t=ec(e=>e.assets.assetTypes),a=ec(e=>e.search.facets),i=ec(e=>e.selected.document),r=eK(),{creditLine:d}=td(),c=!i,u=ex.filter(e=>(!!d?.enabled||e?.type!=="string"||e?.name!=="creditLine")&&("group"===e.type||"divider"===e.type||(c?!e?.selectOnly:e.assetTypes.filter(e=>t.includes(e)).length>0))).filter((e,t,a)=>{let i=a[t-1];return("divider"!==e.type||0!==t&&t!==a.length-1)&&("divider"!==e.type||i?.type!=="divider")}),h=u.length>0,m=(t,i=0)=>(0,s.jsx)(s.Fragment,{children:t?.map((t,r)=>{if("divider"===t.type)return(0,s.jsx)(l.Nj,{},r);if("group"===t.type)return(0,s.jsx)(l.rX,{text:t.title,title:t.title,children:m(t.facets,i+1)},`group-${i}-${r}`);if(t){let i=!t.operatorTypes&&!!a.find(e=>e.name===t.name);return(0,s.jsx)(l.Dr,{disabled:i,fontSize:1,onClick:()=>e(eU.facetsAdd({facet:t})),padding:2,text:t.title},t.name)}return null})});return(0,s.jsxs)(l.so,{children:[(0,s.jsx)(o.IU,{button:(0,s.jsx)(l.$n,{disabled:!h,fontSize:1,icon:n.REV,mode:"bleed",space:2,text:"Add filter",tone:"primary"}),id:"facets",menu:(0,s.jsx)(l.W1,{children:m(u)}),popover:{...r,placement:"right-start"}}),a.length>0&&(0,s.jsx)(l.$n,{fontSize:1,mode:"bleed",onClick:()=>e(eU.facetsClear()),text:"Clear"})]})},tp=()=>(0,s.jsxs)("svg",{"data-sanity-icon":"media__tag",fill:"currentColor",height:"1em",stroke:"currentColor",strokeWidth:"0",viewBox:"0 0 512 512",width:"1em",children:[(0,s.jsx)("path",{d:"M435.25 48h-122.9a14.46 14.46 0 00-10.2 4.2L56.45 297.9a28.85 28.85 0 000 40.7l117 117a28.85 28.85 0 0040.7 0L459.75 210a14.46 14.46 0 004.2-10.2v-123a28.66 28.66 0 00-28.7-28.8z",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32"}),(0,s.jsx)("path",{d:"M384 160a32 32 0 1132-32 32 32 0 01-32 32z"})]}),tu=()=>{let e=ec(e=>e.search.query),t=(0,p.wA)();return(0,s.jsxs)(l.az,{style:{position:"relative"},children:[(0,s.jsx)(l.ks,{fontSize:1,icon:n.WIv,onChange:e=>{t(eU.querySet({searchQuery:e.currentTarget.value}))},placeholder:"Search",radius:2,value:e}),e.length>0&&(0,s.jsx)(l.so,{align:"center",justify:"center",onClick:()=>{t(eU.querySet({searchQuery:""}))},style:{cursor:"pointer",height:"100%",opacity:.75,position:"absolute",right:0,top:0,width:"2em",zIndex:1},children:(0,s.jsx)(n.USm,{})})]})},th=()=>{let e=(0,p.wA)(),t=ec(e=>e.assets.fetching),a=ec(e=>e.assets.pageIndex),i=ec(e=>e.search.facets),r=ec(e=>e.tags.panelVisible),n=(0,l.aY)();return(0,s.jsxs)(l.az,{paddingY:2,style:{borderBottom:"1px solid var(--card-border-color)",zIndex:2},children:[(0,s.jsx)(l.az,{marginBottom:2,children:(0,s.jsx)(l.so,{align:"flex-start",direction:["column","column","column","column","row"],justify:"space-between",children:(0,s.jsxs)(l.so,{flex:1,style:{alignItems:"flex-start",flex:1,height:"100%",justifyContent:n<2?"space-between":"flex-start",position:"relative",width:"100%"},children:[(0,s.jsx)(l.az,{marginX:2,style:{minWidth:"200px"},children:(0,s.jsx)(tu,{})}),(0,s.jsxs)(l.az,{display:["none","none","block"],children:[(0,s.jsx)(tn,{}),(0,s.jsx)(tc,{})]}),(0,s.jsx)(l.az,{display:["block","block","none"],marginX:2,children:(0,s.jsxs)(l.cV,{space:2,style:{whiteSpace:"nowrap"},children:[(0,s.jsx)(l.$n,{fontSize:1,mode:"ghost",onClick:()=>{e(eW.showSearchFacets())},text:`Filters${i.length>0?` (${i.length})`:""}`,tone:"primary"}),(0,s.jsx)(l.$n,{fontSize:1,mode:"ghost",onClick:()=>{e(eW.showTags())},text:"Tags",tone:"primary"})]})})]})})}),(0,s.jsx)(l.az,{children:(0,s.jsxs)(l.so,{align:"center",justify:["space-between"],children:[(0,s.jsx)(l.az,{marginX:2,children:(0,s.jsx)(eJ,{})}),(0,s.jsxs)(l.so,{marginX:2,children:[(0,s.jsx)(eG,{}),(0,s.jsx)(l.az,{display:["none","none","block"],marginLeft:2,children:(0,s.jsx)(l.$n,{fontSize:1,icon:(0,s.jsx)(l.az,{style:{transform:"scale(0.75)"},children:(0,s.jsx)(tp,{})}),onClick:()=>{e(e$.panelVisibleSet({panelVisible:!r}))},mode:r?"default":"ghost",text:r?"Tags":""})})]})]})}),(0,s.jsx)(e0,{loading:t},a)]})},tm=(0,u.Z0)({name:"debug",initialState:{badConnection:!1,enabled:!1},reducers:{setBadConnection(e,t){e.badConnection=t.payload},toggleEnabled(e){e.enabled=!e.enabled}}}),tg={...tm.actions};var tf=tm.reducer;let ty=()=>{let e=(0,p.wA)(),t=ec(e=>e.debug.badConnection),a=ec(e=>e.debug.enabled);return ei("alt+ctrl+shift+/",()=>{e(tg.toggleEnabled())}),a?(0,s.jsx)(l.az,{padding:4,style:{bottom:0,left:0,pointerEvents:"none",position:"fixed",width:"100%"},children:(0,s.jsxs)(l.so,{align:"center",children:[(0,s.jsx)(l.az,{marginRight:3,children:(0,s.jsx)(l.EY,{muted:!0,size:1,children:(0,s.jsx)(n.gP2,{})})}),(0,s.jsx)(l.m_,{animate:!0,content:(0,s.jsx)(l.az,{padding:2,children:(0,s.jsx)(l.EY,{muted:!0,size:1,children:t?"Bad connection: +3000ms & 50% chance to fail":"No connection throttling"})}),fallbackPlacements:["right","left"],placement:"bottom",portal:!0,children:(0,s.jsx)(l.dO,{checked:t,onChange:t=>{let a=t.target.checked;e(tg.setBadConnection(a))},style:{pointerEvents:"auto"}})})]})}):null};function tx(e){if(!e||0===e.length)return Q.Yj().trim().optional();let t={};for(let a of e)t[a.id]=Q.Yj().trim().optional();return Q.Ik(t).passthrough()}let tb=Q.Ik({label:Q.Yj().trim().min(1,{message:"Label cannot be empty"}),value:Q.Yj().trim().min(1,{message:"Value cannot be empty"})});function tj(e){return Q.Ik({altText:tx(e),creditLine:tx(e),description:tx(e),opt:Q.Ik({media:Q.Ik({tags:Q.YO(tb).nullable()})}),originalFilename:Q.Yj().trim().min(1,{message:"Filename cannot be empty"}),title:tx(e)})}tj();let tv=Q.Ik({name:Q.Yj().min(1,{message:"Name cannot be empty"})});function tw(e){let t=e.reduce((e,t)=>
90t._id.startsWith("drafts.")?e.concat(t._id.slice(7)):e,[]);return e.filter(e=>!t.includes(e._id))}let tC=(e,t)=>{let a=typeof window>"u"||!window.devicePixelRatio?1:Math.round(window.devicePixelRatio),i=t?.height?t?.height*Math.max(1,a):void 0,s=t.width*Math.max(1,a),r=new URLSearchParams;return r.append("fit","max"),r.append("w",s.toString()),i&&r.append("h",i.toString()),`${e.url}?${r.toString()}`},tI=e=>Object.keys(e).reduce((t,a)=>{let i=e[a];return"object"==typeof i&&null!==i&&i.constructor!==Array?t[a]=tI(i):""===i||typeof i>"u"||i?.length===0?t[a]=null:"string"==typeof i&&i?t[a]=e[a].trim():t[a]=e[a],t},{}),tk=e=>`${e.metadata.dimensions.width}x${e.metadata.dimensions.height}px`,tT=({disabled:e,url:t})=>{let a=eK(),i=(0,d.useRef)(null),[r,o]=(0,d.useState)(!1);return(0,d.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]),(0,s.jsx)(l.AM,{content:(0,s.jsx)(l.EY,{muted:!0,size:1,children:"Copied!"}),open:r,padding:2,placement:"top",radius:1,...a,children:(0,s.jsx)(l.$n,{disabled:e,fontSize:1,icon:n.uiJ,mode:"ghost",onClick:()=>{i.current&&clearTimeout(i.current),o(!0),X(t),i.current=setTimeout(()=>{o(!1)},1250)},text:"Copy URL"})})},tz=({label:e,value:t})=>(0,s.jsxs)(l.so,{justify:"space-between",children:[(0,s.jsx)(l.EY,{size:1,style:{opacity:.8,width:"40%"},textOverflow:"ellipsis",children:e}),(0,s.jsx)(l.EY,{size:1,style:{opacity:.4,textAlign:"right",width:"60%"},textOverflow:"ellipsis",children:t})]}),tE=e=>{let{asset:t,item:a}=e,i=t?.metadata?.exif;return(0,s.jsxs)(l.az,{marginTop:3,children:[(0,s.jsx)(l.az,{children:(0,s.jsxs)(l.BJ,{space:3,children:[(0,s.jsx)(tz,{label:"Size",value:W(t?.size,{base:10,round:0})}),(0,s.jsx)(tz,{label:"MIME type",value:t?.mimeType}),(0,s.jsx)(tz,{label:"Extension",value:(t?.extension).toUpperCase()}),"sanity.imageAsset"===t._type&&(0,s.jsx)(tz,{label:"Dimensions",value:tk(t)})]})}),i&&(i.DateTimeOriginal||i.FNumber||i.FocalLength||i.ExposureTime||i.ISO)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.az,{marginY:4,style:{background:"var(--card-border-color)",height:"1px",width:"100%"}}),(0,s.jsx)(l.az,{children:(0,s.jsxs)(l.BJ,{space:3,children:[i.ISO&&(0,s.jsx)(tz,{label:"ISO",value:i.ISO}),i.FNumber&&(0,s.jsx)(tz,{label:"Aperture",value:`\u0192/${i.FNumber}`}),i.FocalLength&&(0,s.jsx)(tz,{label:"Focal length",value:`${i.FocalLength}mm`}),i.ExposureTime&&(0,s.jsx)(tz,{label:"Exposure time",value:`1/${1/i.ExposureTime}`}),i.DateTimeOriginal&&(0,s.jsx)(tz,{label:"Original date",value:(0,V.GP)(new Date(i.DateTimeOriginal),"PPp")})]})})]}),(0,s.jsx)(l.az,{marginTop:5,children:(0,s.jsxs)(l.cV,{space:2,children:[(0,s.jsx)(l.$n,{disabled:!a||a?.updating,fontSize:1,icon:n.s3U,mode:"ghost",onClick:()=>{window.location.href=`${t.url}?dl=${t.originalFilename}`},text:"Download"}),(0,s.jsx)(tT,{disabled:!a||a?.updating,url:t.url})]})})]})},t_=e=>(0,s.jsx)(o.lG,{...e,style:{position:"fixed"}}),tA=({documents:e,isLoading:t})=>{let a=(0,r.I07)();return t?(0,s.jsx)(l.EY,{muted:!0,size:1,children:"Loading..."}):0===e.length?(0,s.jsx)(l.EY,{muted:!0,size:1,children:"No documents are referencing this asset"}):(0,s.jsx)(l.Zp,{flex:1,marginBottom:2,padding:2,radius:2,shadow:1,children:(0,s.jsx)(l.BJ,{space:2,children:e?.map(e=>(0,s.jsx)(t$,{doc:e,schemaType:a.get(e._type)},e._id))})})},t$=e=>{let{doc:t,schemaType:a}=e,{onClick:i}=(0,J.cQ)({intent:"edit",params:{id:t._id}});return a?(0,s.jsx)(l.$n,{mode:"bleed",onClick:i,padding:2,style:{width:"100%"},children:(0,s.jsx)(r.lNE,{layout:"default",schemaType:a,value:t})},t._id):(0,s.jsx)(l.az,{padding:2,children:(0,s.jsxs)(l.EY,{size:1,children:["A document of the unknown type ",(0,s.jsx)("em",{children:t._type})]})})},tS=(0,c.I4)(l.az)(({theme:e})=>(0,c.AH)`
91    text {
92      font-family: ${e.sanity.fonts.text.family} !important;
93      font-size: 8px !important;
94      font-weight: 500 !important;
95    }
96  `),tR=e=>{let{extension:t,onClick:a,width:i}=e;return(0,s.jsx)(l.so,{align:"center",justify:"center",onClick:a,style:{height:"100%"},children:(0,s.jsx)(tS,{style:{width:i},children:t?(0,s.jsx)(K.o,{extension:t,...K.k[t]}):(0,s.jsx)(K.o,{})})})},tL=e=>{let{asset:t}=e;return 0===t.mimeType.search("audio")?(0,s.jsx)(l.so,{align:"center",justify:"center",style:{height:"100%"},children:(0,s.jsx)("audio",{controls:!0,src:t.url,style:{width:"100%"}})}):0===t.mimeType.search("video")?(0,s.jsx)("video",{controls:!0,src:t.url,style:{height:"100%",width:"100%"}}):(0,s.jsx)(tR,{extension:t.extension,width:"50%"})},tU=e=>{let t,{disabled:a,isValid:i,lastUpdated:r,onClick:n}=e;return t=i?r?(0,s.jsxs)(s.Fragment,{children:["Last updated",(0,s.jsx)("br",{})," ",(0,V.GP)(new Date(r),"PPp")]}):"No unpublished changes":"There are validation errors that need to be fixed before this document can be published",(0,s.jsx)(l.m_,{animate:!0,content:(0,s.jsx)(l.az,{padding:3,style:{maxWidth:"185px"},children:(0,s.jsx)(l.EY,{muted:!0,size:1,children:t})}),disabled:"ontouchstart"in window,placement:"top",portal:!0,children:(0,s.jsx)(l.az,{children:(0,s.jsx)(l.$n,{disabled:a,fontSize:1,onClick:n,text:"Save and close",tone
96:"primary"})})})},tD=c.I4.img`
97  --checkerboard-color: ${e=>e.$scheme?e2(e.$scheme,"bg2"):"inherit"};
98
99  display: block;
100  width: 100%;
101  height: 100%;
102  object-fit: contain;
103
104  ${e=>e.$showCheckerboard&&(0,c.AH)`
105      background-image: linear-gradient(45deg, var(--checkerboard-color) 25%, transparent 25%),
106        linear-gradient(-45deg, var(--checkerboard-color) 25%, transparent 25%),
107        linear-gradient(45deg, transparent 75%, var(--checkerboard-color) 75%),
108        linear-gradient(-45deg, transparent 75%, var(--checkerboard-color) 75%);
109      background-size: 20px 20px;
110      background-position: 0 0, 0 10px, 10px -10px, -10px 0;
111    `}
112`,{radius:tO,space:tZ}=l.Qx,tq=e=>(0,s.jsx)(l.az,{paddingX:1,paddingY:1,children:(0,s.jsx)(B.c.Option,{...e,children:(0,s.jsxs)(l.so,{align:"center",children:[e.data.__isNew__&&(0,s.jsx)(n.REV,{style:{marginRight:"3px"}}),e.children]})})}),tF={DropdownIndicator:e=>(0,s.jsx)(B.c.DropdownIndicator,{...e,children:(0,s.jsx)(l.az,{paddingX:2,children:(0,s.jsx)(l.EY,{size:1,children:(0,s.jsx)(n.D3D,{})})})}),IndicatorSeparator:null,Menu:e=>(0,s.jsx)(B.c.Menu,{...e,children:(0,s.jsx)(l.Zp,{radius:1,shadow:2,children:e.children})}),MenuList:e=>{let{children:t}=e;if(Array.isArray(t)){let e=t.length>5?185:37*t.length;return(0,s.jsx)(Y.aY,{className:"media__custom-scrollbar",itemContent:e=>{let a=t[e];return(0,s.jsx)(tq,{...a.props})},style:{height:e},totalCount:t.length})}return(0,s.jsx)(B.c.MenuList,{...e,children:t})},MultiValueLabel:e=>(0,s.jsx)(l.az,{padding:2,paddingRight:1,children:(0,s.jsx)(l.EY,{size:1,weight:"medium",children:(0,s.jsx)(B.c.MultiValueLabel,{...e})})}),MultiValueRemove:e=>(0,s.jsx)(B.c.MultiValueRemove,{...e,children:(0,s.jsx)(n.USm,{color:"#1f2123"})}),Option:tq},tB=(0,c.I4)(n.YZv)(({theme:e})=>({color:e.sanity.color.spot.red})),tM=e=>{let{description:t,error:a,label:i,name:r}=e;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.az,{marginY:3,children:(0,s.jsxs)(l.cV,{space:2,children:[(0,s.jsx)(l.EY,{as:"label",htmlFor:r,size:1,weight:"semibold",children:i}),a&&(0,s.jsx)(l.EY,{size:1,children:(0,s.jsx)(l.m_,{animate:!0,content:(0,s.jsx)(l.az,{padding:2,children:(0,s.jsxs)(l.EY,{muted:!0,size:1,children:[(0,s.jsx)(tB,{style:{marginRight:"0.1em"}}),a]})}),fallbackPlacements:["top","left"],placement:"right",portal:!0,children:(0,s.jsx)(tB,{})})})]})}),t&&(0,s.jsx)(l.az,{marginY:3,children:(0,s.jsx)(l.EY,{htmlFor:r,muted:!0,size:1,children:t})})]})},tY=e=>{let{control:t,description:a,disabled:i,error:n,label:o,name:d,onCreateTag:c,options:p,placeholder:u,value:h}=e,m=(0,r.FEk)(),g=ec(e=>e.tags.creating),f=ec(e=>e.tags.fetching);return(0,s.jsxs)(l.az,{style:{zIndex:2},children:[(0,s.jsx)(tM,{description:a,error:n,label:o,name:d}),(0,s.jsx)(P.xI,{control:t,defaultValue:h,name:d,render:({field:e})=>{let{onBlur:t,onChange:a,value:r}=e;return(0,s.jsx)(G.A,{components:tF,instanceId:"tags",isClearable:!1,isDisabled:g||i||f,isLoading:g,isMulti:!0,name:d,noOptionsMessage:()=>"No tags",onBlur:t,onChange:a,onCreateOption:c,options:p,placeholder:f?"Loading...":u,styles:(e=>({control:(t,{isFocused:a})=>{let i="inset 0 0 0 1px var(--card-border-color)";return a&&(i=`inset 0 0 0 1px ${e2(e,"inputEnabledBorder")},
113        0 0 0 1px var(--card-bg-color),
114        0 0 0 3px var(--card-focus-ring-color) !important`),{...t,backgroundColor:"var(--card-bg-color)",color:"inherit",border:"none",borderRadius:tO[1],boxShadow:i,margin:0,minHeight:"35px",outline:"none",padding:(0,l.D0)(tZ[1]),transition:"none","&:hover":{boxShadow:`inset 0 0 0 1px ${e2(e,"inputHoveredBorder")}`}}},indicatorsContainer:(e,{isDisabled:t})=>({...e,opacity:t?.25:1}),input:e=>({...e,color:"var(--card-fg-color)",fontFamily:l.Qx.fonts.text.family,marginLeft:(0,l.D0)(tZ[2])}),menuList:e=>({...e}),multiValue:(t,{isDisabled:a})=>({...t,backgroundColor:e2(e,"mutedHoveredBg"),borderRadius:tO[2],opacity:a?.5:1}),multiValueLabel:()=>({color:e2(e,"mutedHoveredFg"),fontSize:"inherit",padding:0}),multiValueRemove:t=>({...t,borderTopLeftRadius:0,borderBottomLeftRadius:0,svg:{color:e2(e,"mutedHoveredFg")},"&:hover":{backgroundColor:e2(e,"mutedSelectedBg")}}),noOptionsMessage:e=>({...e,fontFamily:l.Qx.fonts.text.family,lineHeight:"1em"}),option:(t,{isFocused:a})=>({...t,backgroundColor:a?e2(e,"spotBlue"):"transparent",borderRadius:tO[2],color:a?e2(e,"bg"):"inherit",padding:`${(0,l.D0)(tZ[1])} ${(0,l.D0)(tZ[2])}`,"&:hover":{backgroundColor:e2(e,"spotBlue"),color:e2(e,"bg")}}),placeholder:e=>({...e,marginLeft:(0,l.D0)(tZ[2])}),valueContainer:e=>({...e,margin:0,padding:0})}))(m),value:r})}})]})},tN=(0,d.forwardRef)((e,t)=>{let{description:a,disabled:i,error:r,label:n,name:o,placeholder:d,value:c,...p}=e;return(0,s.jsxs)(l.az,{children:[(0,s.jsx)(tM,{description:a,error:r,label:n,name:o}),(0,s.jsx)(l.ks,{...p,autoComplete:"off",autoFocus:!0,defaultValue:c,disabled:i,id:o,name:o,placeholder:d,ref:t})]})}),tP=(0,d.forwardRef)((e,t)=>{let{description:a,disabled:i,error:r,label:n,name:o,placeholder:d,rows:c,value:p,...u}=e;return(0,s.jsxs)(l.az,{children:[(0,s.jsx)(tM,{description:a,error:r,label:n,name:o}),(0,s.jsx)(l.fs,{...u,autoComplete:"off",defaultValue:p,disabled:i,id:o,name:o,placeholder:d,ref:t,rows:c})]})});function tQ(e){return"string"==typeof e?e:"object"==typeof e&&null!==e&&Object.values(e).find(e=>e)||void 0}function tV({formUpdating:e,handleCreateTag:t,control:a,errors:i,register:r,allTagOptions:n,assetTagOptions:c,currentAsset:p,creditLine:u,locales:h}){let m=h&&h.length>0,[g,f]=(0,d.useState)(0);return(0,s.jsxs)(l.BJ,{space:3,children:[(0,s.jsx)(tY,{control:a,disabled:e,error:i?.opt?.media?.tags?.message,label:"Tags",name:"opt.media.tags",onCreateTag:t,options:n,placeholder:"Select or create...",value:c}),(0,s.jsx)(tN,{...r("originalFilename"),disabled:e,error:i?.originalFilename?.message,label:"Filename",name:"originalFilename",value:p?.originalFilename}),m?(0,s.jsx)(l.Zp,{marginTop:2,shadow:1,padding:3,radius:1,children:(0,s.jsxs)(l.BJ,{space:2,children:[(0,s.jsx)(l.wb,{space:2,children:h.map((e,t)=>(0,s.jsx)(l.oz,{id:`locale-tab-${e.id}`,"aria-controls":`locale-panel-${e.id}`,selected:g===t,onClick:()=>f(t),label:e.title},e.id))}),h.map((t,a)=>(0,s.jsx)(o.Kp,{id:`locale-panel-${t.id}`,"aria-labelledby":`locale-tab-${t.id}`,hidden:g!==a,children:(0,s.jsxs)(l.BJ,{space:3,children:[(0,s.jsx)(tN,{...r(`title.${t.id}`),disabled:e,error:i?.title?.[t.id]?.message,label:"Title",name:`title.${t.id}`}),(0,s.jsx)(tN,{...r(`altText.${t.id}`),disabled:e,error:i?.altText?.[t.id]?.message,label:"Alt Text",name:`altText.${t.id}`}),(0,s.jsx)(tP,{...r(`description.${t.id}`),disabled:e,error:i?.description?.[t.id]?.message,label:"Description",name:`description.${t.id}`,rows:5}),u?.enabled&&(0,s.jsx)(tN,{...r(`creditLine.${t.id}`),error:i?.creditLine?.[t.id]?.message,label:"Credit",name:`creditLine.${t.id}`,disabled:e||u?.excludeSources?.includes(p?.source?.name)})]})},t.id))]})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tN,{...r("title"),disabled:e,error:i?.title?.message,label:"Title",name:"title",value:tQ(p?.title)}),(0,s.jsx)(tN,{...r("altText"),disabled:e,error:i?.altText?.message,label:"Alt Text",name:"altText",value:tQ(p?.altText)}),(0,s.jsx)(tP,{...r("description"),disabled:e,error:i?.description?.message,label:"Description",name:"description",rows:5,value:tQ(p?.description)}),u?.enabled&&(0,s.jsx)(tN,{...r("creditLine"),error:i?.creditLine?.message,label:"Credit",name:"creditLine",value:tQ(p?.creditLine),disabled:e||u?.excludeSources?.includes(p?.source?.name)})]})]})}function tH(e){return(0,s.jsx)(tV,{...e})}let tW=e=>{let{children:t,dialog:{assetId:a,id:i,lastCreatedTag:n,lastRemovedTagIds:c}}=e,u=el(),h=(0,r.FEk)(),m=(0,r.q3J)(),g=(0,p.wA)(),f=ec(e=>eB(e,String(a))),y=ec(e_),x=(0,d.useRef)(void 0),[b,j]=(0,d.useState)(f?.asset),[v,w]=(0,d.useState)("details"),C=f?f?.asset:b,I=eI(y),k=ec(e=>{let t=C?.opt?.media?.tags?.reduce((t,a)=>{let i=e.tags.byIds[a._ref];return i?.tag&&t.push(i),t},[]);return t&&t?.length>0?eI(t):null}),{creditLine:T,components:{details:z}={},locales:E}=td(),_=(0,d.useCallback)(e=>{if(E&&E.length>0){let t=e=>{let t={};for(let a=0;a<E.length;a++){let i=E[a];"object"==typeof e&&e&&e[i.id]?t[i.id]=e[i.id]:"string"==typeof e?t[i.id]=0===a?e:"":t[i.id]=""}return t};return{altText:t(e?.altText),creditLine:t(e?.creditLine),description:t(e?.description),originalFilename:e?.originalFilename||"",opt:{media:{tags:k}},title:t(e?.title)}}let t=e=>"string"==typeof e?e:"object"==typeof e&&null!==e&&Object.values(e).find(e=>e)||"";return{altText:t(e?.altText),creditLine:t(e?.creditLine),description:t(e?.description),originalFilename:e?.originalFilename||"",opt:{media:{tags:k}},title:t(e?.title)}},[k,E]),{control:A,formState:{errors:$,isDirty:S,isValid:R},getValues:L,handleSubmit:U,register:O,reset:Z,setValue:q}=(0,P.mN)({defaultValues:_(f?.asset),mode:"onChange",resolver:(0,N.u)(tj(E))}),F=!f||f?.updating,B=(0,d.useCallback)(()=>
114{g(eW.remove({id:i}))},[g,i]),M=(0,d.useCallback)(()=>{f?.asset&&g(eW.showConfirmDeleteAssets({assets:[f],closeDialogId:f?.asset._id}))},[f,g]),Y=(0,d.useCallback)(e=>{let{result:t,transition:a}=e;t&&"update"===a&&j(t)},[]),Q=(0,d.useCallback)(e=>{g(e$.createRequest({assetId:C?._id,name:e}))},[C?._id,g]),V=(0,d.useMemo)(()=>{if(!C)return!1;let e=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),t=[C.title,C.altText,C.description,..."sanity.imageAsset"===C._type?[C.creditLine]:[]];if(!t.some(t=>e(t)))return!1;if(!E||0===E.length)return!0;let a=new Set(E.map(e=>e.id));return t.some(t=>!!e(t)&&Object.keys(t).some(e=>!a.has(e)))},[C,E]),H=(0,d.useCallback)(async()=>{if(!C)return;let e=e=>{if("object"!=typeof e||null===e||Array.isArray(e))return e;if(!E||0===E.length)return Object.keys(e).sort().map(t=>e[t]).find(e=>e)||"";let t=new Set(E.map(e=>e.id)),a={};for(let[i,s]of Object.entries(e))t.has(i)&&(a[i]=s);return a};await u.patch(C._id).set({title:e(C.title),altText:e(C.altText),description:e(C.description),..."sanity.imageAsset"===C._type&&{creditLine:e(C.creditLine)}}).commit()},[u,C,E]),W=(0,d.useCallback)(e=>{if(!f?.asset)return;let t=tI(e);g(eQ.updateRequest({asset:f?.asset,closeDialogId:f?.asset._id,formData:{...t,opt:{media:{...t.opt.media,tags:t.opt.media.tags?.map(e=>({_ref:e.value,_type:"reference",_weak:!0}))||null}}}}))},[f?.asset,g]);if((0,d.useEffect)(()=>{if(!f?.asset)return;let e=u.listen((0,D.A)`*[_id == $id]`,{id:f?.asset._id}).subscribe(Y);return()=>{e?.unsubscribe()}},[f?.asset,u,Y]),(0,d.useEffect)(()=>{n&&q("opt.media.tags",(L("opt.media.tags")||[]).concat([n]),{shouldDirty:!0})},[L,n,q]),(0,d.useEffect)(()=>{c&&q("opt.media.tags",(L("opt.media.tags")||[]).filter(e=>!c.includes(e.value)),{shouldDirty:!0})},[L,c,q]),(0,d.useEffect)(()=>{x.current!==f?.asset._updatedAt&&Z(_(f?.asset)),x.current=f?.asset._updatedAt},[f?.asset,_,Z]),!C)return null;let X={control:A,errors:$,formUpdating:F,register:O,setValue:q,assetTagOptions:k,allTagOptions:I,handleCreateTag:Q,currentAsset:C,creditLine:T,locales:E};return(0,s.jsxs)(t_,{animate:!0,footer:(0,s.jsx)(()=>(0,s.jsx)(l.az,{padding:3,children:(0,s.jsxs)(l.BJ,{space:3,children:[V&&(0,s.jsx)(l.Zp,{padding:3,radius:2,shadow:1,tone:"caution",children:(0,s.jsxs)(l.so,{align:"center",justify:"space-between",gap:3,children:[(0,s.jsx)(l.EY,{size:1,children:"This asset has localized fields that are no longer configured. Clean them up to avoid validation errors."}),(0,s.jsx)(l.$n,{fontSize:1,mode:"ghost",onClick:H,text:"Cleanup localized fields",tone:"caution"})]})}),(0,s.jsxs)(l.so,{justify:"space-between",children:[(0,s.jsx)(l.$n,{disabled:F,fontSize:1,mode:"bleed",onClick:M,text:"Delete",tone:"critical"}),(0,s.jsx)(tU,{disabled:F||!S||!R||V,isValid:R,lastUpdated:C?._updatedAt,onClick:U(W)})]})]})}),{}),header:"Asset details",id:i,onClose:B,width:3,children:[(0,s.jsxs)(l.so,{direction:["column-reverse","column-reverse","row-reverse"],children:[(0,s.jsx)(l.az,{flex:1,marginTop:[5,5,0],padding:4,children:(0,s.jsx)(r.zeL,{documentStore:m,id:C._id,children:({isLoading:e,referringDocuments:t})=>{let a=tw(t);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(l.wb,{space:2,children:[(0,s.jsx)(l.oz,{"aria-controls":"details-panel",disabled:F,id:"details-tab",label:"Details",onClick:()=>w("details"),selected:"details"===v,size:2}),(0,s.jsx)(l.oz,{"aria-controls":"references-panel",disabled:F,id:"references-tab",label:`References${!e&&Array.isArray(a)?` (${a.length})`:""}`,onClick:()=>w("references"),selected:"references"===v,size:2})]}),(0,s.jsxs)(l.az,{as:"form",marginTop:4,onSubmit:U(W),children:[!f&&(0,s.jsx)(l.Zp,{marginBottom:3,padding:3,radius:2,shadow:1,tone:"critical",children:(0,s.jsx)(l.EY,{size:1,children:"This file cannot be found – it may have been deleted."})}),(0,s.jsx)("button",{style:{display:"none"},tabIndex:-1,type:"submit"}),(0,s.jsx)(o.Kp,{"aria-labelledby":"details",hidden:"details"!==v,id:"details-panel",children:z?(0,s.jsx)(z,{...X,renderDefaultDetails:tH}):(0,s.jsx)(tV,{...X})}),(0,s.jsx)(o.Kp,{"aria-labelledby":"references",hidden:"references"!==v,id:"references-panel",children:(0,s.jsx)(l.az,{marginTop:5,children:f?.asset&&(0,s.jsx)(tA,{documents:a,isLoading:e})})})]})]})}})}),(0,s.jsxs)(l.az,{flex:1,padding:4,children:[(0,s.jsxs)(l.az,{style:{aspectRatio:"1"},children:["sanity.fileAsset"===C._type&&(0,s.jsx)(tL,{asset:C}),"sanity.imageAsset"===C._type&&(0,s.jsx)(tD,{draggable:!1,$scheme:h,$showCheckerboard:!C?.metadata?.isOpaque,src:tC(C,{height:600,width:600})})]}),C&&(0,s.jsx)(l.az,{marginTop:4,children:(0,s.jsx)(tE,{asset:C,item:f})})]})]}),t]})},tX=e=>{let{children:t,dialog:a}=e,i=(0,p.wA)(),r=()=>
114{i(eW.remove({id:a?.id}))},o=()=>{a?.closeDialogId&&i(eW.remove({id:a?.closeDialogId})),a?.confirmCallbackAction&&i(a.confirmCallbackAction),r()};return(0,s.jsxs)(t_,{animate:!0,footer:(0,s.jsx)(()=>(0,s.jsx)(l.az,{padding:3,children:(0,s.jsxs)(l.so,{justify:"space-between",children:[(0,s.jsx)(l.$n,{fontSize:1,mode:"bleed",onClick:r,text:"Cancel"}),(0,s.jsx)(l.$n,{fontSize:1,onClick:o,text:a?.confirmText,tone:a?.tone})]})}),{}),header:(0,s.jsx)(()=>(0,s.jsxs)(l.so,{align:"center",children:[(0,s.jsx)(l.az,{paddingX:1,children:(0,s.jsx)(n.sAQ,{})}),(0,s.jsx)(l.az,{marginLeft:2,children:a?.headerTitle})]}),{}),id:"confirm",onClose:r,width:1,children:[(0,s.jsx)(l.az,{paddingX:4,paddingY:4,children:(0,s.jsxs)(l.BJ,{space:3,children:[a?.title&&(0,s.jsx)(l.EY,{size:1,children:a.title}),a?.description&&(0,s.jsx)(l.EY,{muted:!0,size:1,children:(0,s.jsx)("em",{children:a.description})})]})}),t]})},tJ=e=>{let{children:t,dialog:{id:a}}=e,i=(0,p.wA)(),r=(0,d.useCallback)(()=>{i(eW.clear())},[]);return(0,s.jsxs)(t_,{animate:!0,header:"Filters",id:a,onClose:r,width:1,children:[(0,s.jsxs)(l.az,{padding:3,children:[(0,s.jsx)(tn,{layout:"stack"}),(0,s.jsx)(tc,{})]}),t]})},tK=e=>{let{children:t,dialog:{id:a}}=e,i=(0,p.wA)(),r=ec(e=>e.tags.creating),n=ec(e=>e.tags.creatingError),{formState:{errors:o,isDirty:c,isValid:u},handleSubmit:h,register:m,setError:g}=(0,P.mN)({defaultValues:{name:""},mode:"onChange",resolver:(0,N.u)(tv)}),f=e=>{let t=tI(e);i(e$.createRequest({name:t.name}))};return(0,d.useEffect)(()=>{n&&g("name",{message:n?.message})},[n,g]),(0,s.jsxs)(t_,{animate:!0,footer:(0,s.jsx)(()=>(0,s.jsx)(l.az,{padding:3,children:(0,s.jsx)(l.so,{justify:"flex-end",children:(0,s.jsx)(tU,{disabled:r||!c||!u,isValid:u,onClick:h(f)})})}),{}),header:"Create Tag",id:a,onClose:()=>{i(eW.clear())},width:1,children:[(0,s.jsxs)(l.az,{as:"form",padding:4,onSubmit:h(f),children:[(0,s.jsx)("button",{style:{display:"none"},tabIndex:-1,type:"submit"}),(0,s.jsx)(tN,{...m("name"),disabled:r,error:o?.name?.message,label:"Name",name:"name"})]}),t]})},tG=e=>{let{children:t,dialog:{id:a,tagId:i}}=e,r=el(),n=(0,p.wA)(),o=ec(e=>eA(e,String(i))),[c,u]=(0,d.useState)(o?.tag),h=o?o?.tag:c,m=e=>({name:e?.name?.current||""}),{formState:{errors:g,isDirty:f,isValid:y},handleSubmit:x,register:b,reset:j,setError:v}=(0,P.mN)({defaultValues:m(o?.tag),mode:"onChange",resolver:(0,N.u)(tv)}),w=!o||o?.updating,C=e=>{if(!o?.tag)return;let t=tI(e);n(e$.updateRequest({closeDialogId:o?.tag?._id,formData:{name:{_type:"slug",current:t.name}},tag:o?.tag}))},I=()=>{o?.tag&&n(eW.showConfirmDeleteTag({closeDialogId:o?.tag?._id,tag:o?.tag}))},k=(0,d.useCallback)(e=>{let{result:t,transition:a}=e;t&&"update"===a&&(u(t),j(m(t)))},[j]);return(0,d.useEffect)(()=>{o?.error&&v("name",{message:o.error?.message})},[v,o.error]),(0,d.useEffect)(()=>{if(!o?.tag)return;let e=r.listen((0,D.A)`*[_id == $id]`,{id:o?.tag._id}).subscribe(k);return()=>{e?.unsubscribe()}},[r,k,o?.tag]),h?(0,s.jsxs)(t_,{animate:!0,footer:(0,s.jsx)(()=>(0,s.jsx)(l.az,{padding:3,children:(0,s.jsxs)(l.so,{justify:"space-between",children:[(0,s.jsx)(l.$n,{disabled:w,fontSize:1,mode:"bleed",onClick:I,text:"Delete",tone:"critical"}),(0,s.jsx)(tU,{disabled:w||!f||!y,isValid:y,lastUpdated:o?.tag?._updatedAt,onClick:x(C)})]})}),{}),header:"Edit Tag",id:a,onClose:()=>{n(eW.remove({id:a}))},width:1,children:[(0,s.jsxs)(l.az,{as:"form",padding:4,onSubmit:x(C),children:[!o&&(0,s.jsx)(l.Zp,{marginBottom:3,padding:3,radius:2,shadow:1,tone:"critical",children:(0,s.jsx)(l.EY,{size:1,children:"This tag cannot be found – it may have been deleted."})}),(0,s.jsx)("button",{style:{display:"none"},tabIndex:-1,type:"submit"}),(0,s.jsx)(tN,{...b("name"),disabled:w,error:g?.name?.message,label:"Name",name:"name"})]}),t]}):null},t0=(0,c.I4)(l.so)`
115  height: ${32}px;
116`,t1=(0,c.I4)(l.so)`
117  @media (pointer: fine) {
118    visibility: hidden;
119  }
120
121  @media (hover: hover) and (pointer: fine) {
122    ${t0}:hover & {
123      visibility: visible;
124    }
125  }
126`,t2=e=>{let{disabled:t,icon:a,onClick:i,tone:r,tooltip:n}=e;return(0,s.jsx)(l.m_,{animate:!0,content:(0,s.jsx)(l.mc,{padding:2,width:0,children:(0,s.jsx)(l.EY,{muted:!0,size:1,children:n})}),disabled:"ontouchstart"in window,placement:"top",portal:!0,children:(0,s.jsx)(l.$n,{disabled:t,fontSize:1,icon:a,mode:"bleed",onClick:i,padding:2,tone:r})})},t3=e=>{let{actions:t,tag:a}=e,i=(0,p.wA)(),r=ec(eN),o=ec(e=>eL(e,a?.tag?._id));return(0,s.jsxs)(t0,{align:"center",flex:1,justify:"space-between",paddingLeft:3,children:[(0,s.jsx)(l.az,{flex:1,children:(0,s.jsx)(l.EY,{muted:!0,size:1,style:{opacity:a?.updating?.5:1,userSelect:"none"},textOverflow:"ellipsis",children:a?.tag?.name?.current})}),(0,s.jsxs)(t1,{align:"center",style:{flexShrink:0},children:[t?.includes("search")&&(0,s.jsx)(t2,{disabled:a?.updating,icon:o?(0,s.jsx)(n.USm,{}):(0,s.jsx)(n.WIv,{}),onClick:o?()=>{i(eU.facetsRemoveByTag({tagId:a.tag._id}))}:()=>{let e={...em.tag,value:{label:a?.tag?.name?.current,value:a?.tag?._id}};i(o?eU.facetsUpdate({name:"tag",operatorType:"references",value:e.value}):eU.facetsAdd({facet:e}))},tooltip:o?"Remove filter":"Filter by tag"}),t?.includes("edit")&&(0,s.jsx)(t2,{disabled:a?.updating,icon:(0,s.jsx)(n.qUP,{}),onClick:()=>{i(eT.showTagEdit({tagId:a?.tag?._id}))},tone:"primary",tooltip:"Edit tag"}),t?.includes("applyAll")&&(0,s.jsx)(t2,{disabled:a?.updating,icon:(0,s.jsx)(n.Kpk,{}),onClick:()=>{i(eW.showConfirmAssetsTagAdd({assetsPicked:r,tag:a.tag}))},tone:"primary",tooltip:"Add tag to selected assets"}),t?.includes("removeAll")&&(0,s.jsx)(t2,{disabled:a?.updating,icon:(0,s.jsx)(n.ZLN,{}),onClick:()=>{i(eW.showConfirmAssetsTagRemove({assetsPicked:r,tag:a.tag}))},tone:"critical",tooltip:"Remove tag from selected assets"}),t?.includes("delete")&&(0,s.jsx)(t2,{disabled:a?.updating,icon:(0,s.jsx)(n.ucK,{}),onClick:()=>{i(eW.showConfirmDeleteTag({tag:a.tag}))},tone:"critical",tooltip:"Delete tag"})]})]})},t5=(0,d.memo)(({isScrolling:e,item:t})=>"string"==typeof t?(0,s.jsx)(l.so,{align:"center",justify:"space-between",paddingX:3,style:{height:"32px"},children:(0,s.jsx)(l.JU,{size:0,children:t})},t):(0,s.jsx)(t3,{actions:e?void 0:t.actions,tag:t},t.tag?._id)),t4=()=>{let e=ec(eN),t=ec(e_),[a,i]=(0,d.useState)(!1),r=[...new Set(e?.reduce((e,t)=>
126{let a=t?.asset?.opt?.media?.tags?.map(e=>e._ref)||[];return e.concat(a)},[]))],n=r.reduce((t,a)=>(e.every(e=>(e.asset.opt?.media?.tags?.findIndex(e=>e._ref===a)??-1)>=0)?t.appliedToAll.push(a):t.appliedToSome.push(a),t),{appliedToAll:[],appliedToSome:[]}),l=t.filter(e=>n.appliedToAll.includes(e.tag._id)).map(e=>({...e,actions:["delete","edit","removeAll","search"]})),o=t.filter(e=>n.appliedToSome.includes(e.tag._id)).map(e=>({...e,actions:["applyAll","delete","edit","removeAll","search"]})),c=t.filter(e=>!r.includes(e.tag._id)).map(e=>({...e,actions:["applyAll","delete","edit","search"]})),p=[];return 0===e.length?p=t.map(e=>({...e,actions:["delete","edit","search"]})):(l?.length>0&&(p=[...p,1===e.length?"Used":"Used by all",...l]),o?.length>0&&(p=[...p,"Used by some",...o]),c?.length>0&&(p=[...p,"Unused",...c])),(0,s.jsx)(Y.aY,{className:"media__custom-scrollbar",computeItemKey:e=>{let t=p[e];return"string"==typeof t?t:t.tag._id},isScrolling:i,itemContent:e=>(0,s.jsx)(t5,{isScrolling:a,item:p[e]}),style:{flex:1,overflowX:"hidden"},totalCount:p.length})},t8=({allowCreate:e,light:t,title:a})=>{let i=(0,r.FEk)(),o=(0,p.wA)(),d=ec(e=>e.tags.creating),c=ec(e=>e.tags.fetching);return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(l.so,{align:"center",justify:"space-between",paddingLeft:3,style:{background:t?e2(i,"bg"):"inherit",borderBottom:"1px solid var(--card-border-color)",flexShrink:0,height:"32px"},children:[(0,s.jsxs)(l.cV,{space:2,children:[(0,s.jsx)(l.JU,{size:0,children:a}),c&&(0,s.jsx)(l.JU,{size:0,style:{opacity:.3},children:"Loading..."})]}),e&&(0,s.jsx)(l.az,{marginRight:1,children:(0,s.jsx)(l.$n,{disabled:d,fontSize:1,icon:n.KJo,mode:"bleed",onClick:()=>{o(eT.showTagCreate())},style:{background:"transparent",boxShadow:"none"}})})]})})},t6=()=>{let e=ec(eP),t=ec(e_),a=ec(e=>e.tags.fetching),i=-1!==ec(e=>e.tags.fetchCount),r=!a&&t?.length>0,n=e>0;return(0,s.jsxs)(l.so,{direction:"column",flex:1,height:"fill",children:[(0,s.jsx)(t8,{allowCreate:!0,light:n,title:n?"Tags (in selection)":"Tags"}),i&&!r&&(0,s.jsx)(l.az,{padding:3,children:(0,s.jsx)(l.EY,{muted:!0,size:1,children:(0,s.jsx)("em",{children:"No tags"})})}),r&&(0,s.jsx)(t4,{})]})},t7=e=>{let{children:t,dialog:{id:a}}=e,i=(0,p.wA)(),r=(0,d.useCallback)(()=>{i(eW.clear())},[]);return(0,s.jsxs)(t_,{animate:!0,header:"All Tags",id:a,onClose:r,width:1,children:[(0,s.jsx)(l.az,{style:{height:"100%",minHeight:"420px"},children:(0,s.jsx)(t6,{})}),t]})},t9=()=>{let e=ec(e=>e.dialog.items),t=(e,a)=>{if(0===e.length||a>=e.length)return null;let i=e[a],r=t(e,a+1);return"assetEdit"===i.type?(0,s.jsx)(tW,{dialog:i,children:r},a):"confirm"===i.type?(0,s.jsx)(tX,{dialog:i,children:r},a):"searchFacets"===i.type?(0,s.jsx)(tJ,{dialog:i,children:r},a):"tagCreate"===i.type?(0,s.jsx)(tK,{dialog:i,children:r},a):"tagEdit"===i.type?(0,s.jsx)(tG,{dialog:i,children:r},a):"tags"===i.type?(0,s.jsx)(t7,{dialog:i,children:r},a):null};return t(e,0)},ae=(0,d.createContext)(void 0),at=e=>{let{children:t,open:a}=e;return(0,s.jsx)(ae.Provider,{value:{open:a},children:t})},aa=e=>{let{onClose:t}=e,{open:a}=(()=>{let e=(0,d.useContext)(ae);if(void 0===e)throw Error("useDropzoneActions must be used within an DropzoneDispatchProvider");return e})(),{onSelect:i}=en(),r=ec(e=>e.assets.assetTypes),o=ec(e=>e.selected.document),{directUploads:c}=td();return(0,s.jsx)(l.az,{paddingY:2,children:(0,s.jsxs)(l.so,{align:"center",justify:"space-between",children:[(0,s.jsx)(l.az,{flex:1,marginX:3,children:(0,s.jsxs)(l.cV,{style:{whiteSpace:"nowrap"},children:[(0,s.jsx)(l.EY,{textOverflow:"ellipsis",weight:"semibold",children:(0,s.jsx)("span",{children:i?`Insert ${r.join(" or ")}`:"Browse Assets"})}),o&&(0,s.jsx)(l.az,{display:["none","none","block"],children:(0,s.jsxs)(l.EY,{children:[(0,s.jsx)("span",{style:{margin:"0 0.5em"},children:(0,s.jsx)(n.Int,{symbol:"arrow-right"})}),(0,s.jsx)("span",{style:{textTransform:"capitalize"},children:o._type})]})})]})}),(0,s.jsxs)(l.so,{marginX:2,children:[c&&(0,s.jsx)(l.$n,{fontSize:1,icon:n.JMY,mode:"bleed",onClick:a,text:`Upload ${1===r.length?g(r[0]):"assets"}`}),t&&(0,s.jsx)(l.az,{style:{flexShrink:0},children:(0,s.jsx)(l.$n,{disabled:!t,icon:n.USm,mode:"bleed",onClick:t,radius:2})})]})]})})},ai=(0,h.Mz)([e=>e.assets.allIds,e=>e.uploads.allIds],(e,t)=>{let a=e.map(e=>({id:e,type:"asset"}));return[...t.map(e=>({id:e,type:"upload"})),...a]}),as=(0,c.I4)(l.so)`
127  box-sizing: border-box;
128  height: 100%;
129  overflow: hidden;
130  position: relative;
131  width: 100%;
132`,ar=(0,c.I4)(l.so)(({$picked:e,theme:t,$updating:a})=>(0,c.AH)`
133      border: 1px solid transparent;
134      height: 100%;
135      pointer-events: ${a?"none":"auto"};
136      position: relative;
137      transition: all 300ms;
138      user-select: none;
139      width: 100%;
140
141      border: ${e?`1px solid ${t.sanity.color.spot.orange} !important`:"1px solid inherit"};
142
143      ${!a&&(0,c.AH)`
144        @media (hover: hover) and (pointer: fine) {
145          &:hover {
146            border: 1px solid var(--card-border-color);
147          }
148        }
149      `}
150    `),an=(0,c.I4)(l.so)(({$scheme:e})=>(0,c.AH)`
151      cursor: pointer;
152      height: ${32}px;
153      transition: all 300ms;
154      @media (hover: hover) and (pointer: fine) {
155        &:hover {
156          background: ${e2(e,"bg")};
157        }
158      }
159    `),al=(0,c.I4)(n.AK5)(({theme:e})=>({color:e.sanity.color.spot.red}));var ao=(0,d.memo)(e=>{let{id:t,selected:a}=e,i=(0,r.FEk)(),o=ei("shift"),d=(0,p.wA)(),c=ec(e=>e.assets.lastPicked),u=ec(e=>eB(e,t)),h=u?.asset,m=u?.error,g=u?.asset?.metadata?.isOpaque,f=u?.picked,y=u?.updating,{onSelect:x}=en();if(!h)return null;let b=y?.5:1,j=a||y?.25:1;return(0,s.jsx)(as,{padding:1,children:(0,s.jsxs)(ar,{direction:"column",$picked:f,$updating:u.updating,children:[(0,s.jsxs)(l.az,{flex:1,style:{cursor:a?"default":"pointer",position:"relative"},children:[(0,s.jsxs)("div",{onClick:e=>{e.stopPropagation(),x?x([{kind:"assetDocumentId",value:h._id}]):o.current?d(f?eQ.pick({assetId:h._id,picked:!f}):eQ.pickRange({startId:c||h._id,endId:h._id})):d(eW.showAssetEdit({assetId:h._id}))},style:{height:"100%",opacity:j},children:["sanity.fileAsset"===h._type&&(0,s.jsx)(tR,{extension:h.extension,width:"80px"}),"sanity.imageAsset"===h._type&&(0,s.jsx)(tD,{draggable:!1,$scheme:i,$showCheckerboard:!g,src:tC(h,{height:250,width:250}),style:{draggable:!1,transition:"opacity 1000ms"}})]}),a&&!y&&(0,s.jsx)(l.so,{align:"center",justify:"center",style:{height:"100%",left:0,opacity:b,position:"absolute",top:0,width:"100%"},children:(0,s.jsx)(l.EY,{size:2,children:(0,s.jsx)(n.Dee,{})})}),y&&(0,s.jsx)(l.so,{align:"center",justify:"center",style:{height:"100%",left:0,position:"absolute",top:0,width:"100%"},children:(0,s.jsx)(l.y$,{})})]}),(0,s.jsxs)(an,{align:"center",onClick:e=>{e.stopPropagation(),x?d(eW.showAssetEdit({assetId:h._id})):o.current&&!f?d(eQ.pickRange({startId:c||h._id,endId:h._id})):d(eQ.pick({assetId:h._id,picked:!f}))},paddingX:1,$scheme:i,style:{opacity:b},children:[x?(0,s.jsx)(n.qUP,{style:{flexShrink:0,opacity:.5}}):(0,s.jsx)(l.Sc,{checked:f,readOnly:!0,style:{flexShrink:0,pointerEvents:"none",transform:"scale(0.8)"}}),(0,s.jsx)(l.az,{marginLeft:2,children:(0,s.jsx)(l.EY,{muted:!0,size:0,textOverflow:"ellipsis",children:h.originalFilename})})]}),m&&(0,s.jsx)(l.az,{padding:3,style:{position:"absolute",right:0,top:0},children:(0,s.jsx)(l.m_,{animate:!0,content:(0,s.jsx)(l.mc,{padding:2,width:0,children:(0,s.jsx)(l.EY,{size:1,children:m})}),placement:"left",portal:!0,children:(0,s.jsx)(l.EY,{size:1,children:(0,s.jsx)(al,{color:"critical"})})})})]})})});let ad=async e=>{let t=await new Promise(t=>{let a=window.URL.createObjectURL(e),i=new Image;i.onload=()=>{window.URL.revokeObjectURL(a),t(i)},i.src=a}),a=await (e=>new Promise(t=>{let a=e.width/e.height,i=document.createElement("canvas");i.width=180,i.height=Math.max(180/a,1);try{i.getContext("2d")?.drawImage(e,0,0,180,180/a),i.toBlob(t,"image/jpeg")}catch(e){console.warn("Unable to generate preview image:",e)}}))(t);if(!a)throw Error("Unable to generate file Blob");return window.URL.createObjectURL(a)},ac=4;function ap(e,t){let a=e.indexOf(t);return a>-1&&e.splice(a,1),e}let au=e=>Array.prototype.map.call(new Uint8Array(e),e=>`00${e.toString(16)}`.slice(-2)).join(""),ah=((e,t=ac)=>{let a=((e=ac)=>{let t=[],a=[],i=new w.B;return function s(r){return new C.c(n=>{if(t.length>=e){var l;return(l=r,a.push(l),i.asObservable().pipe((0,R.$)(e=>e===l))).pipe((0,T.Z)(s)).subscribe(n)}let o=r.subscribe(n);return t.push(o),()=>{for(ap(t,o),ap(a,r),o.unsubscribe();a.length>0&&t.length<e;)i.next(a.shift())}})}})(t);return(...t)=>(0,j.H)(a(e(...t)))})((e,t,a,i)=>(0,b.of)(null).pipe((0,T.Z)(()=>{let a;return a=`sanity.${t}Asset`,e.observable.fetch("*[_type == $documentType && sha1hash == $hash][0]",{documentType:a,hash:i})}),(0,T.Z)(e=>e?(0,x.$)({message:"Asset already exists",statusCode:409}):(0,b.of)(null)),(0,T.Z)(()=>e.observable.assets.upload(t,a,{extract:["blurhash","exif","location","lqip","palette"],preserveFilename:!0}).pipe((0,L.T)(e=>"response"===e.type?{asset:e.body.document,id:e.body.document._id,type:"complete"}:e))))),am=(0,u.Z0)({name:"uploads",initialState:{allIds:[],byIds:{}},extraReducers:e=>{e.addCase(eO.uploadComplete,(e,t)=>{let{asset:a}=t.payload;e.byIds[a.sha1hash]&&(e.byIds[a.sha1hash].status="complete")}
159)},reducers:{checkRequest(e,t){},checkComplete(e,t){let{results:a}=t.payload;Object.keys(a).forEach(t=>{let a=e.allIds.indexOf(t);if(a>=0&&e.allIds.splice(a,1),e.byIds[t]){let a=e.byIds[t].objectUrl;a&&window.URL.revokeObjectURL(a),delete e.byIds[t]}})},previewReady(e,t){let{blobUrl:a,hash:i}=t.payload;e.byIds[i]&&(e.byIds[i].objectUrl=a)},uploadCancel(e,t){let{hash:a}=t.payload,i=e.allIds.indexOf(a);i>=0&&e.allIds.splice(i,1),e.byIds[a]&&delete e.byIds[a]},uploadError(e,t){let{hash:a}=t.payload,i=e.allIds.indexOf(a);i>=0&&e.allIds.splice(i,1),delete e.byIds[a]},uploadRequest(e,t){},uploadProgress(e,t){let{event:a,uploadHash:i}=t.payload;e.byIds[i].percent=a.percent,e.byIds[i].status="uploading"},uploadStart(e,t){let{uploadItem:a}=t.payload;e.allIds.includes(a.hash)||e.allIds.push(a.hash),e.byIds[a.hash]=a}}}),ag=(0,h.Mz)([e=>e.uploads.byIds,(e,t)=>t],(e,t)=>e[t]);(0,h.Mz)([e=>e.uploads.byIds,e=>e.uploads.allIds],(e,t)=>t.map(t=>e[t]));let af={...am.actions};var ay=am.reducer;let ax=(0,c.I4)(l.so)`
160  box-sizing: border-box;
161  height: 100%;
162  overflow: hidden;
163  position: relative;
164  width: 100%;
165`,ab=e=>{let t,{id:a}=e,i=(0,r.FEk)(),o=(0,p.wA)(),d=ec(e=>ag(e,a));if(!d)return null;let c=W(d.size,{base:10,round:0}),u=Math.round(d.percent||0),h="complete"===d.status,m="uploading"===d.status,g="queued"===d.status;return h&&(t="Verifying"),m&&(t=`${u}%`),g&&(t="Queued"),(0,s.jsx)(ax,{padding:1,children:(0,s.jsxs)(l.so,{direction:"column",flex:1,style:{background:e2(i,"bg"),border:"1px solid transparent",height:"100%",position:"relative"},children:[(0,s.jsx)("div",{style:{background:"var(--card-fg-color)",bottom:0,height:"1px",left:0,position:"absolute",width:"100%",transform:`scaleX(${.01*u})`,transformOrigin:"bottom left",transition:"all 1000ms ease-out"}}),(0,s.jsxs)(l.az,{flex:1,style:{position:"relative"},children:["image"===d.assetType&&d?.objectUrl&&(0,s.jsx)(tD,{draggable:!1,$scheme:i,src:d.objectUrl,style:{opacity:.4}}),"file"===d.assetType&&(0,s.jsx)("div",{style:{height:"100%",opacity:.1},children:(0,s.jsx)(tR,{width:"80px"})}),!h&&100!==u&&(0,s.jsx)(l.so,{align:"center",direction:"column",justify:"center",style:{height:"100%",left:0,position:"absolute",top:0,width:"100%"},children:(0,s.jsx)(l.$n,{fontSize:4,icon:n.USm,mode:"bleed",onClick:()=>{o(af.uploadCancel({hash:d.hash}))},padding:2,style:{background:"none",boxShadow:"none"},tone:"critical"})})]}),(0,s.jsxs)(l.so,{align:"center",justify:"space-between",paddingX:2,style:{height:"32px"},children:[(0,s.jsx)(l.az,{flex:1,marginRight:1,children:(0,s.jsxs)(l.EY,{size:0,textOverflow:"ellipsis",children:[d.name," (",c,")"]})}),(0,s.jsx)(l.EY,{size:0,style:{flexShrink:0},weight:"semibold",children:t})]})]})})},aj=(0,d.memo)(({item:e,selected:t})=>e?.type==="asset"?(0,s.jsx)(ao,{id:e.id,selected:t}):e?.type==="upload"?(0,s.jsx)(ab,{id:e.id}):null),av=c.I4.div`
166  height: ${220}px;
167  width: ${240}px;
168`,aw=(0,d.forwardRef)((e,t)=>{let{context:a,...i}=e;return(0,s.jsx)(av,{ref:t,...i})}),aC=c.I4.div`
169  display: grid;
170  grid-template-columns: repeat(auto-fill, ${240}px);
171  grid-template-rows: repeat(auto-fill, ${220}px);
172  justify-content: center;
173  margin: 0 auto;
174`,aI=(0,d.forwardRef)((e,t)=>{let{context:a,...i}=e;return(0,s.jsx)(aC,{ref:t,...i})}),ak=e=>{let{items:t,onLoadMore:a}=e,i=ec(e=>e.selected.assets),r=i&&i.map(e=>e._id)||[],n=t?.length;return 0===n?null:(0,s.jsx)(Y.sN,{className:"media__custom-scrollbar",computeItemKey:e=>t[e]?.id,components:{Item:aw,List:aI},endReached:a,itemContent:e=>{let a=t[e],i=r.includes(a?.id);return(0,s.jsx)(aj,{item:a,selected:i})},overscan:48,style:{overflowX:"hidden",overflowY:"scroll"},totalCount:n})},aT=e=>{let{field:t,title:a}=e,i=(0,p.wA)(),r=ec(e=>e.assets.order),o=r.field===t;return(0,s.jsx)(l.JU,{muted:!t,size:0,children:(0,s.jsxs)(l.az,{onClick:t?()=>{if(!(!t||!a))if(o){let e="asc"===r.direction?"desc":"asc";i(eQ.orderSet({order:{field:t,direction:e}}))}else i(eQ.orderSet({order:{field:t,direction:"asc"}}))}:void 0,style:{cursor:t?"pointer":"default",display:"inline",whiteSpace:"nowrap"},children:[(0,s.jsx)("span",{style:{marginRight:"0.4em"},children:a}),o&&r?.direction==="asc"&&(0,s.jsx)(n.Mtm,{}),o&&r?.direction==="desc"&&(0,s.jsx)(n.D3D,{})]})})},az=(0,c.I4)(l.so)(({$scheme:e})=>(0,c.AH)`
175      cursor: pointer;
176      @media (hover: hover) and (pointer: fine) {
177        &:hover {
178          background: ${e2(e,"bg")};
179        }
180      }
181    `),aE=()=>{let e=(0,r.FEk)(),t=(0,p.wA)(),a=ec(e=>e.assets.fetching),i=ec(eY),n=ec(eP),o=(0,l.aY)(),{onSelect:d}=en(),c=n===i;return(0,s.jsxs)(l.xA,{style:{alignItems:"center",background:"var(--card-bg-color)",borderBottom:"1px solid var(--card-border-color)",gridColumnGap:o<3?0:"16px",gridTemplateColumns:eb.LARGE,height:o<3?0:"32px",letterSpacing:"0.025em",position:"sticky",textTransform:"uppercase",top:0,visibility:o<3?"hidden":"visible",width:"100%",zIndex:1},children:[d?(0,s.jsx)(aT,{}):(0,s.jsx)(az,{align:"center",justify:"center",onClick:e=>{e.stopPropagation(),t(c?eQ.pickClear():eQ.pickAll())},$scheme:e,style:{height:"100%",position:"relative"},children:(0,s.jsx)(l.Sc,{checked:!a&&c,readOnly:!0,style:{pointerEvents:"none",transform:"scale(0.8)"}})}),(0,s.jsx)(aT,{}),(0,s.jsx)(aT,{field:"originalFilename",title:"Filename"}),(0,s.jsx)(aT,{title:"Resolution"}),(0,s.jsx)(aT,{field:"mimeType",title:"MIME type"}),(0,s.jsx)(aT,{field:"size",title:"Size"}),(0,s.jsx)(aT,{field:"_updatedAt",title:"Last updated"}),(0,s.jsx)(aT,{title:"References"}),(0,s.jsx)(aT,{})]})},a_=(0,c.I4)(l.xA)(({$scheme:e,$selected:t,$updating:a})=>(0,c.AH)`
182    align-items: center;
183    cursor: ${t?"default":"pointer"};
184    height: 100%;
185    pointer-events: ${a?"none":"auto"};
186    user-select: none;
187    white-space: nowrap;
188
189    ${!a&&(0,c.AH)`
190      @media (hover: hover) and (pointer: fine) {
191        &:hover {
192          background: ${e2(e,"bg")};
193        }
194      }
195    `}
196  `),aA=(0,c.I4)(l.so)(({$scheme:e})=>(0,c.AH)`
197      cursor: pointer;
198      @media (hover: hover) and (pointer: fine) {
199        &:hover {
200          background: ${e2(e,"bg2")};
201        }
202      }
203    `),a$=(0,c.I4)(n.AK5)(({theme:e})=>({color:e.sanity.color.spot.red}));var aS=(0,d.memo)(e=>{let{id:t,selected:a}=e,i=(0,r.FEk)(),o=ei("shift"),[c,u]=(0,d.useState)(!1),h=(0,d.useRef)(null),m=(0,p.wA)(),g=ec(e=>e.assets.lastPicked),f=ec(e=>eB(e,t)),y=(0,l.aY)(),x=f?.asset,b=f?.error,j=f?.asset?.metadata?.isOpaque,v=f?.picked,w=f?.updating,{onSelect:C}=en(),I=(0,d.useCallback)(e=>{e.stopPropagation(),x&&(C?m(eW.showAssetEdit({assetId:x._id})):o.current&&!v?m(eQ.pickRange({startId:g||x._id,endId:x._id})):m(eQ.pick({assetId:x._id,picked:!v})))},[x,m,g,C,v,o]),k=(0,d.useCallback)(e=>{e.stopPropagation(),x&&(C?C([{kind:"assetDocumentId",value:x._id}]):o.current?m(v?eQ.pick({assetId:x._id,picked:!v}):eQ.pickRange({startId:g||x._id,endId:x._id})):m(eW.showAssetEdit({assetId:x._id})))},[x,m,g,C,v,o]),T=w?.5:1,z=a||w?.1:1;return(0,d.useEffect)(()=>(h.current=setTimeout(()=>u(!0),750),()=>{h.current&&clearTimeout(h.current)}),[]),x?(0,s.jsxs)(a_,{onClick:a?void 0:k,$scheme:i,$selected:a,style:{gridColumnGap:y<3?0:"16px",gridRowGap:0,gridTemplateColumns:y<3?eb.SMALL:eb.LARGE,gridTemplateRows:y<3?"auto":"1fr"},$updating:f.updating,children:[(0,s.jsx)(aA,{onClick:I,$scheme:i,style:{alignItems:"center",gridColumn:1,gridRowStart:1,gridRowEnd:"span 5",height:"100%",
203justifyContent:"center",opacity:T,position:"relative"},children:C?(0,s.jsx)(n.qUP,{style:{flexShrink:0,opacity:.5}}):(0,s.jsx)(l.Sc,{checked:v,readOnly:!0,style:{pointerEvents:"none",transform:"scale(0.8)"}})}),(0,s.jsx)(l.az,{style:{gridColumn:2,gridRowStart:1,gridRowEnd:"span 5",height:"90px",width:"100px"},children:(0,s.jsxs)(l.so,{align:"center",justify:"center",style:{height:"100%",position:"relative"},children:[(0,s.jsxs)(l.az,{style:{height:"100%",opacity:z,position:"relative"},children:["sanity.fileAsset"===x._type&&(0,s.jsx)(tR,{extension:x.extension,width:"40px"}),"sanity.imageAsset"===x._type&&(0,s.jsx)(tD,{draggable:!1,$scheme:i,$showCheckerboard:!j,src:tC(x,{height:100,width:100})})]}),w&&(0,s.jsx)(l.so,{align:"center",justify:"center",style:{height:"100%",left:0,position:"absolute",top:0,width:"100%"},children:(0,s.jsx)(l.y$,{})}),a&&!w&&(0,s.jsx)(l.so,{align:"center",justify:"center",style:{height:"100%",left:0,position:"absolute",top:0,width:"100%"},children:(0,s.jsx)(l.EY,{size:2,children:(0,s.jsx)(n.Dee,{})})})]})}),(0,s.jsx)(l.az,{marginLeft:3*(y<3),style:{gridColumn:3,gridRow:y<3?2:"auto",opacity:T},children:(0,s.jsx)(l.EY,{muted:!0,size:1,style:{lineHeight:"2em"},textOverflow:"ellipsis",children:x.originalFilename})}),(0,s.jsx)(l.az,{marginLeft:3*(y<3),style:{gridColumn:y<3?3:4,gridRow:y<3?3:"auto",opacity:T},children:(0,s.jsx)(l.EY,{muted:!0,size:1,style:{lineHeight:"2em"},textOverflow:"ellipsis",children:"sanity.imageAsset"===x._type&&tk(x)})}),(0,s.jsx)(l.az,{style:{display:y<3?"none":"block",gridColumn:5,gridRow:"auto",opacity:T},children:(0,s.jsx)(l.EY,{muted:!0,size:1,style:{lineHeight:"2em"},textOverflow:"ellipsis",children:x.mimeType})}),(0,s.jsx)(l.az,{style:{display:y<3?"none":"block",gridColumn:6,gridRow:"auto",opacity:T},children:(0,s.jsx)(l.EY,{muted:!0,size:1,style:{lineHeight:"2em"},textOverflow:"ellipsis",children:W(x.size,{base:10,round:0})})}),(0,s.jsx)(l.az,{marginLeft:3*(y<3),style:{gridColumn:y<3?3:7,gridRow:y<3?4:"auto",opacity:T},children:(0,s.jsx)(l.EY,{muted:!0,size:1,style:{lineHeight:"2em"},textOverflow:"ellipsis",children:(0,H.o)(new Date(x._updatedAt),new Date)})}),(0,s.jsx)(l.az,{style:{display:y<3?"none":"block",gridColumn:8,gridRow:"auto",opacity:T},children:(0,s.jsx)(l.EY,{muted:!0,size:1,style:{lineHeight:"2em"},textOverflow:"ellipsis",children:c?(0,s.jsx)(r.zeL,{id:t,children:({isLoading:e,referringDocuments:t})=>{let a=tw(t);return e?(0,s.jsx)(s.Fragment,{children:"-"}):(0,s.jsx)(s.Fragment,{children:Array.isArray(a)?a.length:0})}}):(0,s.jsx)(s.Fragment,{children:"-"})})}),(0,s.jsx)(l.so,{align:"center",justify:"center",style:{gridColumn:y<3?4:9,gridRowStart:"1",gridRowEnd:y<3?"span 5":"auto",opacity:T},children:b&&(0,s.jsx)(l.az,{padding:2,children:(0,s.jsx)(l.m_,{animate:!0,content:(0,s.jsx)(l.mc,{padding:2,width:0,children:(0,s.jsx)(l.EY,{size:1,children:b})}),placement:"left",portal:!0,children:(0,s.jsx)(l.EY,{size:1,children:(0,s.jsx)(a$,{color:"critical"})})})})})]}):null});let aR=e=>{let t,{id:a}=e,i=(0,r.FEk)(),o=(0,p.wA)(),d=ec(e=>ag(e,a)),c=(0,l.aY)();if(!d)return null;let u=W(d.size,{base:10,round:0}),h=Math.round(d.percent||0),m="complete"===d.status,g="uploading"===d.status,f="queued"===d.status;return m&&(t="Verifying"),g&&(t=`${h}%`),f&&(t="Queued"),(0,s.jsxs)(l.xA,{style:{alignItems:"center",background:e2(i,"bg"),gridColumnGap:c<3?0:"16px",gridRowGap:0,gridTemplateColumns:c<3?eb.SMALL:eb.LARGE,gridTemplateRows:c<3?"auto":"1fr",height:"100%",position:"relative"},children:[(0,s.jsx)("div",{style:{background:"var(--card-fg-color)",bottom:0,height:"1px",left:0,position:"absolute",width:"100%",transform:`scaleX(${.01*h})`,transformOrigin:"bottom left",transition:"all 1000ms ease-out"}}),(0,s.jsx)(l.az,{style:{gridColumn:2,gridRowStart:c<3?1:"auto",gridRowEnd:c<3?"span 4":"auto",height:"90px",width:"100px"},children:(0,s.jsxs)(l.az,{style:{height:"100%",position:"relative"},children:["image"===d.assetType&&d?.objectUrl&&(0,s.jsx)(tD,{draggable:!1,$scheme:i,src:d.objectUrl,style:{opacity:.25}}),"file"===d.assetType&&(0,s.jsx)("div",{style:{height:"100%",opacity:.1},children:(0,s.jsx)(tR,{width:"40px"})}),!m&&100!==h&&(0,s.jsx)(l.so,{align:"center",justify:"center",style:{position:"absolute",height:"100%",left:0,top:0,width:"100%"},children:(0,s.jsx)(l.$n,{fontSize:3,icon:n.USm,mode:"bleed",onClick:()=>{o(af.uploadCancel({hash:d.hash}))},padding:2,style:{background:"none",boxShadow:"none"},tone:"critical"})})]})}),(0,s.jsx)(l.az,{style:{gridColumn:c<3?3:"3/8",gridRow:c<3?"2/4":"auto",marginLeft:3*(c<3)},children:(0,s.jsxs)(l.BJ,{space:3,children:[(0,s.jsxs)(l.EY,{muted:!0,size:1,textOverflow:"ellipsis",children:[d.name," 
203(",u,")"]}),(0,s.jsx)(l.EY,{size:1,textOverflow:"ellipsis",weight:"semibold",children:t})]})})]})},aL=(0,d.memo)(({item:e,selected:t})=>e?.type==="asset"?(0,s.jsx)(l.az,{style:{height:"100px"},children:(0,s.jsx)(aS,{id:e.id,selected:t})}):e?.type==="upload"?(0,s.jsx)(l.az,{style:{height:"100px"},children:(0,s.jsx)(aR,{id:e.id})}):null),aU=e=>{let{items:t,onLoadMore:a}=e,i=ec(e=>e.selected.assets),r=i&&i.map(e=>e._id)||[],n=t?.length;return 0===n?null:(0,s.jsx)(Y.kN,{className:"media__custom-scrollbar",computeItemKey:e=>t[e]?.id||e,endReached:a,groupCounts:[,].fill(n),groupContent:()=>(0,s.jsx)(aE,{}),itemContent:e=>{let a=t[e],i=r.includes(a?.id);return(0,s.jsx)(aL,{item:a,selected:i})},style:{overflowX:"hidden"}})},aD=()=>{let e=(0,p.wA)(),t=ec(e=>e.assets.fetchCount),a=ec(e=>e.assets.fetching),i=ec(e=>e.tags.panelVisible),r=ec(e=>e.assets.view),n=ec(ai),o=(()=>{let e=l.Qx?.container?.map(e=>window.matchMedia(`(max-width: ${e}px)`)),t=()=>e.findIndex(e=>e.matches),[a,i]=(0,d.useState)(t());return(0,d.useEffect)(()=>{let a=()=>{i(t)};return e.forEach(e=>{try{e.addEventListener("change",a)}catch{try{e.addListener(a)}catch{}}}),()=>{try{e.forEach(e=>e.removeEventListener("change",a))}catch{try{e.forEach(e=>e.removeListener(a))}catch{}}}},[]),a})(),c=n.length>0,u=()=>{a||e(eQ.loadNextPage())};return(0,d.useEffect)(()=>{o<=1&&i&&e(e$.panelVisibleSet({panelVisible:!1}))},[o]),(0,s.jsx)(l.az,{flex:1,style:{width:"100%"},children:c||!(t>=0)||a?(0,s.jsxs)(s.Fragment,{children:["grid"===r&&(0,s.jsx)(ak,{items:n,onLoadMore:u}),"table"===r&&(0,s.jsx)(aU,{items:n,onLoadMore:u})]}):(0,s.jsx)(l.az,{padding:4,children:(0,s.jsx)(l.EY,{size:1,weight:"semibold",children:"No results for the current query"})})})},aO=()=>{let e=ec(e=>e.notifications.items),t=(0,o.dj)();return(0,d.useEffect)(()=>{if(e.length>0){let a=e[e.length-1];t.push({closable:!0,status:a.status,title:a.title})}},[e.length]),null},aZ=()=>{let e=(0,r.FEk)(),t=(0,p.wA)(),a=ec(eN);return 0===a.length?null:(0,s.jsx)(l.so,{align:"center",justify:"flex-start",style:{background:e2(e,"bg"),borderBottom:"1px solid var(--card-border-color)",height:"32px",position:"relative",width:"100%"},children:(0,s.jsxs)(l.so,{align:"center",paddingX:3,children:[(0,s.jsx)(l.az,{paddingRight:2,children:(0,s.jsxs)(l.JU,{size:0,style:{color:"inherit"},children:[a.length," ",g("asset",a.length)," selected"]})}),(0,s.jsx)(l.$n,{mode:"bleed",onClick:()=>{t(eQ.pickClear())},padding:2,style:{background:"none",boxShadow:"none"},tone:"default",children:(0,s.jsx)(l.JU,{size:0,children:"Deselect"})}),(0,s.jsx)(l.$n,{mode:"bleed",onClick:()=>{t(eW.showConfirmDeleteAssets({assets:a}))},padding:2,style:{background:"none",boxShadow:"none"},tone:"critical",children:(0,s.jsx)(l.JU,{size:0,children:"Delete"})})]})})};var aq=(0,u.Z0)({name:"selected",initialState:{assets:[],document:void 0,documentAssetIds:[]},reducers:{}}).reducer;let aF=(0,u.Z0)({name:"notifications",initialState:{items:[]},reducers:{add(e,t){let{asset:a,status:i,title:s}=t.payload;e.items.push({asset:a,status:i,title:s})}}}),aB={...aF.actions};var aM=aF.reducer;let aY=(0,f.Ex)((e,t,{client:a})=>e.pipe((0,z.p)(eQ.deleteRequest.match),(0,T.Z)(e=>{let{assets:t}=e.payload,i=t.map(e=>e._id);return(0,b.of)(t).pipe((0,T.Z)(()=>a.observable.delete({query:(0,D.A)`*[_id in ${JSON.stringify(i)}]`})),(0,T.Z)(()=>(0,b.of)(eQ.deleteComplete({assetIds:i}))),(0,_.W)(e=>(0,b.of)(eQ.deleteError({assetIds:i,error:e}))))})),(e,t,{client:a})=>e.pipe((0,z.p)(eQ.fetchRequest.match),(0,E.E)(t),(0,A.n)(([e,t])=>{let i=e.payload?.params,s=e.payload?.query;return(0,b.of)(e).pipe(ev(t.debug.badConnection),(0,T.Z)(()=>a.observable.fetch(s,i)),(0,T.Z)(e=>{let{items:t}=e;return(0,b.of)(eQ.fetchComplete({assets:t}))}),(0,_.W)(e=>(0,b.of)(eQ.fetchError({message:e?.message||"Internal error",statusCode:e?.statusCode||500}))))})),(e,t)=>e.pipe((0,z.p)(eQ.deleteComplete.match),(0,E.E)(t),(0,A.n)(([e,t])=>{if(0===t.assets.allIds.length){let e=Math.floor(t.assets.allIds.length/t.assets.pageSize);return(0,b.of)(eQ.loadPageIndex({pageIndex:e}))}return v.w})),(e,t)=>e.pipe((0,z.p)(eQ.loadNextPage.match),(0,E.E)(t),(0,A.n)(([e,t])=>(0,b.of)(eQ.loadPageIndex({pageIndex:t.assets.pageIndex+1})))),(e,t)=>e.pipe((0,z.p)(eQ.loadPageIndex.match),(0,E.E)(t),(0,A.n)(([e,t])=>{let a=t.assets.pageSize,i=e.payload.pageIndex*a,s=t?.selected.document?._id,r=t?.selected?.documentAssetIds,n=ew({assetTypes:t.assets.assetTypes,searchFacets:t.search.facets,searchQuery:t.search.query}),l={...s?{documentId:s}:{},documentAssetIds:r};return(0,b.of)(eQ.fetchRequest({params:l,queryFilter:n,selector:(0,D.A)`[${i}...${i+a}]`,sort:(0,D.A)`order(${t.assets?.order?.field} ${t.assets?.order?.direction})`}))})),e=>e.pipe((0,z.p)(eQ.listenerCreateQueue.match),(0,$.w)(2e3),(0,z.p)(e=>e.length>0),(0,T.Z)(e=>{let t=e?.map(e=>e.payload.asset);return(0,b.of)(eQ.listenerCreateQueueComplete({assets:t}))})),e=>e.pipe((0,z.p)(eQ.listenerDeleteQueue.match),(0,$.w)(2e3),(0,z.p)(e=>e.length>0),(0,T.Z)(e=>{let t=e?.map(e=>e.payload.assetId);return(0,b.of)(eQ.listenerDeleteQueueComplete({assetIds:t}))})),e=>e.pipe((0,z.p)(eQ.listenerUpdateQueue.match),(0,$.w)(2e3),(0,z.p)(e=>e.length>0),(0,T.Z)(e=>{let t=e?.map(e=>e.payload.asset);return(0,b.of)(eQ.listenerUpdateQueueComplete({assets:t}))})),e=>e.pipe((0,z.p)(eQ.orderSet.match),(0,T.Z)(()=>(0,b.of)(eQ.clear(),eQ.loadPageIndex({pageIndex:0})))),e=>e.pipe((0,f.gp)(eU.facetsAdd.type,eU.facetsClear.type,eU.facetsRemoveById.type,eU.facetsRemoveByName.type,eU.facetsRemoveByTag.type,eU.facetsUpdate.type,eU.facetsUpdateById.type,eU.querySet.type),(0,S.B)(400),(0,T.Z)(()=>(0,b.of)(eQ.clear(),eQ.loadPageIndex({pageIndex:0})))),e=>e.pipe((0,f.gp)(eQ.insertUploads.type,eQ.listenerUpdateQueueComplete.type,eQ.updateComplete.type),(0,T.Z)(()=>(0,b.of)(eQ.sort()))),(e,t,{client:a})=>e.pipe((0,z.p)(ek.tagsAddRequest.match),(0,E.E)(t),(0,T.Z)(([e,t])=>{let{assets:i,tag:s}=e.payload;return(0,b.of)(e).pipe(ev(t.debug.badConnection),(0,T.Z)(()=>{let e=(eN(t)?.filter(e=>(e?.asset?.opt?.media?.tags?.findIndex(e=>e._ref===s?._id)??-1)<0)).reduce((e,t)=>
203e.patch(t?.asset?._id,(({tag:e})=>t=>t.setIfMissing({opt:{}}).setIfMissing({"opt.media":{}}).setIfMissing({"opt.media.tags":[]}).append("opt.media.tags",[{_key:(0,O.Ak)(),_ref:e?._id,_type:"reference",_weak:!0}]))({tag:s})),a.transaction());return(0,j.H)(e.commit())}),(0,T.Z)(()=>(0,b.of)(ek.tagsAddComplete({assets:i,tag:s}))),(0,_.W)(e=>(0,b.of)(ek.tagsAddError({assets:i,error:{message:e?.message||"Internal error",statusCode:e?.statusCode||500},tag:s}))))})),(e,t,{client:a})=>e.pipe((0,z.p)(ek.tagsRemoveRequest.match),(0,E.E)(t),(0,T.Z)(([e,t])=>{let{assets:i,tag:s}=e.payload;return(0,b.of)(e).pipe(ev(t.debug.badConnection),(0,T.Z)(()=>{let e=eN(t).reduce((e,t)=>e.patch(t?.asset?._id,(({asset:e,tag:t})=>a=>a.ifRevisionId(e?.asset?._rev).unset([`opt.media.tags[_ref == "${t._id}"]`]))({asset:t,tag:s})),a.transaction());return(0,j.H)(e.commit())}),(0,T.Z)(()=>(0,b.of)(ek.tagsRemoveComplete({assets:i,tag:s}))),(0,_.W)(e=>(0,b.of)(ek.tagsRemoveError({assets:i,error:{message:e?.message||"Internal error",statusCode:e?.statusCode||500},tag:s}))))})),e=>e.pipe((0,f.gp)(eQ.orderSet.type,eQ.viewSet.type,eU.facetsAdd.type,eU.facetsClear.type,eU.facetsRemoveById.type,eU.facetsRemoveByName.type,eU.facetsRemoveByTag.type,eU.facetsUpdate.type,eU.facetsUpdateById.type,eU.querySet.type),(0,T.Z)(()=>(0,b.of)(eQ.pickClear()))),(e,t,{client:a})=>e.pipe((0,z.p)(eQ.updateRequest.match),(0,E.E)(t),(0,T.Z)(([e,t])=>{let{asset:i,closeDialogId:s,formData:r}=e.payload;return(0,b.of)(e).pipe(ev(t.debug.badConnection),(0,T.Z)(()=>(0,j.H)(a.patch(i._id).setIfMissing({opt:{}}).setIfMissing({"opt.media":{}}).set(r).commit())),(0,T.Z)(e=>(0,b.of)(eQ.updateComplete({asset:e,closeDialogId:s}))),(0,_.W)(e=>(0,b.of)(eQ.updateError({asset:i,error:{message:e?.message||"Internal error",statusCode:e?.statusCode||500}}))))})),e=>e.pipe((0,f.gp)(eQ.deleteComplete.type,eQ.updateComplete.type,e$.deleteComplete.type,e$.updateComplete.type),(0,z.p)(e=>!!e?.payload?.closeDialogId),(0,T.Z)(e=>{let t=e?.payload?.closeDialogId;return t?(0,b.of)(eH.actions.remove({id:t})):v.w})),e=>e.pipe((0,z.p)(e$.createComplete.match),(0,T.Z)(e=>{let{assetId:t,tag:a}=e?.payload;return t?(0,b.of)(eH.actions.inlineTagCreate({tag:a,assetId:t})):a._id?(0,b.of)(eH.actions.remove({id:"tagCreate"})):v.w})),e=>e.pipe((0,z.p)(e$.listenerDeleteQueueComplete.match),(0,T.Z)(e=>{let{tagIds:t}=e?.payload;return(0,b.of)(eH.actions.inlineTagRemove({tagIds:t}))})),e=>e.pipe((0,z.p)(eQ.deleteError.match),(0,T.Z)(e=>{let{assetIds:t}=e.payload,a=t.length;return(0,b.of)(aF.actions.add({status:"error",title:`Unable to delete ${a} ${g("asset",a)}. Please review any asset errors and try again.`}))})),e=>e.pipe((0,z.p)(eQ.deleteComplete.match),(0,T.Z)(e=>{let{assetIds:t}=e.payload,a=t.length;return(0,b.of)(aF.actions.add({status:"info",title:`${a} ${g("asset",a)} deleted`}))})),e=>e.pipe((0,z.p)(ek.tagsAddComplete.match),(0,T.Z)(e=>{let t=e?.payload?.assets?.length;return(0,b.of)(aF.actions.add({status:"info",title:`Tag added to ${t} ${g("asset",t)}`}))})),e=>e.pipe((0,z.p)(ek.tagsRemoveComplete.match),(0,T.Z)(e=>{let t=e?.payload?.assets?.length;return(0,b.of)(aF.actions.add({status:"info",title:`Tag removed from ${t} ${g("asset",t)}`}))})),e=>e.pipe((0,z.p)(eQ.updateComplete.match),(0,$.w)(2e3),(0,z.p)(e=>e.length>0),(0,T.Z)(e=>{let t=e.length;return(0,b.of)(aF.actions.add({status:"info",title:`${t} ${g("asset",t)} updated`}))})),e=>e.pipe((0,f.gp)(eQ.fetchError.type,eQ.updateError.type,e$.createError.type,e$.deleteError.type,e$.fetchError.type,e$.updateError.type,af.uploadError.type),(0,T.Z)(e=>{let t=`An error occurred: ${function(e){return e&&"object"==typeof e?"error"in e&&e.error&&"object"==typeof e.error&&null!==e.error&&"message"in e.error?String(e.error.message):"message"in e&&"string"==typeof e.message?String(e.message):"Unknown error":"Unknown error"}(e.payload)}`;return(0,b.of)(aF.actions.add({status:"error",title:t}))})),e=>e.pipe((0,z.p)(e$.createComplete.match),(0,T.Z)(()=>(0,b.of)(aF.actions.add({status:"info",title:"Tag created"})))),e=>e.pipe((0,z.p)(e$.deleteComplete.match),(0,T.Z)(()=>(0,b.of)(aF.actions.add({status:"info",title:"Tag deleted"})))),e=>e.pipe((0,z.p)(e$.updateComplete.match),(0,T.Z)(()=>(0,b.of)(aF.actions.add({status:"info",title:"Tag updated"})))),(e,t)=>e.pipe((0,z.p)(e$.updateComplete.match),(0,E.E)(t),(0,T.Z)(([e,t])=>{let{tag:a}=e.payload,i=t.search.facets?.find(e=>"tag"===e.name),s=t.tags.byIds[a._id];return i?.type==="searchable"&&i.value?.value===a._id?(0,b.of)(eR.actions.facetsUpdate({name:"tag",value:{label:s?.tag?.name?.current,value:s?.tag?._id}})):v.w})),(e,t,{client:a})=>e.pipe((0,z.p)(ez.actions.createRequest.match),(0,E.E)(t),(0,T.Z)(([e,t])=>{let{assetId:i,name:s}=e.payload;return(0,b.of)(e).pipe(ev(t.debug.badConnection),eC(a,s),(0,T.Z)(()=>a.observable.create({_type:ej,name:{_type:"slug",current:s}})),(0,T.Z)(e=>(0,b.of)(ez.actions.createComplete({assetId:i,tag:e}))),(0,_.W)(e=>(0,b.of)(ez.actions.createError({error:{message:e?.message||"Internal error",statusCode:e?.statusCode||500},name:s}))))})),(e,t,{client:a})=>e.pipe((0,z.p)(ez.actions.deleteRequest.match),(0,E.E)(t),(0,T.Z)(([e,t])=>{let{tag:i}=e.payload;return(0,b.of)(e).pipe(ev(t.debug.badConnection),(0,T.Z)(()=>a.observable.fetch((0,D.A)`*[
204              _type in ["sanity.fileAsset", "sanity.imageAsset"]
205              && references(*[_type == "media.tag" && name.current == $tagName]._id)
206            ] {
207              _id,
208              _rev,
209              opt
210            }`,{tagName:i.name.current})),(0,T.Z)(e=>{let t=e.map(e=>({id:e._id,patch:{ifRevisionID:e._rev,unset:[`opt.media.tags[_ref == "${i._id}"]`]}})).reduce((e,t)=>
210e.patch(t.id,t.patch),a.transaction());return t.delete(i._id),(0,j.H)(t.commit())}),(0,T.Z)(()=>(0,b.of)(ez.actions.deleteComplete({tagId:i._id}))),(0,_.W)(e=>(0,b.of)(ez.actions.deleteError({error:{message:e?.message||"Internal error",statusCode:e?.statusCode||500},tag:i}))))})),(e,t,{client:a})=>e.pipe((0,z.p)(ez.actions.fetchRequest.match),(0,E.E)(t),(0,A.n)(([e,t])=>{let{query:i}=e.payload;return(0,b.of)(e).pipe(ev(t.debug.badConnection),(0,T.Z)(()=>a.observable.fetch(i)),(0,T.Z)(e=>{let{items:t}=e;return(0,b.of)(ez.actions.fetchComplete({tags:t}))}),(0,_.W)(e=>(0,b.of)(ez.actions.fetchError({error:{message:e?.message||"Internal error",statusCode:e?.statusCode||500}}))))})),e=>e.pipe((0,z.p)(ez.actions.listenerCreateQueue.match),(0,$.w)(2e3),(0,z.p)(e=>e.length>0),(0,T.Z)(e=>{let t=e?.map(e=>e.payload.tag);return(0,b.of)(ez.actions.listenerCreateQueueComplete({tags:t}))})),e=>e.pipe((0,z.p)(ez.actions.listenerDeleteQueue.match),(0,$.w)(2e3),(0,z.p)(e=>e.length>0),(0,T.Z)(e=>{let t=e?.map(e=>e.payload.tagId);return(0,b.of)(ez.actions.listenerDeleteQueueComplete({tagIds:t}))})),e=>e.pipe((0,z.p)(ez.actions.listenerUpdateQueue.match),(0,$.w)(2e3),(0,z.p)(e=>e.length>0),(0,T.Z)(e=>{let t=e?.map(e=>e.payload.tag);return(0,b.of)(ez.actions.listenerUpdateQueueComplete({tags:t}))})),e=>e.pipe((0,f.gp)(ez.actions.listenerCreateQueueComplete.type,ez.actions.listenerUpdateQueueComplete.type),(0,$.w)(1e3),(0,z.p)(e=>e.length>0),(0,T.Z)(()=>(0,b.of)(ez.actions.sort()))),(e,t,{client:a})=>e.pipe((0,z.p)(ez.actions.updateRequest.match),(0,E.E)(t),(0,T.Z)(([e,t])=>{let{closeDialogId:i,formData:s,tag:r}=e.payload;return(0,b.of)(e).pipe(ev(t.debug.badConnection),eC(a,s?.name?.current),(0,T.Z)(()=>(0,j.H)(a.patch(r._id).set({name:{_type:"slug",current:s?.name.current}}).commit())),(0,T.Z)(e=>(0,b.of)(ez.actions.updateComplete({closeDialogId:i,tag:e}))),(0,_.W)(e=>(0,b.of)(ez.actions.updateError({error:{message:e?.message||"Internal error",statusCode:e?.statusCode||500},tag:r}))))})),(e,t,{client:a})=>e.pipe((0,z.p)(af.uploadStart.match),(0,T.Z)(t=>{let{file:i,uploadItem:s}=t.payload;return(0,I.h)((0,b.of)(null).pipe((0,T.Z)(()=>(0,b.of)(null).pipe((0,T.Z)(()=>(0,j.H)(ad(i))))),(0,T.Z)(e=>(0,b.of)(af.previewReady({blobUrl:e,hash:s.hash})))),(0,b.of)(null).pipe((0,T.Z)(()=>ah(a,s.assetType,i,s.hash)),(0,U.Q)(e.pipe((0,z.p)(af.uploadCancel.match),(0,z.p)(e=>e.payload.hash===s.hash))),(0,T.Z)(e=>e?.type==="complete"?(0,b.of)(eO.uploadComplete({asset:e.asset})):e?.type==="progress"&&e?.stage==="upload"?(0,b.of)(af.uploadProgress({event:e,uploadHash:s.hash})):(0,v.I)()),(0,_.W)(e=>(0,b.of)(af.uploadError({error:{message:e?.message||"Internal error",statusCode:e?.statusCode||500},hash:s.hash})))))})),(e,t)=>e.pipe((0,z.p)(af.uploadRequest.match),(0,E.E)(t),(0,T.Z)(([e,t])=>{let{file:a,forceAsAssetType:i}=e.payload;return(0,b.of)(e).pipe((0,T.Z)(()=>(e=>window.crypto&&window.crypto.subtle&&window.FileReader?new C.c(t=>{let a=new FileReader;return a.onload=()=>{t.next(a.result),t.complete()},a.onerror=e=>{t.error(e)},a.readAsArrayBuffer(e),()=>{a.abort()}}).pipe((0,T.Z)(e=>window.crypto.subtle.digest("SHA-1",e)),(0,L.T)(au)):(0,x.$)({message:"Unable to generate hash: uploads are only allowed in secure contexts",statusCode:500}))(a)),(0,z.p)(e=>!t.uploads.byIds[e]),(0,T.Z)(e=>{let t={_type:"upload",assetType:i||(a.type.indexOf("image")>=0?"image":"file"),hash:e,name:a.name,size:a.size,status:"queued"};return(0,b.of)(af.uploadStart({file:a,uploadItem:t}))}))})),(e,t,{client:a})=>e.pipe((0,z.p)(af.checkRequest.match),(0,E.E)(t),(0,T.Z)(([e,t])=>{let{assets:i}=e.payload,s=i.map(e=>e._id),r=ew({assetTypes:t.assets.assetTypes,searchFacets:t.search.facets,searchQuery:t.search.query}),n=(0,D.A)`
211        *[${r} && _id in $documentIds].sha1hash
212      `;return(0,b.of)(e).pipe((0,k.c)(1e3),(0,T.Z)(()=>a.observable.fetch(n,{documentIds:s})),(0,T.Z)(e=>{let t=i.reduce((t,a)=>(t[a.sha1hash]=e.includes(a.sha1hash)?a._id:null,t),{});return(0,b.of)(af.checkComplete({results:t}),eQ.insertUploads({results:t}))}))})),e=>e.pipe((0,z.p)(eO.uploadComplete.match),(0,T.Z)(e=>(0,b.of)(af.checkRequest({assets:[e.payload.asset]}))))),aN=(0,m.HY)({assets:eV,debug:tf,dialog:eX,notifications:aM,search:eD,selected:aq,tags:eS,uploads:ay}),aP=(e,t=[])=>
212(Array.isArray(e)&&e.forEach(e=>{aP(e,t)}),(e=>null!==e&&"object"==typeof e&&!Array.isArray(e))(e)&&(e?.asset?._type==="reference"&&e?.asset?._ref&&t.push(e.asset._ref),Object.values(e).forEach(e=>{aP(e,t)})),t);class aQ extends d.Component{store;constructor(e){super(e);let t=(0,f.Cw)({dependencies:{client:e.client}});this.store=(0,u.U1)({reducer:aN,middleware:e=>e({serializableCheck:!1,thunk:!1}).prepend(t),devTools:!0,preloadedState:{assets:{...eq,assetTypes:!function(e){return!!e&&ef.includes(e)}(e?.assetType)?["file","image"]:[e.assetType]},debug:{badConnection:!1,enabled:!1},dialog:{items:[]},notifications:{items:[]},search:{facets:[],query:""},selected:{assets:e.selectedAssets||[],document:e.document,documentAssetIds:e.document?[...new Set(aP(e.document).sort())]:[]},tags:{allIds:[],byIds:{},creating:!1,fetchCount:-1,fetching:!1,panelVisible:!0},uploads:{allIds:[],byIds:{}}}}),t.run(aY)}render(){return(0,s.jsx)(p.Kq,{store:this.store,children:this.props.children})}}let aV=()=>ec(e=>e.tags.panelVisible)?(0,s.jsx)(l.az,{style:{position:"relative",width:250},children:(0,s.jsx)(l.az,{className:"media__custom-scrollbar",style:{borderLeft:"1px solid var(--card-border-color)",height:"100%",overflowX:"hidden",overflowY:"auto",position:"absolute",right:0,top:0,width:"100%"},children:(0,s.jsx)(t6,{})})}):null,aH=c.I4.div`
213  color: white;
214  height: 100%;
215  min-height: 100%;
216  right: 0;
217  top: 0;
218  width: 100%;
219
220  &:focus {
221    outline: none;
222  }
223`,aW=c.I4.div`
224  align-items: center;
225  background: rgba(0, 0, 0, 0.75);
226  display: flex;
227  height: 100%;
228  justify-content: center;
229  position: absolute;
230  right: 0;
231  top: 0;
232  width: 100%;
233  z-index: 3;
234`;async function aX(e){let t=Array.from(e),a=[];for(let e of t)try{await e.slice(0,1).arrayBuffer(),a.push(e)}catch{}return a}let aJ=e=>{let{children:t}=e,{dropzone:{maxSize:a},directUploads:i}=td(),{onSelect:r}=en(),n=(0,p.wA)(),o=ec(e=>e.assets.assetTypes),d=1===o.length&&"image"===o[0],c=async e=>{e.forEach(e=>n(af.uploadRequest({file:e,forceAsAssetType:1===o.length?o[0]:void 0})))},u=async e=>{let t;if("drop"===e.type&&"dataTransfer"in e&&(t=e?.dataTransfer?.files),"change"===e.type){let a=e?.target;a?.files&&(t=a.files)}if(!t)return[];let a=await aX(t);return t?.length!==a.length&&n(aB.add({status:"error",title:"Unable to upload some items (folders and packages aren't supported)"})),a},{getRootProps:h,getInputProps:m,isDragActive:g,open:f}=(0,ee.VB)({accept:d?"image/*":"",getFilesFromEvent:u,noClick:!0,noDrag:!!r,onDrop:c,maxSize:a,onDropRejected:e=>{e.flatMap(({errors:e})=>e.map(({code:e})=>e)).includes("file-too-large")&&n(aB.add({status:"error",title:"One or more files exceed the maximum upload size."}))},disabled:!i});return(0,s.jsx)(at,{open:f,children:(0,s.jsxs)(aH,{...h(),children:[(0,s.jsx)("input",{...m()}),g&&(0,s.jsx)(aW,{children:(0,s.jsx)(l.so,{direction:"column",justify:"center",style:{color:F.ON.hex},children:(0,s.jsx)(l.EY,{size:3,style:{color:"inherit"},children:"Drop files to upload"})})}),t]})})},aK=({onClose:e,schemaType:t})=>{let a=el(),[i,r]=(0,d.useState)(null);return function(e,t){let a=(0,p.wA)(),i=(0,p.d4)(e=>e.tags.byIds),s=(0,p.d4)(e=>e.tags.fetchCount),r=function(e){let t=e?.options?.mediaTags;return t?.length?Array.from(new Set(t.map(e=>e?.trim()).filter(e=>!!e?.length))):[]}(t),n=r.length>0;(0,d.useEffect)(()=>{n||a(eU.facetsClear()),a(e$.fetchRequest());let t=e.listen((0,D.A)`*[_type in ["sanity.fileAsset", "sanity.imageAsset"] && !(_id in path("drafts.**"))]`).subscribe(e=>{let{documentId:t,result:i,transition:s}=e;switch(s){case"appear":a(eQ.listenerCreateQueue({asset:i}));break;case"disappear":a(eQ.listenerDeleteQueue({assetId:t}));break;case"update":a(eQ.listenerUpdateQueue({asset:i}))}}),i=e.listen((0,D.A)`*[_type == "${ej}" && !(_id in path("drafts.**"))]`).subscribe(e=>{let{documentId:t,result:i,transition:s}=e;switch(s){case"appear":a(e$.listenerCreateQueue({tag:i}));break;case"disappear":a(e$.listenerDeleteQueue({tagId:t}));break;case"update":a(e$.listenerUpdateQueue({tag:i}))}});return()=>{t.unsubscribe(),i.unsubscribe()}},[e,a,n]),(0,d.useEffect)(()=>
234{if(!n||s<0)return;let e=em.tag;if("searchable"!==e.type)return;let t=r.map(e=>Object.values(i).find(t=>t.tag.name.current===e)).filter(e=>!!e);for(let i of(a(eU.facetsClear()),t))a(eU.facetsAdd({facet:{...e,operatorType:"references",value:{label:i.tag.name.current,value:i.tag._id}}}))},[s,n])}(a,t),(0,s.jsx)(l.GD,{element:i,children:(0,s.jsxs)(aJ,{children:[(0,s.jsx)(t9,{}),(0,s.jsx)(aO,{}),(0,s.jsx)(l.Zp,{display:"flex",height:"fill",ref:r,children:(0,s.jsxs)(l.so,{direction:"column",flex:1,children:[(0,s.jsx)(aa,{onClose:e}),(0,s.jsx)(th,{}),(0,s.jsxs)(l.so,{flex:1,children:[(0,s.jsxs)(l.so,{align:"flex-end",direction:"column",flex:1,style:{position:"relative"},children:[(0,s.jsx)(aZ,{}),(0,s.jsx)(aD,{})]}),(0,s.jsx)(aV,{})]}),(0,s.jsx)(ty,{})]})})]})})},aG=e=>{let t=el();return(0,s.jsx)(aQ,{assetType:e?.assetType,client:t,document:e?.document,selectedAssets:e?.selectedAssets,children:(0,s.jsxs)(er,{onSelect:e?.onSelect,children:[(0,s.jsx)(ed,{}),(0,s.jsx)(aK,{onClose:e?.onClose,schemaType:e?.schemaType})]})})};var a0={title:"Media Tag",icon:tp,name:ej,type:"document",fields:[{title:"Name",name:"name",type:"slug"}],preview:{select:{name:"name"},prepare(e){let{name:t}=e;return{media:tp,title:t?.current}}}};let a1={icon:n.xfq,name:"media",title:"Media"},a2={...a1,component:e=>{let{onClose:t}=e,a=(()=>{let[e]=(0,d.useState)(()=>document.createElement("div"));return(0,d.useEffect)(()=>(e.classList.add("media-portal"),document.body.appendChild(e),()=>{document.body.removeChild(e)}),[e]),e})(),i=(0,r.FlV)([]);ei("escape",t);let n=e=>{e.nativeEvent.stopImmediatePropagation(),e.stopPropagation()},{zIndex:o}=(0,l.Z4)();return(0,s.jsx)(l.GD,{element:a,children:(0,s.jsx)(l.ZL,{children:(0,s.jsx)(l.az,{onDragEnter:n,onDragLeave:n,onDragOver:n,onDrop:n,onMouseUp:n,style:{bottom:0,height:"auto",left:0,position:"fixed",top:0,width:"100%",zIndex:o},children:(0,s.jsx)(aG,{document:i,schemaType:e.schemaType,...e})})})})}},a3={...a1,component:()=>(0,s.jsx)(l.so,{direction:"column",height:"fill",flex:1,children:(0,s.jsx)(aG,{})}),__internalApplicationType:"sanity/media"},a5=(0,r.bzQ)(e=>({name:"media",studio:{components:{layout:t=>(0,s.jsx)(to,{options:e,children:t.renderDefault(t)})}},form:{file:{assetSources:e=>[...e,a2]},image:{assetSources:e=>[...e,a2]}},schema:{types:[a0]},tools:e=>[...e,a3]}))}}]);

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