You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
23 KiB
JavaScript

import{dm as ve,aX as $,q as r,E as Z,S as ge,G as we,bW as qe,bX as Je,dn as Ke,O as U,L,cb as ne,aP as Qe,Q as eo,W as me,j as R,H as oo,ac as V,af as H,aE as pe,I as xe,J as to,R as F,a6 as ro,bb as io,cf as no,bf as ae,ce as ao,aR as X,F as le,ad as P,bg as lo,dp as so,aA as uo,aO as co,ak as fo,a2 as Ce,a0 as ho,i as se,dq as Y,a1 as ue,dr as vo}from"./index.4db9ab9b.js";import{u as go}from"./Suffix.6d76a07e.js";function wo(e,s,l,d){var a=-1,m=e==null?0:e.length;for(d&&m&&(l=e[++a]);++a<m;)l=s(l,e[a],a,e);return l}function mo(e){return function(s){return e==null?void 0:e[s]}}var po={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},xo=mo(po),Co=xo,bo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,So="\\u0300-\\u036f",Oo="\\ufe20-\\ufe2f",Ro="\\u20d0-\\u20ff",Io=So+Oo+Ro,Lo="["+Io+"]",Po=RegExp(Lo,"g");function Mo(e){return e=ve(e),e&&e.replace(bo,Co).replace(Po,"")}var ko=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function yo(e){return e.match(ko)||[]}var zo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function To(e){return zo.test(e)}var be="\\ud800-\\udfff",Ao="\\u0300-\\u036f",Eo="\\ufe20-\\ufe2f",Ho="\\u20d0-\\u20ff",Do=Ao+Eo+Ho,Se="\\u2700-\\u27bf",Oe="a-z\\xdf-\\xf6\\xf8-\\xff",$o="\\xac\\xb1\\xd7\\xf7",Zo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",_o="\\u2000-\\u206f",jo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Re="A-Z\\xc0-\\xd6\\xd8-\\xde",Bo="\\ufe0e\\ufe0f",Ie=$o+Zo+_o+jo,Le="['\u2019]",de="["+Ie+"]",No="["+Do+"]",Pe="\\d+",Wo="["+Se+"]",Me="["+Oe+"]",ke="[^"+be+Ie+Pe+Se+Oe+Re+"]",Uo="\\ud83c[\\udffb-\\udfff]",Vo="(?:"+No+"|"+Uo+")",Xo="[^"+be+"]",ye="(?:\\ud83c[\\udde6-\\uddff]){2}",ze="[\\ud800-\\udbff][\\udc00-\\udfff]",A="["+Re+"]",Yo="\\u200d",ce="(?:"+Me+"|"+ke+")",Fo="(?:"+A+"|"+ke+")",fe="(?:"+Le+"(?:d|ll|m|re|s|t|ve))?",he="(?:"+Le+"(?:D|LL|M|RE|S|T|VE))?",Te=Vo+"?",Ae="["+Bo+"]?",Go="(?:"+Yo+"(?:"+[Xo,ye,ze].join("|")+")"+Ae+Te+")*",qo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Jo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ko=Ae+Te+Go,Qo="(?:"+[Wo,ye,ze].join("|")+")"+Ko,et=RegExp([A+"?"+Me+"+"+fe+"(?="+[de,A,"$"].join("|")+")",Fo+"+"+he+"(?="+[de,A+ce,"$"].join("|")+")",A+"?"+ce+"+"+fe,A+"+"+he,Jo,qo,Pe,Qo].join("|"),"g");function ot(e){return e.match(et)||[]}function tt(e,s,l){return e=ve(e),s=l?void 0:s,s===void 0?To(e)?ot(e):yo(e):e.match(s)||[]}var rt="['\u2019]",it=RegExp(rt,"g");function nt(e){return function(s){return wo(tt(Mo(s).replace(it,"")),e,"")}}var at=nt(function(e,s,l){return e+(l?"-":"")+s.toLowerCase()}),lt=at,st=$("rotateClockwise",r("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("path",{d:"M3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 12.7916 15.3658 15.2026 13 16.3265V14.5C13 14.2239 12.7761 14 12.5 14C12.2239 14 12 14.2239 12 14.5V17.5C12 17.7761 12.2239 18 12.5 18H15.5C15.7761 18 16 17.7761 16 17.5C16 17.2239 15.7761 17 15.5 17H13.8758C16.3346 15.6357 18 13.0128 18 10C18 5.58172 14.4183 2 10 2C5.58172 2 2 5.58172 2 10C2 10.2761 2.22386 10.5 2.5 10.5C2.77614 10.5 3 10.2761 3 10Z",fill:"currentColor"}),r("path",{d:"M10 12C11.1046 12 12 11.1046 12 10C12 8.89543 11.1046 8 10 8C8.89543 8 8 8.89543 8 10C8 11.1046 8.89543 12 10 12ZM10 11C9.44772 11 9 10.5523 9 10C9 9.44772 9.44772 9 10 9C10.5523 9 11 9.44772 11 10C11 10.5523 10.5523 11 10 11Z",fill:"currentColor"}))),ut=$("rotateClockwise",r("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("path",{d:"M17 10C17 6.13401 13.866 3 10 3C6.13401 3 3 6.13401 3 10C3 12.7916 4.63419 15.2026 7 16.3265V14.5C7 14.2239 7.22386 14 7.5 14C7.77614 14 8 14.2239 8 14.5V17.5C8 17.7761 7.77614 18 7.5 18H4.5C4.22386 18 4 17.7761 4 17.5C4 17.2239 4.22386 17 4.5 17H6.12422C3.66539 15.6357 2 13.0128 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10C18 10.2761 17.7761 10.5 17.5 10.5C17.2239 10.5 17 10.2761 17 10Z",fill:"currentColor"}),r("path",{d:"M10 12C8.89543 12 8 11.1046 8 10C8 8.89543 8.89543 8 10 8C11.1046 8 12 8.89543 12 10C12 11.1046 11.1046 12 10 12ZM10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}))),dt=$("zoomIn",r("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("path",{d:"M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5Z",fill:"currentColor"}),r("path",{d:"M8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z",fill:"currentColor"}))),ct=$("zoomOut",r("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("path",{d:"M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11Z",fill:"currentColor"}),r("path",{d:"M14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z",fill:"currentColor"}))),ft=Z({name:"ResizeSmall",render(){return r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},r("g",{fill:"none"},r("path",{d:"M5.5 4A1.5 1.5 0 0 0 4 5.5v1a.5.5 0 0 1-1 0v-1A2.5 2.5 0 0 1 5.5 3h1a.5.5 0 0 1 0 1h-1zM16 5.5A1.5 1.5 0 0 0 14.5 4h-1a.5.5 0 0 1 0-1h1A2.5 2.5 0 0 1 17 5.5v1a.5.5 0 0 1-1 0v-1zm0 9a1.5 1.5 0 0 1-1.5 1.5h-1a.5.5 0 0 0 0 1h1a2.5 2.5 0 0 0 2.5-2.5v-1a.5.5 0 0 0-1 0v1zm-12 0A1.5 1.5 0 0 0 5.5 16h1.25a.5.5 0 0 1 0 1H5.5A2.5 2.5 0 0 1 3 14.5v-1.25a.5.5 0 0 1 1 0v1.25zM8.5 7A1.5 1.5 0 0 0 7 8.5v3A1.5 1.5 0 0 0 8.5 13h3a1.5 1.5 0 0 0 1.5-1.5v-3A1.5 1.5 0 0 0 11.5 7h-3zM8 8.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-3z",fill:"currentColor"})))}});const G=Object.assign(Object.assign({},ge.props),{showToolbar:{type:Boolean,default:!0},showToolbarTooltip:Boolean}),Ee=we("n-image");function ht(){return{toolbarIconColor:"rgba(255, 255, 255, .9)",toolbarColor:"rgba(0, 0, 0, .35)",toolbarBoxShadow:"none",toolbarBorderRadius:"24px"}}const vt=qe({name:"Image",common:Je,peers:{Tooltip:Ke},self:ht}),gt=r("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("path",{d:"M6 5C5.75454 5 5.55039 5.17688 5.50806 5.41012L5.5 5.5V14.5C5.5 14.7761 5.72386 15 6 15C6.24546 15 6.44961 14.8231 6.49194 14.5899L6.5 14.5V5.5C6.5 5.22386 6.27614 5 6 5ZM13.8536 5.14645C13.68 4.97288 13.4106 4.9536 13.2157 5.08859L13.1464 5.14645L8.64645 9.64645C8.47288 9.82001 8.4536 10.0894 8.58859 10.2843L8.64645 10.3536L13.1464 14.8536C13.3417 15.0488 13.6583 15.0488 13.8536 14.8536C14.0271 14.68 14.0464 14.4106 13.9114 14.2157L13.8536 14.1464L9.70711 10L13.8536 5.85355C14.0488 5.65829 14.0488 5.34171 13.8536 5.14645Z",fill:"currentColor"})),wt=r("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("path",{d:"M13.5 5C13.7455 5 13.9496 5.17688 13.9919 5.41012L14 5.5V14.5C14 14.7761 13.7761 15 13.5 15C13.2545 15 13.0504 14.8231 13.0081 14.5899L13 14.5V5.5C13 5.22386 13.2239 5 13.5 5ZM5.64645 5.14645C5.82001 4.97288 6.08944 4.9536 6.28431 5.08859L6.35355 5.14645L10.8536 9.64645C11.0271 9.82001 11.0464 10.0894 10.9114 10.2843L10.8536 10.3536L6.35355 14.8536C6.15829 15.0488 5.84171 15.0488 5.64645 14.8536C5.47288 14.68 5.4536 14.4106 5.58859 14.2157L5.64645 14.1464L9.79289 10L5.64645 5.85355C5.45118 5.65829 5.45118 5.34171 5.64645 5.14645Z",fill:"currentColor"})),mt=r("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r("path",{d:"M4.089 4.216l.057-.07a.5.5 0 0 1 .638-.057l.07.057L10 9.293l5.146-5.147a.5.5 0 0 1 .638-.057l.07.057a.5.5 0 0 1 .057.638l-.057.07L10.707 10l5.147 5.146a.5.5 0 0 1 .057.638l-.057.07a.5.5 0 0 1-.638.057l-.07-.057L10 10.707l-5.146 5.147a.5.5 0 0 1-.638.057l-.07-.057a.5.5 0 0 1-.057-.638l.057-.07L9.293 10L4.146 4.854a.5.5 0 0 1-.057-.638l.057-.07l-.057.07z",fill:"currentColor"}));var pt=U([U("body >",[L("image-container","position: fixed;")]),L("image-preview-container",`
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
`),L("image-preview-overlay",`
z-index: -1;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba(0, 0, 0, .3);
`,[ne()]),L("image-preview-toolbar",`
z-index: 1;
position: absolute;
left: 50%;
transform: translateX(-50%);
border-radius: var(--n-toolbar-border-radius);
height: 48px;
bottom: 40px;
padding: 0 12px;
background: var(--n-toolbar-color);
box-shadow: var(--n-toolbar-box-shadow);
color: var(--n-toolbar-icon-color);
transition: color .3s var(--n-bezier);
display: flex;
align-items: center;
`,[L("base-icon",`
padding: 0 8px;
font-size: 28px;
cursor: pointer;
`),ne()]),L("image-preview-wrapper",`
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
pointer-events: none;
`,[Qe()]),L("image-preview",`
user-select: none;
-webkit-user-select: none;
pointer-events: all;
margin: auto;
max-height: calc(100vh - 32px);
max-width: calc(100vw - 32px);
transition: transform .3s var(--n-bezier);
`),L("image",`
display: inline-flex;
max-height: 100%;
max-width: 100%;
`,[eo("preview-disabled",`
cursor: pointer;
`),U("img",`
border-radius: inherit;
`)])]);const D=32;var He=Z({name:"ImagePreview",props:Object.assign(Object.assign({},G),{onNext:Function,onPrev:Function,clsPrefix:{type:String,required:!0}}),setup(e){const s=ge("Image","-image",pt,vt,e,me(e,"clsPrefix"));let l=null;const d=R(null),a=R(null),m=R(void 0),C=R(!1),g=R(!1),{localeRef:h}=go("Image");function n(){const{value:o}=a;if(!l||!o)return;const{style:i}=o,t=l.getBoundingClientRect(),c=t.left+t.width/2,f=t.top+t.height/2;i.transformOrigin=`${c}px ${f}px`}function u(o){var i,t;switch(o.key){case" ":o.preventDefault();break;case"ArrowLeft":(i=e.onPrev)===null||i===void 0||i.call(e);break;case"ArrowRight":(t=e.onNext)===null||t===void 0||t.call(e);break;case"Escape":te();break}}oo(C,o=>{o?V("keydown",document,u):H("keydown",document,u)}),pe(()=>{H("keydown",document,u)});let v=0,E=0,M=0,k=0,_=0,j=0,q=0,J=0,B=!1;function K(o){const{clientX:i,clientY:t}=o;M=i-v,k=t-E,co(S)}function $e(o){const{mouseUpClientX:i,mouseUpClientY:t,mouseDownClientX:c,mouseDownClientY:f}=o,x=c-i,b=f-t,O=`vertical${b>0?"Top":"Bottom"}`,I=`horizontal${x>0?"Left":"Right"}`;return{moveVerticalDirection:O,moveHorizontalDirection:I,deltaHorizontal:x,deltaVertical:b}}function Q(o){const{value:i}=d;if(!i)return{offsetX:0,offsetY:0};const t=i.getBoundingClientRect(),{moveVerticalDirection:c,moveHorizontalDirection:f,deltaHorizontal:x,deltaVertical:b}=o||{};let O=0,I=0;return t.width<=window.innerWidth?O=0:t.left>0?O=(t.width-window.innerWidth)/2:t.right<window.innerWidth?O=-(t.width-window.innerWidth)/2:f==="horizontalRight"?O=Math.min((t.width-window.innerWidth)/2,_-(x!=null?x:0)):O=Math.max(-((t.width-window.innerWidth)/2),_-(x!=null?x:0)),t.height<=window.innerHeight?I=0:t.top>0?I=(t.height-window.innerHeight)/2:t.bottom<window.innerHeight?I=-(t.height-window.innerHeight)/2:c==="verticalBottom"?I=Math.min((t.height-window.innerHeight)/2,j-(b!=null?b:0)):I=Math.max(-((t.height-window.innerHeight)/2),j-(b!=null?b:0)),{offsetX:O,offsetY:I}}function ee(o){H("mousemove",document,K),H("mouseup",document,ee);const{clientX:i,clientY:t}=o;B=!1;const c=$e({mouseUpClientX:i,mouseUpClientY:t,mouseDownClientX:q,mouseDownClientY:J}),f=Q(c);M=f.offsetX,k=f.offsetY,S()}const w=xe(Ee,null);function Ze(o){var i,t;if((t=(i=w==null?void 0:w.previewedImgPropsRef.value)===null||i===void 0?void 0:i.onMousedown)===null||t===void 0||t.call(i,o),o.button!==0)return;const{clientX:c,clientY:f}=o;B=!0,v=c-M,E=f-k,_=M,j=k,q=c,J=f,S(),V("mousemove",document,K),V("mouseup",document,ee)}function _e(o){var i,t;(t=(i=w==null?void 0:w.previewedImgPropsRef.value)===null||i===void 0?void 0:i.onDblclick)===null||t===void 0||t.call(i,o);const c=oe();p=p===c?1:c,S()}const N=1.5;let y=0,p=1,z=0;function W(){p=1,y=0}function je(){var o;W(),z=0,(o=e.onPrev)===null||o===void 0||o.call(e)}function Be(){var o;W(),z=0,(o=e.onNext)===null||o===void 0||o.call(e)}function Ne(){z-=90,S()}function We(){z+=90,S()}function Ue(){const{value:o}=d;if(!o)return 1;const{innerWidth:i,innerHeight:t}=window,c=Math.max(1,o.naturalHeight/(t-D)),f=Math.max(1,o.naturalWidth/(i-D));return Math.max(3,c*2,f*2)}function oe(){const{value:o}=d;if(!o)return 1;const{innerWidth:i,innerHeight:t}=window,c=o.naturalHeight/(t-D),f=o.naturalWidth/(i-D);return c<1&&f<1?1:Math.max(c,f)}function Ve(){const o=Ue();p<o&&(y+=1,p=Math.min(o,Math.pow(N,y)),S())}function Xe(){if(p>.5){const o=p;y-=1,p=Math.max(.5,Math.pow(N,y));const i=o-p;S(!1);const t=Q();p+=i,S(!1),p-=i,M=t.offsetX,k=t.offsetY,S()}}function S(o=!0){var i;const{value:t}=d;if(!t)return;const{style:c}=t,f=so((i=w==null?void 0:w.previewedImgPropsRef.value)===null||i===void 0?void 0:i.style);let x="";if(typeof f=="string")x=f+";";else for(const O in f)x+=`${lt(O)}: ${f[O]};`;const b=`transform-origin: center; transform: translateX(${M}px) translateY(${k}px) rotate(${z}deg) scale(${p});`;B?c.cssText=x+"cursor: grabbing; transition: none;"+b:c.cssText=x+"cursor: grab;"+b+(o?"":"transition: none;"),o||t.offsetHeight}function te(){C.value=!C.value,g.value=!0}function Ye(){p=oe(),y=Math.ceil(Math.log(p)/Math.log(N)),M=0,k=0,S()}const Fe={setPreviewSrc:o=>{m.value=o},setThumbnailEl:o=>{l=o},toggleShow:te};function Ge(o,i){if(e.showToolbarTooltip){const{value:t}=s;return r(uo,{to:!1,theme:t.peers.Tooltip,themeOverrides:t.peerOverrides.Tooltip,keepAliveOnHover:!1},{default:()=>h.value[i],trigger:()=>o})}else return o}const re=to(()=>{const{common:{cubicBezierEaseInOut:o},self:{toolbarIconColor:i,toolbarBorderRadius:t,toolbarBoxShadow:c,toolbarColor:f}}=s.value;return{"--n-bezier":o,"--n-toolbar-icon-color":i,"--n-toolbar-color":f,"--n-toolbar-border-radius":t,"--n-toolbar-box-shadow":c}}),{inlineThemeDisabled:ie}=F(),T=ie?ro("image-preview",void 0,re,e):void 0;return Object.assign({previewRef:d,previewWrapperRef:a,previewSrc:m,show:C,appear:io(),displayed:g,previewedImgProps:w==null?void 0:w.previewedImgPropsRef,handleWheel(o){o.preventDefault()},handlePreviewMousedown:Ze,handlePreviewDblclick:_e,syncTransformOrigin:n,handleAfterLeave:()=>{W(),z=0,g.value=!1},handleDragStart:o=>{var i,t;(t=(i=w==null?void 0:w.previewedImgPropsRef.value)===null||i===void 0?void 0:i.onDragstart)===null||t===void 0||t.call(i,o),o.preventDefault()},zoomIn:Ve,zoomOut:Xe,rotateCounterclockwise:Ne,rotateClockwise:We,handleSwitchPrev:je,handleSwitchNext:Be,withTooltip:Ge,resizeToOrignalImageSize:Ye,cssVars:ie?void 0:re,themeClass:T==null?void 0:T.themeClass,onRender:T==null?void 0:T.onRender},Fe)},render(){var e,s;const{clsPrefix:l}=this;return r(le,null,(s=(e=this.$slots).default)===null||s===void 0?void 0:s.call(e),r(no,{show:this.show},{default:()=>{var d;return this.show||this.displayed?((d=this.onRender)===null||d===void 0||d.call(this),ae(r("div",{class:[`${l}-image-preview-container`,this.themeClass],style:this.cssVars,onWheel:this.handleWheel},r(X,{name:"fade-in-transition",appear:this.appear},{default:()=>this.show?r("div",{class:`${l}-image-preview-overlay`,onClick:this.toggleShow}):null}),this.showToolbar?r(X,{name:"fade-in-transition",appear:this.appear},{default:()=>{if(!this.show)return null;const{withTooltip:a}=this;return r("div",{class:`${l}-image-preview-toolbar`},this.onPrev?r(le,null,a(r(P,{clsPrefix:l,onClick:this.handleSwitchPrev},{default:()=>gt}),"tipPrevious"),a(r(P,{clsPrefix:l,onClick:this.handleSwitchNext},{default:()=>wt}),"tipNext")):null,a(r(P,{clsPrefix:l,onClick:this.rotateCounterclockwise},{default:()=>r(ut,null)}),"tipCounterclockwise"),a(r(P,{clsPrefix:l,onClick:this.rotateClockwise},{default:()=>r(st,null)}),"tipClockwise"),a(r(P,{clsPrefix:l,onClick:this.resizeToOrignalImageSize},{default:()=>r(ft,null)}),"tipOriginalSize"),a(r(P,{clsPrefix:l,onClick:this.zoomOut},{default:()=>r(ct,null)}),"tipZoomOut"),a(r(P,{clsPrefix:l,onClick:this.zoomIn},{default:()=>r(dt,null)}),"tipZoomIn"),a(r(P,{clsPrefix:l,onClick:this.toggleShow},{default:()=>mt}),"tipClose"))}}):null,r(X,{name:"fade-in-scale-up-transition",onAfterLeave:this.handleAfterLeave,appear:this.appear,onEnter:this.syncTransformOrigin,onBeforeLeave:this.syncTransformOrigin},{default:()=>{const{previewedImgProps:a={}}=this;return ae(r("div",{class:`${l}-image-preview-wrapper`,ref:"previewWrapperRef"},r("img",Object.assign({},a,{draggable:!1,onMousedown:this.handlePreviewMousedown,onDblclick:this.handlePreviewDblclick,class:[`${l}-image-preview`,a.class],key:this.previewSrc,src:this.previewSrc,ref:"previewRef",onDragstart:this.handleDragStart}))),[[lo,this.show]])}})),[[ao,{enabled:this.show}]])):null}}))}});const De=we("n-image-group"),xt=G;var Ot=Z({name:"ImageGroup",props:xt,setup(e){let s;const{mergedClsPrefixRef:l}=F(e),d=`c${fo()}`,a=ho(),m=h=>{var n;s=h,(n=g.value)===null||n===void 0||n.setPreviewSrc(h)};function C(h){if(!(a!=null&&a.proxy))return;const u=a.proxy.$el.parentElement.querySelectorAll(`[data-group-id=${d}]:not([data-error=true])`);if(!u.length)return;const v=Array.from(u).findIndex(E=>E.dataset.previewSrc===s);~v?m(u[(v+h+u.length)%u.length].dataset.previewSrc):m(u[0].dataset.previewSrc)}Ce(De,{mergedClsPrefixRef:l,setPreviewSrc:m,setThumbnailEl:h=>{var n;(n=g.value)===null||n===void 0||n.setThumbnailEl(h)},toggleShow:()=>{var h;(h=g.value)===null||h===void 0||h.toggleShow()},groupId:d});const g=R(null);return{mergedClsPrefix:l,previewInstRef:g,next:()=>C(1),prev:()=>C(-1)}},render(){return r(He,{theme:this.theme,themeOverrides:this.themeOverrides,clsPrefix:this.mergedClsPrefix,ref:"previewInstRef",onPrev:this.prev,onNext:this.next,showToolbar:this.showToolbar,showToolbarTooltip:this.showToolbarTooltip},this.$slots)}});const Ct=Object.assign({alt:String,height:[String,Number],imgProps:Object,previewedImgProps:Object,lazy:Boolean,intersectionObserverOptions:Object,objectFit:{type:String,default:"fill"},previewSrc:String,fallbackSrc:String,width:[String,Number],src:String,previewDisabled:Boolean,loadDescription:String,onError:Function,onLoad:Function},G);var Rt=Z({name:"Image",props:Ct,inheritAttrs:!1,setup(e){const s=R(null),l=R(!1),d=R(null),a=xe(De,null),{mergedClsPrefixRef:m}=a||F(e),C={click:()=>{if(e.previewDisabled||l.value)return;const n=e.previewSrc||e.src;if(a){a.setPreviewSrc(n),a.setThumbnailEl(s.value),a.toggleShow();return}const{value:u}=d;!u||(u.setPreviewSrc(n),u.setThumbnailEl(s.value),u.toggleShow())}},g=R(!e.lazy);se(()=>{var n;(n=s.value)===null||n===void 0||n.setAttribute("data-group-id",(a==null?void 0:a.groupId)||"")}),se(()=>{if(Y)return;let n;const u=ue(()=>{n==null||n(),n=void 0,e.lazy&&(n=vo(s.value,e.intersectionObserverOptions,g))});pe(()=>{u(),n==null||n()})}),ue(()=>{var n;e.src,(n=e.imgProps)===null||n===void 0||n.src,l.value=!1});const h=R(!1);return Ce(Ee,{previewedImgPropsRef:me(e,"previewedImgProps")}),Object.assign({mergedClsPrefix:m,groupId:a==null?void 0:a.groupId,previewInstRef:d,imageRef:s,showError:l,shouldStartLoading:g,loaded:h,mergedOnClick:n=>{var u,v;C.click(),(v=(u=e.imgProps)===null||u===void 0?void 0:u.onClick)===null||v===void 0||v.call(u,n)},mergedOnError:n=>{if(!g.value)return;l.value=!0;const{onError:u,imgProps:{onError:v}={}}=e;u==null||u(n),v==null||v(n)},mergedOnLoad:n=>{const{onLoad:u,imgProps:{onLoad:v}={}}=e;u==null||u(n),v==null||v(n),h.value=!0}},C)},render(){var e,s;const{mergedClsPrefix:l,imgProps:d={},loaded:a,$attrs:m,lazy:C}=this,g=(s=(e=this.$slots).placeholder)===null||s===void 0?void 0:s.call(e),h=this.src||d.src||"",n=r("img",Object.assign(Object.assign({},d),{ref:"imageRef",width:this.width||d.width,height:this.height||d.height,src:Y?h:this.showError?this.fallbackSrc:this.shouldStartLoading?h:void 0,alt:this.alt||d.alt,"aria-label":this.alt||d.alt,onClick:this.mergedOnClick,onError:this.mergedOnError,onLoad:this.mergedOnLoad,loading:Y&&C&&!this.intersectionObserverOptions?"lazy":"eager",style:[d.style||"",g&&!a?{height:"0",width:"0",visibility:"hidden"}:"",{objectFit:this.objectFit}],"data-error":this.showError,"data-preview-src":this.previewSrc||this.src}));return r("div",Object.assign({},m,{role:"none",class:[m.class,`${l}-image`,(this.previewDisabled||this.showError)&&`${l}-image--preview-disabled`]}),this.groupId?n:r(He,{theme:this.theme,themeOverrides:this.themeOverrides,clsPrefix:l,ref:"previewInstRef",showToolbar:this.showToolbar,showToolbarTooltip:this.showToolbarTooltip},{default:()=>n}),!a&&g)}});export{Rt as N,Ot as a};