1 line
23 KiB
JavaScript
1 line
23 KiB
JavaScript
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,Ht as n,J as r,Ut as i,ct as a,ft as o,g as s,gn as c,gt as l,h as u,k as d,o as f,vn as p,xn as m}from"./runtime-core.esm-bundler-DkysjgTd.js";import{t as h}from"./module-CyhaP5hi.js";import{r as g,t as _}from"./en_US-Cv9hrLhb.js";import{U as v,g as y,l as b,m as x,t as S,u as C,vt as w,wt as T}from"./useConfigInject-DomGmy3z.js";import{t as E}from"./raf-CR9Bw2Uc.js";import{a as D}from"./motion-CBgDjk3d.js";import"./warning-BLl3S_cO.js";import{t as O}from"./vue-types-CEi2nPn2.js";import{n as k,t as A}from"./isObjectLike-DNah0Hql.js";import{a as j}from"./Portal-pBogH1MM.js";import{t as M}from"./KeyCode-DNtAKsAc.js";import{n as ee,t as N}from"./css-BflejRyY.js";import{t as P}from"./useMergedState-zH37e67U.js";import{t as F}from"./AntdIcon-DlVhnwS_.js";import{t as I}from"./CloseOutlined-Ba8JgGMi.js";import{a as L,i as R,r as te,t as z}from"./style-BL9u-um5.js";import{t as B}from"./zoom-CBWJFr0a.js";import{n as V,t as ne}from"./LeftOutlined-Bev-nGk9.js";import{t as H}from"./EyeOutlined-CK6UnxBf.js";var U=`[object Number]`;function re(e){return typeof e==`number`||A(e)&&k(e)==U}function ie(e){let t=p(null),n=c(g({},e)),r=p([]);return a(()=>{t.value&&E.cancel(t.value)}),[n,e=>{t.value===null&&(r.value=[],t.value=E(()=>{let e;r.value.forEach(t=>{e=g(g({},e),t)}),g(n,e),t.value=null})),r.value.push(e)}]}function W(e,t,n,r){let i=t+n,a=(n-r)/2;if(n>r){if(t>0)return{[e]:a};if(t<0&&i<r)return{[e]:-a}}else if(t<0||i>r)return{[e]:t<0?a:-a};return{}}function ae(e,t,n,r){let{width:i,height:a}=N(),o=null;return e<=i&&t<=a?o={x:0,y:0}:(e>i||t>a)&&(o=g(g({},W(`x`,n,e,i)),W(`y`,r,t,a))),o}var oe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},G=Symbol(`previewGroupContext`),K={provide:e=>{l(G,e)},inject:()=>r(G,{isPreviewGroup:m(!1),previewUrls:s(()=>new Map),setPreviewUrls:()=>{},current:p(null),setCurrent:()=>{},setShowPreview:()=>{},setMousePosition:()=>{},registerImage:null,rootClassName:``})},q=d({compatConfig:{MODE:3},name:`PreviewGroup`,inheritAttrs:!1,props:{previewPrefixCls:String,preview:{type:[Boolean,Object],default:!0},icons:{type:Object,default:()=>({})}},setup(e,r){let{slots:a}=r,o=s(()=>{let t={visible:void 0,onVisibleChange:()=>{},getContainer:void 0,current:0};return typeof e.preview==`object`?ue(e.preview,t):t}),l=c(new Map),u=p(),d=s(()=>o.value.visible),h=s(()=>o.value.getContainer),[g,_]=P(!!d.value,{value:d,onChange:(e,t)=>{var n,r;(r=(n=o.value).onVisibleChange)==null||r.call(n,e,t)}}),v=p(null),y=s(()=>d.value!==void 0),b=s(()=>Array.from(l.keys())),x=s(()=>b.value[o.value.current]),S=s(()=>new Map(Array.from(l).filter(e=>{let[,{canPreview:t}]=e;return!!t}).map(e=>{let[t,{url:n}]=e;return[t,n]}))),C=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;l.set(e,{url:t,canPreview:n})},w=e=>{u.value=e},E=e=>{v.value=e},D=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return l.set(e,{url:t,canPreview:n}),()=>{l.delete(e)}},O=e=>{e==null||e.stopPropagation(),_(!1),E(null)};return n(x,e=>{w(e)},{immediate:!0,flush:`post`}),i(()=>{g.value&&y.value&&w(x.value)},{flush:`post`}),K.provide({isPreviewGroup:m(!0),previewUrls:S,setPreviewUrls:C,current:u,setCurrent:w,setShowPreview:_,setMousePosition:E,registerImage:D}),()=>{let n=oe(o.value,[]);return t(f,null,[a.default&&a.default(),t(ce,T(T({},n),{},{"ria-hidden":!g.value,visible:g.value,prefixCls:e.previewPrefixCls,onClose:O,mousePosition:v.value,src:S.value.get(u.value),icons:e.icons,getContainer:h.value}),null)])}}}),J={x:0,y:0},se=g(g({},R()),{src:String,alt:String,rootClassName:String,icons:{type:Object,default:()=>({})}}),ce=d({compatConfig:{MODE:3},name:`Preview`,inheritAttrs:!1,props:se,emits:[`close`,`afterClose`],setup(e,r){let{emit:i,attrs:l}=r,{rotateLeft:d,rotateRight:f,zoomIn:p,zoomOut:h,close:_,left:v,right:y,flipX:b,flipY:x}=c(e.icons),S=m(1),C=m(0),E=c({x:1,y:1}),[O,k]=ie(J),A=()=>i(`close`),j=m(),N=c({originX:0,originY:0,deltaX:0,deltaY:0}),P=m(!1),{previewUrls:F,current:I,isPreviewGroup:L,setCurrent:R}=K.inject(),z=s(()=>F.value.size),B=s(()=>Array.from(F.value.keys())),V=s(()=>B.value.indexOf(I.value)),ne=s(()=>L.value?F.value.get(I.value):e.src),H=s(()=>L.value&&z.value>1),U=m({wheelDirection:0}),re=()=>{S.value=1,C.value=0,E.x=1,E.y=1,k(J),i(`afterClose`)},W=e=>{e?S.value+=.5:S.value++,k(J)},oe=e=>{S.value>1&&(e?S.value-=.5:S.value--),k(J)},G=()=>{C.value+=90},q=()=>{C.value-=90},se=()=>{E.x=-E.x},ce=()=>{E.y=-E.y},le=e=>{e.preventDefault(),e.stopPropagation(),V.value>0&&R(B.value[V.value-1])},Y=e=>{e.preventDefault(),e.stopPropagation(),V.value<z.value-1&&R(B.value[V.value+1])},ue=w({[`${e.prefixCls}-moving`]:P.value}),de=`${e.prefixCls}-operations-operation`,fe=`${e.prefixCls}-operations-icon`,pe=[{icon:_,onClick:A,type:`close`},{icon:p,onClick:()=>W(),type:`zoomIn`},{icon:h,onClick:()=>oe(),type:`zoomOut`,disabled:s(()=>S.value===1)},{icon:f,onClick:G,type:`rotateRight`},{icon:d,onClick:q,type:`rotateLeft`},{icon:b,onClick:se,type:`flipX`},{icon:x,onClick:ce,type:`flipY`}],me=()=>{if(e.visible&&P.value){let e=j.value.offsetWidth*S.value,t=j.value.offsetHeight*S.value,{left:n,top:r}=ee(j.value),i=C.value%180!=0;P.value=!1;let a=ae(i?t:e,i?e:t,n,r);a&&k(g({},a))}},he=e=>{e.button===0&&(e.preventDefault(),e.stopPropagation(),N.deltaX=e.pageX-O.x,N.deltaY=e.pageY-O.y,N.originX=O.x,N.originY=O.y,P.value=!0)},ge=t=>{e.visible&&P.value&&k({x:t.pageX-N.deltaX,y:t.pageY-N.deltaY})},X=t=>{if(!e.visible)return;t.preventDefault();let n=t.deltaY;U.value={wheelDirection:n}},_e=t=>{!e.visible||!H.value||(t.preventDefault(),t.keyCode===M.LEFT?V.value>0&&R(B.value[V.value-1]):t.keyCode===M.RIGHT&&V.value<z.value-1&&R(B.value[V.value+1]))},ve=()=>{e.visible&&(S.value!==1&&(S.value=1),(O.x!==J.x||O.y!==J.y)&&k(J))},Z=()=>{};return a(()=>{n([()=>e.visible,P],()=>{Z();let e,t,n=D(window,`mouseup`,me,!1),r=D(window,`mousemove`,ge,!1),i=D(window,`wheel`,X,{passive:!1}),a=D(window,`keydown`,_e,!1);try{window.top!==window.self&&(e=D(window.top,`mouseup`,me,!1),t=D(window.top,`mousemove`,ge,!1))}catch(e){`${e}`}Z=()=>{n.remove(),r.remove(),i.remove(),a.remove(),e&&e.remove(),t&&t.remove()}},{flush:`post`,immediate:!0}),n([U],()=>{let{wheelDirection:e}=U.value;e>0?oe(!0):e<0&&W(!0)})}),o(()=>{Z()}),()=>{let{visible:n,prefixCls:r,rootClassName:i}=e;return t(te,T(T({},l),{},{transitionName:e.transitionName,maskTransitionName:e.maskTransitionName,closable:!1,keyboard:!0,prefixCls:r,onClose:A,afterClose:re,visible:n,wrapClassName:ue,rootClassName:i,getContainer:e.getContainer}),{default:()=>[t(`div`,{class:[`${e.prefixCls}-operations-wrapper`,i]},[t(`ul`,{class:`${e.prefixCls}-operations`},[pe.map(n=>{let{icon:r,onClick:i,type:a,disabled:o}=n;return t(`li`,{class:w(de,{[`${e.prefixCls}-operations-operation-disabled`]:o&&(o==null?void 0:o.value)}),onClick:i,key:a},[u(r,{class:fe})])})])]),t(`div`,{class:`${e.prefixCls}-img-wrapper`,style:{transform:`translate3d(${O.x}px, ${O.y}px, 0)`}},[t(`img`,{onMousedown:he,onDblclick:ve,ref:j,class:`${e.prefixCls}-img`,src:ne.value,alt:e.alt,style:{transform:`scale3d(${E.x*S.value}, ${E.y*S.value}, 1) rotate(${C.value}deg)`}},null)]),H.value&&t(`div`,{class:w(`${e.prefixCls}-switch-left`,{[`${e.prefixCls}-switch-left-disabled`]:V.value<=0}),onClick:le},[v]),H.value&&t(`div`,{class:w(`${e.prefixCls}-switch-right`,{[`${e.prefixCls}-switch-right-disabled`]:V.value>=z.value-1}),onClick:Y},[y])]})}}}),le=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Y=()=>({src:String,wrapperClassName:String,wrapperStyle:{type:Object,default:void 0},rootClassName:String,prefixCls:String,previewPrefixCls:String,width:[Number,String],height:[Number,String],previewMask:{type:[Boolean,Function],default:void 0},placeholder:O.any,fallback:String,preview:{type:[Boolean,Object],default:!0},onClick:{type:Function},onError:{type:Function}}),ue=(e,t)=>{let n=g({},e);return Object.keys(t).forEach(r=>{e[r]===void 0&&(n[r]=t[r])}),n},de=0,fe=d({compatConfig:{MODE:3},name:`VcImage`,inheritAttrs:!1,props:Y(),emits:[`click`,`error`],setup(e,r){let{attrs:i,slots:c,emit:l}=r,u=s(()=>e.prefixCls),d=s(()=>`${u.value}-preview`),m=s(()=>{let t={visible:void 0,onVisibleChange:()=>{},getContainer:void 0};return typeof e.preview==`object`?ue(e.preview,t):t}),h=s(()=>{var t;return(t=m.value.src)==null?e.src:t}),_=s(()=>e.placeholder&&e.placeholder!==!0||c.placeholder),v=s(()=>m.value.visible),y=s(()=>m.value.getContainer),b=s(()=>v.value!==void 0),[x,S]=P(!!v.value,{value:v,onChange:(e,t)=>{var n,r;(r=(n=m.value).onVisibleChange)==null||r.call(n,e,t)}}),C=p(_.value?`loading`:`normal`);n(()=>e.src,()=>{C.value=_.value?`loading`:`normal`});let E=p(null),D=s(()=>C.value===`error`),{isPreviewGroup:O,setCurrent:k,setShowPreview:A,setMousePosition:j,registerImage:M}=K.inject(),N=p(de++),F=s(()=>e.preview&&!D.value),I=()=>{C.value=`normal`},L=e=>{C.value=`error`,l(`error`,e)},R=e=>{if(!b.value){let{left:t,top:n}=ee(e.target);O.value?(k(N.value),j({x:t,y:n})):E.value={x:t,y:n}}O.value?A(!0):S(!0),l(`click`,e)},te=()=>{S(!1),b.value||(E.value=null)},z=p(null);n(()=>z,()=>{C.value===`loading`&&z.value.complete&&(z.value.naturalWidth||z.value.naturalHeight)&&I()});let B=()=>{};a(()=>{n([h,F],()=>{if(B(),!O.value)return()=>{};B=M(N.value,h.value,F.value),F.value||B()},{flush:`post`,immediate:!0})}),o(()=>{B()});let V=e=>re(e)?e+`px`:e;return()=>{let{prefixCls:n,wrapperClassName:r,fallback:a,src:o,placeholder:s,wrapperStyle:u,rootClassName:p,width:_,height:v,crossorigin:b,decoding:S,alt:k,sizes:A,srcset:j,usemap:M,class:ee,style:N}=g(g({},e),i),P=m.value,{icons:B,maskClassName:ne}=P,H=le(P,[`icons`,`maskClassName`]),U=w(n,r,p,{[`${n}-error`]:D.value}),re=D.value&&a?a:h.value,ie={crossorigin:b,decoding:S,alt:k,sizes:A,srcset:j,usemap:M,width:_,height:v,class:w(`${n}-img`,{[`${n}-img-placeholder`]:s===!0},ee),style:g({height:V(v)},N)};return t(f,null,[t(`div`,{class:U,onClick:F.value?R:e=>{l(`click`,e)},style:g({width:V(_),height:V(v)},u)},[t(`img`,T(T(T({},ie),D.value&&a?{src:a}:{onLoad:I,onError:L,src:o}),{},{ref:z}),null),C.value===`loading`&&t(`div`,{"aria-hidden":`true`,class:`${n}-placeholder`},[s||c.placeholder&&c.placeholder()]),c.previewMask&&F.value&&t(`div`,{class:[`${n}-mask`,ne]},[c.previewMask()])]),!O.value&&F.value&&t(ce,T(T({},H),{},{"aria-hidden":!x.value,visible:x.value,prefixCls:d.value,onClose:te,mousePosition:E.value,src:re,alt:k,getContainer:y.value,icons:B,rootClassName:p}),null)])}}});fe.PreviewGroup=q;var pe=fe,me={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z`}},{tag:`path`,attrs:{d:`M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z`}}]},name:`rotate-left`,theme:`outlined`};function he(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ge(e,t,n[t])})}return e}function ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var X=function(e,n){var r=he({},e,n.attrs);return t(F,he({},r,{icon:me}),null)};X.displayName=`RotateLeftOutlined`,X.inheritAttrs=!1;var _e={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-.4-12.6 6.1l-.2 64c-118.6.5-235.8 53.4-314.6 154.2A399.75 399.75 0 00123.5 631h74.9c-.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8z`}},{tag:`path`,attrs:{d:`M880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H396V494h440v326z`}}]},name:`rotate-right`,theme:`outlined`};function ve(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Z(e,t,n[t])})}return e}function Z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ye=function(e,n){var r=ve({},e,n.attrs);return t(F,ve({},r,{icon:_e}),null)};ye.displayName=`RotateRightOutlined`,ye.inheritAttrs=!1;var be={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z`}}]},name:`zoom-in`,theme:`outlined`};function xe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Se(e,t,n[t])})}return e}function Se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ce=function(e,n){var r=xe({},e,n.attrs);return t(F,xe({},r,{icon:be}),null)};Ce.displayName=`ZoomInOutlined`,Ce.inheritAttrs=!1;var we={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z`}}]},name:`zoom-out`,theme:`outlined`};function Te(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Ee(e,t,n[t])})}return e}function Ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var De=function(e,n){var r=Te({},e,n.attrs);return t(F,Te({},r,{icon:we}),null)};De.displayName=`ZoomOutOutlined`,De.inheritAttrs=!1;var Oe={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z`}}]},name:`swap`,theme:`outlined`};function ke(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){Ae(e,t,n[t])})}return e}function Ae(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Q=function(e,n){var r=ke({},e,n.attrs);return t(F,ke({},r,{icon:Oe}),null)};Q.displayName=`SwapOutlined`,Q.inheritAttrs=!1;var je=e=>({position:e||`absolute`,inset:0}),Me=e=>{let{iconCls:t,motionDurationSlow:n,paddingXXS:r,marginXXS:i,prefixCls:a}=e;return{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,background:new h(`#000`).setAlpha(.5).toRgbString(),cursor:`pointer`,opacity:0,transition:`opacity ${n}`,[`.${a}-mask-info`]:g(g({},y),{padding:`0 ${r}px`,[t]:{marginInlineEnd:i,svg:{verticalAlign:`baseline`}}})}},Ne=e=>{let{previewCls:t,modalMaskBg:n,paddingSM:r,previewOperationColorDisabled:i,motionDurationSlow:a}=e,o=new h(n).setAlpha(.1),s=o.clone().setAlpha(.2);return{[`${t}-operations`]:g(g({},x(e)),{display:`flex`,flexDirection:`row-reverse`,alignItems:`center`,color:e.previewOperationColor,listStyle:`none`,background:o.toRgbString(),pointerEvents:`auto`,"&-operation":{marginInlineStart:r,padding:r,cursor:`pointer`,transition:`all ${a}`,userSelect:`none`,"&:hover":{background:s.toRgbString()},"&-disabled":{color:i,pointerEvents:`none`},"&:last-of-type":{marginInlineStart:0}},"&-progress":{position:`absolute`,left:{_skip_check_:!0,value:`50%`},transform:`translateX(-50%)`},"&-icon":{fontSize:e.previewOperationSize}})}},Pe=e=>{let{modalMaskBg:t,iconCls:n,previewOperationColorDisabled:r,previewCls:i,zIndexPopup:a,motionDurationSlow:o}=e,s=new h(t).setAlpha(.1),c=s.clone().setAlpha(.2);return{[`${i}-switch-left, ${i}-switch-right`]:{position:`fixed`,insetBlockStart:`50%`,zIndex:a+1,display:`flex`,alignItems:`center`,justifyContent:`center`,width:e.imagePreviewSwitchSize,height:e.imagePreviewSwitchSize,marginTop:-e.imagePreviewSwitchSize/2,color:e.previewOperationColor,background:s.toRgbString(),borderRadius:`50%`,transform:`translateY(-50%)`,cursor:`pointer`,transition:`all ${o}`,pointerEvents:`auto`,userSelect:`none`,"&:hover":{background:c.toRgbString()},"&-disabled":{"&, &:hover":{color:r,background:`transparent`,cursor:`not-allowed`,[`> ${n}`]:{cursor:`not-allowed`}}},[`> ${n}`]:{fontSize:e.previewOperationSize}},[`${i}-switch-left`]:{insetInlineStart:e.marginSM},[`${i}-switch-right`]:{insetInlineEnd:e.marginSM}}},Fe=e=>{let{motionEaseOut:t,previewCls:n,motionDurationSlow:r,componentCls:i}=e;return[{[`${i}-preview-root`]:{[n]:{height:`100%`,textAlign:`center`,pointerEvents:`none`},[`${n}-body`]:g(g({},je()),{overflow:`hidden`}),[`${n}-img`]:{maxWidth:`100%`,maxHeight:`100%`,verticalAlign:`middle`,transform:`scale3d(1, 1, 1)`,cursor:`grab`,transition:`transform ${r} ${t} 0s`,userSelect:`none`,pointerEvents:`auto`,"&-wrapper":g(g({},je()),{transition:`transform ${r} ${t} 0s`,display:`flex`,justifyContent:`center`,alignItems:`center`,"&::before":{display:`inline-block`,width:1,height:`50%`,marginInlineEnd:-1,content:`""`}})},[`${n}-moving`]:{[`${n}-preview-img`]:{cursor:`grabbing`,"&-wrapper":{transitionDuration:`0s`}}}}},{[`${i}-preview-root`]:{[`${n}-wrap`]:{zIndex:e.zIndexPopup}}},{[`${i}-preview-operations-wrapper`]:{position:`fixed`,insetBlockStart:0,insetInlineEnd:0,zIndex:e.zIndexPopup+1,width:`100%`},"&":[Ne(e),Pe(e)]}]},Ie=e=>{let{componentCls:t}=e;return{[t]:{position:`relative`,display:`inline-block`,[`${t}-img`]:{width:`100%`,height:`auto`,verticalAlign:`middle`},[`${t}-img-placeholder`]:{backgroundColor:e.colorBgContainerDisabled,backgroundImage:`url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')`,backgroundRepeat:`no-repeat`,backgroundPosition:`center center`,backgroundSize:`30%`},[`${t}-mask`]:g({},Me(e)),[`${t}-mask:hover`]:{opacity:1},[`${t}-placeholder`]:g({},je())}}},Le=e=>{let{previewCls:t}=e;return{[`${t}-root`]:B(e,`zoom`),"&":L(e,!0)}},Re=C(`Image`,e=>{let t=`${e.componentCls}-preview`,n=b(e,{previewCls:t,modalMaskBg:new h(`#000`).setAlpha(.45).toRgbString(),imagePreviewSwitchSize:e.controlHeightLG});return[Ie(n),Fe(n),z(b(n,{componentCls:t})),Le(n)]},e=>({zIndexPopup:e.zIndexPopupBase+80,previewOperationColor:new h(e.colorTextLightSolid).toRgbString(),previewOperationColorDisabled:new h(e.colorTextLightSolid).setAlpha(.25).toRgbString(),previewOperationSize:e.fontSizeIcon*1.5})),ze={rotateLeft:t(X,null,null),rotateRight:t(ye,null,null),zoomIn:t(Ce,null,null),zoomOut:t(De,null,null),close:t(I,null,null),left:t(ne,null,null),right:t(V,null,null),flipX:t(Q,null,null),flipY:t(Q,{rotate:90},null)},Be=d({compatConfig:{MODE:3},name:`AImagePreviewGroup`,inheritAttrs:!1,props:{previewPrefixCls:String,preview:v()},setup(e,n){let{attrs:r,slots:i}=n,{prefixCls:a,rootPrefixCls:o}=S(`image`,e),c=s(()=>`${a.value}-preview`),[l,u]=Re(a),d=s(()=>{let{preview:t}=e;if(t===!1)return t;let n=typeof t==`object`?t:{};return g(g({},n),{rootClassName:u.value,transitionName:j(o.value,`zoom`,n.transitionName),maskTransitionName:j(o.value,`fade`,n.maskTransitionName)})});return()=>l(t(q,T(T({},g(g({},r),e)),{},{preview:d.value,icons:ze,previewPrefixCls:c.value}),i))}}),Ve=e({ImagePreviewGroup:()=>Be,default:()=>$,imageProps:()=>Y}),$=d({name:`AImage`,inheritAttrs:!1,props:Y(),setup(e,n){let{slots:r,attrs:i}=n,{prefixCls:a,rootPrefixCls:o,configProvider:c}=S(`image`,e),[l,u]=Re(a),d=s(()=>{let{preview:t}=e;if(t===!1)return t;let n=typeof t==`object`?t:{};return g(g({icons:ze},n),{transitionName:j(o.value,`zoom`,n.transitionName),maskTransitionName:j(o.value,`fade`,n.maskTransitionName)})});return()=>{var n,o;let s=((o=(n=c.locale)==null?void 0:n.value)==null?void 0:o.Image)||_.Image,f=()=>t(`div`,{class:`${a.value}-mask-info`},[t(H,null,null),s==null?void 0:s.preview]),{previewMask:p=r.previewMask||f}=e;return l(t(pe,T(T({},g(g(g({},i),e),{prefixCls:a.value})),{},{preview:d.value,rootClassName:w(e.rootClassName,u.value)}),g(g({},r),{previewMask:typeof p==`function`?p:null})))}}});$.PreviewGroup=Be,$.install=function(e){return e.component($.name,$),e.component($.PreviewGroup.name,$.PreviewGroup),e};export{Ve as n,$ as t}; |