@webhandle/tree-file-browser 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-lib/image-browser-view-methods/upload.mjs +1 -0
- package/package.json +1 -1
- package/public/tree-file-browser/resources/js/tree-file-browser.js +1 -1
- package/public/tree-file-browser/resources/js/tree-file-browser.js.map +1 -1
- package/views/webhandle-tree-image-browser/guilded-image-upload-form.tri +4 -0
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t={547:t=>{t.exports=function(t,e){return e=e?" ":"\n",(""+t).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">").replace(/\r\n/g,e).replace(/[\r\n]/g,e)}},161:t=>{t.exports=function(){function t(){let t=document.createElement("div");t.classList.add("material-icons-styles-marker"),document.body.appendChild(t),window.getComputedStyle(t).content.indexOf("loaded")<0&&document.head.insertAdjacentHTML("beforeend",'<link rel="stylesheet" href="/@dankolz/webhandle-admin-icons/resources/css/admin-icons.css">'),t.remove()}document.body?t():document.addEventListener("DOMContentLoaded",t)}},799:(t,e,i)=>{let{imageExtensions:n,smallerSizeExt:s,imageSizeExt:a}=i(211);const l=i(42),r=i(198),o=i(29),c=i(73),d=i(148);function u(t){let e=l(t.variants);t.preview=e;let i=d(t.variants);t.primary=i}t.exports=function(t){let e=t.filter((t=>!t.directory)),i=e.filter((t=>t.name.toLowerCase().endsWith(".json"))),n=e.filter(r),s={};function a(t){if(t in s)return s[t];let e={baseName:t,variants:[]};return s[t]=e,e}for(let t of i)a(c(t.name)).definitionFile=t;for(let t of n.map(o))a(t.baseName).variants.push(t);for(let t of Array.from(Object.keys(s)))0==s[t].variants.length&&delete s[t];return Object.values(s).forEach(u),s}},211:t=>{let e={imageExtensions:["jpg","jpeg","png","gif","tiff","webp"],smallerSizeExt:["quarter","half"]};e.imageSizeExt=[...e.smallerSizeExt,"std","2x"],t.exports=e},73:t=>{t.exports=function(t){return t.substring(0,t.lastIndexOf("."))}},42:(t,e,i)=>{let{imageExtensions:n,smallerSizeExt:s,imageSizeExt:a}=i(211);t.exports=function(t){for(let e of a)for(let i of n)for(let n of t)if(n.size==e&&n.ext==i)return n}},148:(t,e,i)=>{let{imageExtensions:n,smallerSizeExt:s,imageSizeExt:a}=i(211),l=["std","2x",...s],r=n.filter((t=>"webp"!=t));t.exports=function(t){for(let e of l)for(let i of r)for(let n of t)if(n.size==e&&n.ext==i)return n}},600:(t,e,i)=>{let{imageExtensions:n,smallerSizeExt:s,imageSizeExt:a}=i(211);t.exports=function(t){let e=t.toLowerCase();for(let t of n)if(e.endsWith("."+t))return!0;return!1}},198:(t,e,i)=>{const n=i(600);t.exports=function(t){return n(t.name)}},29:(t,e,i)=>{let{imageExtensions:n,smallerSizeExt:s,imageSizeExt:a}=i(211);t.exports=function(t){let e={size:"std",file:t},i=t.name;e.ext=i.substring(i.lastIndexOf(".")+1);let n=i.substring(0,i.lastIndexOf("."));e.baseName=n;for(let t of a){let i="-"+t;if(n.endsWith(i)){e.size=t,e.baseName=n.substring(0,n.length-i.length);break}}return e}},772:(t,e,i)=>{let n=i(263),s=0;"string"!=typeof n&&n.default&&(n=n.default);var a=function(t){this.id="dialog"+(new Date).getTime()+s++,Object.assign(this,t),this.on||(this.on={}),this.on[".btn-cancel"]||(this.on[".btn-cancel"]=function(){}),this.on[".btn-close"]||(this.on[".btn-close"]=function(){}),t.buttons||(this.buttons=[{classes:"btn btn-primary btn-ok",label:"OK"},{classes:"btn btn-cancel",label:"Cancel"}]),this.body=t.body};a.prototype.getBodySelector=function(){return"#"+this.id+" .body"},a.prototype.getFrameSelector=function(){return"#"+this.id},a.prototype.addStylesIfNeeded=function(){document.querySelector("#dialog-frame-styles")||document.querySelector("head").insertAdjacentHTML("beforeend",'<style type="text/css" id="dialog-frame-styles">'+n+"</style>")},a.prototype.renderButton=function(t){return`<button class="${t.classes}" type="button">${t.label}</button>`},a.prototype.generateFrame=function(){let t=this.buttons.map(this.renderButton).join("");return`\n<div class="dialog-frame ${this.dialogFrameClass||""}" id="${this.id}" >\n\t<div class="mask">\n\t</div>\n\t<div class="the-dialog">\n\t\t<div class="close btn-close">×</div>\n\t\t<div class="head">\n\t\t\t${this.title}\n\t\t</div>\n\t\t<div class="body">\n\t\t</div>\n\t\t<div class="foot">\n\t\t\t${t}\n\t\t</div>\n\t</div>\n</div>\n\t`},a.prototype.open=function(){let t=this;this.addStylesIfNeeded(),document.querySelector("body").insertAdjacentHTML("beforeend",this.generateFrame());let e,i=this.getBodySelector(),n=this.getFrameSelector(),s=document.querySelector(i),a=document.querySelector(n);function l(){setTimeout((function(){let e=document.querySelector(n+" .head").clientHeight+document.querySelector(n+" .foot").clientHeight;s.style.maxHeight="calc(90vh - "+e+"px)",a.classList.add("open"),t.afterOpen&&t.afterOpen(s,t)}))}return a.addEventListener("click",(function(e){for(let i in t.on){let n=a.querySelector(i);if(e.target==n){let e=t.on[i]();"boolean"==typeof e?e&&t.close():"function"==typeof Promise&&e instanceof Promise?e.then((function(e){!1!==e&&t.close()})):t.close();break}}})),"function"==typeof this.body?e=this.body(s,this):"string"==typeof this.body&&(e=this.body),"string"==typeof e?(s.insertAdjacentHTML("beforeend",e),l()):"function"==typeof Promise&&e instanceof Promise&&e.then((function(t){s.insertAdjacentHTML("beforeend",t),l()})),this},a.prototype.close=function(){return document.querySelector(this.getFrameSelector()).remove(),this},t.exports=a},89:(t,e,i)=>{const n=i(939),s=i(674),a=i(493);t.exports=function(t,e){let i=n(t,e);return i=s(i,e),i=a(i,e),i}},939:t=>{function e(t){return t instanceof Date?t:new Date(t)}function i(t,e,i){for(t=""+t;t.length<e;)t=i+t;return t}function n(t){return`${(t=e(t)).getFullYear()}-${i(t.getMonth()+1,2,"0")}-${i(t.getDate(),2,"0")}`}function s(t){let n=i((t=e(t)).getHours(),2,"0"),s=i(t.getMinutes(),2,"0");return i(t.getSeconds(),2,"0"),i(t.getMilliseconds(),4,"0"),`${n}:${s}`}let a=/\sname=["'](.*?)["']/i,l=/\svalue=["'](.*?)["']/i,r=/\stype=["'](.*?)["']/i,o=/(<input.*?>)/i,c=/\schecked(=["'](.*?)["'])?/i,d={"&":"&",'"':""","<":"<"},u=new Function("data","with (data.context) {\n\t\ttry {\n\t\t\treturn eval(data.expression);\n\t\t} catch (e) {\n\t\t\treturn null;\n\t\t}\n\t}");function h(t,e){return u.call(this,{context:t,expression:e})}function p(t,e){return Array.isArray(e)?e.includes(t):t==e}t.exports=function(t,e){let i="";return t.split(o).forEach((t=>{if(0==t.toLowerCase().indexOf("<input")){let u=t.match(a),f=u?u[1]:null;u=t.match(r);let m=(u?u[1]:"text").toLowerCase();if("text"===m||"hidden"===m||"date"===m||"time"===m||"datetime-local"===m||"search"===m||"email"===m||"number"===m||"tel"===m||"url"===m||"month"===m||"week"===m||"color"===m||"week"===m){u=t.match(l);let a,r=u?u[1]:null,c=h(e,f);if("date"===m){if(c){let t=c;try{c=n(c)}catch(e){c=t}"Invalid date"==c&&(c=t)}}else if("time"===m){if(c){let t=c;try{c=s(c)}catch(e){c=t}"Invalid date"==c&&(c=t)}}else if("datetime-local"===m&&c){let t=c;try{c=n(o=newValue)+"T"+s(o)}catch(t){}"Invalid date"==c&&(c=t)}null==c?a="":(c=function(t){null==t&&(t=""),"string"!=typeof t&&(t=""+t);for(let[e,i]of Object.entries(d))t=t.split(e).join(i);return t}(c),a=' value="'+c+'"'),null!=r?null!=c&&(t=t.replace(l,a)):t=(t=t.endsWith("/>")?t.slice(0,-2):t.slice(0,-1))+a+" />",i+=t}else if("radio"===m){u=t.match(l);let n=u?u[1]:null,s=h(e,f);n?s&&s==n?t.match(c)||(t=t.endsWith("/>")?t.slice(0,-2):t.slice(0,-1),t+=' checked="checked" />'):t=t.replace(c,""):s&&"false"!=s&&"off"!=s?t.match(c)||(t=t.endsWith("/>")?t.slice(0,-2):t.slice(0,-1),t+=' checked="checked" />'):t=t.replace(c,""),i+=t}else if("checkbox"===m){u=t.match(l);let n=u?u[1]:null,s=h(e,f);n?s&&p(n,s)?t.match(c)||(t=t.endsWith("/>")?t.slice(0,-2):t.slice(0,-1),t+=' checked="checked" />'):t=t.replace(c,""):!s||p("false",s)||p("off",s)?t=t.replace(c,""):t.match(c)||(t=t.endsWith("/>")?t.slice(0,-2):t.slice(0,-1),t+=' checked="checked" />'),i+=t}else i+=t}else i+=t;var o})),i}},11:t=>{t.exports='<div id="kalpa-tree-icons" style="position: absolute; left: -10000px; width: 0; height: 0;">\n\t<svg xmlns="http://www.w3.org/2000/svg">\n\t\t<symbol id="icon-generic" viewBox="0 0 12 12">\n\t\t\t<path\n\t\t\t\td="M9.7 12H2.3C1 12 0 11 0 9.7V2.3C0 1 1 0 2.3 0h7.5C11 0 12 1 12 2.3v7.5C12 11 11 12 9.7 12zM8 5.3C8 4.6 7.4 4 6.6 4H5.3C4.6 4 4 4.6 4 5.3v1.3C4 7.4 4.6 8 5.3 8h1.3C7.4 8 8 7.4 8 6.6V5.3z" />\n\t\t</symbol>\n\t\t<symbol id="icon-root" viewBox="0 0 16 16">\n\t\t\t<path d="M9 16V9h7v7H9zM9 0h7v7H9V0zM0 9h7v7H0V9zm0-9h7v7H0V0z" />\n\t\t</symbol>\n\t\t<symbol id="icon-metric" viewBox="0 0 100 100">\n\t\t\t<path\n\t\t\t\td="M50 100C22.4 100 0 77.6 0 50S22.4 0 50 0s50 22.4 50 50-22.4 50-50 50zm0-76.9c-14.8 0-26.9 12.1-26.9 26.9S35.2 76.9 50 76.9 76.9 64.8 76.9 50 64.8 23.1 50 23.1zm0 38.4c-6.4 0-11.5-5.2-11.5-11.5S43.6 38.4 50 38.4s11.5 5.2 11.5 11.5S56.4 61.5 50 61.5z" />\n\t\t</symbol>\n\t\t<symbol id="icon-perspective" viewBox="0 0 12 11">\n\t\t\t<path d="M12 11H0L5.9 0 12 11z" />\n\t\t</symbol>\n\t\t<symbol id="icon-objective" viewBox="0 0 12 10">\n\t\t\t<ellipse cx="6" cy="5" rx="6" ry="5" />\n\t\t</symbol>\n\t\t<symbol id="icon-find">\n\t\t\t<path\n\t\t\t\td="m 13.497323,12.433608 c 0.08422,0.978628 -1.417295,1.469942 -1.954282,0.657234 C 10.369384,11.968141 9.2411696,10.799391 8.087323,9.6566079 5.7875518,11.20515 2.2596241,10.270797 1.051352,7.7662065 -0.1027543,5.5922068 0.61269436,2.5743169 2.7539681,1.2885899 4.6322082,0.06461011 7.3623548,0.26924656 8.9286688,1.9183502 c 1.5121032,1.4872335 1.9726552,4.001359 0.8885116,5.8618536 -0.2008407,0.7179057 0.6439246,1.0286413 1.0395966,1.4627471 0.79551,0.9178591 1.752248,1.6943191 2.51171,2.6495761 0.08347,0.167322 0.129284,0.353872 0.128836,0.541081 z m -8.047,-9.7420001 C 3.5991559,2.6059751 2.107634,4.7815577 2.8684439,6.4772182 3.4629388,8.0470383 5.6500695,8.7859958 7.0177529,7.7488936 8.3664062,6.8424394 8.6521549,4.6587499 7.425963,3.52989 6.9118115,3.0069548 6.1883031,2.6803036 5.450323,2.6916079 z" />\n\t\t</symbol>\n\t\t<symbol id="icon-collapsed" viewBox="0 0 9 6">\n\t\t\t<path\n\t\t\t\td="M4.4 6c-.2 0-.5-.1-.9-.5L.3 1.8C-.1 1.4-.1.7.3.3s1.1-.4 1.5 0l2.7 3.2L7.1.4C7.5 0 8.2 0 8.6.4c.4.4.4 1.1 0 1.5L5.4 5.5c-.3.4-.8.5-1 .5z" />\n\t\t</symbol>\n\t</svg>\n</div>'},724:(t,e,i)=>{const n=i(852),s=i(224),a=i(622),l=i(11);let r=[];t.exports=async function(t={}){let e=Object.assign({treeContainerSelector:"#kalpa-tree",stream:new n,loadStyles:!0,styleLocation:"/kalpa-tree-on-page/css/white-page-tree.css",scriptLocation:"/kalpa-tree-on-page/js/kalpa-tree.js",data:null},t);return new Promise(((t,i)=>{document.querySelector("#kalpa-tree-icons")||document.body.insertAdjacentHTML("beforeend",l),async function(t){return new Promise(((e,i)=>{if(window.KalpaTree)e(window.KalpaTree);else{let i=document.createElement("script");i.setAttribute("src",t),i.onload=async function(){e(window.KalpaTree)},document.head.appendChild(i)}}))}(e.scriptLocation).then((i=>{let n=new(0,i.default)({stream:e.stream,accessors:{icon:"nodeType"},initialSelection:0});if(n.on("error",(function(t){console.log("tree error",t)})),n.on("move",(function(t,e,i,n,s){t.parentId=e.id})),n.serializeTree=function(){let t=[];return t.push(n.root),s(this,n.root.id,t),t},n.serialize=function(){var t=[];return t.push(n.get(0)),a(n,0,t),JSON.stringify(t)},e.treeContainerSelector&&document.querySelector(e.treeContainerSelector).appendChild(n.render().el.node()),e.data&&Array.isArray(e.data))for(let t of e.data)n.options.stream.emit("data",t);t(n)})),e.loadStyles&&e.styleLocation&&(r.includes(e.styleLocation)||(r.push(e.styleLocation),document.head.insertAdjacentHTML("beforeend",`<link href="${e.styleLocation}" rel="stylesheet">`)))}))}},622:t=>{t.exports=function t(e,i,n){e.children(i).forEach((function(s){s.parentId=i,n.push(s),t(e,s.id,n)}))}},224:t=>{t.exports=function t(e,i,n){e.children(i).forEach((function(s){s.parentId=i,n.push(s),t(e,s.id,n)}))}},852:t=>{t.exports=class{constructor(){this.handles={}}on(t,e){let i=this.handles[t];return i||(i=this.handles[t]=[]),i.push(e),this}emit(t,...e){if(t in this.handles)for(let i of this.handles[t])i.apply(this,e)}}},263:(t,e,i)=>{i.r(e),i.d(e,{default:()=>n});const n=".dialog-frame {\n\tposition: fixed;\n\ttop: 0;\n\tbottom: 0;\n\tleft: 0;\n\tright: 0;\n\tz-index: 10000;\n\topacity: 0;\n\ttransition: opacity .3s;\n\toverflow: hidden;\n\t\n\t\n\tdisplay: grid;\n\tjustify-content: center;\n\talign-content: center;\n\tpadding: 5vh 5%;\n}\n\n.dialog-frame.open {\n\topacity: 1;\n}\n\n.dialog-frame .mask {\n\tposition: absolute;\n\tbox-sizing: border-box;\n\ttop: 0;\n\tbottom: 0;\n\tleft: 0;\n\tright: 0;\n\tbackground-color: #333333;\n\topacity: .7;\n\theight: 100%;\n\tz-index: 0;\n\t\n}\n\n\n.dialog-frame .the-dialog {\n\tposition: relative;\n\tdisplay: inline-block;\n\tz-index: 1;\n\tborder-radius: 5px;\n\tbackground-color: white;\n\toverflow: hidden;\n\ttransform: scale(.84);\n\ttransition: transform 0.262s cubic-bezier(.77,-1.72,.08,1);\n}\n\n.dialog-frame.open .the-dialog {\n\ttransform: scale(1);\n}\n\n.dialog-frame .the-dialog .close {\n\tposition: absolute;\n\ttop: 0px;\n\tright: 0px;\n\tpadding: 8px 10px 10px 10px;\n\tcursor: pointer;\n}\n\n.dialog-frame .the-dialog .head {\n\tborder-bottom: solid #aaaaaa 1px;\n\tline-height: 2em;\n\tpadding: 0 10px;\n}\n\n.dialog-frame .the-dialog .body {\n\tbox-sizing: border-box;\n\tpadding: 20px;\n\toverflow: auto;\n\tmax-height: calc(90vh - 75px);\n}\n\n.dialog-frame .the-dialog .foot {\n\tborder-top: solid #aaaaaa 1px;\n\tpadding: 10px;\n}\n\n.dialog-frame .the-dialog .foot button {\n\tmargin-right: 15px;\n}"},493:t=>{let e=/\sname=["'](.*?)["']/i,i=/(<select[\w\W]*?select\w*>)/im,n=/\sselected(=["'](.*?)["'])?/i,s=new Function("data","with (data.context) {\n\t\ttry {\n\t\t\treturn eval(data.expression);\n\t\t} catch (e) {\n\t\t\treturn null;\n\t\t}\n\t}");t.exports=function(t,a){let l="";return t.split(i).forEach((t=>{if(0==t.toLowerCase().indexOf("<select")){let r=t.match(e),o=r?r[1]:null,c=function(t,e){return s.call(this,{context:t,expression:e})}(a,o);if(null!=c){let e=(t=t.replace(n,"")).match(new RegExp("value=[\"']"+((i=c)&&i.replace?i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):i)+"[\"']","i"));if(e){let i=t.indexOf(e[0])+e[0].length;t=t.slice(0,i)+' selected="selected" '+t.substring(i)}}l+=t}else l+=t;var i})),l}},674:t=>{let e=/\sname=["'](.*?)["']/i,i=/(<textarea[\w\W]*?textarea\w*>)/im,n=new Function("data","with (data.context) {\n\t\ttry {\n\t\t\treturn eval(data.expression);\n\t\t} catch (e) {\n\t\t\treturn null;\n\t\t}\n\t}");t.exports=function(t,s){let a="";return t.split(i).forEach((t=>{if(0==t.toLowerCase().indexOf("<textarea")){let i=t.match(e),l=i?i[1]:null;if(l){let e=function(t,e){return n.call(this,{context:t,expression:e})}(s,l);if(null!=e){let i=t.indexOf(">"),n=t.lastIndexOf("<");t=t.substring(0,i+1)+e+t.substring(n)}}a+=t}else a+=t})),a}},134:t=>{t.exports=class{constructor(t,e,i,n){this.conditionalExpression=t,this.dataExpression=e,this.handlingExpression=i||"defaultTemplate",this.tripartite=n}}},824:t=>{t.exports=function(t,e){if(!t)return e;if(!e)return e;if(0!=e.indexOf("../")&&0!=e.indexOf("./"))return e;for(var i=t.split("/"),n=e.split("/");i.length&&!i[0];)i.shift();for(;n.length&&!n[0];)n.shift();if(0==e.indexOf("../")){for(;n.length&&".."==n[0];)i.pop(),n.shift();for(i.pop();n.length;)i.push(n.shift());return i.join("/")}if(0==e.indexOf("./")){for(n.shift(),i.pop();n.length;)i.push(n.shift());return i.join("/")}return e}},668:(t,e,i)=>{const n=i(502);let s=new Function("additionalContexts","with ({\n\t\t'$globals': additionalContexts.globalData\n\t}) {\n\t\twith (additionalContexts.dataFunctions) {\n\t\t\twith (additionalContexts.context) {\n\t\t\t\ttry {\n\t\t\t\t\treturn eval(additionalContexts.expression);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}");function a(t,e,i,n){return i=i||{},n=n||{},s.call(this,{globalData:n,dataFunctions:i,context:t,expression:e})}t.exports=function(t,e,i,s){if(!e)return null;if("string"==typeof e&&(e=e.trim()),"$this"===e||"this"===e)return t;if("object"==typeof t&&e in t)return t[e];if('""'===e||"''"===e)return"";let l=n(t,e);return null==l&&(l=n({$globals:s},e)),null==l&&(l=a.call(t,t,e,i,s)),l}},268:(t,e,i)=>{let n=i(134);var s=i(824);let a=i(668);t.exports=class{constructor(t,e,i={},n="",s={}){this.tripartite=t,this.template=e,this.destination=n,this.initialData=i,this.currentData=[],this.dataFunctions=s,this.continueOnTripartiteError=!0,this.callCount=0,this.callDepthLimit=1e3}run(t){let e;return t&&(e=()=>{t(null,this.destination)}),this._run(this.template,this.initialData,e),this.destination}_resolveHandlingExpression(t,e,i){return e||(e=defaultTemplateName),"$"==e.charAt(0)&&(e=a(i,e.substring(1),this.dataFunctions,this.initialData)),0!=e.indexOf("./")&&0!=e.indexOf("../")||(e=s(t.templateMeta.name,e)),e}_run(t,e,i){let s=[...t.parts].reverse();const l=()=>{if(this.callCount++,this.callCount++>this.callDepthLimit)setTimeout((()=>{this.callCount=0,l()}));else if(s.length>0){let r=s.pop();if("string"==typeof r)this.output(r),l();else if(r instanceof n){let n,s=r.conditionalExpression||r.dataExpression,o=!1;if(null==s||null==s||""===s?o=!0:r.conditionalExpression?a(e,r.conditionalExpression,this.dataFunctions,this.initialData)&&(o=!0):(n=a(e,r.dataExpression,this.dataFunctions,this.initialData),null==n?o=!1:("number"==typeof n||Array.isArray(n)&&n.length>0||n)&&(o=!0)),o){r.dataExpression&&void 0===n&&(n=a(e,r.dataExpression,this.dataFunctions,this.initialData)),null==n&&(n=e);let s,o=this._resolveHandlingExpression(t,r.handlingExpression,e),c=(Array.isArray(n)?[...n]:[n]).reverse();const d=()=>{if(c.length>0){let t=c.pop();this._run(s,t,(()=>{d()}))}else l()};o in this.tripartite.templates?(s=this.tripartite.getTemplate(o),s?d():this.continueOnTripartiteError&&l()):this.tripartite.loadTemplate(o,(t=>{if(t)s=t,d();else{let t="Could not load template: "+o;if(console.error(t),this.continueOnTripartiteError)l();else{let e=new Error(t);if(!i)throw e;i(e)}}}))}else l()}else"function"==typeof r&&(r.write?r.write(e,this.destination,(()=>{l()})):(this.output(r(e)),l()))}else i&&i()};l()}output(t){null!=t&&("string"==typeof this.destination?this.destination+=t:this.destination.write&&this.destination.write(t))}}},502:t=>{t.exports=function(t,e){if(null==t)return t;let i;for("string"==typeof e?i=e.trim().split("."):Array.isArray(e)&&(i=e);i.length>0;){let e,n=i.shift();if(n.indexOf(" ")>-1)return null;if("this"===n||"$this"===n?e=t:"object"==typeof t&&n in t&&(e=t[n]),0==i.length)return e;t=e}}},158:(t,e,i)=>{function n(t){return null!==t&&"object"==typeof t&&"function"==typeof t.pipe}"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});let s=i(268),a=i(134);class l{constructor(t={}){this.templates={defaultTemplate:this._makeTemplate((function(t){return""+t}))};let{constants:e={templateBoundary:"__",templateNameBoundary:"##"}}=t;this.constants=e,this.secondaryTemplateFunctionObject=t.secondaryTemplateFunctionObject,this.loaders=t.loaders||[],this.dataFunctions=t.dataFunction||{}}_makeTemplate(t){if((e=t)&&"function"==typeof e&&e.write&&e.parts&&e.templateMeta)return t;var e;let i=this,a=function(t){let e=null,i=null,s=null;for(let t=1;t<arguments.length;t++){let a=arguments[t];n(a)?e=a:"function"==typeof a?s=a:"object"==typeof a&&(i=a)}return a.write(t,e,s,i)};return a.write=function(e,n,l,r={}){if(t&&t.write)return t.write.apply(t,arguments);{let t=new s(i,a,e,n||"",i.dataFunctions);return r&&"continueOnTripartiteError"in r&&(t.continueOnTripartiteError=r.continueOnTripartiteError),t.run(l)}},a.parts=[],t&&"function"==typeof t&&a.parts.push(t),a.templateMeta={},a}addTemplate(t,e){return"string"==typeof e?e=this.parseTemplate(e):"function"==typeof e&&(e=this._makeTemplate(e)),this.templates[t]=e,e.templateMeta=e.templateMeta||{},e.templateMeta.name=t,e}createBlank(){return new l}getTemplate(t){return this.templates[t]}loadTemplate(t,e){if(t in this.templates)e(this.templates[t]);else{let i=this,n=this.loaders.length,s=!1;0==n?(i.templates[t]=null,e(i.getTemplate(t))):this.loaders.forEach((a=>{s||a(t,(a=>{s||(n--,a?(s=!0,i.addTemplate(t,a)):0==n&&(s=!0,i.templates[t]=null),s&&e(i.getTemplate(t)))}))}))}}parseTemplateScript(t){for(var e=this.tokenizeTemplateScript(t),i=null,n=0;n<e.length;n++){var s=e[n];if(s.active)i=s.content;else if(i){var a=this.addTemplate(i,this.stripTemplateWhitespace(s.content));this.secondaryTemplateFunctionObject&&(this.secondaryTemplateFunctionObject[i]=a),i=null}}}stripTemplateWhitespace(t){var e=t.indexOf("\n");return e>-1&&""==t.substring(0,e).trim()&&(t=t.substring(e+1)),(e=t.lastIndexOf("\n"))>-1&&""==t.substring(e).trim()&&(t=t.substring(0,e)),t}_createActiveElement(t,e,i,n,s){let l=new a(t,e,i,n);return l.templateMeta=s,l}pt(t){return this.parseTemplate(t)}parseTemplate(t){var e=this.tokenizeTemplate(t);let i=this._makeTemplate();var n=i.templateMeta;for(let t of e)t.active?i.parts.push(this.tokenizeActivePart(t.content,n)):t.content&&i.parts.push(t.content);return i}tokenizeActivePart(t,e){var i=null,n=null,s=null,a=t.indexOf("??");a>-1?(i=t.substring(0,a),a+=2):a=0;var l=t.indexOf("::");return l>-1?(n=t.substring(a,l),s=t.substring(l+2)):n=t.substring(a),this._createActiveElement(i,n,s,this,e)}tokenizeTemplate(t){return this.tokenizeActiveAndInactiveBlocks(t,this.constants.templateBoundary)}tokenizeTemplateScript(t){return this.tokenizeActiveAndInactiveBlocks(t,this.constants.templateNameBoundary)}tokenizeActiveAndInactiveBlocks(t,e){let i=t.length,n=0,s=!1,a=[];for(;n<i;){let r=t.indexOf(e,n);-1==r&&(r=i);var l={active:s,content:t.substring(n,r)};a.push(l),n=r+e.length,s=!s}return a}}var r=new l;"undefined"!=typeof window&&(r.secondaryTemplateFunctionObject=window),t.exports=r,void 0!==i.g&&(i.g.Tripartite||(i.g.Tripartite=l),i.g.tripartite||(i.g.tripartite=r))},559:(t,e,i)=>{var n=i(158);t.exports=n.addTemplate("webhandle-tree-image-browser/extension-pill",'<span class="extension-pill">__this__</span>')},574:(t,e,i)=>{var n=i(158);t.exports=n.addTemplate("webhandle-tree-image-browser/guilded-file-upload-form",'<div class="guided-image-upload-form ei-form">\n\t<label>\n\t\tSource file name:<br>\n\t\t__nativeName__\n\t</label>\n\t<label>\n\t\tAfter uploaded name (with extension):\n\t\t<input name="name" type="text" />\n\t</label>\n\t\n</div>')},115:(t,e,i)=>{var n=i(158);t.exports=n.addTemplate("webhandle-tree-image-browser/guilded-image-upload-form",'<div class="guided-image-upload-form ei-form">\n\t<label>\n\t\tSource file name:<br>\n\t\t__nativeName__\n\t</label>\n\t<label>\n\t\tNative resolution:<br>\n\t\t__stats.width__ x __stats.height__\n\t</label>\n\t<label>\n\t\tAfter uploaded name (no extension):\n\t\t<input name="name" type="text" />\n\t</label>\n\t<div class="radio-options">\n\t\tOutput format:\n\t\t<label>\n\t\t\t<input type="radio" name="outputFormat" value="image/png" /> <span class="extension-pill">PNG</span>\n\t\t</label>\n\t\t<label>\n\t\t\t<input type="radio" name="outputFormat" value="image/jpeg" /> <span class="extension-pill">JPG</span>\n\t\t</label>\n\t</div>\n\t<label>\n\t\tOn screen width (px):\n\t\t<input name="width" type="number" />\n\t</label>\n\t\n\t<label>\n\t\tAlt text:\n\t\t<textarea name="altText"></textarea>\n\t</label>\n\t\n</div>')},24:(t,e,i)=>{var n=i(158);t.exports=n.addTemplate("webhandle-tree-image-browser/image-browser-frame",'<div class="image-browser-frame">\n\t<div class="directory-side">\n\t\t<div class="treebox">\n\n\t\t</div>\n\t\t<div class="directory-controls">\n\t\t\t<button type="button" class="btn create-directory" title="create new directory">\n\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\tcreate_new_folder\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" class="btn delete-directory" title="delete selected directory">\n\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\tfolder_delete\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>\n\t<div class="node-view">\n\t\t<div class="view-controls">\n\t\t\t<div class="left">\n\t\t\t\t<input name="filter" type="text" placeholder="filter" />\n\t\t\t\t<button class="clear-filter">×</button>\n\t\t\t</div>\n\t\t\t<div class="right">\n\t\t\t\t<span class="view-icons">\n\t\t\t\t\t<button type="button" class="show-large-tiles" title="show big tiles" data-show-class="grid-large">\n\t\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\t\tgrid_view\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" class="show-small-tiles" title="show small tiles"\n\t\t\t\t\t\tdata-show-class="grid-small">\n\t\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\t\tgrid_on\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" class="show-list-rows" title="show as rows" data-show-class="rows">\n\t\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\t\tlist\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" class="show-list-text" title="show as list" data-show-class="list-text">\n\t\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\t\ttable_rows\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t</span>\n\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="node-content">\n\t\t\t<div class="box-holder">\n\t\t\t\t<div class="choice-boxes">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="bottom-controls">\n\t\t\t<div class="file-controls">\n\t\t\t\t<button type="button" class="btn delete-file" title="delete selected file(s)">\n\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\tdelete\n\t\t\t\t\t</span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" class="btn upload-file" title="upload file(s)">\n\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\tupload\n\t\t\t\t\t</span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<div class="folder-info">\n\t\t\t\t\n\t\t\t</div>\n\n\t\t</div>\n\t</div>\n\t<div class="drop-cover file-drop-cover">\n\t\t<div class="drop-type literal">\n\t\t\t<div class="msg">\n\t\t\t\t<h2>\n\t\t\t\t\tJust Do It\n\t\t\t\t</h2>\n\t\t\t\t<p>\n\t\t\t\t\tWe won\'t mess the files at all, just upload them.\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<div class="drop-cover img-drop-cover">\n\t\t<div class="drop-type guided-upload">\n\t\t\t<div class="msg">\n\t\t\t\t<h2>Guided Upload</h2>\n\t\t\t\t<p>\n\t\t\t\t\tLet us help you rename, and resize (if needed), the files by asking you questions\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="drop-type automatic">\n\t\t\t<div class="msg">\n\t\t\t\t<h2>\n\t\t\t\t\tWeb Safe\n\t\t\t\t</h2>\n\t\t\t\t<p>\n\t\t\t\t\tWe\'ll rename the files so they fit better with the web and create multiple formats images.\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="drop-type literal">\n\t\t\t<div class="msg">\n\t\t\t\t<h2>\n\t\t\t\t\tJust Do It\n\t\t\t\t</h2>\n\t\t\t\t<p>\n\t\t\t\t\tWe won\'t mess the files at all, just upload them.\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\n\t</div>\n\t<div class="hidden-elements">\n\t\t<input name="fileUpload" type="file" placeholder="Upload a file" />\n\t\t\n\t</div>\n\n</div>')},466:(t,e,i)=>{var n=i(158);t.exports=n.addTemplate("webhandle-tree-image-browser/variant-choice-box",'<div class="variant-choice-box">\n\t<div class="img">\n\t\t__!this.thumbnail??\'<span class="material-icons thumbnail-icon">\' + thumbnailIcon + \'</span>\'__\n\t\t__this.thumbnail??\'<img loading="lazy" class="thumbnail-image" src="\' + safeThumbnail + \'" />\'__\n\t</div>\n\t<div class="size-line">\n\t\t__size__\n\t</div>\n\t<div class="bottom">\n\t\t<div class="content">\n\t\t\t<div class="basename">\n\t\t\t\t__safeBaseName__\n\t\t\t</div>\n\t\t\t<div class="extensions">\n\t\t\t\t__extensions::./extension-pill__\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="actions">\n\t\t\t<button class="details">\n\t\t\t\t<span class="material-icons">more_vert</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>\n\n</div>')}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,i),a.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{function t([t,e]){let i=(t=t.trim()).split(" "),n=i.shift().trim(),s=i.join(" ").trim();return"string"==typeof e&&(e=e.trim()),{event:n,selector:s,handler:e}}i.d(n,{DY:()=>zt,Tq:()=>Lt,ZP:()=>jt,RM:()=>Ct});let e={tagName:"div",events:{}};class s{constructor(t){this.id=function(){let t=new Uint8Array(32);window.crypto.getRandomValues(t);let e=btoa(t);return e=e.replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,""),e}(),Object.assign(this,e),this.preinitialize.apply(this,arguments),Object.assign(this,t),this._ensureElement(),this.initialize.apply(this,arguments)}preinitialize(){}initialize(){}render(){return this}remove(){this.el.parentElement.removeChild(this.el)}appendTo(t){t.appendChild(this.el)}replaceContentsOf(t){t.innerHTML="",this.appendTo(t)}setElement(t){return this.el!==t&&(this.el=t,this._addListeners()),this}_createElement(t){let e=document.createElement(t);return e.setAttribute("id",this.id),e.view=this,e}_ensureElement(){this.el||this.setElement(this._createElement(this.tagName)),this._setAttributes(),this.className&&this.el.classList.add(this.className)}_setAttributes(t){if(this.attributes)for(let[t,e]of Object.entries(this.attributes))this.el.setAttribute(t,e)}_addListeners(){this.eventTriggers=Object.entries(this.events).map(t);let e=(i=this.eventTriggers,Array.from(i.reduce(((t,e)=>(t.add(e.event),t)),new Set)));var i;for(let t of e)this.el.addEventListener(t,this._eventHandler.bind(this))}_getCandidates(t){return"."===t?[this.el]:Array.from(this.el.querySelectorAll(t))}_eventHandler(t){for(let e of this.eventTriggers)if(t.type==e.event){let i=this._getCandidates(e.selector),n=null;for(let e of i)if(e===t.target||e.contains(t.target)){n=e;break}if(n){"string"==typeof e.handler?this[e.handler].call(this,t,n):"function"==typeof e.handler&&e.handler.call(this,t,n);break}}}}var a=i(24),l=i(466),r=(i(559),i(115)),o=i(574);let c=a,d=l,u=r,h=o;var p=i(724);function f(t,e){if(0==t)return"0 Bytes";var i=e||2,n=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,n)).toFixed(i))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][n]}let m,g="undefined"==typeof EventTarget?{}:EventTarget;m="undefined"!=typeof EventTarget?class extends g{constructor(t){super(t),this.innerEventTarget=t||this}on(t,e){let i=t=>{e.apply(this,t.detail)};return e.nativeListener=i,this.innerEventTarget.addEventListener(t,i),this}emit(t,...e){return this.innerEventTarget.dispatchEvent(new CustomEvent(t,{detail:e})),this}removeListener(t,e){return e=e.nativeListener||e,this.innerEventTarget.removeEventListener(t,e),this}}:class{constructor(){this.handles={}}on(t,e){let i=this.handles[t];return i||(i=this.handles[t]=[]),i.push(e),this}emit(t,...e){if(t in this.handles)for(let i of this.handles[t])i.apply(this,e)}removeListener(t,e){t in this.handles&&(this.handles[t]=this.handles[t].filter((t=>t!==e)))}};const v=m;var b=i(772),y=i(89);class w extends b{constructor(t){super(Object.assign({},t,{on:{".btn-ok":()=>(this.resolve(this.gatherData()),!0),".mask":()=>(this.resolve(),!0),".btn-cancel":()=>(this.resolve(),!0)}})),this.afterOpen&&(this.afterOpenOriginal=this.afterOpen),this.afterOpen=function(t,e){this.data&&(t.innerHTML=y(t.innerHTML,this.data));let i=t.querySelector("input, textarea");i&&i.focus(),this.afterOpenOriginal&&this.afterOpenOriginal(t,e)}}gatherData(){return function(t){let e={},i=t.querySelectorAll("input, textarea, select");for(let t of i){if("checkbox"===t.type){if(!t.checked)continue}else if("radio"===t.type&&!t.checked)continue;e[t.getAttribute("name")]=t.value}return e}(document.querySelector(this.getBodySelector()))}async open(){return this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),super.open(),this.promise}}async function x(t,e){let i=this.getSelectedFiles();if(i.files.length>0){let t=i.files,e=i.names;if(!this.deleteWithoutConfirm){let i=new w({title:"Delete File"+(t.length>1?"s":""),body:"<p>"+e.join(", ")+"</p>"}).open();if(!await i)return}for(let e of t){let t,i=e.relPath;this.eventNotificationPanel&&(t=this.eventNotificationPanel.addNotification({model:{status:"pending",headline:`deleting ${e.name}`}})),await this.sink.rm(i),this.eventNotificationPanel&&(t.remove(),t=this.eventNotificationPanel.addNotification({model:{status:"success",headline:`removed ${e.name}`},ttl:2e3}))}for(let t of i.boxes)t.remove()}this.emitter.emit("delete",{type:"delete",selected:i})}async function _(t,e){let i=this.currentNode.file.relPath,n=this.currentNode.file.name;if(!i)return;let s,a=new w({title:"Delete Directory",body:"<p>"+n+"</p>"}).open();if(!await a)return;this.eventNotificationPanel&&(s=this.eventNotificationPanel.addNotification({model:{status:"pending",headline:`deleting ${n}`}})),await this.sink.rm(i,{recursive:!0});let l=this.tree.selected(),r=this.tree.parent(l);this.tree.removeNode(l),this.tree.select(r.id),this.eventNotificationPanel&&(s.remove(),s=this.eventNotificationPanel.addNotification({model:{status:"success",headline:`removed ${n}`},ttl:2e3}))}function T(...t){return(t=t.filter((t=>!!t))).join("/")}function F(t){if(!t)return"";let e=t.split("/");return e.pop(),e.join("/")}function S(t){let e={id:this.idInd++,label:t.name,directory:t.directory,file:t,loaded:!1},i=this.nodes[this._determineParentPath(t.relPath)];return this.nodes[t.relPath]=e,i&&(e.parentId=i.id,e.path=t.relPath),t.path=e.path,e}function k(t){let e=new Set;if(t.variants)for(let i of t.variants)e.add(i.ext);else e.add(t.ext);let i=Array.from(e).filter((t=>!!t));return i.sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase()))),i}function E(t){let e=2e9,i=0;if(t.variants)for(let n of t.variants){let t=n.file.stat.size;t>i&&(i=t),t<e&&(e=t)}else{let n=t.file.stat.size;n>i&&(i=n),n<e&&(e=n)}return[e,i]}function O(t){return t.sort(((t,e)=>t.relPath.toLowerCase().localeCompare(e.relPath.toLowerCase()))),t}function L(t,e){return t.baseName.toLowerCase().localeCompare(e.baseName.toLowerCase())}function z(t){return t.split("/").join("-").split("..").join("-")}function C(t){return!!t.type.startsWith("image")&&!!(t.type.includes("jpeg")||t.type.includes("png")||t.type.includes("webp"))}function j(t,e){t in this||(this[t]=e)}function N(t){let e;return this.eventNotificationPanel&&(e=this.eventNotificationPanel.addNotification({model:{status:"pending",headline:`uploading ${t.name}`}})),e}class D extends b{constructor(t){super(Object.assign({},t,{on:{".btn-ok":()=>(this.resolve(),!0),".mask":()=>(this.resolve(),!0),".btn-cancel":()=>(this.resolve(),!0)}}))}async open(){return this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),super.open(),this.promise}}var A=i(547);function P(t,e){let i=e.getAttribute("data-show-class");this.changeFilesViewToClass(i)}function I(t){let e=this.el.querySelector(".choice-boxes");[...this.el.querySelector(".view-icons").querySelectorAll("button")].map((t=>t.getAttribute("data-show-class"))).forEach((t=>{e.classList.remove(t)})),e.classList.add(t)}function M(t,e){setTimeout((()=>{let t=this.el.querySelector('[name="filter"]').value,e=this.el.querySelectorAll(".choice-boxes .variant-choice-box");for(let i of e)i.classList.remove("hidden"),t&&(t=t.toLowerCase(),(i.variant.baseName.toLowerCase()+i.variant.extensions.map((t=>t.toLowerCase())).join()).indexOf(t)<0&&i.classList.add("hidden"));this.setFolderInfo()}))}function q(t,e){this.el.querySelector('[name="filter"]').value="",this.applyFilter()}function B(t,e){let i=this.el.querySelectorAll(".choice-boxes .variant-choice-box.selected");if(!t.ctrlKey&&!t.shiftKey)for(let t of i)t.classList.remove("selected");if(t.shiftKey){let t=e;do{if(t.classList.contains("selected"))break;t.classList.add("selected"),t=t.previousElementSibling}while(t)}else e.classList.toggle("selected");let n=this.getSelectedFiles();this.emitter.emit("select",{type:"select",selected:n})}function U(t,e){let i=e.closest(".variant-choice-box").variant,n=this._getAssociatedRealFiles(i),s='<div class="variant-details-information">';i.safeThumbnail&&(s+=`<div class="details-preview-image">\n\t\t<img loading="lazy" src="${i.safeThumbnail}" />\n\t\t</div>`),s+='<ul class="variants">';for(let t of n)s+='<li><a target="_blank" href="'+A(this.escapeAccessUrl(t.accessUrl))+'">',s+=A(t.name)+"</a> - "+this._formatBytes(t.stat.size),s+="</li>";s+="</ul>",s+="</div>",new D({title:"File Details: "+i.baseName,body:s,buttons:[{classes:"btn btn-primary btn-ok",label:"OK"}]}).open().then((async t=>{}))}function $(){let t=0,e=0,i=0,n=0,s=this.el.querySelectorAll(".choice-boxes .variant-choice-box");for(let a of s)a.classList.contains("hidden")||(e++,a.variant.variants?a.variant.variants.forEach((e=>{t++,i+=e.file.stat.size})):(t++,i+=a.variant.file.stat.size,n++));this.el.querySelector(".folder-info").innerHTML=`${e} items / ${t} files / ${this._formatBytes(i)} `,e>this.listTriggerSize&&this.changeFilesViewToClass("list-text"),this.el.querySelector(".view-icons").classList.remove("no-img"),e-n>this.listLockSize&&this.el.querySelector(".view-icons").classList.add("no-img")}function H(){this.el.querySelector(".folder-info").innerHTML="",this.el.querySelector(".choice-boxes").innerHTML='<div class="loading-info">Loading Information Now</div>',this.el.querySelector(".view-icons").classList.add("no-img")}function V(){return".img-drop-cover"}async function W(t,e){let i="literal",n=t.target.closest(".drop-type");n&&(n.classList.contains("guided-upload")?i="guided":n.classList.contains("automatic")&&(i="automatic")),this._cleanupDropDone(),t.preventDefault();let s=await this._getFilesFromEvent(t);this.uploadFiles(s,{uploadType:i})}function R(t){let e=!0;return t.dataTransfer&&"string"===t.dataTransfer.items[0].kind&&(e=!1),e}function K(t,e){this.isFileTypeDrag(t)&&(this.overCount++,this.el.querySelector(this.getDropCoverSelector()).classList.add("file-dropping"))}function G(t,e){this.isFileTypeDrag(t)&&(this.overCount--,0==this.overCount&&this._cleanupDropDone())}function J(t,e){t.preventDefault()}function Y(){this.overCount=0,[...this.el.querySelectorAll(".file-dropping")].forEach((t=>t.classList.remove("file-dropping")))}async function Z(t){this.ignoreGlobalEvents||(t.preventDefault(),t.clipboardData&&t.clipboardData.files&&t.clipboardData.files.length>0&&this.uploadFiles(t.clipboardData.files,{uploadType:"guided"}))}function Q(t,e){new w({title:"Create Directory",body:'<label>Directory name <input type="text" name="name" /></label>'}).open().then((async t=>{if(t){let e=this.currentNode.file.relPath+"/"+t.name;await this.sink.mkdir(e);let i=await this.sink.getFullFileInfo(e),n=this._fileToKalpaNode(i);this.tree.options.stream.emit("data",n);let s=this.tree.selected();s&&this.tree.expand(s.id)}}))}var X=i(799);function tt(t){if(!t||"string"!=typeof t)return t;let e=[...t];t="";for(let i=0;i<e.length;i++)t+=e[i],i%10==0&&(t+="<wbr>");return function(t,e){for(let t of["_"])e=e.split(t).join("<wbr>"+t);return e}(0,t)}function et(t){let e=X(t.children),i=Object.values(e),n=[];for(let t of i)n.push(...this._getAssociatedRealFiles(t).map((t=>t.name)));let s=t.children.filter((t=>!n.includes(t.name))).filter((t=>!t.directory));for(let t of i)t.thumbnailIcon="image",t.preview&&(t.thumbnail=this._createAccessUrl(t.preview.file),t.safeThumbnail=A(t.thumbnail));if(!this.imagesOnly)for(let t of s){let e={file:t,thumbnailIcon:"description"},n=t.name;e.ext=n.substring(n.lastIndexOf(".")+1),e.baseName=n.substring(0,n.lastIndexOf(".")),i.push(e)}for(let t of i)t.extensions=this._determineExtensions(t),t.sizes=this._determineSizes(t),t.sizes[0]==t.sizes[1]?t.size=this._formatBytes(t.sizes[0]):t.size=this._formatBytes(t.sizes[0])+" - "+this._formatBytes(t.sizes[1]),t.safeBaseName=tt(A(t.baseName));return i.sort(this._compareVariants),i}async function it(t){let e=[];if(t.dataTransfer.items){let i=[];[...t.dataTransfer.items].forEach(((t,e)=>{i.push(t)}));for(let t of i)if("file"===t.kind)if(t.webkitGetAsEntry){let i=t.webkitGetAsEntry();if(i){if(i.isDirectory)continue;e.push(t.getAsFile())}}else e.push(t.getAsFile());else t instanceof File&&e.push(t)}else[...t.dataTransfer.files].forEach(((t,i)=>{e.push(t)}));return e}function nt(t){let e=[];return t.variants?e.push(...t.variants.map((t=>t.file))):e.push(t.file),t.definitionFile&&e.push(t.definitionFile),e}function st(t){return this.escapeAccessUrl(t.accessUrl)}function at(t){return function(t,e){for(let t of["%"," ","#","?","<",">","$","@","^","&"])e=e.split(t).join(encodeURIComponent(t));return e}(0,t)}function lt(){let t={boxes:[],variants:[],files:[],names:[]},e=this.el.querySelectorAll(".choice-boxes .variant-choice-box.selected");if(e.length>0){for(let i of e)t.boxes.push(i),t.variants.push(i.variant),t.files.push(...this._getAssociatedRealFiles(i.variant));let i=t.files.map((t=>t.name));t.names.push(...i)}return t}function rt(t){return 0==t.startsWith("/")&&(t="/"+t),t}async function ot(t){if(t||(t=this.getSelectedFiles()),0==t.variants.length)return;let e,i=t.variants[0];e=i.primary?i.primary.file:i.file;let n=this._transformRelativeUrlToPublic(e.relPath);if(i.definitionFile){let t=await this.sink.read(i.definitionFile.relPath);try{let e=JSON.parse(t);n+=this.getSelectedUrlExtFromMeta(e)}catch(t){}}return n}function ct(t){let e="",i=t.displaySize.split("x");return e+=`#format=webp2x&width=${i[0]}&height=${i[1]}`,t.altText&&(e+="&alt="+encodeURIComponent(t.altText)),e}function dt(t){let e;"string"==typeof t?e=t:t instanceof File&&(e=t.name);let i=e.split(".");i.length>1&&i.pop(),e=i.join("."),e=e.replace(/-@2x$/,""),e=e.replace(/@2x$/,""),e=e.replace(/-2x$/,""),e=e.replace(/2x$/,"");let n=[e.substring(0,1)];for(let t of e.substring(1))t.match(/[A-Z]/)&&n.push("-"),n.push(t);return e=n.join(""),e=e.toLowerCase(),e=e.replace(/[^1234567890a-z-]/g,"-"),e=e.replace(/--+/g,"-"),e}async function ut(t){return new Promise(((e,i)=>{let n,s;if(t instanceof Image)n=t;else if("string"==typeof t)n=new Image,n.src=t;else{let e=new Blob([t]);s=URL.createObjectURL(e),n=new Image,n.src=s}function a(){s&&URL.revokeObjectURL(s),e(n)}n.complete?a():n.addEventListener("load",(()=>{a()}))}))}async function ht(t,{maxWidth:e=1920,quality:i=.7,outputFormat:n="image/png"}={}){return new Promise((async(s,a)=>{try{let a=await ut(t),o=a.naturalWidth/e,c=a.naturalHeight/o;var l=document.createElement("canvas");l.width=e,l.height=c;var r=l.getContext("2d");r.clearRect(0,0,l.width,l.height),r.drawImage(a,0,0,l.width,l.height),l.toBlob((t=>{s(t)}),n,i)}catch(t){console&&console.log&&console.log("error resizing image: "+t),a(t)}}))}async function pt(t){let e=await ut(t);return{width:e.naturalWidth,height:e.naturalHeight}}let ft={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/webp":"webp"};function mt(t){return t in ft?ft[t]:t.split("/").pop()}let gt="image/webp";async function vt(t,{singleDensityWidth:e=null,quality:i=.7,outputFormat:n="image/png",doubleDensityInput:s=!0,baseFileName:a,altText:l}={}){let r=await ut(t),o=await pt(r),c=o.width/o.height;a||(a=""+(new Date).getTime()),e||(e=s?o.width/2:o.width);let d=2*e,u={"-2x":d,"":e,"-half":Math.floor(e/2),"-quarter":Math.floor(e/4)},h={};for(let t of Object.keys(u)){let e=u[t],s=await ht(r,{maxWidth:e,quality:i,outputFormat:n});h[a+t+"."+mt(n)]=s,s=await ht(r,{maxWidth:e,quality:i,outputFormat:gt}),h[a+t+"."+mt(gt)]=s}let p={name:a,size:d+"x"+d/c,displaySize:e+"x"+e/c,fallback:mt(n),altText:l||a};return h[a+".json"]=JSON.stringify(p,null,"\t"),h}function bt(t){let e;"string"==typeof t?e=t:t instanceof File&&(e=t.name);let i=[dt(e)],n=e.split(".");return n.length>1&&i.push(n.pop()),i}async function yt(t){let e=dt(t),i=await async function(t){let e=await ut(t),i=await pt(e);return i.ratio=i.width/i.height,i.ext=mt(t.type),i}(t),n={nativeName:t.name,name:e,outputFormat:t.type,stats:i,width:Math.floor(i.width/2)},s=new w({title:"Upload File",body:u(n),data:n,dialogFrameClass:"webhandle-file-tree-image-browser"}).open(),a=await s;if(a){let i,n={baseFileName:a.name,outputFormat:a.outputFormat,singleDensityWidth:parseInt(a.width),altText:a.altText},s=this._addPending(t),l=await vt(t,n),r=JSON.parse(l[e+".json"]);for(let t of Object.keys(l)){let e=await this._uploadData(t,l[t]);t===r.name+"."+r.fallback&&(i=e)}let o=this._transformRelativeUrlToPublic(i);return o+=this.getSelectedUrlExtFromMeta(r),s&&s.remove(),o}}async function wt(t){let e=bt(t),i={nativeName:t.name,name:e.join(".")},n=new w({title:"Upload File",body:h(i),data:i,dialogFrameClass:"webhandle-file-tree-image-browser"}).open(),s=await n;if(s){let e=this._addPending(t),i=await this._uploadData(s.name,t),n=this._transformRelativeUrlToPublic(i);return e&&e.remove(),n}}async function xt(t){let e,i=this._addPending(t),n=bt(t)[0],s=await vt(t,{baseFileName:n,outputFormat:t.type}),a=JSON.parse(s[n+".json"]);for(let t of Object.keys(s)){let i=await this._uploadData(t,s[t]);t===a.name+"."+a.fallback&&(e=i)}let l=this._transformRelativeUrlToPublic(e);return l+=this.getSelectedUrlExtFromMeta(a),i&&i.remove(),l}async function _t(t,{uploadType:e}={}){let i=[];for(let n of t){let t=!1;if("guided"===e&&this._isImageFile(n))t=await this._uploadGuidedImageFile(n);else if("guided"===e)t=await this._uploadGuidedFile(n);else if("automatic"===e&&this._isImageFile(n))t=await this._uploadAutomaticImageFile(n);else{let i,s=this._addPending(n);if("automatic"===e){let t=bt(n);i=await this._uploadData(t.join("."),n)}else i=await this._uploadData(n.name,n);t=this._transformRelativeUrlToPublic(i),s&&s.remove()}this.eventNotificationPanel&&t&&this.eventNotificationPanel.addNotification({model:{status:"success",headline:`uploaded ${n.name}`},ttl:2e3}),i.push(t)}return this.setCurrentNode(this.currentNode),this.emitter.emit("upload",{type:"upload",accessUrls:i}),i}function Tt(t,e){this.el.querySelector(this.fileUploadSelector).click()}async function Ft(t,e){t.preventDefault();let i=this.el.querySelector(this.fileUploadSelector);t.dataTransfer={files:i.files};let n=await this._getFilesFromEvent(t);if(n.length>0){let t=this.uploadFiles(n,{uploadType:"guided"});return i.value="",t}}async function St(t,e){let i=this.currentNode.file.relPath+"/"+this.sanitizeFileName(t);return await this.sink.write(i,e),i}async function kt(){return new Promise(((t,e)=>{let i=[],n=this.sink.find({file:!1});n.on("data",(t=>{i.push(t)})),n.on("done",(()=>{t(i)}))}))}class Et extends s{constructor(t){super(t),this.setIfNotSet("overCount",0),this.setIfNotSet("emitter",new v),this.setIfNotSet("fileUploadSelector",'input[name="fileUpload"]'),this.setIfNotSet("listTriggerSize",100),this.setIfNotSet("listLockSize",200)}preinitialize(){this.className="image-browser",this.idInd=1,this.nodes={},this.events={"click .create-directory":"createDirectory","click .upload-file":"_uploadFileButton",'change [name="fileUpload"]':"_uploadFile","click .delete-file":"deleteFile","click .delete-directory":"deleteDirectory","click .variant-choice-box .details":"showVariantDetails","dblclick .variant-choice-box":"showVariantDetails","click .variant-choice-box":"selectVariant","click .view-icons button":"changeFilesView",'keyup [name="filter"]':"applyFilter",'change [name="filter"]':"applyFilter","click .clear-filter":"clearFilter","dragenter .":"dragEnter","dragleave .":"dragLeave","dragover .":"dragOver","drop .":"handleDrop"},document.addEventListener("paste",Z.bind(this))}async render(){this.el.innerHTML=c(this.model),this.data=[],this.rootDirectory=await this.sink.getFullFileInfo(""),this.rootDirectory.name="Files";let t=this.rootNode=this._fileToKalpaNode(this.rootDirectory);this.data.push(t);let e=await this.findDirectories();this._sortFiles(e),this.data.push(...e.map(this._fileToKalpaNode.bind(this))),p({treeContainerSelector:`#${this.id} .treebox`,data:this.data}).then((t=>{if(this.tree=t,t.on("select",(t=>{this.setCurrentNode(t)})),t.on("selected",(t=>{let e=this.el.querySelector(".tree");e.style.height="99.99999%",setTimeout((()=>{e.style.height="100%"}),100)})),this.startingDirectory){for(let e of Object.values(this.tree.nodes))if(e.file&&e.file.relPath&&e.file.relPath==this.startingDirectory){t.select(e.id);break}}else t.select(1)}))}async setCurrentNode(t){this.currentNode=t,this.cleanFileInfo();let e=this.el.querySelector(".choice-boxes"),i=await this.sink.getFullFileInfo(t.file.relPath),n=this.createVariantValues(i);n.length>this.listTriggerSize&&this.changeFilesViewToClass("list-text");let s="";for(let t of n)s+=d(t);e.innerHTML="",e.insertAdjacentHTML("beforeend",s);for(let t=0;t<e.children.length;t++)e.children[t].variant=n[t];this.el.querySelector(".box-holder").scrollTop=0,this.applyFilter()}_uploadGuidedImageFile=yt;_uploadGuidedFile=wt;_uploadAutomaticImageFile=xt;uploadFiles=_t;_uploadFileButton=Tt;_uploadFile=Ft;createVariantValues=et;_getFilesFromEvent=it;_getAssociatedRealFiles=nt;_createAccessUrl=st;escapeAccessUrl=at;getSelectedFiles=lt;_transformRelativeUrlToPublic=rt;getSelectedUrl=ot;getSelectedUrlExtFromMeta=ct;createDirectory=Q;getDropCoverSelector=V;handleDrop=W;isFileTypeDrag=R;dragEnter=K;dragLeave=G;dragOver=J;handlePaste=Z;_cleanupDropDone=Y;changeFilesView=P;changeFilesViewToClass=I;applyFilter=M;clearFilter=q;selectVariant=B;showVariantDetails=U;setFolderInfo=$;cleanFileInfo=H;sanitizeFileName=z;_sortFiles=O;_compareVariants=L;_determineExtensions=k;_determineSizes=E;_join=T;_determineParentPath=F;_fileToKalpaNode=S;_formatBytes=f;_isImageFile=C;setIfNotSet=j;_addPending=N;deleteFile=x;deleteDirectory=_;_uploadData=St;findDirectories=kt}var Ot=i(161);let Lt=Et,zt=class extends b{constructor(t){super(Object.assign({title:"Select A File",body:'<div class="webhandle-file-tree-image-browser" style="width: 87vw;"> </div>',afterOpen:function(t,e){let i=t.querySelector(".webhandle-file-tree-image-browser");if(i){let t={sink:e.sink,imagesOnly:e.imagesOnly,eventNotificationPanel:e.eventNotificationPanel,startingDirectory:e.startingDirectory,deleteWithoutConfirm:e.deleteWithoutConfirm},n=this.imageBrowserView=new Et(t);e._createAccessUrl&&(n._createAccessUrl=e._createAccessUrl),e._transformRelativeUrlToPublic&&(n._transformRelativeUrlToPublic=e._transformRelativeUrlToPublic),n.appendTo(i),n.render(),n.emitter.on("select",(async function(t){})),n.emitter.on("upload",(async function(t){e.chooseOnUpload&&(e.close(),e.resolve({url:t.accessUrls[0]}))}))}},chooseOnUpload:!0},t,{on:{".btn-ok":async()=>{let t={selection:this.imageBrowserView.getSelectedFiles()};return t.url=await this.imageBrowserView.getSelectedUrl(t.selection),this.resolve(t),!0},".mask":()=>(this.resolve(),!0),".btn-cancel":()=>(this.resolve(),!0)}}))}async open(){return this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),super.open(),this.promise}},Ct=function(){if(!function(){let t=document.createElement("div");t.classList.add("webhandle-file-tree-image-browser-test"),t.style.position="absolute",t.style.left="-10000px",document.body.appendChild(t);let e=window.getComputedStyle(t)["background-color"];return t.remove(),"rgb(101, 105, 99)"===e}()){let t=document.createElement("link");t.href="/@webhandle/tree-file-browser/resources/css/tree-browser.css",t.rel="stylesheet",document.head.appendChild(t)}Ot()};"undefined"!=typeof window&&(window["@webhandle/tree-file-browser"]={ImageBrowserView:Lt,FileSelectDialog:zt,loadStyles:Ct});const jt=Lt})();var s=n.DY,a=n.Tq,l=n.ZP,r=n.RM;export{s as FileSelectDialog,a as ImageBrowserView,l as default,r as loadStyles};
|
|
1
|
+
var t={547:t=>{t.exports=function(t,e){return e=e?" ":"\n",(""+t).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">").replace(/\r\n/g,e).replace(/[\r\n]/g,e)}},161:t=>{t.exports=function(){function t(){let t=document.createElement("div");t.classList.add("material-icons-styles-marker"),document.body.appendChild(t),window.getComputedStyle(t).content.indexOf("loaded")<0&&document.head.insertAdjacentHTML("beforeend",'<link rel="stylesheet" href="/@dankolz/webhandle-admin-icons/resources/css/admin-icons.css">'),t.remove()}document.body?t():document.addEventListener("DOMContentLoaded",t)}},799:(t,e,i)=>{let{imageExtensions:n,smallerSizeExt:a,imageSizeExt:s}=i(211);const l=i(42),r=i(198),o=i(29),c=i(73),d=i(148);function u(t){let e=l(t.variants);t.preview=e;let i=d(t.variants);t.primary=i}t.exports=function(t){let e=t.filter((t=>!t.directory)),i=e.filter((t=>t.name.toLowerCase().endsWith(".json"))),n=e.filter(r),a={};function s(t){if(t in a)return a[t];let e={baseName:t,variants:[]};return a[t]=e,e}for(let t of i)s(c(t.name)).definitionFile=t;for(let t of n.map(o))s(t.baseName).variants.push(t);for(let t of Array.from(Object.keys(a)))0==a[t].variants.length&&delete a[t];return Object.values(a).forEach(u),a}},211:t=>{let e={imageExtensions:["jpg","jpeg","png","gif","tiff","webp"],smallerSizeExt:["quarter","half"]};e.imageSizeExt=[...e.smallerSizeExt,"std","2x"],t.exports=e},73:t=>{t.exports=function(t){return t.substring(0,t.lastIndexOf("."))}},42:(t,e,i)=>{let{imageExtensions:n,smallerSizeExt:a,imageSizeExt:s}=i(211);t.exports=function(t){for(let e of s)for(let i of n)for(let n of t)if(n.size==e&&n.ext==i)return n}},148:(t,e,i)=>{let{imageExtensions:n,smallerSizeExt:a,imageSizeExt:s}=i(211),l=["std","2x",...a],r=n.filter((t=>"webp"!=t));t.exports=function(t){for(let e of l)for(let i of r)for(let n of t)if(n.size==e&&n.ext==i)return n}},600:(t,e,i)=>{let{imageExtensions:n,smallerSizeExt:a,imageSizeExt:s}=i(211);t.exports=function(t){let e=t.toLowerCase();for(let t of n)if(e.endsWith("."+t))return!0;return!1}},198:(t,e,i)=>{const n=i(600);t.exports=function(t){return n(t.name)}},29:(t,e,i)=>{let{imageExtensions:n,smallerSizeExt:a,imageSizeExt:s}=i(211);t.exports=function(t){let e={size:"std",file:t},i=t.name;e.ext=i.substring(i.lastIndexOf(".")+1);let n=i.substring(0,i.lastIndexOf("."));e.baseName=n;for(let t of s){let i="-"+t;if(n.endsWith(i)){e.size=t,e.baseName=n.substring(0,n.length-i.length);break}}return e}},772:(t,e,i)=>{let n=i(263),a=0;"string"!=typeof n&&n.default&&(n=n.default);var s=function(t){this.id="dialog"+(new Date).getTime()+a++,Object.assign(this,t),this.on||(this.on={}),this.on[".btn-cancel"]||(this.on[".btn-cancel"]=function(){}),this.on[".btn-close"]||(this.on[".btn-close"]=function(){}),t.buttons||(this.buttons=[{classes:"btn btn-primary btn-ok",label:"OK"},{classes:"btn btn-cancel",label:"Cancel"}]),this.body=t.body};s.prototype.getBodySelector=function(){return"#"+this.id+" .body"},s.prototype.getFrameSelector=function(){return"#"+this.id},s.prototype.addStylesIfNeeded=function(){document.querySelector("#dialog-frame-styles")||document.querySelector("head").insertAdjacentHTML("beforeend",'<style type="text/css" id="dialog-frame-styles">'+n+"</style>")},s.prototype.renderButton=function(t){return`<button class="${t.classes}" type="button">${t.label}</button>`},s.prototype.generateFrame=function(){let t=this.buttons.map(this.renderButton).join("");return`\n<div class="dialog-frame ${this.dialogFrameClass||""}" id="${this.id}" >\n\t<div class="mask">\n\t</div>\n\t<div class="the-dialog">\n\t\t<div class="close btn-close">×</div>\n\t\t<div class="head">\n\t\t\t${this.title}\n\t\t</div>\n\t\t<div class="body">\n\t\t</div>\n\t\t<div class="foot">\n\t\t\t${t}\n\t\t</div>\n\t</div>\n</div>\n\t`},s.prototype.open=function(){let t=this;this.addStylesIfNeeded(),document.querySelector("body").insertAdjacentHTML("beforeend",this.generateFrame());let e,i=this.getBodySelector(),n=this.getFrameSelector(),a=document.querySelector(i),s=document.querySelector(n);function l(){setTimeout((function(){let e=document.querySelector(n+" .head").clientHeight+document.querySelector(n+" .foot").clientHeight;a.style.maxHeight="calc(90vh - "+e+"px)",s.classList.add("open"),t.afterOpen&&t.afterOpen(a,t)}))}return s.addEventListener("click",(function(e){for(let i in t.on){let n=s.querySelector(i);if(e.target==n){let e=t.on[i]();"boolean"==typeof e?e&&t.close():"function"==typeof Promise&&e instanceof Promise?e.then((function(e){!1!==e&&t.close()})):t.close();break}}})),"function"==typeof this.body?e=this.body(a,this):"string"==typeof this.body&&(e=this.body),"string"==typeof e?(a.insertAdjacentHTML("beforeend",e),l()):"function"==typeof Promise&&e instanceof Promise&&e.then((function(t){a.insertAdjacentHTML("beforeend",t),l()})),this},s.prototype.close=function(){return document.querySelector(this.getFrameSelector()).remove(),this},t.exports=s},89:(t,e,i)=>{const n=i(939),a=i(674),s=i(493);t.exports=function(t,e){let i=n(t,e);return i=a(i,e),i=s(i,e),i}},939:t=>{function e(t){return t instanceof Date?t:new Date(t)}function i(t,e,i){for(t=""+t;t.length<e;)t=i+t;return t}function n(t){return`${(t=e(t)).getFullYear()}-${i(t.getMonth()+1,2,"0")}-${i(t.getDate(),2,"0")}`}function a(t){let n=i((t=e(t)).getHours(),2,"0"),a=i(t.getMinutes(),2,"0");return i(t.getSeconds(),2,"0"),i(t.getMilliseconds(),4,"0"),`${n}:${a}`}let s=/\sname=["'](.*?)["']/i,l=/\svalue=["'](.*?)["']/i,r=/\stype=["'](.*?)["']/i,o=/(<input.*?>)/i,c=/\schecked(=["'](.*?)["'])?/i,d={"&":"&",'"':""","<":"<"},u=new Function("data","with (data.context) {\n\t\ttry {\n\t\t\treturn eval(data.expression);\n\t\t} catch (e) {\n\t\t\treturn null;\n\t\t}\n\t}");function h(t,e){return u.call(this,{context:t,expression:e})}function p(t,e){return Array.isArray(e)?e.includes(t):t==e}t.exports=function(t,e){let i="";return t.split(o).forEach((t=>{if(0==t.toLowerCase().indexOf("<input")){let u=t.match(s),f=u?u[1]:null;u=t.match(r);let m=(u?u[1]:"text").toLowerCase();if("text"===m||"hidden"===m||"date"===m||"time"===m||"datetime-local"===m||"search"===m||"email"===m||"number"===m||"tel"===m||"url"===m||"month"===m||"week"===m||"color"===m||"week"===m){u=t.match(l);let s,r=u?u[1]:null,c=h(e,f);if("date"===m){if(c){let t=c;try{c=n(c)}catch(e){c=t}"Invalid date"==c&&(c=t)}}else if("time"===m){if(c){let t=c;try{c=a(c)}catch(e){c=t}"Invalid date"==c&&(c=t)}}else if("datetime-local"===m&&c){let t=c;try{c=n(o=newValue)+"T"+a(o)}catch(t){}"Invalid date"==c&&(c=t)}null==c?s="":(c=function(t){null==t&&(t=""),"string"!=typeof t&&(t=""+t);for(let[e,i]of Object.entries(d))t=t.split(e).join(i);return t}(c),s=' value="'+c+'"'),null!=r?null!=c&&(t=t.replace(l,s)):t=(t=t.endsWith("/>")?t.slice(0,-2):t.slice(0,-1))+s+" />",i+=t}else if("radio"===m){u=t.match(l);let n=u?u[1]:null,a=h(e,f);n?a&&a==n?t.match(c)||(t=t.endsWith("/>")?t.slice(0,-2):t.slice(0,-1),t+=' checked="checked" />'):t=t.replace(c,""):a&&"false"!=a&&"off"!=a?t.match(c)||(t=t.endsWith("/>")?t.slice(0,-2):t.slice(0,-1),t+=' checked="checked" />'):t=t.replace(c,""),i+=t}else if("checkbox"===m){u=t.match(l);let n=u?u[1]:null,a=h(e,f);n?a&&p(n,a)?t.match(c)||(t=t.endsWith("/>")?t.slice(0,-2):t.slice(0,-1),t+=' checked="checked" />'):t=t.replace(c,""):!a||p("false",a)||p("off",a)?t=t.replace(c,""):t.match(c)||(t=t.endsWith("/>")?t.slice(0,-2):t.slice(0,-1),t+=' checked="checked" />'),i+=t}else i+=t}else i+=t;var o})),i}},11:t=>{t.exports='<div id="kalpa-tree-icons" style="position: absolute; left: -10000px; width: 0; height: 0;">\n\t<svg xmlns="http://www.w3.org/2000/svg">\n\t\t<symbol id="icon-generic" viewBox="0 0 12 12">\n\t\t\t<path\n\t\t\t\td="M9.7 12H2.3C1 12 0 11 0 9.7V2.3C0 1 1 0 2.3 0h7.5C11 0 12 1 12 2.3v7.5C12 11 11 12 9.7 12zM8 5.3C8 4.6 7.4 4 6.6 4H5.3C4.6 4 4 4.6 4 5.3v1.3C4 7.4 4.6 8 5.3 8h1.3C7.4 8 8 7.4 8 6.6V5.3z" />\n\t\t</symbol>\n\t\t<symbol id="icon-root" viewBox="0 0 16 16">\n\t\t\t<path d="M9 16V9h7v7H9zM9 0h7v7H9V0zM0 9h7v7H0V9zm0-9h7v7H0V0z" />\n\t\t</symbol>\n\t\t<symbol id="icon-metric" viewBox="0 0 100 100">\n\t\t\t<path\n\t\t\t\td="M50 100C22.4 100 0 77.6 0 50S22.4 0 50 0s50 22.4 50 50-22.4 50-50 50zm0-76.9c-14.8 0-26.9 12.1-26.9 26.9S35.2 76.9 50 76.9 76.9 64.8 76.9 50 64.8 23.1 50 23.1zm0 38.4c-6.4 0-11.5-5.2-11.5-11.5S43.6 38.4 50 38.4s11.5 5.2 11.5 11.5S56.4 61.5 50 61.5z" />\n\t\t</symbol>\n\t\t<symbol id="icon-perspective" viewBox="0 0 12 11">\n\t\t\t<path d="M12 11H0L5.9 0 12 11z" />\n\t\t</symbol>\n\t\t<symbol id="icon-objective" viewBox="0 0 12 10">\n\t\t\t<ellipse cx="6" cy="5" rx="6" ry="5" />\n\t\t</symbol>\n\t\t<symbol id="icon-find">\n\t\t\t<path\n\t\t\t\td="m 13.497323,12.433608 c 0.08422,0.978628 -1.417295,1.469942 -1.954282,0.657234 C 10.369384,11.968141 9.2411696,10.799391 8.087323,9.6566079 5.7875518,11.20515 2.2596241,10.270797 1.051352,7.7662065 -0.1027543,5.5922068 0.61269436,2.5743169 2.7539681,1.2885899 4.6322082,0.06461011 7.3623548,0.26924656 8.9286688,1.9183502 c 1.5121032,1.4872335 1.9726552,4.001359 0.8885116,5.8618536 -0.2008407,0.7179057 0.6439246,1.0286413 1.0395966,1.4627471 0.79551,0.9178591 1.752248,1.6943191 2.51171,2.6495761 0.08347,0.167322 0.129284,0.353872 0.128836,0.541081 z m -8.047,-9.7420001 C 3.5991559,2.6059751 2.107634,4.7815577 2.8684439,6.4772182 3.4629388,8.0470383 5.6500695,8.7859958 7.0177529,7.7488936 8.3664062,6.8424394 8.6521549,4.6587499 7.425963,3.52989 6.9118115,3.0069548 6.1883031,2.6803036 5.450323,2.6916079 z" />\n\t\t</symbol>\n\t\t<symbol id="icon-collapsed" viewBox="0 0 9 6">\n\t\t\t<path\n\t\t\t\td="M4.4 6c-.2 0-.5-.1-.9-.5L.3 1.8C-.1 1.4-.1.7.3.3s1.1-.4 1.5 0l2.7 3.2L7.1.4C7.5 0 8.2 0 8.6.4c.4.4.4 1.1 0 1.5L5.4 5.5c-.3.4-.8.5-1 .5z" />\n\t\t</symbol>\n\t</svg>\n</div>'},724:(t,e,i)=>{const n=i(852),a=i(224),s=i(622),l=i(11);let r=[];t.exports=async function(t={}){let e=Object.assign({treeContainerSelector:"#kalpa-tree",stream:new n,loadStyles:!0,styleLocation:"/kalpa-tree-on-page/css/white-page-tree.css",scriptLocation:"/kalpa-tree-on-page/js/kalpa-tree.js",data:null},t);return new Promise(((t,i)=>{document.querySelector("#kalpa-tree-icons")||document.body.insertAdjacentHTML("beforeend",l),async function(t){return new Promise(((e,i)=>{if(window.KalpaTree)e(window.KalpaTree);else{let i=document.createElement("script");i.setAttribute("src",t),i.onload=async function(){e(window.KalpaTree)},document.head.appendChild(i)}}))}(e.scriptLocation).then((i=>{let n=new(0,i.default)({stream:e.stream,accessors:{icon:"nodeType"},initialSelection:0});if(n.on("error",(function(t){console.log("tree error",t)})),n.on("move",(function(t,e,i,n,a){t.parentId=e.id})),n.serializeTree=function(){let t=[];return t.push(n.root),a(this,n.root.id,t),t},n.serialize=function(){var t=[];return t.push(n.get(0)),s(n,0,t),JSON.stringify(t)},e.treeContainerSelector&&document.querySelector(e.treeContainerSelector).appendChild(n.render().el.node()),e.data&&Array.isArray(e.data))for(let t of e.data)n.options.stream.emit("data",t);t(n)})),e.loadStyles&&e.styleLocation&&(r.includes(e.styleLocation)||(r.push(e.styleLocation),document.head.insertAdjacentHTML("beforeend",`<link href="${e.styleLocation}" rel="stylesheet">`)))}))}},622:t=>{t.exports=function t(e,i,n){e.children(i).forEach((function(a){a.parentId=i,n.push(a),t(e,a.id,n)}))}},224:t=>{t.exports=function t(e,i,n){e.children(i).forEach((function(a){a.parentId=i,n.push(a),t(e,a.id,n)}))}},852:t=>{t.exports=class{constructor(){this.handles={}}on(t,e){let i=this.handles[t];return i||(i=this.handles[t]=[]),i.push(e),this}emit(t,...e){if(t in this.handles)for(let i of this.handles[t])i.apply(this,e)}}},263:(t,e,i)=>{i.r(e),i.d(e,{default:()=>n});const n=".dialog-frame {\n\tposition: fixed;\n\ttop: 0;\n\tbottom: 0;\n\tleft: 0;\n\tright: 0;\n\tz-index: 10000;\n\topacity: 0;\n\ttransition: opacity .3s;\n\toverflow: hidden;\n\t\n\t\n\tdisplay: grid;\n\tjustify-content: center;\n\talign-content: center;\n\tpadding: 5vh 5%;\n}\n\n.dialog-frame.open {\n\topacity: 1;\n}\n\n.dialog-frame .mask {\n\tposition: absolute;\n\tbox-sizing: border-box;\n\ttop: 0;\n\tbottom: 0;\n\tleft: 0;\n\tright: 0;\n\tbackground-color: #333333;\n\topacity: .7;\n\theight: 100%;\n\tz-index: 0;\n\t\n}\n\n\n.dialog-frame .the-dialog {\n\tposition: relative;\n\tdisplay: inline-block;\n\tz-index: 1;\n\tborder-radius: 5px;\n\tbackground-color: white;\n\toverflow: hidden;\n\ttransform: scale(.84);\n\ttransition: transform 0.262s cubic-bezier(.77,-1.72,.08,1);\n}\n\n.dialog-frame.open .the-dialog {\n\ttransform: scale(1);\n}\n\n.dialog-frame .the-dialog .close {\n\tposition: absolute;\n\ttop: 0px;\n\tright: 0px;\n\tpadding: 8px 10px 10px 10px;\n\tcursor: pointer;\n}\n\n.dialog-frame .the-dialog .head {\n\tborder-bottom: solid #aaaaaa 1px;\n\tline-height: 2em;\n\tpadding: 0 10px;\n}\n\n.dialog-frame .the-dialog .body {\n\tbox-sizing: border-box;\n\tpadding: 20px;\n\toverflow: auto;\n\tmax-height: calc(90vh - 75px);\n}\n\n.dialog-frame .the-dialog .foot {\n\tborder-top: solid #aaaaaa 1px;\n\tpadding: 10px;\n}\n\n.dialog-frame .the-dialog .foot button {\n\tmargin-right: 15px;\n}"},493:t=>{let e=/\sname=["'](.*?)["']/i,i=/(<select[\w\W]*?select\w*>)/im,n=/\sselected(=["'](.*?)["'])?/i,a=new Function("data","with (data.context) {\n\t\ttry {\n\t\t\treturn eval(data.expression);\n\t\t} catch (e) {\n\t\t\treturn null;\n\t\t}\n\t}");t.exports=function(t,s){let l="";return t.split(i).forEach((t=>{if(0==t.toLowerCase().indexOf("<select")){let r=t.match(e),o=r?r[1]:null,c=function(t,e){return a.call(this,{context:t,expression:e})}(s,o);if(null!=c){let e=(t=t.replace(n,"")).match(new RegExp("value=[\"']"+((i=c)&&i.replace?i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):i)+"[\"']","i"));if(e){let i=t.indexOf(e[0])+e[0].length;t=t.slice(0,i)+' selected="selected" '+t.substring(i)}}l+=t}else l+=t;var i})),l}},674:t=>{let e=/\sname=["'](.*?)["']/i,i=/(<textarea[\w\W]*?textarea\w*>)/im,n=new Function("data","with (data.context) {\n\t\ttry {\n\t\t\treturn eval(data.expression);\n\t\t} catch (e) {\n\t\t\treturn null;\n\t\t}\n\t}");t.exports=function(t,a){let s="";return t.split(i).forEach((t=>{if(0==t.toLowerCase().indexOf("<textarea")){let i=t.match(e),l=i?i[1]:null;if(l){let e=function(t,e){return n.call(this,{context:t,expression:e})}(a,l);if(null!=e){let i=t.indexOf(">"),n=t.lastIndexOf("<");t=t.substring(0,i+1)+e+t.substring(n)}}s+=t}else s+=t})),s}},134:t=>{t.exports=class{constructor(t,e,i,n){this.conditionalExpression=t,this.dataExpression=e,this.handlingExpression=i||"defaultTemplate",this.tripartite=n}}},824:t=>{t.exports=function(t,e){if(!t)return e;if(!e)return e;if(0!=e.indexOf("../")&&0!=e.indexOf("./"))return e;for(var i=t.split("/"),n=e.split("/");i.length&&!i[0];)i.shift();for(;n.length&&!n[0];)n.shift();if(0==e.indexOf("../")){for(;n.length&&".."==n[0];)i.pop(),n.shift();for(i.pop();n.length;)i.push(n.shift());return i.join("/")}if(0==e.indexOf("./")){for(n.shift(),i.pop();n.length;)i.push(n.shift());return i.join("/")}return e}},668:(t,e,i)=>{const n=i(502);let a=new Function("additionalContexts","with ({\n\t\t'$globals': additionalContexts.globalData\n\t}) {\n\t\twith (additionalContexts.dataFunctions) {\n\t\t\twith (additionalContexts.context) {\n\t\t\t\ttry {\n\t\t\t\t\treturn eval(additionalContexts.expression);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}");function s(t,e,i,n){return i=i||{},n=n||{},a.call(this,{globalData:n,dataFunctions:i,context:t,expression:e})}t.exports=function(t,e,i,a){if(!e)return null;if("string"==typeof e&&(e=e.trim()),"$this"===e||"this"===e)return t;if("object"==typeof t&&e in t)return t[e];if('""'===e||"''"===e)return"";let l=n(t,e);return null==l&&(l=n({$globals:a},e)),null==l&&(l=s.call(t,t,e,i,a)),l}},268:(t,e,i)=>{let n=i(134);var a=i(824);let s=i(668);t.exports=class{constructor(t,e,i={},n="",a={}){this.tripartite=t,this.template=e,this.destination=n,this.initialData=i,this.currentData=[],this.dataFunctions=a,this.continueOnTripartiteError=!0,this.callCount=0,this.callDepthLimit=1e3}run(t){let e;return t&&(e=()=>{t(null,this.destination)}),this._run(this.template,this.initialData,e),this.destination}_resolveHandlingExpression(t,e,i){return e||(e=defaultTemplateName),"$"==e.charAt(0)&&(e=s(i,e.substring(1),this.dataFunctions,this.initialData)),0!=e.indexOf("./")&&0!=e.indexOf("../")||(e=a(t.templateMeta.name,e)),e}_run(t,e,i){let a=[...t.parts].reverse();const l=()=>{if(this.callCount++,this.callCount++>this.callDepthLimit)setTimeout((()=>{this.callCount=0,l()}));else if(a.length>0){let r=a.pop();if("string"==typeof r)this.output(r),l();else if(r instanceof n){let n,a=r.conditionalExpression||r.dataExpression,o=!1;if(null==a||null==a||""===a?o=!0:r.conditionalExpression?s(e,r.conditionalExpression,this.dataFunctions,this.initialData)&&(o=!0):(n=s(e,r.dataExpression,this.dataFunctions,this.initialData),null==n?o=!1:("number"==typeof n||Array.isArray(n)&&n.length>0||n)&&(o=!0)),o){r.dataExpression&&void 0===n&&(n=s(e,r.dataExpression,this.dataFunctions,this.initialData)),null==n&&(n=e);let a,o=this._resolveHandlingExpression(t,r.handlingExpression,e),c=(Array.isArray(n)?[...n]:[n]).reverse();const d=()=>{if(c.length>0){let t=c.pop();this._run(a,t,(()=>{d()}))}else l()};o in this.tripartite.templates?(a=this.tripartite.getTemplate(o),a?d():this.continueOnTripartiteError&&l()):this.tripartite.loadTemplate(o,(t=>{if(t)a=t,d();else{let t="Could not load template: "+o;if(console.error(t),this.continueOnTripartiteError)l();else{let e=new Error(t);if(!i)throw e;i(e)}}}))}else l()}else"function"==typeof r&&(r.write?r.write(e,this.destination,(()=>{l()})):(this.output(r(e)),l()))}else i&&i()};l()}output(t){null!=t&&("string"==typeof this.destination?this.destination+=t:this.destination.write&&this.destination.write(t))}}},502:t=>{t.exports=function(t,e){if(null==t)return t;let i;for("string"==typeof e?i=e.trim().split("."):Array.isArray(e)&&(i=e);i.length>0;){let e,n=i.shift();if(n.indexOf(" ")>-1)return null;if("this"===n||"$this"===n?e=t:"object"==typeof t&&n in t&&(e=t[n]),0==i.length)return e;t=e}}},158:(t,e,i)=>{function n(t){return null!==t&&"object"==typeof t&&"function"==typeof t.pipe}"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});let a=i(268),s=i(134);class l{constructor(t={}){this.templates={defaultTemplate:this._makeTemplate((function(t){return""+t}))};let{constants:e={templateBoundary:"__",templateNameBoundary:"##"}}=t;this.constants=e,this.secondaryTemplateFunctionObject=t.secondaryTemplateFunctionObject,this.loaders=t.loaders||[],this.dataFunctions=t.dataFunction||{}}_makeTemplate(t){if((e=t)&&"function"==typeof e&&e.write&&e.parts&&e.templateMeta)return t;var e;let i=this,s=function(t){let e=null,i=null,a=null;for(let t=1;t<arguments.length;t++){let s=arguments[t];n(s)?e=s:"function"==typeof s?a=s:"object"==typeof s&&(i=s)}return s.write(t,e,a,i)};return s.write=function(e,n,l,r={}){if(t&&t.write)return t.write.apply(t,arguments);{let t=new a(i,s,e,n||"",i.dataFunctions);return r&&"continueOnTripartiteError"in r&&(t.continueOnTripartiteError=r.continueOnTripartiteError),t.run(l)}},s.parts=[],t&&"function"==typeof t&&s.parts.push(t),s.templateMeta={},s}addTemplate(t,e){return"string"==typeof e?e=this.parseTemplate(e):"function"==typeof e&&(e=this._makeTemplate(e)),this.templates[t]=e,e.templateMeta=e.templateMeta||{},e.templateMeta.name=t,e}createBlank(){return new l}getTemplate(t){return this.templates[t]}loadTemplate(t,e){if(t in this.templates)e(this.templates[t]);else{let i=this,n=this.loaders.length,a=!1;0==n?(i.templates[t]=null,e(i.getTemplate(t))):this.loaders.forEach((s=>{a||s(t,(s=>{a||(n--,s?(a=!0,i.addTemplate(t,s)):0==n&&(a=!0,i.templates[t]=null),a&&e(i.getTemplate(t)))}))}))}}parseTemplateScript(t){for(var e=this.tokenizeTemplateScript(t),i=null,n=0;n<e.length;n++){var a=e[n];if(a.active)i=a.content;else if(i){var s=this.addTemplate(i,this.stripTemplateWhitespace(a.content));this.secondaryTemplateFunctionObject&&(this.secondaryTemplateFunctionObject[i]=s),i=null}}}stripTemplateWhitespace(t){var e=t.indexOf("\n");return e>-1&&""==t.substring(0,e).trim()&&(t=t.substring(e+1)),(e=t.lastIndexOf("\n"))>-1&&""==t.substring(e).trim()&&(t=t.substring(0,e)),t}_createActiveElement(t,e,i,n,a){let l=new s(t,e,i,n);return l.templateMeta=a,l}pt(t){return this.parseTemplate(t)}parseTemplate(t){var e=this.tokenizeTemplate(t);let i=this._makeTemplate();var n=i.templateMeta;for(let t of e)t.active?i.parts.push(this.tokenizeActivePart(t.content,n)):t.content&&i.parts.push(t.content);return i}tokenizeActivePart(t,e){var i=null,n=null,a=null,s=t.indexOf("??");s>-1?(i=t.substring(0,s),s+=2):s=0;var l=t.indexOf("::");return l>-1?(n=t.substring(s,l),a=t.substring(l+2)):n=t.substring(s),this._createActiveElement(i,n,a,this,e)}tokenizeTemplate(t){return this.tokenizeActiveAndInactiveBlocks(t,this.constants.templateBoundary)}tokenizeTemplateScript(t){return this.tokenizeActiveAndInactiveBlocks(t,this.constants.templateNameBoundary)}tokenizeActiveAndInactiveBlocks(t,e){let i=t.length,n=0,a=!1,s=[];for(;n<i;){let r=t.indexOf(e,n);-1==r&&(r=i);var l={active:a,content:t.substring(n,r)};s.push(l),n=r+e.length,a=!a}return s}}var r=new l;"undefined"!=typeof window&&(r.secondaryTemplateFunctionObject=window),t.exports=r,void 0!==i.g&&(i.g.Tripartite||(i.g.Tripartite=l),i.g.tripartite||(i.g.tripartite=r))},559:(t,e,i)=>{var n=i(158);t.exports=n.addTemplate("webhandle-tree-image-browser/extension-pill",'<span class="extension-pill">__this__</span>')},574:(t,e,i)=>{var n=i(158);t.exports=n.addTemplate("webhandle-tree-image-browser/guilded-file-upload-form",'<div class="guided-image-upload-form ei-form">\n\t<label>\n\t\tSource file name:<br>\n\t\t__nativeName__\n\t</label>\n\t<label>\n\t\tAfter uploaded name (with extension):\n\t\t<input name="name" type="text" />\n\t</label>\n\t\n</div>')},115:(t,e,i)=>{var n=i(158);t.exports=n.addTemplate("webhandle-tree-image-browser/guilded-image-upload-form",'<div class="guided-image-upload-form ei-form">\n\t<label>\n\t\tSource file name:<br>\n\t\t__nativeName__\n\t</label>\n\t<label>\n\t\tNative resolution:<br>\n\t\t__stats.width__ x __stats.height__\n\t</label>\n\t<label>\n\t\tAfter uploaded name (no extension):\n\t\t<input name="name" type="text" />\n\t</label>\n\t<div class="radio-options">\n\t\tOutput format:\n\t\t<label>\n\t\t\t<input type="radio" name="outputFormat" value="image/png" /> <span class="extension-pill">PNG</span>\n\t\t</label>\n\t\t<label>\n\t\t\t<input type="radio" name="outputFormat" value="image/jpeg" /> <span class="extension-pill">JPG</span>\n\t\t</label>\n\t</div>\n\t<label>\n\t\tOn screen width (px):\n\t\t<input name="width" type="number" />\n\t</label>\n\t<label>\n\t\tOutput quality (0 to 1):\n\t\t<input name="quality" value="0.7" type="number" min="0" max="1" step=".01" />\n\t</label>\n\t\n\t<label>\n\t\tAlt text:\n\t\t<textarea name="altText"></textarea>\n\t</label>\n\t\n</div>')},24:(t,e,i)=>{var n=i(158);t.exports=n.addTemplate("webhandle-tree-image-browser/image-browser-frame",'<div class="image-browser-frame">\n\t<div class="directory-side">\n\t\t<div class="treebox">\n\n\t\t</div>\n\t\t<div class="directory-controls">\n\t\t\t<button type="button" class="btn create-directory" title="create new directory">\n\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\tcreate_new_folder\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" class="btn delete-directory" title="delete selected directory">\n\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\tfolder_delete\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>\n\t<div class="node-view">\n\t\t<div class="view-controls">\n\t\t\t<div class="left">\n\t\t\t\t<input name="filter" type="text" placeholder="filter" />\n\t\t\t\t<button class="clear-filter">×</button>\n\t\t\t</div>\n\t\t\t<div class="right">\n\t\t\t\t<span class="view-icons">\n\t\t\t\t\t<button type="button" class="show-large-tiles" title="show big tiles" data-show-class="grid-large">\n\t\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\t\tgrid_view\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" class="show-small-tiles" title="show small tiles"\n\t\t\t\t\t\tdata-show-class="grid-small">\n\t\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\t\tgrid_on\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" class="show-list-rows" title="show as rows" data-show-class="rows">\n\t\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\t\tlist\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" class="show-list-text" title="show as list" data-show-class="list-text">\n\t\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\t\ttable_rows\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t</span>\n\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="node-content">\n\t\t\t<div class="box-holder">\n\t\t\t\t<div class="choice-boxes">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="bottom-controls">\n\t\t\t<div class="file-controls">\n\t\t\t\t<button type="button" class="btn delete-file" title="delete selected file(s)">\n\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\tdelete\n\t\t\t\t\t</span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" class="btn upload-file" title="upload file(s)">\n\t\t\t\t\t<span class="material-icons thumbnail-icon">\n\t\t\t\t\t\tupload\n\t\t\t\t\t</span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<div class="folder-info">\n\t\t\t\t\n\t\t\t</div>\n\n\t\t</div>\n\t</div>\n\t<div class="drop-cover file-drop-cover">\n\t\t<div class="drop-type literal">\n\t\t\t<div class="msg">\n\t\t\t\t<h2>\n\t\t\t\t\tJust Do It\n\t\t\t\t</h2>\n\t\t\t\t<p>\n\t\t\t\t\tWe won\'t mess the files at all, just upload them.\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<div class="drop-cover img-drop-cover">\n\t\t<div class="drop-type guided-upload">\n\t\t\t<div class="msg">\n\t\t\t\t<h2>Guided Upload</h2>\n\t\t\t\t<p>\n\t\t\t\t\tLet us help you rename, and resize (if needed), the files by asking you questions\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="drop-type automatic">\n\t\t\t<div class="msg">\n\t\t\t\t<h2>\n\t\t\t\t\tWeb Safe\n\t\t\t\t</h2>\n\t\t\t\t<p>\n\t\t\t\t\tWe\'ll rename the files so they fit better with the web and create multiple formats images.\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="drop-type literal">\n\t\t\t<div class="msg">\n\t\t\t\t<h2>\n\t\t\t\t\tJust Do It\n\t\t\t\t</h2>\n\t\t\t\t<p>\n\t\t\t\t\tWe won\'t mess the files at all, just upload them.\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\n\t</div>\n\t<div class="hidden-elements">\n\t\t<input name="fileUpload" type="file" placeholder="Upload a file" />\n\t\t\n\t</div>\n\n</div>')},466:(t,e,i)=>{var n=i(158);t.exports=n.addTemplate("webhandle-tree-image-browser/variant-choice-box",'<div class="variant-choice-box">\n\t<div class="img">\n\t\t__!this.thumbnail??\'<span class="material-icons thumbnail-icon">\' + thumbnailIcon + \'</span>\'__\n\t\t__this.thumbnail??\'<img loading="lazy" class="thumbnail-image" src="\' + safeThumbnail + \'" />\'__\n\t</div>\n\t<div class="size-line">\n\t\t__size__\n\t</div>\n\t<div class="bottom">\n\t\t<div class="content">\n\t\t\t<div class="basename">\n\t\t\t\t__safeBaseName__\n\t\t\t</div>\n\t\t\t<div class="extensions">\n\t\t\t\t__extensions::./extension-pill__\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="actions">\n\t\t\t<button class="details">\n\t\t\t\t<span class="material-icons">more_vert</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>\n\n</div>')}},e={};function i(n){var a=e[n];if(void 0!==a)return a.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,i),s.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{function t([t,e]){let i=(t=t.trim()).split(" "),n=i.shift().trim(),a=i.join(" ").trim();return"string"==typeof e&&(e=e.trim()),{event:n,selector:a,handler:e}}i.d(n,{DY:()=>zt,Tq:()=>Lt,ZP:()=>jt,RM:()=>Ct});let e={tagName:"div",events:{}};class a{constructor(t){this.id=function(){let t=new Uint8Array(32);window.crypto.getRandomValues(t);let e=btoa(t);return e=e.replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,""),e}(),Object.assign(this,e),this.preinitialize.apply(this,arguments),Object.assign(this,t),this._ensureElement(),this.initialize.apply(this,arguments)}preinitialize(){}initialize(){}render(){return this}remove(){this.el.parentElement.removeChild(this.el)}appendTo(t){t.appendChild(this.el)}replaceContentsOf(t){t.innerHTML="",this.appendTo(t)}setElement(t){return this.el!==t&&(this.el=t,this._addListeners()),this}_createElement(t){let e=document.createElement(t);return e.setAttribute("id",this.id),e.view=this,e}_ensureElement(){this.el||this.setElement(this._createElement(this.tagName)),this._setAttributes(),this.className&&this.el.classList.add(this.className)}_setAttributes(t){if(this.attributes)for(let[t,e]of Object.entries(this.attributes))this.el.setAttribute(t,e)}_addListeners(){this.eventTriggers=Object.entries(this.events).map(t);let e=(i=this.eventTriggers,Array.from(i.reduce(((t,e)=>(t.add(e.event),t)),new Set)));var i;for(let t of e)this.el.addEventListener(t,this._eventHandler.bind(this))}_getCandidates(t){return"."===t?[this.el]:Array.from(this.el.querySelectorAll(t))}_eventHandler(t){for(let e of this.eventTriggers)if(t.type==e.event){let i=this._getCandidates(e.selector),n=null;for(let e of i)if(e===t.target||e.contains(t.target)){n=e;break}if(n){"string"==typeof e.handler?this[e.handler].call(this,t,n):"function"==typeof e.handler&&e.handler.call(this,t,n);break}}}}var s=i(24),l=i(466),r=(i(559),i(115)),o=i(574);let c=s,d=l,u=r,h=o;var p=i(724);function f(t,e){if(0==t)return"0 Bytes";var i=e||2,n=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,n)).toFixed(i))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][n]}let m,g="undefined"==typeof EventTarget?{}:EventTarget;m="undefined"!=typeof EventTarget?class extends g{constructor(t){super(t),this.innerEventTarget=t||this}on(t,e){let i=t=>{e.apply(this,t.detail)};return e.nativeListener=i,this.innerEventTarget.addEventListener(t,i),this}emit(t,...e){return this.innerEventTarget.dispatchEvent(new CustomEvent(t,{detail:e})),this}removeListener(t,e){return e=e.nativeListener||e,this.innerEventTarget.removeEventListener(t,e),this}}:class{constructor(){this.handles={}}on(t,e){let i=this.handles[t];return i||(i=this.handles[t]=[]),i.push(e),this}emit(t,...e){if(t in this.handles)for(let i of this.handles[t])i.apply(this,e)}removeListener(t,e){t in this.handles&&(this.handles[t]=this.handles[t].filter((t=>t!==e)))}};const b=m;var v=i(772),y=i(89);class w extends v{constructor(t){super(Object.assign({},t,{on:{".btn-ok":()=>(this.resolve(this.gatherData()),!0),".mask":()=>(this.resolve(),!0),".btn-cancel":()=>(this.resolve(),!0)}})),this.afterOpen&&(this.afterOpenOriginal=this.afterOpen),this.afterOpen=function(t,e){this.data&&(t.innerHTML=y(t.innerHTML,this.data));let i=t.querySelector("input, textarea");i&&i.focus(),this.afterOpenOriginal&&this.afterOpenOriginal(t,e)}}gatherData(){return function(t){let e={},i=t.querySelectorAll("input, textarea, select");for(let t of i){if("checkbox"===t.type){if(!t.checked)continue}else if("radio"===t.type&&!t.checked)continue;e[t.getAttribute("name")]=t.value}return e}(document.querySelector(this.getBodySelector()))}async open(){return this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),super.open(),this.promise}}async function x(t,e){let i=this.getSelectedFiles();if(i.files.length>0){let t=i.files,e=i.names;if(!this.deleteWithoutConfirm){let i=new w({title:"Delete File"+(t.length>1?"s":""),body:"<p>"+e.join(", ")+"</p>"}).open();if(!await i)return}for(let e of t){let t,i=e.relPath;this.eventNotificationPanel&&(t=this.eventNotificationPanel.addNotification({model:{status:"pending",headline:`deleting ${e.name}`}})),await this.sink.rm(i),this.eventNotificationPanel&&(t.remove(),t=this.eventNotificationPanel.addNotification({model:{status:"success",headline:`removed ${e.name}`},ttl:2e3}))}for(let t of i.boxes)t.remove()}this.emitter.emit("delete",{type:"delete",selected:i})}async function _(t,e){let i=this.currentNode.file.relPath,n=this.currentNode.file.name;if(!i)return;let a,s=new w({title:"Delete Directory",body:"<p>"+n+"</p>"}).open();if(!await s)return;this.eventNotificationPanel&&(a=this.eventNotificationPanel.addNotification({model:{status:"pending",headline:`deleting ${n}`}})),await this.sink.rm(i,{recursive:!0});let l=this.tree.selected(),r=this.tree.parent(l);this.tree.removeNode(l),this.tree.select(r.id),this.eventNotificationPanel&&(a.remove(),a=this.eventNotificationPanel.addNotification({model:{status:"success",headline:`removed ${n}`},ttl:2e3}))}function T(...t){return(t=t.filter((t=>!!t))).join("/")}function F(t){if(!t)return"";let e=t.split("/");return e.pop(),e.join("/")}function S(t){let e={id:this.idInd++,label:t.name,directory:t.directory,file:t,loaded:!1},i=this.nodes[this._determineParentPath(t.relPath)];return this.nodes[t.relPath]=e,i&&(e.parentId=i.id,e.path=t.relPath),t.path=e.path,e}function k(t){let e=new Set;if(t.variants)for(let i of t.variants)e.add(i.ext);else e.add(t.ext);let i=Array.from(e).filter((t=>!!t));return i.sort(((t,e)=>t.toLowerCase().localeCompare(e.toLowerCase()))),i}function E(t){let e=2e9,i=0;if(t.variants)for(let n of t.variants){let t=n.file.stat.size;t>i&&(i=t),t<e&&(e=t)}else{let n=t.file.stat.size;n>i&&(i=n),n<e&&(e=n)}return[e,i]}function O(t){return t.sort(((t,e)=>t.relPath.toLowerCase().localeCompare(e.relPath.toLowerCase()))),t}function L(t,e){return t.baseName.toLowerCase().localeCompare(e.baseName.toLowerCase())}function z(t){return t.split("/").join("-").split("..").join("-")}function C(t){return!!t.type.startsWith("image")&&!!(t.type.includes("jpeg")||t.type.includes("png")||t.type.includes("webp"))}function j(t,e){t in this||(this[t]=e)}function N(t){let e;return this.eventNotificationPanel&&(e=this.eventNotificationPanel.addNotification({model:{status:"pending",headline:`uploading ${t.name}`}})),e}class D extends v{constructor(t){super(Object.assign({},t,{on:{".btn-ok":()=>(this.resolve(),!0),".mask":()=>(this.resolve(),!0),".btn-cancel":()=>(this.resolve(),!0)}}))}async open(){return this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),super.open(),this.promise}}var A=i(547);function P(t,e){let i=e.getAttribute("data-show-class");this.changeFilesViewToClass(i)}function I(t){let e=this.el.querySelector(".choice-boxes");[...this.el.querySelector(".view-icons").querySelectorAll("button")].map((t=>t.getAttribute("data-show-class"))).forEach((t=>{e.classList.remove(t)})),e.classList.add(t)}function q(t,e){setTimeout((()=>{let t=this.el.querySelector('[name="filter"]').value,e=this.el.querySelectorAll(".choice-boxes .variant-choice-box");for(let i of e)i.classList.remove("hidden"),t&&(t=t.toLowerCase(),(i.variant.baseName.toLowerCase()+i.variant.extensions.map((t=>t.toLowerCase())).join()).indexOf(t)<0&&i.classList.add("hidden"));this.setFolderInfo()}))}function M(t,e){this.el.querySelector('[name="filter"]').value="",this.applyFilter()}function B(t,e){let i=this.el.querySelectorAll(".choice-boxes .variant-choice-box.selected");if(!t.ctrlKey&&!t.shiftKey)for(let t of i)t.classList.remove("selected");if(t.shiftKey){let t=e;do{if(t.classList.contains("selected"))break;t.classList.add("selected"),t=t.previousElementSibling}while(t)}else e.classList.toggle("selected");let n=this.getSelectedFiles();this.emitter.emit("select",{type:"select",selected:n})}function U(t,e){let i=e.closest(".variant-choice-box").variant,n=this._getAssociatedRealFiles(i),a='<div class="variant-details-information">';i.safeThumbnail&&(a+=`<div class="details-preview-image">\n\t\t<img loading="lazy" src="${i.safeThumbnail}" />\n\t\t</div>`),a+='<ul class="variants">';for(let t of n)a+='<li><a target="_blank" href="'+A(this.escapeAccessUrl(t.accessUrl))+'">',a+=A(t.name)+"</a> - "+this._formatBytes(t.stat.size),a+="</li>";a+="</ul>",a+="</div>",new D({title:"File Details: "+i.baseName,body:a,buttons:[{classes:"btn btn-primary btn-ok",label:"OK"}]}).open().then((async t=>{}))}function $(){let t=0,e=0,i=0,n=0,a=this.el.querySelectorAll(".choice-boxes .variant-choice-box");for(let s of a)s.classList.contains("hidden")||(e++,s.variant.variants?s.variant.variants.forEach((e=>{t++,i+=e.file.stat.size})):(t++,i+=s.variant.file.stat.size,n++));this.el.querySelector(".folder-info").innerHTML=`${e} items / ${t} files / ${this._formatBytes(i)} `,e>this.listTriggerSize&&this.changeFilesViewToClass("list-text"),this.el.querySelector(".view-icons").classList.remove("no-img"),e-n>this.listLockSize&&this.el.querySelector(".view-icons").classList.add("no-img")}function H(){this.el.querySelector(".folder-info").innerHTML="",this.el.querySelector(".choice-boxes").innerHTML='<div class="loading-info">Loading Information Now</div>',this.el.querySelector(".view-icons").classList.add("no-img")}function V(){return".img-drop-cover"}async function W(t,e){let i="literal",n=t.target.closest(".drop-type");n&&(n.classList.contains("guided-upload")?i="guided":n.classList.contains("automatic")&&(i="automatic")),this._cleanupDropDone(),t.preventDefault();let a=await this._getFilesFromEvent(t);this.uploadFiles(a,{uploadType:i})}function R(t){let e=!0;return t.dataTransfer&&"string"===t.dataTransfer.items[0].kind&&(e=!1),e}function K(t,e){this.isFileTypeDrag(t)&&(this.overCount++,this.el.querySelector(this.getDropCoverSelector()).classList.add("file-dropping"))}function G(t,e){this.isFileTypeDrag(t)&&(this.overCount--,0==this.overCount&&this._cleanupDropDone())}function J(t,e){t.preventDefault()}function Y(){this.overCount=0,[...this.el.querySelectorAll(".file-dropping")].forEach((t=>t.classList.remove("file-dropping")))}async function Z(t){this.ignoreGlobalEvents||(t.preventDefault(),t.clipboardData&&t.clipboardData.files&&t.clipboardData.files.length>0&&this.uploadFiles(t.clipboardData.files,{uploadType:"guided"}))}function Q(t,e){new w({title:"Create Directory",body:'<label>Directory name <input type="text" name="name" /></label>'}).open().then((async t=>{if(t){let e=this.currentNode.file.relPath+"/"+t.name;await this.sink.mkdir(e);let i=await this.sink.getFullFileInfo(e),n=this._fileToKalpaNode(i);this.tree.options.stream.emit("data",n);let a=this.tree.selected();a&&this.tree.expand(a.id)}}))}var X=i(799);function tt(t){if(!t||"string"!=typeof t)return t;let e=[...t];t="";for(let i=0;i<e.length;i++)t+=e[i],i%10==0&&(t+="<wbr>");return function(t,e){for(let t of["_"])e=e.split(t).join("<wbr>"+t);return e}(0,t)}function et(t){let e=X(t.children),i=Object.values(e),n=[];for(let t of i)n.push(...this._getAssociatedRealFiles(t).map((t=>t.name)));let a=t.children.filter((t=>!n.includes(t.name))).filter((t=>!t.directory));for(let t of i)t.thumbnailIcon="image",t.preview&&(t.thumbnail=this._createAccessUrl(t.preview.file),t.safeThumbnail=A(t.thumbnail));if(!this.imagesOnly)for(let t of a){let e={file:t,thumbnailIcon:"description"},n=t.name;e.ext=n.substring(n.lastIndexOf(".")+1),e.baseName=n.substring(0,n.lastIndexOf(".")),i.push(e)}for(let t of i)t.extensions=this._determineExtensions(t),t.sizes=this._determineSizes(t),t.sizes[0]==t.sizes[1]?t.size=this._formatBytes(t.sizes[0]):t.size=this._formatBytes(t.sizes[0])+" - "+this._formatBytes(t.sizes[1]),t.safeBaseName=tt(A(t.baseName));return i.sort(this._compareVariants),i}async function it(t){let e=[];if(t.dataTransfer.items){let i=[];[...t.dataTransfer.items].forEach(((t,e)=>{i.push(t)}));for(let t of i)if("file"===t.kind)if(t.webkitGetAsEntry){let i=t.webkitGetAsEntry();if(i){if(i.isDirectory)continue;e.push(t.getAsFile())}}else e.push(t.getAsFile());else t instanceof File&&e.push(t)}else[...t.dataTransfer.files].forEach(((t,i)=>{e.push(t)}));return e}function nt(t){let e=[];return t.variants?e.push(...t.variants.map((t=>t.file))):e.push(t.file),t.definitionFile&&e.push(t.definitionFile),e}function at(t){return this.escapeAccessUrl(t.accessUrl)}function st(t){return function(t,e){for(let t of["%"," ","#","?","<",">","$","@","^","&"])e=e.split(t).join(encodeURIComponent(t));return e}(0,t)}function lt(){let t={boxes:[],variants:[],files:[],names:[]},e=this.el.querySelectorAll(".choice-boxes .variant-choice-box.selected");if(e.length>0){for(let i of e)t.boxes.push(i),t.variants.push(i.variant),t.files.push(...this._getAssociatedRealFiles(i.variant));let i=t.files.map((t=>t.name));t.names.push(...i)}return t}function rt(t){return 0==t.startsWith("/")&&(t="/"+t),t}async function ot(t){if(t||(t=this.getSelectedFiles()),0==t.variants.length)return;let e,i=t.variants[0];e=i.primary?i.primary.file:i.file;let n=this._transformRelativeUrlToPublic(e.relPath);if(i.definitionFile){let t=await this.sink.read(i.definitionFile.relPath);try{let e=JSON.parse(t);n+=this.getSelectedUrlExtFromMeta(e)}catch(t){}}return n}function ct(t){let e="",i=t.displaySize.split("x");return e+=`#format=webp2x&width=${i[0]}&height=${i[1]}`,t.altText&&(e+="&alt="+encodeURIComponent(t.altText)),e}function dt(t){let e;"string"==typeof t?e=t:t instanceof File&&(e=t.name);let i=e.split(".");i.length>1&&i.pop(),e=i.join("."),e=e.replace(/-@2x$/,""),e=e.replace(/@2x$/,""),e=e.replace(/-2x$/,""),e=e.replace(/2x$/,"");let n=[e.substring(0,1)];for(let t of e.substring(1))t.match(/[A-Z]/)&&n.push("-"),n.push(t);return e=n.join(""),e=e.toLowerCase(),e=e.replace(/[^1234567890a-z-]/g,"-"),e=e.replace(/--+/g,"-"),e}async function ut(t){return new Promise(((e,i)=>{let n,a;if(t instanceof Image)n=t;else if("string"==typeof t)n=new Image,n.src=t;else{let e=new Blob([t]);a=URL.createObjectURL(e),n=new Image,n.src=a}function s(){a&&URL.revokeObjectURL(a),e(n)}n.complete?s():n.addEventListener("load",(()=>{s()}))}))}async function ht(t,{maxWidth:e=1920,quality:i=.7,outputFormat:n="image/png"}={}){return new Promise((async(a,s)=>{try{let s=await ut(t),o=s.naturalWidth/e,c=s.naturalHeight/o;var l=document.createElement("canvas");l.width=e,l.height=c;var r=l.getContext("2d");r.clearRect(0,0,l.width,l.height),r.drawImage(s,0,0,l.width,l.height),l.toBlob((t=>{a(t)}),n,i)}catch(t){console&&console.log&&console.log("error resizing image: "+t),s(t)}}))}async function pt(t){let e=await ut(t);return{width:e.naturalWidth,height:e.naturalHeight}}let ft={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/webp":"webp"};function mt(t){return t in ft?ft[t]:t.split("/").pop()}let gt="image/webp";async function bt(t,{singleDensityWidth:e=null,quality:i=.7,outputFormat:n="image/png",doubleDensityInput:a=!0,baseFileName:s,altText:l}={}){let r=await ut(t),o=await pt(r),c=o.width/o.height;s||(s=""+(new Date).getTime()),e||(e=a?o.width/2:o.width);let d=2*e,u={"-2x":d,"":e,"-half":Math.floor(e/2),"-quarter":Math.floor(e/4)},h={};for(let t of Object.keys(u)){let e=u[t],a=await ht(r,{maxWidth:e,quality:i,outputFormat:n});h[s+t+"."+mt(n)]=a,a=await ht(r,{maxWidth:e,quality:i,outputFormat:gt}),h[s+t+"."+mt(gt)]=a}let p={name:s,size:d+"x"+d/c,displaySize:e+"x"+e/c,fallback:mt(n),altText:l||s};return h[s+".json"]=JSON.stringify(p,null,"\t"),h}function vt(t){let e;"string"==typeof t?e=t:t instanceof File&&(e=t.name);let i=[dt(e)],n=e.split(".");return n.length>1&&i.push(n.pop()),i}async function yt(t){let e=dt(t),i=await async function(t){let e=await ut(t),i=await pt(e);return i.ratio=i.width/i.height,i.ext=mt(t.type),i}(t),n={nativeName:t.name,name:e,outputFormat:t.type,stats:i,width:Math.floor(i.width/2)},a=new w({title:"Upload File",body:u(n),data:n,dialogFrameClass:"webhandle-file-tree-image-browser"}).open(),s=await a;if(s){let i,n={baseFileName:s.name,outputFormat:s.outputFormat,singleDensityWidth:parseInt(s.width),quality:parseFloat(s.quality),altText:s.altText},a=this._addPending(t),l=await bt(t,n),r=JSON.parse(l[e+".json"]);for(let t of Object.keys(l)){let e=await this._uploadData(t,l[t]);t===r.name+"."+r.fallback&&(i=e)}let o=this._transformRelativeUrlToPublic(i);return o+=this.getSelectedUrlExtFromMeta(r),a&&a.remove(),o}}async function wt(t){let e=vt(t),i={nativeName:t.name,name:e.join(".")},n=new w({title:"Upload File",body:h(i),data:i,dialogFrameClass:"webhandle-file-tree-image-browser"}).open(),a=await n;if(a){let e=this._addPending(t),i=await this._uploadData(a.name,t),n=this._transformRelativeUrlToPublic(i);return e&&e.remove(),n}}async function xt(t){let e,i=this._addPending(t),n=vt(t)[0],a=await bt(t,{baseFileName:n,outputFormat:t.type}),s=JSON.parse(a[n+".json"]);for(let t of Object.keys(a)){let i=await this._uploadData(t,a[t]);t===s.name+"."+s.fallback&&(e=i)}let l=this._transformRelativeUrlToPublic(e);return l+=this.getSelectedUrlExtFromMeta(s),i&&i.remove(),l}async function _t(t,{uploadType:e}={}){let i=[];for(let n of t){let t=!1;if("guided"===e&&this._isImageFile(n))t=await this._uploadGuidedImageFile(n);else if("guided"===e)t=await this._uploadGuidedFile(n);else if("automatic"===e&&this._isImageFile(n))t=await this._uploadAutomaticImageFile(n);else{let i,a=this._addPending(n);if("automatic"===e){let t=vt(n);i=await this._uploadData(t.join("."),n)}else i=await this._uploadData(n.name,n);t=this._transformRelativeUrlToPublic(i),a&&a.remove()}this.eventNotificationPanel&&t&&this.eventNotificationPanel.addNotification({model:{status:"success",headline:`uploaded ${n.name}`},ttl:2e3}),i.push(t)}return this.setCurrentNode(this.currentNode),this.emitter.emit("upload",{type:"upload",accessUrls:i}),i}function Tt(t,e){this.el.querySelector(this.fileUploadSelector).click()}async function Ft(t,e){t.preventDefault();let i=this.el.querySelector(this.fileUploadSelector);t.dataTransfer={files:i.files};let n=await this._getFilesFromEvent(t);if(n.length>0){let t=this.uploadFiles(n,{uploadType:"guided"});return i.value="",t}}async function St(t,e){let i=this.currentNode.file.relPath+"/"+this.sanitizeFileName(t);return await this.sink.write(i,e),i}async function kt(){return new Promise(((t,e)=>{let i=[],n=this.sink.find({file:!1});n.on("data",(t=>{i.push(t)})),n.on("done",(()=>{t(i)}))}))}class Et extends a{constructor(t){super(t),this.setIfNotSet("overCount",0),this.setIfNotSet("emitter",new b),this.setIfNotSet("fileUploadSelector",'input[name="fileUpload"]'),this.setIfNotSet("listTriggerSize",100),this.setIfNotSet("listLockSize",200)}preinitialize(){this.className="image-browser",this.idInd=1,this.nodes={},this.events={"click .create-directory":"createDirectory","click .upload-file":"_uploadFileButton",'change [name="fileUpload"]':"_uploadFile","click .delete-file":"deleteFile","click .delete-directory":"deleteDirectory","click .variant-choice-box .details":"showVariantDetails","dblclick .variant-choice-box":"showVariantDetails","click .variant-choice-box":"selectVariant","click .view-icons button":"changeFilesView",'keyup [name="filter"]':"applyFilter",'change [name="filter"]':"applyFilter","click .clear-filter":"clearFilter","dragenter .":"dragEnter","dragleave .":"dragLeave","dragover .":"dragOver","drop .":"handleDrop"},document.addEventListener("paste",Z.bind(this))}async render(){this.el.innerHTML=c(this.model),this.data=[],this.rootDirectory=await this.sink.getFullFileInfo(""),this.rootDirectory.name="Files";let t=this.rootNode=this._fileToKalpaNode(this.rootDirectory);this.data.push(t);let e=await this.findDirectories();this._sortFiles(e),this.data.push(...e.map(this._fileToKalpaNode.bind(this))),p({treeContainerSelector:`#${this.id} .treebox`,data:this.data}).then((t=>{if(this.tree=t,t.on("select",(t=>{this.setCurrentNode(t)})),t.on("selected",(t=>{let e=this.el.querySelector(".tree");e.style.height="99.99999%",setTimeout((()=>{e.style.height="100%"}),100)})),this.startingDirectory){for(let e of Object.values(this.tree.nodes))if(e.file&&e.file.relPath&&e.file.relPath==this.startingDirectory){t.select(e.id);break}}else t.select(1)}))}async setCurrentNode(t){this.currentNode=t,this.cleanFileInfo();let e=this.el.querySelector(".choice-boxes"),i=await this.sink.getFullFileInfo(t.file.relPath),n=this.createVariantValues(i);n.length>this.listTriggerSize&&this.changeFilesViewToClass("list-text");let a="";for(let t of n)a+=d(t);e.innerHTML="",e.insertAdjacentHTML("beforeend",a);for(let t=0;t<e.children.length;t++)e.children[t].variant=n[t];this.el.querySelector(".box-holder").scrollTop=0,this.applyFilter()}_uploadGuidedImageFile=yt;_uploadGuidedFile=wt;_uploadAutomaticImageFile=xt;uploadFiles=_t;_uploadFileButton=Tt;_uploadFile=Ft;createVariantValues=et;_getFilesFromEvent=it;_getAssociatedRealFiles=nt;_createAccessUrl=at;escapeAccessUrl=st;getSelectedFiles=lt;_transformRelativeUrlToPublic=rt;getSelectedUrl=ot;getSelectedUrlExtFromMeta=ct;createDirectory=Q;getDropCoverSelector=V;handleDrop=W;isFileTypeDrag=R;dragEnter=K;dragLeave=G;dragOver=J;handlePaste=Z;_cleanupDropDone=Y;changeFilesView=P;changeFilesViewToClass=I;applyFilter=q;clearFilter=M;selectVariant=B;showVariantDetails=U;setFolderInfo=$;cleanFileInfo=H;sanitizeFileName=z;_sortFiles=O;_compareVariants=L;_determineExtensions=k;_determineSizes=E;_join=T;_determineParentPath=F;_fileToKalpaNode=S;_formatBytes=f;_isImageFile=C;setIfNotSet=j;_addPending=N;deleteFile=x;deleteDirectory=_;_uploadData=St;findDirectories=kt}var Ot=i(161);let Lt=Et,zt=class extends v{constructor(t){super(Object.assign({title:"Select A File",body:'<div class="webhandle-file-tree-image-browser" style="width: 87vw;"> </div>',afterOpen:function(t,e){let i=t.querySelector(".webhandle-file-tree-image-browser");if(i){let t={sink:e.sink,imagesOnly:e.imagesOnly,eventNotificationPanel:e.eventNotificationPanel,startingDirectory:e.startingDirectory,deleteWithoutConfirm:e.deleteWithoutConfirm},n=this.imageBrowserView=new Et(t);e._createAccessUrl&&(n._createAccessUrl=e._createAccessUrl),e._transformRelativeUrlToPublic&&(n._transformRelativeUrlToPublic=e._transformRelativeUrlToPublic),n.appendTo(i),n.render(),n.emitter.on("select",(async function(t){})),n.emitter.on("upload",(async function(t){e.chooseOnUpload&&(e.close(),e.resolve({url:t.accessUrls[0]}))}))}},chooseOnUpload:!0},t,{on:{".btn-ok":async()=>{let t={selection:this.imageBrowserView.getSelectedFiles()};return t.url=await this.imageBrowserView.getSelectedUrl(t.selection),this.resolve(t),!0},".mask":()=>(this.resolve(),!0),".btn-cancel":()=>(this.resolve(),!0)}}))}async open(){return this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),super.open(),this.promise}},Ct=function(){if(!function(){let t=document.createElement("div");t.classList.add("webhandle-file-tree-image-browser-test"),t.style.position="absolute",t.style.left="-10000px",document.body.appendChild(t);let e=window.getComputedStyle(t)["background-color"];return t.remove(),"rgb(101, 105, 99)"===e}()){let t=document.createElement("link");t.href="/@webhandle/tree-file-browser/resources/css/tree-browser.css",t.rel="stylesheet",document.head.appendChild(t)}Ot()};"undefined"!=typeof window&&(window["@webhandle/tree-file-browser"]={ImageBrowserView:Lt,FileSelectDialog:zt,loadStyles:Ct});const jt=Lt})();var a=n.DY,s=n.Tq,l=n.ZP,r=n.RM;export{a as FileSelectDialog,s as ImageBrowserView,l as default,r as loadStyles};
|
|
2
2
|
//# sourceMappingURL=tree-file-browser.js.map
|