mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 22:07:10 -04:00
60 lines
23 KiB
JavaScript
60 lines
23 KiB
JavaScript
![]() |
import{i as qe}from"./chunk-fc34c9a6.js";import{aa as ge,v as we,j as Qe,b as eo,S as oo,n as U,o as y,a3 as ae,M as to,ac as D,u as me,x as no,a6 as io,aP as ro,aQ as ao,ad as V,W as so,aj as lo}from"../entries/src_pages_Home.page.16dc467b.js";import{c as pe}from"./chunk-a740628f.js";import{h as i,d as J,C as xe,r as M,A as be,a1 as Ce,i as Se,c as uo,I as se,f as Y,F as le,J as co,aa as fo,b as ue,w as ce,p as ho,S as vo,a9 as H}from"./chunk-449c23a2.js";import{f as go}from"./chunk-051b56e8.js";import{u as wo}from"./chunk-66ac4853.js";import{N as I}from"./chunk-9519e52e.js";import{r as j}from"./chunk-f94e2689.js";import{b as mo}from"./chunk-e933942f.js";function po(e,s,n,u){var r=-1,d=e==null?0:e.length;for(u&&d&&(n=e[++r]);++r<d;)n=s(n,e[r],r,e);return n}function xo(e){return function(s){return e?.[s]}}var bo={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"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),e&&e.replace(Oo,So).replace(yo,"")}var zo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ao(e){return e.match(zo)||[]}var To=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Eo(e){return To.test(e)}var Oe="\\ud800-\\udfff",Ho="\\u0300-\\u036f",Do="\\ufe20-\\ufe2f",_o="\\u20d0-\\u20ff",jo=Ho+Do+_o,Me="\\u2700-\\u27bf",Re="a-z\\xdf-\\xf6\\xf8-\\xff",$o="\\xac\\xb1\\xd7\\xf7",Zo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Bo="\\u2000-\\u206f",Wo=" \\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",Le="A-Z\\xc0-\\xd6\\xd8-\\xde",No="\\ufe0e\\ufe0f",Ie=$o+Zo+Bo+Wo,ke="['’]",de="["+Ie+"]",Uo="["+jo+"]",ye="\\d+",Vo="["+Me+"]",Pe="["+Re+"]",ze="[^"+Oe+Ie+ye+Me+Re+Le+"]",Yo="\\ud83c[\\udffb-\\udfff]",Xo="(?:"+Uo+"|"+Yo+")",Fo="[^"+Oe+"]",Ae="(?:\\ud83c[\\udde6-\\uddff]){2}",Te="[\\ud800-\\udbff][\\udc00-\\udfff]",E="["+Le+"]",Go="\\u200d",fe="(?:"+Pe+"|"+ze+")",Jo="(?:"+E+"|"+ze+")",he="(?:"+ke+"(?:d|ll|m|re|s|t|ve))?",ve="(?:"+ke+"(?:D|LL|M|RE|S|T|VE))?",Ee=Xo+"?",He="["+No+"]?",Ko="(?:"+Go+"(?:"+[Fo,Ae,Te].join("|")+")"+He+Ee+")*",qo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Qo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",et=He+Ee+Ko,ot="(?:"+[Vo,Ae,Te].join("|")+")"+et,tt=RegExp([E+"?"+Pe+"+"+he+"(?="+[de,E,"$"].join("|")+")",Jo+"+"+ve+"(?="+[de,E+fe,"$"].join("|")+")",E+"?"+fe+"+"+he,E+"+"+ve,Qo,qo,ye,ot].join("|"),"g");function nt(e){return e.match(tt)||[]}function it(e,s,n){return e=ge(e),s=n?void 0:s,s===void 0?Eo(e)?nt(e):Ao(e):e.match(s)||[]}var rt="['’]",at=RegExp(rt,"g");function st(e){return function(s){return po(it(Po(s).re
|
|||
|
position: fixed;
|
|||
|
left: 0;
|
|||
|
right: 0;
|
|||
|
top: 0;
|
|||
|
bottom: 0;
|
|||
|
display: flex;
|
|||
|
`),y("image-preview-overlay",`
|
|||
|
z-index: -1;
|
|||
|
position: absolute;
|
|||
|
left: 0;
|
|||
|
right: 0;
|
|||
|
top: 0;
|
|||
|
bottom: 0;
|
|||
|
background: rgba(0, 0, 0, .3);
|
|||
|
`,[ae()]),y("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;
|
|||
|
`,[y("base-icon",`
|
|||
|
padding: 0 8px;
|
|||
|
font-size: 28px;
|
|||
|
cursor: pointer;
|
|||
|
`),ae()]),y("image-preview-wrapper",`
|
|||
|
position: absolute;
|
|||
|
left: 0;
|
|||
|
right: 0;
|
|||
|
top: 0;
|
|||
|
bottom: 0;
|
|||
|
display: flex;
|
|||
|
pointer-events: none;
|
|||
|
`,[go()]),y("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);
|
|||
|
`),y("image",`
|
|||
|
display: inline-flex;
|
|||
|
max-height: 100%;
|
|||
|
max-width: 100%;
|
|||
|
`,[to("preview-disabled",`
|
|||
|
cursor: pointer;
|
|||
|
`),U("img",`
|
|||
|
border-radius: inherit;
|
|||
|
`)])]),_=32,Lt=J({name:"ImagePreview",props:Object.assign(Object.assign({},De),{onNext:Function,onPrev:Function,clsPrefix:{type:String,required:!0}}),setup(e){const s=we("Image","-image",Rt,bt,e,xe(e,"clsPrefix"));let n=null;const u=M(null),r=M(null),d=M(void 0),w=M(!1),m=M(!1),{localeRef:v}=wo("Image");function l(){const{value:o}=r;if(!n||!o)return;const{style:a}=o,t=n.getBoundingClientRect(),f=t.left+t.width/2,h=t.top+t.height/2;a.transformOrigin=`${f}px ${h}px`}function c(o){var a,t;switch(o.key){case" ":o.preventDefault();break;case"ArrowLeft":(a=e.onPrev)===null||a===void 0||a.call(e);break;case"ArrowRight":(t=e.onNext)===null||t===void 0||t.call(e);break;case"Escape":ne();break}}be(w,o=>{o?V("keydown",document,c):D("keydown",document,c)}),Ce(()=>{D("keydown",document,c)});let g=0,P=0,R=0,L=0,$=0,Z=0,K=0,q=0,B=!1;function Q(o){const{clientX:a,clientY:t}=o;R=a-g,L=t-P,lo(S)}function je(o){const{mouseUpClientX:a,mouseUpClientY:t,mouseDownClientX:f,mouseDownClientY:h}=o,b=f-a,C=h-t,O=`vertical${C>0?"Top":"Bottom"}`,k=`horizontal${b>0?"Left":"Right"}`;return{moveVerticalDirection:O,moveHorizontalDirection:k,deltaHorizontal:b,deltaVertical:C}}function ee(o){const{value:a}=u;if(!a)return{offsetX:0,offsetY:0};const t=a.getBoundingClientRect(),{moveVerticalDirection:f,moveHorizontalDirection:h,deltaHorizontal:b,deltaVertical:C}=o||{};let O=0,k=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:h==="horizontalRight"?O=Math.min((t.width-window.innerWidth)/2,$-(b??0)):O=Math.max(-((t.width-window.innerWidth)/2),$-(b??0)),t.height<=window.innerHeight?k=0:t.top>0?k=(t.height-window.innerHeight)/2:t.bottom<window.innerHeight?k=-(t.height-window.innerHeight)/2:f==="verticalBottom"?k=Math.min((t.height-window.innerHeight)/2,Z-(C??0)):k=Math.max(-((t.height-window.innerHeight)/2),Z-(C??0)),{offsetX:O,offsetY:k}}function oe(o){D("mousemove",document,Q),D("mouseup",document,oe);const{clientX:a,clientY:t}=o;B=!1;const f=je({mouseUpClientX:a,mouseUpClientY:t,mouseDownClientX:K,mouseDownClientY:q}),h=ee(f);R=h.offsetX,L=h.offsetY,S()}const p=Se(_e,null);function $e(o){var a,t;if((t=(a=p?.previewedImgPropsRef.value)===null||a===void 0?void 0:a.onMousedown)===null||t===void 0||t.call(a,o),o.button!==0)return;const{clientX:f,clientY:h}=o;B=!0,g=f-R,P=h-L,$=R,Z=L,K=f,q=h,S(),V("mousemove",document,Q),V("mouseup",document,oe)}function Ze(o){var a,t;(t=(a=p?.previewedImgPropsRef.value)===null||a===void 0?void 0:a.onDblclick)===null||t===void 0||t.call(a,o);const f=te();x=x===f?1:f,S()}const W=1.5;let z=0,x=1,A=0;function N(){x=1,z=0}function Be(){var o;N(),A=0,(o=e.onPrev)===null||o===void 0||o.call(e)}function We(){var o;N(),A=0,(o=e.onNext)===null||o===void 0||o.call(e)}function Ne(){A-=90,S()}function Ue(){A+=90,S()}function Ve(){const{value:o}=u;if(!o)return 1;const{innerWidth:a,innerHeight:t}=window,f=Math.max(1,o.naturalHeight/(t-_)),h=Math.max(1,o.naturalWidth/(a-_));return Math.max(3,f*2,h*2)}function te(){const{value:o}=u;if(!o)return 1;const{innerWidth:a,innerHeight:t}=window,f=o.naturalHeight/(t-_),h=o.naturalWidth/(a-_);return f<1&&h<1?1:Math.max(f,h)}function Ye(){const o=Ve();x<o&&(z+=1,x=Math.min(o,Math.pow(W,z)),S())}function Xe(){if(x>.5){const o=x;z-=1,x=Math.max(.5,Math.pow(W,z));const a=o-x;S(!1);const t=ee();x+=a,S(!1),x-=a,R=t.offsetX,L=t.offsetY,S()}}function Fe(){const o=d.value;o&&pt(o,void 0)}function S(o=!0){var a;const{value:t}=u;if(!t)return;const{style:f}=t,h=fo((a=p?.previewedImgPropsRef.value)===null||a===void 0?void 0:a.style);let b="";if(typeof h=="string")b=h+";";else for(const O in h)b+=`${ut(O)}: ${h[O]};`;const C=`transform-origin: center; transform: translateX(${R}px) translateY(${L}px) rotate(${A}deg) scale(${x});`;B?f.cssText=b+"cursor: grabbing; transition: none;"+C:f.cssText=b+"cursor: grab;"+C+(o?"":"transition: none;"),o||t.offsetHeight}function ne(){w.value=!w.value,m.value=!0}function Ge(){x=te(),z=Math.ceil(Math.log(x)/Math.log(W)),R=0,L=0,S()}const Je={setPreviewSrc:o=>{d.value=o},setThumbnailEl:o=>{n=o},t
|