const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__toCdnUrl("assets/vendor-ux-DYcPPYq2.css"),window.__toCdnUrl("assets/index-DrCTi6nm.css"),window.__toCdnUrl("assets/index-_3Fxot8G.css")])))=>i.map(i=>d[i]);
import{W as O,bV as _,y as q}from"./vendor-ux-bFYdDLNG.js";import{r as m}from"./vendor-react-DX7tU9aY.js";import{j as o,al as u,aT as z,X as e}from"./vendor-mui-core-CDEc-eG6.js";import{n as d,y as F}from"./vendor-utils-_C9URqjS.js";const U=m.lazy(()=>q(()=>import("./index-pn9rq9ly.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>({default:t.Uploader}))),k="/blocklet/logo/upload",c=[".png",".jpg",".jpeg",".webp",".bmp",".ico"];function C({url:t,height:f=80,width:g="auto",enabled:s=!0,allowSVG:h=!0,type:r,did:a,prefix:b,headers:x=d,aspectRatio:l=1,minWidth:y=256,minHeight:P=256,onUploaded:R=d,children:n=null}){const{t:j,locale:v}=O(),i=m.useRef(null),p=()=>{i.current?.open()},w=()=>{R(),i.current?.close()},E={cursor:s?"pointer":"default","&::after":{content:`"${j("common.switch")}"`}};return o.jsxs(S,{id:`uploader-${a}-${r}`,children:[o.jsx(U,{ref:i,locale:v,popup:!0,onUploadFinish:w,plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:F(b,k,r,a),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:h?[...c,".svg"]:c,maxFileSize:1024*1024*5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:l,initialAspectRatio:l,croppedCanvasOptions:{minWidth:y,minHeight:P}}},tusProps:{headers:x}}),n?o.jsx(u,{onClick:p,children:n}):o.jsx(u,{className:_("uploader-wrapper",s&&"enabled"),sx:E,onClick:p,children:o.jsx("img",{alt:r,src:t,style:{width:g,height:f}})})]},`uploader-${a}-${r}`)}C.propTypes={url:e.string.isRequired,type:e.oneOf(["square","rect","favicon","splash-portrait","splash-landscape","og-image"]).isRequired,did:e.string.isRequired,prefix:e.string.isRequired,headers:e.func,onUploaded:e.func,height:e.number,width:e.any,enabled:e.bool,allowSVG:e.bool,aspectRatio:e.number,minWidth:e.number,minHeight:e.number,children:e.node};const S=z.div`
  .uploader-wrapper {
    display: inline-flex;
    position: relative;
    font-size: 0px;
    overflow: hidden;
    &.enabled {
      cursor: pointer;
    }
    &::after {
      display: none;
    }
    &.enabled::after {
      display: block;
      opacity: 1;
      position: absolute;
      bottom: 0;
      background: rgba(0, 0, 0, 0.3);
      left: 0;
      right: 0;
      height: 2.2em;
      color: white;
      text-align: center;
      font-size: 12px;
      line-height: 2em;
      transition: opacity 0.3s ease;
    }
  }
`;export{C as L};
