import{_ as f,o as l,c,a as R,b as a,n as S,d as u,e as y,t as p,p as V,f as I,r as m,g as _,F as x,h as Y,i as z,j as D,k as H,m as j,V as O,w as b,l as $,v as k,s as X,q as B,u as U}from"./vendor.b4e4e155.js";const A=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function s(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerpolicy&&(i.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?i.credentials="include":o.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(o){if(o.ep)return;o.ep=!0;const i=s(o);fetch(o.href,i)}};A();class v{static post(e,s,n){var o=this;window.wcfmoptions.poster(e,s,function(i){n.call(o,i)},function(){console.log("failure")})}}const E={},q={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"},G=R(`<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><svg 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></svg><svg 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></svg><svg 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></svg><svg id="icon-help2" viewBox="0 0 431.855 431.855" style="enable-background:new 0 0 431.855 431.855;" xml:space="preserve"><g><path style="fill:#aaaaaa;" d="M215.936,0C96.722,0,0.008,96.592,0.008,215.814c0,119.336,96.714,216.041,215.927,216.041
        		c119.279,0,215.911-96.706,215.911-216.041C431.847,96.592,335.214,0,215.936,0z M231.323,335.962
        		c-5.015,4.463-10.827,6.706-17.411,6.706c-6.812,0-12.754-2.203-17.826-6.617c-5.08-4.406-7.625-10.575-7.625-18.501
        		c0-7.031,2.463-12.949,7.373-17.745c4.91-4.796,10.933-7.194,18.078-7.194c7.031,0,12.949,2.398,17.753,7.194
        		c4.796,4.796,7.202,10.713,7.202,17.745C238.858,325.362,236.346,331.5,231.323,335.962z M293.856,180.934
        		c-3.853,7.145-8.429,13.306-13.737,18.501c-5.292,5.194-14.81,13.924-28.548,26.198c-3.788,3.463-6.836,6.503-9.12,9.12
        		c-2.284,2.626-3.991,5.023-5.105,7.202c-1.122,2.178-1.983,4.357-2.593,6.535c-0.61,2.17-1.528,5.999-2.772,11.469
        		c-2.113,11.608-8.754,17.411-19.915,17.411c-5.804,0-10.681-1.894-14.656-5.69c-3.959-3.796-5.934-9.429-5.934-16.907
        		c0-9.372,1.455-17.493,4.357-24.361c2.886-6.869,6.747-12.892,11.543-18.086c4.804-5.194,11.274-11.356,19.427-18.501
        		c7.145-6.251,12.307-10.965,15.485-14.144c3.186-3.186,5.861-6.73,8.031-10.632c2.187-3.91,3.26-8.145,3.26-12.721
        		c0-8.933-3.308-16.46-9.957-22.597c-6.641-6.137-15.209-9.21-25.703-9.21c-12.282,0-21.321,3.097-27.125,9.291
        		c-5.804,6.194-10.705,15.314-14.729,27.369c-3.804,12.616-11.006,18.923-21.598,18.923c-6.251,0-11.526-2.203-15.826-6.609
        		c-4.292-4.406-6.438-9.177-6.438-14.314c0-10.6,3.406-21.346,10.21-32.23c6.812-10.884,16.745-19.899,29.807-27.036
        		c13.054-7.145,28.296-10.722,45.699-10.722c16.184,0,30.466,2.991,42.854,8.966c12.388,5.966,21.963,14.087,28.718,24.361
        		c6.747,10.266,10.128,21.427,10.128,33.482C299.635,165.473,297.709,173.789,293.856,180.934z"></path></g></svg><svg 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></svg></defs>`,1),K=[G];function J(t,e){return l(),c("svg",q,K)}var Q=f(E,[["render",J]]);class w{static escape(e){return e.replace(/./gm,function(s){var n=/[0-9a-zA-Z\!\[\]\(\)\*\#]/;return n.test(s.charAt(0))?s.charAt(0):"&#"+s.charCodeAt(0)+";"})}static md2htmlOneLine(e){return e=w.escape(e),e=e.replace(/\[([^[]+)\]\(([^)]+)\)/gm,function(s,n,o){return'<a target="blank" href="'+o+'">'+n+"</a>"}),e=e.replace(/(\*\*[^\*]+\*\*)/gm,function(s){return"<b>"+s.substr(2,s.length-4)+"</b>"}),e=e.replace(/(\*[^\*]+\*)/gm,function(s){return"<i>"+s.substr(1,s.length-2)+"</i>"}),e.substr(0,1)=="#"&&(e.substr(0,2)=="# "&&(e="<h1>"+e.substr(2)+"</h1>"),e.substr(0,3)=="## "&&(e="<h2>"+e.substr(3)+"</h2>"),e.substr(0,4)=="### "&&(e="<h3>"+e.substr(4)+"</h3>"),e.substr(0,5)=="#### "&&(e="<h4>"+e.substr(5)+"</h4>")),e==""&&(e="<br>"),e}static md2html(e){for(var s=e.match(/[^\r\n]+/g),n=[],o=0;o<s.length;o++)n.push(w.md2htmlOneLine(s[o]));return n.join("<br>")}}const ee={name:"FileItem",emits:["toggle","select"],props:{item:Object},data(){return{hover:!1,selected:!1}},inject:["wcfm"],methods:{onClick(t){this.selected=!0,this.$emit("select",this)},getWCFM(){return this.wcfm},getFullPath(){for(var t=this.$parent,e=[];t!==null&&t.$parent!==null;)t.item&&e.push(t.item.name),t=t.$parent;return e.pop(),e=e.reverse().join("/"),e=e.replace("//","/"),e},infoClick(){this.getWCFM().displayInfo(this.getFullPath())},convertClick(){this.getWCFM().onConvertClick(this.getFullPath())}}},C=t=>(V("data-v-4fb0cc48"),t=t(),I(),t),te={key:0,class:"icon-fold"},oe=C(()=>a("use",{"xlink:href":"#icon-fold"},null,-1)),se=[oe],ie={key:1,class:"icon-unfold"},ne=C(()=>a("use",{"xlink:href":"#icon-unfold"},null,-1)),ae=[ne],le=C(()=>a("use",{"xlink:href":"#icon-folder"},null,-1)),re=[le],ce={key:2,class:"icon-file"},de=C(()=>a("use",{"xlink:href":"#icon-file"},null,-1)),he=[de];function ue(t,e,s,n,o,i){return l(),c("div",{class:S({fileitem:!0,selected:o.selected}),onMouseover:e[2]||(e[2]=r=>o.hover=!0),onMouseleave:e[3]||(e[3]=r=>o.hover=!1),onClick:e[4]||(e[4]=(...r)=>i.onClick&&i.onClick(...r))},[a("p",null,[s.item.isDir?(l(),c("span",{key:0,class:S({"fold-unfold":!0,empty:s.item.isEmpty}),onClick:e[0]||(e[0]=r=>this.$emit("toggle"))},[s.item.isOpen?(l(),c("svg",te,se)):u("",!0),s.item.isOpen?u("",!0):(l(),c("svg",ie,ae))],2)):u("",!0),s.item.isDir?(l(),c("svg",{key:1,class:"icon-folder",onClick:e[1]||(e[1]=r=>this.$emit("toggle"))},re)):u("",!0),s.item.isDir?u("",!0):(l(),c("svg",ce,he)),y(" "+p(s.item.nickname||s.item.name),1)])],34)}var me=f(ee,[["render",ue],["__scopeId","data-v-4fb0cc48"]]);const fe={name:"FileTree",components:{FileItem:me},emits:["select"],props:{item:Object},data(){return{loading:!1}},methods:{load(){var t=this;v.post("get-folder",{path:this.$refs.thefileitem.getFullPath()},function(e){t.loading=!0,t.item.children=e.children.sort(function(s,n){return s.isDir&&!n.isDir?-1:!s.isDir&&n.isDir||s.name>n.name?1:s.name<n.name?-1:0}),t.item.loaded=!0,t.loading=!1})},toggle(){this.item.isOpen=!this.item.isOpen,this.item.loaded||this.load()},onSelect(t){this.$emit("select",t)}},mounted(){let t=this.$refs.thefileitem.getFullPath();(t=="/"||t.indexOf("/")==-1)&&this.toggle()}},_e={key:0},pe=a("li",null,"loading...",-1),ge=[pe],ve={key:1,class:"tree"};function ye(t,e,s,n,o,i){const r=m("FileItem"),h=m("FileTree",!0);return l(),c(x,null,[_(r,{ref:"thefileitem",item:s.item,onDblclick:i.toggle,onToggle:i.toggle,onSelect:i.onSelect},null,8,["item","onDblclick","onToggle","onSelect"]),o.loading?(l(),c("ul",_e,ge)):u("",!0),s.item.children!==void 0&&s.item.isOpen?(l(),c("ul",ve,[(l(!0),c(x,null,Y(s.item.children,d=>(l(),c("li",null,[_(h,{item:d,onSelect:i.onSelect},null,8,["item","onSelect"])]))),256))])):u("",!0)],64)}var ze=f(fe,[["render",ye]]);const be={name:"Files",components:{FileTree:ze},emits:["select"],props:{item:Object,statusText:String},methods:{onSelect(t){this.selectedItem&&(this.selectedItem.selected=!1),this.selectedItem=t,this.$emit("select",this.selectedItem.getFullPath(),this.selectedItem.item.isDir)}},data(){return{selected:null}}},we={key:1};function xe(t,e,s,n,o,i){const r=m("FileTree");return l(),c(x,null,[s.item?(l(),z(r,{key:0,item:s.item,onSelect:i.onSelect},null,8,["item","onSelect"])):u("",!0),s.item?u("",!0):(l(),c("div",we,p(s.statusText),1))],64)}var $e=f(be,[["render",xe]]);const ke={name:"Modal",emits:["close"],props:{title:{type:String},closeButtonText:{type:String},width:{type:[Number,String],default:"95%"},maxwidth:{type:[Number,String],default:"700px"},alignment:{type:String,default:"center"},height:{type:[Number,String],default:"92%"},maxheight:{type:[Number,String],default:"700px"},valignment:{type:String,default:"center"}},computed:{containerStyle(){let t={width:this.width,"max-width":this.maxwidth,height:this.height,"max-height":this.maxheight};return this.alignment=="center"&&(t.margin="0px auto"),this.alignment=="right"&&(t.position="absolute",t.right="10px"),this.valignment=="center"&&(t.top="50%",t.transform="translateY(-50%)"),this.alignment=="bottom"&&(t.position="absolute",t.bottom="10px"),t}},methods:{onCloseClick(){this.$emit("close")},registerKeyDownEvent(){let t=this;document.onkeydown=function(e){e=e||window.event;var s=!1;"key"in e?s=e.key==="Escape"||e.key==="Esc":s=e.keyCode===27,s&&t.$emit("close")}}},mounted(){this.registerKeyDownEvent()}},Ce={class:"modal-mask"},Se={class:"modal-wrapper"},Ve={class:"title"},Ie={class:"modal-body"},Me={class:"content"},Fe=y(" default body "),Re={class:"close-button-with-text"};function Ye(t,e,s,n,o,i){return l(),c("div",Ce,[a("div",Se,[a("div",{class:"modal-container",style:D(i.containerStyle)},[a("a",{class:"close-button",onClick:e[0]||(e[0]=(...r)=>i.onCloseClick&&i.onCloseClick(...r))},"X"),a("div",Ve,p(s.title),1),a("div",Ie,[a("div",Me,[H(t.$slots,"default",{},()=>[Fe]),a("div",Re,[a("button",{onClick:e[1]||(e[1]=(...r)=>i.onCloseClick&&i.onCloseClick(...r))},p(s.closeButtonText),1)])])])],4)])])}var L=f(ke,[["render",Ye]]);const De={name:"ZoomSlider",components:{Slider:j},emits:["update:zoom"],props:{zoom:{type:Number,default:1}},watch:{exp(t,e){this.$emit("update:zoom",2**t)},zoom(t,e){this.exp=Math.log2(t)}},methods:{sliderFormat(t){return Math.round(2**t*100)+"%"}},mounted(){},data(){return{exp:0}}},Oe={class:"zoom-slider"};function Xe(t,e,s,n,o,i){const r=m("Slider");return l(),c("div",Oe,[_(r,{modelValue:o.exp,"onUpdate:modelValue":e[0]||(e[0]=h=>o.exp=h),min:-4,max:4,width:100,step:-1,format:i.sliderFormat,tooltipPosition:"bottom",orientation:"horizontal"},null,8,["modelValue","format"])])}var Le=f(De,[["render",Xe]]);const Te={name:"ImageViewport",components:{VueZoomer:O,ZoomSlider:Le},emits:["update:zoom","update:translateX","update:translateY","load","resize"],props:{src:{type:String},height:{type:Number,default:500},zoom:{type:Number,default:1},scaleZoomRatio:{type:Number},translateX:{type:Number,default:1},translateY:{type:Number,default:1}},data(){return{ratio:1,ro:null}},watch:{height(t,e){var s;((s=this.$refs)==null?void 0:s.zoomer)&&(this.$refs.zoomer.onWindowResize(),this.$refs.zoomer.refreshContainerPos())},scaleZoomRatio(t){var e;((e=this.$refs)==null?void 0:e.zoomer)&&(this.$refs.zoomer.onWindowResize(),this.$refs.zoomer.refreshContainerPos()),this.$refs.zoomer.scale=this.zoom*this.scaleZoomRatio},zoom(t,e){this.isImageReady(),this.$refs.zoomer.scale=t*this.scaleZoomRatio},translateX(t,e){this.$refs.zoomer.translateX!=t&&(this.$refs.zoomer.translateX=t)},translateY(t,e){this.$refs.zoomer.translateY!=t&&(this.$refs.zoomer.translateY=t)}},methods:{getGoodContainerHeight(){var t,e,s;if((e=(t=this.$refs)==null?void 0:t.theimg)==null?void 0:e.naturalWidth){let n=this.$refs.theimg.naturalWidth/this.$refs.theimg.naturalHeight,i=((s=this.$refs.root)==null?void 0:s.offsetWidth)/n;return i>300&&(i=300),i}return 300},updateContainerHeight(){},isImageReady(){var t,e,s;return!(!((e=(t=this.$refs)==null?void 0:t.theimg)==null?void 0:e.naturalWidth)||!((s=this.$refs.root)==null?void 0:s.offsetWidth))},calcScaleZoomRatio(){var n,o;if(!this.isImageReady())return 1;let t=this.$refs.theimg.naturalWidth/((n=this.$refs.root)==null?void 0:n.offsetWidth),e=this.$refs.theimg.naturalHeight/((o=this.$refs.root)==null?void 0:o.offsetHeight),s=Math.max(t,e);return isNaN(s)?1:s},updateRatio(){},updateScale(){this.zoom&&(this.$refs.zoomer.scale=this.zoom*this.scaleZoomRatio)},zoomToFit(){},onImgLoad(){var t,e;((e=(t=this.$refs)==null?void 0:t.theimg)==null?void 0:e.naturalWidth)&&this.$emit("load")},onResize(){this.$emit("resize")},onDoubleTap(){console.log("double tab - zoom to 100%"),this.$emit("update:zoom",1),this.$emit("update:translateX",0),this.$emit("update:translateY",0)}},mounted(){window.ResizeObserver&&(this.ro=new ResizeObserver(this.onResize).observe(this.$refs.root)),this.$refs.zoomer.tapDetector.onDoubleTap(this.onDoubleTap),this.$watch("$refs.zoomer.scale",(t,e)=>{this.isImageReady(),this.$emit("update:zoom",t/this.scaleZoomRatio)}),this.$watch("$refs.zoomer.translateX",(t,e)=>{this.$emit("update:translateX",t)}),this.$watch("$refs.zoomer.translateY",(t,e)=>{this.$emit("update:translateY",t)})},beforeDestroy(){window.ResizeObserver&&this.ro.unobserve(this.$refs.zoomer)}},We={ref:"root",class:"image-viewport"},Ne=["src"],Pe={class:"zoom-info"};function Ze(t,e,s,n,o,i){const r=m("v-zoomer");return l(),c("div",We,[_(r,{ref:"zoomer",class:"zoomer",minScale:.1,maxScale:8,onResize:i.onResize,doubleClickToZoom:!1,style:D({height:s.height+"px"}),pivot:"cursor",limitTranslation:!1,lockPanOnNoScale:!1},{default:b(()=>[a("img",{ref:"theimg",src:s.src,onLoad:e[0]||(e[0]=(...h)=>i.onImgLoad&&i.onImgLoad(...h))},null,40,Ne)]),_:1},8,["minScale","onResize","style"]),a("div",Pe," zoom: "+p(Math.round(s.zoom*100))+"% ",1)],512)}var He=f(Te,[["render",Ze]]);const je={name:"Variant",components:{ImageViewport:He},emits:["select","update:zoom","update:translateX","update:translateY","load","resize"],props:{title:{type:String},info:{type:Object},url:{type:String,default:""},height:{type:Number},zoom:{type:Number},scaleZoomRatio:{type:Number},translateX:{type:Number},translateY:{type:Number},variantIndex:{type:Number}},computed:{imageUrl:function(){var t;return(t=this.info)==null?void 0:t.url},filesize:function(){var e;if(!((e=this.info)==null?void 0:e.size))return"";let t=this.info.size;return t<1024?t+" bytes":(t/=1024,t<1024?Math.round(t*10)/10+" kb":(t/=1024,Math.round(t*10)/10+" MB"))}},methods:{onVariantSelect(){this.$emit("select",this.variantIndex)},onLoad(){this.$emit("load")},zoomToFit(){this.$refs.theport.zoomToFit()}},mounted(){this.$watch("$refs.theport.zoom",(t,e)=>{this.$emit("update:zoom",t)}),this.$watch("$refs.theport.translateX",(t,e)=>{this.$emit("update:translateX",t)}),this.$watch("$refs.theport.translateY",(t,e)=>{this.$emit("update:translateY",t)})},data(){return{}}},Be={class:"variant"},Ue={class:"header"},Ae={class:"title"},Ee={class:"size"};function qe(t,e,s,n,o,i){const r=m("ImageViewport");return l(),c("div",Be,[a("div",Ue,[a("div",Ae,p(s.title),1),a("div",Ee,p(i.filesize),1)]),_(r,{ref:"theport",src:i.imageUrl,height:s.height,zoom:s.zoom,"onUpdate:zoom":e[0]||(e[0]=h=>s.zoom=h),scaleZoomRatio:s.scaleZoomRatio,translateX:s.translateX,"onUpdate:translateX":e[1]||(e[1]=h=>s.translateX=h),translateY:s.translateY,"onUpdate:translateY":e[2]||(e[2]=h=>s.translateY=h),onLoad:i.onLoad,onResize:e[3]||(e[3]=h=>this.$emit("resize"))},null,8,["src","height","zoom","scaleZoomRatio","translateX","translateY","onLoad"])])}var T=f(je,[["render",qe],["__scopeId","data-v-0372e854"]]);const Ge={name:"Variants",components:{Variant:T},emits:["update:zoom","update:translateX","update:translateY"],props:{file:{type:Object},viewport:{type:Object},height:{type:Number},zoom:{type:Number,default:1},translateX:{type:Number,default:0},translateY:{type:Number,default:0}},watch:{file(t,e){}},methods:{onZoomChange(t){this.$emit("update:zoom",t)},onTranslateXChange(t){this.$emit("update:translateX",t)},onTranslateYChange(t){this.$emit("update:translateY",t)},sliderFormat(t){return Math.round(t*100)+"%"},changeImage(){this.imageUrl=="http://localhost:3000/src/assets/dummy.jpg"?this.imageUrl="http://localhost:3000/src/assets/dummy2.jpg":this.imageUrl="http://localhost:3000/src/assets/dummy.jpg",this.selectedVariant=-1},onVariantSelect(t){this.selectedVariant=t}},mounted(){this.$watch("$refs.variants.zoom",(t,e)=>{})},data(){var t="http://localhost:3000/src/assets/200x100.jpg";return{imageUrl:"",selectedVariant:-1,variants:[{title:"Existing conversion",size:732,url:t},{title:"Lossy, q:20",size:35e5,url:t}]}}},W=t=>(V("data-v-25a3327e"),t=t(),I(),t),Ke={class:"variants-component"},Je=W(()=>a("br",null,null,-1)),Qe=W(()=>a("br",null,null,-1)),et={class:"variants"};function tt(t,e,s,n,o,i){const r=m("Variant");return l(),c("div",Ke,[y(" File: "+p(s.file)+" ",1),a("button",{onClick:e[0]||(e[0]=h=>i.changeImage())},"Change image"),Je,Qe,a("div",et,[(l(!0),c(x,null,Y(o.variants,(h,d)=>(l(),z(r,{title:h.title,info:h,variantIndex:d,class:S({selected:d==o.selectedVariant}),height:s.height,zoom:s.zoom,"onUpdate:zoom":[e[1]||(e[1]=g=>s.zoom=g),i.onZoomChange],translateX:s.translateX,"onUpdate:translateX":[e[2]||(e[2]=g=>s.translateX=g),i.onTranslateXChange],translateY:s.translateY,"onUpdate:translateY":[e[3]||(e[3]=g=>s.translateY=g),i.onTranslateYChange],onSelect:i.onVariantSelect},null,8,["title","info","variantIndex","class","height","zoom","translateX","translateY","onSelect","onUpdate:zoom","onUpdate:translateX","onUpdate:translateY"]))),256))])])}var ot=f(Ge,[["render",tt],["__scopeId","data-v-25a3327e"]]);const st={name:"FileProperties",components:{Variant:T,Variants:ot,Modal:L},props:{file:{type:Object,default:{}}},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,s=e.$refs.theimg,n=e.$refs.root,o=s.naturalWidth,i=s.naturalHeight,r=n.offsetWidth,d=this.height/i,g=r/o;this.zoom=Math.min(d,g)}else this.zoom=1;this.translateX=0,this.translateY=0},onOriginalResize(){this.updateHeight()},onConvertClick(){let t=this;this.converting=!0,v.post("convert",{path:this.path},function(e){t.converting=!1,(e==null?void 0:e.success)==!1&&(t.errorMsg=e.data),e.converted&&(t.convertedInfo=e.converted),e.log&&(t.log=w.md2html(e.log))})},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;v.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=w.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}}},M=t=>(V("data-v-1f62a342"),t=t(),I(),t),it={class:"file-properties"},nt={class:"path"},at=y(" Path: "),lt={class:"path"},rt={key:0,class:"error"},ct=["innerHTML"],dt={key:0},ht={key:1},ut={key:0,class:"icon-converting",width:"15",height:"15"},mt=M(()=>a("use",{"xlink:href":"#icon-loading"},null,-1)),ft=[mt],_t=["disabled"],pt=M(()=>a("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)),gt=M(()=>a("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 vt(t,e,s,n,o,i){const r=m("Variant"),h=m("Modal");return l(),c("div",it,[a("div",nt,[at,a("span",lt,p(s.file.path),1)]),o.errorMsg!=""?(l(),c("div",rt,[a("p",null,"Error: "+p(o.errorMsg),1)])):u("",!0),$(a("div",null,"Getting info...",512),[[k,o.loading]]),$(_(r,{ref:"original",title:"Original",info:o.originalInfo,height:o.height,zoom:o.zoom,"onUpdate:zoom":e[0]||(e[0]=d=>o.zoom=d),scaleZoomRatio:o.scaleZoomRatio,translateX:o.translateX,"onUpdate:translateX":e[1]||(e[1]=d=>o.translateX=d),translateY:o.translateY,"onUpdate:translateY":e[2]||(e[2]=d=>o.translateY=d),onLoad:i.onOriginalLoad,onResize:i.onOriginalResize},null,8,["info","height","zoom","scaleZoomRatio","translateX","translateY","onLoad","onResize"]),[[k,o.originalInfo]]),$(_(r,{title:"Existing conversion",info:o.convertedInfo,height:o.height,zoom:o.zoom,"onUpdate:zoom":e[3]||(e[3]=d=>o.zoom=d),scaleZoomRatio:o.scaleZoomRatio,translateX:o.translateX,"onUpdate:translateX":e[4]||(e[4]=d=>o.translateX=d),translateY:o.translateY,"onUpdate:translateY":e[5]||(e[5]=d=>o.translateY=d)},null,8,["info","height","zoom","scaleZoomRatio","translateX","translateY"]),[[k,o.convertedInfo]]),$(_(h,{title:"Conversion log",closeButtonText:"Ok",width:"95vw",maxwidth:"1400px",height:"95vh",onClose:e[6]||(e[6]=d=>o.showingLogDialog=!1)},{default:b(()=>[a("div",{innerHTML:o.log},null,8,ct)]),_:1},512),[[k,o.showingLogDialog]]),a("div",null,[a("button",{onClick:e[7]||(e[7]=(...d)=>i.onConvertClick&&i.onConvertClick(...d))},[o.convertedInfo?(l(),c("span",dt,"Reconvert")):u("",!0),o.convertedInfo?u("",!0):(l(),c("span",ht,"Convert"))]),o.converting?(l(),c("svg",ut,ft)):u("",!0),o.log!=""?(l(),c("button",{key:1,onClick:e[8]||(e[8]=d=>o.showingLogDialog=!0),class:"log-button",disabled:o.converting},"View conversion log",8,_t)):u("",!0)]),pt,gt])}var yt=f(st,[["render",vt],["__scopeId","data-v-1f62a342"]]);const zt={name:"FolderProperties",components:{},props:{file:{type:Object,default:{}}},watch:{file(t,e){}}},bt={class:"folder-properties"},wt={class:"path"},xt=y(" Path: "),$t={class:"path"},kt=a("p",null," You cannot do anything on folders yet. Browse to an image... ",-1);function Ct(t,e,s,n,o,i){return l(),c("div",bt,[a("div",wt,[xt,a("span",$t,p(s.file.path),1)]),kt])}var St=f(zt,[["render",Ct]]);const Vt={name:"Welcome"},It={class:"welcome"},Mt=R('<div class="headline"><div>Welcome to</div><h3>WebP Convert file manager</h3></div><p> To open a folder, click the &quot;+&quot; sign next to the folder name or double click the folder name </p><p><h4>Whats new?</h4><ul><li>You can now convert files and view conversion log</li></ul></p><p><h4>Whats planned ahead?</h4> I have plenty of ideas, but no planned priority. Ideas: <ul><li>Trigger bulk conversion on folders / mark for background conversion</li><li>Stats on folders</li><li>Display more info on images (mime type, dimensions and such)</li><li>Adjust conversion settings</li><li>Interface to allow adjusting quality on a conversion quickly and compare directly</li></ul> To support development, you can <a href="https://ko-fi.com/rosell" target="_blank">buy me a cup of coffee</a></p>',4),Ft=[Mt];function Rt(t,e,s,n,o,i){return l(),c("div",It,Ft)}var Yt=f(Vt,[["render",Rt]]);const Dt={name:"WCFM",components:{SVGs:Q,FileProperties:yt,FolderProperties:St,Modal:L,Files:$e,Splitpanes:X.exports.Splitpanes,Pane:X.exports.Pane,Welcome:Yt},methods:{onConvertClick(t){var n,o;let e=(o=(n=this.$refs.convertOptions)==null?void 0:n.general)==null?void 0:o.data,s={path:t,convertOptions:e};console.log(s),v.post("convert",s,function(i){console.log("convert response:",i)})},onConvertCloseClick(){console.log("CLRCL"),this.showConvertOptions=!1},onFileSelect(t,e){this.file={path:t,isDir:e}},displayInfo(t){var e=this;v.post("info",{path:t},function(s){e.selectedInfo=s})}},mounted(){var t=this;v.post("get-folder",{path:""},function(e){t.item=e.children[0]})},data(){return{file:null,selectedItem:null,item:null,treeStatusText:"loading file tree...",selectedInfo:{},showConvertOptions:!1}},provide(){return{wcfm:this}}},Ot={class:"wcfm",style:{overflow:"hidden"}},Xt={class:"pane-content"},Lt={key:0,class:"pane-content"};function Tt(t,e,s,n,o,i){const r=m("SVGs"),h=m("Files"),d=m("pane"),g=m("FileProperties"),N=m("FolderProperties"),P=m("Welcome"),Z=m("splitpanes");return l(),c("div",Ot,[_(r),_(Z,{class:"default-theme",style:{position:"absolute",top:"0",left:"0"}},{default:b(()=>[_(d,{size:"30"},{default:b(()=>[a("div",Xt,[a("div",null,[_(h,{item:o.item,statusText:o.treeStatusText,onSelect:i.onFileSelect},null,8,["item","statusText","onSelect"])])])]),_:1}),_(d,{size:"70",style:{"overflow-y":"auto"}},{default:b(()=>[o.file?(l(),c("div",Lt,[o.file.isDir?u("",!0):(l(),z(g,{key:0,file:o.file},null,8,["file"])),o.file.isDir?(l(),z(N,{key:1,file:o.file},null,8,["file"])):u("",!0)])):u("",!0),o.file?u("",!0):(l(),z(P,{key:1}))]),_:1})]),_:1})])}var Wt=f(Dt,[["render",Tt]]);const F=B(Wt);F.use(O);F.use(U,{defaultHtml:!1});window.wcfmoptions||(window.wcfmoptions={},window.wcfmoptions.poster=function(t,e,s,n){switch(t){case"get-folder":switch(e.path){case"":var o={children:[{name:"/",isDir:!0,nickname:"root"}]};break;case"/":var o={children:[{name:"empty-folder",isDir:!0,isEmpty:!0},{name:"file",isDir:!1,isConverted:!0},{name:"aaa",isDir:!1,isConverted:!0},{name:"test-folder",isDir:!0},{name:"file2",isDir:!1,isConverted:!1}]};break;case"/empty-folder":var o={children:[]};break;case"/test-folder":var o={children:[{name:"banana",isDir:!1},{name:"subfolder",isDir:!0},{name:"apple",isDir:!1}]};break;case"/test-folder/subfolder":var o={children:[{name:"file2",isDir:!1},{name:"file1",isDir:!1}]};break;default:n();return}break;case"conversion-settings":var o={systemStatus:{converterRequirements:{gd:{extensionLoaded:!1,compiledWithWebP:!0}}}};break;case"info":if(e.path=="/file2")var o={original:{size:100,url:"http://localhost:3000/src/assets/200x100.jpg"},converted:{size:70,url:"http://localhost:3000/src/assets/200x100.jpg"},log:`blah blah blah
\rand *more* blah`};else if(e.path=="/file")var o={original:{size:100,url:"http://localhost:3000/src/assets/dummy2.jpg"},log:"blah blah *blah*"};else var o={original:{size:100,url:"http://localhost:3000/src/assets/dummy.jpg"},converted:{size:70,url:"http://localhost:3000/src/assets/dummy.jpg"},log:"blah blah *blah*"};break;case"convert":if(e.path=="/file2")var o={success:!1,data:"We pretend file2 errors converting...",log:"Oh no!"};else var o={success:!0,converted:{size:26050,url:"http://we0/wordpress/wp-content/uploads/2021/10/Screenshot_2021-10-04_13-43-11.png.webp"},log:`All is *groovy*
next line`};break;default:var o="ok";break}s(o)});F.mount("#webpconvert-filemanager");
