Files
WebP-eXpress/lib/wcfm/index.be5d792e.js

24 lines
68 KiB
JavaScript
Raw Permalink Normal View History

var ue=Object.defineProperty;var G=Object.getOwnPropertySymbols;var he=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var Z=(t,e,o)=>e in t?ue(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,K=(t,e)=>{for(var o in e||(e={}))he.call(e,o)&&Z(t,o,e[o]);if(G)for(var o of G(e))pe.call(e,o)&&Z(t,o,e[o]);return t};import{_ as v,o as s,c as d,a as Q,b as r,n as $,d as p,e as q,t as _,p as Y,f as H,r as m,g as w,F as B,h as P,i as x,j as A,k as J,m as ee,V as te,w as S,l as W,q as z,v as I,s as me,u as oe,x as ie,y as ne,z as X,T as fe,A as se,B as ge,C as ve}from"./vendor.fa68d508.js";const ye=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))l(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&l(a)}).observe(document,{childList:!0,subtree:!0});function o(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerpolicy&&(n.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?n.credentials="include":i.crossorigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function l(i){if(i.ep)return;i.ep=!0;const n=o(i);fetch(i.href,n)}};ye();class L{static post(e,o,l){var i=this;window.wcfmoptions.poster(e,o,function(n){l.call(i,n)},function(){console.log("failure")})}}const _e={},we={style:{position:"absolute",width:"0",height:"0"},width:"0",height:"0",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},be=Q(`<defs><symbol id="icon-folder" viewBox="0 0 309.267 309.267"><g><path style="fill:#D0994B;" d="M260.944,43.491H125.64c0,0-18.324-28.994-28.994-28.994H48.323c-10.67,0-19.329,8.65-19.329,19.329
v222.286c0,10.67,8.659,19.329,19.329,19.329h212.621c10.67,0,19.329-8.659,19.329-19.329V62.82
C280.273,52.15,271.614,43.491,260.944,43.491z"></path><path style="fill:#E4E7E7;" d="M28.994,72.484h251.279v77.317H28.994V72.484z"></path><path style="fill:#F4B459;" d="M19.329,91.814h270.609c10.67,0,19.329,8.65,19.329,19.329l-19.329,164.298
c0,10.67-8.659,19.329-19.329,19.329H38.658c-10.67,0-19.329-8.659-19.329-19.329L0,111.143C0,100.463,8.659,91.814,19.329,91.814z
"></path></g></symbol><symbol id="icon-unfold" viewBox="0 0 32 32"><path d="M28,14H18V4c0-1.104-0.896-2-2-2s-2,0.896-2,2v10H4c-1.104,0-2,0.896-2,2s0.896,2,2,2h10v10c0,1.104,0.896,2,2,2 s2-0.896,2-2V18h10c1.104,0,2-0.896,2-2S29.104,14,28,14z"></path></symbol><symbol id="icon-fold" viewBox="0 0 24 24"><g fill="none" stroke="#000" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></g></symbol><symbol id="icon-file" viewBox="0 0 56 56"><g><path style="fill:#E9E9E0;" d="M36.985,0H7.963C7.155,0,6.5,0.655,6.5,1.926V55c0,0.345,0.655,1,1.463,1h40.074
c0.808,0,1.463-0.655,1.463-1V12.978c0-0.696-0.093-0.92-0.257-1.085L37.607,0.257C37.442,0.093,37.218,0,36.985,0z"></path><polygon style="fill:#D9D7CA;" points="37.5,0.151 37.5,12 49.349,12 "></polygon><circle style="fill:#F3D55B;" cx="18.931" cy="14.431" r="4.569"></circle><polygon style="fill:#c5e8e1;" points="6.5,39 17.5,39 49.5,39 49.5,28 39.5,18.5 29,30 23.517,24.517 "></polygon><path style="fill:#14A085;" d="M48.037,56H7.963C7.155,56,6.5,55.345,6.5,54.537V39h43v15.537C49.5,55.345,48.845,56,48.037,56z"></path><g></g></g></symbol><symbol id="icon-ok" viewBox="0 0 256 256"><g fill="green" stroke="none" transform="translate(0.000000,256.000000) scale(0.100000,-0.100000)"><path d="M1064 2545 c-406 -72 -744 -324 -927 -690 -96 -193 -127 -333 -127 -575 0 -243 33 -387 133 -585 177 -351 518 -606 907 -676 118 -22 393 -17 511 8 110 24 252 78 356 136 327 183 569 525 628 887 19 122 19 338 0 460 -81 498 -483 914 -990 1025 -101 22 -389 28 -491 10z m814 -745 c39 -27 73 -59 77 -70 9 -27 10 -25 -372 -590 -345 -510 -357 -524 -420 -512 -19 4 -98 74 -250 225 -123 121 -225 228 -228 238 -3 10 1 31 9 47 20 40 125 132 149 132 11 0 79 -59 162 -140 79 -77 146 -140 149 -140 3 0 38 48 78 108 95 143 465 678 496 720 35 46 64 42 150 -18z"></path></g></symbol><symbol id="icon-not-available" viewBox="0 0 500.000000 500.000000" preserveAspectRatio="xMidYMid meet"><g fill="#b11010" stroke="none" transform="translate(0.000000,500.000000) scale(0.100000,-0.100000)"><path d="M2315 4800 c-479 -35 -928 -217 -1303 -527 -352 -293 -615 -702 -738 -1151 -104 -380 -104 -824 0 -1204 107 -389 302 -724 591 -1013 354 -354 785 -572 1279 -646 196 -30 476 -30 672 0 494 74 925 292 1279 646 354 354 571 784 646 1279 30 197 30 475 0 672 -75 495 -292 925 -646 1279 -289 289 -624 484 -1013 591 -228 62 -528 91 -767 74z m353 -511 c458 -50 874 -272 1170 -624 417 -497 536 -1174 308 -1763 -56 -145 -176 -367 -235 -434 -4 -4 -566 552 -1250 1236 l-1243 1243 94 60 c354 229 754 327 1156 282z m864 -3200 c-67 -59 -289 -179 -434 -235 -946 -366 -2024 172 -2322 1158 -47 155 -66 276 -73 453 -13 362 84 704 290 1023 l60 94 1243 -1243 c684 -684 1240 -1246 1236 -1250z"></path></g></symbol><symbol id="icon-help" viewBox="0 0 400 400" style="enable-background:new 0 0 400 400;" xml:space="preserve"><g><path style="fill:#cccccc;" d="M199.996,0C89.719,0,0,89.72,0,200c0,110.279,89.719,200,199.996,200C310.281,400,400,310.279,400,200
C400,89.72,310.281,0,199.996,0z M199.996,373.77C104.187,373.77,26.23,295.816,26.23,200
c0-95.817,77.957-173.769,173.766-173.769c95.816,0,173.772,77.953,173.772,173.769
C373.769,295.816,295.812,373.77,199.996,373.77z"></path><path style="fill:#000000;" d="M199.996,91.382c-35.176,0-63.789,28.616-63.789,63.793c0,7.243,5.871,13.115,13.113,13.115
c7.246,0,13.117-5.873,13.117-13.115c0-20.71,16.848-37.562,37.559-37.562c20.719,0,37.566,16.852,37.566,37.562
c0,20.714-16.849,37.566-37.566,37.566c-7.242,0-13.113,5.873-13.113,13.114v45.684c0,7.243,5.871,13.115,13.113,13.115
s13.117-5.872,13.117-13.115v-33.938c28.905-6.064,50.68-31.746,50.68-62.427C263.793,119.998,235.176,91.382,199.996,91.382z"></path><path d="M200.004,273.738c-9.086,0-16.465,7.371-16.465,16.462s7.379,16.465,16.465,16.465c9.094,0,16.457-7.374,16.457-16.465
S209.098,273.738,200.004,273.738z"></path></g></symbol><symbol id="icon-loading" viewBox="0 0 128 128" xml:space="preserve"><g><path d="M38.52 33.37L21.36 16.2A63.6 63.6 0 0 1 59.5.16v24.3a39.5 39.5 0 0 0-20.98 8.92z" fill="#049046"></path><path d="M38.52 33.37L21.36 16.2A63.6 63.6 0 0 1 59.5.16v24.3a39.5 39.5 0 0 0-20.98 8.92z" fill="#c5e8e1" transform="rotate(45 64 64)"></path><path d="M38.52 33.37L21.36 16.2A63.6 63.6 0 0 1 59.5.16v24.3a39.5 39.5 0 0 0-20.98 8.92z" fill="#c5e8e1" transform="rotate(90 64 64)"></path><path d="M38.52 33.37L21.36 16.2A63.6 63.6 0 0 1 59.5.16v24.3a39.5 39.5 0 0 0-20.98 8.92z" fill="#c5e8e1" transform="rotate(135 64 64)"></path><path d="M38.52 33.37L21.36 16.2A63.6 63.6 0 0 1 59.5.16v24.3a39.5 39.5 0 0 0-20.98 8.92z" fill="#c5e8e1" transform="rotate(180 64 64)"></path><path d="M38.52 33.37L21.36 16.2A63.6 63.6 0 0 1 59.5.16v24.3a39.5 39.5 0 0 0-20.98 8.92z" fill="#c5e8e1" transform="rotate(225 64 64)"></path><path d="M38.52 33.37L21.36 16.2A63.6 63.6 0 0 1 59.5.16v24.3a39.5 39.5 0 0 0-20.98 8.92z" fill="#c5e8e1" transform="rotate(270 64 64)"></path><path d="M38.52 33.37L21.36 16.2A63.6 63.6 0 0 1 59.5.16v24.3a39.5 39.5 0 0 0-20.98 8.92z" fill="#c5e8e1" transform="rotate(315 64 64)"></path><animateTransform attributeName="transform" type="rotate" values="0 64 64;45 64 64;90 64 64;135 64 64;180 64 64;225 64 64;270 64 64;315 64 64" calcMode="discrete" dur="720ms" repeatCount="indefinite"></animateTransform></g></symbol><symbol id="icon-trash" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve"><path d="M423.059,45.755h-97.156C321.093,19.757,298.267,0,270.897,0h-29.794c-27.37,0-50.196,19.757-55.006,45.755H88.941c-5.633,0-10.199,4.567-10.199,10.199v62.781c0,5.632,4.566,10.199,10.199,10.199h13.21v372.867c0,5.632,4.566,10.199,10.199,10.199H399.65c5.633,0,10.199-4.567,10.199-10.199V128.934h13.21c5.633,0,10.199-4.567,10.199-10.199V55.954C433.258,50.322,428.692,45.755,423.059,45.755zM241.103,20.398h29.794c16.063,0,29.672,10.706,34.065,25.356h97.926C211.432,31.104,225.04,20.398,241.103,20.398z M389.45,491.602H122.55V128.934H389.45V491.602z M412.861,108.536H99.14V66.153h313.72V108.536z"></path><path d="M256,151.099c-17.359,0-31.481,14.122-31.481,31.48v255.378c0,17.358,14.122,31.481,31.481,31.481s31.481-14.123,31.481-31.481V182.579C287.481,165.22,273.359,151.099,256,151.099z M267.082,437.957c0,6.11-4.972,11.082-11.082,11.082c-6.11,0-11.082-4.972-11.082-11.082V182.579c0-6.11,4.972-11.081,11.082-11.081c6.11,0,11.082,4.971,11.082,11.081V437.957z"></path><path d="M171.938,151.099c-17.359,0-31.481,14.122-31.481,31.48v255.378c0,17.358,14.123,31.481,31.481,31.481c17.359,0,31.481-14.123,31.481-31.481V182.579C203.419,165.22,189.297,151.099,171.938,151.099z M183.021,437.957c0,6.11-4.972,11.082-11.082,11.082s-11.082-4.972-11.082-11.082V182.579c0-6.11,4.972-11.081,11.082-11.081s11.082,4.971,11.082,11.081V437.957z"></path><path d="M340.062,151.099c-17.359,0-31.481,14.122-31.481,31.48v255.378c0,17.358,14.122,31.481,31.481,31.481c17.359,0,31.481-14.123,31.481-31.481V182.579C371.543,165.22,357.421,151.099,340.062,151.099z M351.144,437.957c0,6.11-4.972,11.082-11.082,11.082s-11.082-4.972-11.082-11.082V182.579c0-6.11,4.972-11.081,11.082-11.081s11.082,4.971,11.082,11.081V437.957z"></path><path d="M218.758,79.806H118.735c-5.633,0-10.199,4.567-10.199,10.199c0,5.632,4.566,10.199,10.199,10.199h100.023c5.633,0,10.199-4.567,10.199-10.199C228.957,84.373,224.391,79.806,218.758,79.806z"></path><path d="M259.192,79.806h-5.32c-5.633,0-10.199,4.567-10.199,10.199c0,5.632,4.566,10.199,10.199,10.199h5.32c5.633,0,10.199-4.567,10.199-10.199C269.392,84.373,264.825,79.806,259.192,79.806z"></path></symbol><symbol id="icon-eye" x="0px" y="0px" viewBox="0 0 572.098 572.098" xml:space="preserve"><path d="M99.187,398.999l44.333-44.332c-24.89-15.037-47.503-33.984-66.763-56.379c29.187-33.941,66.053-60.018,106.947-76.426c-6.279,14.002-9.853,29.486-9.853,45.827c0,16.597,3.696,32.3,10.165,46.476l35.802-35.797c-5.698-5.594-9.248-13.36-9.248-21.977c0-17.02,13.801-30.82,30.82-30.82c8.611,0,16.383,3.55,21.971,9.
`);for(var o=e.split(`
`),l=[],i=0;i<o.length;i++)l.push(U.md2htmlOneLine(o[i]));return l.join("<br>")}}const Mt={name:"FileProperties",components:{Variant:le,Variants:St,Modal:ae},props:{file:{type:Object,default:{}}},inject:["wcfm"],computed:{originalMime:function(){var t;return((t=this.originalInfo)==null?void 0:t.mime)?this.originalInfo.mime:""},convertedMime:function(){var t;return((t=this.convertedInfo)==null?void 0:t.mime)?this.convertedInfo.mime:""}},watch:{file(t,e){t.isDir||this.changePath(t.path)}},methods:{onVariantSelect(t){this.selectedVariant=t},onOriginalLoad(){if(this.updateHeight(),this.$refs.original.$refs.theport.calcScaleZoomRatio()>1){let e=this.$refs.original.$refs.theport,o=e.$refs.theimg,l=e.$refs.root,i=o.naturalWidth,n=o.naturalHeight,a=l.offsetWidth,g=this.height/n,u=a/i;this.zoom=Math.min(g,u)}else this.zoom=1;this.translateX=0,this.translateY=0},onOriginalResize(){this.updateHeight()},onConvertClick(){var o;let t=this;this.converting=!0;let e=(o=this.wcfm.$refs.convertOptions)==null?void 0:o.getOptions();t.errorMsg="",L.post("convert",{path:this.path,convertOptions:e},function(l){t.converting=!1,(l==null?void 0:l.success)==!1&&(t.errorMsg=l.data),l.converted&&(t.convertedInfo=l.converted),l.log&&(t.log=U.md2html(l.log))})},onDeleteConvertedClick(){let t=this;L.post("delete-converted",{path:this.path},function(e){(e==null?void 0:e.success)==!1?t.errorMsg=e.data:(t.log="",t.convertedInfo=null)})},updateHeight(){this.$refs.original&&(this.height=this.$refs.original.$refs.theport.getGoodContainerHeight(),this.scaleZoomRatio=this.$refs.original.$refs.theport.calcScaleZoomRatio())},reset(){this.originalInfo=null,this.convertedInfo=null},reload(){this.load()},changePath(t){this.reset(),this.path=t,this.loading=!0,this.errorMsg="",this.log="",this.load()},load(){let t=this;L.post("info",{path:this.path},function(e){(e==null?void 0:e.success)==!1&&(t.errorMsg=e.data),t.loading=!1,t.originalInfo=e.original,e.converted&&(t.convertedInfo=e.converted),e.log&&(t.log=U.md2html(e.log))})}},mounted(){this.file&&(this.path=this.file.path,this.load())},data(){return{zoom:1,scaleZoomRatio:1,translateX:0,translateY:0,height:100,loading:!1,errorMsg:"",originalInfo:null,convertedInfo:null,path:"",log:"",showingLogDialog:!1,converting:!1}}},F=t=>(Y("data-v-1e863e69"),t=t(),H(),t),It={class:"file-properties"},Ot={class:"path"},Tt=q(" Path: "),$t={class:"path"},Bt={key:0,class:"error"},Lt={class:"variant-wrap"},Dt={class:"variant-footer"},qt={class:"variant-wrap"},At={key:0,class:"variant-footer"},Pt=F(()=>r("use",{"xlink:href":"#icon-trash"},null,-1)),Ut=[Pt],jt=["innerHTML"],Rt={key:0},Ft={key:1},Nt={key:0,class:"icon-converting",width:"15",height:"15"},Yt=F(()=>r("use",{"xlink:href":"#icon-loading"},null,-1)),Ht=[Yt],Wt=["disabled"],Xt=F(()=>r("p",null," Above, you see the original image. If it has been converted, you also see the converted image (provided that your browser supports webp). ",-1)),Et=F(()=>r("p",null," You can zoom in on the image, ie using scroll wheel. Both images will zoom, allowing you to compare the quality. Double-click the image to set zoom to 100%. You can also drag the image. ",-1));function Gt(t,e,o,l,i,n){const a=m("Variant"),c=m("Modal"),g=W("tooltip");return s(),d("div",It,[r("div",Ot,[Tt,r("span",$t,_(o.file.path),1)]),i.errorMsg!=""?(s(),d("div",Bt,[r("p",null,"Error: "+_(i.errorMsg),1)])):p("",!0),z(r("div",null,"Getting info...",512),[[I,i.loading]]),r("div",null,[r("div",Lt,[z(w(a,{ref:"original",title:"Original",info:i.originalInfo,height:i.height,zoom:i.zoom,"onUpdate:zoom":e[0]||(e[0]=u=>i.zoom=u),scaleZoomRatio:i.scaleZoomRatio,translateX:i.translateX,"onUpdate:translateX":e[1]||(e[1]=u=>i.translateX=u),translateY:i.translateY,"onUpdate:translateY":e[2]||(e[2]=u=>i.translateY=u),onLoad:n.onOriginalLoad,onResize:n.onOriginalResize},null,8,["info","height","zoom","scaleZoomRatio","translateX","translateY","onLoad","onResize"]),[[I,i.originalInfo]]),r("div",Dt,_(n.originalMime),1)]),r("div",qt,[z(w(a,{title:"Existing conversion",info:i.convertedInfo,height:i.height,zoom:i.zoom,"onUpdate:zoom":e[3]||(e
The option is ignored for PNG and never adjusts quality up.
The feature requires Imagick, ImageMagick or Gmagick in order to detect the quality of the jpeg.
The option is relative new. Before this option, you could do the same by setting quality to "auto" and specifying a "max-quality" and a "default-quality". These are deprecated now.`,type:["boolean"],default:!0},ui:{component:"checkbox",advanced:!0,links:[["Guide","https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#preventing-unnecessarily-high-quality-setting-for-low-quality-jpegs"]],display:"option('encoding') != 'lossless'"},unsupportedBy:[]},{id:"alpha-quality",schema:{title:"Alpha quality",description:"Quality of alpha channel. Often, there is no need for high quality transparency layer and in some cases you can tweak this all the way down to 10 and save a lot in file size. The option only has effect with lossy encoding, and of course only on images with transparency.",type:["integer"],default:85,minimum:0,maximum:100},ui:{component:"slider",links:[["Guide","https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#alpha-quality"]],display:"(option('encoding') != 'lossless') && (imageType!='jpeg')"},unsupportedBy:["ffmpeg","ewww","gd","stack"]},{id:"near-lossless",schema:{title:'"Near lossless" quality',description:"This option allows you to get impressively better compression for lossless encoding, with minimal impact on visual quality. The range is 0 (maximum preprocessing) to 100 (no preprocessing). Read the guide for more info.",type:["integer"],default:60,minimum:0,maximum:100},ui:{component:"slider",links:[["Guide","https://github.com/rosell-dk/webp-convert/blob/master/docs/v2.0/converting/introduction-for-converting.md#near-lossless"]],display:"option('encoding') != 'lossy'"},unsupportedBy:["gmagick","graphicsmagick","ffmpeg","ewww","gd","stack"]},{id:"metadata",schema:{title:"Metadata",description:'Determines which metadata that should be copied over to the webp. Setting it to "all" preserves all metadata, setting it to "none" strips all metadata. *cwebp* can take a comma-separated list of which kinds of metadata that should be copied (ie "exif,icc"). *gd* will always remove all metadata and *ffmpeg* will always keep all metadata. The rest can either strip all or keep all (they will keep all, unless the option is set to *none*)',type:["string"],default:"none"},ui:{component:"multi-select",options:["all","none","exif","icc","xmp"]},sensitive:!1,unsupportedBy:["ffmpeg","gd","stack"]},{id:"method",schema:{title:"Reduction effort (0-6)",description:'Controls the trade off between encoding speed and the compressed file size and quality. Possible values range from 0 to 6. 0 is fastest. 6 results in best quality and compression. PS: The option corresponds to the "method" option in libwebp',type:["integer"],default:6,minimum:0,maximum:6},ui:{component:"slider",advanced:!0},unsupportedBy:["ewww","gd","stack"]},{id:"sharp-yuv",schema:{title:"Sharp YUV",description:"Better RGB->YUV color conversion (sharper and more accurate) at the expense of a little extra conversion time.",type:["boolean"],default:!0},ui:{component:"checkbox",advanced:!0,links:[["Ctrl.blog","https://www.ctrl.blog/entry/webp-sharp-yuv.html"]]},unsupportedBy:["ffmpeg","ewww","gd","stack"]},{id:"auto-filter",schema:{title:"Auto-filter",description:"Turns auto-filter on. This algorithm will spend additional time optimizing the filtering strength to reach a well-balanced quality. Unfortunately, it is extremely expensive in terms of computation. It takes about 5-10 times longer to do a conversion. A 1MB picture which perhaps typically takes about 2 seconds to convert, will takes about 15 seconds to convert with auto-filter. ",type:["boolean"],default:!1},ui:{component:"checkbox",advanced:!0},unsupportedBy:["vips","ffmpeg","ewww","gd","stack"]},{id:"low-memory",schema:{title:"Low memory",description:"Reduce memory usage of lossy encoding at the cost of ~30% longer encoding time and marginally larger output size. Only effective when the *method* option is 3 or more. Read more in [the docs](https://developers.google.com/speed/webp/docs/cwebp)",type:["boolea
\rand *more* blah`};else if(e.path=="/file")var i={original:{size:100,url:"http://localhost:3000/src/assets/dummy2.jpg",mime:"image/jpeg"},log:"blah blah *blah*"};else var i={original:{size:100,url:"http://localhost:3000/src/assets/dummy.jpg",mime:"image/jpeg"},converted:{size:70,url:"http://localhost:3000/src/assets/dummy.jpg",mime:"image/webp"},log:"blah blah *blah*"};break;case"convert":if(e.path=="/file2")var i={success:!1,data:"We pretend file2 errors converting...",log:"Oh no!"};else var i={success:!0,converted:{size:26050,url:"http://we0/wordpress/wp-content/uploads/2021/10/Screenshot_2021-10-04_13-43-11.png.webp",mime:"image/webp"},log:`All is *groovy*
next line`};break;case"delete-converted":if(e.path=="/file2")var i={success:!1,data:"We pretend file2 errors deleting..."};else var i={success:!0};break;default:var i="ok";break}o(i)});E.mount("#webpconvert-filemanager");