@manifest-editor/exhibition-preset 2.0.2 → 2.0.3-next.0.2f3498a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@manifest-editor/manifest-preset`);c=s(c);let l=require(`@manifest-editor/shell`),u=require(`@manifest-editor/editors`),d=require(`react-iiif-vault`),f=require(`zustand`),p=require(`react/jsx-runtime`),m=require(`@manifest-editor/manifest-preset/components`),h=require(`react`),g=require(`@manifest-editor/components`),_=require(`exhibition-viewer`),v=require(`exhibition-viewer/library`),y=require(`react-aria-components`),b=require(`tailwind-merge`),x=require(`tiny-invariant`);x=s(x);let S=require(`@manifest-editor/creator-api`),C=require(`@manifest-editor/creators`),w=require(`@iiif/parser`),T=require(`@dnd-kit/core`),ee=require(`@dnd-kit/modifiers`),E=require(`@dnd-kit/sortable`),te=require(`@dnd-kit/utilities`),D=require(`@iiif/helpers`);const O={id:`@exhibition/tour-step-annotations`,label:`Tour steps`,render:()=>(0,p.jsx)(k,{})};function k(){let e=(0,d.useCanvas)(),t=(0,f.useStore)((0,l.useAtlasStore)(),e=>e.tool.enabled),{rightPanel:n}=(0,l.useLayoutState)(),r=n.current===`@manifest-editor/editor`&&n.state?.currentTab?.startsWith(`@exhibition/tour-steps`),i=e?.annotations[0];return!r||!e||t||!i?null:(0,p.jsx)(p.Fragment,{children:(0,p.jsx)(d.AnnotationPageContext,{annotationPage:i.id,children:(0,p.jsx)(u.ViewerAnnotationPage,{})})})}const A={id:`@exhibitions/center-panel`,label:`Exhibition editor`,icon:null,render:()=>(0,p.jsx)(ne,{}),options:{minWidth:350,maxWidth:350}};function ne(){let e=(0,d.useManifest)(),t=(0,d.useVault)(),[n,r]=(0,h.useState)(.8),i=(0,h.useRef)(null),{edit:a,leftPanel:o}=(0,l.useLayoutActions)(),s=(0,h.useMemo)(()=>({localeStringEditor:e=>(0,p.jsxs)(`span`,{className:`inline-flex items-center hover:ring-4 hover:ring-me-primary-500`,children:[e.original,(0,p.jsx)(y.Button,{className:`py-1 px-2 inline-block`,onPress:()=>a(e.resource),children:(0,p.jsx)(g.EditTextIcon,{className:`text-xl`})})]}),canvasPreviewEditor:e=>(0,p.jsxs)(`div`,{className:`w-full h-full flex-1 flex relative`,children:[e.original,(0,p.jsx)(`button`,{onClick:t=>{t.preventDefault(),t.stopPropagation(),a(e.resource),o.open({id:`canvas-listing`,open:!0})},className:`absolute top-5 right-5 bg-white text-black p-2 rounded z-40`,children:`EDIT`})]})}),[]);return(0,h.useLayoutEffect)(()=>{if(i.current){let e=i.current.offsetWidth/1200;r(Math.max(1,e))}},[]),e?(0,p.jsx)(`div`,{ref:i,className:`overflow-y-auto delft-exhibition`,children:(0,p.jsx)(v.EditorHooksProvider,{hooks:s,children:(0,p.jsx)(_.DelftExhibition,{skipLoadManifest:!0,customVault:t,manifest:e.id,options:{disablePresentation:!0,hideTableOfContents:!0,hideTitle:!0,alternativeImageMode:!0}},n)})}):null}const j={id:`@exhibitions/overview-panel`,label:``,icon:(0,p.jsx)(`div`,{className:`hidden hover:block`,children:`👀`}),render:()=>(0,p.jsx)(re,{})};function re(){return(0,d.useManifest)()?(0,p.jsx)(`div`,{children:`Coming soon.`}):null}const ie={id:`exhibition-background-task`,label:`Query string`,render:()=>(0,p.jsx)(ae,{})};function ae(){console.log(`rendering?`);let e=(0,d.useManifest)();(0,u.useInStack)(`Canvas`);let{leftPanel:t,rightPanel:n}=(0,l.useLayoutState)(),{edit:r,leftPanel:i,rightPanel:a,centerPanel:o}=(0,l.useLayoutActions)(),{canvasActions:s,open:c}=(0,m.useEditCanvasItems)(),{editorFeatureFlags:{rememberCanvasId:f=!0,rememberLeftPanelId:p=!1}={}}=(0,l.useConfig)();return t.open,(0,h.useEffect)(()=>{e&&t.current===j.id&&(r(e),o.open({id:A.id}),i.close())},[t.current]),null}const oe={"h-1":`lg:min-h-[100px] row-span-1`,"h-2":`lg:min-h-[200px] row-span-2`,"h-3":`lg:min-h-[300px] row-span-3`,"h-4":`lg:min-h-[400px] row-span-4`,"h-5":`lg:min-h-[500px] row-span-5`,"h-6":`lg:min-h-[600px] row-span-6`,"h-7":`lg:min-h-[700px] row-span-7`,"h-8":`lg:min-h-[800px] row-span-8`,"h-9":`lg:min-h-[900px] row-span-9`,"h-10":`lg:min-h-[1000px] row-span-10`,"h-11":`lg:min-h-[1100px] row-span-11`,"h-12":`lg:min-h-[1200px] row-span-12`},se={"h-1":`lg:min-h-[25px] row-span-1`,"h-2":`lg:min-h-[50px] row-span-2`,"h-3":`lg:min-h-[75px] row-span-3`,"h-4":`lg:min-h-[100px] row-span-4`,"h-5":`lg:min-h-[125px] row-span-5`,"h-6":`lg:min-h-[150px] row-span-6`,"h-7":`lg:min-h-[175px] row-span-7`,"h-8":`lg:min-h-[200px] row-span-8`,"h-9":`lg:min-h-[225px] row-span-9`,"h-10":`lg:min-h-[250px] row-span-10`,"h-11":`lg:min-h-[275px] row-span-11`,"h-12":`lg:min-h-[300px] row-span-12`},ce={"w-1":`col-span-1`,"w-2":`col-span-2`,"w-3":`col-span-3`,"w-4":`col-span-4`,"w-5":`col-span-5`,"w-6":`col-span-6`,"w-7":`col-span-7`,"w-8":`col-span-8`,"w-9":`col-span-9`,"w-10":`col-span-10`,"w-11":`col-span-11`,"w-12":`col-span-12`};function le(e){let{isLeft:t,isRight:n,isBottom:r}=N(e),i=e?.find(e=>e.includes(`h-`)),a=e?.find(e=>e.includes(`w-`));if(!i||!a)return{h:0,w:0,ratio:1};let o={h:Number.parseInt(i.split(`-`)[1]),w:Number.parseInt(a.split(`-`)[1]),ratio:1};return(t||n)&&(o.w*=2/3),r&&(o.h*=2/3),o.h&&o.w&&(o.ratio=o.w/o.h),o}function M(e,t=!1,n=!0){(!e||e.length===0)&&(e=[`h-8`,`w-8`,`image`]);let r=e.find(e=>e.includes(`h-`)),i=e.find(e=>e.includes(`w-`)),a=[];return t&&r===`h-4`&&(r=`h-8`),a.push(n?se[r]:oe[r]),a.push(ce[i]),a.join(` `)}function N(e){let t=e?.includes(`right`),n=e?.includes(`left`),r=e?.includes(`bottom`),i=e?.includes(`top`),a=e?.includes(`image`)||!n&&!t&&!r&&!i;return{isRight:t,isLeft:n,isBottom:r,isTop:i,isInfo:e?.includes(`info`),isImage:a}}function P(e){if(!e)return!1;let t=e.behavior||[];if(t.includes(`image`)||t.includes(`info`))return!0;for(let e of t)if(e.startsWith(`w-`)||e.startsWith(`h-`))return!0;return!1}const F={id:`image-block-editor`,label:`Image Block Editor`,component:e=>(0,p.jsx)(I,{strategy:e}),supports:{strategy:(e,t,n)=>{if(e.type!==`images`)return!1;let r=n.get(t.resource);if(r.type!==`Canvas`)return!1;let i=r.behavior||[],a=!1;for(let e of i)(e.startsWith(`w-`)||e.startsWith(`h-`)||e===`image`)&&(a=!0);return a}}};function I({strategy:e}){let[t,n]=(0,l.useLocalStorage)(`exhibition-preview-mode`),r=(0,u.useInStack)(`Canvas`);return r?(0,p.jsxs)(d.CanvasContext,{canvas:r.resource.source?.id,children:[(0,p.jsxs)(`div`,{className:`flex gap-4 bg-me-500 py-2 px-4 text-white shadow-md z-40 ring-1 ring-me-500 items-center`,children:[`Switch view`,(0,p.jsx)(g.ActionButton,{onPress:()=>n(!t),children:t?`Full canvas`:`Layout preview`})]}),t?(0,p.jsx)(L,{}):(0,p.jsx)(`div`,{className:`h-full flex flex-1 min-h-0`,children:(0,p.jsx)(u.CanvasPanelEditor,{asFallback:!0})})]}):null}function L(){let e=(0,h.useRef)(null),t=(0,d.useCanvas)(),n=M(t?.behavior||[],!1,!1),{isBottom:r,isImage:i,isInfo:a,isLeft:o}=N(t?.behavior),[s,c]=(0,h.useState)(1);return(0,h.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=t.offsetWidth;c(n/1200)},[t]),(0,p.jsx)(`div`,{className:`overflow-hidden h-full w-full`,ref:e,children:(0,p.jsx)(`div`,{className:`grid grid-cols-12 grid-rows-12 h-full bg-white`,children:(0,p.jsxs)(`div`,{className:(0,b.twMerge)(n,`flex h-full max-h-full min-h-0 ring-4 ring-black`,o?`flex-row-reverse`:r?`flex-col`:`flex-row`),children:[(0,p.jsx)(`div`,{className:`flex-1 h-full flex min-w-0`,children:(0,p.jsx)(u.CanvasPanelEditor,{asFallback:!0})}),i?null:(0,p.jsx)(`div`,{className:`${r?`min-h-3 w-full`:`w-1/3`} flex-shrink-0 self-stretch text-white bg-black rounded p-8 relative h-full`,children:(0,p.jsxs)(`div`,{style:{fontSize:`${s*16}px`},children:[(0,p.jsx)(d.LocaleString,{className:`block mb-4`,children:t?.label}),(0,p.jsx)(d.LocaleString,{children:t?.summary})]})})]})})})}const R={id:`info-block-editor`,label:`info Block Editor`,component:e=>(0,p.jsx)(z,{strategy:e}),supports:{strategy:(e,t,n)=>e.type===`textual-content`}};function z(e){let t=(0,d.useCanvas)(),n=(0,d.useVaultSelector)((e,n)=>n.get(t?.items[0])),r=(0,d.useVaultSelector)((e,n)=>t?.annotations[0]?n.get(t?.annotations[0]):null);return(0,p.jsxs)(`div`,{className:`overflow-y-auto bg-white shadow`,children:[(0,p.jsx)(`div`,{className:`mb-12`,children:n.items.map((e,t)=>(0,p.jsx)(d.AnnotationContext,{annotation:e.id,children:(0,p.jsx)(B,{})},e.id+t))}),r?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`h2`,{className:`text-2xl font-bold px-4 border-t border-gray-200 pt-4 mb-4`,children:`Long Summaries`}),(0,p.jsx)(`p`,{className:`my-4 px-4`,children:`Long summaries are used to provide more detailed information about the canvas. They appear when the user clicks "read more" in the exhibition.`}),r.items.map((e,t)=>(0,p.jsx)(d.AnnotationContext,{annotation:e.id,children:(0,p.jsx)(B,{})},e.id+t))]}):null]})}function B(){let e=(0,d.useAnnotation)(),t=(0,l.useInlineCreator)(),n=e?.body||[],r=(0,l.useGenericEditor)(e);return e?(0,p.jsxs)(`div`,{children:[n.map((e,t)=>(0,p.jsx)(u.AnnotationBodyEditor,{className:`p-4 hover:bg-me-100/40 focus-within:bg-me-100/40`,resourceId:e.id,onRemove:()=>r.annotation.body.deleteAtIndex(t)},t)),(0,p.jsx)(`div`,{className:`p-4`,children:(0,p.jsx)(g.ActionButton,{primary:!0,onPress:()=>{t.create(`@manifest-editor/html-body-creator`,{language:`en`,value:``},{targetType:`ContentResource`,parent:{property:`body`,resource:{id:e.id,type:`Annotation`}},initialData:{}})},children:`Add new annotation`})})]}):null}const V={id:`youtube-main-editor`,label:`YouTube main editor`,component:e=>e.type===`media`?(0,p.jsx)(H,{strategy:e,video:e.media}):null,supports:{strategy:(e,t,n)=>(console.log(e),!(e.type!==`media`||e.media.type!==`VideoYouTube`))}};function H({strategy:e,video:t}){let{edit:n}=(0,l.useLayoutActions)(),r=(0,d.useCanvas)(),i=(0,d.useVaultSelector)((e,t)=>t.get(r?.items[0]).items[0]);(0,x.default)(r&&i);let a=(0,h.useRef)(null),o=(0,l.useGenericEditor)(i),s=t,c=(r.width||1)/(r.height||1);return`${s.youTubeId}`,(0,p.jsxs)(`div`,{className:`overflow-y-auto`,children:[(0,p.jsx)(`div`,{className:`p-8`,children:(0,p.jsx)(`div`,{className:`bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto`,style:{aspectRatio:c},children:(0,p.jsx)(`iframe`,{title:`YouTube video`,className:`border-none w-full h-full object-contain`,ref:a,src:`https://www.youtube.com/embed/${s.youTubeId}?enablejsapi=1&origin=${window.location.host}&modestbranding=1&rel=0`,referrerPolicy:`no-referrer compute-pressure`,sandbox:`allow-scripts allow-same-origin allow-presentation`})})}),(0,p.jsxs)(`div`,{className:`bg-white shadow w-full p-8 flex gap-8`,children:[(0,p.jsx)(`div`,{children:(0,p.jsx)(`div`,{className:`w-64 bg-black flex-shrink-0 flex items-center justify-center rounded overflow-clip`,style:{aspectRatio:c},children:r.thumbnail?.length?(0,p.jsx)(g.LazyThumbnail,{cover:!0}):(0,p.jsx)(`div`,{className:`text-white/50 text-center py-16`,children:`No thumbnail`})})}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(d.LocaleString,{as:`h3`,className:`text-2xl font-bold mt-4`,defaultText:(0,p.jsx)(`span`,{className:`text-black/30`,children:`No Label`}),children:o.descriptive.label.get()}),(0,p.jsx)(d.LocaleString,{as:`p`,className:`mt-2 mb-8`,defaultText:(0,p.jsx)(`span`,{className:`text-black/30`,children:`No summary`}),children:o.descriptive.summary.get()}),(0,p.jsx)(g.ActionButton,{onPress:()=>n(o.ref()),children:`Edit properties`})]})]})]})}const U=(0,S.defineCreator)({...C.iiifBrowserCreator,id:`@exhibitions/browser-creator`,create:W,tags:[`image`,`exhibition-slide`],label:`IIIF Browser`,summary:`Browse IIIF Resources`});async function W(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i={width:0,height:0},a=await(0,S.creatorHelper)(t,{id:r,type:`AnnotationPage`},`items`,`@manifest-editor/iiif-browser-creator`)({...e,trackSize({width:e,height:t}){i.height=t,i.width=e}},{targetType:`Annotation`,target:{id:n,type:`Canvas`}});return await(0,S.creatorHelper)(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:i.width,height:i.height,type:`default`,items:a})}const ue=(0,S.defineCreator)({...C.imageServiceCreator,id:`@exhibitions/image-service-creator`,create:de,tags:[`image`,`exhibition-slide`],label:`IIIF Image`,summary:`IIIF Image service`,resourceType:`Canvas`,supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function de(e,t){let n=t.generateId(`canvas`);t.generateId(`annotation-page`,{id:n,type:`Canvas`});let r=await(0,S.creatorHelper)(t,{id:t.generateId(`annotation`),type:`Annotation`},`body`,`@manifest-editor/image-service-creator`)(e,{target:{id:n,type:`Canvas`}}),{width:i,height:a}=r.get(),o=t.embed({id:t.generateId(`annotation`),type:`Annotation`,motivation:`painting`,body:[r],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}});return await(0,S.creatorHelper)(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:i,height:a,type:`default`,items:[o]})}const G=(0,S.defineCreator)({id:`@exhibitions/image-slide-creator`,create:K,label:`Empty slide`,summary:`An empty image slide.`,icon:(0,p.jsx)(g.EmptyCanvasIcon,{}),tags:[`exhibition-slide`],resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}}),fe=(0,S.defineCreator)({...G,id:`@exhibitions/image-slide-creator-left`,label:`Image (Left)`,summary:`An image with text on the left.`,icon:(0,p.jsx)(`div`,{children:`IMAGE (LEFT)`}),create:(e,t)=>K({...e,type:`left`},t)}),pe=(0,S.defineCreator)({...G,id:`@exhibitions/image-slide-creator-right`,label:`Image (Right)`,summary:`An image with text on the right.`,icon:(0,p.jsx)(`div`,{children:`IMAGE (RIGHT)`}),create:(e,t)=>K({...e,type:`right`},t)}),me=(0,S.defineCreator)({...G,id:`@exhibitions/image-slide-creator-bottom`,label:`Image (Bottom)`,summary:`An image with text at the bottom.`,icon:(0,p.jsx)(`div`,{children:`IMAGE (BOTTOM)`}),create:(e,t)=>K({...e,type:`bottom`},t)});function K(e,t){let n=e.canvasId||t.generateId(`Canvas`),r=t.generateId(`AnnotationPage`,{id:n,type:`Canvas`}),i=t.generateId(`AnnotationPage`,{id:n,type:`Canvas`}),a=[],o=6e3;if(e.width&&e.height)if(e.width>e.height){let t=e.width/12,n=`h-${Math.floor(e.height/t)}`;a.push(`w-12`,n)}else{let t=e.height/12,n=`w-${Math.floor(e.width/t)}`;a.push(n,`h-12`)}else a.push(`w-12`,`h-4`);switch(e.type){case`left`:a.push(`left`),o*=2/3;break;case`right`:a.push(`right`),o*=2/3;break;case`bottom`:a.push(`bottom`);break}return e.items?.length||a.push(`multi-image`),t.embed({...w.emptyCanvas,id:n,behavior:a,label:e.label||{en:[`Untitled`]},height:e.height||2e3,duration:e.duration,width:e.width||o,items:[t.embed({...w.emptyAnnotationPage,id:r,type:`AnnotationPage`,items:e.items?e.items:[]})],annotations:[t.embed({...w.emptyAnnotationPage,id:i,type:`AnnotationPage`,items:[]})]})}const he=(0,S.defineCreator)({...C.imageUrlCreator,id:`@exhibitions/image-url-creator`,create:ge,tags:[`exhibition-slide`],label:`Image`,summary:`Image from URL`,resourceType:`Canvas`,supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function ge(e,t){let n=t.generateId(`canvas`);t.generateId(`annotation-page`,{id:n,type:`Canvas`});let r=t.generateId(`annotation`),i=await(0,S.creatorHelper)(t,{id:r,type:`Annotation`},`body`,`@manifest-editor/image-url-creator`)(e,{target:{id:n,type:`Canvas`},targetType:`Annotation`}),{width:a,height:o}=i.get(),s=t.embed({id:r,type:`Annotation`,motivation:`painting`,body:[i],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}});return await(0,S.creatorHelper)(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:a,height:o,type:`default`,items:[s]})}const _e=(0,S.defineCreator)({id:`@exhibitions/info-box-creator`,create:ve,label:`Info box`,summary:`A text panel for an exhibition`,icon:(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,children:[(0,p.jsx)(`title`,{children:`Info box`}),(0,p.jsx)(`path`,{fill:`currentColor`,d:`M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22`})]}),tags:[`exhibition-slide`],resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function ve(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),a={...w.emptyAnnotation,id:t.generateId(`annotation`,{id:n,type:`Canvas`}),type:`Annotation`},o=[await t.create(`@manifest-editor/html-body-creator`,{language:`en`,body:``},{parent:{resource:a,property:`body`}})],s=t.embed({...a,motivation:`painting`,body:o,target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}}),c=t.generateId(`annotation`,{id:n,type:`Canvas`}),l=t.embed({id:c,type:`Annotation`,motivation:`tagging`,body:[await t.create(`@manifest-editor/html-body-creator`,{language:`en`,body:``},{parent:{resource:{id:c,type:`Annotation`},property:`body`}})],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}}),u=t.embed({id:r,type:`AnnotationPage`,items:[s]}),d=t.embed({id:i,type:`AnnotationPage`,items:[l]});return t.embed({...w.emptyCanvas,id:n,type:`Canvas`,behavior:[`w-4`,`h-4`,`info`],label:e.label||void 0,height:e.height||1e3,width:e.width||1e3,items:[u],annotations:[d]})}const ye=(0,S.defineCreator)({...C.videoAnnotation,id:`@exhibitions/video-creator`,create:be,tags:[`video`,`exhibition-slide`],label:`Video`,summary:`A video for an exhibition`,resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function be(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i=await t.create(`@manifest-editor/video-annotation`,e,{target:{id:n,type:`Canvas`},targetType:`Annotation`,parent:{resource:{id:r,type:`AnnotationPage`},property:`items`}});return t.embed({id:r,type:`AnnotationPage`,items:[i]}),await(0,S.creatorHelper)(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,height:e.height||1080,width:e.width||1920,duration:e.duration,type:`bottom`,items:[i]})}const xe=(0,S.defineCreator)({...C.youTubeBodyCreator,id:`@exhibitions/youtube-creator`,create:Se,tags:[`video`,`exhibition-slide`],label:`YouTube`,summary:`A YouTube for an exhibition`});async function Se(e,t){let n=(0,u.getYouTubeId)(e.youtubeUrl),r=t.generateId(`canvas`),i=t.generateId(`annotation-page`,{id:r,type:`Canvas`}),a=await t.create(`@manifest-editor/youtube`,e,{target:{id:r,type:`Canvas`},targetType:`Annotation`,parent:{resource:{id:i,type:`AnnotationPage`},property:`items`}}),o=t.embed({id:i,type:`AnnotationPage`,items:[a]}),s=t.embed({id:`https://img.youtube.com/vi/${n}/maxresdefault.jpg`,type:`Image`,format:`image/jpeg`,width:640,height:360});return t.embed({...w.emptyCanvas,id:r,type:`Canvas`,behavior:[`w-12`,`h-8`],label:e.label||{en:[`Untitled YouTube Video`]},height:e.height||1080,width:e.width||1920,thumbnail:[s],items:[o]})}function q({children:e}){let t=(0,d.useManifest)(),{edit:n}=(0,l.useLayoutActions)();return(0,p.jsxs)(`div`,{className:`grid auto-rows-auto grid-cols-12 content-center justify-center gap-2 p-2`,children:[(0,p.jsx)(`div`,{className:`col-span-12 row-span-2 text-black flex flex-col items-center justify-center`,children:(0,p.jsx)(y.Button,{onPress:()=>t&&n(t),className:`col-span-4 row-span-4 text-md text-left text-black hover:bg-slate-100 w-full flex items-center justify-center`,children:(0,p.jsx)(d.LocaleString,{className:`block w-full text-left`,children:t?.label})})}),e]})}const J=(0,h.forwardRef)(function({isFirst:e,item:t,children:n,...r},i){let a=(0,d.useCanvas)(),[o]=(0,d.useRenderingStrategy)();a?.behavior;let s=(0,u.useInStack)(`Canvas`),c=M(a?.behavior,e),{isBottom:l,isImage:f,isInfo:m,isLeft:h}=N(a?.behavior),_=s?.resource.source?.id===a?.id,v=null;return v=m?(0,p.jsx)(`div`,{className:`bg-black w-full h-full text-white max-h-40`,children:(0,p.jsx)(`div`,{className:`p-1.5 text-[4px]`,children:o.type===`textual-content`?(0,p.jsx)(d.LocaleString,{enableDangerouslySetInnerHTML:!0,children:o.items[0]?.text}):null})}):(0,p.jsxs)(`div`,{className:(0,b.twMerge)(`flex h-full max-h-full min-h-0`,h?`flex-row-reverse`:l?`flex-col`:`flex-row`),children:[(0,p.jsx)(`div`,{className:`flex-1 overflow-hidden relative justify-self-stretch`,children:(0,p.jsx)(`div`,{className:`absolute inset-0 w-full h-full`,children:(0,p.jsx)(g.LazyThumbnail,{cover:!0,fade:!1})})}),f?null:(0,p.jsx)(`div`,{className:`${l?`min-h-3 w-full`:`w-1/3`} flex-shrink-0 self-stretch p-2 text-white bg-black rounded`,children:(0,p.jsxs)(`div`,{className:`p-1.5 text-[4px]`,children:[(0,p.jsx)(d.LocaleString,{className:`block mb-1 text-[5px]`,children:a?.label}),(0,p.jsx)(d.LocaleString,{children:a?.summary})]})})]}),(0,p.jsxs)(`div`,{ref:i,className:(0,b.twMerge)(c,`bg-me-gray-700 overflow-hidden hover:ring-2 ring-me-primary-500 relative`,_?`ring-2 ring-me-primary-500`:``),...r,children:[v,n]})});function Ce(){let{open:e}=(0,l.useLayoutActions)(),{structural:t,technical:n}=(0,l.useManifestEditor)(),[,r]=(0,l.useCreator)({id:n.id.get(),type:`Manifest`},`items`,`Manifest`);return(0,p.jsx)(q,{children:t.items.get().map((t,n)=>(0,p.jsx)(d.CanvasContext,{canvas:t.id,children:(0,p.jsx)(J,{isFirst:n===0,item:t,onClick:()=>{e({id:`current-canvas`}),r.edit(t,n)}})},n))})}function we(e){return(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,height:`1em`,width:`1em`,...e,children:[(0,p.jsx)(`title`,{children:`Rearrange`}),(0,p.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,p.jsx)(`path`,{d:`M20 9H4v2h16V9zM4 15h16v-2H4v2z`,fill:`currentColor`})]})}function Te({isFirst:e,onClick:t,item:n,actions:r}){let{attributes:i,listeners:a,setNodeRef:o,transform:s,transition:c}=(0,E.useSortable)({id:n.id,transition:{duration:150,easing:`cubic-bezier(0.25, 1, 0.5, 1)`}});return(0,p.jsx)(J,{ref:o,style:{transform:te.CSS.Translate.toString(s),transition:c},...i,...a,onClick:t,isFirst:e,item:n,children:(0,p.jsxs)(`div`,{className:`absolute top-0.5 right-0.5 flex gap-0.5 items-stretch`,children:[r?.length?(0,p.jsx)(u.AppDropdown,{as:y.Button,className:`bg-white p-1 text-2xl hover:text-me-500 aria-expanded:text-me-600 aria-expanded:bg-me-200 hover:bg-me-100 rounded-sm`,"aria-label":`Action menu`,items:r,children:(0,p.jsx)(g.MoreMenu,{})}):null,(0,p.jsx)(`div`,{className:`bg-white text-2xl h-8 flex items-center p-1 hover:text-me-500 hover:bg-me-100 rounded-sm`,children:(0,p.jsx)(we,{"aria-label":`Reorder item`})})]})})}function Ee(){let e=(0,d.useManifest)(),{structural:t,technical:n}=(0,l.useManifestEditor)(),r=(0,l.useEditingStack)(),i=(0,u.useInStack)(`Canvas`),a=t.items.get(),{open:o}=(0,l.useLayoutActions)(),s=(0,T.useSensors)((0,T.useSensor)(T.PointerSensor,{activationConstraint:{distance:5}}),(0,T.useSensor)(T.KeyboardSensor,{coordinateGetter:E.sortableKeyboardCoordinates})),[,c]=(0,l.useCreator)({id:n.id.get(),type:`Manifest`},`items`,`Manifest`),f=(0,h.useCallback)(e=>{let{active:n,over:r}=e;r&&n.id!==r.id&&t.items.reorder(a.findIndex(e=>e.id===n.id),a.findIndex(e=>e.id===r.id))},[a,t.items]),m=i?.resource.source.id,g=m?a.findIndex(e=>e.id===m):-1,_=g&&g>0?Number(g-1):0;function v(){r.close();let n=t.items.get();n&&n.length>0?c.edit(n[_]):c.edit(e)}let y=(0,h.useMemo)(()=>(0,u.createAppActions)(t.items,v),[t.items,v]);return(0,p.jsx)(q,{children:(0,p.jsx)(T.DndContext,{sensors:s,collisionDetection:T.closestCenter,onDragEnd:f,modifiers:[ee.restrictToParentElement],children:(0,p.jsx)(E.SortableContext,{items:a,strategy:E.rectSortingStrategy,children:a.map((t,n)=>t?(0,p.jsx)(d.CanvasContext,{canvas:t.id,children:(0,p.jsx)(Te,{item:t,isFirst:n===0,onClick:()=>{o({id:`current-canvas`}),c.edit(t,n)},actions:y(t,n,e)},t.id)},t.id):null)})})})}const De={id:`canvas-listing`,label:`Exhibition grid`,icon:(0,p.jsx)(Y,{}),render:()=>(0,p.jsx)(Oe,{}),options:{minWidth:350,maxWidth:350}};function Oe(){let{technical:e}=(0,l.useManifestEditor)(),[t,n]=(0,l.useCreator)({id:e.id.get(),type:`Manifest`},`items`,`Canvas`),[r,i]=(0,u.useToggleList)();return(0,p.jsxs)(g.Sidebar,{children:[(0,p.jsx)(g.SidebarHeader,{title:`Exhibition`,actions:[{icon:r.list?(0,p.jsx)(m.CanvasListingIcon,{className:`text-2xl`}):(0,p.jsx)(Y,{}),title:r.list?`List view`:`Grid view`,onClick:()=>i(`list`)},{icon:(0,p.jsx)(ke,{}),title:`Edit slides`,toggled:r.editing,onClick:()=>i(`editing`)},{icon:(0,p.jsx)(Ae,{}),title:`Add new slide`,disabled:!t,onClick:()=>n.createFiltered(`exhibition-slide`)}]}),(0,p.jsx)(g.SidebarContent,{children:r.list?(0,p.jsx)(m.CanvasListView,{isEditing:r.editing}):r.editing?(0,p.jsx)(Ee,{}):(0,p.jsx)(Ce,{})})]})}function Y(){return(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`currentColor`,viewBox:`0 -960 960 960`,children:[(0,p.jsx)(`title`,{children:`Exhibition grid`}),(0,p.jsx)(`path`,{d:`M600-160v-280h280v280H600ZM440-520v-280h440v280H440ZM80-160v-280h440v280H80Zm0-360v-280h280v280H80Zm440-80h280v-120H520v120ZM160-240h280v-120H160v120Zm520 0h120v-120H680v120ZM160-600h120v-120H160v120Zm360 0Zm-80 240Zm240 0ZM280-600Z`})]})}function ke(){return(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24`,viewBox:`0 0 24 24`,width:`24`,children:[(0,p.jsx)(`title`,{children:`Edit slides`}),(0,p.jsx)(`path`,{d:`M0 0h24v24H0V0z`,fill:`none`}),(0,p.jsx)(`path`,{d:`M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z`})]})}function Ae(){return(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`currentColor`,viewBox:`0 -960 960 960`,children:[(0,p.jsx)(`title`,{children:`Add new slide`}),(0,p.jsx)(`path`,{d:`M160-240v-480 480Zm80-80v-200h360v200H240Zm-80 160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v240h-80v-240H160v480h360v80H160Zm500-320v-100H360v-60h360v160h-60Zm60 400v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z`})]})}function je(){let e=(0,l.useEditor)(),t=()=>{let t=e.technical.width.get(),n=e.technical.height.get(),r=e.descriptive.summary,i=e.technical.behavior.get();i.push(`w-12`);let a=Math.max(1,Math.min(12,Math.round(t/n*12)));i.push(`h-${a}`),(0,D.getValue)(r.get())||r.set({en:[`Summary of image`]}),e.technical.behavior.set(i)};return(0,p.jsxs)(`div`,{className:`flex flex-col items-center gap-4 border-me-100 border-2 p-4 rounded`,children:[`This canvas was not created in the exhibition editor. Do you want to apply default settings?`,(0,p.jsx)(g.ActionButton,{onPress:()=>t(),children:`Apply defaults`})]})}const Me={id:`@exhibition/right-panel-editor`,supports:{edit:!0,properties:[`label`,`summary`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=N(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Exhibition`,component:()=>(0,p.jsx)(Ne,{})};function Ne(){let e=(0,d.useCanvas)(),t=(0,l.useEditingResource)(),{structural:n,descriptive:r}=(0,l.useEditor)(),{items:i}=n,{thumbnail:a}=r,o=i.get()[0],s=P(e);return!e||!o||!t?(0,p.jsx)(`div`,{className:`p-8`,children:`Canvas, page, or resource not found`}):(0,p.jsx)(g.Sidebar,{children:(0,p.jsx)(g.SidebarContent,{padding:!0,children:(0,p.jsxs)(l.ResourceEditingProvider,{resource:e,children:[s?null:(0,p.jsx)(je,{}),(0,p.jsx)(u.LanguageMapEditor,{dispatchType:`label`,disableMultiline:!0,disallowHTML:!0}),(0,p.jsx)(u.LinkingPropertyList,{containerId:a.containerId(),label:`Thumbnail`,property:`thumbnail`,items:a.get(),singleMode:!0,reorder:e=>a.reorder(e.startIndex,e.endIndex),createActions:(0,u.createAppActions)(a),creationType:`ContentResource`,emptyLabel:`No thumbnail`,parent:t?.resource}),(0,p.jsx)(d.AnnotationPageContext,{annotationPage:o.id,children:(0,p.jsx)(u.PaintingAnnotationList,{createFilter:`image`})})]})})})}const Pe={id:`@exhibition/summary-editor`,supports:{edit:!0,properties:[`summary`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=N(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Summary`,component:()=>(0,p.jsx)(Fe,{})};function Fe(){let e=(0,d.useCanvas)();return e?(0,p.jsx)(g.Sidebar,{children:(0,p.jsx)(g.SidebarContent,{padding:!0,children:(0,p.jsxs)(l.ResourceEditingProvider,{resource:e,children:[(0,p.jsx)(u.LanguageMapEditor,{dispatchType:`label`}),(0,p.jsx)(u.LanguageMapEditor,{dispatchType:`summary`})]})})}):null}function X(e){return(0,p.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,...e,children:(0,p.jsx)(`path`,{fill:`currentColor`,d:`M9 16.17L4.83 12l-1.42 1.41L9 19L21 7l-1.41-1.41z`})})}const Z=`<h2>New step</h2><p>Description</p>`;function Ie(){let{saveAnnotation:e}=(0,d.useCurrentAnnotationActions)(),[t,n]=(0,d.useCurrentAnnotationMetadata)(),{editorFeatureFlags:r}=(0,l.useConfig)(),{annotationPopups:i}=r;return i?(0,p.jsxs)(`div`,{className:`bg-white shadow-md rounded-lg`,children:[(0,p.jsx)(`div`,{className:`prose-headings:mt-1 overflow-y-auto rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500`,children:(0,p.jsx)(g.HTMLEditor,{className:`border-none`,value:t.bodyValue||Z,onChange:e=>n({bodyValue:e})})}),(0,p.jsxs)(`div`,{className:`flex gap-2 p-3`,children:[(0,p.jsxs)(g.ActionButton,{primary:!0,onPress:()=>e(),children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsx)(u.AnnotationPopUpSwitcherButton,{})]})]}):(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(g.ActionButton,{primary:!0,onPress:()=>e(),children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsx)(u.AnnotationPopUpSwitcherButton,{})]})}function Le(){let e=(0,f.useStore)((0,l.useAtlasStore)(),e=>e.polygon),[t,n]=(0,d.useCurrentAnnotationMetadata)(),{editorFeatureFlags:r}=(0,l.useConfig)(),{annotationPopups:i}=r,{cancelRequest:a,saveAnnotation:o}=(0,d.useCurrentAnnotationActions)();return(0,p.jsxs)(`div`,{className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[(0,p.jsxs)(`div`,{className:`bg-me-primary-500 text-white p-2 m-1 rounded flex gap-2`,children:[(0,p.jsx)(g.TargetIcon,{}),`Draw a box on the canvas`]}),i?(0,p.jsx)(`div`,{className:`relative p-3 line-clamp-3 prose-p:text-slate-600`,children:(0,p.jsx)(`div`,{className:`prose-headings:mt-1 prose-headings:mb-1 prose-sm`,children:(0,p.jsx)(`div`,{dangerouslySetInnerHTML:{__html:t.bodyValue||Z}})})}):(0,p.jsx)(g.HTMLEditor,{className:`border-none`,value:t.bodyValue||Z,onChange:e=>n({bodyValue:e})}),(0,p.jsxs)(`div`,{className:`flex gap-2 p-3`,children:[(0,p.jsxs)(g.ActionButton,{isDisabled:e?.points.length===0,onPress:()=>o(),children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsxs)(g.ActionButton,{className:`gap-2 flex`,onPress:()=>a(),children:[(0,p.jsx)(g.DeleteIcon,{}),` Delete`]}),(0,p.jsx)(u.AnnotationPopUpSwitcherButton,{})]})]})}function Re(){let{editorFeatureFlags:e}=(0,l.useConfig)(),{annotationPopups:t}=e,n=(0,l.useSaveConfig)();return(0,p.jsx)(g.ActionButton,{className:`ml-auto`,onPress:()=>n({editorFeatureFlags:{...e,annotationPopups:!t}}),children:t?(0,p.jsx)(g.AnnotationPopInIcon,{}):(0,p.jsx)(g.AnnotationPopOutIcon,{})})}function ze({highlightProps:e}){let t=(0,h.useContext)(l.ResourceEditingReactContext),n=(0,d.useAnnotation)(),{editorFeatureFlags:r}=(0,l.useConfig)(),{annotationPopups:i}=r,{isPending:a,cancelRequest:o,busy:s,requestAnnotationFromTarget:c,deleteAnnotation:f}=(0,u.useAnnotationEditor)({annotationPopup:(0,p.jsx)(d.AnnotationContext,{annotation:n.id,children:(0,p.jsx)(l.ResourceEditingReactContext.Provider,{value:t,children:(0,p.jsx)(Be,{})})})}),[m,_]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{m&&!a&&_(!0)},[a,m]),(0,p.jsxs)(`div`,{...e,className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[(0,p.jsx)(`div`,{className:`relative`,children:m&&!i?(0,p.jsx)(u.HTMLAnnotationEditor,{className:`border-none`}):(0,p.jsx)(g.HTMLAnnotationBodyRender,{className:`px-3 pt-3 line-clamp-3 prose-p:text-slate-600`,locale:`en`})}),(0,p.jsxs)(`div`,{className:`flex gap-2 p-2`,children:[m&&a?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(g.ActionButton,{primary:!0,onPress:()=>{_(!1),o()},children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsx)(u.AnnotationPopUpSwitcherButton,{})]}):(0,p.jsxs)(g.ActionButton,{isDisabled:s,onPress:()=>{_(!0),c().then(()=>{_(!1)})},children:[(0,p.jsx)(g.EditTextIcon,{}),` Edit`]}),(0,p.jsxs)(g.ActionButton,{className:`gap-2 flex`,onPress:()=>f(),children:[(0,p.jsx)(g.DeleteIcon,{}),` Delete`]})]}),(0,p.jsx)(`div`,{className:`absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0`})]})}function Be(){let{editorFeatureFlags:e}=(0,l.useConfig)(),{annotationPopups:t}=e,{saveAnnotation:n}=(0,d.useCurrentAnnotationActions)();return t?(0,p.jsxs)(`div`,{className:`bg-white shadow-md rounded-lg relative max-h-[50vh] overflow-y-auto`,children:[(0,p.jsx)(`div`,{className:`prose-headings:mt-1 rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500`,children:(0,p.jsx)(u.HTMLAnnotationEditor,{className:`border-none`})}),(0,p.jsxs)(`div`,{className:`flex gap-2 p-2 sticky bottom-0 z-50 bg-white`,children:[(0,p.jsxs)(g.ActionButton,{primary:!0,onPress:()=>{n()},children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsx)(Re,{})]})]}):(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(g.ActionButton,{primary:!0,onPress:()=>n(),children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsx)(u.AnnotationPopUpSwitcherButton,{})]})}function Ve({originalAnnotationId:e,highlightProps:t}){let n=(0,l.useGenericEditor)((0,d.useAnnotationPage)()),r=(0,d.useAnnotation)(),{edit:i}=(0,l.useLayoutActions)(),[a,o]=(0,h.useState)(!1),s=()=>{if(e&&confirm(`Are you sure you want to delete this annotation?`)){let t=n.structural.items.getWithoutTracking().findIndex(t=>t.id===e);n.structural.items.deleteAtIndex(t)}};return(0,p.jsxs)(`div`,{...t,className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[(0,p.jsx)(`div`,{className:`flex gap-2 mb-2 p-3`,children:(0,p.jsx)(`div`,{className:`flex-1 min-w-0`,children:a?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`h3`,{className:`text-lg font-semibold border-b pt-1 pb-2 mb-2`,children:`Edit step`}),(0,p.jsx)(u.LanguageMapEditor,{dispatchType:`label`}),(0,p.jsx)(u.LanguageMapEditor,{dispatchType:`summary`})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.LocaleString,{as:`div`,defaultText:(0,p.jsx)(`span`,{className:`opacity-50`,children:`Untitled`}),className:`whitespace-nowrap overflow-ellipsis w-full overflow-x-hidden`,children:r?.label}),(0,p.jsx)(d.LocaleString,{className:`text-gray-500 text-sm bg-white line-clamp-2`,as:`div`,children:r?.summary})]})})}),(0,p.jsxs)(`div`,{className:`flex gap-2 p-2`,children:[a?(0,p.jsxs)(g.ActionButton,{onPress:()=>o(!1),children:[(0,p.jsx)(X,{}),` Finish editing`]}):(0,p.jsxs)(g.ActionButton,{onPress:()=>o(!0),children:[(0,p.jsx)(g.EditTextIcon,{}),` Edit body`]}),(0,p.jsx)(g.ActionButton,{onPress:()=>i(r),children:`Edit annotation`}),(0,p.jsxs)(g.ActionButton,{className:`gap-2 flex`,onPress:()=>s(),children:[(0,p.jsx)(g.DeleteIcon,{}),` Delete`]})]}),(0,p.jsx)(`div`,{className:`absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0`})]})}function Q(){let[e,{annotationTarget:t,highlightProps:n}]=(0,u.useAnnotationInfo)(),r=(0,h.useMemo)(()=>t?{id:t,type:`Annotation`}:{id:e?.id,type:`Annotation`},[e?.id,t]);return t?(0,p.jsx)(l.ResourceEditingProvider,{resource:r,children:(0,p.jsx)(d.AnnotationContext,{annotation:t,children:(0,p.jsx)(Ve,{originalAnnotationId:e?.id,highlightProps:n})})}):(0,p.jsx)(l.ResourceEditingProvider,{resource:r,children:(0,p.jsx)(ze,{highlightProps:n})})}function $({reorderable:e=!1}){let t=(0,d.useAnnotationPage)(),n=(0,l.useGenericEditor)(t);return t?e?(0,p.jsx)(p.Fragment,{children:(0,p.jsx)(u.ReorderList,{id:t.id,marginBottom:`0.5em`,items:t.items||[],inlineHandle:!1,reorder:({startIndex:e,endIndex:t})=>n.structural.items.reorder(e,t),renderItem:(e,t)=>(0,p.jsx)(d.AnnotationContext,{annotation:e.id,children:(0,p.jsx)(Q,{})})})}):(0,p.jsx)(p.Fragment,{children:t.items.map(e=>(0,p.jsx)(d.AnnotationContext,{annotation:e.id,children:(0,p.jsx)(Q,{})},e.id))}):null}const He={id:`@exhibition/tour-steps`,supports:{edit:!0,properties:[`annotations`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=N(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Tour steps`,component:()=>(0,p.jsx)(Ue,{})};function Ue(){let e=(0,d.useCanvas)(),t=e?.annotations[0],n=e?.items[0];return!t||!e||!n?(0,p.jsx)(We,{}):(0,p.jsx)(Ge,{})}function We(){let e=(0,d.useCanvas)(),t=(0,l.useInlineCreator)(),n=()=>{e&&t.create(`@manifest-editor/empty-annotation-page`,{label:{en:[`Tour steps`]}},{target:{id:e.id,type:`Canvas`},targetType:`AnnotationPage`,parent:{property:`annotations`,resource:{id:e.id,type:`Canvas`}}})};return(0,p.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-4`,children:[(0,p.jsx)(`div`,{className:`p-4 opacity-50 text-center`,children:`This image does not yet have a tour.`}),(0,p.jsx)(y.Button,{className:`border w-full disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500`,onPress:()=>n(),children:`Create Tour`})]})}function Ge(){let e=(0,d.useCanvas)(),t=e?.annotations[0],n=e?.items[0],r=(0,l.useGenericEditor)(t),i=(0,l.useInlineCreator)(),[a,o]=(0,h.useState)(!1),{requestAnnotation:s,isPending:c,busy:f,cancelRequest:m,completeRequest:_}=(0,d.useRequestAnnotation)({onSuccess:n=>{let r=n.metadata.bodyValue||``;!n.cancelled&&n.target&&t&&i.create(`@manifest-editor/html-annotation`,{label:{en:[`Tour step`]},body:{en:[r||`<h2>New step</h2><p>Description</p>`]},motivation:`tagging`},{target:{id:e.id,type:`Canvas`},targetType:`Annotation`,parent:{property:`items`,resource:{id:t.id,type:`AnnotationPage`}},initialData:{selector:n}})}});return e?t?(0,p.jsx)(g.Sidebar,{children:(0,p.jsxs)(g.SidebarContent,{padding:!0,children:[(0,p.jsxs)(`div`,{className:`flex gap-4 border-b pt-4 pb-2 mb-2`,children:[(0,p.jsx)(`h2`,{className:`text-lg font-semibold flex-1`,children:`Tour steps`}),(0,p.jsx)(g.ActionButton,{onPress:()=>o(e=>!e),children:a?`Done`:`Reorder`})]}),(0,p.jsx)(l.ResourceEditingProvider,{resource:e,children:(0,p.jsxs)(d.AnnotationPageContext,{annotationPage:t.id,children:[(0,p.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,p.jsx)($,{reorderable:a}),f?null:c?(0,p.jsx)(Le,{}):(0,p.jsx)(y.Button,{onPress:()=>s({type:`box`,annotationPopup:(0,p.jsx)(Ie,{})}),className:`border disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500`,children:`+ Add new step`})]}),n?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`h3`,{className:`text-md border-b pt-4 pb-2 mb-2`,children:`Available tour steps from images`}),(0,p.jsx)(u.PromptToAddPaintingAnnotations,{painting:n,page:r.ref(),canvasId:e.id})]}):null]})})]})}):(0,p.jsx)(`div`,{children:`No annotation page - create one?`}):null}function Ke(){let e=(0,d.useCanvas)();(0,x.default)(e);let t=e.width&&e.height?e.width/e.height:0,n=le(e.behavior||[]);return Math.abs(t-n.ratio)<.01?null:(0,p.jsxs)(`div`,{className:`p-2 rounded bg-me-100`,children:[(0,p.jsx)(`div`,{className:`text-me-700-500`,children:`Aspect ratio warning`}),(0,p.jsxs)(`div`,{className:`text-sm text-black/60`,children:[`The aspect ratio of this canvas is `,t.toFixed(2),` but the target aspect ratio is `,n.ratio.toFixed(2),`. Some parts of this image may be cropped.`,(0,p.jsx)(`div`,{className:`relative h-32 w-full mt-2`,children:(0,p.jsx)(`div`,{className:`bg-[red] left-0 top-0 z-2 opacity-50 max-w-32 max-h-32`,style:{aspectRatio:t.toFixed(2)},children:(0,p.jsx)(`div`,{className:`asbolute bg-[white] left-0 top-0 z-1 opacity-50 max-w-32 max-h-32`,style:{aspectRatio:n.ratio}})})})]})]})}const qe={component:()=>(0,p.jsx)(Ze,{}),supports:{edit:!0,resourceTypes:[`Canvas`],properties:[`behavior`]},id:`slide-behaviors`,label:`Layout`,tabs:{showTitle:!0}},Je=[{id:`layout`,type:`choice`,label:{en:[`Layout`]},initialOpen:!0,items:[{label:{en:[`Text on left`]},value:`left`},{label:{en:[`Text on right`]},value:`right`},{label:{en:[`Text on bottom`]},value:`bottom`},{label:{en:[`Text on top`]},value:`top`},{label:{en:[`Only image`]},value:`image`}]},{id:`floating`,type:`choice`,label:{en:[`Floating`]},initialOpen:!1,addNone:!0,groupBehavior:`floating`,items:[{label:{en:[`Float top left`]},value:`float-top-left`},{label:{en:[`Float top right`]},value:`float-top-right`},{label:{en:[`Float bottom left`]},value:`float-bottom-left`},{label:{en:[`Float bottom right`]},value:`float-bottom-right`}]},{id:`size`,component:(e,t)=>(0,p.jsx)(Xe,{behaviors:e,setBehaviors:t}),label:{en:[`Size`]},type:`custom`,initialOpen:!0,supports:e=>e.startsWith(`w-`)||e.startsWith(`h-`)}];function Ye(e){let t=0,n=0;for(let r of e)r.startsWith(`w-`)&&(t=Number.parseInt(r.slice(2))),r.startsWith(`h-`)&&(n=Number.parseInt(r.slice(2)));return{width:t,height:n}}function Xe({behaviors:e,setBehaviors:t}){let{width:n,height:r}=Ye(e),[i,a]=(0,h.useState)({x:-1,y:-1}),o=(n,r)=>{let i=e.filter(e=>!e.startsWith(`w-`)&&!e.startsWith(`h-`));i.push(`w-${n}`),i.push(`h-${r}`),t(i)};return(0,p.jsx)(`div`,{className:`grid grid-cols-12 grid-rows-12 gap-1`,onMouseLeave:()=>a({x:-1,y:-1}),children:Array.from({length:144},(e,t)=>{let s=t%12,c=Math.floor(t/12),l=i.x>=s&&i.y>=c,u=s<n&&c<r,d=l&&u,f=`bg-gray-200`;return l&&(f=`bg-me-200`),u&&(f=`bg-me-500`),d&&(f=`bg-me-400`),(0,p.jsx)(`div`,{className:`flex aspect-square rounded cursor-se-resize items-center justify-center ${f}`,onClick:()=>o(s+1,c+1),onMouseUp:()=>o(s+1,c+1),onMouseEnter:()=>a({x:s,y:c})},t)})})}function Ze(){let e=(0,u.useInStack)(`Canvas`),t=(0,l.useEditor)(),{width:n,height:r}=t.technical;return!e||t.technical.type!==`Canvas`?(0,p.jsxs)(g.Sidebar,{children:[(0,p.jsx)(g.SidebarHeader,{title:`Slide behaviors`}),(0,p.jsx)(`div`,{children:`Please select canvas`})]}):(0,p.jsx)(g.Sidebar,{children:(0,p.jsxs)(g.SidebarContent,{children:[(0,p.jsx)(`div`,{className:`px-2`,children:(0,p.jsxs)(u.InputContainer,{$wide:!0,children:[(0,p.jsx)(u.DimensionsTriplet,{widthId:n.containerId(),width:n.get()||0,changeWidth:e=>n.set(e),heightId:r.containerId(),height:r.get()||0,changeHeight:e=>r.set(e)}),(0,p.jsx)(`div`,{children:(0,p.jsx)(Ke,{})})]})}),(0,p.jsx)(u.BehaviorEditor,{behavior:t.technical.behavior.get()||[],onChange:e=>{t.technical.behavior.set(e)},configs:Je})]})})}const Qe=(0,l.extendApp)((0,l.mapApp)(c),{id:`exhibition-editor`,title:`Exhibition Editor`,project:!0,projectType:`Manifest`},{config:{editorConfig:{Canvas:{hideTabs:[`@manifest-editor/overview`,`@manifest-editor/technical-properties`,`@manifest-editor/linking-properties`,`@manifest-editor/nav-place-editor`,`@manifest-editor/canvas-structural`,`@manifest-editor/descriptive-properties`,`@manifest-editor/overview-canvas-editor`,`@manifest-editor/metadata`]}}},leftPanels:[De,j],centerPanels:[A],annotations:[O],leftPanelIds:[`left-panel-manifest`],background:[ie],canvasEditors:[F,V,R],editors:[Me,qe,Pe,He],creators:[_e,xe,ue,U,G,he,ye]});exports.exhibitionEditorPreset=Qe;
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@manifest-editor/manifest-preset`);c=s(c);let l=require(`@manifest-editor/shell`),u=require(`@manifest-editor/editors`),d=require(`react-iiif-vault`),f=require(`zustand`),p=require(`react/jsx-runtime`),m=require(`@manifest-editor/manifest-preset/components`),h=require(`react`),g=require(`@manifest-editor/components`),_=require(`exhibition-viewer`),v=require(`exhibition-viewer/library`),y=require(`react-aria-components`),b=require(`tailwind-merge`),x=require(`tiny-invariant`);x=s(x);let S=require(`@manifest-editor/creator-api`),C=require(`@manifest-editor/creators`),w=require(`@iiif/parser`),T=require(`@dnd-kit/core`),ee=require(`@dnd-kit/modifiers`),E=require(`@dnd-kit/sortable`),te=require(`@dnd-kit/utilities`),D=require(`@iiif/helpers`);const O={id:`@exhibition/tour-step-annotations`,label:`Tour steps`,render:()=>(0,p.jsx)(k,{})};function k(){let e=(0,d.useCanvas)(),t=(0,f.useStore)((0,l.useAtlasStore)(),e=>e.tool.enabled),{rightPanel:n}=(0,l.useLayoutState)(),r=n.current===`@manifest-editor/editor`&&n.state?.currentTab?.startsWith(`@exhibition/tour-steps`),i=e?.annotations[0];return!r||!e||t||!i?null:(0,p.jsx)(p.Fragment,{children:(0,p.jsx)(d.AnnotationPageContext,{annotationPage:i.id,children:(0,p.jsx)(u.ViewerAnnotationPage,{})})})}const A={id:`@exhibitions/center-panel`,label:`Exhibition editor`,icon:null,render:()=>(0,p.jsx)(ne,{}),options:{minWidth:350,maxWidth:350}};function ne(){let e=(0,d.useManifest)(),t=(0,d.useVault)(),[n,r]=(0,h.useState)(.8),i=(0,h.useRef)(null),{edit:a,leftPanel:o}=(0,l.useLayoutActions)(),s=(0,h.useMemo)(()=>({localeStringEditor:e=>(0,p.jsxs)(`span`,{className:`inline-flex items-center hover:ring-4 hover:ring-me-primary-500`,children:[e.original,(0,p.jsx)(y.Button,{className:`py-1 px-2 inline-block`,onPress:()=>a(e.resource),children:(0,p.jsx)(g.EditTextIcon,{className:`text-xl`})})]}),canvasPreviewEditor:e=>(0,p.jsxs)(`div`,{className:`w-full h-full flex-1 flex relative`,children:[e.original,(0,p.jsx)(`button`,{onClick:t=>{t.preventDefault(),t.stopPropagation(),a(e.resource),o.open({id:`canvas-listing`,open:!0})},className:`absolute top-5 right-5 bg-white text-black p-2 rounded z-40`,children:`EDIT`})]})}),[]);return(0,h.useLayoutEffect)(()=>{if(i.current){let e=i.current.offsetWidth/1200;r(Math.max(1,e))}},[]),e?(0,p.jsx)(`div`,{ref:i,className:`overflow-y-auto delft-exhibition`,children:(0,p.jsx)(v.EditorHooksProvider,{hooks:s,children:(0,p.jsx)(_.DelftExhibition,{skipLoadManifest:!0,customVault:t,manifest:e.id,options:{disablePresentation:!0,hideTableOfContents:!0,hideTitle:!0,alternativeImageMode:!0}},n)})}):null}const j={id:`@exhibitions/overview-panel`,label:``,icon:(0,p.jsx)(`div`,{className:`hidden hover:block`,children:`👀`}),render:()=>(0,p.jsx)(re,{})};function re(){return(0,d.useManifest)()?(0,p.jsx)(`div`,{children:`Coming soon.`}):null}const ie={id:`exhibition-background-task`,label:`Query string`,render:()=>(0,p.jsx)(ae,{})};function ae(){console.log(`rendering?`);let e=(0,d.useManifest)();(0,u.useInStack)(`Canvas`);let{leftPanel:t,rightPanel:n}=(0,l.useLayoutState)(),{edit:r,leftPanel:i,rightPanel:a,centerPanel:o}=(0,l.useLayoutActions)(),{canvasActions:s,open:c}=(0,m.useEditCanvasItems)(),{editorFeatureFlags:{rememberCanvasId:f=!0,rememberLeftPanelId:p=!1}={}}=(0,l.useConfig)();return t.open,(0,h.useEffect)(()=>{e&&t.current===j.id&&(r(e),o.open({id:A.id}),i.close())},[t.current]),null}const oe={"h-1":`lg:min-h-[100px] row-span-1`,"h-2":`lg:min-h-[200px] row-span-2`,"h-3":`lg:min-h-[300px] row-span-3`,"h-4":`lg:min-h-[400px] row-span-4`,"h-5":`lg:min-h-[500px] row-span-5`,"h-6":`lg:min-h-[600px] row-span-6`,"h-7":`lg:min-h-[700px] row-span-7`,"h-8":`lg:min-h-[800px] row-span-8`,"h-9":`lg:min-h-[900px] row-span-9`,"h-10":`lg:min-h-[1000px] row-span-10`,"h-11":`lg:min-h-[1100px] row-span-11`,"h-12":`lg:min-h-[1200px] row-span-12`},se={"h-1":`lg:min-h-[25px] row-span-1`,"h-2":`lg:min-h-[50px] row-span-2`,"h-3":`lg:min-h-[75px] row-span-3`,"h-4":`lg:min-h-[100px] row-span-4`,"h-5":`lg:min-h-[125px] row-span-5`,"h-6":`lg:min-h-[150px] row-span-6`,"h-7":`lg:min-h-[175px] row-span-7`,"h-8":`lg:min-h-[200px] row-span-8`,"h-9":`lg:min-h-[225px] row-span-9`,"h-10":`lg:min-h-[250px] row-span-10`,"h-11":`lg:min-h-[275px] row-span-11`,"h-12":`lg:min-h-[300px] row-span-12`},ce={"w-1":`col-span-1`,"w-2":`col-span-2`,"w-3":`col-span-3`,"w-4":`col-span-4`,"w-5":`col-span-5`,"w-6":`col-span-6`,"w-7":`col-span-7`,"w-8":`col-span-8`,"w-9":`col-span-9`,"w-10":`col-span-10`,"w-11":`col-span-11`,"w-12":`col-span-12`};function le(e){let{isLeft:t,isRight:n,isBottom:r}=N(e),i=e?.find(e=>e.includes(`h-`)),a=e?.find(e=>e.includes(`w-`));if(!i||!a)return{h:0,w:0,ratio:1};let o={h:Number.parseInt(i.split(`-`)[1]),w:Number.parseInt(a.split(`-`)[1]),ratio:1};return(t||n)&&(o.w*=2/3),r&&(o.h*=2/3),o.h&&o.w&&(o.ratio=o.w/o.h),o}function M(e,t=!1,n=!0){(!e||e.length===0)&&(e=[`h-8`,`w-8`,`image`]);let r=e.find(e=>e.includes(`h-`)),i=e.find(e=>e.includes(`w-`)),a=[];return t&&r===`h-4`&&(r=`h-8`),a.push(n?se[r]:oe[r]),a.push(ce[i]),a.join(` `)}function N(e){let t=e?.includes(`right`),n=e?.includes(`left`),r=e?.includes(`bottom`),i=e?.includes(`top`),a=e?.includes(`image`)||!n&&!t&&!r&&!i;return{isRight:t,isLeft:n,isBottom:r,isTop:i,isInfo:e?.includes(`info`),isImage:a}}function P(e){if(!e)return!1;let t=e.behavior||[];if(t.includes(`image`)||t.includes(`info`))return!0;for(let e of t)if(e.startsWith(`w-`)||e.startsWith(`h-`))return!0;return!1}const F={id:`image-block-editor`,label:`Image Block Editor`,component:e=>(0,p.jsx)(I,{strategy:e}),supports:{strategy:(e,t,n)=>{if(e.type!==`images`)return!1;let r=n.get(t.resource);if(r.type!==`Canvas`)return!1;let i=r.behavior||[],a=!1;for(let e of i)(e.startsWith(`w-`)||e.startsWith(`h-`)||e===`image`)&&(a=!0);return a}}};function I({strategy:e}){let[t,n]=(0,l.useLocalStorage)(`exhibition-preview-mode`),r=(0,u.useInStack)(`Canvas`);return r?(0,p.jsxs)(d.CanvasContext,{canvas:r.resource.source?.id,children:[(0,p.jsxs)(`div`,{className:`flex gap-4 bg-me-500 py-2 px-4 text-white shadow-md z-40 ring-1 ring-me-500 items-center`,children:[`Switch view`,(0,p.jsx)(g.ActionButton,{onPress:()=>n(!t),children:t?`Full canvas`:`Layout preview`})]}),t?(0,p.jsx)(L,{}):(0,p.jsx)(`div`,{className:`h-full flex flex-1 min-h-0`,children:(0,p.jsx)(u.CanvasPanelEditor,{asFallback:!0})})]}):null}function L(){let e=(0,h.useRef)(null),t=(0,d.useCanvas)(),n=M(t?.behavior||[],!1,!1),{isBottom:r,isImage:i,isInfo:a,isLeft:o}=N(t?.behavior),[s,c]=(0,h.useState)(1);return(0,h.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=t.offsetWidth;c(n/1200)},[t]),(0,p.jsx)(`div`,{className:`overflow-hidden h-full w-full`,ref:e,children:(0,p.jsx)(`div`,{className:`grid grid-cols-12 grid-rows-12 h-full bg-white`,children:(0,p.jsxs)(`div`,{className:(0,b.twMerge)(n,`flex h-full max-h-full min-h-0 ring-4 ring-black`,o?`flex-row-reverse`:r?`flex-col`:`flex-row`),children:[(0,p.jsx)(`div`,{className:`flex-1 h-full flex min-w-0`,children:(0,p.jsx)(u.CanvasPanelEditor,{asFallback:!0})}),i?null:(0,p.jsx)(`div`,{className:`${r?`min-h-3 w-full`:`w-1/3`} flex-shrink-0 self-stretch text-white bg-black rounded p-8 relative h-full`,children:(0,p.jsxs)(`div`,{style:{fontSize:`${s*16}px`},children:[(0,p.jsx)(d.LocaleString,{className:`block mb-4`,children:t?.label}),(0,p.jsx)(d.LocaleString,{children:t?.summary})]})})]})})})}const R={id:`info-block-editor`,label:`info Block Editor`,component:e=>(0,p.jsx)(z,{strategy:e}),supports:{strategy:(e,t,n)=>e.type===`textual-content`}};function z(e){let t=(0,d.useCanvas)(),n=(0,d.useVaultSelector)((e,n)=>n.get(t?.items[0])),r=(0,d.useVaultSelector)((e,n)=>t?.annotations[0]?n.get(t?.annotations[0]):null);return(0,p.jsxs)(`div`,{className:`overflow-y-auto bg-white shadow`,children:[(0,p.jsx)(`div`,{className:`mb-12`,children:n.items.map((e,t)=>(0,p.jsx)(d.AnnotationContext,{annotation:e.id,children:(0,p.jsx)(B,{})},e.id+t))}),r?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`h2`,{className:`text-2xl font-bold px-4 border-t border-gray-200 pt-4 mb-4`,children:`Long Summaries`}),(0,p.jsx)(`p`,{className:`my-4 px-4`,children:`Long summaries are used to provide more detailed information about the canvas. They appear when the user clicks "read more" in the exhibition.`}),r.items.map((e,t)=>(0,p.jsx)(d.AnnotationContext,{annotation:e.id,children:(0,p.jsx)(B,{})},e.id+t))]}):null]})}function B(){let e=(0,d.useAnnotation)(),t=(0,l.useInlineCreator)(),n=e?.body||[],r=(0,l.useGenericEditor)(e);return e?(0,p.jsxs)(`div`,{children:[n.map((e,t)=>(0,p.jsx)(u.AnnotationBodyEditor,{className:`p-4 hover:bg-me-100/40 focus-within:bg-me-100/40`,resourceId:e.id,onRemove:()=>r.annotation.body.deleteAtIndex(t)},t)),(0,p.jsx)(`div`,{className:`p-4`,children:(0,p.jsx)(g.ActionButton,{primary:!0,onPress:()=>{t.create(`@manifest-editor/html-body-creator`,{language:`en`,value:``},{targetType:`ContentResource`,parent:{property:`body`,resource:{id:e.id,type:`Annotation`}},initialData:{}})},children:`Add new annotation`})})]}):null}const V={id:`youtube-main-editor`,label:`YouTube main editor`,component:e=>e.type===`media`?(0,p.jsx)(H,{strategy:e,video:e.media}):null,supports:{strategy:(e,t,n)=>(console.log(e),!(e.type!==`media`||e.media.type!==`VideoYouTube`))}};function H({strategy:e,video:t}){let{edit:n}=(0,l.useLayoutActions)(),r=(0,d.useCanvas)(),i=(0,d.useVaultSelector)((e,t)=>t.get(r?.items[0]).items[0]);(0,x.default)(r&&i);let a=(0,h.useRef)(null),o=(0,l.useGenericEditor)(i),s=t,c=(r.width||1)/(r.height||1);return`${s.youTubeId}`,(0,p.jsxs)(`div`,{className:`overflow-y-auto`,children:[(0,p.jsx)(`div`,{className:`p-8`,children:(0,p.jsx)(`div`,{className:`bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto`,style:{aspectRatio:c},children:(0,p.jsx)(`iframe`,{title:`YouTube video`,className:`border-none w-full h-full object-contain`,ref:a,src:`https://www.youtube.com/embed/${s.youTubeId}?enablejsapi=1&origin=${window.location.host}&modestbranding=1&rel=0`,referrerPolicy:`no-referrer compute-pressure`,sandbox:`allow-scripts allow-same-origin allow-presentation`})})}),(0,p.jsxs)(`div`,{className:`bg-white shadow w-full p-8 flex gap-8`,children:[(0,p.jsx)(`div`,{children:(0,p.jsx)(`div`,{className:`w-64 bg-black flex-shrink-0 flex items-center justify-center rounded overflow-clip`,style:{aspectRatio:c},children:r.thumbnail?.length?(0,p.jsx)(g.LazyThumbnail,{cover:!0}):(0,p.jsx)(`div`,{className:`text-white/50 text-center py-16`,children:`No thumbnail`})})}),(0,p.jsxs)(`div`,{className:`flex-1`,children:[(0,p.jsx)(d.LocaleString,{as:`h3`,className:`text-2xl font-bold mt-4`,defaultText:(0,p.jsx)(`span`,{className:`text-black/30`,children:`No Label`}),children:o.descriptive.label.get()}),(0,p.jsx)(d.LocaleString,{as:`p`,className:`mt-2 mb-8`,defaultText:(0,p.jsx)(`span`,{className:`text-black/30`,children:`No summary`}),children:o.descriptive.summary.get()}),(0,p.jsx)(g.ActionButton,{onPress:()=>n(o.ref()),children:`Edit properties`})]})]})]})}const U=(0,S.defineCreator)({...C.iiifBrowserCreator,id:`@exhibitions/browser-creator`,create:W,tags:[`image`,`exhibition-slide`],label:`IIIF Browser`,summary:`Browse IIIF Resources`,resourceType:`Canvas`,resourceFields:[`id`,`language`,`type`,`format`,`value`],additionalTypes:[],supports:{onlyPainting:!0,parentTypes:[`Manifest`],parentFields:[`items`],parentFieldMap:{Manifest:[`items`]}}});async function W(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i={width:0,height:0},a=await(0,S.creatorHelper)(t,{id:r,type:`AnnotationPage`},`items`,`@manifest-editor/iiif-browser-creator`)({...e,trackSize({width:e,height:t}){i.height=t,i.width=e}},{targetType:`Annotation`,target:{id:n,type:`Canvas`}});return await(0,S.creatorHelper)(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:i.width,height:i.height,type:`default`,items:a})}const ue=(0,S.defineCreator)({...C.imageServiceCreator,id:`@exhibitions/image-service-creator`,create:de,tags:[`image`,`exhibition-slide`],label:`IIIF Image`,summary:`IIIF Image service`,resourceType:`Canvas`,supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function de(e,t){let n=t.generateId(`canvas`);t.generateId(`annotation-page`,{id:n,type:`Canvas`});let r=await(0,S.creatorHelper)(t,{id:t.generateId(`annotation`),type:`Annotation`},`body`,`@manifest-editor/image-service-creator`)(e,{target:{id:n,type:`Canvas`}}),{width:i,height:a}=r.get(),o=t.embed({id:t.generateId(`annotation`),type:`Annotation`,motivation:`painting`,body:[r],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}});return await(0,S.creatorHelper)(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:i,height:a,type:`default`,items:[o]})}const G=(0,S.defineCreator)({id:`@exhibitions/image-slide-creator`,create:K,label:`Empty slide`,summary:`An empty image slide.`,icon:(0,p.jsx)(g.EmptyCanvasIcon,{}),tags:[`exhibition-slide`],resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}}),fe=(0,S.defineCreator)({...G,id:`@exhibitions/image-slide-creator-left`,label:`Image (Left)`,summary:`An image with text on the left.`,icon:(0,p.jsx)(`div`,{children:`IMAGE (LEFT)`}),create:(e,t)=>K({...e,type:`left`},t)}),pe=(0,S.defineCreator)({...G,id:`@exhibitions/image-slide-creator-right`,label:`Image (Right)`,summary:`An image with text on the right.`,icon:(0,p.jsx)(`div`,{children:`IMAGE (RIGHT)`}),create:(e,t)=>K({...e,type:`right`},t)}),me=(0,S.defineCreator)({...G,id:`@exhibitions/image-slide-creator-bottom`,label:`Image (Bottom)`,summary:`An image with text at the bottom.`,icon:(0,p.jsx)(`div`,{children:`IMAGE (BOTTOM)`}),create:(e,t)=>K({...e,type:`bottom`},t)});function K(e,t){let n=e.canvasId||t.generateId(`Canvas`),r=t.generateId(`AnnotationPage`,{id:n,type:`Canvas`}),i=t.generateId(`AnnotationPage`,{id:n,type:`Canvas`}),a=[],o=6e3;if(e.width&&e.height)if(e.width>e.height){let t=e.width/12,n=`h-${Math.floor(e.height/t)}`;a.push(`w-12`,n)}else{let t=e.height/12,n=`w-${Math.floor(e.width/t)}`;a.push(n,`h-12`)}else a.push(`w-12`,`h-4`);switch(e.type){case`left`:a.push(`left`),o*=2/3;break;case`right`:a.push(`right`),o*=2/3;break;case`bottom`:a.push(`bottom`);break}return e.items?.length||a.push(`multi-image`),t.embed({...w.emptyCanvas,id:n,behavior:a,label:e.label||{en:[`Untitled`]},height:e.height||4e3,duration:e.duration,width:e.width||o,items:[t.embed({...w.emptyAnnotationPage,id:r,type:`AnnotationPage`,items:e.items?e.items:[]})],annotations:[t.embed({...w.emptyAnnotationPage,id:i,type:`AnnotationPage`,items:[]})]})}const he=(0,S.defineCreator)({...C.imageUrlCreator,id:`@exhibitions/image-url-creator`,create:ge,tags:[`exhibition-slide`],label:`Image`,summary:`Image from URL`,resourceType:`Canvas`,supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function ge(e,t){let n=t.generateId(`canvas`);t.generateId(`annotation-page`,{id:n,type:`Canvas`});let r=t.generateId(`annotation`),i=await(0,S.creatorHelper)(t,{id:r,type:`Annotation`},`body`,`@manifest-editor/image-url-creator`)(e,{target:{id:n,type:`Canvas`},targetType:`Annotation`}),{width:a,height:o}=i.get(),s=t.embed({id:r,type:`Annotation`,motivation:`painting`,body:[i],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}});return await(0,S.creatorHelper)(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:a,height:o,type:`default`,items:[s]})}const _e=(0,S.defineCreator)({id:`@exhibitions/info-box-creator`,create:ve,label:`Info box`,summary:`A text panel for an exhibition`,icon:(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,children:[(0,p.jsx)(`title`,{children:`Info box`}),(0,p.jsx)(`path`,{fill:`currentColor`,d:`M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22`})]}),tags:[`exhibition-slide`],resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function ve(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),a={...w.emptyAnnotation,id:t.generateId(`annotation`,{id:n,type:`Canvas`}),type:`Annotation`},o=[await t.create(`@manifest-editor/html-body-creator`,{language:`en`,body:``},{parent:{resource:a,property:`body`}})],s=t.embed({...a,motivation:`painting`,body:o,target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}}),c=t.generateId(`annotation`,{id:n,type:`Canvas`}),l=t.embed({id:c,type:`Annotation`,motivation:`tagging`,body:[await t.create(`@manifest-editor/html-body-creator`,{language:`en`,body:``},{parent:{resource:{id:c,type:`Annotation`},property:`body`}})],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}}),u=t.embed({id:r,type:`AnnotationPage`,items:[s]}),d=t.embed({id:i,type:`AnnotationPage`,items:[l]});return t.embed({...w.emptyCanvas,id:n,type:`Canvas`,behavior:[`w-4`,`h-4`,`info`],label:e.label||void 0,height:e.height||1e3,width:e.width||1e3,items:[u],annotations:[d]})}const ye=(0,S.defineCreator)({...C.videoAnnotation,id:`@exhibitions/video-creator`,create:be,tags:[`video`,`exhibition-slide`],label:`Video`,summary:`A video for an exhibition`,resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function be(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i=await t.create(`@manifest-editor/video-annotation`,e,{target:{id:n,type:`Canvas`},targetType:`Annotation`,parent:{resource:{id:r,type:`AnnotationPage`},property:`items`}});return t.embed({id:r,type:`AnnotationPage`,items:[i]}),await(0,S.creatorHelper)(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,height:e.height||1080,width:e.width||1920,duration:e.duration,type:`bottom`,items:[i]})}const xe=(0,S.defineCreator)({...C.youTubeBodyCreator,id:`@exhibitions/youtube-creator`,create:Se,tags:[`video`,`exhibition-slide`],label:`YouTube`,summary:`A YouTube for an exhibition`});async function Se(e,t){let n=(0,u.getYouTubeId)(e.youtubeUrl),r=t.generateId(`canvas`),i=t.generateId(`annotation-page`,{id:r,type:`Canvas`}),a=await t.create(`@manifest-editor/youtube`,e,{target:{id:r,type:`Canvas`},targetType:`Annotation`,parent:{resource:{id:i,type:`AnnotationPage`},property:`items`}}),o=t.embed({id:i,type:`AnnotationPage`,items:[a]}),s=t.embed({id:`https://img.youtube.com/vi/${n}/maxresdefault.jpg`,type:`Image`,format:`image/jpeg`,width:640,height:360});return t.embed({...w.emptyCanvas,id:r,type:`Canvas`,behavior:[`w-12`,`h-8`],label:e.label||{en:[`Untitled YouTube Video`]},height:e.height||1080,width:e.width||1920,thumbnail:[s],items:[o]})}function q({children:e}){let t=(0,d.useManifest)(),{edit:n}=(0,l.useLayoutActions)();return(0,p.jsxs)(`div`,{className:`grid auto-rows-auto grid-cols-12 content-center justify-center gap-2 p-2`,children:[(0,p.jsx)(`div`,{className:`col-span-12 row-span-2 text-black flex flex-col items-center justify-center`,children:(0,p.jsx)(y.Button,{onPress:()=>t&&n(t),className:`col-span-4 row-span-4 text-md text-left text-black hover:bg-slate-100 w-full flex items-center justify-center`,children:(0,p.jsx)(d.LocaleString,{className:`block w-full text-left`,children:t?.label})})}),e]})}const J=(0,h.forwardRef)(function({isFirst:e,item:t,children:n,...r},i){let a=(0,d.useCanvas)(),[o]=(0,d.useRenderingStrategy)();a?.behavior;let s=(0,u.useInStack)(`Canvas`),c=M(a?.behavior,e),{isBottom:l,isImage:f,isInfo:m,isLeft:h}=N(a?.behavior),_=s?.resource.source?.id===a?.id,v=null;return v=m?(0,p.jsx)(`div`,{className:`bg-black w-full h-full text-white max-h-40`,children:(0,p.jsx)(`div`,{className:`p-1.5 text-[4px]`,children:o.type===`textual-content`?(0,p.jsx)(d.LocaleString,{enableDangerouslySetInnerHTML:!0,children:o.items[0]?.text}):null})}):(0,p.jsxs)(`div`,{className:(0,b.twMerge)(`flex h-full max-h-full min-h-0`,h?`flex-row-reverse`:l?`flex-col`:`flex-row`),children:[(0,p.jsx)(`div`,{className:`flex-1 overflow-hidden relative justify-self-stretch`,children:(0,p.jsx)(`div`,{className:`absolute inset-0 w-full h-full`,children:(0,p.jsx)(g.LazyThumbnail,{cover:!0,fade:!1})})}),f?null:(0,p.jsx)(`div`,{className:`${l?`min-h-3 w-full`:`w-1/3`} flex-shrink-0 self-stretch p-2 text-white bg-black rounded`,children:(0,p.jsxs)(`div`,{className:`p-1.5 text-[4px]`,children:[(0,p.jsx)(d.LocaleString,{className:`block mb-1 text-[5px]`,children:a?.label}),(0,p.jsx)(d.LocaleString,{children:a?.summary})]})})]}),(0,p.jsxs)(`div`,{ref:i,className:(0,b.twMerge)(c,`bg-me-gray-700 overflow-hidden hover:ring-2 ring-me-primary-500 relative`,_?`ring-2 ring-me-primary-500`:``),...r,children:[v,n]})});function Ce(){let{open:e}=(0,l.useLayoutActions)(),{structural:t,technical:n}=(0,l.useManifestEditor)(),[,r]=(0,l.useCreator)({id:n.id.get(),type:`Manifest`},`items`,`Manifest`);return(0,p.jsx)(q,{children:t.items.get().map((t,n)=>(0,p.jsx)(d.CanvasContext,{canvas:t.id,children:(0,p.jsx)(J,{isFirst:n===0,item:t,onClick:()=>{e({id:`current-canvas`}),r.edit(t,n)}})},n))})}function we(e){return(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,height:`1em`,width:`1em`,...e,children:[(0,p.jsx)(`title`,{children:`Rearrange`}),(0,p.jsx)(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),(0,p.jsx)(`path`,{d:`M20 9H4v2h16V9zM4 15h16v-2H4v2z`,fill:`currentColor`})]})}function Te({isFirst:e,onClick:t,item:n,actions:r}){let{attributes:i,listeners:a,setNodeRef:o,transform:s,transition:c}=(0,E.useSortable)({id:n.id,transition:{duration:150,easing:`cubic-bezier(0.25, 1, 0.5, 1)`}});return(0,p.jsx)(J,{ref:o,style:{transform:te.CSS.Translate.toString(s),transition:c},...i,...a,onClick:t,isFirst:e,item:n,children:(0,p.jsxs)(`div`,{className:`absolute top-0.5 right-0.5 flex gap-0.5 items-stretch`,children:[r?.length?(0,p.jsx)(u.AppDropdown,{as:y.Button,className:`bg-white p-1 text-2xl hover:text-me-500 aria-expanded:text-me-600 aria-expanded:bg-me-200 hover:bg-me-100 rounded-sm`,"aria-label":`Action menu`,items:r,children:(0,p.jsx)(g.MoreMenu,{})}):null,(0,p.jsx)(`div`,{className:`bg-white text-2xl h-8 flex items-center p-1 hover:text-me-500 hover:bg-me-100 rounded-sm`,children:(0,p.jsx)(we,{"aria-label":`Reorder item`})})]})})}function Ee(){let e=(0,d.useManifest)(),{structural:t,technical:n}=(0,l.useManifestEditor)(),r=(0,l.useEditingStack)(),i=(0,u.useInStack)(`Canvas`),a=t.items.get(),{open:o}=(0,l.useLayoutActions)(),s=(0,T.useSensors)((0,T.useSensor)(T.PointerSensor,{activationConstraint:{distance:5}}),(0,T.useSensor)(T.KeyboardSensor,{coordinateGetter:E.sortableKeyboardCoordinates})),[,c]=(0,l.useCreator)({id:n.id.get(),type:`Manifest`},`items`,`Manifest`),f=(0,h.useCallback)(e=>{let{active:n,over:r}=e;r&&n.id!==r.id&&t.items.reorder(a.findIndex(e=>e.id===n.id),a.findIndex(e=>e.id===r.id))},[a,t.items]),m=i?.resource.source.id,g=m?a.findIndex(e=>e.id===m):-1,_=g&&g>0?Number(g-1):0;function v(){r.close();let n=t.items.get();n&&n.length>0?c.edit(n[_]):c.edit(e)}let y=(0,h.useMemo)(()=>(0,u.createAppActions)(t.items,v),[t.items,v]);return(0,p.jsx)(q,{children:(0,p.jsx)(T.DndContext,{sensors:s,collisionDetection:T.closestCenter,onDragEnd:f,modifiers:[ee.restrictToParentElement],children:(0,p.jsx)(E.SortableContext,{items:a,strategy:E.rectSortingStrategy,children:a.map((t,n)=>t?(0,p.jsx)(d.CanvasContext,{canvas:t.id,children:(0,p.jsx)(Te,{item:t,isFirst:n===0,onClick:()=>{o({id:`current-canvas`}),c.edit(t,n)},actions:y(t,n,e)},t.id)},t.id):null)})})})}const De={id:`canvas-listing`,label:`Exhibition grid`,icon:(0,p.jsx)(Y,{}),render:()=>(0,p.jsx)(Oe,{}),options:{minWidth:350,maxWidth:350}};function Oe(){let{technical:e}=(0,l.useManifestEditor)(),[t,n]=(0,l.useCreator)({id:e.id.get(),type:`Manifest`},`items`,`Canvas`,void 0,{isPainting:!0}),[r,i]=(0,u.useToggleList)();return(0,p.jsxs)(g.Sidebar,{children:[(0,p.jsx)(g.SidebarHeader,{title:`Exhibition`,actions:[{icon:r.list?(0,p.jsx)(m.CanvasListingIcon,{className:`text-2xl`}):(0,p.jsx)(Y,{}),title:r.list?`List view`:`Grid view`,onClick:()=>i(`list`)},{icon:(0,p.jsx)(ke,{}),title:`Edit slides`,toggled:r.editing,onClick:()=>i(`editing`)},{icon:(0,p.jsx)(Ae,{}),title:`Add new slide`,disabled:!t,onClick:()=>n.createFiltered(`exhibition-slide`)}]}),(0,p.jsx)(g.SidebarContent,{children:r.list?(0,p.jsx)(m.CanvasListView,{isEditing:r.editing}):r.editing?(0,p.jsx)(Ee,{}):(0,p.jsx)(Ce,{})})]})}function Y(){return(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`currentColor`,viewBox:`0 -960 960 960`,children:[(0,p.jsx)(`title`,{children:`Exhibition grid`}),(0,p.jsx)(`path`,{d:`M600-160v-280h280v280H600ZM440-520v-280h440v280H440ZM80-160v-280h440v280H80Zm0-360v-280h280v280H80Zm440-80h280v-120H520v120ZM160-240h280v-120H160v120Zm520 0h120v-120H680v120ZM160-600h120v-120H160v120Zm360 0Zm-80 240Zm240 0ZM280-600Z`})]})}function ke(){return(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24`,viewBox:`0 0 24 24`,width:`24`,children:[(0,p.jsx)(`title`,{children:`Edit slides`}),(0,p.jsx)(`path`,{d:`M0 0h24v24H0V0z`,fill:`none`}),(0,p.jsx)(`path`,{d:`M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z`})]})}function Ae(){return(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`currentColor`,viewBox:`0 -960 960 960`,children:[(0,p.jsx)(`title`,{children:`Add new slide`}),(0,p.jsx)(`path`,{d:`M160-240v-480 480Zm80-80v-200h360v200H240Zm-80 160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v240h-80v-240H160v480h360v80H160Zm500-320v-100H360v-60h360v160h-60Zm60 400v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z`})]})}function je(){let e=(0,l.useEditor)(),t=()=>{let t=e.technical.width.get(),n=e.technical.height.get(),r=e.descriptive.summary,i=e.technical.behavior.get();i.push(`w-12`);let a=Math.max(1,Math.min(12,Math.round(t/n*12)));i.push(`h-${a}`),(0,D.getValue)(r.get())||r.set({en:[`Summary of image`]}),e.technical.behavior.set(i)};return(0,p.jsxs)(`div`,{className:`flex flex-col items-center gap-4 border-me-100 border-2 p-4 rounded`,children:[`This canvas was not created in the exhibition editor. Do you want to apply default settings?`,(0,p.jsx)(g.ActionButton,{onPress:()=>t(),children:`Apply defaults`})]})}const Me={id:`@exhibition/right-panel-editor`,supports:{edit:!0,properties:[`label`,`summary`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=N(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Exhibition`,component:()=>(0,p.jsx)(Ne,{})};function Ne(){let e=(0,d.useCanvas)(),t=(0,l.useEditingResource)(),{structural:n,descriptive:r}=(0,l.useEditor)(),{items:i}=n,{thumbnail:a}=r,o=i.get()[0],s=P(e);return!e||!o||!t?(0,p.jsx)(`div`,{className:`p-8`,children:`Canvas, page, or resource not found`}):(0,p.jsx)(g.Sidebar,{children:(0,p.jsx)(g.SidebarContent,{padding:!0,children:(0,p.jsxs)(l.ResourceEditingProvider,{resource:e,children:[s?null:(0,p.jsx)(je,{}),(0,p.jsx)(u.LanguageMapEditor,{dispatchType:`label`,disableMultiline:!0,disallowHTML:!0}),(0,p.jsx)(u.LinkingPropertyList,{containerId:a.containerId(),label:`Thumbnail`,property:`thumbnail`,items:a.get(),singleMode:!0,reorder:e=>a.reorder(e.startIndex,e.endIndex),createActions:(0,u.createAppActions)(a),creationType:`ContentResource`,emptyLabel:`No thumbnail`,parent:t?.resource}),(0,p.jsx)(d.AnnotationPageContext,{annotationPage:o.id,children:(0,p.jsx)(u.PaintingAnnotationList,{createFilter:`image`})})]})})})}const Pe={id:`@exhibition/summary-editor`,supports:{edit:!0,properties:[`summary`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=N(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Summary`,component:()=>(0,p.jsx)(Fe,{})};function Fe(){let e=(0,d.useCanvas)();return e?(0,p.jsx)(g.Sidebar,{children:(0,p.jsx)(g.SidebarContent,{padding:!0,children:(0,p.jsxs)(l.ResourceEditingProvider,{resource:e,children:[(0,p.jsx)(u.LanguageMapEditor,{dispatchType:`label`}),(0,p.jsx)(u.LanguageMapEditor,{dispatchType:`summary`})]})})}):null}function X(e){return(0,p.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,...e,children:(0,p.jsx)(`path`,{fill:`currentColor`,d:`M9 16.17L4.83 12l-1.42 1.41L9 19L21 7l-1.41-1.41z`})})}const Z=`<h2>New step</h2><p>Description</p>`;function Ie(){let{saveAnnotation:e}=(0,d.useCurrentAnnotationActions)(),[t,n]=(0,d.useCurrentAnnotationMetadata)(),{editorFeatureFlags:r}=(0,l.useConfig)(),{annotationPopups:i}=r;return i?(0,p.jsxs)(`div`,{className:`bg-white shadow-md rounded-lg`,children:[(0,p.jsx)(`div`,{className:`prose-headings:mt-1 overflow-y-auto rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500`,children:(0,p.jsx)(g.HTMLEditor,{className:`border-none`,value:t.bodyValue||Z,onChange:e=>n({bodyValue:e})})}),(0,p.jsxs)(`div`,{className:`flex gap-2 p-3`,children:[(0,p.jsxs)(g.ActionButton,{primary:!0,onPress:()=>e(),children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsx)(u.AnnotationPopUpSwitcherButton,{})]})]}):(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(g.ActionButton,{primary:!0,onPress:()=>e(),children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsx)(u.AnnotationPopUpSwitcherButton,{})]})}function Le(){let e=(0,f.useStore)((0,l.useAtlasStore)(),e=>e.polygon),[t,n]=(0,d.useCurrentAnnotationMetadata)(),{editorFeatureFlags:r}=(0,l.useConfig)(),{annotationPopups:i}=r,{cancelRequest:a,saveAnnotation:o}=(0,d.useCurrentAnnotationActions)();return(0,p.jsxs)(`div`,{className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[(0,p.jsxs)(`div`,{className:`bg-me-primary-500 text-white p-2 m-1 rounded flex gap-2`,children:[(0,p.jsx)(g.TargetIcon,{}),`Draw a box on the canvas`]}),i?(0,p.jsx)(`div`,{className:`relative p-3 line-clamp-3 prose-p:text-slate-600`,children:(0,p.jsx)(`div`,{className:`prose-headings:mt-1 prose-headings:mb-1 prose-sm`,children:(0,p.jsx)(`div`,{dangerouslySetInnerHTML:{__html:t.bodyValue||Z}})})}):(0,p.jsx)(g.HTMLEditor,{className:`border-none`,value:t.bodyValue||Z,onChange:e=>n({bodyValue:e})}),(0,p.jsxs)(`div`,{className:`flex gap-2 p-3`,children:[(0,p.jsxs)(g.ActionButton,{isDisabled:e?.points.length===0,onPress:()=>o(),children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsxs)(g.ActionButton,{className:`gap-2 flex`,onPress:()=>a(),children:[(0,p.jsx)(g.DeleteIcon,{}),` Delete`]}),(0,p.jsx)(u.AnnotationPopUpSwitcherButton,{})]})]})}function Re(){let{editorFeatureFlags:e}=(0,l.useConfig)(),{annotationPopups:t}=e,n=(0,l.useSaveConfig)();return(0,p.jsx)(g.ActionButton,{className:`ml-auto`,onPress:()=>n({editorFeatureFlags:{...e,annotationPopups:!t}}),children:t?(0,p.jsx)(g.AnnotationPopInIcon,{}):(0,p.jsx)(g.AnnotationPopOutIcon,{})})}function ze({highlightProps:e}){let t=(0,h.useContext)(l.ResourceEditingReactContext),n=(0,d.useAnnotation)(),{editorFeatureFlags:r}=(0,l.useConfig)(),{annotationPopups:i}=r,{isPending:a,cancelRequest:o,busy:s,requestAnnotationFromTarget:c,deleteAnnotation:f}=(0,u.useAnnotationEditor)({annotationPopup:(0,p.jsx)(d.AnnotationContext,{annotation:n.id,children:(0,p.jsx)(l.ResourceEditingReactContext.Provider,{value:t,children:(0,p.jsx)(Be,{})})})}),[m,_]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{m&&!a&&_(!0)},[a,m]),(0,p.jsxs)(`div`,{...e,className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[(0,p.jsx)(`div`,{className:`relative`,children:m&&!i?(0,p.jsx)(u.HTMLAnnotationEditor,{className:`border-none`}):(0,p.jsx)(g.HTMLAnnotationBodyRender,{className:`px-3 pt-3 line-clamp-3 prose-p:text-slate-600`,locale:`en`})}),(0,p.jsxs)(`div`,{className:`flex gap-2 p-2`,children:[m&&a?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(g.ActionButton,{primary:!0,onPress:()=>{_(!1),o()},children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsx)(u.AnnotationPopUpSwitcherButton,{})]}):(0,p.jsxs)(g.ActionButton,{isDisabled:s,onPress:()=>{_(!0),c().then(()=>{_(!1)})},children:[(0,p.jsx)(g.EditTextIcon,{}),` Edit`]}),(0,p.jsxs)(g.ActionButton,{className:`gap-2 flex`,onPress:()=>f(),children:[(0,p.jsx)(g.DeleteIcon,{}),` Delete`]})]}),(0,p.jsx)(`div`,{className:`absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0`})]})}function Be(){let{editorFeatureFlags:e}=(0,l.useConfig)(),{annotationPopups:t}=e,{saveAnnotation:n}=(0,d.useCurrentAnnotationActions)();return t?(0,p.jsxs)(`div`,{className:`bg-white shadow-md rounded-lg relative max-h-[50vh] overflow-y-auto`,children:[(0,p.jsx)(`div`,{className:`prose-headings:mt-1 rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500`,children:(0,p.jsx)(u.HTMLAnnotationEditor,{className:`border-none`})}),(0,p.jsxs)(`div`,{className:`flex gap-2 p-2 sticky bottom-0 z-50 bg-white`,children:[(0,p.jsxs)(g.ActionButton,{primary:!0,onPress:()=>{n()},children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsx)(Re,{})]})]}):(0,p.jsxs)(`div`,{className:`flex gap-2`,children:[(0,p.jsxs)(g.ActionButton,{primary:!0,onPress:()=>n(),children:[(0,p.jsx)(X,{}),` Finish editing`]}),(0,p.jsx)(u.AnnotationPopUpSwitcherButton,{})]})}function Ve({originalAnnotationId:e,highlightProps:t}){let n=(0,l.useGenericEditor)((0,d.useAnnotationPage)()),r=(0,d.useAnnotation)(),{edit:i}=(0,l.useLayoutActions)(),[a,o]=(0,h.useState)(!1),s=()=>{if(e&&confirm(`Are you sure you want to delete this annotation?`)){let t=n.structural.items.getWithoutTracking().findIndex(t=>t.id===e);n.structural.items.deleteAtIndex(t)}};return(0,p.jsxs)(`div`,{...t,className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[(0,p.jsx)(`div`,{className:`flex gap-2 mb-2 p-3`,children:(0,p.jsx)(`div`,{className:`flex-1 min-w-0`,children:a?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`h3`,{className:`text-lg font-semibold border-b pt-1 pb-2 mb-2`,children:`Edit step`}),(0,p.jsx)(u.LanguageMapEditor,{dispatchType:`label`}),(0,p.jsx)(u.LanguageMapEditor,{dispatchType:`summary`})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.LocaleString,{as:`div`,defaultText:(0,p.jsx)(`span`,{className:`opacity-50`,children:`Untitled`}),className:`whitespace-nowrap overflow-ellipsis w-full overflow-x-hidden`,children:r?.label}),(0,p.jsx)(d.LocaleString,{className:`text-gray-500 text-sm bg-white line-clamp-2`,as:`div`,children:r?.summary})]})})}),(0,p.jsxs)(`div`,{className:`flex gap-2 p-2`,children:[a?(0,p.jsxs)(g.ActionButton,{onPress:()=>o(!1),children:[(0,p.jsx)(X,{}),` Finish editing`]}):(0,p.jsxs)(g.ActionButton,{onPress:()=>o(!0),children:[(0,p.jsx)(g.EditTextIcon,{}),` Edit body`]}),(0,p.jsx)(g.ActionButton,{onPress:()=>i(r),children:`Edit annotation`}),(0,p.jsxs)(g.ActionButton,{className:`gap-2 flex`,onPress:()=>s(),children:[(0,p.jsx)(g.DeleteIcon,{}),` Delete`]})]}),(0,p.jsx)(`div`,{className:`absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0`})]})}function Q(){let[e,{annotationTarget:t,highlightProps:n}]=(0,u.useAnnotationInfo)(),r=(0,h.useMemo)(()=>t?{id:t,type:`Annotation`}:{id:e?.id,type:`Annotation`},[e?.id,t]);return t?(0,p.jsx)(l.ResourceEditingProvider,{resource:r,children:(0,p.jsx)(d.AnnotationContext,{annotation:t,children:(0,p.jsx)(Ve,{originalAnnotationId:e?.id,highlightProps:n})})}):(0,p.jsx)(l.ResourceEditingProvider,{resource:r,children:(0,p.jsx)(ze,{highlightProps:n})})}function $({reorderable:e=!1}){let t=(0,d.useAnnotationPage)(),n=(0,l.useGenericEditor)(t);return t?e?(0,p.jsx)(p.Fragment,{children:(0,p.jsx)(u.ReorderList,{id:t.id,marginBottom:`0.5em`,items:t.items||[],inlineHandle:!1,reorder:({startIndex:e,endIndex:t})=>n.structural.items.reorder(e,t),renderItem:(e,t)=>(0,p.jsx)(d.AnnotationContext,{annotation:e.id,children:(0,p.jsx)(Q,{})})})}):(0,p.jsx)(p.Fragment,{children:t.items.map(e=>(0,p.jsx)(d.AnnotationContext,{annotation:e.id,children:(0,p.jsx)(Q,{})},e.id))}):null}const He={id:`@exhibition/tour-steps`,supports:{edit:!0,properties:[`annotations`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=N(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Tour steps`,component:()=>(0,p.jsx)(Ue,{})};function Ue(){let e=(0,d.useCanvas)(),t=e?.annotations[0],n=e?.items[0];return!t||!e||!n?(0,p.jsx)(We,{}):(0,p.jsx)(Ge,{})}function We(){let e=(0,d.useCanvas)(),t=(0,l.useInlineCreator)(),n=()=>{e&&t.create(`@manifest-editor/empty-annotation-page`,{label:{en:[`Tour steps`]}},{target:{id:e.id,type:`Canvas`},targetType:`AnnotationPage`,parent:{property:`annotations`,resource:{id:e.id,type:`Canvas`}}})};return(0,p.jsxs)(`div`,{className:`flex flex-col items-center justify-center p-4`,children:[(0,p.jsx)(`div`,{className:`p-4 opacity-50 text-center`,children:`This image does not yet have a tour.`}),(0,p.jsx)(y.Button,{className:`border w-full disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500`,onPress:()=>n(),children:`Create Tour`})]})}function Ge(){let e=(0,d.useCanvas)(),t=e?.annotations[0],n=e?.items[0],r=(0,l.useGenericEditor)(t),i=(0,l.useInlineCreator)(),[a,o]=(0,h.useState)(!1),{requestAnnotation:s,isPending:c,busy:f,cancelRequest:m,completeRequest:_}=(0,d.useRequestAnnotation)({onSuccess:n=>{let r=n.metadata.bodyValue||``;!n.cancelled&&n.target&&t&&i.create(`@manifest-editor/html-annotation`,{label:{en:[`Tour step`]},body:{en:[r||`<h2>New step</h2><p>Description</p>`]},motivation:`tagging`},{target:{id:e.id,type:`Canvas`},targetType:`Annotation`,parent:{property:`items`,resource:{id:t.id,type:`AnnotationPage`}},initialData:{selector:n}})}});return e?t?(0,p.jsx)(g.Sidebar,{children:(0,p.jsxs)(g.SidebarContent,{padding:!0,children:[(0,p.jsxs)(`div`,{className:`flex gap-4 border-b pt-4 pb-2 mb-2`,children:[(0,p.jsx)(`h2`,{className:`text-lg font-semibold flex-1`,children:`Tour steps`}),(0,p.jsx)(g.ActionButton,{onPress:()=>o(e=>!e),children:a?`Done`:`Reorder`})]}),(0,p.jsx)(l.ResourceEditingProvider,{resource:e,children:(0,p.jsxs)(d.AnnotationPageContext,{annotationPage:t.id,children:[(0,p.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,p.jsx)($,{reorderable:a}),f?null:c?(0,p.jsx)(Le,{}):(0,p.jsx)(y.Button,{onPress:()=>s({type:`box`,annotationPopup:(0,p.jsx)(Ie,{})}),className:`border disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500`,children:`+ Add new step`})]}),n?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`h3`,{className:`text-md border-b pt-4 pb-2 mb-2`,children:`Available tour steps from images`}),(0,p.jsx)(u.PromptToAddPaintingAnnotations,{painting:n,page:r.ref(),canvasId:e.id})]}):null]})})]})}):(0,p.jsx)(`div`,{children:`No annotation page - create one?`}):null}function Ke(){let e=(0,d.useCanvas)();(0,x.default)(e);let t=e.width&&e.height?e.width/e.height:0,n=le(e.behavior||[]);return Math.abs(t-n.ratio)<.01?null:(0,p.jsxs)(`div`,{className:`p-2 rounded bg-me-100`,children:[(0,p.jsx)(`div`,{className:`text-me-700-500`,children:`Aspect ratio warning`}),(0,p.jsxs)(`div`,{className:`text-sm text-black/60`,children:[`The aspect ratio of this canvas is `,t.toFixed(2),` but the target aspect ratio is `,n.ratio.toFixed(2),`. Some parts of this image may be cropped.`,(0,p.jsx)(`div`,{className:`relative h-32 w-full mt-2`,children:(0,p.jsx)(`div`,{className:`bg-[red] left-0 top-0 z-2 opacity-50 max-w-32 max-h-32`,style:{aspectRatio:t.toFixed(2)},children:(0,p.jsx)(`div`,{className:`asbolute bg-[white] left-0 top-0 z-1 opacity-50 max-w-32 max-h-32`,style:{aspectRatio:n.ratio}})})})]})]})}const qe={component:()=>(0,p.jsx)(Ze,{}),supports:{edit:!0,resourceTypes:[`Canvas`],properties:[`behavior`]},id:`slide-behaviors`,label:`Layout`,tabs:{showTitle:!0}},Je=[{id:`layout`,type:`choice`,label:{en:[`Layout`]},initialOpen:!0,items:[{label:{en:[`Text on left`]},value:`left`},{label:{en:[`Text on right`]},value:`right`},{label:{en:[`Text on bottom`]},value:`bottom`},{label:{en:[`Text on top`]},value:`top`},{label:{en:[`Only image`]},value:`image`}]},{id:`floating`,type:`choice`,label:{en:[`Floating`]},initialOpen:!1,addNone:!0,groupBehavior:`floating`,items:[{label:{en:[`Float top left`]},value:`float-top-left`},{label:{en:[`Float top right`]},value:`float-top-right`},{label:{en:[`Float bottom left`]},value:`float-bottom-left`},{label:{en:[`Float bottom right`]},value:`float-bottom-right`}]},{id:`size`,component:(e,t)=>(0,p.jsx)(Xe,{behaviors:e,setBehaviors:t}),label:{en:[`Size`]},type:`custom`,initialOpen:!0,supports:e=>e.startsWith(`w-`)||e.startsWith(`h-`)}];function Ye(e){let t=0,n=0;for(let r of e)r.startsWith(`w-`)&&(t=Number.parseInt(r.slice(2))),r.startsWith(`h-`)&&(n=Number.parseInt(r.slice(2)));return{width:t,height:n}}function Xe({behaviors:e,setBehaviors:t}){let{width:n,height:r}=Ye(e),[i,a]=(0,h.useState)({x:-1,y:-1}),o=(n,r)=>{let i=e.filter(e=>!e.startsWith(`w-`)&&!e.startsWith(`h-`));i.push(`w-${n}`),i.push(`h-${r}`),t(i)};return(0,p.jsx)(`div`,{className:`grid grid-cols-12 grid-rows-12 gap-1`,onMouseLeave:()=>a({x:-1,y:-1}),children:Array.from({length:144},(e,t)=>{let s=t%12,c=Math.floor(t/12),l=i.x>=s&&i.y>=c,u=s<n&&c<r,d=l&&u,f=`bg-gray-200`;return l&&(f=`bg-me-200`),u&&(f=`bg-me-500`),d&&(f=`bg-me-400`),(0,p.jsx)(`div`,{className:`flex aspect-square rounded cursor-se-resize items-center justify-center ${f}`,onClick:()=>o(s+1,c+1),onMouseUp:()=>o(s+1,c+1),onMouseEnter:()=>a({x:s,y:c})},t)})})}function Ze(){let e=(0,u.useInStack)(`Canvas`),t=(0,l.useEditor)(),{width:n,height:r}=t.technical;return!e||t.technical.type!==`Canvas`?(0,p.jsxs)(g.Sidebar,{children:[(0,p.jsx)(g.SidebarHeader,{title:`Slide behaviors`}),(0,p.jsx)(`div`,{children:`Please select canvas`})]}):(0,p.jsx)(g.Sidebar,{children:(0,p.jsxs)(g.SidebarContent,{children:[(0,p.jsx)(`div`,{className:`px-2`,children:(0,p.jsxs)(u.InputContainer,{$wide:!0,children:[(0,p.jsx)(u.DimensionsTriplet,{widthId:n.containerId(),width:n.get()||0,changeWidth:e=>n.set(e),heightId:r.containerId(),height:r.get()||0,changeHeight:e=>r.set(e)}),(0,p.jsx)(`div`,{children:(0,p.jsx)(Ke,{})})]})}),(0,p.jsx)(u.BehaviorEditor,{behavior:t.technical.behavior.get()||[],onChange:e=>{t.technical.behavior.set(e)},configs:Je})]})})}const Qe=(0,l.extendApp)((0,l.mapApp)(c),{id:`exhibition-editor`,title:`Exhibition Editor`,project:!0,projectType:`Manifest`},{config:{editorConfig:{Canvas:{hideTabs:[`@manifest-editor/overview`,`@manifest-editor/technical-properties`,`@manifest-editor/linking-properties`,`@manifest-editor/nav-place-editor`,`@manifest-editor/canvas-structural`,`@manifest-editor/descriptive-properties`,`@manifest-editor/overview-canvas-editor`,`@manifest-editor/metadata`]}}},leftPanels:[De,j],centerPanels:[A],annotations:[O],leftPanelIds:[`left-panel-manifest`],background:[ie],canvasEditors:[F,V,R],editors:[Me,qe,Pe,He],creators:[_e,xe,ue,U,G,he,ye]});exports.exhibitionEditorPreset=Qe;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import*as e from"@manifest-editor/manifest-preset";import{ResourceEditingProvider as t,ResourceEditingReactContext as n,extendApp as r,mapApp as i,useAtlasStore as a,useConfig as o,useCreator as s,useEditingResource as c,useEditingStack as l,useEditor as u,useGenericEditor as d,useInlineCreator as f,useLayoutActions as p,useLayoutState as m,useLocalStorage as ee,useManifestEditor as h,useSaveConfig as g}from"@manifest-editor/shell";import{AnnotationBodyEditor as te,AnnotationPopUpSwitcherButton as _,AppDropdown as ne,BehaviorEditor as re,CanvasPanelEditor as ie,DimensionsTriplet as ae,HTMLAnnotationEditor as oe,InputContainer as se,LanguageMapEditor as v,LinkingPropertyList as ce,PaintingAnnotationList as le,PromptToAddPaintingAnnotations as ue,ReorderList as de,ViewerAnnotationPage as fe,createAppActions as pe,getYouTubeId as me,useAnnotationEditor as he,useAnnotationInfo as ge,useInStack as y,useToggleList as _e}from"@manifest-editor/editors";import{AnnotationContext as b,AnnotationPageContext as x,CanvasContext as S,LocaleString as C,useAnnotation as w,useAnnotationPage as ve,useCanvas as T,useCurrentAnnotationActions as E,useCurrentAnnotationMetadata as ye,useManifest as D,useRenderingStrategy as be,useRequestAnnotation as xe,useVault as Se,useVaultSelector as O}from"react-iiif-vault";import{useStore as k}from"zustand";import{Fragment as A,jsx as j,jsxs as M}from"react/jsx-runtime";import{CanvasListView as Ce,CanvasListingIcon as we,useEditCanvasItems as Te}from"@manifest-editor/manifest-preset/components";import{forwardRef as Ee,useCallback as De,useContext as Oe,useEffect as N,useLayoutEffect as P,useMemo as F,useRef as I,useState as L}from"react";import{ActionButton as R,AnnotationPopInIcon as ke,AnnotationPopOutIcon as Ae,DeleteIcon as z,EditTextIcon as B,EmptyCanvasIcon as je,HTMLAnnotationBodyRender as Me,HTMLEditor as Ne,LazyThumbnail as Pe,MoreMenu as Fe,Sidebar as V,SidebarContent as H,SidebarHeader as Ie,TargetIcon as Le}from"@manifest-editor/components";import{DelftExhibition as Re}from"exhibition-viewer";import{EditorHooksProvider as ze}from"exhibition-viewer/library";import{Button as U}from"react-aria-components";import{twMerge as W}from"tailwind-merge";import Be from"tiny-invariant";import{creatorHelper as G,defineCreator as K}from"@manifest-editor/creator-api";import{iiifBrowserCreator as Ve,imageServiceCreator as He,imageUrlCreator as Ue,videoAnnotation as We,youTubeBodyCreator as Ge}from"@manifest-editor/creators";import{emptyAnnotation as Ke,emptyAnnotationPage as qe,emptyCanvas as q}from"@iiif/parser";import{DndContext as Je,KeyboardSensor as Ye,PointerSensor as Xe,closestCenter as Ze,useSensor as Qe,useSensors as $e}from"@dnd-kit/core";import{restrictToParentElement as et}from"@dnd-kit/modifiers";import{SortableContext as tt,rectSortingStrategy as nt,sortableKeyboardCoordinates as rt,useSortable as it}from"@dnd-kit/sortable";import{CSS as at}from"@dnd-kit/utilities";import{getValue as ot}from"@iiif/helpers";const st={id:`@exhibition/tour-step-annotations`,label:`Tour steps`,render:()=>j(ct,{})};function ct(){let e=T(),t=k(a(),e=>e.tool.enabled),{rightPanel:n}=m(),r=n.current===`@manifest-editor/editor`&&n.state?.currentTab?.startsWith(`@exhibition/tour-steps`),i=e?.annotations[0];return!r||!e||t||!i?null:j(A,{children:j(x,{annotationPage:i.id,children:j(fe,{})})})}const lt={id:`@exhibitions/center-panel`,label:`Exhibition editor`,icon:null,render:()=>j(ut,{}),options:{minWidth:350,maxWidth:350}};function ut(){let e=D(),t=Se(),[n,r]=L(.8),i=I(null),{edit:a,leftPanel:o}=p(),s=F(()=>({localeStringEditor:e=>M(`span`,{className:`inline-flex items-center hover:ring-4 hover:ring-me-primary-500`,children:[e.original,j(U,{className:`py-1 px-2 inline-block`,onPress:()=>a(e.resource),children:j(B,{className:`text-xl`})})]}),canvasPreviewEditor:e=>M(`div`,{className:`w-full h-full flex-1 flex relative`,children:[e.original,j(`button`,{onClick:t=>{t.preventDefault(),t.stopPropagation(),a(e.resource),o.open({id:`canvas-listing`,open:!0})},className:`absolute top-5 right-5 bg-white text-black p-2 rounded z-40`,children:`EDIT`})]})}),[]);return P(()=>{if(i.current){let e=i.current.offsetWidth/1200;r(Math.max(1,e))}},[]),e?j(`div`,{ref:i,className:`overflow-y-auto delft-exhibition`,children:j(ze,{hooks:s,children:j(Re,{skipLoadManifest:!0,customVault:t,manifest:e.id,options:{disablePresentation:!0,hideTableOfContents:!0,hideTitle:!0,alternativeImageMode:!0}},n)})}):null}const dt={id:`@exhibitions/overview-panel`,label:``,icon:j(`div`,{className:`hidden hover:block`,children:`👀`}),render:()=>j(ft,{})};function ft(){return D()?j(`div`,{children:`Coming soon.`}):null}const pt={id:`exhibition-background-task`,label:`Query string`,render:()=>j(mt,{})};function mt(){console.log(`rendering?`);let e=D();y(`Canvas`);let{leftPanel:t,rightPanel:n}=m(),{edit:r,leftPanel:i,rightPanel:a,centerPanel:s}=p(),{canvasActions:c,open:l}=Te(),{editorFeatureFlags:{rememberCanvasId:u=!0,rememberLeftPanelId:d=!1}={}}=o();return t.open,N(()=>{e&&t.current===dt.id&&(r(e),s.open({id:lt.id}),i.close())},[t.current]),null}const ht={"h-1":`lg:min-h-[100px] row-span-1`,"h-2":`lg:min-h-[200px] row-span-2`,"h-3":`lg:min-h-[300px] row-span-3`,"h-4":`lg:min-h-[400px] row-span-4`,"h-5":`lg:min-h-[500px] row-span-5`,"h-6":`lg:min-h-[600px] row-span-6`,"h-7":`lg:min-h-[700px] row-span-7`,"h-8":`lg:min-h-[800px] row-span-8`,"h-9":`lg:min-h-[900px] row-span-9`,"h-10":`lg:min-h-[1000px] row-span-10`,"h-11":`lg:min-h-[1100px] row-span-11`,"h-12":`lg:min-h-[1200px] row-span-12`},gt={"h-1":`lg:min-h-[25px] row-span-1`,"h-2":`lg:min-h-[50px] row-span-2`,"h-3":`lg:min-h-[75px] row-span-3`,"h-4":`lg:min-h-[100px] row-span-4`,"h-5":`lg:min-h-[125px] row-span-5`,"h-6":`lg:min-h-[150px] row-span-6`,"h-7":`lg:min-h-[175px] row-span-7`,"h-8":`lg:min-h-[200px] row-span-8`,"h-9":`lg:min-h-[225px] row-span-9`,"h-10":`lg:min-h-[250px] row-span-10`,"h-11":`lg:min-h-[275px] row-span-11`,"h-12":`lg:min-h-[300px] row-span-12`},_t={"w-1":`col-span-1`,"w-2":`col-span-2`,"w-3":`col-span-3`,"w-4":`col-span-4`,"w-5":`col-span-5`,"w-6":`col-span-6`,"w-7":`col-span-7`,"w-8":`col-span-8`,"w-9":`col-span-9`,"w-10":`col-span-10`,"w-11":`col-span-11`,"w-12":`col-span-12`};function vt(e){let{isLeft:t,isRight:n,isBottom:r}=J(e),i=e?.find(e=>e.includes(`h-`)),a=e?.find(e=>e.includes(`w-`));if(!i||!a)return{h:0,w:0,ratio:1};let o={h:Number.parseInt(i.split(`-`)[1]),w:Number.parseInt(a.split(`-`)[1]),ratio:1};return(t||n)&&(o.w*=2/3),r&&(o.h*=2/3),o.h&&o.w&&(o.ratio=o.w/o.h),o}function yt(e,t=!1,n=!0){(!e||e.length===0)&&(e=[`h-8`,`w-8`,`image`]);let r=e.find(e=>e.includes(`h-`)),i=e.find(e=>e.includes(`w-`)),a=[];return t&&r===`h-4`&&(r=`h-8`),a.push(n?gt[r]:ht[r]),a.push(_t[i]),a.join(` `)}function J(e){let t=e?.includes(`right`),n=e?.includes(`left`),r=e?.includes(`bottom`),i=e?.includes(`top`),a=e?.includes(`image`)||!n&&!t&&!r&&!i;return{isRight:t,isLeft:n,isBottom:r,isTop:i,isInfo:e?.includes(`info`),isImage:a}}function bt(e){if(!e)return!1;let t=e.behavior||[];if(t.includes(`image`)||t.includes(`info`))return!0;for(let e of t)if(e.startsWith(`w-`)||e.startsWith(`h-`))return!0;return!1}const xt={id:`image-block-editor`,label:`Image Block Editor`,component:e=>j(St,{strategy:e}),supports:{strategy:(e,t,n)=>{if(e.type!==`images`)return!1;let r=n.get(t.resource);if(r.type!==`Canvas`)return!1;let i=r.behavior||[],a=!1;for(let e of i)(e.startsWith(`w-`)||e.startsWith(`h-`)||e===`image`)&&(a=!0);return a}}};function St({strategy:e}){let[t,n]=ee(`exhibition-preview-mode`),r=y(`Canvas`);return r?M(S,{canvas:r.resource.source?.id,children:[M(`div`,{className:`flex gap-4 bg-me-500 py-2 px-4 text-white shadow-md z-40 ring-1 ring-me-500 items-center`,children:[`Switch view`,j(R,{onPress:()=>n(!t),children:t?`Full canvas`:`Layout preview`})]}),t?j(Ct,{}):j(`div`,{className:`h-full flex flex-1 min-h-0`,children:j(ie,{asFallback:!0})})]}):null}function Ct(){let e=I(null),t=T(),n=yt(t?.behavior||[],!1,!1),{isBottom:r,isImage:i,isInfo:a,isLeft:o}=J(t?.behavior),[s,c]=L(1);return P(()=>{let t=e.current;if(!t)return;let n=t.offsetWidth;c(n/1200)},[t]),j(`div`,{className:`overflow-hidden h-full w-full`,ref:e,children:j(`div`,{className:`grid grid-cols-12 grid-rows-12 h-full bg-white`,children:M(`div`,{className:W(n,`flex h-full max-h-full min-h-0 ring-4 ring-black`,o?`flex-row-reverse`:r?`flex-col`:`flex-row`),children:[j(`div`,{className:`flex-1 h-full flex min-w-0`,children:j(ie,{asFallback:!0})}),i?null:j(`div`,{className:`${r?`min-h-3 w-full`:`w-1/3`} flex-shrink-0 self-stretch text-white bg-black rounded p-8 relative h-full`,children:M(`div`,{style:{fontSize:`${s*16}px`},children:[j(C,{className:`block mb-4`,children:t?.label}),j(C,{children:t?.summary})]})})]})})})}const wt={id:`info-block-editor`,label:`info Block Editor`,component:e=>j(Tt,{strategy:e}),supports:{strategy:(e,t,n)=>e.type===`textual-content`}};function Tt(e){let t=T(),n=O((e,n)=>n.get(t?.items[0])),r=O((e,n)=>t?.annotations[0]?n.get(t?.annotations[0]):null);return M(`div`,{className:`overflow-y-auto bg-white shadow`,children:[j(`div`,{className:`mb-12`,children:n.items.map((e,t)=>j(b,{annotation:e.id,children:j(Et,{})},e.id+t))}),r?M(A,{children:[j(`h2`,{className:`text-2xl font-bold px-4 border-t border-gray-200 pt-4 mb-4`,children:`Long Summaries`}),j(`p`,{className:`my-4 px-4`,children:`Long summaries are used to provide more detailed information about the canvas. They appear when the user clicks "read more" in the exhibition.`}),r.items.map((e,t)=>j(b,{annotation:e.id,children:j(Et,{})},e.id+t))]}):null]})}function Et(){let e=w(),t=f(),n=e?.body||[],r=d(e);return e?M(`div`,{children:[n.map((e,t)=>j(te,{className:`p-4 hover:bg-me-100/40 focus-within:bg-me-100/40`,resourceId:e.id,onRemove:()=>r.annotation.body.deleteAtIndex(t)},t)),j(`div`,{className:`p-4`,children:j(R,{primary:!0,onPress:()=>{t.create(`@manifest-editor/html-body-creator`,{language:`en`,value:``},{targetType:`ContentResource`,parent:{property:`body`,resource:{id:e.id,type:`Annotation`}},initialData:{}})},children:`Add new annotation`})})]}):null}const Dt={id:`youtube-main-editor`,label:`YouTube main editor`,component:e=>e.type===`media`?j(Ot,{strategy:e,video:e.media}):null,supports:{strategy:(e,t,n)=>(console.log(e),!(e.type!==`media`||e.media.type!==`VideoYouTube`))}};function Ot({strategy:e,video:t}){let{edit:n}=p(),r=T(),i=O((e,t)=>t.get(r?.items[0]).items[0]);Be(r&&i);let a=I(null),o=d(i),s=t,c=(r.width||1)/(r.height||1);return`${s.youTubeId}`,M(`div`,{className:`overflow-y-auto`,children:[j(`div`,{className:`p-8`,children:j(`div`,{className:`bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto`,style:{aspectRatio:c},children:j(`iframe`,{title:`YouTube video`,className:`border-none w-full h-full object-contain`,ref:a,src:`https://www.youtube.com/embed/${s.youTubeId}?enablejsapi=1&origin=${window.location.host}&modestbranding=1&rel=0`,referrerPolicy:`no-referrer compute-pressure`,sandbox:`allow-scripts allow-same-origin allow-presentation`})})}),M(`div`,{className:`bg-white shadow w-full p-8 flex gap-8`,children:[j(`div`,{children:j(`div`,{className:`w-64 bg-black flex-shrink-0 flex items-center justify-center rounded overflow-clip`,style:{aspectRatio:c},children:r.thumbnail?.length?j(Pe,{cover:!0}):j(`div`,{className:`text-white/50 text-center py-16`,children:`No thumbnail`})})}),M(`div`,{className:`flex-1`,children:[j(C,{as:`h3`,className:`text-2xl font-bold mt-4`,defaultText:j(`span`,{className:`text-black/30`,children:`No Label`}),children:o.descriptive.label.get()}),j(C,{as:`p`,className:`mt-2 mb-8`,defaultText:j(`span`,{className:`text-black/30`,children:`No summary`}),children:o.descriptive.summary.get()}),j(R,{onPress:()=>n(o.ref()),children:`Edit properties`})]})]})]})}const kt=K({...Ve,id:`@exhibitions/browser-creator`,create:At,tags:[`image`,`exhibition-slide`],label:`IIIF Browser`,summary:`Browse IIIF Resources`});async function At(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i={width:0,height:0},a=await G(t,{id:r,type:`AnnotationPage`},`items`,`@manifest-editor/iiif-browser-creator`)({...e,trackSize({width:e,height:t}){i.height=t,i.width=e}},{targetType:`Annotation`,target:{id:n,type:`Canvas`}});return await G(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:i.width,height:i.height,type:`default`,items:a})}const jt=K({...He,id:`@exhibitions/image-service-creator`,create:Mt,tags:[`image`,`exhibition-slide`],label:`IIIF Image`,summary:`IIIF Image service`,resourceType:`Canvas`,supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function Mt(e,t){let n=t.generateId(`canvas`);t.generateId(`annotation-page`,{id:n,type:`Canvas`});let r=await G(t,{id:t.generateId(`annotation`),type:`Annotation`},`body`,`@manifest-editor/image-service-creator`)(e,{target:{id:n,type:`Canvas`}}),{width:i,height:a}=r.get(),o=t.embed({id:t.generateId(`annotation`),type:`Annotation`,motivation:`painting`,body:[r],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}});return await G(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:i,height:a,type:`default`,items:[o]})}const Y=K({id:`@exhibitions/image-slide-creator`,create:X,label:`Empty slide`,summary:`An empty image slide.`,icon:j(je,{}),tags:[`exhibition-slide`],resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});K({...Y,id:`@exhibitions/image-slide-creator-left`,label:`Image (Left)`,summary:`An image with text on the left.`,icon:j(`div`,{children:`IMAGE (LEFT)`}),create:(e,t)=>X({...e,type:`left`},t)}),K({...Y,id:`@exhibitions/image-slide-creator-right`,label:`Image (Right)`,summary:`An image with text on the right.`,icon:j(`div`,{children:`IMAGE (RIGHT)`}),create:(e,t)=>X({...e,type:`right`},t)}),K({...Y,id:`@exhibitions/image-slide-creator-bottom`,label:`Image (Bottom)`,summary:`An image with text at the bottom.`,icon:j(`div`,{children:`IMAGE (BOTTOM)`}),create:(e,t)=>X({...e,type:`bottom`},t)});function X(e,t){let n=e.canvasId||t.generateId(`Canvas`),r=t.generateId(`AnnotationPage`,{id:n,type:`Canvas`}),i=t.generateId(`AnnotationPage`,{id:n,type:`Canvas`}),a=[],o=6e3;if(e.width&&e.height)if(e.width>e.height){let t=e.width/12,n=`h-${Math.floor(e.height/t)}`;a.push(`w-12`,n)}else{let t=e.height/12,n=`w-${Math.floor(e.width/t)}`;a.push(n,`h-12`)}else a.push(`w-12`,`h-4`);switch(e.type){case`left`:a.push(`left`),o*=2/3;break;case`right`:a.push(`right`),o*=2/3;break;case`bottom`:a.push(`bottom`);break}return e.items?.length||a.push(`multi-image`),t.embed({...q,id:n,behavior:a,label:e.label||{en:[`Untitled`]},height:e.height||2e3,duration:e.duration,width:e.width||o,items:[t.embed({...qe,id:r,type:`AnnotationPage`,items:e.items?e.items:[]})],annotations:[t.embed({...qe,id:i,type:`AnnotationPage`,items:[]})]})}const Nt=K({...Ue,id:`@exhibitions/image-url-creator`,create:Pt,tags:[`exhibition-slide`],label:`Image`,summary:`Image from URL`,resourceType:`Canvas`,supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function Pt(e,t){let n=t.generateId(`canvas`);t.generateId(`annotation-page`,{id:n,type:`Canvas`});let r=t.generateId(`annotation`),i=await G(t,{id:r,type:`Annotation`},`body`,`@manifest-editor/image-url-creator`)(e,{target:{id:n,type:`Canvas`},targetType:`Annotation`}),{width:a,height:o}=i.get(),s=t.embed({id:r,type:`Annotation`,motivation:`painting`,body:[i],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}});return await G(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:a,height:o,type:`default`,items:[s]})}const Ft=K({id:`@exhibitions/info-box-creator`,create:It,label:`Info box`,summary:`A text panel for an exhibition`,icon:M(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,children:[j(`title`,{children:`Info box`}),j(`path`,{fill:`currentColor`,d:`M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22`})]}),tags:[`exhibition-slide`],resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function It(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),a={...Ke,id:t.generateId(`annotation`,{id:n,type:`Canvas`}),type:`Annotation`},o=[await t.create(`@manifest-editor/html-body-creator`,{language:`en`,body:``},{parent:{resource:a,property:`body`}})],s=t.embed({...a,motivation:`painting`,body:o,target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}}),c=t.generateId(`annotation`,{id:n,type:`Canvas`}),l=t.embed({id:c,type:`Annotation`,motivation:`tagging`,body:[await t.create(`@manifest-editor/html-body-creator`,{language:`en`,body:``},{parent:{resource:{id:c,type:`Annotation`},property:`body`}})],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}}),u=t.embed({id:r,type:`AnnotationPage`,items:[s]}),d=t.embed({id:i,type:`AnnotationPage`,items:[l]});return t.embed({...q,id:n,type:`Canvas`,behavior:[`w-4`,`h-4`,`info`],label:e.label||void 0,height:e.height||1e3,width:e.width||1e3,items:[u],annotations:[d]})}const Lt=K({...We,id:`@exhibitions/video-creator`,create:Rt,tags:[`video`,`exhibition-slide`],label:`Video`,summary:`A video for an exhibition`,resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function Rt(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i=await t.create(`@manifest-editor/video-annotation`,e,{target:{id:n,type:`Canvas`},targetType:`Annotation`,parent:{resource:{id:r,type:`AnnotationPage`},property:`items`}});return t.embed({id:r,type:`AnnotationPage`,items:[i]}),await G(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,height:e.height||1080,width:e.width||1920,duration:e.duration,type:`bottom`,items:[i]})}const zt=K({...Ge,id:`@exhibitions/youtube-creator`,create:Bt,tags:[`video`,`exhibition-slide`],label:`YouTube`,summary:`A YouTube for an exhibition`});async function Bt(e,t){let n=me(e.youtubeUrl),r=t.generateId(`canvas`),i=t.generateId(`annotation-page`,{id:r,type:`Canvas`}),a=await t.create(`@manifest-editor/youtube`,e,{target:{id:r,type:`Canvas`},targetType:`Annotation`,parent:{resource:{id:i,type:`AnnotationPage`},property:`items`}}),o=t.embed({id:i,type:`AnnotationPage`,items:[a]}),s=t.embed({id:`https://img.youtube.com/vi/${n}/maxresdefault.jpg`,type:`Image`,format:`image/jpeg`,width:640,height:360});return t.embed({...q,id:r,type:`Canvas`,behavior:[`w-12`,`h-8`],label:e.label||{en:[`Untitled YouTube Video`]},height:e.height||1080,width:e.width||1920,thumbnail:[s],items:[o]})}function Vt({children:e}){let t=D(),{edit:n}=p();return M(`div`,{className:`grid auto-rows-auto grid-cols-12 content-center justify-center gap-2 p-2`,children:[j(`div`,{className:`col-span-12 row-span-2 text-black flex flex-col items-center justify-center`,children:j(U,{onPress:()=>t&&n(t),className:`col-span-4 row-span-4 text-md text-left text-black hover:bg-slate-100 w-full flex items-center justify-center`,children:j(C,{className:`block w-full text-left`,children:t?.label})})}),e]})}const Ht=Ee(function({isFirst:e,item:t,children:n,...r},i){let a=T(),[o]=be();a?.behavior;let s=y(`Canvas`),c=yt(a?.behavior,e),{isBottom:l,isImage:u,isInfo:d,isLeft:f}=J(a?.behavior),p=s?.resource.source?.id===a?.id,m=null;return m=d?j(`div`,{className:`bg-black w-full h-full text-white max-h-40`,children:j(`div`,{className:`p-1.5 text-[4px]`,children:o.type===`textual-content`?j(C,{enableDangerouslySetInnerHTML:!0,children:o.items[0]?.text}):null})}):M(`div`,{className:W(`flex h-full max-h-full min-h-0`,f?`flex-row-reverse`:l?`flex-col`:`flex-row`),children:[j(`div`,{className:`flex-1 overflow-hidden relative justify-self-stretch`,children:j(`div`,{className:`absolute inset-0 w-full h-full`,children:j(Pe,{cover:!0,fade:!1})})}),u?null:j(`div`,{className:`${l?`min-h-3 w-full`:`w-1/3`} flex-shrink-0 self-stretch p-2 text-white bg-black rounded`,children:M(`div`,{className:`p-1.5 text-[4px]`,children:[j(C,{className:`block mb-1 text-[5px]`,children:a?.label}),j(C,{children:a?.summary})]})})]}),M(`div`,{ref:i,className:W(c,`bg-me-gray-700 overflow-hidden hover:ring-2 ring-me-primary-500 relative`,p?`ring-2 ring-me-primary-500`:``),...r,children:[m,n]})});function Ut(){let{open:e}=p(),{structural:t,technical:n}=h(),[,r]=s({id:n.id.get(),type:`Manifest`},`items`,`Manifest`);return j(Vt,{children:t.items.get().map((t,n)=>j(S,{canvas:t.id,children:j(Ht,{isFirst:n===0,item:t,onClick:()=>{e({id:`current-canvas`}),r.edit(t,n)}})},n))})}function Wt(e){return M(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,height:`1em`,width:`1em`,...e,children:[j(`title`,{children:`Rearrange`}),j(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),j(`path`,{d:`M20 9H4v2h16V9zM4 15h16v-2H4v2z`,fill:`currentColor`})]})}function Gt({isFirst:e,onClick:t,item:n,actions:r}){let{attributes:i,listeners:a,setNodeRef:o,transform:s,transition:c}=it({id:n.id,transition:{duration:150,easing:`cubic-bezier(0.25, 1, 0.5, 1)`}});return j(Ht,{ref:o,style:{transform:at.Translate.toString(s),transition:c},...i,...a,onClick:t,isFirst:e,item:n,children:M(`div`,{className:`absolute top-0.5 right-0.5 flex gap-0.5 items-stretch`,children:[r?.length?j(ne,{as:U,className:`bg-white p-1 text-2xl hover:text-me-500 aria-expanded:text-me-600 aria-expanded:bg-me-200 hover:bg-me-100 rounded-sm`,"aria-label":`Action menu`,items:r,children:j(Fe,{})}):null,j(`div`,{className:`bg-white text-2xl h-8 flex items-center p-1 hover:text-me-500 hover:bg-me-100 rounded-sm`,children:j(Wt,{"aria-label":`Reorder item`})})]})})}function Kt(){let e=D(),{structural:t,technical:n}=h(),r=l(),i=y(`Canvas`),a=t.items.get(),{open:o}=p(),c=$e(Qe(Xe,{activationConstraint:{distance:5}}),Qe(Ye,{coordinateGetter:rt})),[,u]=s({id:n.id.get(),type:`Manifest`},`items`,`Manifest`),d=De(e=>{let{active:n,over:r}=e;r&&n.id!==r.id&&t.items.reorder(a.findIndex(e=>e.id===n.id),a.findIndex(e=>e.id===r.id))},[a,t.items]),f=i?.resource.source.id,m=f?a.findIndex(e=>e.id===f):-1,ee=m&&m>0?Number(m-1):0;function g(){r.close();let n=t.items.get();n&&n.length>0?u.edit(n[ee]):u.edit(e)}let te=F(()=>pe(t.items,g),[t.items,g]);return j(Vt,{children:j(Je,{sensors:c,collisionDetection:Ze,onDragEnd:d,modifiers:[et],children:j(tt,{items:a,strategy:nt,children:a.map((t,n)=>t?j(S,{canvas:t.id,children:j(Gt,{item:t,isFirst:n===0,onClick:()=>{o({id:`current-canvas`}),u.edit(t,n)},actions:te(t,n,e)},t.id)},t.id):null)})})})}const qt={id:`canvas-listing`,label:`Exhibition grid`,icon:j(Z,{}),render:()=>j(Jt,{}),options:{minWidth:350,maxWidth:350}};function Jt(){let{technical:e}=h(),[t,n]=s({id:e.id.get(),type:`Manifest`},`items`,`Canvas`),[r,i]=_e();return M(V,{children:[j(Ie,{title:`Exhibition`,actions:[{icon:r.list?j(we,{className:`text-2xl`}):j(Z,{}),title:r.list?`List view`:`Grid view`,onClick:()=>i(`list`)},{icon:j(Yt,{}),title:`Edit slides`,toggled:r.editing,onClick:()=>i(`editing`)},{icon:j(Xt,{}),title:`Add new slide`,disabled:!t,onClick:()=>n.createFiltered(`exhibition-slide`)}]}),j(H,{children:r.list?j(Ce,{isEditing:r.editing}):r.editing?j(Kt,{}):j(Ut,{})})]})}function Z(){return M(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`currentColor`,viewBox:`0 -960 960 960`,children:[j(`title`,{children:`Exhibition grid`}),j(`path`,{d:`M600-160v-280h280v280H600ZM440-520v-280h440v280H440ZM80-160v-280h440v280H80Zm0-360v-280h280v280H80Zm440-80h280v-120H520v120ZM160-240h280v-120H160v120Zm520 0h120v-120H680v120ZM160-600h120v-120H160v120Zm360 0Zm-80 240Zm240 0ZM280-600Z`})]})}function Yt(){return M(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24`,viewBox:`0 0 24 24`,width:`24`,children:[j(`title`,{children:`Edit slides`}),j(`path`,{d:`M0 0h24v24H0V0z`,fill:`none`}),j(`path`,{d:`M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z`})]})}function Xt(){return M(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`currentColor`,viewBox:`0 -960 960 960`,children:[j(`title`,{children:`Add new slide`}),j(`path`,{d:`M160-240v-480 480Zm80-80v-200h360v200H240Zm-80 160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v240h-80v-240H160v480h360v80H160Zm500-320v-100H360v-60h360v160h-60Zm60 400v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z`})]})}function Zt(){let e=u(),t=()=>{let t=e.technical.width.get(),n=e.technical.height.get(),r=e.descriptive.summary,i=e.technical.behavior.get();i.push(`w-12`);let a=Math.max(1,Math.min(12,Math.round(t/n*12)));i.push(`h-${a}`),ot(r.get())||r.set({en:[`Summary of image`]}),e.technical.behavior.set(i)};return M(`div`,{className:`flex flex-col items-center gap-4 border-me-100 border-2 p-4 rounded`,children:[`This canvas was not created in the exhibition editor. Do you want to apply default settings?`,j(R,{onPress:()=>t(),children:`Apply defaults`})]})}const Qt={id:`@exhibition/right-panel-editor`,supports:{edit:!0,properties:[`label`,`summary`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=J(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Exhibition`,component:()=>j($t,{})};function $t(){let e=T(),n=c(),{structural:r,descriptive:i}=u(),{items:a}=r,{thumbnail:o}=i,s=a.get()[0],l=bt(e);return!e||!s||!n?j(`div`,{className:`p-8`,children:`Canvas, page, or resource not found`}):j(V,{children:j(H,{padding:!0,children:M(t,{resource:e,children:[l?null:j(Zt,{}),j(v,{dispatchType:`label`,disableMultiline:!0,disallowHTML:!0}),j(ce,{containerId:o.containerId(),label:`Thumbnail`,property:`thumbnail`,items:o.get(),singleMode:!0,reorder:e=>o.reorder(e.startIndex,e.endIndex),createActions:pe(o),creationType:`ContentResource`,emptyLabel:`No thumbnail`,parent:n?.resource}),j(x,{annotationPage:s.id,children:j(le,{createFilter:`image`})})]})})})}const en={id:`@exhibition/summary-editor`,supports:{edit:!0,properties:[`summary`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=J(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Summary`,component:()=>j(tn,{})};function tn(){let e=T();return e?j(V,{children:j(H,{padding:!0,children:M(t,{resource:e,children:[j(v,{dispatchType:`label`}),j(v,{dispatchType:`summary`})]})})}):null}function Q(e){return j(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,...e,children:j(`path`,{fill:`currentColor`,d:`M9 16.17L4.83 12l-1.42 1.41L9 19L21 7l-1.41-1.41z`})})}const $=`<h2>New step</h2><p>Description</p>`;function nn(){let{saveAnnotation:e}=E(),[t,n]=ye(),{editorFeatureFlags:r}=o(),{annotationPopups:i}=r;return i?M(`div`,{className:`bg-white shadow-md rounded-lg`,children:[j(`div`,{className:`prose-headings:mt-1 overflow-y-auto rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500`,children:j(Ne,{className:`border-none`,value:t.bodyValue||$,onChange:e=>n({bodyValue:e})})}),M(`div`,{className:`flex gap-2 p-3`,children:[M(R,{primary:!0,onPress:()=>e(),children:[j(Q,{}),` Finish editing`]}),j(_,{})]})]}):M(`div`,{className:`flex gap-2`,children:[M(R,{primary:!0,onPress:()=>e(),children:[j(Q,{}),` Finish editing`]}),j(_,{})]})}function rn(){let e=k(a(),e=>e.polygon),[t,n]=ye(),{editorFeatureFlags:r}=o(),{annotationPopups:i}=r,{cancelRequest:s,saveAnnotation:c}=E();return M(`div`,{className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[M(`div`,{className:`bg-me-primary-500 text-white p-2 m-1 rounded flex gap-2`,children:[j(Le,{}),`Draw a box on the canvas`]}),i?j(`div`,{className:`relative p-3 line-clamp-3 prose-p:text-slate-600`,children:j(`div`,{className:`prose-headings:mt-1 prose-headings:mb-1 prose-sm`,children:j(`div`,{dangerouslySetInnerHTML:{__html:t.bodyValue||$}})})}):j(Ne,{className:`border-none`,value:t.bodyValue||$,onChange:e=>n({bodyValue:e})}),M(`div`,{className:`flex gap-2 p-3`,children:[M(R,{isDisabled:e?.points.length===0,onPress:()=>c(),children:[j(Q,{}),` Finish editing`]}),M(R,{className:`gap-2 flex`,onPress:()=>s(),children:[j(z,{}),` Delete`]}),j(_,{})]})]})}function an(){let{editorFeatureFlags:e}=o(),{annotationPopups:t}=e,n=g();return j(R,{className:`ml-auto`,onPress:()=>n({editorFeatureFlags:{...e,annotationPopups:!t}}),children:j(t?ke:Ae,{})})}function on({highlightProps:e}){let t=Oe(n),r=w(),{editorFeatureFlags:i}=o(),{annotationPopups:a}=i,{isPending:s,cancelRequest:c,busy:l,requestAnnotationFromTarget:u,deleteAnnotation:d}=he({annotationPopup:j(b,{annotation:r.id,children:j(n.Provider,{value:t,children:j(sn,{})})})}),[f,p]=L(!1);return N(()=>{f&&!s&&p(!0)},[s,f]),M(`div`,{...e,className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[j(`div`,{className:`relative`,children:f&&!a?j(oe,{className:`border-none`}):j(Me,{className:`px-3 pt-3 line-clamp-3 prose-p:text-slate-600`,locale:`en`})}),M(`div`,{className:`flex gap-2 p-2`,children:[f&&s?M(A,{children:[M(R,{primary:!0,onPress:()=>{p(!1),c()},children:[j(Q,{}),` Finish editing`]}),j(_,{})]}):M(R,{isDisabled:l,onPress:()=>{p(!0),u().then(()=>{p(!1)})},children:[j(B,{}),` Edit`]}),M(R,{className:`gap-2 flex`,onPress:()=>d(),children:[j(z,{}),` Delete`]})]}),j(`div`,{className:`absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0`})]})}function sn(){let{editorFeatureFlags:e}=o(),{annotationPopups:t}=e,{saveAnnotation:n}=E();return t?M(`div`,{className:`bg-white shadow-md rounded-lg relative max-h-[50vh] overflow-y-auto`,children:[j(`div`,{className:`prose-headings:mt-1 rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500`,children:j(oe,{className:`border-none`})}),M(`div`,{className:`flex gap-2 p-2 sticky bottom-0 z-50 bg-white`,children:[M(R,{primary:!0,onPress:()=>{n()},children:[j(Q,{}),` Finish editing`]}),j(an,{})]})]}):M(`div`,{className:`flex gap-2`,children:[M(R,{primary:!0,onPress:()=>n(),children:[j(Q,{}),` Finish editing`]}),j(_,{})]})}function cn({originalAnnotationId:e,highlightProps:t}){let n=d(ve()),r=w(),{edit:i}=p(),[a,o]=L(!1),s=()=>{if(e&&confirm(`Are you sure you want to delete this annotation?`)){let t=n.structural.items.getWithoutTracking().findIndex(t=>t.id===e);n.structural.items.deleteAtIndex(t)}};return M(`div`,{...t,className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[j(`div`,{className:`flex gap-2 mb-2 p-3`,children:j(`div`,{className:`flex-1 min-w-0`,children:a?M(A,{children:[j(`h3`,{className:`text-lg font-semibold border-b pt-1 pb-2 mb-2`,children:`Edit step`}),j(v,{dispatchType:`label`}),j(v,{dispatchType:`summary`})]}):M(A,{children:[j(C,{as:`div`,defaultText:j(`span`,{className:`opacity-50`,children:`Untitled`}),className:`whitespace-nowrap overflow-ellipsis w-full overflow-x-hidden`,children:r?.label}),j(C,{className:`text-gray-500 text-sm bg-white line-clamp-2`,as:`div`,children:r?.summary})]})})}),M(`div`,{className:`flex gap-2 p-2`,children:[a?M(R,{onPress:()=>o(!1),children:[j(Q,{}),` Finish editing`]}):M(R,{onPress:()=>o(!0),children:[j(B,{}),` Edit body`]}),j(R,{onPress:()=>i(r),children:`Edit annotation`}),M(R,{className:`gap-2 flex`,onPress:()=>s(),children:[j(z,{}),` Delete`]})]}),j(`div`,{className:`absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0`})]})}function ln(){let[e,{annotationTarget:n,highlightProps:r}]=ge(),i=F(()=>n?{id:n,type:`Annotation`}:{id:e?.id,type:`Annotation`},[e?.id,n]);return n?j(t,{resource:i,children:j(b,{annotation:n,children:j(cn,{originalAnnotationId:e?.id,highlightProps:r})})}):j(t,{resource:i,children:j(on,{highlightProps:r})})}function un({reorderable:e=!1}){let t=ve(),n=d(t);return t?e?j(A,{children:j(de,{id:t.id,marginBottom:`0.5em`,items:t.items||[],inlineHandle:!1,reorder:({startIndex:e,endIndex:t})=>n.structural.items.reorder(e,t),renderItem:(e,t)=>j(b,{annotation:e.id,children:j(ln,{})})})}):j(A,{children:t.items.map(e=>j(b,{annotation:e.id,children:j(ln,{})},e.id))}):null}const dn={id:`@exhibition/tour-steps`,supports:{edit:!0,properties:[`annotations`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=J(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Tour steps`,component:()=>j(fn,{})};function fn(){let e=T(),t=e?.annotations[0],n=e?.items[0];return j(!t||!e||!n?pn:mn,{})}function pn(){let e=T(),t=f(),n=()=>{e&&t.create(`@manifest-editor/empty-annotation-page`,{label:{en:[`Tour steps`]}},{target:{id:e.id,type:`Canvas`},targetType:`AnnotationPage`,parent:{property:`annotations`,resource:{id:e.id,type:`Canvas`}}})};return M(`div`,{className:`flex flex-col items-center justify-center p-4`,children:[j(`div`,{className:`p-4 opacity-50 text-center`,children:`This image does not yet have a tour.`}),j(U,{className:`border w-full disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500`,onPress:()=>n(),children:`Create Tour`})]})}function mn(){let e=T(),n=e?.annotations[0],r=e?.items[0],i=d(n),a=f(),[o,s]=L(!1),{requestAnnotation:c,isPending:l,busy:u,cancelRequest:p,completeRequest:m}=xe({onSuccess:t=>{let r=t.metadata.bodyValue||``;!t.cancelled&&t.target&&n&&a.create(`@manifest-editor/html-annotation`,{label:{en:[`Tour step`]},body:{en:[r||`<h2>New step</h2><p>Description</p>`]},motivation:`tagging`},{target:{id:e.id,type:`Canvas`},targetType:`Annotation`,parent:{property:`items`,resource:{id:n.id,type:`AnnotationPage`}},initialData:{selector:t}})}});return e?n?j(V,{children:M(H,{padding:!0,children:[M(`div`,{className:`flex gap-4 border-b pt-4 pb-2 mb-2`,children:[j(`h2`,{className:`text-lg font-semibold flex-1`,children:`Tour steps`}),j(R,{onPress:()=>s(e=>!e),children:o?`Done`:`Reorder`})]}),j(t,{resource:e,children:M(x,{annotationPage:n.id,children:[M(`div`,{className:`flex flex-col gap-4`,children:[j(un,{reorderable:o}),u?null:l?j(rn,{}):j(U,{onPress:()=>c({type:`box`,annotationPopup:j(nn,{})}),className:`border disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500`,children:`+ Add new step`})]}),r?M(A,{children:[j(`h3`,{className:`text-md border-b pt-4 pb-2 mb-2`,children:`Available tour steps from images`}),j(ue,{painting:r,page:i.ref(),canvasId:e.id})]}):null]})})]})}):j(`div`,{children:`No annotation page - create one?`}):null}function hn(){let e=T();Be(e);let t=e.width&&e.height?e.width/e.height:0,n=vt(e.behavior||[]);return Math.abs(t-n.ratio)<.01?null:M(`div`,{className:`p-2 rounded bg-me-100`,children:[j(`div`,{className:`text-me-700-500`,children:`Aspect ratio warning`}),M(`div`,{className:`text-sm text-black/60`,children:[`The aspect ratio of this canvas is `,t.toFixed(2),` but the target aspect ratio is `,n.ratio.toFixed(2),`. Some parts of this image may be cropped.`,j(`div`,{className:`relative h-32 w-full mt-2`,children:j(`div`,{className:`bg-[red] left-0 top-0 z-2 opacity-50 max-w-32 max-h-32`,style:{aspectRatio:t.toFixed(2)},children:j(`div`,{className:`asbolute bg-[white] left-0 top-0 z-1 opacity-50 max-w-32 max-h-32`,style:{aspectRatio:n.ratio}})})})]})]})}const gn={component:()=>j(bn,{}),supports:{edit:!0,resourceTypes:[`Canvas`],properties:[`behavior`]},id:`slide-behaviors`,label:`Layout`,tabs:{showTitle:!0}},_n=[{id:`layout`,type:`choice`,label:{en:[`Layout`]},initialOpen:!0,items:[{label:{en:[`Text on left`]},value:`left`},{label:{en:[`Text on right`]},value:`right`},{label:{en:[`Text on bottom`]},value:`bottom`},{label:{en:[`Text on top`]},value:`top`},{label:{en:[`Only image`]},value:`image`}]},{id:`floating`,type:`choice`,label:{en:[`Floating`]},initialOpen:!1,addNone:!0,groupBehavior:`floating`,items:[{label:{en:[`Float top left`]},value:`float-top-left`},{label:{en:[`Float top right`]},value:`float-top-right`},{label:{en:[`Float bottom left`]},value:`float-bottom-left`},{label:{en:[`Float bottom right`]},value:`float-bottom-right`}]},{id:`size`,component:(e,t)=>j(yn,{behaviors:e,setBehaviors:t}),label:{en:[`Size`]},type:`custom`,initialOpen:!0,supports:e=>e.startsWith(`w-`)||e.startsWith(`h-`)}];function vn(e){let t=0,n=0;for(let r of e)r.startsWith(`w-`)&&(t=Number.parseInt(r.slice(2))),r.startsWith(`h-`)&&(n=Number.parseInt(r.slice(2)));return{width:t,height:n}}function yn({behaviors:e,setBehaviors:t}){let{width:n,height:r}=vn(e),[i,a]=L({x:-1,y:-1}),o=(n,r)=>{let i=e.filter(e=>!e.startsWith(`w-`)&&!e.startsWith(`h-`));i.push(`w-${n}`),i.push(`h-${r}`),t(i)};return j(`div`,{className:`grid grid-cols-12 grid-rows-12 gap-1`,onMouseLeave:()=>a({x:-1,y:-1}),children:Array.from({length:144},(e,t)=>{let s=t%12,c=Math.floor(t/12),l=i.x>=s&&i.y>=c,u=s<n&&c<r,d=l&&u,f=`bg-gray-200`;return l&&(f=`bg-me-200`),u&&(f=`bg-me-500`),d&&(f=`bg-me-400`),j(`div`,{className:`flex aspect-square rounded cursor-se-resize items-center justify-center ${f}`,onClick:()=>o(s+1,c+1),onMouseUp:()=>o(s+1,c+1),onMouseEnter:()=>a({x:s,y:c})},t)})})}function bn(){let e=y(`Canvas`),t=u(),{width:n,height:r}=t.technical;return!e||t.technical.type!==`Canvas`?M(V,{children:[j(Ie,{title:`Slide behaviors`}),j(`div`,{children:`Please select canvas`})]}):j(V,{children:M(H,{children:[j(`div`,{className:`px-2`,children:M(se,{$wide:!0,children:[j(ae,{widthId:n.containerId(),width:n.get()||0,changeWidth:e=>n.set(e),heightId:r.containerId(),height:r.get()||0,changeHeight:e=>r.set(e)}),j(`div`,{children:j(hn,{})})]})}),j(re,{behavior:t.technical.behavior.get()||[],onChange:e=>{t.technical.behavior.set(e)},configs:_n})]})})}const xn=r(i(e),{id:`exhibition-editor`,title:`Exhibition Editor`,project:!0,projectType:`Manifest`},{config:{editorConfig:{Canvas:{hideTabs:[`@manifest-editor/overview`,`@manifest-editor/technical-properties`,`@manifest-editor/linking-properties`,`@manifest-editor/nav-place-editor`,`@manifest-editor/canvas-structural`,`@manifest-editor/descriptive-properties`,`@manifest-editor/overview-canvas-editor`,`@manifest-editor/metadata`]}}},leftPanels:[qt,dt],centerPanels:[lt],annotations:[st],leftPanelIds:[`left-panel-manifest`],background:[pt],canvasEditors:[xt,Dt,wt],editors:[Qt,gn,en,dn],creators:[Ft,zt,jt,kt,Y,Nt,Lt]});export{xn as exhibitionEditorPreset};
1
+ import*as e from"@manifest-editor/manifest-preset";import{ResourceEditingProvider as t,ResourceEditingReactContext as n,extendApp as r,mapApp as i,useAtlasStore as a,useConfig as o,useCreator as s,useEditingResource as c,useEditingStack as l,useEditor as u,useGenericEditor as d,useInlineCreator as f,useLayoutActions as p,useLayoutState as m,useLocalStorage as ee,useManifestEditor as h,useSaveConfig as g}from"@manifest-editor/shell";import{AnnotationBodyEditor as te,AnnotationPopUpSwitcherButton as _,AppDropdown as ne,BehaviorEditor as re,CanvasPanelEditor as ie,DimensionsTriplet as ae,HTMLAnnotationEditor as oe,InputContainer as se,LanguageMapEditor as v,LinkingPropertyList as ce,PaintingAnnotationList as le,PromptToAddPaintingAnnotations as ue,ReorderList as de,ViewerAnnotationPage as fe,createAppActions as pe,getYouTubeId as me,useAnnotationEditor as he,useAnnotationInfo as ge,useInStack as y,useToggleList as _e}from"@manifest-editor/editors";import{AnnotationContext as b,AnnotationPageContext as x,CanvasContext as S,LocaleString as C,useAnnotation as w,useAnnotationPage as ve,useCanvas as T,useCurrentAnnotationActions as E,useCurrentAnnotationMetadata as ye,useManifest as D,useRenderingStrategy as be,useRequestAnnotation as xe,useVault as Se,useVaultSelector as O}from"react-iiif-vault";import{useStore as k}from"zustand";import{Fragment as A,jsx as j,jsxs as M}from"react/jsx-runtime";import{CanvasListView as Ce,CanvasListingIcon as we,useEditCanvasItems as Te}from"@manifest-editor/manifest-preset/components";import{forwardRef as Ee,useCallback as De,useContext as Oe,useEffect as N,useLayoutEffect as P,useMemo as F,useRef as I,useState as L}from"react";import{ActionButton as R,AnnotationPopInIcon as ke,AnnotationPopOutIcon as Ae,DeleteIcon as z,EditTextIcon as B,EmptyCanvasIcon as je,HTMLAnnotationBodyRender as Me,HTMLEditor as Ne,LazyThumbnail as Pe,MoreMenu as Fe,Sidebar as V,SidebarContent as H,SidebarHeader as Ie,TargetIcon as Le}from"@manifest-editor/components";import{DelftExhibition as Re}from"exhibition-viewer";import{EditorHooksProvider as ze}from"exhibition-viewer/library";import{Button as U}from"react-aria-components";import{twMerge as W}from"tailwind-merge";import Be from"tiny-invariant";import{creatorHelper as G,defineCreator as K}from"@manifest-editor/creator-api";import{iiifBrowserCreator as Ve,imageServiceCreator as He,imageUrlCreator as Ue,videoAnnotation as We,youTubeBodyCreator as Ge}from"@manifest-editor/creators";import{emptyAnnotation as Ke,emptyAnnotationPage as qe,emptyCanvas as q}from"@iiif/parser";import{DndContext as Je,KeyboardSensor as Ye,PointerSensor as Xe,closestCenter as Ze,useSensor as Qe,useSensors as $e}from"@dnd-kit/core";import{restrictToParentElement as et}from"@dnd-kit/modifiers";import{SortableContext as tt,rectSortingStrategy as nt,sortableKeyboardCoordinates as rt,useSortable as it}from"@dnd-kit/sortable";import{CSS as at}from"@dnd-kit/utilities";import{getValue as ot}from"@iiif/helpers";const st={id:`@exhibition/tour-step-annotations`,label:`Tour steps`,render:()=>j(ct,{})};function ct(){let e=T(),t=k(a(),e=>e.tool.enabled),{rightPanel:n}=m(),r=n.current===`@manifest-editor/editor`&&n.state?.currentTab?.startsWith(`@exhibition/tour-steps`),i=e?.annotations[0];return!r||!e||t||!i?null:j(A,{children:j(x,{annotationPage:i.id,children:j(fe,{})})})}const lt={id:`@exhibitions/center-panel`,label:`Exhibition editor`,icon:null,render:()=>j(ut,{}),options:{minWidth:350,maxWidth:350}};function ut(){let e=D(),t=Se(),[n,r]=L(.8),i=I(null),{edit:a,leftPanel:o}=p(),s=F(()=>({localeStringEditor:e=>M(`span`,{className:`inline-flex items-center hover:ring-4 hover:ring-me-primary-500`,children:[e.original,j(U,{className:`py-1 px-2 inline-block`,onPress:()=>a(e.resource),children:j(B,{className:`text-xl`})})]}),canvasPreviewEditor:e=>M(`div`,{className:`w-full h-full flex-1 flex relative`,children:[e.original,j(`button`,{onClick:t=>{t.preventDefault(),t.stopPropagation(),a(e.resource),o.open({id:`canvas-listing`,open:!0})},className:`absolute top-5 right-5 bg-white text-black p-2 rounded z-40`,children:`EDIT`})]})}),[]);return P(()=>{if(i.current){let e=i.current.offsetWidth/1200;r(Math.max(1,e))}},[]),e?j(`div`,{ref:i,className:`overflow-y-auto delft-exhibition`,children:j(ze,{hooks:s,children:j(Re,{skipLoadManifest:!0,customVault:t,manifest:e.id,options:{disablePresentation:!0,hideTableOfContents:!0,hideTitle:!0,alternativeImageMode:!0}},n)})}):null}const dt={id:`@exhibitions/overview-panel`,label:``,icon:j(`div`,{className:`hidden hover:block`,children:`👀`}),render:()=>j(ft,{})};function ft(){return D()?j(`div`,{children:`Coming soon.`}):null}const pt={id:`exhibition-background-task`,label:`Query string`,render:()=>j(mt,{})};function mt(){console.log(`rendering?`);let e=D();y(`Canvas`);let{leftPanel:t,rightPanel:n}=m(),{edit:r,leftPanel:i,rightPanel:a,centerPanel:s}=p(),{canvasActions:c,open:l}=Te(),{editorFeatureFlags:{rememberCanvasId:u=!0,rememberLeftPanelId:d=!1}={}}=o();return t.open,N(()=>{e&&t.current===dt.id&&(r(e),s.open({id:lt.id}),i.close())},[t.current]),null}const ht={"h-1":`lg:min-h-[100px] row-span-1`,"h-2":`lg:min-h-[200px] row-span-2`,"h-3":`lg:min-h-[300px] row-span-3`,"h-4":`lg:min-h-[400px] row-span-4`,"h-5":`lg:min-h-[500px] row-span-5`,"h-6":`lg:min-h-[600px] row-span-6`,"h-7":`lg:min-h-[700px] row-span-7`,"h-8":`lg:min-h-[800px] row-span-8`,"h-9":`lg:min-h-[900px] row-span-9`,"h-10":`lg:min-h-[1000px] row-span-10`,"h-11":`lg:min-h-[1100px] row-span-11`,"h-12":`lg:min-h-[1200px] row-span-12`},gt={"h-1":`lg:min-h-[25px] row-span-1`,"h-2":`lg:min-h-[50px] row-span-2`,"h-3":`lg:min-h-[75px] row-span-3`,"h-4":`lg:min-h-[100px] row-span-4`,"h-5":`lg:min-h-[125px] row-span-5`,"h-6":`lg:min-h-[150px] row-span-6`,"h-7":`lg:min-h-[175px] row-span-7`,"h-8":`lg:min-h-[200px] row-span-8`,"h-9":`lg:min-h-[225px] row-span-9`,"h-10":`lg:min-h-[250px] row-span-10`,"h-11":`lg:min-h-[275px] row-span-11`,"h-12":`lg:min-h-[300px] row-span-12`},_t={"w-1":`col-span-1`,"w-2":`col-span-2`,"w-3":`col-span-3`,"w-4":`col-span-4`,"w-5":`col-span-5`,"w-6":`col-span-6`,"w-7":`col-span-7`,"w-8":`col-span-8`,"w-9":`col-span-9`,"w-10":`col-span-10`,"w-11":`col-span-11`,"w-12":`col-span-12`};function vt(e){let{isLeft:t,isRight:n,isBottom:r}=J(e),i=e?.find(e=>e.includes(`h-`)),a=e?.find(e=>e.includes(`w-`));if(!i||!a)return{h:0,w:0,ratio:1};let o={h:Number.parseInt(i.split(`-`)[1]),w:Number.parseInt(a.split(`-`)[1]),ratio:1};return(t||n)&&(o.w*=2/3),r&&(o.h*=2/3),o.h&&o.w&&(o.ratio=o.w/o.h),o}function yt(e,t=!1,n=!0){(!e||e.length===0)&&(e=[`h-8`,`w-8`,`image`]);let r=e.find(e=>e.includes(`h-`)),i=e.find(e=>e.includes(`w-`)),a=[];return t&&r===`h-4`&&(r=`h-8`),a.push(n?gt[r]:ht[r]),a.push(_t[i]),a.join(` `)}function J(e){let t=e?.includes(`right`),n=e?.includes(`left`),r=e?.includes(`bottom`),i=e?.includes(`top`),a=e?.includes(`image`)||!n&&!t&&!r&&!i;return{isRight:t,isLeft:n,isBottom:r,isTop:i,isInfo:e?.includes(`info`),isImage:a}}function bt(e){if(!e)return!1;let t=e.behavior||[];if(t.includes(`image`)||t.includes(`info`))return!0;for(let e of t)if(e.startsWith(`w-`)||e.startsWith(`h-`))return!0;return!1}const xt={id:`image-block-editor`,label:`Image Block Editor`,component:e=>j(St,{strategy:e}),supports:{strategy:(e,t,n)=>{if(e.type!==`images`)return!1;let r=n.get(t.resource);if(r.type!==`Canvas`)return!1;let i=r.behavior||[],a=!1;for(let e of i)(e.startsWith(`w-`)||e.startsWith(`h-`)||e===`image`)&&(a=!0);return a}}};function St({strategy:e}){let[t,n]=ee(`exhibition-preview-mode`),r=y(`Canvas`);return r?M(S,{canvas:r.resource.source?.id,children:[M(`div`,{className:`flex gap-4 bg-me-500 py-2 px-4 text-white shadow-md z-40 ring-1 ring-me-500 items-center`,children:[`Switch view`,j(R,{onPress:()=>n(!t),children:t?`Full canvas`:`Layout preview`})]}),t?j(Ct,{}):j(`div`,{className:`h-full flex flex-1 min-h-0`,children:j(ie,{asFallback:!0})})]}):null}function Ct(){let e=I(null),t=T(),n=yt(t?.behavior||[],!1,!1),{isBottom:r,isImage:i,isInfo:a,isLeft:o}=J(t?.behavior),[s,c]=L(1);return P(()=>{let t=e.current;if(!t)return;let n=t.offsetWidth;c(n/1200)},[t]),j(`div`,{className:`overflow-hidden h-full w-full`,ref:e,children:j(`div`,{className:`grid grid-cols-12 grid-rows-12 h-full bg-white`,children:M(`div`,{className:W(n,`flex h-full max-h-full min-h-0 ring-4 ring-black`,o?`flex-row-reverse`:r?`flex-col`:`flex-row`),children:[j(`div`,{className:`flex-1 h-full flex min-w-0`,children:j(ie,{asFallback:!0})}),i?null:j(`div`,{className:`${r?`min-h-3 w-full`:`w-1/3`} flex-shrink-0 self-stretch text-white bg-black rounded p-8 relative h-full`,children:M(`div`,{style:{fontSize:`${s*16}px`},children:[j(C,{className:`block mb-4`,children:t?.label}),j(C,{children:t?.summary})]})})]})})})}const wt={id:`info-block-editor`,label:`info Block Editor`,component:e=>j(Tt,{strategy:e}),supports:{strategy:(e,t,n)=>e.type===`textual-content`}};function Tt(e){let t=T(),n=O((e,n)=>n.get(t?.items[0])),r=O((e,n)=>t?.annotations[0]?n.get(t?.annotations[0]):null);return M(`div`,{className:`overflow-y-auto bg-white shadow`,children:[j(`div`,{className:`mb-12`,children:n.items.map((e,t)=>j(b,{annotation:e.id,children:j(Et,{})},e.id+t))}),r?M(A,{children:[j(`h2`,{className:`text-2xl font-bold px-4 border-t border-gray-200 pt-4 mb-4`,children:`Long Summaries`}),j(`p`,{className:`my-4 px-4`,children:`Long summaries are used to provide more detailed information about the canvas. They appear when the user clicks "read more" in the exhibition.`}),r.items.map((e,t)=>j(b,{annotation:e.id,children:j(Et,{})},e.id+t))]}):null]})}function Et(){let e=w(),t=f(),n=e?.body||[],r=d(e);return e?M(`div`,{children:[n.map((e,t)=>j(te,{className:`p-4 hover:bg-me-100/40 focus-within:bg-me-100/40`,resourceId:e.id,onRemove:()=>r.annotation.body.deleteAtIndex(t)},t)),j(`div`,{className:`p-4`,children:j(R,{primary:!0,onPress:()=>{t.create(`@manifest-editor/html-body-creator`,{language:`en`,value:``},{targetType:`ContentResource`,parent:{property:`body`,resource:{id:e.id,type:`Annotation`}},initialData:{}})},children:`Add new annotation`})})]}):null}const Dt={id:`youtube-main-editor`,label:`YouTube main editor`,component:e=>e.type===`media`?j(Ot,{strategy:e,video:e.media}):null,supports:{strategy:(e,t,n)=>(console.log(e),!(e.type!==`media`||e.media.type!==`VideoYouTube`))}};function Ot({strategy:e,video:t}){let{edit:n}=p(),r=T(),i=O((e,t)=>t.get(r?.items[0]).items[0]);Be(r&&i);let a=I(null),o=d(i),s=t,c=(r.width||1)/(r.height||1);return`${s.youTubeId}`,M(`div`,{className:`overflow-y-auto`,children:[j(`div`,{className:`p-8`,children:j(`div`,{className:`bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto`,style:{aspectRatio:c},children:j(`iframe`,{title:`YouTube video`,className:`border-none w-full h-full object-contain`,ref:a,src:`https://www.youtube.com/embed/${s.youTubeId}?enablejsapi=1&origin=${window.location.host}&modestbranding=1&rel=0`,referrerPolicy:`no-referrer compute-pressure`,sandbox:`allow-scripts allow-same-origin allow-presentation`})})}),M(`div`,{className:`bg-white shadow w-full p-8 flex gap-8`,children:[j(`div`,{children:j(`div`,{className:`w-64 bg-black flex-shrink-0 flex items-center justify-center rounded overflow-clip`,style:{aspectRatio:c},children:r.thumbnail?.length?j(Pe,{cover:!0}):j(`div`,{className:`text-white/50 text-center py-16`,children:`No thumbnail`})})}),M(`div`,{className:`flex-1`,children:[j(C,{as:`h3`,className:`text-2xl font-bold mt-4`,defaultText:j(`span`,{className:`text-black/30`,children:`No Label`}),children:o.descriptive.label.get()}),j(C,{as:`p`,className:`mt-2 mb-8`,defaultText:j(`span`,{className:`text-black/30`,children:`No summary`}),children:o.descriptive.summary.get()}),j(R,{onPress:()=>n(o.ref()),children:`Edit properties`})]})]})]})}const kt=K({...Ve,id:`@exhibitions/browser-creator`,create:At,tags:[`image`,`exhibition-slide`],label:`IIIF Browser`,summary:`Browse IIIF Resources`,resourceType:`Canvas`,resourceFields:[`id`,`language`,`type`,`format`,`value`],additionalTypes:[],supports:{onlyPainting:!0,parentTypes:[`Manifest`],parentFields:[`items`],parentFieldMap:{Manifest:[`items`]}}});async function At(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i={width:0,height:0},a=await G(t,{id:r,type:`AnnotationPage`},`items`,`@manifest-editor/iiif-browser-creator`)({...e,trackSize({width:e,height:t}){i.height=t,i.width=e}},{targetType:`Annotation`,target:{id:n,type:`Canvas`}});return await G(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:i.width,height:i.height,type:`default`,items:a})}const jt=K({...He,id:`@exhibitions/image-service-creator`,create:Mt,tags:[`image`,`exhibition-slide`],label:`IIIF Image`,summary:`IIIF Image service`,resourceType:`Canvas`,supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function Mt(e,t){let n=t.generateId(`canvas`);t.generateId(`annotation-page`,{id:n,type:`Canvas`});let r=await G(t,{id:t.generateId(`annotation`),type:`Annotation`},`body`,`@manifest-editor/image-service-creator`)(e,{target:{id:n,type:`Canvas`}}),{width:i,height:a}=r.get(),o=t.embed({id:t.generateId(`annotation`),type:`Annotation`,motivation:`painting`,body:[r],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}});return await G(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:i,height:a,type:`default`,items:[o]})}const Y=K({id:`@exhibitions/image-slide-creator`,create:X,label:`Empty slide`,summary:`An empty image slide.`,icon:j(je,{}),tags:[`exhibition-slide`],resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});K({...Y,id:`@exhibitions/image-slide-creator-left`,label:`Image (Left)`,summary:`An image with text on the left.`,icon:j(`div`,{children:`IMAGE (LEFT)`}),create:(e,t)=>X({...e,type:`left`},t)}),K({...Y,id:`@exhibitions/image-slide-creator-right`,label:`Image (Right)`,summary:`An image with text on the right.`,icon:j(`div`,{children:`IMAGE (RIGHT)`}),create:(e,t)=>X({...e,type:`right`},t)}),K({...Y,id:`@exhibitions/image-slide-creator-bottom`,label:`Image (Bottom)`,summary:`An image with text at the bottom.`,icon:j(`div`,{children:`IMAGE (BOTTOM)`}),create:(e,t)=>X({...e,type:`bottom`},t)});function X(e,t){let n=e.canvasId||t.generateId(`Canvas`),r=t.generateId(`AnnotationPage`,{id:n,type:`Canvas`}),i=t.generateId(`AnnotationPage`,{id:n,type:`Canvas`}),a=[],o=6e3;if(e.width&&e.height)if(e.width>e.height){let t=e.width/12,n=`h-${Math.floor(e.height/t)}`;a.push(`w-12`,n)}else{let t=e.height/12,n=`w-${Math.floor(e.width/t)}`;a.push(n,`h-12`)}else a.push(`w-12`,`h-4`);switch(e.type){case`left`:a.push(`left`),o*=2/3;break;case`right`:a.push(`right`),o*=2/3;break;case`bottom`:a.push(`bottom`);break}return e.items?.length||a.push(`multi-image`),t.embed({...q,id:n,behavior:a,label:e.label||{en:[`Untitled`]},height:e.height||4e3,duration:e.duration,width:e.width||o,items:[t.embed({...qe,id:r,type:`AnnotationPage`,items:e.items?e.items:[]})],annotations:[t.embed({...qe,id:i,type:`AnnotationPage`,items:[]})]})}const Nt=K({...Ue,id:`@exhibitions/image-url-creator`,create:Pt,tags:[`exhibition-slide`],label:`Image`,summary:`Image from URL`,resourceType:`Canvas`,supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function Pt(e,t){let n=t.generateId(`canvas`);t.generateId(`annotation-page`,{id:n,type:`Canvas`});let r=t.generateId(`annotation`),i=await G(t,{id:r,type:`Annotation`},`body`,`@manifest-editor/image-url-creator`)(e,{target:{id:n,type:`Canvas`},targetType:`Annotation`}),{width:a,height:o}=i.get(),s=t.embed({id:r,type:`Annotation`,motivation:`painting`,body:[i],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}});return await G(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,width:a,height:o,type:`default`,items:[s]})}const Ft=K({id:`@exhibitions/info-box-creator`,create:It,label:`Info box`,summary:`A text panel for an exhibition`,icon:M(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,children:[j(`title`,{children:`Info box`}),j(`path`,{fill:`currentColor`,d:`M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22`})]}),tags:[`exhibition-slide`],resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function It(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),a={...Ke,id:t.generateId(`annotation`,{id:n,type:`Canvas`}),type:`Annotation`},o=[await t.create(`@manifest-editor/html-body-creator`,{language:`en`,body:``},{parent:{resource:a,property:`body`}})],s=t.embed({...a,motivation:`painting`,body:o,target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}}),c=t.generateId(`annotation`,{id:n,type:`Canvas`}),l=t.embed({id:c,type:`Annotation`,motivation:`tagging`,body:[await t.create(`@manifest-editor/html-body-creator`,{language:`en`,body:``},{parent:{resource:{id:c,type:`Annotation`},property:`body`}})],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}}),u=t.embed({id:r,type:`AnnotationPage`,items:[s]}),d=t.embed({id:i,type:`AnnotationPage`,items:[l]});return t.embed({...q,id:n,type:`Canvas`,behavior:[`w-4`,`h-4`,`info`],label:e.label||void 0,height:e.height||1e3,width:e.width||1e3,items:[u],annotations:[d]})}const Lt=K({...We,id:`@exhibitions/video-creator`,create:Rt,tags:[`video`,`exhibition-slide`],label:`Video`,summary:`A video for an exhibition`,resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});async function Rt(e,t){let n=t.generateId(`canvas`),r=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),i=await t.create(`@manifest-editor/video-annotation`,e,{target:{id:n,type:`Canvas`},targetType:`Annotation`,parent:{resource:{id:r,type:`AnnotationPage`},property:`items`}});return t.embed({id:r,type:`AnnotationPage`,items:[i]}),await G(t,`Manifest`,`items`,`@exhibitions/image-slide-creator`)({canvasId:n,height:e.height||1080,width:e.width||1920,duration:e.duration,type:`bottom`,items:[i]})}const zt=K({...Ge,id:`@exhibitions/youtube-creator`,create:Bt,tags:[`video`,`exhibition-slide`],label:`YouTube`,summary:`A YouTube for an exhibition`});async function Bt(e,t){let n=me(e.youtubeUrl),r=t.generateId(`canvas`),i=t.generateId(`annotation-page`,{id:r,type:`Canvas`}),a=await t.create(`@manifest-editor/youtube`,e,{target:{id:r,type:`Canvas`},targetType:`Annotation`,parent:{resource:{id:i,type:`AnnotationPage`},property:`items`}}),o=t.embed({id:i,type:`AnnotationPage`,items:[a]}),s=t.embed({id:`https://img.youtube.com/vi/${n}/maxresdefault.jpg`,type:`Image`,format:`image/jpeg`,width:640,height:360});return t.embed({...q,id:r,type:`Canvas`,behavior:[`w-12`,`h-8`],label:e.label||{en:[`Untitled YouTube Video`]},height:e.height||1080,width:e.width||1920,thumbnail:[s],items:[o]})}function Vt({children:e}){let t=D(),{edit:n}=p();return M(`div`,{className:`grid auto-rows-auto grid-cols-12 content-center justify-center gap-2 p-2`,children:[j(`div`,{className:`col-span-12 row-span-2 text-black flex flex-col items-center justify-center`,children:j(U,{onPress:()=>t&&n(t),className:`col-span-4 row-span-4 text-md text-left text-black hover:bg-slate-100 w-full flex items-center justify-center`,children:j(C,{className:`block w-full text-left`,children:t?.label})})}),e]})}const Ht=Ee(function({isFirst:e,item:t,children:n,...r},i){let a=T(),[o]=be();a?.behavior;let s=y(`Canvas`),c=yt(a?.behavior,e),{isBottom:l,isImage:u,isInfo:d,isLeft:f}=J(a?.behavior),p=s?.resource.source?.id===a?.id,m=null;return m=d?j(`div`,{className:`bg-black w-full h-full text-white max-h-40`,children:j(`div`,{className:`p-1.5 text-[4px]`,children:o.type===`textual-content`?j(C,{enableDangerouslySetInnerHTML:!0,children:o.items[0]?.text}):null})}):M(`div`,{className:W(`flex h-full max-h-full min-h-0`,f?`flex-row-reverse`:l?`flex-col`:`flex-row`),children:[j(`div`,{className:`flex-1 overflow-hidden relative justify-self-stretch`,children:j(`div`,{className:`absolute inset-0 w-full h-full`,children:j(Pe,{cover:!0,fade:!1})})}),u?null:j(`div`,{className:`${l?`min-h-3 w-full`:`w-1/3`} flex-shrink-0 self-stretch p-2 text-white bg-black rounded`,children:M(`div`,{className:`p-1.5 text-[4px]`,children:[j(C,{className:`block mb-1 text-[5px]`,children:a?.label}),j(C,{children:a?.summary})]})})]}),M(`div`,{ref:i,className:W(c,`bg-me-gray-700 overflow-hidden hover:ring-2 ring-me-primary-500 relative`,p?`ring-2 ring-me-primary-500`:``),...r,children:[m,n]})});function Ut(){let{open:e}=p(),{structural:t,technical:n}=h(),[,r]=s({id:n.id.get(),type:`Manifest`},`items`,`Manifest`);return j(Vt,{children:t.items.get().map((t,n)=>j(S,{canvas:t.id,children:j(Ht,{isFirst:n===0,item:t,onClick:()=>{e({id:`current-canvas`}),r.edit(t,n)}})},n))})}function Wt(e){return M(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,height:`1em`,width:`1em`,...e,children:[j(`title`,{children:`Rearrange`}),j(`path`,{fill:`none`,d:`M0 0h24v24H0z`}),j(`path`,{d:`M20 9H4v2h16V9zM4 15h16v-2H4v2z`,fill:`currentColor`})]})}function Gt({isFirst:e,onClick:t,item:n,actions:r}){let{attributes:i,listeners:a,setNodeRef:o,transform:s,transition:c}=it({id:n.id,transition:{duration:150,easing:`cubic-bezier(0.25, 1, 0.5, 1)`}});return j(Ht,{ref:o,style:{transform:at.Translate.toString(s),transition:c},...i,...a,onClick:t,isFirst:e,item:n,children:M(`div`,{className:`absolute top-0.5 right-0.5 flex gap-0.5 items-stretch`,children:[r?.length?j(ne,{as:U,className:`bg-white p-1 text-2xl hover:text-me-500 aria-expanded:text-me-600 aria-expanded:bg-me-200 hover:bg-me-100 rounded-sm`,"aria-label":`Action menu`,items:r,children:j(Fe,{})}):null,j(`div`,{className:`bg-white text-2xl h-8 flex items-center p-1 hover:text-me-500 hover:bg-me-100 rounded-sm`,children:j(Wt,{"aria-label":`Reorder item`})})]})})}function Kt(){let e=D(),{structural:t,technical:n}=h(),r=l(),i=y(`Canvas`),a=t.items.get(),{open:o}=p(),c=$e(Qe(Xe,{activationConstraint:{distance:5}}),Qe(Ye,{coordinateGetter:rt})),[,u]=s({id:n.id.get(),type:`Manifest`},`items`,`Manifest`),d=De(e=>{let{active:n,over:r}=e;r&&n.id!==r.id&&t.items.reorder(a.findIndex(e=>e.id===n.id),a.findIndex(e=>e.id===r.id))},[a,t.items]),f=i?.resource.source.id,m=f?a.findIndex(e=>e.id===f):-1,ee=m&&m>0?Number(m-1):0;function g(){r.close();let n=t.items.get();n&&n.length>0?u.edit(n[ee]):u.edit(e)}let te=F(()=>pe(t.items,g),[t.items,g]);return j(Vt,{children:j(Je,{sensors:c,collisionDetection:Ze,onDragEnd:d,modifiers:[et],children:j(tt,{items:a,strategy:nt,children:a.map((t,n)=>t?j(S,{canvas:t.id,children:j(Gt,{item:t,isFirst:n===0,onClick:()=>{o({id:`current-canvas`}),u.edit(t,n)},actions:te(t,n,e)},t.id)},t.id):null)})})})}const qt={id:`canvas-listing`,label:`Exhibition grid`,icon:j(Z,{}),render:()=>j(Jt,{}),options:{minWidth:350,maxWidth:350}};function Jt(){let{technical:e}=h(),[t,n]=s({id:e.id.get(),type:`Manifest`},`items`,`Canvas`,void 0,{isPainting:!0}),[r,i]=_e();return M(V,{children:[j(Ie,{title:`Exhibition`,actions:[{icon:r.list?j(we,{className:`text-2xl`}):j(Z,{}),title:r.list?`List view`:`Grid view`,onClick:()=>i(`list`)},{icon:j(Yt,{}),title:`Edit slides`,toggled:r.editing,onClick:()=>i(`editing`)},{icon:j(Xt,{}),title:`Add new slide`,disabled:!t,onClick:()=>n.createFiltered(`exhibition-slide`)}]}),j(H,{children:r.list?j(Ce,{isEditing:r.editing}):r.editing?j(Kt,{}):j(Ut,{})})]})}function Z(){return M(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`currentColor`,viewBox:`0 -960 960 960`,children:[j(`title`,{children:`Exhibition grid`}),j(`path`,{d:`M600-160v-280h280v280H600ZM440-520v-280h440v280H440ZM80-160v-280h440v280H80Zm0-360v-280h280v280H80Zm440-80h280v-120H520v120ZM160-240h280v-120H160v120Zm520 0h120v-120H680v120ZM160-600h120v-120H160v120Zm360 0Zm-80 240Zm240 0ZM280-600Z`})]})}function Yt(){return M(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24`,viewBox:`0 0 24 24`,width:`24`,children:[j(`title`,{children:`Edit slides`}),j(`path`,{d:`M0 0h24v24H0V0z`,fill:`none`}),j(`path`,{d:`M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z`})]})}function Xt(){return M(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,fill:`currentColor`,viewBox:`0 -960 960 960`,children:[j(`title`,{children:`Add new slide`}),j(`path`,{d:`M160-240v-480 480Zm80-80v-200h360v200H240Zm-80 160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v240h-80v-240H160v480h360v80H160Zm500-320v-100H360v-60h360v160h-60Zm60 400v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z`})]})}function Zt(){let e=u(),t=()=>{let t=e.technical.width.get(),n=e.technical.height.get(),r=e.descriptive.summary,i=e.technical.behavior.get();i.push(`w-12`);let a=Math.max(1,Math.min(12,Math.round(t/n*12)));i.push(`h-${a}`),ot(r.get())||r.set({en:[`Summary of image`]}),e.technical.behavior.set(i)};return M(`div`,{className:`flex flex-col items-center gap-4 border-me-100 border-2 p-4 rounded`,children:[`This canvas was not created in the exhibition editor. Do you want to apply default settings?`,j(R,{onPress:()=>t(),children:`Apply defaults`})]})}const Qt={id:`@exhibition/right-panel-editor`,supports:{edit:!0,properties:[`label`,`summary`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=J(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Exhibition`,component:()=>j($t,{})};function $t(){let e=T(),n=c(),{structural:r,descriptive:i}=u(),{items:a}=r,{thumbnail:o}=i,s=a.get()[0],l=bt(e);return!e||!s||!n?j(`div`,{className:`p-8`,children:`Canvas, page, or resource not found`}):j(V,{children:j(H,{padding:!0,children:M(t,{resource:e,children:[l?null:j(Zt,{}),j(v,{dispatchType:`label`,disableMultiline:!0,disallowHTML:!0}),j(ce,{containerId:o.containerId(),label:`Thumbnail`,property:`thumbnail`,items:o.get(),singleMode:!0,reorder:e=>o.reorder(e.startIndex,e.endIndex),createActions:pe(o),creationType:`ContentResource`,emptyLabel:`No thumbnail`,parent:n?.resource}),j(x,{annotationPage:s.id,children:j(le,{createFilter:`image`})})]})})})}const en={id:`@exhibition/summary-editor`,supports:{edit:!0,properties:[`summary`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=J(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Summary`,component:()=>j(tn,{})};function tn(){let e=T();return e?j(V,{children:j(H,{padding:!0,children:M(t,{resource:e,children:[j(v,{dispatchType:`label`}),j(v,{dispatchType:`summary`})]})})}):null}function Q(e){return j(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`1em`,height:`1em`,viewBox:`0 0 24 24`,...e,children:j(`path`,{fill:`currentColor`,d:`M9 16.17L4.83 12l-1.42 1.41L9 19L21 7l-1.41-1.41z`})})}const $=`<h2>New step</h2><p>Description</p>`;function nn(){let{saveAnnotation:e}=E(),[t,n]=ye(),{editorFeatureFlags:r}=o(),{annotationPopups:i}=r;return i?M(`div`,{className:`bg-white shadow-md rounded-lg`,children:[j(`div`,{className:`prose-headings:mt-1 overflow-y-auto rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500`,children:j(Ne,{className:`border-none`,value:t.bodyValue||$,onChange:e=>n({bodyValue:e})})}),M(`div`,{className:`flex gap-2 p-3`,children:[M(R,{primary:!0,onPress:()=>e(),children:[j(Q,{}),` Finish editing`]}),j(_,{})]})]}):M(`div`,{className:`flex gap-2`,children:[M(R,{primary:!0,onPress:()=>e(),children:[j(Q,{}),` Finish editing`]}),j(_,{})]})}function rn(){let e=k(a(),e=>e.polygon),[t,n]=ye(),{editorFeatureFlags:r}=o(),{annotationPopups:i}=r,{cancelRequest:s,saveAnnotation:c}=E();return M(`div`,{className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[M(`div`,{className:`bg-me-primary-500 text-white p-2 m-1 rounded flex gap-2`,children:[j(Le,{}),`Draw a box on the canvas`]}),i?j(`div`,{className:`relative p-3 line-clamp-3 prose-p:text-slate-600`,children:j(`div`,{className:`prose-headings:mt-1 prose-headings:mb-1 prose-sm`,children:j(`div`,{dangerouslySetInnerHTML:{__html:t.bodyValue||$}})})}):j(Ne,{className:`border-none`,value:t.bodyValue||$,onChange:e=>n({bodyValue:e})}),M(`div`,{className:`flex gap-2 p-3`,children:[M(R,{isDisabled:e?.points.length===0,onPress:()=>c(),children:[j(Q,{}),` Finish editing`]}),M(R,{className:`gap-2 flex`,onPress:()=>s(),children:[j(z,{}),` Delete`]}),j(_,{})]})]})}function an(){let{editorFeatureFlags:e}=o(),{annotationPopups:t}=e,n=g();return j(R,{className:`ml-auto`,onPress:()=>n({editorFeatureFlags:{...e,annotationPopups:!t}}),children:j(t?ke:Ae,{})})}function on({highlightProps:e}){let t=Oe(n),r=w(),{editorFeatureFlags:i}=o(),{annotationPopups:a}=i,{isPending:s,cancelRequest:c,busy:l,requestAnnotationFromTarget:u,deleteAnnotation:d}=he({annotationPopup:j(b,{annotation:r.id,children:j(n.Provider,{value:t,children:j(sn,{})})})}),[f,p]=L(!1);return N(()=>{f&&!s&&p(!0)},[s,f]),M(`div`,{...e,className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[j(`div`,{className:`relative`,children:f&&!a?j(oe,{className:`border-none`}):j(Me,{className:`px-3 pt-3 line-clamp-3 prose-p:text-slate-600`,locale:`en`})}),M(`div`,{className:`flex gap-2 p-2`,children:[f&&s?M(A,{children:[M(R,{primary:!0,onPress:()=>{p(!1),c()},children:[j(Q,{}),` Finish editing`]}),j(_,{})]}):M(R,{isDisabled:l,onPress:()=>{p(!0),u().then(()=>{p(!1)})},children:[j(B,{}),` Edit`]}),M(R,{className:`gap-2 flex`,onPress:()=>d(),children:[j(z,{}),` Delete`]})]}),j(`div`,{className:`absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0`})]})}function sn(){let{editorFeatureFlags:e}=o(),{annotationPopups:t}=e,{saveAnnotation:n}=E();return t?M(`div`,{className:`bg-white shadow-md rounded-lg relative max-h-[50vh] overflow-y-auto`,children:[j(`div`,{className:`prose-headings:mt-1 rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500`,children:j(oe,{className:`border-none`})}),M(`div`,{className:`flex gap-2 p-2 sticky bottom-0 z-50 bg-white`,children:[M(R,{primary:!0,onPress:()=>{n()},children:[j(Q,{}),` Finish editing`]}),j(an,{})]})]}):M(`div`,{className:`flex gap-2`,children:[M(R,{primary:!0,onPress:()=>n(),children:[j(Q,{}),` Finish editing`]}),j(_,{})]})}function cn({originalAnnotationId:e,highlightProps:t}){let n=d(ve()),r=w(),{edit:i}=p(),[a,o]=L(!1),s=()=>{if(e&&confirm(`Are you sure you want to delete this annotation?`)){let t=n.structural.items.getWithoutTracking().findIndex(t=>t.id===e);n.structural.items.deleteAtIndex(t)}};return M(`div`,{...t,className:`border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative`,children:[j(`div`,{className:`flex gap-2 mb-2 p-3`,children:j(`div`,{className:`flex-1 min-w-0`,children:a?M(A,{children:[j(`h3`,{className:`text-lg font-semibold border-b pt-1 pb-2 mb-2`,children:`Edit step`}),j(v,{dispatchType:`label`}),j(v,{dispatchType:`summary`})]}):M(A,{children:[j(C,{as:`div`,defaultText:j(`span`,{className:`opacity-50`,children:`Untitled`}),className:`whitespace-nowrap overflow-ellipsis w-full overflow-x-hidden`,children:r?.label}),j(C,{className:`text-gray-500 text-sm bg-white line-clamp-2`,as:`div`,children:r?.summary})]})})}),M(`div`,{className:`flex gap-2 p-2`,children:[a?M(R,{onPress:()=>o(!1),children:[j(Q,{}),` Finish editing`]}):M(R,{onPress:()=>o(!0),children:[j(B,{}),` Edit body`]}),j(R,{onPress:()=>i(r),children:`Edit annotation`}),M(R,{className:`gap-2 flex`,onPress:()=>s(),children:[j(z,{}),` Delete`]})]}),j(`div`,{className:`absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0`})]})}function ln(){let[e,{annotationTarget:n,highlightProps:r}]=ge(),i=F(()=>n?{id:n,type:`Annotation`}:{id:e?.id,type:`Annotation`},[e?.id,n]);return n?j(t,{resource:i,children:j(b,{annotation:n,children:j(cn,{originalAnnotationId:e?.id,highlightProps:r})})}):j(t,{resource:i,children:j(on,{highlightProps:r})})}function un({reorderable:e=!1}){let t=ve(),n=d(t);return t?e?j(A,{children:j(de,{id:t.id,marginBottom:`0.5em`,items:t.items||[],inlineHandle:!1,reorder:({startIndex:e,endIndex:t})=>n.structural.items.reorder(e,t),renderItem:(e,t)=>j(b,{annotation:e.id,children:j(ln,{})})})}):j(A,{children:t.items.map(e=>j(b,{annotation:e.id,children:j(ln,{})},e.id))}):null}const dn={id:`@exhibition/tour-steps`,supports:{edit:!0,properties:[`annotations`],resourceTypes:[`Canvas`],custom:({resource:e},t)=>{let n=t.get(e),r=J(n.behavior);return n.type===`Canvas`&&!r.isInfo}},label:`Tour steps`,component:()=>j(fn,{})};function fn(){let e=T(),t=e?.annotations[0],n=e?.items[0];return j(!t||!e||!n?pn:mn,{})}function pn(){let e=T(),t=f(),n=()=>{e&&t.create(`@manifest-editor/empty-annotation-page`,{label:{en:[`Tour steps`]}},{target:{id:e.id,type:`Canvas`},targetType:`AnnotationPage`,parent:{property:`annotations`,resource:{id:e.id,type:`Canvas`}}})};return M(`div`,{className:`flex flex-col items-center justify-center p-4`,children:[j(`div`,{className:`p-4 opacity-50 text-center`,children:`This image does not yet have a tour.`}),j(U,{className:`border w-full disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500`,onPress:()=>n(),children:`Create Tour`})]})}function mn(){let e=T(),n=e?.annotations[0],r=e?.items[0],i=d(n),a=f(),[o,s]=L(!1),{requestAnnotation:c,isPending:l,busy:u,cancelRequest:p,completeRequest:m}=xe({onSuccess:t=>{let r=t.metadata.bodyValue||``;!t.cancelled&&t.target&&n&&a.create(`@manifest-editor/html-annotation`,{label:{en:[`Tour step`]},body:{en:[r||`<h2>New step</h2><p>Description</p>`]},motivation:`tagging`},{target:{id:e.id,type:`Canvas`},targetType:`Annotation`,parent:{property:`items`,resource:{id:n.id,type:`AnnotationPage`}},initialData:{selector:t}})}});return e?n?j(V,{children:M(H,{padding:!0,children:[M(`div`,{className:`flex gap-4 border-b pt-4 pb-2 mb-2`,children:[j(`h2`,{className:`text-lg font-semibold flex-1`,children:`Tour steps`}),j(R,{onPress:()=>s(e=>!e),children:o?`Done`:`Reorder`})]}),j(t,{resource:e,children:M(x,{annotationPage:n.id,children:[M(`div`,{className:`flex flex-col gap-4`,children:[j(un,{reorderable:o}),u?null:l?j(rn,{}):j(U,{onPress:()=>c({type:`box`,annotationPopup:j(nn,{})}),className:`border disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500`,children:`+ Add new step`})]}),r?M(A,{children:[j(`h3`,{className:`text-md border-b pt-4 pb-2 mb-2`,children:`Available tour steps from images`}),j(ue,{painting:r,page:i.ref(),canvasId:e.id})]}):null]})})]})}):j(`div`,{children:`No annotation page - create one?`}):null}function hn(){let e=T();Be(e);let t=e.width&&e.height?e.width/e.height:0,n=vt(e.behavior||[]);return Math.abs(t-n.ratio)<.01?null:M(`div`,{className:`p-2 rounded bg-me-100`,children:[j(`div`,{className:`text-me-700-500`,children:`Aspect ratio warning`}),M(`div`,{className:`text-sm text-black/60`,children:[`The aspect ratio of this canvas is `,t.toFixed(2),` but the target aspect ratio is `,n.ratio.toFixed(2),`. Some parts of this image may be cropped.`,j(`div`,{className:`relative h-32 w-full mt-2`,children:j(`div`,{className:`bg-[red] left-0 top-0 z-2 opacity-50 max-w-32 max-h-32`,style:{aspectRatio:t.toFixed(2)},children:j(`div`,{className:`asbolute bg-[white] left-0 top-0 z-1 opacity-50 max-w-32 max-h-32`,style:{aspectRatio:n.ratio}})})})]})]})}const gn={component:()=>j(bn,{}),supports:{edit:!0,resourceTypes:[`Canvas`],properties:[`behavior`]},id:`slide-behaviors`,label:`Layout`,tabs:{showTitle:!0}},_n=[{id:`layout`,type:`choice`,label:{en:[`Layout`]},initialOpen:!0,items:[{label:{en:[`Text on left`]},value:`left`},{label:{en:[`Text on right`]},value:`right`},{label:{en:[`Text on bottom`]},value:`bottom`},{label:{en:[`Text on top`]},value:`top`},{label:{en:[`Only image`]},value:`image`}]},{id:`floating`,type:`choice`,label:{en:[`Floating`]},initialOpen:!1,addNone:!0,groupBehavior:`floating`,items:[{label:{en:[`Float top left`]},value:`float-top-left`},{label:{en:[`Float top right`]},value:`float-top-right`},{label:{en:[`Float bottom left`]},value:`float-bottom-left`},{label:{en:[`Float bottom right`]},value:`float-bottom-right`}]},{id:`size`,component:(e,t)=>j(yn,{behaviors:e,setBehaviors:t}),label:{en:[`Size`]},type:`custom`,initialOpen:!0,supports:e=>e.startsWith(`w-`)||e.startsWith(`h-`)}];function vn(e){let t=0,n=0;for(let r of e)r.startsWith(`w-`)&&(t=Number.parseInt(r.slice(2))),r.startsWith(`h-`)&&(n=Number.parseInt(r.slice(2)));return{width:t,height:n}}function yn({behaviors:e,setBehaviors:t}){let{width:n,height:r}=vn(e),[i,a]=L({x:-1,y:-1}),o=(n,r)=>{let i=e.filter(e=>!e.startsWith(`w-`)&&!e.startsWith(`h-`));i.push(`w-${n}`),i.push(`h-${r}`),t(i)};return j(`div`,{className:`grid grid-cols-12 grid-rows-12 gap-1`,onMouseLeave:()=>a({x:-1,y:-1}),children:Array.from({length:144},(e,t)=>{let s=t%12,c=Math.floor(t/12),l=i.x>=s&&i.y>=c,u=s<n&&c<r,d=l&&u,f=`bg-gray-200`;return l&&(f=`bg-me-200`),u&&(f=`bg-me-500`),d&&(f=`bg-me-400`),j(`div`,{className:`flex aspect-square rounded cursor-se-resize items-center justify-center ${f}`,onClick:()=>o(s+1,c+1),onMouseUp:()=>o(s+1,c+1),onMouseEnter:()=>a({x:s,y:c})},t)})})}function bn(){let e=y(`Canvas`),t=u(),{width:n,height:r}=t.technical;return!e||t.technical.type!==`Canvas`?M(V,{children:[j(Ie,{title:`Slide behaviors`}),j(`div`,{children:`Please select canvas`})]}):j(V,{children:M(H,{children:[j(`div`,{className:`px-2`,children:M(se,{$wide:!0,children:[j(ae,{widthId:n.containerId(),width:n.get()||0,changeWidth:e=>n.set(e),heightId:r.containerId(),height:r.get()||0,changeHeight:e=>r.set(e)}),j(`div`,{children:j(hn,{})})]})}),j(re,{behavior:t.technical.behavior.get()||[],onChange:e=>{t.technical.behavior.set(e)},configs:_n})]})})}const xn=r(i(e),{id:`exhibition-editor`,title:`Exhibition Editor`,project:!0,projectType:`Manifest`},{config:{editorConfig:{Canvas:{hideTabs:[`@manifest-editor/overview`,`@manifest-editor/technical-properties`,`@manifest-editor/linking-properties`,`@manifest-editor/nav-place-editor`,`@manifest-editor/canvas-structural`,`@manifest-editor/descriptive-properties`,`@manifest-editor/overview-canvas-editor`,`@manifest-editor/metadata`]}}},leftPanels:[qt,dt],centerPanels:[lt],annotations:[st],leftPanelIds:[`left-panel-manifest`],background:[pt],canvasEditors:[xt,Dt,wt],editors:[Qt,gn,en,dn],creators:[Ft,zt,jt,kt,Y,Nt,Lt]});export{xn as exhibitionEditorPreset};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["tourStepAnnotations: AnnotationPanel","exhibitionCenterPanel: LayoutPanel","exhibitionOverviewLeftPanel: LayoutPanel","exhibitionBackgroundTask: BackgroundPanel","imageBlockEditor: CanvasEditorDefinition","infoBlockEditor: CanvasEditorDefinition","youtubeMainEdtior: CanvasEditorDefinition","ExhibitionItem","prevCanvasIndex: number","exhibitionGridLeftPanel: LayoutPanel","exhibitionCanvasEditor: EditorDefinition","ExhibitionRightPanel","exhibitionSummaryEdtior: EditorDefinition","ExhibitionRightPanel","exhibitionTourSteps: EditorDefinition","customBehaviourEditor: EditorDefinition","exhibitionConfigs: BehaviorEditorProps[\"configs\"]"],"sources":["../src/annotations/TourStepAnnotations.tsx","../src/center-panels/ExhibitionCenterPanel.tsx","../src/left-panels/ExhibitionOverview.tsx","../src/background-panel.tsx","../src/helpers.ts","../src/canvas-editors/image-block-editor.tsx","../src/canvas-editors/info-block-editor.tsx","../src/canvas-editors/youtube-editor.tsx","../src/creators/image-browser-slide-creator.tsx","../src/creators/image-service-slide-creator.tsx","../src/creators/image-slide-creator.tsx","../src/creators/image-url-slide.tsx","../src/creators/info-box-creator.tsx","../src/creators/video-slide-creator.tsx","../src/creators/youtube-slide-creator.tsx","../src/components/ExhibitionContainer.tsx","../src/components/ExhibitionItem.tsx","../src/components/ExhibitionGrid.tsx","../src/icons/ResizeHandleIcon.tsx","../src/components/SortableExhibitionItem.tsx","../src/components/SortableExhibitionGrid.tsx","../src/left-panels/ExhibitionGrid.tsx","../src/components/ExhibitionItemConversion.tsx","../src/right-panels/ExhibitionCanvasEditor.tsx","../src/right-panels/ExhibitionSummaryEditor.tsx","../src/icons/CheckIcon.tsx","../src/components/ExhibitionTourStepPopup.tsx","../src/components/PendingTourStepAnnotation.tsx","../src/components/ActionButtonPopupSwitcher.tsx","../src/components/TourNormalAnnotationEditor.tsx","../src/components/TourPaintingAnnotationEditor.tsx","../src/components/TourAnnotationEditor.tsx","../src/components/TourAnnotationPageEditor.tsx","../src/right-panels/ExhibitionTourSteps.tsx","../src/components/AspectRatioWarning.tsx","../src/right-panels/SlideBehaviours.tsx","../src/index.tsx"],"sourcesContent":["import { ViewerAnnotationPage } from \"@manifest-editor/editors\";\nimport { type AnnotationPanel, useAtlasStore, useLayoutState } from \"@manifest-editor/shell\";\nimport { AnnotationPageContext, useCanvas } from \"react-iiif-vault\";\nimport { useStore } from \"zustand\";\n\nexport const tourStepAnnotations: AnnotationPanel = {\n id: \"@exhibition/tour-step-annotations\",\n label: \"Tour steps\",\n render: () => <TourStepAnnotations />,\n};\n\nfunction TourStepAnnotations() {\n const canvas = useCanvas();\n const store = useAtlasStore();\n const toolEnabled = useStore(store, (s) => s.tool.enabled);\n const { rightPanel } = useLayoutState();\n const isRightPanel = rightPanel.current === \"@manifest-editor/editor\";\n const isTour = isRightPanel && rightPanel.state?.currentTab?.startsWith(\"@exhibition/tour-steps\");\n const firstAnnotationPage = canvas?.annotations[0];\n\n if (!isTour || !canvas || toolEnabled || !firstAnnotationPage) {\n return null;\n }\n\n return (\n <>\n <AnnotationPageContext annotationPage={firstAnnotationPage.id}>\n <ViewerAnnotationPage />\n </AnnotationPageContext>\n </>\n );\n}\n","import { EditTextIcon } from \"@manifest-editor/components\";\nimport { CanvasPanelEditor, CanvasPanelViewer } from \"@manifest-editor/editors\";\nimport {\n EditingStackContext,\n InlineEditingStack,\n type LayoutPanel,\n useLayoutActions,\n usePanelActions,\n} from \"@manifest-editor/shell\";\nimport { DelftExhibition } from \"exhibition-viewer\";\nimport { type EditorHooks, EditorHooksProvider } from \"exhibition-viewer/library\";\nimport { useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { Button } from \"react-aria-components\";\nimport { CanvasContext, useManifest, useVault } from \"react-iiif-vault\";\n\nexport const exhibitionCenterPanel: LayoutPanel = {\n id: \"@exhibitions/center-panel\", // We are overriding the default canvas listing panel\n label: \"Exhibition editor\",\n icon: null,\n render: () => <ExhibitionCenterPanel />,\n options: {\n minWidth: 350,\n maxWidth: 350,\n },\n};\n\nfunction ExhibitionCenterPanel() {\n const manifest = useManifest();\n const vault = useVault();\n const [scale, setScale] = useState(0.8);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const { edit, leftPanel } = useLayoutActions();\n\n const hooks = useMemo(() => {\n return {\n localeStringEditor: (props) => {\n return (\n <span className=\"inline-flex items-center hover:ring-4 hover:ring-me-primary-500\">\n {props.original}\n <Button className=\"py-1 px-2 inline-block\" onPress={() => edit(props.resource)}>\n <EditTextIcon className=\"text-xl\" />\n </Button>\n </span>\n );\n },\n canvasPreviewEditor: (props) => {\n return (\n <div className=\"w-full h-full flex-1 flex relative\">\n {props.original}\n <button\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n edit(props.resource);\n leftPanel.open({ id: \"canvas-listing\", open: true });\n }}\n className=\"absolute top-5 right-5 bg-white text-black p-2 rounded z-40\"\n >\n EDIT\n </button>\n </div>\n );\n },\n } satisfies EditorHooks;\n }, []);\n\n useLayoutEffect(() => {\n if (wrapperRef.current) {\n const wrapperWidth = wrapperRef.current.offsetWidth;\n const initialScale = wrapperWidth / 1200;\n setScale(Math.max(1, initialScale));\n }\n }, []);\n\n if (!manifest) return null;\n\n return (\n <div ref={wrapperRef} className=\"overflow-y-auto delft-exhibition\">\n <EditorHooksProvider hooks={hooks}>\n <DelftExhibition\n key={scale}\n skipLoadManifest\n customVault={vault}\n manifest={manifest.id}\n options={{\n disablePresentation: true,\n hideTableOfContents: true,\n hideTitle: true,\n alternativeImageMode: true,\n }}\n />\n </EditorHooksProvider>\n </div>\n );\n}\n","import { InfoIcon } from \"@manifest-editor/components\";\nimport type { LayoutPanel } from \"@manifest-editor/shell\";\nimport { useManifest } from \"react-iiif-vault\";\n\nexport const exhibitionOverviewLeftPanel: LayoutPanel = {\n id: \"@exhibitions/overview-panel\", // We are overriding the default canvas listing panel\n label: \"\",\n icon: <div className=\"hidden hover:block\">👀</div>,\n render: () => <ExhibitionOverviewPanel />,\n};\n\nexport function ExhibitionOverviewPanel() {\n const manifest = useManifest();\n\n if (!manifest) return null;\n\n return (\n <div>\n Coming soon.\n {/*<DelftExhibition manifest={manifest.id} language=\"en\" viewObjectLinks={[]} />*/}\n </div>\n );\n}\n","import { useInStack } from \"@manifest-editor/editors\";\nimport { useEditCanvasItems } from \"@manifest-editor/manifest-preset/components\";\nimport { type BackgroundPanel, useConfig, useLayoutActions, useLayoutState } from \"@manifest-editor/shell\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useManifest } from \"react-iiif-vault\";\nimport { exhibitionCenterPanel } from \"./center-panels/ExhibitionCenterPanel\";\nimport { exhibitionOverviewLeftPanel } from \"./left-panels/ExhibitionOverview\";\n\nexport const exhibitionBackgroundTask: BackgroundPanel = {\n id: \"exhibition-background-task\",\n label: \"Query string\",\n render: () => <ExhibitionBackgroundPanel />,\n};\n\nfunction ExhibitionBackgroundPanel() {\n console.log(\"rendering?\");\n const manifest = useManifest();\n const canvas = useInStack(\"Canvas\");\n const { leftPanel, rightPanel } = useLayoutState();\n const {\n edit,\n leftPanel: leftPanelActions,\n rightPanel: rightPanelActions,\n centerPanel: centerPanelActions,\n } = useLayoutActions();\n const { canvasActions, open } = useEditCanvasItems();\n const { editorFeatureFlags: { rememberCanvasId = true, rememberLeftPanelId = false } = {} } = useConfig();\n const isLeftPanelOpen = leftPanel.open;\n\n useEffect(() => {\n // When left panel is exhibition overview, set the main panel\n if (manifest && leftPanel.current === exhibitionOverviewLeftPanel.id) {\n edit(manifest);\n centerPanelActions.open({ id: exhibitionCenterPanel.id });\n leftPanelActions.close();\n }\n }, [leftPanel.current]);\n\n return null;\n}\n","import type { CanvasNormalized } from \"@iiif/presentation-3-normalized\";\n\nconst heightMap = {\n \"h-1\": \"lg:min-h-[100px] row-span-1\",\n \"h-2\": \"lg:min-h-[200px] row-span-2\",\n \"h-3\": \"lg:min-h-[300px] row-span-3\",\n \"h-4\": \"lg:min-h-[400px] row-span-4\",\n \"h-5\": \"lg:min-h-[500px] row-span-5\",\n \"h-6\": \"lg:min-h-[600px] row-span-6\",\n \"h-7\": \"lg:min-h-[700px] row-span-7\",\n \"h-8\": \"lg:min-h-[800px] row-span-8\",\n \"h-9\": \"lg:min-h-[900px] row-span-9\",\n \"h-10\": \"lg:min-h-[1000px] row-span-10\",\n \"h-11\": \"lg:min-h-[1100px] row-span-11\",\n \"h-12\": \"lg:min-h-[1200px] row-span-12\",\n};\nconst previewHeightMap = {\n \"h-1\": \"lg:min-h-[25px] row-span-1\",\n \"h-2\": \"lg:min-h-[50px] row-span-2\",\n \"h-3\": \"lg:min-h-[75px] row-span-3\",\n \"h-4\": \"lg:min-h-[100px] row-span-4\",\n \"h-5\": \"lg:min-h-[125px] row-span-5\",\n \"h-6\": \"lg:min-h-[150px] row-span-6\",\n \"h-7\": \"lg:min-h-[175px] row-span-7\",\n \"h-8\": \"lg:min-h-[200px] row-span-8\",\n \"h-9\": \"lg:min-h-[225px] row-span-9\",\n \"h-10\": \"lg:min-h-[250px] row-span-10\",\n \"h-11\": \"lg:min-h-[275px] row-span-11\",\n \"h-12\": \"lg:min-h-[300px] row-span-12\",\n};\n\nconst widthMap = {\n \"w-1\": \"col-span-1\",\n \"w-2\": \"col-span-2\",\n \"w-3\": \"col-span-3\",\n \"w-4\": \"col-span-4\",\n \"w-5\": \"col-span-5\",\n \"w-6\": \"col-span-6\",\n \"w-7\": \"col-span-7\",\n \"w-8\": \"col-span-8\",\n \"w-9\": \"col-span-9\",\n \"w-10\": \"col-span-10\",\n \"w-11\": \"col-span-11\",\n \"w-12\": \"col-span-12\",\n};\n\nexport function getHeightWidthRatio(behavior?: string[]) {\n const { isLeft, isRight, isBottom } = getGridStats(behavior);\n const h = behavior?.find((a) => a.includes(\"h-\")) as keyof typeof heightMap;\n const w = behavior?.find((a) => a.includes(\"w-\")) as keyof typeof widthMap;\n\n if (!h || !w) {\n return { h: 0, w: 0, ratio: 1 };\n }\n\n const ret = {\n h: Number.parseInt(h.split(\"-\")[1]!),\n w: Number.parseInt(w.split(\"-\")[1]!),\n ratio: 1,\n };\n\n // If left or right - the ratio is 2/3s.\n if (isLeft || isRight) {\n ret.w *= 2 / 3;\n }\n if (isBottom) {\n ret.h *= 2 / 3;\n }\n\n if (ret.h && ret.w) {\n ret.ratio = ret.w / ret.h;\n }\n return ret;\n}\n\nexport function getClassName(b?: string[], firstInfo = false, preview = true) {\n if (!b || b.length === 0) {\n b = [\"h-8\", \"w-8\", \"image\"];\n }\n let h = b.find((a) => a.includes(\"h-\")) as keyof typeof heightMap;\n const w = b.find((a) => a.includes(\"w-\")) as keyof typeof widthMap;\n const classNames = [];\n\n if (firstInfo && h === \"h-4\") {\n h = \"h-8\";\n }\n classNames.push(preview ? previewHeightMap[h] : heightMap[h]);\n classNames.push(widthMap[w]);\n return classNames.join(\" \");\n}\n\nexport function getGridStats(behavior?: string[]) {\n const isRight = behavior?.includes(\"right\");\n const isLeft = behavior?.includes(\"left\");\n const isBottom = behavior?.includes(\"bottom\");\n const isTop = behavior?.includes(\"top\");\n const isImage = behavior?.includes(\"image\") || (!isLeft && !isRight && !isBottom && !isTop);\n const isInfo = behavior?.includes(\"info\");\n\n return {\n isRight,\n isLeft,\n isBottom,\n isTop,\n isInfo,\n isImage,\n };\n}\n\nexport function isExhibitionItem(canvas: CanvasNormalized | undefined) {\n if (!canvas) return false;\n\n const behaviors = canvas.behavior || [];\n if (behaviors.includes(\"image\") || behaviors.includes(\"info\")) {\n return true;\n }\n\n for (const behavior of behaviors) {\n if (behavior.startsWith(\"w-\") || behavior.startsWith(\"h-\")) {\n return true;\n }\n }\n\n return false;\n}\n","import { ActionButton } from \"@manifest-editor/components\";\nimport { CanvasPanelEditor, useInStack, useToggleList } from \"@manifest-editor/editors\";\nimport type { CanvasEditorDefinition, LayoutPanel } from \"@manifest-editor/shell\";\nimport { useLocalStorage } from \"@manifest-editor/shell\";\nimport { CanvasContext, LocaleString, type RenderingStrategy, useCanvas } from \"react-iiif-vault\";\nimport { twMerge } from \"tailwind-merge\";\nimport { getClassName, getGridStats } from \"../helpers\";\nimport { useLayoutEffect, useRef, useState } from \"react\";\n\nexport const imageBlockEditor: CanvasEditorDefinition = {\n id: \"image-block-editor\",\n label: \"Image Block Editor\",\n component: (strategy) => <ImageBlockEditor strategy={strategy} />,\n supports: {\n strategy: (strategy, resource, vault) => {\n if (strategy.type !== \"images\") {\n return false;\n }\n\n const fullResource = vault.get(resource.resource);\n if (fullResource.type !== \"Canvas\") {\n return false;\n }\n\n const behaviors = fullResource.behavior || [];\n\n let isImage = false;\n for (const behaviour of behaviors) {\n if (behaviour.startsWith(\"w-\") || behaviour.startsWith(\"h-\") || behaviour === \"image\") {\n isImage = true;\n }\n }\n\n return isImage;\n },\n },\n};\n\nexport function ImageBlockEditor({ strategy }: { strategy: RenderingStrategy }) {\n const [isPreview, setIsPreview] = useLocalStorage(\"exhibition-preview-mode\");\n const canvas = useInStack(\"Canvas\");\n if (!canvas) {\n return null;\n }\n\n return (\n <CanvasContext canvas={canvas.resource.source?.id}>\n <div className=\"flex gap-4 bg-me-500 py-2 px-4 text-white shadow-md z-40 ring-1 ring-me-500 items-center\">\n Switch view\n <ActionButton onPress={() => setIsPreview(!isPreview)}>\n {isPreview ? \"Full canvas\" : \"Layout preview\"}\n </ActionButton>\n </div>\n {isPreview ? (\n <ImageBlockRenderer />\n ) : (\n <div className=\"h-full flex flex-1 min-h-0\">\n <CanvasPanelEditor asFallback />\n </div>\n )}\n </CanvasContext>\n );\n}\n\nfunction ImageBlockRenderer() {\n const ref = useRef<HTMLDivElement>(null);\n const canvas = useCanvas();\n const behavior = canvas?.behavior || [];\n const className = getClassName(behavior, false, false);\n const { isBottom, isImage, isInfo, isLeft } = getGridStats(canvas?.behavior);\n\n const [scale, setScale] = useState(1);\n\n useLayoutEffect(() => {\n // 1200 is what it looks like on the site.\n const container = ref.current;\n if (!container) return;\n const containerWidth = container.offsetWidth;\n const imageWidth = 1200;\n setScale(containerWidth / imageWidth);\n }, [canvas]);\n\n return (\n <div className=\"overflow-hidden h-full w-full\" ref={ref}>\n <div className=\"grid grid-cols-12 grid-rows-12 h-full bg-white\">\n <div\n className={twMerge(\n className,\n \"flex h-full max-h-full min-h-0 ring-4 ring-black\",\n isLeft ? \"flex-row-reverse\" : isBottom ? \"flex-col\" : \"flex-row\"\n )}\n >\n <div className=\"flex-1 h-full flex min-w-0\">\n <CanvasPanelEditor asFallback />\n </div>\n {!isImage ? (\n <div\n className={`${isBottom ? \"min-h-3 w-full\" : \"w-1/3\"} flex-shrink-0 self-stretch text-white bg-black rounded p-8 relative h-full`}\n >\n <div style={{ fontSize: `${scale * 16}px` }}>\n <LocaleString className=\"block mb-4\">{canvas?.label}</LocaleString>\n <LocaleString>{canvas?.summary}</LocaleString>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n","import { ActionButton } from \"@manifest-editor/components\";\nimport { AnnotationBodyEditor } from \"@manifest-editor/editors\";\nimport {\n type CanvasEditorDefinition,\n useGenericEditor,\n useInlineCreator,\n} from \"@manifest-editor/shell\";\nimport {\n AnnotationContext,\n type TextualContentStrategy,\n useAnnotation,\n useCanvas,\n useVaultSelector,\n} from \"react-iiif-vault\";\n\nexport const infoBlockEditor: CanvasEditorDefinition = {\n id: \"info-block-editor\",\n label: \"info Block Editor\",\n component: (strategy) => (\n <InfoBlockEditor strategy={strategy as TextualContentStrategy} />\n ),\n supports: {\n strategy: (strategy, resource, vault) => {\n if (strategy.type !== \"textual-content\") {\n return false;\n }\n return true;\n },\n },\n};\n\nexport function InfoBlockEditor(props: { strategy: TextualContentStrategy }) {\n const canvas = useCanvas();\n const annotationPage = useVaultSelector((_, vault) =>\n // biome-ignore lint/style/noNonNullAssertion: Should always be present.\n vault.get(canvas?.items[0]!),\n );\n const longSummaries = useVaultSelector((_, vault) =>\n canvas?.annotations[0] ? vault.get(canvas?.annotations[0]!) : null,\n );\n\n // creator.create(definition, payload);\n\n return (\n <div className=\"overflow-y-auto bg-white shadow\">\n <div className=\"mb-12\">\n {annotationPage.items.map((annotation, key) => {\n return (\n <AnnotationContext\n key={annotation.id + key}\n annotation={annotation.id}\n >\n <AnnotationEditor />\n </AnnotationContext>\n );\n })}\n </div>\n\n {longSummaries ? (\n <>\n <h2 className=\"text-2xl font-bold px-4 border-t border-gray-200 pt-4 mb-4\">\n Long Summaries\n </h2>\n <p className=\"my-4 px-4\">\n Long summaries are used to provide more detailed information about\n the canvas. They appear when the user clicks \"read more\" in the\n exhibition.\n </p>\n {longSummaries.items.map((annotation, key) => {\n return (\n <AnnotationContext\n key={annotation.id + key}\n annotation={annotation.id}\n >\n <AnnotationEditor />\n </AnnotationContext>\n );\n })}\n </>\n ) : null}\n </div>\n );\n}\n\nfunction AnnotationEditor() {\n const annotation = useAnnotation();\n const creator = useInlineCreator();\n const bodies = annotation?.body || [];\n const editor = useGenericEditor(annotation);\n\n if (!annotation) {\n return null;\n }\n\n return (\n <div>\n {bodies.map((body, n) => {\n return (\n <AnnotationBodyEditor\n key={n}\n className=\"p-4 hover:bg-me-100/40 focus-within:bg-me-100/40\"\n resourceId={body.id}\n onRemove={() => editor.annotation.body.deleteAtIndex(n)}\n />\n );\n })}\n\n <div className=\"p-4\">\n <ActionButton\n primary\n onPress={() => {\n creator.create(\n \"@manifest-editor/html-body-creator\",\n { language: \"en\", value: \"\" },\n {\n targetType: \"ContentResource\",\n parent: {\n property: \"body\",\n resource: {\n id: annotation.id,\n type: \"Annotation\",\n },\n },\n initialData: {},\n },\n );\n }}\n >\n Add new annotation\n </ActionButton>\n </div>\n </div>\n );\n}\n","import { ActionButton, LazyThumbnail } from \"@manifest-editor/components\";\nimport { type CanvasEditorDefinition, useGenericEditor, useLayoutActions } from \"@manifest-editor/shell\";\nimport { useRef } from \"react\";\nimport {\n LocaleString,\n type MediaStrategy,\n type SingleYouTubeVideo,\n useCanvas,\n useVaultSelector,\n} from \"react-iiif-vault\";\nimport invariant from \"tiny-invariant\";\n\nexport const youtubeMainEdtior: CanvasEditorDefinition = {\n id: \"youtube-main-editor\",\n label: \"YouTube main editor\",\n component: (strategy) =>\n strategy.type === \"media\" ? (\n <YouTubeEditor strategy={strategy as MediaStrategy} video={strategy.media as SingleYouTubeVideo} />\n ) : null,\n supports: {\n strategy: (strategy, resource, vault) => {\n console.log(strategy);\n if (strategy.type !== \"media\") {\n return false;\n }\n\n if (strategy.media.type !== \"VideoYouTube\") {\n return false;\n }\n\n return true;\n },\n },\n};\n\nexport function YouTubeEditor({ strategy, video }: { strategy: MediaStrategy; video: SingleYouTubeVideo }) {\n const { edit } = useLayoutActions();\n const canvas = useCanvas();\n const annotationRef = useVaultSelector((_, v) => {\n const page = v.get(canvas?.items[0]!);\n return page.items[0]!;\n });\n invariant(canvas && annotationRef);\n const player = useRef<HTMLIFrameElement>(null);\n const annotation = useGenericEditor(annotationRef);\n const media = video;\n\n const ar = (canvas.width || 1) / (canvas.height || 1);\n const ytThumbnail = `https://img.youtube.com/vi/${media.youTubeId}/maxresdefault.jpg`;\n\n return (\n <div className=\"overflow-y-auto\">\n <div className=\"p-8\">\n <div className=\"bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto\" style={{ aspectRatio: ar }}>\n <iframe\n title=\"YouTube video\"\n className=\"border-none w-full h-full object-contain\"\n ref={player}\n src={`https://www.youtube.com/embed/${media.youTubeId}?enablejsapi=1&origin=${window.location.host}&modestbranding=1&rel=0`}\n // @ts-expect-error\n referrerPolicy=\"no-referrer compute-pressure\"\n sandbox=\"allow-scripts allow-same-origin allow-presentation\"\n />\n </div>\n </div>\n\n <div className=\"bg-white shadow w-full p-8 flex gap-8\">\n <div>\n <div\n className=\"w-64 bg-black flex-shrink-0 flex items-center justify-center rounded overflow-clip\"\n style={{ aspectRatio: ar }}\n >\n {canvas.thumbnail?.length ? (\n <LazyThumbnail cover />\n ) : (\n <div className=\"text-white/50 text-center py-16\">No thumbnail</div>\n )}\n </div>\n </div>\n <div className=\"flex-1\">\n <LocaleString\n as=\"h3\"\n className=\"text-2xl font-bold mt-4\"\n defaultText={(<span className=\"text-black/30\">No Label</span>) as any}\n >\n {annotation.descriptive.label.get()}\n </LocaleString>\n <LocaleString\n as=\"p\"\n className=\"mt-2 mb-8\"\n defaultText={(<span className=\"text-black/30\">No summary</span>) as any}\n >\n {annotation.descriptive.summary.get()}\n </LocaleString>\n <ActionButton onPress={() => edit(annotation.ref())}>Edit properties</ActionButton>\n </div>\n </div>\n </div>\n );\n}\n","import {\n type CreatorFunctionContext,\n creatorHelper,\n type CreatorResource,\n defineCreator,\n} from \"@manifest-editor/creator-api\";\nimport { type IIIFBrowserCreatorPayload, iiifBrowserCreator } from \"@manifest-editor/creators\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/browser-creator\": typeof imageBrowserSlideCreator;\n }\n }\n}\n\nexport const imageBrowserSlideCreator = defineCreator({\n ...iiifBrowserCreator,\n id: \"@exhibitions/browser-creator\",\n create: createBrowser,\n tags: [\"image\", \"exhibition-slide\"],\n label: \"IIIF Browser\",\n summary: \"Browse IIIF Resources\",\n});\n\nasync function createBrowser(data: IIIFBrowserCreatorPayload, ctx: CreatorFunctionContext): Promise<CreatorResource> {\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n\n const dimensions = { width: 0, height: 0 };\n\n const createBrowserAnnotation = creatorHelper(\n ctx,\n { id: pageId, type: \"AnnotationPage\" },\n \"items\",\n \"@manifest-editor/iiif-browser-creator\",\n );\n\n const annotation = await createBrowserAnnotation(\n {\n ...data,\n trackSize({ width, height }) {\n dimensions.height = height;\n dimensions.width = width;\n },\n },\n {\n targetType: \"Annotation\",\n target: {\n id: canvasId,\n type: \"Canvas\",\n },\n },\n );\n\n const createSlide = creatorHelper(ctx, \"Manifest\", \"items\", \"@exhibitions/image-slide-creator\");\n\n // 2. Pass that to an empty slide.\n return await createSlide({\n canvasId,\n width: dimensions.width,\n height: dimensions.height,\n type: \"default\", // default / left / right / bottom\n items: annotation,\n });\n}\n","import {\n type CreatorFunctionContext,\n creatorHelper,\n type CreatorResource,\n defineCreator,\n} from \"@manifest-editor/creator-api\";\nimport { type CreateImageServicePayload, imageServiceCreator } from \"@manifest-editor/creators\";\nimport { imageSlideCreator } from \"./image-slide-creator\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/image-service-creator\": typeof imageServiceSlideCreator;\n }\n }\n}\n\nexport const imageServiceSlideCreator = defineCreator({\n ...imageServiceCreator,\n id: \"@exhibitions/image-service-creator\",\n create: createImageService,\n tags: [\"image\", \"exhibition-slide\"],\n label: \"IIIF Image\",\n summary: \"IIIF Image service\",\n resourceType: \"Canvas\",\n supports: {\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n },\n});\n\nasync function createImageService(\n data: CreateImageServicePayload,\n ctx: CreatorFunctionContext,\n): Promise<CreatorResource> {\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const annotationId = ctx.generateId(\"annotation\");\n\n const createImageService = creatorHelper(\n ctx,\n { id: annotationId, type: \"Annotation\" },\n \"body\",\n \"@manifest-editor/image-service-creator\",\n );\n\n // 1. Call the original creator to get the annotation\n const resource = await createImageService(data, {\n target: {\n id: canvasId,\n type: \"Canvas\",\n },\n });\n\n const { width, height } = resource.get();\n\n const annotation = ctx.embed({\n id: ctx.generateId(\"annotation\"),\n type: \"Annotation\",\n motivation: \"painting\",\n body: [resource],\n target: {\n type: \"SpecificResource\",\n source: { id: canvasId, type: \"Canvas\" },\n },\n });\n\n // 2. Pass that to an empty slide.\n const createSlide = creatorHelper(ctx, \"Manifest\", \"items\", \"@exhibitions/image-slide-creator\");\n return await createSlide({\n canvasId,\n width,\n height,\n type: \"default\", // default / left / right / bottom\n items: [annotation],\n });\n}\n","import { emptyAnnotationPage, emptyCanvas } from \"@iiif/parser\";\nimport type { InternationalString } from \"@iiif/presentation-3\";\nimport { EmptyCanvasIcon } from \"@manifest-editor/components\";\nimport { type CreatorFunctionContext, type CreatorResource, defineCreator } from \"@manifest-editor/creator-api\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/image-slide-creator\": typeof imageSlideCreator;\n \"@exhibitions/image-slide-creator-bottom\": typeof imageSlideBottomCreator;\n \"@exhibitions/image-slide-creator-left\": typeof imageSlideLeftCreator;\n \"@exhibitions/image-slide-creator-right\": typeof imageSlideRightCreator;\n }\n }\n}\n\nexport const imageSlideCreator = defineCreator({\n id: \"@exhibitions/image-slide-creator\",\n create: createImageSlide,\n label: \"Empty slide\",\n summary: \"An empty image slide.\",\n icon: <EmptyCanvasIcon />,\n tags: [\"exhibition-slide\"], // No tag, so it doesn't appear, it's just called.\n resourceType: \"Canvas\",\n resourceFields: [\"id\", \"type\", \"label\", \"height\", \"width\", \"items\"],\n supports: {\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n },\n});\n\nexport const imageSlideLeftCreator = defineCreator({\n ...imageSlideCreator,\n id: \"@exhibitions/image-slide-creator-left\",\n label: \"Image (Left)\",\n summary: \"An image with text on the left.\",\n icon: <div>IMAGE (LEFT)</div>,\n create: (payload, ctx) => createImageSlide({ ...payload, type: \"left\" }, ctx),\n});\n\nexport const imageSlideRightCreator = defineCreator({\n ...imageSlideCreator,\n id: \"@exhibitions/image-slide-creator-right\",\n label: \"Image (Right)\",\n summary: \"An image with text on the right.\",\n icon: <div>IMAGE (RIGHT)</div>,\n create: (payload, ctx) => createImageSlide({ ...payload, type: \"right\" }, ctx),\n});\n\nexport const imageSlideBottomCreator = defineCreator({\n ...imageSlideCreator,\n id: \"@exhibitions/image-slide-creator-bottom\",\n label: \"Image (Bottom)\",\n summary: \"An image with text at the bottom.\",\n icon: <div>IMAGE (BOTTOM)</div>,\n create: (payload, ctx) => createImageSlide({ ...payload, type: \"bottom\" }, ctx),\n});\n\ninterface InfoBoxPayload {\n canvasId?: string;\n label?: InternationalString;\n height?: number;\n width?: number;\n duration?: number;\n type: \"default\" | \"left\" | \"right\" | \"bottom\";\n items?: CreatorResource[];\n}\n\nfunction createImageSlide(payload: InfoBoxPayload, ctx: CreatorFunctionContext) {\n const canvasId = payload.canvasId || ctx.generateId(\"Canvas\");\n const itemsPageId = ctx.generateId(\"AnnotationPage\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const annotationsPageId = ctx.generateId(\"AnnotationPage\", {\n id: canvasId,\n type: \"Canvas\",\n });\n\n const behavior = [];\n let width = 6000;\n\n if (payload.width && payload.height) {\n // Let's figure out the right behaviours.\n if (payload.width > payload.height) {\n // The orientation is landscape.\n // Let's shrink the height.\n const gridSize = payload.width / 12;\n const heightColumns = Math.floor(payload.height / gridSize);\n const hClass = `h-${heightColumns}`;\n behavior.push(\"w-12\", hClass);\n } else {\n // The orientation is portrait.\n const gridSize = payload.height / 12;\n const widthColumns = Math.floor(payload.width / gridSize);\n const wClass = `w-${widthColumns}`;\n behavior.push(wClass, \"h-12\");\n }\n } else {\n behavior.push(\"w-12\", \"h-4\");\n }\n\n switch (payload.type) {\n case \"left\":\n behavior.push(\"left\");\n width *= 2 / 3;\n break;\n case \"right\":\n behavior.push(\"right\");\n width *= 2 / 3;\n break;\n case \"bottom\":\n behavior.push(\"bottom\");\n break;\n }\n\n if (!payload.items?.length) {\n behavior.push(\"multi-image\");\n }\n\n return ctx.embed({\n ...emptyCanvas,\n id: canvasId,\n behavior,\n label: payload.label || { en: [\"Untitled\"] },\n height: payload.height || 2000,\n duration: payload.duration,\n width: payload.width || width,\n items: [\n ctx.embed({\n ...emptyAnnotationPage,\n id: itemsPageId,\n type: \"AnnotationPage\",\n items: payload.items ? payload.items : [],\n }),\n ],\n annotations: [\n ctx.embed({\n ...emptyAnnotationPage,\n id: annotationsPageId,\n type: \"AnnotationPage\",\n items: [],\n }),\n ],\n });\n}\n","import {\n type CreatorFunctionContext,\n creatorHelper,\n type CreatorResource,\n defineCreator,\n} from \"@manifest-editor/creator-api\";\nimport { type CreateImageUrlPayload, imageUrlCreator } from \"@manifest-editor/creators\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/image-url-creator\": typeof imageUrlSlideCreator;\n }\n }\n}\n\nexport const imageUrlSlideCreator = defineCreator({\n ...imageUrlCreator,\n id: \"@exhibitions/image-url-creator\",\n create: createUrlSlide,\n tags: [\"exhibition-slide\"],\n label: \"Image\",\n summary: \"Image from URL\",\n resourceType: \"Canvas\",\n supports: {\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n },\n});\n\nasync function createUrlSlide(data: CreateImageUrlPayload, ctx: CreatorFunctionContext): Promise<CreatorResource> {\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const annotationId = ctx.generateId(\"annotation\");\n\n const createImageUrl = creatorHelper(\n ctx,\n { id: annotationId, type: \"Annotation\" },\n \"body\",\n \"@manifest-editor/image-url-creator\",\n );\n\n // 1. Call the original creator to get the annotation\n const resource = await createImageUrl(data, {\n target: {\n id: canvasId,\n type: \"Canvas\",\n },\n targetType: \"Annotation\",\n });\n\n const { width, height } = resource.get();\n\n const annotation = ctx.embed({\n id: annotationId,\n type: \"Annotation\",\n motivation: \"painting\",\n body: [resource],\n target: {\n type: \"SpecificResource\",\n source: { id: canvasId, type: \"Canvas\" },\n },\n });\n\n // 2. Pass that to an empty slide.\n const createSlide = creatorHelper(ctx, \"Manifest\", \"items\", \"@exhibitions/image-slide-creator\");\n return await createSlide({\n canvasId,\n width,\n height,\n type: \"default\", // default / left / right / bottom\n items: [annotation],\n });\n}\n","import { emptyAnnotation, emptyCanvas } from \"@iiif/parser\";\nimport type { InternationalString } from \"@iiif/presentation-3\";\nimport { type CreatorFunctionContext, defineCreator } from \"@manifest-editor/creator-api\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/info-box-creator\": typeof infoBoxCreator;\n }\n }\n}\n\nexport const infoBoxCreator = defineCreator({\n id: \"@exhibitions/info-box-creator\",\n create: createInfoBox,\n label: \"Info box\",\n summary: \"A text panel for an exhibition\",\n icon: (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\">\n <title>Info box</title>\n <path\n fill=\"currentColor\"\n d=\"M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22\"\n />\n </svg>\n ),\n tags: [\"exhibition-slide\"],\n resourceType: \"Canvas\",\n resourceFields: [\"id\", \"type\", \"label\", \"height\", \"width\", \"items\"],\n supports: {\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n },\n});\n\ninterface InfoBoxPayload {\n label?: InternationalString;\n height?: number;\n width?: number;\n}\n\nasync function createInfoBox(data: InfoBoxPayload, ctx: CreatorFunctionContext) {\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const annotationsId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const annotation = {\n ...emptyAnnotation,\n id: ctx.generateId(\"annotation\", { id: canvasId, type: \"Canvas\" }),\n type: \"Annotation\",\n };\n\n const bodies = [\n await ctx.create(\n \"@manifest-editor/html-body-creator\",\n {\n language: \"en\",\n body: \"\",\n },\n { parent: { resource: annotation, property: \"body\" } },\n ),\n ];\n\n const annotationResource = ctx.embed({\n ...annotation,\n motivation: \"painting\",\n body: bodies,\n target: {\n type: \"SpecificResource\",\n source: { id: canvasId, type: \"Canvas\" },\n },\n });\n\n const annotationLongId = ctx.generateId(\"annotation\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const longDescriptionResource = ctx.embed({\n id: annotationLongId,\n type: \"Annotation\",\n motivation: \"tagging\",\n body: [\n await ctx.create(\n \"@manifest-editor/html-body-creator\",\n {\n language: \"en\",\n body: \"\",\n },\n {\n parent: {\n resource: { id: annotationLongId, type: \"Annotation\" },\n property: \"body\",\n },\n },\n ),\n ],\n target: {\n type: \"SpecificResource\",\n source: { id: canvasId, type: \"Canvas\" },\n },\n });\n\n const page = ctx.embed({\n id: pageId,\n type: \"AnnotationPage\",\n items: [annotationResource],\n });\n\n const annotations = ctx.embed({\n id: annotationsId,\n type: \"AnnotationPage\",\n items: [longDescriptionResource],\n });\n\n return ctx.embed({\n ...emptyCanvas, // bug with placeholder canvas.\n id: canvasId,\n type: \"Canvas\",\n behavior: [\"w-4\", \"h-4\", \"info\"],\n label: data.label || undefined,\n height: data.height || 1000,\n width: data.width || 1000,\n items: [page],\n annotations: [annotations],\n });\n}\n","import { emptyCanvas } from \"@iiif/parser\";\nimport type { ContentResource } from \"@iiif/presentation-3\";\nimport { type CreatorFunctionContext, creatorHelper, defineCreator } from \"@manifest-editor/creator-api\";\nimport { type CreateVideoAnnotationPayload, videoAnnotation } from \"@manifest-editor/creators\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/video-creator\": typeof videoSlideCreator;\n }\n }\n}\n\nexport const videoSlideCreator = defineCreator({\n ...videoAnnotation,\n id: \"@exhibitions/video-creator\",\n create: createVideo,\n tags: [\"video\", \"exhibition-slide\"],\n label: \"Video\",\n summary: \"A video for an exhibition\",\n resourceType: \"Canvas\",\n resourceFields: [\"id\", \"type\", \"label\", \"height\", \"width\", \"items\"],\n supports: {\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n },\n});\n\nasync function createVideo(data: CreateVideoAnnotationPayload, ctx: CreatorFunctionContext): any {\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n\n const annotation = await ctx.create(\"@manifest-editor/video-annotation\", data, {\n target: {\n id: canvasId,\n type: \"Canvas\",\n },\n targetType: \"Annotation\",\n parent: {\n resource: { id: pageId, type: \"AnnotationPage\" },\n property: \"items\",\n },\n });\n\n const page = ctx.embed({\n id: pageId,\n type: \"AnnotationPage\",\n items: [annotation],\n });\n\n // Add thumbnail?\n\n const createSlide = creatorHelper(ctx, \"Manifest\", \"items\", \"@exhibitions/image-slide-creator\");\n\n // 2. Pass that to an empty slide.\n return await createSlide({\n canvasId,\n height: data.height || 1080,\n width: data.width || 1920,\n duration: data.duration,\n type: \"bottom\", // default / left / right / bottom\n items: [annotation as any],\n });\n}\n","import { emptyCanvas } from \"@iiif/parser\";\nimport type { InternationalString } from \"@iiif/presentation-3\";\nimport { type CreatorFunctionContext, defineCreator } from \"@manifest-editor/creator-api\";\nimport { youTubeBodyCreator } from \"@manifest-editor/creators\";\nimport { getYouTubeId } from \"@manifest-editor/editors\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/youtube-creator\": typeof youtubeSlideCreator;\n }\n }\n}\n\nexport const youtubeSlideCreator = defineCreator({\n ...youTubeBodyCreator,\n id: \"@exhibitions/youtube-creator\",\n create: createYoutube,\n tags: [\"video\", \"exhibition-slide\"],\n label: \"YouTube\",\n summary: \"A YouTube for an exhibition\",\n});\n\ninterface YouTubeCreatePayload {\n youtubeUrl: string;\n label?: InternationalString;\n height?: number;\n width?: number;\n duration: number;\n}\n\nasync function createYoutube(data: YouTubeCreatePayload, ctx: CreatorFunctionContext) {\n const ytId = getYouTubeId(data.youtubeUrl);\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n\n const annotation = await ctx.create(\"@manifest-editor/youtube\", data, {\n target: {\n id: canvasId,\n type: \"Canvas\",\n },\n targetType: \"Annotation\",\n parent: {\n resource: { id: pageId, type: \"AnnotationPage\" },\n property: \"items\",\n },\n });\n\n const page = ctx.embed({\n id: pageId,\n type: \"AnnotationPage\",\n items: [annotation],\n });\n\n const thumbnail = ctx.embed({\n id: `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`,\n type: \"Image\",\n format: \"image/jpeg\",\n width: 640,\n height: 360,\n });\n\n // Add thumbnail?\n\n return ctx.embed({\n ...emptyCanvas, // bug with placeholder canvas.\n id: canvasId,\n type: \"Canvas\",\n behavior: [\"w-12\", \"h-8\"],\n label: data.label || { en: [\"Untitled YouTube Video\"] },\n height: data.height || 1080,\n width: data.width || 1920,\n thumbnail: [thumbnail],\n items: [page],\n });\n}\n","import { useLayoutActions } from \"@manifest-editor/shell\";\nimport { Button } from \"react-aria-components\";\nimport { LocaleString, useManifest } from \"react-iiif-vault\";\n\nexport function ExhibitionContainer({ children }: { children: React.ReactNode }) {\n const manifest = useManifest();\n const { edit } = useLayoutActions();\n return (\n <div className=\"grid auto-rows-auto grid-cols-12 content-center justify-center gap-2 p-2\">\n <div className=\"col-span-12 row-span-2 text-black flex flex-col items-center justify-center\">\n <Button\n onPress={() => manifest && edit(manifest)}\n className=\"col-span-4 row-span-4 text-md text-left text-black hover:bg-slate-100 w-full flex items-center justify-center\"\n >\n <LocaleString className=\"block w-full text-left\">{manifest?.label}</LocaleString>\n </Button>\n </div>\n {children}\n </div>\n );\n}\n","import { LazyThumbnail } from \"@manifest-editor/components\";\nimport { useInStack } from \"@manifest-editor/editors\";\nimport { forwardRef } from \"react\";\nimport {\n LocaleString,\n useCanvas,\n useRenderingStrategy,\n} from \"react-iiif-vault\";\nimport { twMerge } from \"tailwind-merge\";\nimport { getClassName, getGridStats } from \"../helpers\";\n\nexport interface ExhibitionItemProps\n extends React.HTMLAttributes<HTMLDivElement> {\n isFirst: boolean;\n onClick: () => void;\n item: { id: string };\n}\n\nexport const ExhibitionItem = forwardRef<HTMLDivElement, ExhibitionItemProps>(\n function ExhibitionItem(\n { isFirst, item, children: divChildren, ...props },\n ref,\n ) {\n const canvas = useCanvas();\n const [strategy] = useRenderingStrategy();\n const behavior = canvas?.behavior || [];\n const currentCanvas = useInStack(\"Canvas\");\n const className = getClassName(canvas?.behavior, isFirst);\n const { isBottom, isImage, isInfo, isLeft } = getGridStats(\n canvas?.behavior,\n );\n\n const isSelected = currentCanvas?.resource.source?.id === canvas?.id;\n\n let children = null;\n if (isInfo) {\n children = (\n <div className=\"bg-black w-full h-full text-white max-h-40\">\n <div className=\"p-1.5 text-[4px]\">\n {strategy.type === \"textual-content\" ? (\n <LocaleString enableDangerouslySetInnerHTML>\n {strategy.items[0]?.text}\n </LocaleString>\n ) : null}\n </div>\n </div>\n );\n } else {\n children = (\n <div\n className={twMerge(\n \"flex h-full max-h-full min-h-0\",\n isLeft ? \"flex-row-reverse\" : isBottom ? \"flex-col\" : \"flex-row\",\n )}\n >\n <div className=\"flex-1 overflow-hidden relative justify-self-stretch\">\n <div className=\"absolute inset-0 w-full h-full\">\n <LazyThumbnail cover fade={false} />\n </div>\n </div>\n {isImage ? null : (\n <div\n className={`${isBottom ? \"min-h-3 w-full\" : \"w-1/3\"} flex-shrink-0 self-stretch p-2 text-white bg-black rounded`}\n >\n <div className=\"p-1.5 text-[4px]\">\n <LocaleString className=\"block mb-1 text-[5px]\">\n {canvas?.label}\n </LocaleString>\n <LocaleString>{canvas?.summary}</LocaleString>\n </div>\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n className={twMerge(\n className,\n \"bg-me-gray-700 overflow-hidden hover:ring-2 ring-me-primary-500 relative\",\n isSelected ? \"ring-2 ring-me-primary-500\" : \"\",\n )}\n {...props}\n >\n {children}\n {divChildren}\n </div>\n );\n },\n);\n","import {\n useCreator,\n useLayoutActions,\n useManifestEditor,\n} from \"@manifest-editor/shell\";\nimport { CanvasContext } from \"react-iiif-vault\";\nimport { ExhibitionContainer } from \"./ExhibitionContainer\";\nimport { ExhibitionItem } from \"./ExhibitionItem\";\n\nexport function ExhibitionGrid() {\n const { open } = useLayoutActions();\n const { structural, technical } = useManifestEditor();\n const [, canvasActions] = useCreator(\n { id: technical.id.get(), type: \"Manifest\" },\n \"items\",\n \"Manifest\",\n );\n const items = structural.items.get();\n\n return (\n <ExhibitionContainer>\n {items.map((item, index) => (\n <CanvasContext key={index} canvas={item.id}>\n <ExhibitionItem\n isFirst={index === 0}\n item={item}\n onClick={() => {\n open({ id: \"current-canvas\" });\n canvasActions.edit(item, index);\n }}\n />\n </CanvasContext>\n ))}\n </ExhibitionContainer>\n );\n}\n","import type { SVGProps } from \"react\";\n\nexport function ResizeHandleIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" height=\"1em\" width=\"1em\" {...props}>\n <title>Rearrange</title>\n <path fill=\"none\" d=\"M0 0h24v24H0z\" />\n <path d=\"M20 9H4v2h16V9zM4 15h16v-2H4v2z\" fill=\"currentColor\" />\n </svg>\n );\n}\n","import { useSortable } from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { MoreMenu } from \"@manifest-editor/components\";\nimport { AppDropdown, type AppDropdownItem } from \"@manifest-editor/editors\";\nimport { Button } from \"react-aria-components\";\nimport { ResizeHandleIcon } from \"../icons/ResizeHandleIcon\";\nimport { ExhibitionItem } from \"./ExhibitionItem\";\n\nexport function SortableExhibitionItem({\n isFirst,\n onClick,\n item,\n actions,\n}: {\n isFirst: boolean;\n onClick: () => void;\n item: { id: string };\n actions?: AppDropdownItem[];\n}) {\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({\n id: item.id,\n transition: {\n duration: 150,\n easing: \"cubic-bezier(0.25, 1, 0.5, 1)\",\n },\n });\n\n const style = {\n transform: CSS.Translate.toString(transform),\n transition,\n };\n\n return (\n <ExhibitionItem\n ref={setNodeRef}\n style={style}\n {...attributes}\n {...listeners}\n onClick={onClick}\n isFirst={isFirst}\n item={item}\n >\n <div className=\"absolute top-0.5 right-0.5 flex gap-0.5 items-stretch\">\n {actions?.length ? (\n <AppDropdown\n as={Button}\n className=\"bg-white p-1 text-2xl hover:text-me-500 aria-expanded:text-me-600 aria-expanded:bg-me-200 hover:bg-me-100 rounded-sm\"\n aria-label=\"Action menu\"\n items={actions}\n >\n <MoreMenu />\n </AppDropdown>\n ) : null}\n <div className=\"bg-white text-2xl h-8 flex items-center p-1 hover:text-me-500 hover:bg-me-100 rounded-sm\">\n <ResizeHandleIcon aria-label=\"Reorder item\" />\n </div>\n </div>\n </ExhibitionItem>\n );\n}\n","import {\n closestCenter,\n DndContext,\n type DragEndEvent,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport { restrictToParentElement } from \"@dnd-kit/modifiers\";\nimport { rectSortingStrategy, SortableContext, sortableKeyboardCoordinates } from \"@dnd-kit/sortable\";\nimport { createAppActions, useInStack } from \"@manifest-editor/editors\";\nimport { useEditCanvasItems } from \"@manifest-editor/manifest-preset/components\";\nimport { useCreator, useEditingStack, useLayoutActions, useManifestEditor } from \"@manifest-editor/shell\";\nimport { useCallback, useMemo } from \"react\";\nimport { CanvasContext, useManifest } from \"react-iiif-vault\";\nimport { ExhibitionContainer } from \"./ExhibitionContainer\";\nimport { SortableExhibitionItem } from \"./SortableExhibitionItem\";\n\nexport function SortableExhibitionGrid() {\n const manifest = useManifest();\n const { structural, technical } = useManifestEditor();\n const editingStack = useEditingStack();\n const editingCanvas = useInStack(\"Canvas\");\n\n const items = structural.items.get();\n const { open } = useLayoutActions();\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 5,\n },\n }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n const [, canvasActions] = useCreator({ id: technical.id.get(), type: \"Manifest\" }, \"items\", \"Manifest\");\n\n const onDragEnd = useCallback(\n (result: DragEndEvent) => {\n const { active, over } = result;\n if (over && active.id !== over.id) {\n structural.items.reorder(\n items.findIndex((item) => item.id === active.id),\n items.findIndex((item) => item.id === over.id),\n );\n }\n },\n [items, structural.items],\n );\n\n const canvasId = editingCanvas?.resource.source.id;\n const canvasIndex = canvasId ? items.findIndex((canv) => canv.id === canvasId) : -1;\n const prevCanvasIndex: number = canvasIndex && canvasIndex > 0 ? Number(canvasIndex - 1) : 0;\n\n function onDeleteCanvas() {\n editingStack.close(); // close the deleted canvas\n const newCanvases = structural.items.get(); // refresh canvases\n\n if (newCanvases && newCanvases.length > 0) {\n canvasActions.edit(newCanvases[prevCanvasIndex]);\n } else {\n canvasActions.edit(manifest);\n }\n }\n\n const createActions = useMemo(\n () => createAppActions(structural.items, onDeleteCanvas),\n [structural.items, onDeleteCanvas],\n );\n\n return (\n <ExhibitionContainer>\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragEnd={onDragEnd}\n modifiers={[restrictToParentElement]}\n >\n <SortableContext items={items} strategy={rectSortingStrategy}>\n {items.map((item, idx) => {\n if (!item) return null;\n return (\n <CanvasContext key={item.id} canvas={item.id}>\n <SortableExhibitionItem\n key={item.id}\n item={item}\n isFirst={idx === 0}\n onClick={() => {\n open({ id: \"current-canvas\" });\n canvasActions.edit(item, idx);\n }}\n actions={createActions(item, idx, manifest!)}\n />\n </CanvasContext>\n );\n })}\n </SortableContext>\n </DndContext>\n </ExhibitionContainer>\n );\n}\n","import { Sidebar, SidebarContent, SidebarHeader } from \"@manifest-editor/components\";\nimport { useToggleList } from \"@manifest-editor/editors\";\nimport { CanvasListView, CanvasListingIcon } from \"@manifest-editor/manifest-preset/components\";\nimport { type LayoutPanel, useCreator, useManifestEditor } from \"@manifest-editor/shell\";\nimport { ExhibitionGrid } from \"../components/ExhibitionGrid\";\nimport { SortableExhibitionGrid } from \"../components/SortableExhibitionGrid\";\n\nexport const exhibitionGridLeftPanel: LayoutPanel = {\n id: \"canvas-listing\", // We are overriding the default canvas listing panel\n label: \"Exhibition grid\",\n icon: <ExhibitionGridIcon />,\n render: () => <ExhibitionGridLeftPanel />,\n options: {\n minWidth: 350,\n maxWidth: 350,\n },\n};\n\nfunction ExhibitionGridLeftPanel() {\n const { technical } = useManifestEditor();\n const manifestId = technical.id.get();\n const manifest = { id: manifestId, type: \"Manifest\" };\n const [canCreateCanvas, canvasActions] = useCreator(manifest, \"items\", \"Canvas\");\n const [toggled, toggle] = useToggleList();\n\n return (\n <Sidebar>\n <SidebarHeader\n title={\"Exhibition\"}\n actions={[\n {\n icon: toggled.list ? <CanvasListingIcon className=\"text-2xl\" /> : <ExhibitionGridIcon />,\n title: toggled.list ? \"List view\" : \"Grid view\",\n onClick: () => toggle(\"list\"),\n },\n {\n icon: <ListEditIcon />,\n title: \"Edit slides\",\n toggled: toggled.editing,\n onClick: () => toggle(\"editing\"),\n },\n {\n icon: <NewSlideIcon />,\n title: \"Add new slide\",\n disabled: !canCreateCanvas,\n onClick: () => canvasActions.createFiltered(\"exhibition-slide\"),\n },\n ]}\n />\n <SidebarContent>\n {toggled.list ? (\n <CanvasListView isEditing={toggled.editing} />\n ) : toggled.editing ? (\n <SortableExhibitionGrid />\n ) : (\n <ExhibitionGrid />\n )}\n </SidebarContent>\n </Sidebar>\n );\n}\n\nfunction ExhibitionGridIcon() {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"currentColor\" viewBox=\"0 -960 960 960\">\n <title>Exhibition grid</title>\n <path d=\"M600-160v-280h280v280H600ZM440-520v-280h440v280H440ZM80-160v-280h440v280H80Zm0-360v-280h280v280H80Zm440-80h280v-120H520v120ZM160-240h280v-120H160v120Zm520 0h120v-120H680v120ZM160-600h120v-120H160v120Zm360 0Zm-80 240Zm240 0ZM280-600Z\" />\n </svg>\n );\n}\nfunction ListEditIcon() {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\">\n <title>Edit slides</title>\n <path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n <path d=\"M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z\" />\n </svg>\n );\n}\nfunction NewSlideIcon() {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"currentColor\" viewBox=\"0 -960 960 960\">\n <title>Add new slide</title>\n <path d=\"M160-240v-480 480Zm80-80v-200h360v200H240Zm-80 160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v240h-80v-240H160v480h360v80H160Zm500-320v-100H360v-60h360v160h-60Zm60 400v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z\" />\n </svg>\n );\n}\n","import { getValue } from \"@iiif/helpers\";\nimport { ActionButton } from \"@manifest-editor/components\";\nimport { useEditor } from \"@manifest-editor/shell\";\n\nexport function ExhibitionItemConversion() {\n const editor = useEditor();\n\n const applyDefaultSettings = () => {\n const canvasWidth = editor.technical.width.get();\n const canvasHeight = editor.technical.height.get();\n const summary = editor.descriptive.summary;\n const behaviors = editor.technical.behavior;\n\n const behaviorsToAdd = behaviors.get();\n behaviorsToAdd.push(\"w-12\");\n\n const height = Math.max(1, Math.min(12, Math.round((canvasWidth / canvasHeight) * 12)));\n behaviorsToAdd.push(`h-${height}`);\n // Implementation of applying default settings\n // 1. Add behavior of \"w-12\"\n // 2. Add behavior of \"h-1\" to \"h-12\" based on canvas height\n // 3. Add an empty summary\n if (!getValue(summary.get())) {\n summary.set({ en: [\"Summary of image\"] });\n }\n\n editor.technical.behavior.set(behaviorsToAdd);\n };\n\n return (\n <div className=\"flex flex-col items-center gap-4 border-me-100 border-2 p-4 rounded\">\n This canvas was not created in the exhibition editor. Do you want to apply default settings?\n <ActionButton onPress={() => applyDefaultSettings()}>Apply defaults</ActionButton>\n </div>\n );\n}\n","import { Sidebar, SidebarContent } from \"@manifest-editor/components\";\nimport {\n DimensionsTriplet,\n InputContainer,\n LanguageMapEditor,\n LinkingPropertyList,\n PaintingAnnotationList,\n createAppActions,\n} from \"@manifest-editor/editors\";\nimport { type EditorDefinition, ResourceEditingProvider, useEditingResource, useEditor } from \"@manifest-editor/shell\";\nimport { AnnotationPageContext, useCanvas } from \"react-iiif-vault\";\nimport { AspectRatioWarning } from \"../components/AspectRatioWarning\";\nimport { getGridStats, isExhibitionItem } from \"../helpers\";\nimport { ExhibitionItemConversion } from \"../components/ExhibitionItemConversion\";\n\nexport const exhibitionCanvasEditor: EditorDefinition = {\n id: \"@exhibition/right-panel-editor\",\n supports: {\n edit: true,\n properties: [\"label\", \"summary\"],\n resourceTypes: [\"Canvas\"],\n custom: ({ resource }, vault) => {\n const full = vault.get(resource);\n const stats = getGridStats(full.behavior);\n\n if (full.type === \"Canvas\" && !stats.isInfo) {\n return true;\n }\n return false;\n },\n },\n label: \"Exhibition\",\n component: () => <ExhibitionRightPanel />,\n};\n\nfunction ExhibitionRightPanel() {\n const canvas = useCanvas();\n const resource = useEditingResource();\n const { structural, descriptive } = useEditor();\n const { items } = structural;\n const { thumbnail } = descriptive;\n const pages = items.get();\n const page = pages[0];\n\n const isAnExhibitionCanvas = isExhibitionItem(canvas);\n\n if (!canvas || !page || !resource) return <div className=\"p-8\">Canvas, page, or resource not found</div>;\n\n return (\n <Sidebar>\n <SidebarContent padding>\n <ResourceEditingProvider resource={canvas}>\n {!isAnExhibitionCanvas ? <ExhibitionItemConversion /> : null}\n\n <LanguageMapEditor dispatchType=\"label\" disableMultiline disallowHTML />\n\n <LinkingPropertyList\n containerId={thumbnail.containerId()}\n label=\"Thumbnail\"\n property=\"thumbnail\"\n items={thumbnail.get()}\n singleMode\n reorder={(ctx) => thumbnail.reorder(ctx.startIndex, ctx.endIndex)}\n createActions={createAppActions(thumbnail)}\n creationType=\"ContentResource\"\n emptyLabel=\"No thumbnail\"\n parent={resource?.resource}\n />\n\n <AnnotationPageContext annotationPage={page.id}>\n <PaintingAnnotationList createFilter=\"image\" />\n </AnnotationPageContext>\n </ResourceEditingProvider>\n </SidebarContent>\n </Sidebar>\n );\n}\n","import { Sidebar, SidebarContent } from \"@manifest-editor/components\";\nimport { LanguageMapEditor } from \"@manifest-editor/editors\";\nimport { type EditorDefinition, ResourceEditingProvider } from \"@manifest-editor/shell\";\nimport { useCanvas } from \"react-iiif-vault\";\nimport { getGridStats } from \"../helpers\";\n\nexport const exhibitionSummaryEdtior: EditorDefinition = {\n id: \"@exhibition/summary-editor\",\n supports: {\n edit: true,\n properties: [\"summary\"],\n resourceTypes: [\"Canvas\"],\n custom: ({ resource }, vault) => {\n const full = vault.get(resource);\n const stats = getGridStats(full.behavior);\n\n if (full.type === \"Canvas\" && !stats.isInfo) {\n return true;\n }\n return false;\n },\n },\n label: \"Summary\",\n component: () => <ExhibitionRightPanel />,\n};\n\nfunction ExhibitionRightPanel() {\n const canvas = useCanvas();\n if (!canvas) return null;\n\n return (\n <Sidebar>\n <SidebarContent padding>\n <ResourceEditingProvider resource={canvas}>\n <LanguageMapEditor dispatchType=\"label\" />\n <LanguageMapEditor dispatchType=\"summary\" />\n </ResourceEditingProvider>\n </SidebarContent>\n </Sidebar>\n );\n}\n","export function CheckIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n {/* Icon from Google Material Icons by Material Design Authors - https://github.com/material-icons/material-icons/blob/master/LICENSE */}\n <path fill=\"currentColor\" d=\"M9 16.17L4.83 12l-1.42 1.41L9 19L21 7l-1.41-1.41z\" />\n </svg>\n );\n}\n","import { ActionButton, HTMLEditor } from \"@manifest-editor/components\";\nimport {\n useCurrentAnnotationActions,\n useCurrentAnnotationMetadata,\n} from \"react-iiif-vault\";\nimport { CheckIcon } from \"../icons/CheckIcon\";\nimport { useConfig } from \"@manifest-editor/shell\";\nimport { AnnotationPopUpSwitcherButton } from \"@manifest-editor/editors\";\n\nexport const DEFAULT_TOUR_STEP_HTML = \"<h2>New step</h2><p>Description</p>\";\n\nexport function ExhibitionTourStepPopup() {\n const { saveAnnotation } = useCurrentAnnotationActions();\n const [metadata, setMetadata] = useCurrentAnnotationMetadata();\n const { editorFeatureFlags } = useConfig();\n const { annotationPopups } = editorFeatureFlags;\n\n if (!annotationPopups) {\n return (\n <div className=\"flex gap-2\">\n <ActionButton primary onPress={() => saveAnnotation()}>\n <CheckIcon /> Finish editing\n </ActionButton>\n <AnnotationPopUpSwitcherButton />\n </div>\n );\n }\n\n return (\n <div className=\"bg-white shadow-md rounded-lg\">\n <div className=\"prose-headings:mt-1 overflow-y-auto rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500\">\n <HTMLEditor\n className=\"border-none\"\n value={metadata.bodyValue || DEFAULT_TOUR_STEP_HTML}\n onChange={(newValue) => setMetadata({ bodyValue: newValue })}\n />\n </div>\n\n <div className=\"flex gap-2 p-3\">\n <ActionButton primary onPress={() => saveAnnotation()}>\n <CheckIcon /> Finish editing\n </ActionButton>\n <AnnotationPopUpSwitcherButton />\n </div>\n </div>\n );\n}\n","import {\n ActionButton,\n HTMLEditor,\n DeleteIcon,\n TargetIcon,\n} from \"@manifest-editor/components\";\nimport { useAtlasStore, useConfig } from \"@manifest-editor/shell\";\nimport {\n useCurrentAnnotationActions,\n useCurrentAnnotationMetadata,\n} from \"react-iiif-vault\";\nimport { useStore } from \"zustand\";\nimport { CheckIcon } from \"../icons/CheckIcon\";\nimport { DEFAULT_TOUR_STEP_HTML } from \"./ExhibitionTourStepPopup\";\nimport { AnnotationPopUpSwitcherButton } from \"@manifest-editor/editors\";\n\nexport function PendingTourStepAnnotation() {\n const store = useAtlasStore();\n const polygon = useStore(store, (s) => s.polygon);\n const [metadata, setMetadata] = useCurrentAnnotationMetadata();\n const { editorFeatureFlags } = useConfig();\n const { annotationPopups } = editorFeatureFlags;\n const { cancelRequest, saveAnnotation } = useCurrentAnnotationActions();\n\n return (\n <div className=\"border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative\">\n <div className=\"bg-me-primary-500 text-white p-2 m-1 rounded flex gap-2\">\n <TargetIcon />\n Draw a box on the canvas\n </div>\n {annotationPopups ? (\n <div className=\"relative p-3 line-clamp-3 prose-p:text-slate-600\">\n <div className=\"prose-headings:mt-1 prose-headings:mb-1 prose-sm\">\n <div\n dangerouslySetInnerHTML={{\n __html: metadata.bodyValue || DEFAULT_TOUR_STEP_HTML,\n }}\n />\n </div>\n </div>\n ) : (\n <HTMLEditor\n className=\"border-none\"\n value={metadata.bodyValue || DEFAULT_TOUR_STEP_HTML}\n onChange={(newValue) => setMetadata({ bodyValue: newValue })}\n />\n )}\n <div className=\"flex gap-2 p-3\">\n <ActionButton\n isDisabled={polygon?.points.length === 0}\n onPress={() => saveAnnotation()}\n >\n <CheckIcon /> Finish editing\n </ActionButton>\n\n <ActionButton className=\"gap-2 flex\" onPress={() => cancelRequest()}>\n <DeleteIcon /> Delete\n </ActionButton>\n\n <AnnotationPopUpSwitcherButton />\n </div>\n </div>\n );\n}\n","import { ActionButton, AnnotationPopInIcon, AnnotationPopOutIcon } from \"@manifest-editor/components\";\nimport { useConfig, useSaveConfig } from \"@manifest-editor/shell\";\n\nexport function ActionButtonPopupSwitcher() {\n const { editorFeatureFlags } = useConfig();\n const { annotationPopups } = editorFeatureFlags;\n const saveConfig = useSaveConfig();\n\n return (\n <ActionButton\n className=\"ml-auto\"\n onPress={() => saveConfig({ editorFeatureFlags: { ...editorFeatureFlags, annotationPopups: annotationPopups ? false : true } })}\n >\n {annotationPopups ? <AnnotationPopInIcon /> : <AnnotationPopOutIcon />}\n </ActionButton>\n );\n}\n","import {\n ActionButton,\n DeleteIcon,\n EditTextIcon,\n HTMLAnnotationBodyRender,\n} from \"@manifest-editor/components\";\nimport {\n AnnotationPopUpSwitcherButton,\n HTMLAnnotationEditor,\n useAnnotationEditor,\n} from \"@manifest-editor/editors\";\nimport { useContext, useEffect, useState } from \"react\";\nimport { CheckIcon } from \"../icons/CheckIcon\";\nimport { ResourceEditingReactContext, useConfig } from \"@manifest-editor/shell\";\nimport {\n AnnotationContext,\n useAnnotation,\n useCurrentAnnotationActions,\n} from \"react-iiif-vault\";\nimport { ActionButtonPopupSwitcher } from \"./ActionButtonPopupSwitcher\";\n\nexport function TourNormalAnnotationEditor({\n highlightProps,\n}: {\n highlightProps: any;\n}) {\n const value = useContext(ResourceEditingReactContext);\n const annotation = useAnnotation();\n const { editorFeatureFlags } = useConfig();\n const { annotationPopups } = editorFeatureFlags;\n\n const {\n isPending,\n cancelRequest,\n busy,\n requestAnnotationFromTarget,\n deleteAnnotation,\n } = useAnnotationEditor({\n annotationPopup: (\n <AnnotationContext annotation={annotation!.id}>\n <ResourceEditingReactContext.Provider value={value}>\n <TourAnnotationPopupEditor />\n </ResourceEditingReactContext.Provider>\n </AnnotationContext>\n ),\n });\n\n const [isOpen, setIsOpen] = useState(false);\n\n useEffect(() => {\n if (isOpen && !isPending) {\n setIsOpen(true);\n }\n }, [isPending, isOpen]);\n\n // This is an annotatino within a page.\n return (\n <div\n {...highlightProps}\n className=\"border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative\"\n >\n <div className=\"relative\">\n {isOpen && !annotationPopups ? (\n <HTMLAnnotationEditor className=\"border-none\" />\n ) : (\n <HTMLAnnotationBodyRender\n className=\"px-3 pt-3 line-clamp-3 prose-p:text-slate-600\"\n locale=\"en\"\n />\n )}\n </div>\n <div className=\"flex gap-2 p-2\">\n {isOpen && isPending ? (\n <>\n <ActionButton\n primary\n onPress={() => {\n setIsOpen(false);\n cancelRequest();\n }}\n >\n <CheckIcon /> Finish editing\n </ActionButton>\n <AnnotationPopUpSwitcherButton />\n </>\n ) : (\n <ActionButton\n isDisabled={busy}\n onPress={() => {\n setIsOpen(true);\n requestAnnotationFromTarget().then(() => {\n setIsOpen(false);\n });\n }}\n >\n <EditTextIcon /> Edit\n </ActionButton>\n )}\n <ActionButton className=\"gap-2 flex\" onPress={() => deleteAnnotation()}>\n <DeleteIcon /> Delete\n </ActionButton>\n </div>\n <div className=\"absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0\" />\n </div>\n );\n}\n\nfunction TourAnnotationPopupEditor() {\n const { editorFeatureFlags } = useConfig();\n const { annotationPopups } = editorFeatureFlags;\n const { saveAnnotation } = useCurrentAnnotationActions();\n\n if (!annotationPopups) {\n return (\n <div className=\"flex gap-2\">\n <ActionButton primary onPress={() => saveAnnotation()}>\n <CheckIcon /> Finish editing\n </ActionButton>\n <AnnotationPopUpSwitcherButton />\n </div>\n );\n }\n\n return (\n <div className=\"bg-white shadow-md rounded-lg relative max-h-[50vh] overflow-y-auto\">\n <div className=\"prose-headings:mt-1 rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500\">\n <HTMLAnnotationEditor className=\"border-none\" />\n </div>\n\n <div className=\"flex gap-2 p-2 sticky bottom-0 z-50 bg-white\">\n <ActionButton\n primary\n onPress={() => {\n saveAnnotation();\n }}\n >\n <CheckIcon /> Finish editing\n </ActionButton>\n <ActionButtonPopupSwitcher />\n </div>\n </div>\n );\n}\n","import { ActionButton, DeleteIcon, EditTextIcon } from \"@manifest-editor/components\";\nimport { LanguageMapEditor } from \"@manifest-editor/editors\";\nimport { useGenericEditor, useLayoutActions } from \"@manifest-editor/shell\";\nimport { useState } from \"react\";\nimport { LocaleString, useAnnotation, useAnnotationPage } from \"react-iiif-vault\";\nimport { CheckIcon } from \"../icons/CheckIcon\";\n\nexport function TourPaintingAnnotationEditor({\n originalAnnotationId,\n highlightProps,\n}: {\n originalAnnotationId?: string;\n highlightProps: any;\n}) {\n const page = useAnnotationPage();\n const pageEditor = useGenericEditor(page);\n const annotation = useAnnotation();\n const { edit } = useLayoutActions();\n const [isOpen, setIsOpen] = useState(false);\n\n const deleteAnnotation = () => {\n if (originalAnnotationId && confirm(\"Are you sure you want to delete this annotation?\")) {\n // Delete the original annotation.\n const index = pageEditor.structural.items\n .getWithoutTracking()\n .findIndex((item) => item.id === originalAnnotationId);\n pageEditor.structural.items.deleteAtIndex(index);\n }\n };\n\n return (\n <div {...highlightProps} className=\"border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative\">\n <div className=\"flex gap-2 mb-2 p-3\">\n <div className=\"flex-1 min-w-0\">\n {isOpen ? (\n <>\n <h3 className=\"text-lg font-semibold border-b pt-1 pb-2 mb-2\">Edit step</h3>\n <LanguageMapEditor dispatchType=\"label\" />\n <LanguageMapEditor dispatchType=\"summary\" />\n </>\n ) : (\n <>\n <LocaleString\n as=\"div\"\n defaultText={(<span className=\"opacity-50\">Untitled</span>) as any}\n className=\"whitespace-nowrap overflow-ellipsis w-full overflow-x-hidden\"\n >\n {annotation?.label}\n </LocaleString>\n <LocaleString className=\"text-gray-500 text-sm bg-white line-clamp-2\" as=\"div\">\n {annotation?.summary}\n </LocaleString>\n </>\n )}\n </div>\n </div>\n\n <div className=\"flex gap-2 p-2\">\n {isOpen ? (\n <ActionButton onPress={() => setIsOpen(false)}>\n <CheckIcon /> Finish editing\n </ActionButton>\n ) : (\n <ActionButton onPress={() => setIsOpen(true)}>\n <EditTextIcon /> Edit body\n </ActionButton>\n )}\n\n <ActionButton onPress={() => edit(annotation!)}>Edit annotation</ActionButton>\n\n <ActionButton className=\"gap-2 flex\" onPress={() => deleteAnnotation()}>\n <DeleteIcon /> Delete\n </ActionButton>\n </div>\n <div className=\"absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0\" />\n </div>\n );\n}\n","import { useAnnotationInfo } from \"@manifest-editor/editors\";\nimport { ResourceEditingProvider } from \"@manifest-editor/shell\";\nimport { useMemo } from \"react\";\nimport { AnnotationContext } from \"react-iiif-vault\";\nimport { TourNormalAnnotationEditor } from \"./TourNormalAnnotationEditor\";\nimport { TourPaintingAnnotationEditor } from \"./TourPaintingAnnotationEditor\";\n\nexport function TourAnnotationEditor() {\n const [annotation, { annotationTarget, highlightProps }] =\n useAnnotationInfo();\n\n const resource = useMemo(() => {\n if (annotationTarget) {\n return { id: annotationTarget, type: \"Annotation\" };\n }\n return { id: annotation?.id as string, type: \"Annotation\" };\n }, [annotation?.id, annotationTarget]);\n\n if (annotationTarget) {\n return (\n <ResourceEditingProvider resource={resource}>\n <AnnotationContext annotation={annotationTarget}>\n <TourPaintingAnnotationEditor\n originalAnnotationId={annotation?.id}\n highlightProps={highlightProps}\n />\n </AnnotationContext>\n </ResourceEditingProvider>\n );\n }\n\n return (\n <ResourceEditingProvider resource={resource}>\n <TourNormalAnnotationEditor highlightProps={highlightProps} />\n </ResourceEditingProvider>\n );\n}\n","import { ReorderList } from \"@manifest-editor/editors\";\nimport { useGenericEditor } from \"@manifest-editor/shell\";\nimport { AnnotationContext, useAnnotationPage } from \"react-iiif-vault\";\nimport { TourAnnotationEditor } from \"./TourAnnotationEditor\";\n\nexport function TourAnnotationPageEditor({\n reorderable = false,\n}: { reorderable?: boolean }) {\n const page = useAnnotationPage();\n const editor = useGenericEditor(page);\n\n if (!page) {\n return null;\n }\n\n if (!reorderable) {\n return (\n <>\n {page.items.map((annotation) => (\n <AnnotationContext annotation={annotation.id} key={annotation.id}>\n <TourAnnotationEditor />\n </AnnotationContext>\n ))}\n </>\n );\n }\n\n return (\n <>\n <ReorderList\n id={page.id}\n marginBottom=\"0.5em\"\n items={page.items || []}\n inlineHandle={false}\n reorder={({ startIndex, endIndex }) =>\n editor.structural.items.reorder(startIndex, endIndex)\n }\n renderItem={(ref, index) => (\n <AnnotationContext annotation={ref.id as string}>\n <TourAnnotationEditor />\n </AnnotationContext>\n )}\n />\n </>\n );\n}\n","import type { InternationalString } from \"@iiif/presentation-3\";\nimport { ActionButton, Sidebar, SidebarContent } from \"@manifest-editor/components\";\nimport { PromptToAddPaintingAnnotations } from \"@manifest-editor/editors\";\nimport {\n type EditorDefinition,\n ResourceEditingProvider,\n useConfig,\n useCreator,\n useGenericEditor,\n useInlineCreator,\n} from \"@manifest-editor/shell\";\nimport { useState } from \"react\";\nimport { Button } from \"react-aria-components\";\nimport { AnnotationPageContext, useCanvas, useRequestAnnotation } from \"react-iiif-vault\";\nimport { ExhibitionTourStepPopup } from \"../components/ExhibitionTourStepPopup\";\nimport { PendingTourStepAnnotation } from \"../components/PendingTourStepAnnotation\";\nimport { TourAnnotationPageEditor } from \"../components/TourAnnotationPageEditor\";\nimport { getGridStats } from \"../helpers\";\n\nexport const exhibitionTourSteps: EditorDefinition = {\n id: \"@exhibition/tour-steps\",\n supports: {\n edit: true,\n properties: [\"annotations\"],\n resourceTypes: [\"Canvas\"],\n custom: ({ resource }, vault) => {\n const full = vault.get(resource);\n const stats = getGridStats(full.behavior);\n\n if (full.type === \"Canvas\" && !stats.isInfo) {\n return true;\n }\n return false;\n },\n },\n label: \"Tour steps\",\n component: () => <ExhibitionRightPanelOptionalPage />,\n};\n\nfunction ExhibitionRightPanelOptionalPage() {\n const canvas = useCanvas();\n const firstAnnotationPage = canvas?.annotations[0];\n const itemsAnnotationPage = canvas?.items[0];\n\n // @todo create annotation page?\n if (!firstAnnotationPage || !canvas || !itemsAnnotationPage) {\n return <PromptCreationOfTourSteps />;\n }\n\n return <ExhibitionRightPanel />;\n}\n\nfunction PromptCreationOfTourSteps() {\n const canvas = useCanvas();\n const creator = useInlineCreator();\n\n const createEmptyAnnotationPage = () => {\n if (!canvas) return;\n creator.create(\n \"@manifest-editor/empty-annotation-page\",\n {\n label: { en: [\"Tour steps\"] },\n },\n {\n target: {\n id: canvas.id,\n type: \"Canvas\",\n },\n targetType: \"AnnotationPage\",\n parent: {\n property: \"annotations\",\n resource: {\n id: canvas.id,\n type: \"Canvas\",\n },\n },\n },\n );\n };\n\n return (\n <div className=\"flex flex-col items-center justify-center p-4\">\n <div className=\"p-4 opacity-50 text-center\">This image does not yet have a tour.</div>\n\n <Button\n className=\"border w-full disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500\"\n onPress={() => createEmptyAnnotationPage()}\n >\n Create Tour\n </Button>\n </div>\n );\n}\n\nfunction ExhibitionRightPanel() {\n const canvas = useCanvas();\n const firstAnnotationPage = canvas?.annotations[0];\n const itemsAnnotationPage = canvas?.items[0];\n const editor = useGenericEditor(firstAnnotationPage);\n const creator = useInlineCreator();\n const [reorderable, setReorderable] = useState(false);\n\n const { requestAnnotation, isPending, busy, cancelRequest, completeRequest } = useRequestAnnotation({\n onSuccess: (resp) => {\n const bodyValue = resp.metadata.bodyValue || \"\";\n\n if (!resp.cancelled && resp.target && firstAnnotationPage) {\n creator.create(\n \"@manifest-editor/html-annotation\",\n {\n label: { en: [\"Tour step\"] },\n body: {\n en: [bodyValue || \"<h2>New step</h2><p>Description</p>\"],\n },\n motivation: \"tagging\",\n } as {\n label?: InternationalString;\n body: InternationalString;\n motivation?: string;\n height?: number;\n width?: number;\n },\n {\n target: {\n id: canvas.id,\n type: \"Canvas\",\n },\n targetType: \"Annotation\",\n parent: {\n property: \"items\",\n resource: {\n id: firstAnnotationPage.id,\n type: \"AnnotationPage\",\n },\n },\n initialData: {\n selector: resp,\n },\n },\n );\n }\n },\n });\n\n if (!canvas) return null;\n if (!firstAnnotationPage) {\n return <div>No annotation page - create one?</div>;\n }\n\n return (\n <Sidebar>\n <SidebarContent padding>\n <div className=\"flex gap-4 border-b pt-4 pb-2 mb-2\">\n <h2 className=\"text-lg font-semibold flex-1\">Tour steps</h2>\n <ActionButton onPress={() => setReorderable((r) => !r)}>{reorderable ? \"Done\" : \"Reorder\"}</ActionButton>\n </div>\n\n <ResourceEditingProvider resource={canvas}>\n <AnnotationPageContext annotationPage={firstAnnotationPage.id}>\n <div className=\"flex flex-col gap-4\">\n <TourAnnotationPageEditor reorderable={reorderable} />\n\n {!busy ? (\n isPending ? (\n <PendingTourStepAnnotation />\n ) : (\n <Button\n onPress={() =>\n requestAnnotation({\n type: \"box\",\n annotationPopup: <ExhibitionTourStepPopup />,\n })\n }\n className=\"border disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500\"\n >\n + Add new step\n </Button>\n )\n ) : null}\n </div>\n {itemsAnnotationPage /*&& hasMultiplePainting*/ ? (\n <>\n <h3 className=\"text-md border-b pt-4 pb-2 mb-2\">Available tour steps from images</h3>\n <PromptToAddPaintingAnnotations\n painting={itemsAnnotationPage}\n page={editor.ref()}\n canvasId={canvas.id}\n />\n </>\n ) : null}\n </AnnotationPageContext>\n </ResourceEditingProvider>\n </SidebarContent>\n </Sidebar>\n );\n}\n","import { useCanvas } from \"react-iiif-vault\";\nimport invariant from \"tiny-invariant\";\nimport { getHeightWidthRatio } from \"../helpers\";\n\nexport function AspectRatioWarning() {\n const canvas = useCanvas();\n invariant(canvas);\n\n const ratio =\n canvas.width && canvas.height ? canvas.width / canvas.height : 0;\n const target = getHeightWidthRatio(canvas.behavior || []);\n\n if (Math.abs(ratio - target.ratio) < 0.01) return null;\n\n return (\n <div className=\"p-2 rounded bg-me-100\">\n <div className=\"text-me-700-500\">Aspect ratio warning</div>\n <div className=\"text-sm text-black/60\">\n The aspect ratio of this canvas is {ratio.toFixed(2)} but the target\n aspect ratio is {target.ratio.toFixed(2)}. Some parts of this image may\n be cropped.\n <div className=\"relative h-32 w-full mt-2\">\n <div\n className=\"bg-[red] left-0 top-0 z-2 opacity-50 max-w-32 max-h-32\"\n style={{ aspectRatio: ratio.toFixed(2) }}\n >\n <div\n className=\"asbolute bg-[white] left-0 top-0 z-1 opacity-50 max-w-32 max-h-32\"\n style={{ aspectRatio: target.ratio }}\n />\n </div>\n </div>\n </div>\n </div>\n );\n}\n","import { Sidebar, SidebarContent, SidebarHeader } from \"@manifest-editor/components\";\nimport {\n BehaviorEditor,\n type BehaviorEditorProps,\n DimensionsTriplet,\n InputContainer,\n useInStack,\n} from \"@manifest-editor/editors\";\nimport { type EditorDefinition, useEditor } from \"@manifest-editor/shell\";\nimport { useState } from \"react\";\nimport { AspectRatioWarning } from \"../components/AspectRatioWarning\";\n\nexport const customBehaviourEditor: EditorDefinition = {\n component: () => <SlideBehavioursPanel />,\n supports: {\n edit: true,\n resourceTypes: [\"Canvas\"],\n properties: [\"behavior\"],\n },\n id: \"slide-behaviors\",\n label: \"Layout\",\n tabs: {\n showTitle: true,\n },\n};\n\nconst exhibitionConfigs: BehaviorEditorProps[\"configs\"] = [\n {\n id: \"layout\",\n type: \"choice\",\n label: { en: [\"Layout\"] },\n initialOpen: true,\n items: [\n {\n label: { en: [\"Text on left\"] },\n value: \"left\",\n },\n {\n label: { en: [\"Text on right\"] },\n value: \"right\",\n },\n {\n label: { en: [\"Text on bottom\"] },\n value: \"bottom\",\n },\n {\n label: { en: [\"Text on top\"] },\n value: \"top\",\n },\n {\n label: { en: [\"Only image\"] },\n value: \"image\",\n },\n ],\n },\n {\n id: \"floating\",\n type: \"choice\",\n label: { en: [\"Floating\"] },\n initialOpen: false,\n addNone: true,\n groupBehavior: \"floating\",\n items: [\n {\n label: { en: [\"Float top left\"] },\n value: \"float-top-left\",\n },\n {\n label: { en: [\"Float top right\"] },\n value: \"float-top-right\",\n },\n {\n label: { en: [\"Float bottom left\"] },\n value: \"float-bottom-left\",\n },\n {\n label: { en: [\"Float bottom right\"] },\n value: \"float-bottom-right\",\n },\n ],\n },\n {\n id: \"size\",\n component: (existing, setBehaviors) => <EditSize behaviors={existing} setBehaviors={setBehaviors} />,\n label: { en: [\"Size\"] },\n type: \"custom\",\n initialOpen: true,\n supports: (b) => b.startsWith(\"w-\") || b.startsWith(\"h-\"),\n },\n];\n\nexport function RoundGridIcon(props: { index: number } & React.SVGProps<SVGSVGElement>) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n {/* Icon from Google Material Icons by Material Design Authors - https://github.com/material-icons/material-icons/blob/master/LICENSE */}\n <path\n fill={props.index === 0 ? \"currentColor\" : \"none\"}\n stroke=\"currentColor\"\n d=\"M5 11h4c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2\"\n />\n <path\n fill={props.index === 1 ? \"currentColor\" : \"none\"}\n stroke=\"currentColor\"\n d=\"M5 21h4c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2\"\n />\n <path\n fill={props.index === 2 ? \"currentColor\" : \"none\"}\n stroke=\"currentColor\"\n d=\"M13 5v4c0 1.1.9 2 2 2h4c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-4c-1.1 0-2 .9-2 2\"\n />\n <path\n fill={props.index === 3 ? \"currentColor\" : \"none\"}\n stroke=\"currentColor\"\n d=\"M15 21h4c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2h-4c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2\"\n />\n </svg>\n );\n}\n\nfunction parseBehaviors(items: string[]) {\n let width = 0;\n let height = 0;\n\n for (const item of items) {\n if (item.startsWith(\"w-\")) {\n width = Number.parseInt(item.slice(2));\n }\n if (item.startsWith(\"h-\")) {\n height = Number.parseInt(item.slice(2));\n }\n }\n\n return {\n width,\n height,\n };\n}\n\nfunction EditSize({ behaviors, setBehaviors }: { behaviors: string[]; setBehaviors: (behaviors: string[]) => void }) {\n const { width, height } = parseBehaviors(behaviors);\n const [hoverPosition, setHoverPosition] = useState({ x: -1, y: -1 });\n\n const setBehavior = (w: number, h: number) => {\n const newBehaviors = behaviors.filter((b) => {\n return !b.startsWith(\"w-\") && !b.startsWith(\"h-\");\n });\n\n newBehaviors.push(`w-${w}`);\n newBehaviors.push(`h-${h}`);\n\n setBehaviors(newBehaviors);\n };\n\n const cells = Array.from({ length: 144 }, (_, i) => {\n const x = i % 12;\n const y = Math.floor(i / 12);\n const hovered = hoverPosition.x >= x && hoverPosition.y >= y;\n const selected = x < width && y < height;\n const hoveredAndSelected = hovered && selected;\n\n let bgClass = \"bg-gray-200\";\n if (hovered) {\n bgClass = \"bg-me-200\";\n }\n if (selected) {\n bgClass = \"bg-me-500\";\n }\n if (hoveredAndSelected) {\n bgClass = \"bg-me-400\";\n }\n\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>\n <div\n key={i}\n className={`flex aspect-square rounded cursor-se-resize items-center justify-center ${bgClass}`}\n onClick={() => setBehavior(x + 1, y + 1)}\n onMouseUp={() => setBehavior(x + 1, y + 1)}\n onMouseEnter={() => setHoverPosition({ x, y })}\n />\n );\n });\n\n return (\n <div className=\"grid grid-cols-12 grid-rows-12 gap-1\" onMouseLeave={() => setHoverPosition({ x: -1, y: -1 })}>\n {cells}\n </div>\n );\n}\n\nfunction SlideBehavioursPanel() {\n const canvas = useInStack(\"Canvas\");\n const editor = useEditor();\n const { width, height } = editor.technical;\n\n if (!canvas || editor.technical.type !== \"Canvas\") {\n return (\n <Sidebar>\n <SidebarHeader title=\"Slide behaviors\" />\n <div>Please select canvas</div>\n </Sidebar>\n );\n }\n\n return (\n <Sidebar>\n <SidebarContent>\n <div className=\"px-2\">\n <InputContainer $wide>\n <DimensionsTriplet\n widthId={width.containerId()}\n width={width.get() || 0}\n changeWidth={(v) => width.set(v)}\n heightId={height.containerId()}\n height={height.get() || 0}\n changeHeight={(v) => height.set(v)}\n />\n <div>\n <AspectRatioWarning />\n </div>\n </InputContainer>\n </div>\n\n <BehaviorEditor\n behavior={editor.technical.behavior.get() || []}\n onChange={(v) => {\n editor.technical.behavior.set(v);\n }}\n configs={exhibitionConfigs}\n />\n </SidebarContent>\n </Sidebar>\n );\n}\n","import * as ManifestPreset from \"@manifest-editor/manifest-preset\";\nimport { extendApp, mapApp } from \"@manifest-editor/shell\";\nimport \"./index.css\";\nimport { tourStepAnnotations } from \"./annotations/TourStepAnnotations\";\nimport { exhibitionBackgroundTask } from \"./background-panel\";\nimport { imageBlockEditor } from \"./canvas-editors/image-block-editor\";\nimport { infoBlockEditor } from \"./canvas-editors/info-block-editor\";\nimport { youtubeMainEdtior } from \"./canvas-editors/youtube-editor\";\nimport { exhibitionCenterPanel } from \"./center-panels/ExhibitionCenterPanel\";\nimport { imageBrowserSlideCreator } from \"./creators/image-browser-slide-creator\";\nimport { imageServiceSlideCreator } from \"./creators/image-service-slide-creator\";\nimport { imageSlideCreator } from \"./creators/image-slide-creator\";\nimport { imageUrlSlideCreator } from \"./creators/image-url-slide\";\nimport { infoBoxCreator } from \"./creators/info-box-creator\";\nimport { videoSlideCreator } from \"./creators/video-slide-creator\";\nimport { youtubeSlideCreator } from \"./creators/youtube-slide-creator\";\nimport { exhibitionGridLeftPanel } from \"./left-panels/ExhibitionGrid\";\nimport { exhibitionOverviewLeftPanel } from \"./left-panels/ExhibitionOverview\";\nimport { exhibitionCanvasEditor } from \"./right-panels/ExhibitionCanvasEditor\";\nimport { exhibitionSummaryEdtior } from \"./right-panels/ExhibitionSummaryEditor\";\nimport { exhibitionTourSteps } from \"./right-panels/ExhibitionTourSteps\";\nimport { customBehaviourEditor } from \"./right-panels/SlideBehaviours\";\n\nexport const exhibitionEditorPreset = extendApp(\n mapApp(ManifestPreset),\n {\n id: \"exhibition-editor\",\n title: \"Exhibition Editor\",\n project: true,\n projectType: \"Manifest\",\n },\n {\n config: {\n editorConfig: {\n Canvas: {\n hideTabs: [\n \"@manifest-editor/overview\",\n \"@manifest-editor/technical-properties\",\n \"@manifest-editor/linking-properties\",\n \"@manifest-editor/nav-place-editor\",\n \"@manifest-editor/canvas-structural\",\n \"@manifest-editor/descriptive-properties\",\n \"@manifest-editor/overview-canvas-editor\",\n \"@manifest-editor/metadata\",\n ],\n },\n },\n },\n leftPanels: [\n //\n exhibitionGridLeftPanel,\n exhibitionOverviewLeftPanel,\n ],\n centerPanels: [\n //\n exhibitionCenterPanel,\n ],\n annotations: [\n //\n tourStepAnnotations,\n ],\n leftPanelIds: [\"left-panel-manifest\"],\n background: [exhibitionBackgroundTask],\n canvasEditors: [\n //\n imageBlockEditor,\n youtubeMainEdtior,\n infoBlockEditor,\n ],\n editors: [\n //\n exhibitionCanvasEditor,\n customBehaviourEditor,\n exhibitionSummaryEdtior,\n exhibitionTourSteps,\n ],\n creators: [\n infoBoxCreator,\n youtubeSlideCreator,\n imageServiceSlideCreator,\n imageBrowserSlideCreator,\n imageSlideCreator,\n imageUrlSlideCreator,\n videoSlideCreator,\n ],\n },\n);\n"],"mappings":"y6FAKA,MAAaA,GAAuC,CAClD,GAAI,oCACJ,MAAO,aACP,WAAc,EAAC,GAAA,EAAA,CAAsB,CACtC,CAED,SAAS,IAAsB,CAC7B,IAAM,EAAS,GAAW,CAEpB,EAAc,EADN,GAAe,CACQ,GAAM,EAAE,KAAK,QAAQ,CACpD,CAAE,cAAe,GAAgB,CAEjC,EADe,EAAW,UAAY,2BACb,EAAW,OAAO,YAAY,WAAW,yBAAyB,CAC3F,EAAsB,GAAQ,YAAY,GAMhD,MAJI,CAAC,GAAU,CAAC,GAAU,GAAe,CAAC,EACjC,KAIP,EAAA,EAAA,CAAA,SACE,EAAC,EAAA,CAAsB,eAAgB,EAAoB,YACzD,EAAC,GAAA,EAAA,CAAuB,EACF,CAAA,CACvB,CCdP,MAAaC,GAAqC,CAChD,GAAI,4BACJ,MAAO,oBACP,KAAM,KACN,WAAc,EAAC,GAAA,EAAA,CAAwB,CACvC,QAAS,CACP,SAAU,IACV,SAAU,IACX,CACF,CAED,SAAS,IAAwB,CAC/B,IAAM,EAAW,GAAa,CACxB,EAAQ,IAAU,CAClB,CAAC,EAAO,GAAY,EAAS,GAAI,CACjC,EAAa,EAAuB,KAAK,CACzC,CAAE,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,CACrC,WAAY,CAAC,GAAyB,CACtC,cAAe,CAEb,GACA,GACA,GACD,CACD,QAAS,CAEP,GACA,GACA,GACA,GACD,CACD,SAAU,CACR,GACA,GACA,GACA,GACA,EACA,GACA,GACD,CACF,CACF"}
1
+ {"version":3,"file":"index.js","names":["tourStepAnnotations: AnnotationPanel","exhibitionCenterPanel: LayoutPanel","exhibitionOverviewLeftPanel: LayoutPanel","exhibitionBackgroundTask: BackgroundPanel","imageBlockEditor: CanvasEditorDefinition","infoBlockEditor: CanvasEditorDefinition","youtubeMainEdtior: CanvasEditorDefinition","ExhibitionItem","prevCanvasIndex: number","exhibitionGridLeftPanel: LayoutPanel","exhibitionCanvasEditor: EditorDefinition","ExhibitionRightPanel","exhibitionSummaryEdtior: EditorDefinition","ExhibitionRightPanel","exhibitionTourSteps: EditorDefinition","customBehaviourEditor: EditorDefinition","exhibitionConfigs: BehaviorEditorProps[\"configs\"]"],"sources":["../src/annotations/TourStepAnnotations.tsx","../src/center-panels/ExhibitionCenterPanel.tsx","../src/left-panels/ExhibitionOverview.tsx","../src/background-panel.tsx","../src/helpers.ts","../src/canvas-editors/image-block-editor.tsx","../src/canvas-editors/info-block-editor.tsx","../src/canvas-editors/youtube-editor.tsx","../src/creators/image-browser-slide-creator.tsx","../src/creators/image-service-slide-creator.tsx","../src/creators/image-slide-creator.tsx","../src/creators/image-url-slide.tsx","../src/creators/info-box-creator.tsx","../src/creators/video-slide-creator.tsx","../src/creators/youtube-slide-creator.tsx","../src/components/ExhibitionContainer.tsx","../src/components/ExhibitionItem.tsx","../src/components/ExhibitionGrid.tsx","../src/icons/ResizeHandleIcon.tsx","../src/components/SortableExhibitionItem.tsx","../src/components/SortableExhibitionGrid.tsx","../src/left-panels/ExhibitionGrid.tsx","../src/components/ExhibitionItemConversion.tsx","../src/right-panels/ExhibitionCanvasEditor.tsx","../src/right-panels/ExhibitionSummaryEditor.tsx","../src/icons/CheckIcon.tsx","../src/components/ExhibitionTourStepPopup.tsx","../src/components/PendingTourStepAnnotation.tsx","../src/components/ActionButtonPopupSwitcher.tsx","../src/components/TourNormalAnnotationEditor.tsx","../src/components/TourPaintingAnnotationEditor.tsx","../src/components/TourAnnotationEditor.tsx","../src/components/TourAnnotationPageEditor.tsx","../src/right-panels/ExhibitionTourSteps.tsx","../src/components/AspectRatioWarning.tsx","../src/right-panels/SlideBehaviours.tsx","../src/index.tsx"],"sourcesContent":["import { ViewerAnnotationPage } from \"@manifest-editor/editors\";\nimport { type AnnotationPanel, useAtlasStore, useLayoutState } from \"@manifest-editor/shell\";\nimport { AnnotationPageContext, useCanvas } from \"react-iiif-vault\";\nimport { useStore } from \"zustand\";\n\nexport const tourStepAnnotations: AnnotationPanel = {\n id: \"@exhibition/tour-step-annotations\",\n label: \"Tour steps\",\n render: () => <TourStepAnnotations />,\n};\n\nfunction TourStepAnnotations() {\n const canvas = useCanvas();\n const store = useAtlasStore();\n const toolEnabled = useStore(store, (s) => s.tool.enabled);\n const { rightPanel } = useLayoutState();\n const isRightPanel = rightPanel.current === \"@manifest-editor/editor\";\n const isTour = isRightPanel && rightPanel.state?.currentTab?.startsWith(\"@exhibition/tour-steps\");\n const firstAnnotationPage = canvas?.annotations[0];\n\n if (!isTour || !canvas || toolEnabled || !firstAnnotationPage) {\n return null;\n }\n\n return (\n <>\n <AnnotationPageContext annotationPage={firstAnnotationPage.id}>\n <ViewerAnnotationPage />\n </AnnotationPageContext>\n </>\n );\n}\n","import { EditTextIcon } from \"@manifest-editor/components\";\nimport { CanvasPanelEditor, CanvasPanelViewer } from \"@manifest-editor/editors\";\nimport {\n EditingStackContext,\n InlineEditingStack,\n type LayoutPanel,\n useLayoutActions,\n usePanelActions,\n} from \"@manifest-editor/shell\";\nimport { DelftExhibition } from \"exhibition-viewer\";\nimport { type EditorHooks, EditorHooksProvider } from \"exhibition-viewer/library\";\nimport { useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { Button } from \"react-aria-components\";\nimport { CanvasContext, useManifest, useVault } from \"react-iiif-vault\";\n\nexport const exhibitionCenterPanel: LayoutPanel = {\n id: \"@exhibitions/center-panel\", // We are overriding the default canvas listing panel\n label: \"Exhibition editor\",\n icon: null,\n render: () => <ExhibitionCenterPanel />,\n options: {\n minWidth: 350,\n maxWidth: 350,\n },\n};\n\nfunction ExhibitionCenterPanel() {\n const manifest = useManifest();\n const vault = useVault();\n const [scale, setScale] = useState(0.8);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const { edit, leftPanel } = useLayoutActions();\n\n const hooks = useMemo(() => {\n return {\n localeStringEditor: (props) => {\n return (\n <span className=\"inline-flex items-center hover:ring-4 hover:ring-me-primary-500\">\n {props.original}\n <Button className=\"py-1 px-2 inline-block\" onPress={() => edit(props.resource)}>\n <EditTextIcon className=\"text-xl\" />\n </Button>\n </span>\n );\n },\n canvasPreviewEditor: (props) => {\n return (\n <div className=\"w-full h-full flex-1 flex relative\">\n {props.original}\n <button\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n edit(props.resource);\n leftPanel.open({ id: \"canvas-listing\", open: true });\n }}\n className=\"absolute top-5 right-5 bg-white text-black p-2 rounded z-40\"\n >\n EDIT\n </button>\n </div>\n );\n },\n } satisfies EditorHooks;\n }, []);\n\n useLayoutEffect(() => {\n if (wrapperRef.current) {\n const wrapperWidth = wrapperRef.current.offsetWidth;\n const initialScale = wrapperWidth / 1200;\n setScale(Math.max(1, initialScale));\n }\n }, []);\n\n if (!manifest) return null;\n\n return (\n <div ref={wrapperRef} className=\"overflow-y-auto delft-exhibition\">\n <EditorHooksProvider hooks={hooks}>\n <DelftExhibition\n key={scale}\n skipLoadManifest\n customVault={vault}\n manifest={manifest.id}\n options={{\n disablePresentation: true,\n hideTableOfContents: true,\n hideTitle: true,\n alternativeImageMode: true,\n }}\n />\n </EditorHooksProvider>\n </div>\n );\n}\n","import { InfoIcon } from \"@manifest-editor/components\";\nimport type { LayoutPanel } from \"@manifest-editor/shell\";\nimport { useManifest } from \"react-iiif-vault\";\n\nexport const exhibitionOverviewLeftPanel: LayoutPanel = {\n id: \"@exhibitions/overview-panel\", // We are overriding the default canvas listing panel\n label: \"\",\n icon: <div className=\"hidden hover:block\">👀</div>,\n render: () => <ExhibitionOverviewPanel />,\n};\n\nexport function ExhibitionOverviewPanel() {\n const manifest = useManifest();\n\n if (!manifest) return null;\n\n return (\n <div>\n Coming soon.\n {/*<DelftExhibition manifest={manifest.id} language=\"en\" viewObjectLinks={[]} />*/}\n </div>\n );\n}\n","import { useInStack } from \"@manifest-editor/editors\";\nimport { useEditCanvasItems } from \"@manifest-editor/manifest-preset/components\";\nimport { type BackgroundPanel, useConfig, useLayoutActions, useLayoutState } from \"@manifest-editor/shell\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { useManifest } from \"react-iiif-vault\";\nimport { exhibitionCenterPanel } from \"./center-panels/ExhibitionCenterPanel\";\nimport { exhibitionOverviewLeftPanel } from \"./left-panels/ExhibitionOverview\";\n\nexport const exhibitionBackgroundTask: BackgroundPanel = {\n id: \"exhibition-background-task\",\n label: \"Query string\",\n render: () => <ExhibitionBackgroundPanel />,\n};\n\nfunction ExhibitionBackgroundPanel() {\n console.log(\"rendering?\");\n const manifest = useManifest();\n const canvas = useInStack(\"Canvas\");\n const { leftPanel, rightPanel } = useLayoutState();\n const {\n edit,\n leftPanel: leftPanelActions,\n rightPanel: rightPanelActions,\n centerPanel: centerPanelActions,\n } = useLayoutActions();\n const { canvasActions, open } = useEditCanvasItems();\n const { editorFeatureFlags: { rememberCanvasId = true, rememberLeftPanelId = false } = {} } = useConfig();\n const isLeftPanelOpen = leftPanel.open;\n\n useEffect(() => {\n // When left panel is exhibition overview, set the main panel\n if (manifest && leftPanel.current === exhibitionOverviewLeftPanel.id) {\n edit(manifest);\n centerPanelActions.open({ id: exhibitionCenterPanel.id });\n leftPanelActions.close();\n }\n }, [leftPanel.current]);\n\n return null;\n}\n","import type { CanvasNormalized } from \"@iiif/presentation-3-normalized\";\n\nconst heightMap = {\n \"h-1\": \"lg:min-h-[100px] row-span-1\",\n \"h-2\": \"lg:min-h-[200px] row-span-2\",\n \"h-3\": \"lg:min-h-[300px] row-span-3\",\n \"h-4\": \"lg:min-h-[400px] row-span-4\",\n \"h-5\": \"lg:min-h-[500px] row-span-5\",\n \"h-6\": \"lg:min-h-[600px] row-span-6\",\n \"h-7\": \"lg:min-h-[700px] row-span-7\",\n \"h-8\": \"lg:min-h-[800px] row-span-8\",\n \"h-9\": \"lg:min-h-[900px] row-span-9\",\n \"h-10\": \"lg:min-h-[1000px] row-span-10\",\n \"h-11\": \"lg:min-h-[1100px] row-span-11\",\n \"h-12\": \"lg:min-h-[1200px] row-span-12\",\n};\nconst previewHeightMap = {\n \"h-1\": \"lg:min-h-[25px] row-span-1\",\n \"h-2\": \"lg:min-h-[50px] row-span-2\",\n \"h-3\": \"lg:min-h-[75px] row-span-3\",\n \"h-4\": \"lg:min-h-[100px] row-span-4\",\n \"h-5\": \"lg:min-h-[125px] row-span-5\",\n \"h-6\": \"lg:min-h-[150px] row-span-6\",\n \"h-7\": \"lg:min-h-[175px] row-span-7\",\n \"h-8\": \"lg:min-h-[200px] row-span-8\",\n \"h-9\": \"lg:min-h-[225px] row-span-9\",\n \"h-10\": \"lg:min-h-[250px] row-span-10\",\n \"h-11\": \"lg:min-h-[275px] row-span-11\",\n \"h-12\": \"lg:min-h-[300px] row-span-12\",\n};\n\nconst widthMap = {\n \"w-1\": \"col-span-1\",\n \"w-2\": \"col-span-2\",\n \"w-3\": \"col-span-3\",\n \"w-4\": \"col-span-4\",\n \"w-5\": \"col-span-5\",\n \"w-6\": \"col-span-6\",\n \"w-7\": \"col-span-7\",\n \"w-8\": \"col-span-8\",\n \"w-9\": \"col-span-9\",\n \"w-10\": \"col-span-10\",\n \"w-11\": \"col-span-11\",\n \"w-12\": \"col-span-12\",\n};\n\nexport function getHeightWidthRatio(behavior?: string[]) {\n const { isLeft, isRight, isBottom } = getGridStats(behavior);\n const h = behavior?.find((a) => a.includes(\"h-\")) as keyof typeof heightMap;\n const w = behavior?.find((a) => a.includes(\"w-\")) as keyof typeof widthMap;\n\n if (!h || !w) {\n return { h: 0, w: 0, ratio: 1 };\n }\n\n const ret = {\n h: Number.parseInt(h.split(\"-\")[1]!),\n w: Number.parseInt(w.split(\"-\")[1]!),\n ratio: 1,\n };\n\n // If left or right - the ratio is 2/3s.\n if (isLeft || isRight) {\n ret.w *= 2 / 3;\n }\n if (isBottom) {\n ret.h *= 2 / 3;\n }\n\n if (ret.h && ret.w) {\n ret.ratio = ret.w / ret.h;\n }\n return ret;\n}\n\nexport function getClassName(b?: string[], firstInfo = false, preview = true) {\n if (!b || b.length === 0) {\n b = [\"h-8\", \"w-8\", \"image\"];\n }\n let h = b.find((a) => a.includes(\"h-\")) as keyof typeof heightMap;\n const w = b.find((a) => a.includes(\"w-\")) as keyof typeof widthMap;\n const classNames = [];\n\n if (firstInfo && h === \"h-4\") {\n h = \"h-8\";\n }\n classNames.push(preview ? previewHeightMap[h] : heightMap[h]);\n classNames.push(widthMap[w]);\n return classNames.join(\" \");\n}\n\nexport function getGridStats(behavior?: string[]) {\n const isRight = behavior?.includes(\"right\");\n const isLeft = behavior?.includes(\"left\");\n const isBottom = behavior?.includes(\"bottom\");\n const isTop = behavior?.includes(\"top\");\n const isImage = behavior?.includes(\"image\") || (!isLeft && !isRight && !isBottom && !isTop);\n const isInfo = behavior?.includes(\"info\");\n\n return {\n isRight,\n isLeft,\n isBottom,\n isTop,\n isInfo,\n isImage,\n };\n}\n\nexport function isExhibitionItem(canvas: CanvasNormalized | undefined) {\n if (!canvas) return false;\n\n const behaviors = canvas.behavior || [];\n if (behaviors.includes(\"image\") || behaviors.includes(\"info\")) {\n return true;\n }\n\n for (const behavior of behaviors) {\n if (behavior.startsWith(\"w-\") || behavior.startsWith(\"h-\")) {\n return true;\n }\n }\n\n return false;\n}\n","import { ActionButton } from \"@manifest-editor/components\";\nimport { CanvasPanelEditor, useInStack, useToggleList } from \"@manifest-editor/editors\";\nimport type { CanvasEditorDefinition, LayoutPanel } from \"@manifest-editor/shell\";\nimport { useLocalStorage } from \"@manifest-editor/shell\";\nimport { CanvasContext, LocaleString, type RenderingStrategy, useCanvas } from \"react-iiif-vault\";\nimport { twMerge } from \"tailwind-merge\";\nimport { getClassName, getGridStats } from \"../helpers\";\nimport { useLayoutEffect, useRef, useState } from \"react\";\n\nexport const imageBlockEditor: CanvasEditorDefinition = {\n id: \"image-block-editor\",\n label: \"Image Block Editor\",\n component: (strategy) => <ImageBlockEditor strategy={strategy} />,\n supports: {\n strategy: (strategy, resource, vault) => {\n if (strategy.type !== \"images\") {\n return false;\n }\n\n const fullResource = vault.get(resource.resource);\n if (fullResource.type !== \"Canvas\") {\n return false;\n }\n\n const behaviors = fullResource.behavior || [];\n\n let isImage = false;\n for (const behaviour of behaviors) {\n if (behaviour.startsWith(\"w-\") || behaviour.startsWith(\"h-\") || behaviour === \"image\") {\n isImage = true;\n }\n }\n\n return isImage;\n },\n },\n};\n\nexport function ImageBlockEditor({ strategy }: { strategy: RenderingStrategy }) {\n const [isPreview, setIsPreview] = useLocalStorage(\"exhibition-preview-mode\");\n const canvas = useInStack(\"Canvas\");\n if (!canvas) {\n return null;\n }\n\n return (\n <CanvasContext canvas={canvas.resource.source?.id}>\n <div className=\"flex gap-4 bg-me-500 py-2 px-4 text-white shadow-md z-40 ring-1 ring-me-500 items-center\">\n Switch view\n <ActionButton onPress={() => setIsPreview(!isPreview)}>\n {isPreview ? \"Full canvas\" : \"Layout preview\"}\n </ActionButton>\n </div>\n {isPreview ? (\n <ImageBlockRenderer />\n ) : (\n <div className=\"h-full flex flex-1 min-h-0\">\n <CanvasPanelEditor asFallback />\n </div>\n )}\n </CanvasContext>\n );\n}\n\nfunction ImageBlockRenderer() {\n const ref = useRef<HTMLDivElement>(null);\n const canvas = useCanvas();\n const behavior = canvas?.behavior || [];\n const className = getClassName(behavior, false, false);\n const { isBottom, isImage, isInfo, isLeft } = getGridStats(canvas?.behavior);\n\n const [scale, setScale] = useState(1);\n\n useLayoutEffect(() => {\n // 1200 is what it looks like on the site.\n const container = ref.current;\n if (!container) return;\n const containerWidth = container.offsetWidth;\n const imageWidth = 1200;\n setScale(containerWidth / imageWidth);\n }, [canvas]);\n\n return (\n <div className=\"overflow-hidden h-full w-full\" ref={ref}>\n <div className=\"grid grid-cols-12 grid-rows-12 h-full bg-white\">\n <div\n className={twMerge(\n className,\n \"flex h-full max-h-full min-h-0 ring-4 ring-black\",\n isLeft ? \"flex-row-reverse\" : isBottom ? \"flex-col\" : \"flex-row\"\n )}\n >\n <div className=\"flex-1 h-full flex min-w-0\">\n <CanvasPanelEditor asFallback />\n </div>\n {!isImage ? (\n <div\n className={`${isBottom ? \"min-h-3 w-full\" : \"w-1/3\"} flex-shrink-0 self-stretch text-white bg-black rounded p-8 relative h-full`}\n >\n <div style={{ fontSize: `${scale * 16}px` }}>\n <LocaleString className=\"block mb-4\">{canvas?.label}</LocaleString>\n <LocaleString>{canvas?.summary}</LocaleString>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n","import { ActionButton } from \"@manifest-editor/components\";\nimport { AnnotationBodyEditor } from \"@manifest-editor/editors\";\nimport {\n type CanvasEditorDefinition,\n useGenericEditor,\n useInlineCreator,\n} from \"@manifest-editor/shell\";\nimport {\n AnnotationContext,\n type TextualContentStrategy,\n useAnnotation,\n useCanvas,\n useVaultSelector,\n} from \"react-iiif-vault\";\n\nexport const infoBlockEditor: CanvasEditorDefinition = {\n id: \"info-block-editor\",\n label: \"info Block Editor\",\n component: (strategy) => (\n <InfoBlockEditor strategy={strategy as TextualContentStrategy} />\n ),\n supports: {\n strategy: (strategy, resource, vault) => {\n if (strategy.type !== \"textual-content\") {\n return false;\n }\n return true;\n },\n },\n};\n\nexport function InfoBlockEditor(props: { strategy: TextualContentStrategy }) {\n const canvas = useCanvas();\n const annotationPage = useVaultSelector((_, vault) =>\n // biome-ignore lint/style/noNonNullAssertion: Should always be present.\n vault.get(canvas?.items[0]!),\n );\n const longSummaries = useVaultSelector((_, vault) =>\n canvas?.annotations[0] ? vault.get(canvas?.annotations[0]!) : null,\n );\n\n // creator.create(definition, payload);\n\n return (\n <div className=\"overflow-y-auto bg-white shadow\">\n <div className=\"mb-12\">\n {annotationPage.items.map((annotation, key) => {\n return (\n <AnnotationContext\n key={annotation.id + key}\n annotation={annotation.id}\n >\n <AnnotationEditor />\n </AnnotationContext>\n );\n })}\n </div>\n\n {longSummaries ? (\n <>\n <h2 className=\"text-2xl font-bold px-4 border-t border-gray-200 pt-4 mb-4\">\n Long Summaries\n </h2>\n <p className=\"my-4 px-4\">\n Long summaries are used to provide more detailed information about\n the canvas. They appear when the user clicks \"read more\" in the\n exhibition.\n </p>\n {longSummaries.items.map((annotation, key) => {\n return (\n <AnnotationContext\n key={annotation.id + key}\n annotation={annotation.id}\n >\n <AnnotationEditor />\n </AnnotationContext>\n );\n })}\n </>\n ) : null}\n </div>\n );\n}\n\nfunction AnnotationEditor() {\n const annotation = useAnnotation();\n const creator = useInlineCreator();\n const bodies = annotation?.body || [];\n const editor = useGenericEditor(annotation);\n\n if (!annotation) {\n return null;\n }\n\n return (\n <div>\n {bodies.map((body, n) => {\n return (\n <AnnotationBodyEditor\n key={n}\n className=\"p-4 hover:bg-me-100/40 focus-within:bg-me-100/40\"\n resourceId={body.id}\n onRemove={() => editor.annotation.body.deleteAtIndex(n)}\n />\n );\n })}\n\n <div className=\"p-4\">\n <ActionButton\n primary\n onPress={() => {\n creator.create(\n \"@manifest-editor/html-body-creator\",\n { language: \"en\", value: \"\" },\n {\n targetType: \"ContentResource\",\n parent: {\n property: \"body\",\n resource: {\n id: annotation.id,\n type: \"Annotation\",\n },\n },\n initialData: {},\n },\n );\n }}\n >\n Add new annotation\n </ActionButton>\n </div>\n </div>\n );\n}\n","import { ActionButton, LazyThumbnail } from \"@manifest-editor/components\";\nimport { type CanvasEditorDefinition, useGenericEditor, useLayoutActions } from \"@manifest-editor/shell\";\nimport { useRef } from \"react\";\nimport {\n LocaleString,\n type MediaStrategy,\n type SingleYouTubeVideo,\n useCanvas,\n useVaultSelector,\n} from \"react-iiif-vault\";\nimport invariant from \"tiny-invariant\";\n\nexport const youtubeMainEdtior: CanvasEditorDefinition = {\n id: \"youtube-main-editor\",\n label: \"YouTube main editor\",\n component: (strategy) =>\n strategy.type === \"media\" ? (\n <YouTubeEditor strategy={strategy as MediaStrategy} video={strategy.media as SingleYouTubeVideo} />\n ) : null,\n supports: {\n strategy: (strategy, resource, vault) => {\n console.log(strategy);\n if (strategy.type !== \"media\") {\n return false;\n }\n\n if (strategy.media.type !== \"VideoYouTube\") {\n return false;\n }\n\n return true;\n },\n },\n};\n\nexport function YouTubeEditor({ strategy, video }: { strategy: MediaStrategy; video: SingleYouTubeVideo }) {\n const { edit } = useLayoutActions();\n const canvas = useCanvas();\n const annotationRef = useVaultSelector((_, v) => {\n const page = v.get(canvas?.items[0]!);\n return page.items[0]!;\n });\n invariant(canvas && annotationRef);\n const player = useRef<HTMLIFrameElement>(null);\n const annotation = useGenericEditor(annotationRef);\n const media = video;\n\n const ar = (canvas.width || 1) / (canvas.height || 1);\n const ytThumbnail = `https://img.youtube.com/vi/${media.youTubeId}/maxresdefault.jpg`;\n\n return (\n <div className=\"overflow-y-auto\">\n <div className=\"p-8\">\n <div className=\"bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto\" style={{ aspectRatio: ar }}>\n <iframe\n title=\"YouTube video\"\n className=\"border-none w-full h-full object-contain\"\n ref={player}\n src={`https://www.youtube.com/embed/${media.youTubeId}?enablejsapi=1&origin=${window.location.host}&modestbranding=1&rel=0`}\n // @ts-expect-error\n referrerPolicy=\"no-referrer compute-pressure\"\n sandbox=\"allow-scripts allow-same-origin allow-presentation\"\n />\n </div>\n </div>\n\n <div className=\"bg-white shadow w-full p-8 flex gap-8\">\n <div>\n <div\n className=\"w-64 bg-black flex-shrink-0 flex items-center justify-center rounded overflow-clip\"\n style={{ aspectRatio: ar }}\n >\n {canvas.thumbnail?.length ? (\n <LazyThumbnail cover />\n ) : (\n <div className=\"text-white/50 text-center py-16\">No thumbnail</div>\n )}\n </div>\n </div>\n <div className=\"flex-1\">\n <LocaleString\n as=\"h3\"\n className=\"text-2xl font-bold mt-4\"\n defaultText={(<span className=\"text-black/30\">No Label</span>) as any}\n >\n {annotation.descriptive.label.get()}\n </LocaleString>\n <LocaleString\n as=\"p\"\n className=\"mt-2 mb-8\"\n defaultText={(<span className=\"text-black/30\">No summary</span>) as any}\n >\n {annotation.descriptive.summary.get()}\n </LocaleString>\n <ActionButton onPress={() => edit(annotation.ref())}>Edit properties</ActionButton>\n </div>\n </div>\n </div>\n );\n}\n","import {\n type CreatorFunctionContext,\n creatorHelper,\n type CreatorResource,\n defineCreator,\n} from \"@manifest-editor/creator-api\";\nimport { type IIIFBrowserCreatorPayload, iiifBrowserCreator } from \"@manifest-editor/creators\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/browser-creator\": typeof imageBrowserSlideCreator;\n }\n }\n}\n\nexport const imageBrowserSlideCreator = defineCreator({\n ...iiifBrowserCreator,\n id: \"@exhibitions/browser-creator\",\n create: createBrowser,\n tags: [\"image\", \"exhibition-slide\"],\n label: \"IIIF Browser\",\n summary: \"Browse IIIF Resources\",\n resourceType: \"Canvas\",\n resourceFields: [\"id\", \"language\", \"type\", \"format\", \"value\"],\n additionalTypes: [],\n supports: {\n onlyPainting: true,\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n parentFieldMap: {\n Manifest: [\"items\"],\n },\n },\n});\n\nasync function createBrowser(data: IIIFBrowserCreatorPayload, ctx: CreatorFunctionContext): Promise<CreatorResource> {\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n\n const dimensions = { width: 0, height: 0 };\n\n const createBrowserAnnotation = creatorHelper(\n ctx,\n { id: pageId, type: \"AnnotationPage\" },\n \"items\",\n \"@manifest-editor/iiif-browser-creator\",\n );\n\n const annotation = await createBrowserAnnotation(\n {\n ...data,\n trackSize({ width, height }) {\n dimensions.height = height;\n dimensions.width = width;\n },\n },\n {\n targetType: \"Annotation\",\n target: {\n id: canvasId,\n type: \"Canvas\",\n },\n },\n );\n\n const createSlide = creatorHelper(ctx, \"Manifest\", \"items\", \"@exhibitions/image-slide-creator\");\n\n // 2. Pass that to an empty slide.\n return await createSlide({\n canvasId,\n width: dimensions.width,\n height: dimensions.height,\n type: \"default\", // default / left / right / bottom\n items: annotation,\n });\n}\n","import {\n type CreatorFunctionContext,\n creatorHelper,\n type CreatorResource,\n defineCreator,\n} from \"@manifest-editor/creator-api\";\nimport { type CreateImageServicePayload, imageServiceCreator } from \"@manifest-editor/creators\";\nimport { imageSlideCreator } from \"./image-slide-creator\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/image-service-creator\": typeof imageServiceSlideCreator;\n }\n }\n}\n\nexport const imageServiceSlideCreator = defineCreator({\n ...imageServiceCreator,\n id: \"@exhibitions/image-service-creator\",\n create: createImageService,\n tags: [\"image\", \"exhibition-slide\"],\n label: \"IIIF Image\",\n summary: \"IIIF Image service\",\n resourceType: \"Canvas\",\n supports: {\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n },\n});\n\nasync function createImageService(\n data: CreateImageServicePayload,\n ctx: CreatorFunctionContext,\n): Promise<CreatorResource> {\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const annotationId = ctx.generateId(\"annotation\");\n\n const createImageService = creatorHelper(\n ctx,\n { id: annotationId, type: \"Annotation\" },\n \"body\",\n \"@manifest-editor/image-service-creator\",\n );\n\n // 1. Call the original creator to get the annotation\n const resource = await createImageService(data, {\n target: {\n id: canvasId,\n type: \"Canvas\",\n },\n });\n\n const { width, height } = resource.get();\n\n const annotation = ctx.embed({\n id: ctx.generateId(\"annotation\"),\n type: \"Annotation\",\n motivation: \"painting\",\n body: [resource],\n target: {\n type: \"SpecificResource\",\n source: { id: canvasId, type: \"Canvas\" },\n },\n });\n\n // 2. Pass that to an empty slide.\n const createSlide = creatorHelper(ctx, \"Manifest\", \"items\", \"@exhibitions/image-slide-creator\");\n return await createSlide({\n canvasId,\n width,\n height,\n type: \"default\", // default / left / right / bottom\n items: [annotation],\n });\n}\n","import { emptyAnnotationPage, emptyCanvas } from \"@iiif/parser\";\nimport type { InternationalString } from \"@iiif/presentation-3\";\nimport { EmptyCanvasIcon } from \"@manifest-editor/components\";\nimport { type CreatorFunctionContext, type CreatorResource, defineCreator } from \"@manifest-editor/creator-api\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/image-slide-creator\": typeof imageSlideCreator;\n \"@exhibitions/image-slide-creator-bottom\": typeof imageSlideBottomCreator;\n \"@exhibitions/image-slide-creator-left\": typeof imageSlideLeftCreator;\n \"@exhibitions/image-slide-creator-right\": typeof imageSlideRightCreator;\n }\n }\n}\n\nexport const imageSlideCreator = defineCreator({\n id: \"@exhibitions/image-slide-creator\",\n create: createImageSlide,\n label: \"Empty slide\",\n summary: \"An empty image slide.\",\n icon: <EmptyCanvasIcon />,\n tags: [\"exhibition-slide\"], // No tag, so it doesn't appear, it's just called.\n resourceType: \"Canvas\",\n resourceFields: [\"id\", \"type\", \"label\", \"height\", \"width\", \"items\"],\n supports: {\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n },\n});\n\nexport const imageSlideLeftCreator = defineCreator({\n ...imageSlideCreator,\n id: \"@exhibitions/image-slide-creator-left\",\n label: \"Image (Left)\",\n summary: \"An image with text on the left.\",\n icon: <div>IMAGE (LEFT)</div>,\n create: (payload, ctx) => createImageSlide({ ...payload, type: \"left\" }, ctx),\n});\n\nexport const imageSlideRightCreator = defineCreator({\n ...imageSlideCreator,\n id: \"@exhibitions/image-slide-creator-right\",\n label: \"Image (Right)\",\n summary: \"An image with text on the right.\",\n icon: <div>IMAGE (RIGHT)</div>,\n create: (payload, ctx) => createImageSlide({ ...payload, type: \"right\" }, ctx),\n});\n\nexport const imageSlideBottomCreator = defineCreator({\n ...imageSlideCreator,\n id: \"@exhibitions/image-slide-creator-bottom\",\n label: \"Image (Bottom)\",\n summary: \"An image with text at the bottom.\",\n icon: <div>IMAGE (BOTTOM)</div>,\n create: (payload, ctx) => createImageSlide({ ...payload, type: \"bottom\" }, ctx),\n});\n\ninterface InfoBoxPayload {\n canvasId?: string;\n label?: InternationalString;\n height?: number;\n width?: number;\n duration?: number;\n type: \"default\" | \"left\" | \"right\" | \"bottom\";\n items?: CreatorResource[];\n}\n\nfunction createImageSlide(payload: InfoBoxPayload, ctx: CreatorFunctionContext) {\n const canvasId = payload.canvasId || ctx.generateId(\"Canvas\");\n const itemsPageId = ctx.generateId(\"AnnotationPage\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const annotationsPageId = ctx.generateId(\"AnnotationPage\", {\n id: canvasId,\n type: \"Canvas\",\n });\n\n const behavior = [];\n let width = 6000;\n\n if (payload.width && payload.height) {\n // Let's figure out the right behaviours.\n if (payload.width > payload.height) {\n // The orientation is landscape.\n // Let's shrink the height.\n const gridSize = payload.width / 12;\n const heightColumns = Math.floor(payload.height / gridSize);\n const hClass = `h-${heightColumns}`;\n behavior.push(\"w-12\", hClass);\n } else {\n // The orientation is portrait.\n const gridSize = payload.height / 12;\n const widthColumns = Math.floor(payload.width / gridSize);\n const wClass = `w-${widthColumns}`;\n behavior.push(wClass, \"h-12\");\n }\n } else {\n behavior.push(\"w-12\", \"h-4\");\n }\n\n switch (payload.type) {\n case \"left\":\n behavior.push(\"left\");\n width *= 2 / 3;\n break;\n case \"right\":\n behavior.push(\"right\");\n width *= 2 / 3;\n break;\n case \"bottom\":\n behavior.push(\"bottom\");\n break;\n }\n\n if (!payload.items?.length) {\n behavior.push(\"multi-image\");\n }\n\n return ctx.embed({\n ...emptyCanvas,\n id: canvasId,\n behavior,\n label: payload.label || { en: [\"Untitled\"] },\n height: payload.height || 4000,\n duration: payload.duration,\n width: payload.width || width,\n items: [\n ctx.embed({\n ...emptyAnnotationPage,\n id: itemsPageId,\n type: \"AnnotationPage\",\n items: payload.items ? payload.items : [],\n }),\n ],\n annotations: [\n ctx.embed({\n ...emptyAnnotationPage,\n id: annotationsPageId,\n type: \"AnnotationPage\",\n items: [],\n }),\n ],\n });\n}\n","import {\n type CreatorFunctionContext,\n creatorHelper,\n type CreatorResource,\n defineCreator,\n} from \"@manifest-editor/creator-api\";\nimport { type CreateImageUrlPayload, imageUrlCreator } from \"@manifest-editor/creators\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/image-url-creator\": typeof imageUrlSlideCreator;\n }\n }\n}\n\nexport const imageUrlSlideCreator = defineCreator({\n ...imageUrlCreator,\n id: \"@exhibitions/image-url-creator\",\n create: createUrlSlide,\n tags: [\"exhibition-slide\"],\n label: \"Image\",\n summary: \"Image from URL\",\n resourceType: \"Canvas\",\n supports: {\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n },\n});\n\nasync function createUrlSlide(data: CreateImageUrlPayload, ctx: CreatorFunctionContext): Promise<CreatorResource> {\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const annotationId = ctx.generateId(\"annotation\");\n\n const createImageUrl = creatorHelper(\n ctx,\n { id: annotationId, type: \"Annotation\" },\n \"body\",\n \"@manifest-editor/image-url-creator\",\n );\n\n // 1. Call the original creator to get the annotation\n const resource = await createImageUrl(data, {\n target: {\n id: canvasId,\n type: \"Canvas\",\n },\n targetType: \"Annotation\",\n });\n\n const { width, height } = resource.get();\n\n const annotation = ctx.embed({\n id: annotationId,\n type: \"Annotation\",\n motivation: \"painting\",\n body: [resource],\n target: {\n type: \"SpecificResource\",\n source: { id: canvasId, type: \"Canvas\" },\n },\n });\n\n // 2. Pass that to an empty slide.\n const createSlide = creatorHelper(ctx, \"Manifest\", \"items\", \"@exhibitions/image-slide-creator\");\n return await createSlide({\n canvasId,\n width,\n height,\n type: \"default\", // default / left / right / bottom\n items: [annotation],\n });\n}\n","import { emptyAnnotation, emptyCanvas } from \"@iiif/parser\";\nimport type { InternationalString } from \"@iiif/presentation-3\";\nimport { type CreatorFunctionContext, defineCreator } from \"@manifest-editor/creator-api\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/info-box-creator\": typeof infoBoxCreator;\n }\n }\n}\n\nexport const infoBoxCreator = defineCreator({\n id: \"@exhibitions/info-box-creator\",\n create: createInfoBox,\n label: \"Info box\",\n summary: \"A text panel for an exhibition\",\n icon: (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\">\n <title>Info box</title>\n <path\n fill=\"currentColor\"\n d=\"M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22\"\n />\n </svg>\n ),\n tags: [\"exhibition-slide\"],\n resourceType: \"Canvas\",\n resourceFields: [\"id\", \"type\", \"label\", \"height\", \"width\", \"items\"],\n supports: {\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n },\n});\n\ninterface InfoBoxPayload {\n label?: InternationalString;\n height?: number;\n width?: number;\n}\n\nasync function createInfoBox(data: InfoBoxPayload, ctx: CreatorFunctionContext) {\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const annotationsId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const annotation = {\n ...emptyAnnotation,\n id: ctx.generateId(\"annotation\", { id: canvasId, type: \"Canvas\" }),\n type: \"Annotation\",\n };\n\n const bodies = [\n await ctx.create(\n \"@manifest-editor/html-body-creator\",\n {\n language: \"en\",\n body: \"\",\n },\n { parent: { resource: annotation, property: \"body\" } },\n ),\n ];\n\n const annotationResource = ctx.embed({\n ...annotation,\n motivation: \"painting\",\n body: bodies,\n target: {\n type: \"SpecificResource\",\n source: { id: canvasId, type: \"Canvas\" },\n },\n });\n\n const annotationLongId = ctx.generateId(\"annotation\", {\n id: canvasId,\n type: \"Canvas\",\n });\n const longDescriptionResource = ctx.embed({\n id: annotationLongId,\n type: \"Annotation\",\n motivation: \"tagging\",\n body: [\n await ctx.create(\n \"@manifest-editor/html-body-creator\",\n {\n language: \"en\",\n body: \"\",\n },\n {\n parent: {\n resource: { id: annotationLongId, type: \"Annotation\" },\n property: \"body\",\n },\n },\n ),\n ],\n target: {\n type: \"SpecificResource\",\n source: { id: canvasId, type: \"Canvas\" },\n },\n });\n\n const page = ctx.embed({\n id: pageId,\n type: \"AnnotationPage\",\n items: [annotationResource],\n });\n\n const annotations = ctx.embed({\n id: annotationsId,\n type: \"AnnotationPage\",\n items: [longDescriptionResource],\n });\n\n return ctx.embed({\n ...emptyCanvas, // bug with placeholder canvas.\n id: canvasId,\n type: \"Canvas\",\n behavior: [\"w-4\", \"h-4\", \"info\"],\n label: data.label || undefined,\n height: data.height || 1000,\n width: data.width || 1000,\n items: [page],\n annotations: [annotations],\n });\n}\n","import { emptyCanvas } from \"@iiif/parser\";\nimport type { ContentResource } from \"@iiif/presentation-3\";\nimport { type CreatorFunctionContext, creatorHelper, defineCreator } from \"@manifest-editor/creator-api\";\nimport { type CreateVideoAnnotationPayload, videoAnnotation } from \"@manifest-editor/creators\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/video-creator\": typeof videoSlideCreator;\n }\n }\n}\n\nexport const videoSlideCreator = defineCreator({\n ...videoAnnotation,\n id: \"@exhibitions/video-creator\",\n create: createVideo,\n tags: [\"video\", \"exhibition-slide\"],\n label: \"Video\",\n summary: \"A video for an exhibition\",\n resourceType: \"Canvas\",\n resourceFields: [\"id\", \"type\", \"label\", \"height\", \"width\", \"items\"],\n supports: {\n parentTypes: [\"Manifest\"],\n parentFields: [\"items\"],\n },\n});\n\nasync function createVideo(data: CreateVideoAnnotationPayload, ctx: CreatorFunctionContext): any {\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n\n const annotation = await ctx.create(\"@manifest-editor/video-annotation\", data, {\n target: {\n id: canvasId,\n type: \"Canvas\",\n },\n targetType: \"Annotation\",\n parent: {\n resource: { id: pageId, type: \"AnnotationPage\" },\n property: \"items\",\n },\n });\n\n const page = ctx.embed({\n id: pageId,\n type: \"AnnotationPage\",\n items: [annotation],\n });\n\n // Add thumbnail?\n\n const createSlide = creatorHelper(ctx, \"Manifest\", \"items\", \"@exhibitions/image-slide-creator\");\n\n // 2. Pass that to an empty slide.\n return await createSlide({\n canvasId,\n height: data.height || 1080,\n width: data.width || 1920,\n duration: data.duration,\n type: \"bottom\", // default / left / right / bottom\n items: [annotation as any],\n });\n}\n","import { emptyCanvas } from \"@iiif/parser\";\nimport type { InternationalString } from \"@iiif/presentation-3\";\nimport { type CreatorFunctionContext, defineCreator } from \"@manifest-editor/creator-api\";\nimport { youTubeBodyCreator } from \"@manifest-editor/creators\";\nimport { getYouTubeId } from \"@manifest-editor/editors\";\n\ndeclare module \"@manifest-editor/creator-api\" {\n namespace IIIFManifestEditor {\n interface CreatorDefinitions {\n \"@exhibitions/youtube-creator\": typeof youtubeSlideCreator;\n }\n }\n}\n\nexport const youtubeSlideCreator = defineCreator({\n ...youTubeBodyCreator,\n id: \"@exhibitions/youtube-creator\",\n create: createYoutube,\n tags: [\"video\", \"exhibition-slide\"],\n label: \"YouTube\",\n summary: \"A YouTube for an exhibition\",\n});\n\ninterface YouTubeCreatePayload {\n youtubeUrl: string;\n label?: InternationalString;\n height?: number;\n width?: number;\n duration: number;\n}\n\nasync function createYoutube(data: YouTubeCreatePayload, ctx: CreatorFunctionContext) {\n const ytId = getYouTubeId(data.youtubeUrl);\n const canvasId = ctx.generateId(\"canvas\");\n const pageId = ctx.generateId(\"annotation-page\", {\n id: canvasId,\n type: \"Canvas\",\n });\n\n const annotation = await ctx.create(\"@manifest-editor/youtube\", data, {\n target: {\n id: canvasId,\n type: \"Canvas\",\n },\n targetType: \"Annotation\",\n parent: {\n resource: { id: pageId, type: \"AnnotationPage\" },\n property: \"items\",\n },\n });\n\n const page = ctx.embed({\n id: pageId,\n type: \"AnnotationPage\",\n items: [annotation],\n });\n\n const thumbnail = ctx.embed({\n id: `https://img.youtube.com/vi/${ytId}/maxresdefault.jpg`,\n type: \"Image\",\n format: \"image/jpeg\",\n width: 640,\n height: 360,\n });\n\n // Add thumbnail?\n\n return ctx.embed({\n ...emptyCanvas, // bug with placeholder canvas.\n id: canvasId,\n type: \"Canvas\",\n behavior: [\"w-12\", \"h-8\"],\n label: data.label || { en: [\"Untitled YouTube Video\"] },\n height: data.height || 1080,\n width: data.width || 1920,\n thumbnail: [thumbnail],\n items: [page],\n });\n}\n","import { useLayoutActions } from \"@manifest-editor/shell\";\nimport { Button } from \"react-aria-components\";\nimport { LocaleString, useManifest } from \"react-iiif-vault\";\n\nexport function ExhibitionContainer({ children }: { children: React.ReactNode }) {\n const manifest = useManifest();\n const { edit } = useLayoutActions();\n return (\n <div className=\"grid auto-rows-auto grid-cols-12 content-center justify-center gap-2 p-2\">\n <div className=\"col-span-12 row-span-2 text-black flex flex-col items-center justify-center\">\n <Button\n onPress={() => manifest && edit(manifest)}\n className=\"col-span-4 row-span-4 text-md text-left text-black hover:bg-slate-100 w-full flex items-center justify-center\"\n >\n <LocaleString className=\"block w-full text-left\">{manifest?.label}</LocaleString>\n </Button>\n </div>\n {children}\n </div>\n );\n}\n","import { LazyThumbnail } from \"@manifest-editor/components\";\nimport { useInStack } from \"@manifest-editor/editors\";\nimport { forwardRef } from \"react\";\nimport {\n LocaleString,\n useCanvas,\n useRenderingStrategy,\n} from \"react-iiif-vault\";\nimport { twMerge } from \"tailwind-merge\";\nimport { getClassName, getGridStats } from \"../helpers\";\n\nexport interface ExhibitionItemProps\n extends React.HTMLAttributes<HTMLDivElement> {\n isFirst: boolean;\n onClick: () => void;\n item: { id: string };\n}\n\nexport const ExhibitionItem = forwardRef<HTMLDivElement, ExhibitionItemProps>(\n function ExhibitionItem(\n { isFirst, item, children: divChildren, ...props },\n ref,\n ) {\n const canvas = useCanvas();\n const [strategy] = useRenderingStrategy();\n const behavior = canvas?.behavior || [];\n const currentCanvas = useInStack(\"Canvas\");\n const className = getClassName(canvas?.behavior, isFirst);\n const { isBottom, isImage, isInfo, isLeft } = getGridStats(\n canvas?.behavior,\n );\n\n const isSelected = currentCanvas?.resource.source?.id === canvas?.id;\n\n let children = null;\n if (isInfo) {\n children = (\n <div className=\"bg-black w-full h-full text-white max-h-40\">\n <div className=\"p-1.5 text-[4px]\">\n {strategy.type === \"textual-content\" ? (\n <LocaleString enableDangerouslySetInnerHTML>\n {strategy.items[0]?.text}\n </LocaleString>\n ) : null}\n </div>\n </div>\n );\n } else {\n children = (\n <div\n className={twMerge(\n \"flex h-full max-h-full min-h-0\",\n isLeft ? \"flex-row-reverse\" : isBottom ? \"flex-col\" : \"flex-row\",\n )}\n >\n <div className=\"flex-1 overflow-hidden relative justify-self-stretch\">\n <div className=\"absolute inset-0 w-full h-full\">\n <LazyThumbnail cover fade={false} />\n </div>\n </div>\n {isImage ? null : (\n <div\n className={`${isBottom ? \"min-h-3 w-full\" : \"w-1/3\"} flex-shrink-0 self-stretch p-2 text-white bg-black rounded`}\n >\n <div className=\"p-1.5 text-[4px]\">\n <LocaleString className=\"block mb-1 text-[5px]\">\n {canvas?.label}\n </LocaleString>\n <LocaleString>{canvas?.summary}</LocaleString>\n </div>\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n className={twMerge(\n className,\n \"bg-me-gray-700 overflow-hidden hover:ring-2 ring-me-primary-500 relative\",\n isSelected ? \"ring-2 ring-me-primary-500\" : \"\",\n )}\n {...props}\n >\n {children}\n {divChildren}\n </div>\n );\n },\n);\n","import {\n useCreator,\n useLayoutActions,\n useManifestEditor,\n} from \"@manifest-editor/shell\";\nimport { CanvasContext } from \"react-iiif-vault\";\nimport { ExhibitionContainer } from \"./ExhibitionContainer\";\nimport { ExhibitionItem } from \"./ExhibitionItem\";\n\nexport function ExhibitionGrid() {\n const { open } = useLayoutActions();\n const { structural, technical } = useManifestEditor();\n const [, canvasActions] = useCreator(\n { id: technical.id.get(), type: \"Manifest\" },\n \"items\",\n \"Manifest\",\n );\n const items = structural.items.get();\n\n return (\n <ExhibitionContainer>\n {items.map((item, index) => (\n <CanvasContext key={index} canvas={item.id}>\n <ExhibitionItem\n isFirst={index === 0}\n item={item}\n onClick={() => {\n open({ id: \"current-canvas\" });\n canvasActions.edit(item, index);\n }}\n />\n </CanvasContext>\n ))}\n </ExhibitionContainer>\n );\n}\n","import type { SVGProps } from \"react\";\n\nexport function ResizeHandleIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" height=\"1em\" width=\"1em\" {...props}>\n <title>Rearrange</title>\n <path fill=\"none\" d=\"M0 0h24v24H0z\" />\n <path d=\"M20 9H4v2h16V9zM4 15h16v-2H4v2z\" fill=\"currentColor\" />\n </svg>\n );\n}\n","import { useSortable } from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { MoreMenu } from \"@manifest-editor/components\";\nimport { AppDropdown, type AppDropdownItem } from \"@manifest-editor/editors\";\nimport { Button } from \"react-aria-components\";\nimport { ResizeHandleIcon } from \"../icons/ResizeHandleIcon\";\nimport { ExhibitionItem } from \"./ExhibitionItem\";\n\nexport function SortableExhibitionItem({\n isFirst,\n onClick,\n item,\n actions,\n}: {\n isFirst: boolean;\n onClick: () => void;\n item: { id: string };\n actions?: AppDropdownItem[];\n}) {\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({\n id: item.id,\n transition: {\n duration: 150,\n easing: \"cubic-bezier(0.25, 1, 0.5, 1)\",\n },\n });\n\n const style = {\n transform: CSS.Translate.toString(transform),\n transition,\n };\n\n return (\n <ExhibitionItem\n ref={setNodeRef}\n style={style}\n {...attributes}\n {...listeners}\n onClick={onClick}\n isFirst={isFirst}\n item={item}\n >\n <div className=\"absolute top-0.5 right-0.5 flex gap-0.5 items-stretch\">\n {actions?.length ? (\n <AppDropdown\n as={Button}\n className=\"bg-white p-1 text-2xl hover:text-me-500 aria-expanded:text-me-600 aria-expanded:bg-me-200 hover:bg-me-100 rounded-sm\"\n aria-label=\"Action menu\"\n items={actions}\n >\n <MoreMenu />\n </AppDropdown>\n ) : null}\n <div className=\"bg-white text-2xl h-8 flex items-center p-1 hover:text-me-500 hover:bg-me-100 rounded-sm\">\n <ResizeHandleIcon aria-label=\"Reorder item\" />\n </div>\n </div>\n </ExhibitionItem>\n );\n}\n","import {\n closestCenter,\n DndContext,\n type DragEndEvent,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport { restrictToParentElement } from \"@dnd-kit/modifiers\";\nimport { rectSortingStrategy, SortableContext, sortableKeyboardCoordinates } from \"@dnd-kit/sortable\";\nimport { createAppActions, useInStack } from \"@manifest-editor/editors\";\nimport { useEditCanvasItems } from \"@manifest-editor/manifest-preset/components\";\nimport { useCreator, useEditingStack, useLayoutActions, useManifestEditor } from \"@manifest-editor/shell\";\nimport { useCallback, useMemo } from \"react\";\nimport { CanvasContext, useManifest } from \"react-iiif-vault\";\nimport { ExhibitionContainer } from \"./ExhibitionContainer\";\nimport { SortableExhibitionItem } from \"./SortableExhibitionItem\";\n\nexport function SortableExhibitionGrid() {\n const manifest = useManifest();\n const { structural, technical } = useManifestEditor();\n const editingStack = useEditingStack();\n const editingCanvas = useInStack(\"Canvas\");\n\n const items = structural.items.get();\n const { open } = useLayoutActions();\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 5,\n },\n }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n const [, canvasActions] = useCreator({ id: technical.id.get(), type: \"Manifest\" }, \"items\", \"Manifest\");\n\n const onDragEnd = useCallback(\n (result: DragEndEvent) => {\n const { active, over } = result;\n if (over && active.id !== over.id) {\n structural.items.reorder(\n items.findIndex((item) => item.id === active.id),\n items.findIndex((item) => item.id === over.id),\n );\n }\n },\n [items, structural.items],\n );\n\n const canvasId = editingCanvas?.resource.source.id;\n const canvasIndex = canvasId ? items.findIndex((canv) => canv.id === canvasId) : -1;\n const prevCanvasIndex: number = canvasIndex && canvasIndex > 0 ? Number(canvasIndex - 1) : 0;\n\n function onDeleteCanvas() {\n editingStack.close(); // close the deleted canvas\n const newCanvases = structural.items.get(); // refresh canvases\n\n if (newCanvases && newCanvases.length > 0) {\n canvasActions.edit(newCanvases[prevCanvasIndex]);\n } else {\n canvasActions.edit(manifest);\n }\n }\n\n const createActions = useMemo(\n () => createAppActions(structural.items, onDeleteCanvas),\n [structural.items, onDeleteCanvas],\n );\n\n return (\n <ExhibitionContainer>\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragEnd={onDragEnd}\n modifiers={[restrictToParentElement]}\n >\n <SortableContext items={items} strategy={rectSortingStrategy}>\n {items.map((item, idx) => {\n if (!item) return null;\n return (\n <CanvasContext key={item.id} canvas={item.id}>\n <SortableExhibitionItem\n key={item.id}\n item={item}\n isFirst={idx === 0}\n onClick={() => {\n open({ id: \"current-canvas\" });\n canvasActions.edit(item, idx);\n }}\n actions={createActions(item, idx, manifest!)}\n />\n </CanvasContext>\n );\n })}\n </SortableContext>\n </DndContext>\n </ExhibitionContainer>\n );\n}\n","import { Sidebar, SidebarContent, SidebarHeader } from \"@manifest-editor/components\";\nimport { useToggleList } from \"@manifest-editor/editors\";\nimport { CanvasListView, CanvasListingIcon } from \"@manifest-editor/manifest-preset/components\";\nimport { type LayoutPanel, useCreator, useManifestEditor } from \"@manifest-editor/shell\";\nimport { ExhibitionGrid } from \"../components/ExhibitionGrid\";\nimport { SortableExhibitionGrid } from \"../components/SortableExhibitionGrid\";\n\nexport const exhibitionGridLeftPanel: LayoutPanel = {\n id: \"canvas-listing\", // We are overriding the default canvas listing panel\n label: \"Exhibition grid\",\n icon: <ExhibitionGridIcon />,\n render: () => <ExhibitionGridLeftPanel />,\n options: {\n minWidth: 350,\n maxWidth: 350,\n },\n};\n\nfunction ExhibitionGridLeftPanel() {\n const { technical } = useManifestEditor();\n const manifestId = technical.id.get();\n const manifest = { id: manifestId, type: \"Manifest\" };\n const [canCreateCanvas, canvasActions] = useCreator(manifest, \"items\", \"Canvas\", undefined, {isPainting: true});\n const [toggled, toggle] = useToggleList();\n\n return (\n <Sidebar>\n <SidebarHeader\n title={\"Exhibition\"}\n actions={[\n {\n icon: toggled.list ? <CanvasListingIcon className=\"text-2xl\" /> : <ExhibitionGridIcon />,\n title: toggled.list ? \"List view\" : \"Grid view\",\n onClick: () => toggle(\"list\"),\n },\n {\n icon: <ListEditIcon />,\n title: \"Edit slides\",\n toggled: toggled.editing,\n onClick: () => toggle(\"editing\"),\n },\n {\n icon: <NewSlideIcon />,\n title: \"Add new slide\",\n disabled: !canCreateCanvas,\n onClick: () => canvasActions.createFiltered(\"exhibition-slide\"),\n },\n ]}\n />\n <SidebarContent>\n {toggled.list ? (\n <CanvasListView isEditing={toggled.editing} />\n ) : toggled.editing ? (\n <SortableExhibitionGrid />\n ) : (\n <ExhibitionGrid />\n )}\n </SidebarContent>\n </Sidebar>\n );\n}\n\nfunction ExhibitionGridIcon() {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"currentColor\" viewBox=\"0 -960 960 960\">\n <title>Exhibition grid</title>\n <path d=\"M600-160v-280h280v280H600ZM440-520v-280h440v280H440ZM80-160v-280h440v280H80Zm0-360v-280h280v280H80Zm440-80h280v-120H520v120ZM160-240h280v-120H160v120Zm520 0h120v-120H680v120ZM160-600h120v-120H160v120Zm360 0Zm-80 240Zm240 0ZM280-600Z\" />\n </svg>\n );\n}\nfunction ListEditIcon() {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 0 24 24\" width=\"24\">\n <title>Edit slides</title>\n <path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n <path d=\"M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z\" />\n </svg>\n );\n}\nfunction NewSlideIcon() {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" fill=\"currentColor\" viewBox=\"0 -960 960 960\">\n <title>Add new slide</title>\n <path d=\"M160-240v-480 480Zm80-80v-200h360v200H240Zm-80 160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v240h-80v-240H160v480h360v80H160Zm500-320v-100H360v-60h360v160h-60Zm60 400v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z\" />\n </svg>\n );\n}\n","import { getValue } from \"@iiif/helpers\";\nimport { ActionButton } from \"@manifest-editor/components\";\nimport { useEditor } from \"@manifest-editor/shell\";\n\nexport function ExhibitionItemConversion() {\n const editor = useEditor();\n\n const applyDefaultSettings = () => {\n const canvasWidth = editor.technical.width.get();\n const canvasHeight = editor.technical.height.get();\n const summary = editor.descriptive.summary;\n const behaviors = editor.technical.behavior;\n\n const behaviorsToAdd = behaviors.get();\n behaviorsToAdd.push(\"w-12\");\n\n const height = Math.max(1, Math.min(12, Math.round((canvasWidth / canvasHeight) * 12)));\n behaviorsToAdd.push(`h-${height}`);\n // Implementation of applying default settings\n // 1. Add behavior of \"w-12\"\n // 2. Add behavior of \"h-1\" to \"h-12\" based on canvas height\n // 3. Add an empty summary\n if (!getValue(summary.get())) {\n summary.set({ en: [\"Summary of image\"] });\n }\n\n editor.technical.behavior.set(behaviorsToAdd);\n };\n\n return (\n <div className=\"flex flex-col items-center gap-4 border-me-100 border-2 p-4 rounded\">\n This canvas was not created in the exhibition editor. Do you want to apply default settings?\n <ActionButton onPress={() => applyDefaultSettings()}>Apply defaults</ActionButton>\n </div>\n );\n}\n","import { Sidebar, SidebarContent } from \"@manifest-editor/components\";\nimport {\n DimensionsTriplet,\n InputContainer,\n LanguageMapEditor,\n LinkingPropertyList,\n PaintingAnnotationList,\n createAppActions,\n} from \"@manifest-editor/editors\";\nimport { type EditorDefinition, ResourceEditingProvider, useEditingResource, useEditor } from \"@manifest-editor/shell\";\nimport { AnnotationPageContext, useCanvas } from \"react-iiif-vault\";\nimport { AspectRatioWarning } from \"../components/AspectRatioWarning\";\nimport { getGridStats, isExhibitionItem } from \"../helpers\";\nimport { ExhibitionItemConversion } from \"../components/ExhibitionItemConversion\";\n\nexport const exhibitionCanvasEditor: EditorDefinition = {\n id: \"@exhibition/right-panel-editor\",\n supports: {\n edit: true,\n properties: [\"label\", \"summary\"],\n resourceTypes: [\"Canvas\"],\n custom: ({ resource }, vault) => {\n const full = vault.get(resource);\n const stats = getGridStats(full.behavior);\n\n if (full.type === \"Canvas\" && !stats.isInfo) {\n return true;\n }\n return false;\n },\n },\n label: \"Exhibition\",\n component: () => <ExhibitionRightPanel />,\n};\n\nfunction ExhibitionRightPanel() {\n const canvas = useCanvas();\n const resource = useEditingResource();\n const { structural, descriptive } = useEditor();\n const { items } = structural;\n const { thumbnail } = descriptive;\n const pages = items.get();\n const page = pages[0];\n\n const isAnExhibitionCanvas = isExhibitionItem(canvas);\n\n if (!canvas || !page || !resource) return <div className=\"p-8\">Canvas, page, or resource not found</div>;\n\n return (\n <Sidebar>\n <SidebarContent padding>\n <ResourceEditingProvider resource={canvas}>\n {!isAnExhibitionCanvas ? <ExhibitionItemConversion /> : null}\n\n <LanguageMapEditor dispatchType=\"label\" disableMultiline disallowHTML />\n\n <LinkingPropertyList\n containerId={thumbnail.containerId()}\n label=\"Thumbnail\"\n property=\"thumbnail\"\n items={thumbnail.get()}\n singleMode\n reorder={(ctx) => thumbnail.reorder(ctx.startIndex, ctx.endIndex)}\n createActions={createAppActions(thumbnail)}\n creationType=\"ContentResource\"\n emptyLabel=\"No thumbnail\"\n parent={resource?.resource}\n />\n\n <AnnotationPageContext annotationPage={page.id}>\n <PaintingAnnotationList createFilter=\"image\" />\n </AnnotationPageContext>\n </ResourceEditingProvider>\n </SidebarContent>\n </Sidebar>\n );\n}\n","import { Sidebar, SidebarContent } from \"@manifest-editor/components\";\nimport { LanguageMapEditor } from \"@manifest-editor/editors\";\nimport { type EditorDefinition, ResourceEditingProvider } from \"@manifest-editor/shell\";\nimport { useCanvas } from \"react-iiif-vault\";\nimport { getGridStats } from \"../helpers\";\n\nexport const exhibitionSummaryEdtior: EditorDefinition = {\n id: \"@exhibition/summary-editor\",\n supports: {\n edit: true,\n properties: [\"summary\"],\n resourceTypes: [\"Canvas\"],\n custom: ({ resource }, vault) => {\n const full = vault.get(resource);\n const stats = getGridStats(full.behavior);\n\n if (full.type === \"Canvas\" && !stats.isInfo) {\n return true;\n }\n return false;\n },\n },\n label: \"Summary\",\n component: () => <ExhibitionRightPanel />,\n};\n\nfunction ExhibitionRightPanel() {\n const canvas = useCanvas();\n if (!canvas) return null;\n\n return (\n <Sidebar>\n <SidebarContent padding>\n <ResourceEditingProvider resource={canvas}>\n <LanguageMapEditor dispatchType=\"label\" />\n <LanguageMapEditor dispatchType=\"summary\" />\n </ResourceEditingProvider>\n </SidebarContent>\n </Sidebar>\n );\n}\n","export function CheckIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n {/* Icon from Google Material Icons by Material Design Authors - https://github.com/material-icons/material-icons/blob/master/LICENSE */}\n <path fill=\"currentColor\" d=\"M9 16.17L4.83 12l-1.42 1.41L9 19L21 7l-1.41-1.41z\" />\n </svg>\n );\n}\n","import { ActionButton, HTMLEditor } from \"@manifest-editor/components\";\nimport {\n useCurrentAnnotationActions,\n useCurrentAnnotationMetadata,\n} from \"react-iiif-vault\";\nimport { CheckIcon } from \"../icons/CheckIcon\";\nimport { useConfig } from \"@manifest-editor/shell\";\nimport { AnnotationPopUpSwitcherButton } from \"@manifest-editor/editors\";\n\nexport const DEFAULT_TOUR_STEP_HTML = \"<h2>New step</h2><p>Description</p>\";\n\nexport function ExhibitionTourStepPopup() {\n const { saveAnnotation } = useCurrentAnnotationActions();\n const [metadata, setMetadata] = useCurrentAnnotationMetadata();\n const { editorFeatureFlags } = useConfig();\n const { annotationPopups } = editorFeatureFlags;\n\n if (!annotationPopups) {\n return (\n <div className=\"flex gap-2\">\n <ActionButton primary onPress={() => saveAnnotation()}>\n <CheckIcon /> Finish editing\n </ActionButton>\n <AnnotationPopUpSwitcherButton />\n </div>\n );\n }\n\n return (\n <div className=\"bg-white shadow-md rounded-lg\">\n <div className=\"prose-headings:mt-1 overflow-y-auto rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500\">\n <HTMLEditor\n className=\"border-none\"\n value={metadata.bodyValue || DEFAULT_TOUR_STEP_HTML}\n onChange={(newValue) => setMetadata({ bodyValue: newValue })}\n />\n </div>\n\n <div className=\"flex gap-2 p-3\">\n <ActionButton primary onPress={() => saveAnnotation()}>\n <CheckIcon /> Finish editing\n </ActionButton>\n <AnnotationPopUpSwitcherButton />\n </div>\n </div>\n );\n}\n","import {\n ActionButton,\n HTMLEditor,\n DeleteIcon,\n TargetIcon,\n} from \"@manifest-editor/components\";\nimport { useAtlasStore, useConfig } from \"@manifest-editor/shell\";\nimport {\n useCurrentAnnotationActions,\n useCurrentAnnotationMetadata,\n} from \"react-iiif-vault\";\nimport { useStore } from \"zustand\";\nimport { CheckIcon } from \"../icons/CheckIcon\";\nimport { DEFAULT_TOUR_STEP_HTML } from \"./ExhibitionTourStepPopup\";\nimport { AnnotationPopUpSwitcherButton } from \"@manifest-editor/editors\";\n\nexport function PendingTourStepAnnotation() {\n const store = useAtlasStore();\n const polygon = useStore(store, (s) => s.polygon);\n const [metadata, setMetadata] = useCurrentAnnotationMetadata();\n const { editorFeatureFlags } = useConfig();\n const { annotationPopups } = editorFeatureFlags;\n const { cancelRequest, saveAnnotation } = useCurrentAnnotationActions();\n\n return (\n <div className=\"border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative\">\n <div className=\"bg-me-primary-500 text-white p-2 m-1 rounded flex gap-2\">\n <TargetIcon />\n Draw a box on the canvas\n </div>\n {annotationPopups ? (\n <div className=\"relative p-3 line-clamp-3 prose-p:text-slate-600\">\n <div className=\"prose-headings:mt-1 prose-headings:mb-1 prose-sm\">\n <div\n dangerouslySetInnerHTML={{\n __html: metadata.bodyValue || DEFAULT_TOUR_STEP_HTML,\n }}\n />\n </div>\n </div>\n ) : (\n <HTMLEditor\n className=\"border-none\"\n value={metadata.bodyValue || DEFAULT_TOUR_STEP_HTML}\n onChange={(newValue) => setMetadata({ bodyValue: newValue })}\n />\n )}\n <div className=\"flex gap-2 p-3\">\n <ActionButton\n isDisabled={polygon?.points.length === 0}\n onPress={() => saveAnnotation()}\n >\n <CheckIcon /> Finish editing\n </ActionButton>\n\n <ActionButton className=\"gap-2 flex\" onPress={() => cancelRequest()}>\n <DeleteIcon /> Delete\n </ActionButton>\n\n <AnnotationPopUpSwitcherButton />\n </div>\n </div>\n );\n}\n","import { ActionButton, AnnotationPopInIcon, AnnotationPopOutIcon } from \"@manifest-editor/components\";\nimport { useConfig, useSaveConfig } from \"@manifest-editor/shell\";\n\nexport function ActionButtonPopupSwitcher() {\n const { editorFeatureFlags } = useConfig();\n const { annotationPopups } = editorFeatureFlags;\n const saveConfig = useSaveConfig();\n\n return (\n <ActionButton\n className=\"ml-auto\"\n onPress={() => saveConfig({ editorFeatureFlags: { ...editorFeatureFlags, annotationPopups: annotationPopups ? false : true } })}\n >\n {annotationPopups ? <AnnotationPopInIcon /> : <AnnotationPopOutIcon />}\n </ActionButton>\n );\n}\n","import {\n ActionButton,\n DeleteIcon,\n EditTextIcon,\n HTMLAnnotationBodyRender,\n} from \"@manifest-editor/components\";\nimport {\n AnnotationPopUpSwitcherButton,\n HTMLAnnotationEditor,\n useAnnotationEditor,\n} from \"@manifest-editor/editors\";\nimport { useContext, useEffect, useState } from \"react\";\nimport { CheckIcon } from \"../icons/CheckIcon\";\nimport { ResourceEditingReactContext, useConfig } from \"@manifest-editor/shell\";\nimport {\n AnnotationContext,\n useAnnotation,\n useCurrentAnnotationActions,\n} from \"react-iiif-vault\";\nimport { ActionButtonPopupSwitcher } from \"./ActionButtonPopupSwitcher\";\n\nexport function TourNormalAnnotationEditor({\n highlightProps,\n}: {\n highlightProps: any;\n}) {\n const value = useContext(ResourceEditingReactContext);\n const annotation = useAnnotation();\n const { editorFeatureFlags } = useConfig();\n const { annotationPopups } = editorFeatureFlags;\n\n const {\n isPending,\n cancelRequest,\n busy,\n requestAnnotationFromTarget,\n deleteAnnotation,\n } = useAnnotationEditor({\n annotationPopup: (\n <AnnotationContext annotation={annotation!.id}>\n <ResourceEditingReactContext.Provider value={value}>\n <TourAnnotationPopupEditor />\n </ResourceEditingReactContext.Provider>\n </AnnotationContext>\n ),\n });\n\n const [isOpen, setIsOpen] = useState(false);\n\n useEffect(() => {\n if (isOpen && !isPending) {\n setIsOpen(true);\n }\n }, [isPending, isOpen]);\n\n // This is an annotatino within a page.\n return (\n <div\n {...highlightProps}\n className=\"border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative\"\n >\n <div className=\"relative\">\n {isOpen && !annotationPopups ? (\n <HTMLAnnotationEditor className=\"border-none\" />\n ) : (\n <HTMLAnnotationBodyRender\n className=\"px-3 pt-3 line-clamp-3 prose-p:text-slate-600\"\n locale=\"en\"\n />\n )}\n </div>\n <div className=\"flex gap-2 p-2\">\n {isOpen && isPending ? (\n <>\n <ActionButton\n primary\n onPress={() => {\n setIsOpen(false);\n cancelRequest();\n }}\n >\n <CheckIcon /> Finish editing\n </ActionButton>\n <AnnotationPopUpSwitcherButton />\n </>\n ) : (\n <ActionButton\n isDisabled={busy}\n onPress={() => {\n setIsOpen(true);\n requestAnnotationFromTarget().then(() => {\n setIsOpen(false);\n });\n }}\n >\n <EditTextIcon /> Edit\n </ActionButton>\n )}\n <ActionButton className=\"gap-2 flex\" onPress={() => deleteAnnotation()}>\n <DeleteIcon /> Delete\n </ActionButton>\n </div>\n <div className=\"absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0\" />\n </div>\n );\n}\n\nfunction TourAnnotationPopupEditor() {\n const { editorFeatureFlags } = useConfig();\n const { annotationPopups } = editorFeatureFlags;\n const { saveAnnotation } = useCurrentAnnotationActions();\n\n if (!annotationPopups) {\n return (\n <div className=\"flex gap-2\">\n <ActionButton primary onPress={() => saveAnnotation()}>\n <CheckIcon /> Finish editing\n </ActionButton>\n <AnnotationPopUpSwitcherButton />\n </div>\n );\n }\n\n return (\n <div className=\"bg-white shadow-md rounded-lg relative max-h-[50vh] overflow-y-auto\">\n <div className=\"prose-headings:mt-1 rounded prose-headings:mb-1 prose-sm focus-within:ring-1 focus-within:ring-me-primary-500\">\n <HTMLAnnotationEditor className=\"border-none\" />\n </div>\n\n <div className=\"flex gap-2 p-2 sticky bottom-0 z-50 bg-white\">\n <ActionButton\n primary\n onPress={() => {\n saveAnnotation();\n }}\n >\n <CheckIcon /> Finish editing\n </ActionButton>\n <ActionButtonPopupSwitcher />\n </div>\n </div>\n );\n}\n","import { ActionButton, DeleteIcon, EditTextIcon } from \"@manifest-editor/components\";\nimport { LanguageMapEditor } from \"@manifest-editor/editors\";\nimport { useGenericEditor, useLayoutActions } from \"@manifest-editor/shell\";\nimport { useState } from \"react\";\nimport { LocaleString, useAnnotation, useAnnotationPage } from \"react-iiif-vault\";\nimport { CheckIcon } from \"../icons/CheckIcon\";\n\nexport function TourPaintingAnnotationEditor({\n originalAnnotationId,\n highlightProps,\n}: {\n originalAnnotationId?: string;\n highlightProps: any;\n}) {\n const page = useAnnotationPage();\n const pageEditor = useGenericEditor(page);\n const annotation = useAnnotation();\n const { edit } = useLayoutActions();\n const [isOpen, setIsOpen] = useState(false);\n\n const deleteAnnotation = () => {\n if (originalAnnotationId && confirm(\"Are you sure you want to delete this annotation?\")) {\n // Delete the original annotation.\n const index = pageEditor.structural.items\n .getWithoutTracking()\n .findIndex((item) => item.id === originalAnnotationId);\n pageEditor.structural.items.deleteAtIndex(index);\n }\n };\n\n return (\n <div {...highlightProps} className=\"border border-gray-300 hover:border-me-500 shadow-sm rounded bg-white relative\">\n <div className=\"flex gap-2 mb-2 p-3\">\n <div className=\"flex-1 min-w-0\">\n {isOpen ? (\n <>\n <h3 className=\"text-lg font-semibold border-b pt-1 pb-2 mb-2\">Edit step</h3>\n <LanguageMapEditor dispatchType=\"label\" />\n <LanguageMapEditor dispatchType=\"summary\" />\n </>\n ) : (\n <>\n <LocaleString\n as=\"div\"\n defaultText={(<span className=\"opacity-50\">Untitled</span>) as any}\n className=\"whitespace-nowrap overflow-ellipsis w-full overflow-x-hidden\"\n >\n {annotation?.label}\n </LocaleString>\n <LocaleString className=\"text-gray-500 text-sm bg-white line-clamp-2\" as=\"div\">\n {annotation?.summary}\n </LocaleString>\n </>\n )}\n </div>\n </div>\n\n <div className=\"flex gap-2 p-2\">\n {isOpen ? (\n <ActionButton onPress={() => setIsOpen(false)}>\n <CheckIcon /> Finish editing\n </ActionButton>\n ) : (\n <ActionButton onPress={() => setIsOpen(true)}>\n <EditTextIcon /> Edit body\n </ActionButton>\n )}\n\n <ActionButton onPress={() => edit(annotation!)}>Edit annotation</ActionButton>\n\n <ActionButton className=\"gap-2 flex\" onPress={() => deleteAnnotation()}>\n <DeleteIcon /> Delete\n </ActionButton>\n </div>\n <div className=\"absolute -bottom-5 left-5 h-5 border-l-2 border-gray-300 w-0\" />\n </div>\n );\n}\n","import { useAnnotationInfo } from \"@manifest-editor/editors\";\nimport { ResourceEditingProvider } from \"@manifest-editor/shell\";\nimport { useMemo } from \"react\";\nimport { AnnotationContext } from \"react-iiif-vault\";\nimport { TourNormalAnnotationEditor } from \"./TourNormalAnnotationEditor\";\nimport { TourPaintingAnnotationEditor } from \"./TourPaintingAnnotationEditor\";\n\nexport function TourAnnotationEditor() {\n const [annotation, { annotationTarget, highlightProps }] =\n useAnnotationInfo();\n\n const resource = useMemo(() => {\n if (annotationTarget) {\n return { id: annotationTarget, type: \"Annotation\" };\n }\n return { id: annotation?.id as string, type: \"Annotation\" };\n }, [annotation?.id, annotationTarget]);\n\n if (annotationTarget) {\n return (\n <ResourceEditingProvider resource={resource}>\n <AnnotationContext annotation={annotationTarget}>\n <TourPaintingAnnotationEditor\n originalAnnotationId={annotation?.id}\n highlightProps={highlightProps}\n />\n </AnnotationContext>\n </ResourceEditingProvider>\n );\n }\n\n return (\n <ResourceEditingProvider resource={resource}>\n <TourNormalAnnotationEditor highlightProps={highlightProps} />\n </ResourceEditingProvider>\n );\n}\n","import { ReorderList } from \"@manifest-editor/editors\";\nimport { useGenericEditor } from \"@manifest-editor/shell\";\nimport { AnnotationContext, useAnnotationPage } from \"react-iiif-vault\";\nimport { TourAnnotationEditor } from \"./TourAnnotationEditor\";\n\nexport function TourAnnotationPageEditor({\n reorderable = false,\n}: { reorderable?: boolean }) {\n const page = useAnnotationPage();\n const editor = useGenericEditor(page);\n\n if (!page) {\n return null;\n }\n\n if (!reorderable) {\n return (\n <>\n {page.items.map((annotation) => (\n <AnnotationContext annotation={annotation.id} key={annotation.id}>\n <TourAnnotationEditor />\n </AnnotationContext>\n ))}\n </>\n );\n }\n\n return (\n <>\n <ReorderList\n id={page.id}\n marginBottom=\"0.5em\"\n items={page.items || []}\n inlineHandle={false}\n reorder={({ startIndex, endIndex }) =>\n editor.structural.items.reorder(startIndex, endIndex)\n }\n renderItem={(ref, index) => (\n <AnnotationContext annotation={ref.id as string}>\n <TourAnnotationEditor />\n </AnnotationContext>\n )}\n />\n </>\n );\n}\n","import type { InternationalString } from \"@iiif/presentation-3\";\nimport { ActionButton, Sidebar, SidebarContent } from \"@manifest-editor/components\";\nimport { PromptToAddPaintingAnnotations } from \"@manifest-editor/editors\";\nimport {\n type EditorDefinition,\n ResourceEditingProvider,\n useConfig,\n useCreator,\n useGenericEditor,\n useInlineCreator,\n} from \"@manifest-editor/shell\";\nimport { useState } from \"react\";\nimport { Button } from \"react-aria-components\";\nimport { AnnotationPageContext, useCanvas, useRequestAnnotation } from \"react-iiif-vault\";\nimport { ExhibitionTourStepPopup } from \"../components/ExhibitionTourStepPopup\";\nimport { PendingTourStepAnnotation } from \"../components/PendingTourStepAnnotation\";\nimport { TourAnnotationPageEditor } from \"../components/TourAnnotationPageEditor\";\nimport { getGridStats } from \"../helpers\";\n\nexport const exhibitionTourSteps: EditorDefinition = {\n id: \"@exhibition/tour-steps\",\n supports: {\n edit: true,\n properties: [\"annotations\"],\n resourceTypes: [\"Canvas\"],\n custom: ({ resource }, vault) => {\n const full = vault.get(resource);\n const stats = getGridStats(full.behavior);\n\n if (full.type === \"Canvas\" && !stats.isInfo) {\n return true;\n }\n return false;\n },\n },\n label: \"Tour steps\",\n component: () => <ExhibitionRightPanelOptionalPage />,\n};\n\nfunction ExhibitionRightPanelOptionalPage() {\n const canvas = useCanvas();\n const firstAnnotationPage = canvas?.annotations[0];\n const itemsAnnotationPage = canvas?.items[0];\n\n // @todo create annotation page?\n if (!firstAnnotationPage || !canvas || !itemsAnnotationPage) {\n return <PromptCreationOfTourSteps />;\n }\n\n return <ExhibitionRightPanel />;\n}\n\nfunction PromptCreationOfTourSteps() {\n const canvas = useCanvas();\n const creator = useInlineCreator();\n\n const createEmptyAnnotationPage = () => {\n if (!canvas) return;\n creator.create(\n \"@manifest-editor/empty-annotation-page\",\n {\n label: { en: [\"Tour steps\"] },\n },\n {\n target: {\n id: canvas.id,\n type: \"Canvas\",\n },\n targetType: \"AnnotationPage\",\n parent: {\n property: \"annotations\",\n resource: {\n id: canvas.id,\n type: \"Canvas\",\n },\n },\n },\n );\n };\n\n return (\n <div className=\"flex flex-col items-center justify-center p-4\">\n <div className=\"p-4 opacity-50 text-center\">This image does not yet have a tour.</div>\n\n <Button\n className=\"border w-full disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500\"\n onPress={() => createEmptyAnnotationPage()}\n >\n Create Tour\n </Button>\n </div>\n );\n}\n\nfunction ExhibitionRightPanel() {\n const canvas = useCanvas();\n const firstAnnotationPage = canvas?.annotations[0];\n const itemsAnnotationPage = canvas?.items[0];\n const editor = useGenericEditor(firstAnnotationPage);\n const creator = useInlineCreator();\n const [reorderable, setReorderable] = useState(false);\n\n const { requestAnnotation, isPending, busy, cancelRequest, completeRequest } = useRequestAnnotation({\n onSuccess: (resp) => {\n const bodyValue = resp.metadata.bodyValue || \"\";\n\n if (!resp.cancelled && resp.target && firstAnnotationPage) {\n creator.create(\n \"@manifest-editor/html-annotation\",\n {\n label: { en: [\"Tour step\"] },\n body: {\n en: [bodyValue || \"<h2>New step</h2><p>Description</p>\"],\n },\n motivation: \"tagging\",\n } as {\n label?: InternationalString;\n body: InternationalString;\n motivation?: string;\n height?: number;\n width?: number;\n },\n {\n target: {\n id: canvas.id,\n type: \"Canvas\",\n },\n targetType: \"Annotation\",\n parent: {\n property: \"items\",\n resource: {\n id: firstAnnotationPage.id,\n type: \"AnnotationPage\",\n },\n },\n initialData: {\n selector: resp,\n },\n },\n );\n }\n },\n });\n\n if (!canvas) return null;\n if (!firstAnnotationPage) {\n return <div>No annotation page - create one?</div>;\n }\n\n return (\n <Sidebar>\n <SidebarContent padding>\n <div className=\"flex gap-4 border-b pt-4 pb-2 mb-2\">\n <h2 className=\"text-lg font-semibold flex-1\">Tour steps</h2>\n <ActionButton onPress={() => setReorderable((r) => !r)}>{reorderable ? \"Done\" : \"Reorder\"}</ActionButton>\n </div>\n\n <ResourceEditingProvider resource={canvas}>\n <AnnotationPageContext annotationPage={firstAnnotationPage.id}>\n <div className=\"flex flex-col gap-4\">\n <TourAnnotationPageEditor reorderable={reorderable} />\n\n {!busy ? (\n isPending ? (\n <PendingTourStepAnnotation />\n ) : (\n <Button\n onPress={() =>\n requestAnnotation({\n type: \"box\",\n annotationPopup: <ExhibitionTourStepPopup />,\n })\n }\n className=\"border disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500\"\n >\n + Add new step\n </Button>\n )\n ) : null}\n </div>\n {itemsAnnotationPage /*&& hasMultiplePainting*/ ? (\n <>\n <h3 className=\"text-md border-b pt-4 pb-2 mb-2\">Available tour steps from images</h3>\n <PromptToAddPaintingAnnotations\n painting={itemsAnnotationPage}\n page={editor.ref()}\n canvasId={canvas.id}\n />\n </>\n ) : null}\n </AnnotationPageContext>\n </ResourceEditingProvider>\n </SidebarContent>\n </Sidebar>\n );\n}\n","import { useCanvas } from \"react-iiif-vault\";\nimport invariant from \"tiny-invariant\";\nimport { getHeightWidthRatio } from \"../helpers\";\n\nexport function AspectRatioWarning() {\n const canvas = useCanvas();\n invariant(canvas);\n\n const ratio =\n canvas.width && canvas.height ? canvas.width / canvas.height : 0;\n const target = getHeightWidthRatio(canvas.behavior || []);\n\n if (Math.abs(ratio - target.ratio) < 0.01) return null;\n\n return (\n <div className=\"p-2 rounded bg-me-100\">\n <div className=\"text-me-700-500\">Aspect ratio warning</div>\n <div className=\"text-sm text-black/60\">\n The aspect ratio of this canvas is {ratio.toFixed(2)} but the target\n aspect ratio is {target.ratio.toFixed(2)}. Some parts of this image may\n be cropped.\n <div className=\"relative h-32 w-full mt-2\">\n <div\n className=\"bg-[red] left-0 top-0 z-2 opacity-50 max-w-32 max-h-32\"\n style={{ aspectRatio: ratio.toFixed(2) }}\n >\n <div\n className=\"asbolute bg-[white] left-0 top-0 z-1 opacity-50 max-w-32 max-h-32\"\n style={{ aspectRatio: target.ratio }}\n />\n </div>\n </div>\n </div>\n </div>\n );\n}\n","import { Sidebar, SidebarContent, SidebarHeader } from \"@manifest-editor/components\";\nimport {\n BehaviorEditor,\n type BehaviorEditorProps,\n DimensionsTriplet,\n InputContainer,\n useInStack,\n} from \"@manifest-editor/editors\";\nimport { type EditorDefinition, useEditor } from \"@manifest-editor/shell\";\nimport { useState } from \"react\";\nimport { AspectRatioWarning } from \"../components/AspectRatioWarning\";\n\nexport const customBehaviourEditor: EditorDefinition = {\n component: () => <SlideBehavioursPanel />,\n supports: {\n edit: true,\n resourceTypes: [\"Canvas\"],\n properties: [\"behavior\"],\n },\n id: \"slide-behaviors\",\n label: \"Layout\",\n tabs: {\n showTitle: true,\n },\n};\n\nconst exhibitionConfigs: BehaviorEditorProps[\"configs\"] = [\n {\n id: \"layout\",\n type: \"choice\",\n label: { en: [\"Layout\"] },\n initialOpen: true,\n items: [\n {\n label: { en: [\"Text on left\"] },\n value: \"left\",\n },\n {\n label: { en: [\"Text on right\"] },\n value: \"right\",\n },\n {\n label: { en: [\"Text on bottom\"] },\n value: \"bottom\",\n },\n {\n label: { en: [\"Text on top\"] },\n value: \"top\",\n },\n {\n label: { en: [\"Only image\"] },\n value: \"image\",\n },\n ],\n },\n {\n id: \"floating\",\n type: \"choice\",\n label: { en: [\"Floating\"] },\n initialOpen: false,\n addNone: true,\n groupBehavior: \"floating\",\n items: [\n {\n label: { en: [\"Float top left\"] },\n value: \"float-top-left\",\n },\n {\n label: { en: [\"Float top right\"] },\n value: \"float-top-right\",\n },\n {\n label: { en: [\"Float bottom left\"] },\n value: \"float-bottom-left\",\n },\n {\n label: { en: [\"Float bottom right\"] },\n value: \"float-bottom-right\",\n },\n ],\n },\n {\n id: \"size\",\n component: (existing, setBehaviors) => <EditSize behaviors={existing} setBehaviors={setBehaviors} />,\n label: { en: [\"Size\"] },\n type: \"custom\",\n initialOpen: true,\n supports: (b) => b.startsWith(\"w-\") || b.startsWith(\"h-\"),\n },\n];\n\nexport function RoundGridIcon(props: { index: number } & React.SVGProps<SVGSVGElement>) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" {...props}>\n {/* Icon from Google Material Icons by Material Design Authors - https://github.com/material-icons/material-icons/blob/master/LICENSE */}\n <path\n fill={props.index === 0 ? \"currentColor\" : \"none\"}\n stroke=\"currentColor\"\n d=\"M5 11h4c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2\"\n />\n <path\n fill={props.index === 1 ? \"currentColor\" : \"none\"}\n stroke=\"currentColor\"\n d=\"M5 21h4c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2\"\n />\n <path\n fill={props.index === 2 ? \"currentColor\" : \"none\"}\n stroke=\"currentColor\"\n d=\"M13 5v4c0 1.1.9 2 2 2h4c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-4c-1.1 0-2 .9-2 2\"\n />\n <path\n fill={props.index === 3 ? \"currentColor\" : \"none\"}\n stroke=\"currentColor\"\n d=\"M15 21h4c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2h-4c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2\"\n />\n </svg>\n );\n}\n\nfunction parseBehaviors(items: string[]) {\n let width = 0;\n let height = 0;\n\n for (const item of items) {\n if (item.startsWith(\"w-\")) {\n width = Number.parseInt(item.slice(2));\n }\n if (item.startsWith(\"h-\")) {\n height = Number.parseInt(item.slice(2));\n }\n }\n\n return {\n width,\n height,\n };\n}\n\nfunction EditSize({ behaviors, setBehaviors }: { behaviors: string[]; setBehaviors: (behaviors: string[]) => void }) {\n const { width, height } = parseBehaviors(behaviors);\n const [hoverPosition, setHoverPosition] = useState({ x: -1, y: -1 });\n\n const setBehavior = (w: number, h: number) => {\n const newBehaviors = behaviors.filter((b) => {\n return !b.startsWith(\"w-\") && !b.startsWith(\"h-\");\n });\n\n newBehaviors.push(`w-${w}`);\n newBehaviors.push(`h-${h}`);\n\n setBehaviors(newBehaviors);\n };\n\n const cells = Array.from({ length: 144 }, (_, i) => {\n const x = i % 12;\n const y = Math.floor(i / 12);\n const hovered = hoverPosition.x >= x && hoverPosition.y >= y;\n const selected = x < width && y < height;\n const hoveredAndSelected = hovered && selected;\n\n let bgClass = \"bg-gray-200\";\n if (hovered) {\n bgClass = \"bg-me-200\";\n }\n if (selected) {\n bgClass = \"bg-me-500\";\n }\n if (hoveredAndSelected) {\n bgClass = \"bg-me-400\";\n }\n\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>\n <div\n key={i}\n className={`flex aspect-square rounded cursor-se-resize items-center justify-center ${bgClass}`}\n onClick={() => setBehavior(x + 1, y + 1)}\n onMouseUp={() => setBehavior(x + 1, y + 1)}\n onMouseEnter={() => setHoverPosition({ x, y })}\n />\n );\n });\n\n return (\n <div className=\"grid grid-cols-12 grid-rows-12 gap-1\" onMouseLeave={() => setHoverPosition({ x: -1, y: -1 })}>\n {cells}\n </div>\n );\n}\n\nfunction SlideBehavioursPanel() {\n const canvas = useInStack(\"Canvas\");\n const editor = useEditor();\n const { width, height } = editor.technical;\n\n if (!canvas || editor.technical.type !== \"Canvas\") {\n return (\n <Sidebar>\n <SidebarHeader title=\"Slide behaviors\" />\n <div>Please select canvas</div>\n </Sidebar>\n );\n }\n\n return (\n <Sidebar>\n <SidebarContent>\n <div className=\"px-2\">\n <InputContainer $wide>\n <DimensionsTriplet\n widthId={width.containerId()}\n width={width.get() || 0}\n changeWidth={(v) => width.set(v)}\n heightId={height.containerId()}\n height={height.get() || 0}\n changeHeight={(v) => height.set(v)}\n />\n <div>\n <AspectRatioWarning />\n </div>\n </InputContainer>\n </div>\n\n <BehaviorEditor\n behavior={editor.technical.behavior.get() || []}\n onChange={(v) => {\n editor.technical.behavior.set(v);\n }}\n configs={exhibitionConfigs}\n />\n </SidebarContent>\n </Sidebar>\n );\n}\n","import * as ManifestPreset from \"@manifest-editor/manifest-preset\";\nimport { extendApp, mapApp } from \"@manifest-editor/shell\";\nimport \"./index.css\";\nimport { tourStepAnnotations } from \"./annotations/TourStepAnnotations\";\nimport { exhibitionBackgroundTask } from \"./background-panel\";\nimport { imageBlockEditor } from \"./canvas-editors/image-block-editor\";\nimport { infoBlockEditor } from \"./canvas-editors/info-block-editor\";\nimport { youtubeMainEdtior } from \"./canvas-editors/youtube-editor\";\nimport { exhibitionCenterPanel } from \"./center-panels/ExhibitionCenterPanel\";\nimport { imageBrowserSlideCreator } from \"./creators/image-browser-slide-creator\";\nimport { imageServiceSlideCreator } from \"./creators/image-service-slide-creator\";\nimport { imageSlideCreator } from \"./creators/image-slide-creator\";\nimport { imageUrlSlideCreator } from \"./creators/image-url-slide\";\nimport { infoBoxCreator } from \"./creators/info-box-creator\";\nimport { videoSlideCreator } from \"./creators/video-slide-creator\";\nimport { youtubeSlideCreator } from \"./creators/youtube-slide-creator\";\nimport { exhibitionGridLeftPanel } from \"./left-panels/ExhibitionGrid\";\nimport { exhibitionOverviewLeftPanel } from \"./left-panels/ExhibitionOverview\";\nimport { exhibitionCanvasEditor } from \"./right-panels/ExhibitionCanvasEditor\";\nimport { exhibitionSummaryEdtior } from \"./right-panels/ExhibitionSummaryEditor\";\nimport { exhibitionTourSteps } from \"./right-panels/ExhibitionTourSteps\";\nimport { customBehaviourEditor } from \"./right-panels/SlideBehaviours\";\n\nexport const exhibitionEditorPreset = extendApp(\n mapApp(ManifestPreset),\n {\n id: \"exhibition-editor\",\n title: \"Exhibition Editor\",\n project: true,\n projectType: \"Manifest\",\n },\n {\n config: {\n editorConfig: {\n Canvas: {\n hideTabs: [\n \"@manifest-editor/overview\",\n \"@manifest-editor/technical-properties\",\n \"@manifest-editor/linking-properties\",\n \"@manifest-editor/nav-place-editor\",\n \"@manifest-editor/canvas-structural\",\n \"@manifest-editor/descriptive-properties\",\n \"@manifest-editor/overview-canvas-editor\",\n \"@manifest-editor/metadata\",\n ],\n },\n },\n },\n leftPanels: [\n //\n exhibitionGridLeftPanel,\n exhibitionOverviewLeftPanel,\n ],\n centerPanels: [\n //\n exhibitionCenterPanel,\n ],\n annotations: [\n //\n tourStepAnnotations,\n ],\n leftPanelIds: [\"left-panel-manifest\"],\n background: [exhibitionBackgroundTask],\n canvasEditors: [\n //\n imageBlockEditor,\n youtubeMainEdtior,\n infoBlockEditor,\n ],\n editors: [\n //\n exhibitionCanvasEditor,\n customBehaviourEditor,\n exhibitionSummaryEdtior,\n exhibitionTourSteps,\n ],\n creators: [\n infoBoxCreator,\n youtubeSlideCreator,\n imageServiceSlideCreator,\n imageBrowserSlideCreator,\n imageSlideCreator,\n imageUrlSlideCreator,\n videoSlideCreator,\n ],\n },\n);\n"],"mappings":"y6FAKA,MAAaA,GAAuC,CAClD,GAAI,oCACJ,MAAO,aACP,WAAc,EAAC,GAAA,EAAA,CAAsB,CACtC,CAED,SAAS,IAAsB,CAC7B,IAAM,EAAS,GAAW,CAEpB,EAAc,EADN,GAAe,CACQ,GAAM,EAAE,KAAK,QAAQ,CACpD,CAAE,cAAe,GAAgB,CAEjC,EADe,EAAW,UAAY,2BACb,EAAW,OAAO,YAAY,WAAW,yBAAyB,CAC3F,EAAsB,GAAQ,YAAY,GAMhD,MAJI,CAAC,GAAU,CAAC,GAAU,GAAe,CAAC,EACjC,KAIP,EAAA,EAAA,CAAA,SACE,EAAC,EAAA,CAAsB,eAAgB,EAAoB,YACzD,EAAC,GAAA,E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AA,CAAA,SACC,EAAC,GAAA,EAAA,CAAqB,CAAA,CAClB,CAAA,EACS,EACb,CAEN,EAAC,GAAA,CACC,SAAU,EAAO,UAAU,SAAS,KAAK,EAAI,EAAE,CAC/C,SAAW,GAAM,CACf,EAAO,UAAU,SAAS,IAAI,EAAE,EAElC,QAAS,IACT,CAAA,CAAA,CACa,CAAA,CACT,CChNd,MAAa,GAAyB,EACpC,EAAO,EAAe,CACtB,CACE,GAAI,oBACJ,MAAO,oBACP,QAAS,GACT,YAAa,WACd,CACD,CACE,OAAQ,CACN,aAAc,CACZ,OAAQ,CACN,SAAU,CACR,4BACA,wCACA,sCACA,oCACA,qCACA,0CACA,0CACA,4BACD,CACF,CACF,CACF,CACD,WAAY,CAEV,GACA,GACD,CACD,aAAc,CAEZ,GACD,CACD,YAAa,CAEX,GACD,CACD,aAAc,CAAC,sBAAsB,CACrC,WAAY,CAAC,GAAyB,CACtC,cAAe,CAEb,GACA,GACA,GACD,CACD,QAAS,CAEP,GACA,GACA,GACA,GACD,CACD,SAAU,CACR,GACA,GACA,GACA,GACA,EACA,GACA,GACD,CACF,CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifest-editor/exhibition-preset",
3
- "version": "2.0.2",
3
+ "version": "2.0.3-next.0.2f3498a",
4
4
  "type": "module",
5
5
  "bugs": "https://github.com/digirati-co-uk/iiif-manifest-editor/issues",
6
6
  "repository": {
@@ -45,13 +45,13 @@
45
45
  "@iiif/parser": "2.2.8",
46
46
  "@iiif/presentation-3": "^2.2.3",
47
47
  "@iiif/presentation-3-normalized": "^0.9.7",
48
- "@manifest-editor/components": "2.0.2",
49
- "@manifest-editor/creator-api": "2.0.2",
50
- "@manifest-editor/creators": "2.0.2",
51
- "@manifest-editor/editor-api": "2.0.2",
52
- "@manifest-editor/editors": "2.0.2",
53
- "@manifest-editor/manifest-preset": "2.0.2",
54
- "@manifest-editor/shell": "2.0.2",
48
+ "@manifest-editor/components": "2.0.3-next.0.2f3498a",
49
+ "@manifest-editor/creator-api": "2.0.3-next.0.2f3498a",
50
+ "@manifest-editor/creators": "2.0.3-next.0.2f3498a",
51
+ "@manifest-editor/editor-api": "2.0.3-next.0.2f3498a",
52
+ "@manifest-editor/editors": "2.0.3-next.0.2f3498a",
53
+ "@manifest-editor/manifest-preset": "2.0.3-next.0.2f3498a",
54
+ "@manifest-editor/shell": "2.0.3-next.0.2f3498a",
55
55
  "exhibition-viewer": "^1.0.10",
56
56
  "react": "19.2.0",
57
57
  "react-aria-components": "^1.12",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "9825dc38f994931db06f820f70163538dd1f4e1f"
77
+ "gitHead": "2f3498a25aeb7cd5ca382b1c13fa4ea5c53db336"
78
78
  }