this.select(e.elm,i))),this.interface(),i&&this.headroom_pin()}static selected(){return this.matchingItems_length()?Y.list.matchingItems.filter((e=>e.elm.dataset.selected)):[]}static toggle_has_matchingItems(e){this.el.selectbar.classList.toggle("has-matchingItems",e),this.el.selectbar.firstElementChild.disabled=!e}static update(){this.config.enabled&&(this.count=this.selected().length,this.toggle_has_matchingItems(!!this.matchingItems_length()),this.interface())}static reset(e){this.config.enabled&&(this.anchor=this.focus=0,this.toggle_has_matchingItems(!!e),this.count&&(this.count=0,this.interface()))}static interface(){this.el.counter.textContent=this.count||"",this.el.selectbar.classList.toggle("has-selection",!!this.count),this.el.selectbar.classList.toggle("select-single",1===this.count),this.el.selectbar.classList.toggle("select-multiple",this.count>1),this.el.selectbar.classList.toggle("select-is-zip",1===this.count&&"zip"===this.selected()[0]._values.ext),this.el.buttons.forEach((e=>e.disabled=!this.count))}static set_mode(e){this.mode=!!e,K.main.classList.toggle("select-mode",this.mode),K.main.classList.toggle("select-mode-disabled",!this.mode)}static copy_links(e){const t=[];return e.forEach((e=>{try{const i=new URL(p(e),location);i&&i.href&&t.push(i.href)}catch(e){return}})),t.length&&A(t.join(this.config.copy_links_separator))}static copied_items=[];static copied_items_parent;static paste_items(){if(!(_c.current_dir&&this.copied_items.length&&this.copied_items_parent&&this.copied_items_parent.files))return;if(_c.dirs[this.copied_items_parent.path]!==this.copied_items_parent)return;if(this.copied_items=this.copied_items.filter((e=>{let t=this.copied_items_parent.files[e.basename];if(t)return t===e||["basename","filesize","mtime","path"].every((i=>t[i]===e[i]))})),!this.copied_items.length)return;const e=this.copied_items_parent===_c.current_dir?"duplicate":"copy";return new me({action:e,items:this.copied_items,pasted_from:"copy"===e&&this.copied_items_parent,parent_dir:this.copied_items_parent,parent_path:this.copied_items_parent.path})}static select_action(e){if("toggle"===e)return this.all();const t=this.count?this.selected():[];if(!t.length)return F.toggle(!1,"Nothing selected!");const i=t.map((e=>e._values));return"copy links"===e?ne?F.toggle(this.copy_links(i),ie.get("copy link"+(i.length>1?"s":""))):F.license():"download"===e?ce.zip(_c.current_dir,i.filter((e=>e.is_readable))):"copy_items"===e?(this.copied_items=i,this.copied_items_parent=_c.current_dir,F.toggle(!0,`${i.length} ${ie.get(me.get_items_type(i))} ${ie.get("copied to clipboard")}`)):"modal"===e?1===i.length&&U.open_modal(i[0],!0):new me({action:e,items:i,list_items:t,parent_dir:_c.current_dir,parent_path:_c.current_path})}static keyboard_events(){if(!this.config.keyboard_shortcuts||!this.config.keyboard_shortcuts.length)return;const e=this.config.keyboard_shortcuts.filter((e=>this.keyboard_shortcuts[e]));e.length&&document.addEventListener("keydown",(t=>{if(Y.modal.open||Y.popup.is_open||!_c.current_dir)return;const i=t.key;if((t[X.modKey]||"n"===i)&&!["INPUT","SELECT","TEXTAREA"].includes(t.target.nodeName)&&e.includes(i)&&(t.preventDefault(),!t.repeat)){if("v"===i)return this.paste_items();if("a"===i)return ye.all(!0);if(this.count)return"n"===i?1===this.count&&this.select_action("rename"):"Backspace"===i?this.select_action("delete"):"d"===i?this.select_action("duplicate"):"c"===i?this.select_action("copy_items"):"i"===i?1===this.count&&this.select_action("modal"):void 0}}))}static init(){if(!this.config.enabled)return;if(this.buttons=this.config.buttons?this.config.buttons.filter((e=>{if(this.actions[e])return _c[`allow_${e}`]||!_c.hasOwnProperty(`allow_${e}`)})):[],!this.buttons.length)return this.config.enabled=!1;K.files_container.classList.add("select-enabled"),this.buttons_contextmenu=this.buttons.filter((e=>!["rename","unzip"].includes(e))),this.config.mode_button&&(K.topbar_top.insertAdjacentHTML("beforeend",``),L(K.topbar_top.lastElementChild,(e=>{this.set_mode(!this.mode),T.set("files:select:mode",this.mode?"on":"off")}))),this.el.selectbar=_query(".topbar-select"),this.el.selectbar.classList.add("select-display-"+this.config.display),this.el.selectbar.innerHTML=`${E(this.buttons,(e=>``))}
`,this.el.select_all_button=this.el.selectbar.firstElementChild,this.el.counter=this.el.selectbar.querySelector(".selected-count"),this.el.buttons=Array.from(this.el.selectbar.lastElementChild.children),u(this.el.selectbar,((e,t)=>this.select_action(e)));let e=!!this.config.mode_button&&T.get("files:select:mode");this.set_mode("on"===e||!e&&this.config.mode),this.keyboard_events()}}ye.init();class xe{static users;static usernames;static username;static is_install=_c.allow_settings&&"install.php"===_c.script;static options=e("settings_editor",{show_button:!0,allow_default:!0,allow_users:!0,allow_new:!0,allow_remove:!0,allow_rename:!0,select_current_user_append:" ←",reload:!0,reload_confirm:!1,template:" '',\n //'start_path' => '',\n 'password' => '$PASSWORD',\n //'allow_all' => false,\n //'allow_settings' => false, // only enable for trusted users! https://www.files.gallery/docs/security/#allow_settings-enabled\n //'files_include' => '',\n //'files_exclude' => '',\n //'dirs_include' => '',\n //'dirs_exclude' => '',\n //'upload_allowed_file_types' => '',\n];"});el={};is_new_user;is_default_user;is_current_user;cm;is_loading;reload=!1;constructor(){if(["default","users"].every((e=>!xe.options[`allow_${e}`])))return F.toggle(!1,"Can't have both [default] and [users] disabled");U.load_plugin("codemirror"),this.modal()}modal(){Ae.confirm.fire({title:ie.get("settings"),cancelButtonText:ie.get("cancel"),confirmButtonText:ie.get("save"),returnFocus:!1,customClass:{popup:"settings-popup",htmlContainer:"settings-html-container",confirmButton:"button",cancelButton:"button button-secondary",validationMessage:"settings-validation"},allowEscapeKey:()=>{if(!this.cm.hasFocus())return!0;this.toggle_fullscreen()},didOpen:()=>this.open(),preConfirm:()=>this.preconfirm(),didDestroy:()=>{this.reload&&this.reload_confirm()&&location.reload()}})}open(){if(this.el.popup=Swal.getPopup(),this.el.container=Swal.getHtmlContainer(),this.el.save=Swal.getConfirmButton(),this.el.cancel=Swal.getCancelButton(),this.el.popup.focus(),xe.users)return U.load_plugin("codemirror",(()=>this.interface()));this.load({load:!0},(e=>{!xe.options.allow_default&&e.hasOwnProperty("default")&&delete e.default,xe.options.allow_users||Object.keys(e).forEach((t=>{"default"!==t&&delete e[t]})),xe.users=e,xe.usernames=Object.keys(e).sort(((e,t)=>"default"===t?1:e.localeCompare(t,void 0,{sensitivity:"base"}))),xe.username=[T.get("files:settings:username"),_c.username,xe.usernames[0]].find((t=>t&&e[t])),U.load_plugin("codemirror",(()=>this.interface()))}))}load(e,t,i){return!e.load&&_c.demo_mode?F.demo():e.load||ne||xe.is_install?(this.loader(!0),void fetch(`${_c.script}?action=settings`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(e)}).then((e=>(this.loader(!1),e.ok?e.json():{error:`${e.status} ${e.statusText}`}))).then((e=>{if(e.success&&i&&(F.toggle(!0,i),this.cm.hasFocus()||this.el.popup.focus()),e.error)return this.invalid(e.error);t&&t(e)})).catch((e=>{this.loader(!1),this.invalid(`${ie.get("error")}`)}))):F.license()}loader(e){this.is_loading=!!e,this.el.select&&Q(1).then((()=>["save","cancel","select","new","username","remove","cancel_new"].forEach((t=>this.el[t].toggleAttribute("disabled",!!e))))),this.cm&&this.cm.setOption("readOnly",!!e),this.el.popup.classList.toggle("settings-loading",!!e)}interface(){this.el.container.innerHTML=`\n \n \n \n
\n \n \n \n \n
\n \n ${xe.is_install?`${U.get_svg_icon("alert_circle_outline")}Install Mode
Remember to rename the file back to index.php once you have edited settings and/or created users.
`:""}`,this.el.users=this.el.container.children[0],this.el.select=this.el.users.firstElementChild,this.el.new=this.el.users.lastElementChild,this.el.user=this.el.container.children[1],this.el.username=this.el.user.firstElementChild,this.el.remove=this.el.user.children[1],this.el.cancel_new=this.el.user.children[2],this.el.options=this.el.container.children[2],this.el.alert_install=!!xe.is_install&&this.el.container.children[3],this.el.container.style.setProperty("--button-min-width",Math.max(...["new","remove","cancel_new"].map((e=>this.el[e].clientWidth)))+"px"),this.el.select.addEventListener("change",(e=>this.assign_user(e.currentTarget.value))),this.el.new.addEventListener("click",(e=>this.assign_user(!1))),this.el.remove.addEventListener("click",(e=>this.remove_user())),this.el.cancel_new.addEventListener("click",(e=>this.assign_user(this.el.select.value))),this.el.alert_install&&this.el.alert_install.addEventListener("click",(e=>this.el.alert_install.remove())),this.el.popup.addEventListener("keydown",(e=>{e[X.modKey]&&"s"===e.key&&(e.preventDefault(),e.repeat||this.preconfirm())})),this.codemirror(),this.el.options.insertAdjacentHTML("beforeend",``),this.el.options.lastElementChild.addEventListener("click",(()=>this.toggle_fullscreen())),this.assign_user(xe.username)}select_option(e,t){return``}codemirror(){this.cm=CodeMirror(this.el.options,{lineNumbers:!0,mode:"php",viewportMargin:1/0,theme:"one-"+U.get_codemirror_theme(),styleActiveLine:!0,extraKeys:{F11:()=>this.toggle_fullscreen()}}),CodeMirror.autoLoadMode(this.cm,"php")}toggle_fullscreen(){this.el.popup.classList.toggle("settings-fullscreen")}assign_user(e=!1){e&&this.el.select.value!==e&&(this.el.select.value=e),xe.username=e,e&&T.set("files:settings:username",e),this.is_new_user=!e,this.is_default_user="default"===e,this.is_current_user=_c.username&&e===_c.username;let t=this.el.container.classList;t.toggle("user-new",this.is_new_user),t.toggle("user-default",this.is_default_user),t.toggle("user-user",!this.is_new_user&&!this.is_default_user),this.el.username.value=this.is_new_user?ie.get("username"):e,xe.options.allow_rename||(this.el.username.readOnly=!this.is_new_user),this.is_new_user&&this.el.user.firstElementChild.select();let i=this.is_new_user?xe.options.template.replace("$PASSWORD",this.random_password()):xe.users[e];this.cm.setValue(i)}remove_user(){xe.options.allow_remove&&xe.username&&"default"!==xe.username.toLowerCase()&&confirm(`${ie.get("delete",!0)} ${xe.username}?`)&&this.load({username:xe.username,remove:!0},(()=>{let e=xe.usernames.indexOf(xe.username);e<1||(delete xe.users[xe.username],xe.usernames.splice(e,1),this.el.select.children[e].remove(),this.check_reload(),this.assign_user(xe.usernames[e-1]))}),`${ie.get("delete")} ${xe.username}`)}preconfirm(e){if(this.is_loading)return!1;if(this.username_new=this.el.username.value.trim(),this.is_renamed=xe.username!==this.username_new,!this.username_new)return this.invalid_username(`${ie.get("invalid")} ${ie.get("username")}`);if(this.is_renamed){if(this.username_new.length>128)return this.invalid_username(`${ie.get("username")} max length 128 chars`);if(xe.usernames.find((e=>this.username_new.toLowerCase()===e.toLowerCase())))return this.invalid_username(`${ie.get("username")} "${this.username_new}" already exists`);const e=this.username_new.match(/[<>{}:"'/\\|?*#+%&]|\.\.|\.$|^\./g);if(e)return this.invalid_username(`${ie.get("invalid")} ${ie.get("username")} ${[...new Set(e)].join("")}`)}return this.data=this.cm.getValue(),this.is_renamed||xe.users[xe.username]!==this.data?this.data.trim().startsWith("this.update(e.data)),`${ie.get("save")} ${this.username_new}`),!1):this.invalid(`${ie.get("invalid")} ${ie.get("password")}`):this.invalid(`${ie.get("invalid")} ${ie.get("settings")}`):(w(this.el.popup,"settings-loading",!1,300),!1)}invalid_username(e){return this.el.username.select(),this.invalid(e)}invalid(e){return["pointerup","keydown"].forEach((e=>this.el.popup.addEventListener(e,(()=>Swal.resetValidationMessage()),{once:!0}))),Swal.showValidationMessage(Ae.invalid_response(e))}ensure_commas(){let e=this.data.split("\n");if(!e)return;let t=0;e.forEach(((i,a)=>{!i||i.indexOf("=>")<0||!i.trim().match(/^("|')/)||i.trim().endsWith(",")||(t++,e[a]+=",")})),t&&(this.data=e.join("\n"),this.cm.setValue(this.data))}check_reload(e){if(xe.options.reload&&(this.is_default_user||this.is_current_user))return"close"===xe.options.reload?this.reload=!0:void(this.reload_confirm()&&location.replace(`${location.pathname}${location.search}${location.search.match(/(^\?|&)settings=(1|true)/)?"":location.search?"&settings=1":"?settings=1"}${e?"&login=1":""}${location.hash}`))}reload_confirm(){let e=xe.options.reload_confirm;return!e||("string"!=typeof e&&(e="Refresh required. Reload page now?"),confirm(e))}update(e){if(this.check_reload(),e!==this.data){let t=this.cm.getCursor();this.cm.setValue(e),Q(1).then((()=>this.cm.setCursor(t)))}if(xe.users[this.username_new]=e,this.is_new_user)xe.usernames.push(this.username_new),this.el.select.insertAdjacentHTML("beforeend",this.select_option(this.username_new,!0));else{if(!this.is_renamed)return;let e=xe.usernames.indexOf(xe.username);xe.usernames[e]=this.username_new,delete xe.users[xe.username],this.el.select.children[e].outerHTML=this.select_option(this.username_new,!0)}this.assign_user(this.username_new)}random_password(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@-#$";return Array.from(crypto.getRandomValues(new Uint32Array(16))).map((t=>e[t%68])).join("")}}const Ae=(()=>{T.remove("swal-initiation");const e=Swal.mixin({scrollbarPadding:!1,showCloseButton:!1,closeButtonHtml:U.get_svg_icon("close_thin"),buttonsStyling:!1,reverseButtons:!X.ua||-1===X.ua.indexOf("Win"),showCancelButton:!0,cancelButtonText:ie.get("cancel"),customClass:{confirmButton:"button",cancelButton:"button button-secondary",input:"input",closeButton:"button-icon"},willOpen:()=>R(),heightAuto:!1});return{default:e.mixin(),prompt:e.mixin({input:"text",inputAttributes:{maxlength:127,autocapitalize:"off",autocorrect:"off",autocomplete:"off",spellcheck:"false"},didOpen:()=>{if(!X.is_pointer)return;let e=Swal.getInput();if(!e||!e.value||e!==document.activeElement)return;let t=e.value.lastIndexOf(".");if(t<1)return e.select();e.setSelectionRange(0,t)}}),confirm:e.mixin({title:"Confirm?"}),invalid_response:e=>`${U.get_svg_icon("alert_circle_outline")}${e}`}})();(()=>{var e=document.body;function t(t){e.dataset.updated=t,e.style.cursor="pointer";var i=H(e,"click",(function(){e.classList.remove("updated"),e.removeAttribute("data-updated"),e.style.removeProperty("cursor"),i.remove()}))}_c.allow_check_updates&&(T.get("files:updated")?(T.remove("files:updated"),t("✓ Successfully updated to Files Gallery version "+_c.version),e.classList.add("updated")):O({json_response:!0,params:"action=check_updates",url:_c.script+"?action=check_updates",complete:function(i,a,n){if(i&&a&&n&&i.hasOwnProperty("success")){var o=i.success;if(j(o?"New version "+o+" available.":"Already using latest version "+_c.version),o){_id("change-sort").insertAdjacentHTML("afterend",'");var s=_id("files-notifications");if(U.dropdown(s,s.firstChild),!i.writeable)return;L(s.children[1].children[1],(()=>{Ae.confirm.fire({title:ie.get("update"),text:"Update to Files Gallery "+o+"?",cancelButtonText:ie.get("cancel"),confirmButtonText:ie.get("update")}).then((i=>{i.isConfirmed&&(e.classList.add("updating"),O({params:"version="+o,url:_c.script+"?action=do_update",json_response:!0,complete:function(i,a,n){e.classList.add("updated"),e.classList.remove("updating"),i&&a&&n&&i.hasOwnProperty("success")&&i.success?(T.set("files:updated",!0),e.dataset.updated="✓ Success!",F.toggle(!0,`Updated to ${o}. Please refresh browser.`)):t("✗ Failed to load update :(")}}))}))}))}}else j("Failed to load external JSON check_updates.")}}))})(),window.onpopstate=function(e){_c.config.history&&e.state&&e.state.hasOwnProperty("path")&&U.get_files(e.state.path)},(()=>{U.get_codemirror_theme=()=>"dark"===ee.theme?"dark":(te.codemirror_theme||(te.codemirror_theme=T.get("files:codemirror_theme")||"light"),te.codemirror_theme);const t=e("markdown",{enabled:!0,extensions:["md","markdown","mdown","mkdn","mkd","mdwn","mkdown","ron"],modes:matchMedia("(min-width: 576px)").matches?["split","edit","preview"]:["edit","preview","split"],remember_mode:!0,scroll_sync:!0,html:e=>e,link_target:"_blank",shortcuts:{B:["**","**"],I:["_","_"],K:["[","](https://)"],"Alt-I":["![","]()"]}}),i=t.enabled&&t.extensions.length>1&&["split","preview"].some((e=>t.modes.includes(e)));let a=(()=>{if(!i||!t.remember_mode)return t.modes[0];let e=T.get("files:markdown:mode");return e&&t.modes.includes(e)?e:t.modes[0]})();const s=()=>{if(!te.codemirror||!te.marked)return!1;let e=a,i=t.modes.indexOf(a);return a=t.modes[i>=t.modes.length-1?0:i+1],t.remember_mode&&T.set_option("files:markdown:mode",a,t.modes[0]),"edit"===e&&d(),ae.popup.classList.replace(`markdown-mode-${e}`,`markdown-mode-${a}`),"preview"!==a&&te.codemirror.refresh(),!0},l=X.is_mac?"Cmd":"Ctrl",r={};i&&Object.keys(t.shortcuts).forEach((e=>{r[`${l}-${e}`]=i=>((e,[t,i])=>{let a=e.getSelection(),n=a.slice(0,t.length)===t&&a.slice(-i.length)===i;e.replaceSelection(n?a.slice(t.length,-i.length):`${t}${a}${i}`,"around")})(i,t.shortcuts[e])}));const d=()=>{"edit"!==a&&(ae.markdown_preview.innerHTML=t.html(te.marked.parse(te.codemirror.getValue())))},h=()=>{te.codemirror.addKeyMap(r),ae.preview.insertAdjacentHTML("beforeend",''),ae.markdown_preview=ae.preview.lastElementChild,t.link_target&&ae.markdown_preview.addEventListener("click",(e=>{let i=e.target.closest("a");i&&!i.hasAttribute("target")&&i.setAttribute("target",t.link_target)})),te.marked=new marked.Marked(e("marked")),_c.current_dir.url_path&&te.marked.use(markedBaseUrl.baseUrl(`${_c.current_dir.url_path}/`)),d(),t.modes.includes("split")&&te.codemirror.on("change",(()=>d())),(()=>{if(!t.scroll_sync||!t.modes.includes("split"))return;let e,i=!1;te.codemirror.on("scroll",(t=>{if("split"!==a)return;if(e)return e=!1;i=!0;let n=t.getScrollInfo(),o=n.height-n.clientHeight,s=parseFloat(n.top)/o,l=(ae.markdown_preview.scrollHeight-ae.markdown_preview.clientHeight)*s;ae.markdown_preview.scrollTop=l})),ae.markdown_preview.addEventListener("scroll",(t=>{if("split"!==a)return;if(i)return i=!1;e=!0;let n=te.codemirror.getScrollInfo(),o=ae.markdown_preview.scrollHeight-ae.markdown_preview.clientHeight,s=parseFloat(ae.markdown_preview.scrollTop)/o,l=(n.height-n.clientHeight)*s;te.codemirror.scrollTo(0,l)}))})()};let g,x=0,w=0;function k(){ae.preview.dataset.counter=te.index+1+"/"+Y.list.matchingItems.length}function H(){if(!te.codemirror||te.codemirror_saving||!ae.code_save_button||ae.code_save_button.disabled)return;if(_c.demo_mode)return F.demo();if(!ne)return F.license();if(!te.item.is_writeable)return F.toggle(!1,`${ie.get("file",!0)} ${ie.get("is not writeable")}`);te.codemirror_saving=!0,ae.code_save_button.disabled=!0;const e=te.item;new me({action:"text_edit",action_name:"save",items:[te.item],text:te.codemirror.getValue(),parent_path:_c.current_path,parent_dir:_c.current_dir,complete:t=>{e===te.item&&(te.codemirror_saving=!1,ae.code_save_button.disabled=!1)}})}function M(e,t){_c.config.history&&history[e+"State"](null,te.item.basename,"#"+encodeURIComponent(te.item.basename))}function $(e){anime({targets:ae.preview.querySelector("svg").children,scale:[.9,1],opacity:[0,1],duration:120,easing:"easeOutQuad",delay:anime.stagger(30,{start:e,direction:"reverse"})})}const V=e=>{let t=Y.list.matchingItems.length,i=te.index+e;return i<0?t-1:i>=t?0:i},z=U.modal_nav=(e,t=!1)=>{if(Y.list.matchingItems.length<2)return;let i=V(e),a=Y.list.matchingItems[i]._values;if(!t||a.embed||["audio","video"].includes(a.mime0)){if(te.index=i,k(),x&&clearTimeout(w),w=setTimeout((()=>x=0),500),le.destroy(),x)return oe(a);x=1,oe(a),["file","dir"].includes(te.type)&&$(0)}};function j(){te.codemirror_xhr&&(te.codemirror_xhr.abort(),te.codemirror_xhr=!1)}function I(){return location.hash==="#"+encodeURIComponent(te.item.basename)}function B(e){document.documentElement.classList.toggle("modal-open",!!e),ae.modal.classList.toggle("modal-show",!!e)}function Z(){te.is_fullscreen=!te.is_fullscreen,ae.popup.classList.toggle("modal-popup-fullscreen"),te.codemirror&&te.codemirror.refresh()}var N,q=["start-start","center-start","end-start","start-center","center-center","end-center","start-end","center-end","end-end"],W=(N=T.get("files:modal:position"))&&q.includes(N)?N:"center-center";function G(e,t){var i=(e||W).split("-"),a=["x","y"].map(((e,t)=>`modal-pos-${e}-${i[t]}`));return t?ae.popup.classList[t](...a):a.join(" ")}const K=e("modal_types",{dir:{anchor:!0,info:!0},file:{info:!0},code:{},image:{anchor:!0,info:!0},video:{},audio:{},embed:{spinner:!0},pdf:{},document:{spinner:!0},"custom-preview":{info:!0},"video-thumb":{info:!0},"pdf-thumb":{anchor:!0,info:!0}}),te=Y.modal={codemirror_lineWrapping:T.get_option("files:codemirror_lineWrapping",!0)};document.body.insertAdjacentHTML("beforeend",`\n\t\n\t\t\n\t
`);const ae=te.el={modal:document.body.lastElementChild};function oe(e){j(),re(e),M("replace")}function se(e){if(!e.is_dir&&e.is_readable){if(e.browser_image)return te.type="image",`
`;if(e.is_browser_video||e.url&&"m3u8"===e.ext)return te.type="video",le.tag(e,"video");if("video"===e.mime0){if(!_c.ffmpeg||!e.is_readable)return;return te.type="video-thumb",`
`}if(J("audio",e))return te.type="audio",le.tag(e,"audio");if(e.embed)return te.type="embed",``;if(e.ext.match(_c.config.google_docs_extensions||/(doc|ppt|pages)x?$/)){if(!_c.use_google_docs_viewer||e.filesize>25e6)return;return te.type="document",``}if("pdf"===e.mime1){if(!_c.config.load_inline_pdf||!X.supports_inline_pdf&&!navigator.pdfViewerEnabled&&!_c.use_google_docs_viewer)return(()=>{if(_c.imagemagick_pdf)return te.type="pdf-thumb",`
`})();te.type="pdf";let t=c(e),i=t+(_c.config.inline_pdf_append_url||"");const a=e=>``;return!X.supports_inline_pdf&&_c.use_google_docs_viewer?a(`https://docs.google.com/viewer?url=${new URL(t,location)}&embedded=true`):a(i)}if(!e.hasOwnProperty("code_mode")){let a=function(e){if(!e||e.filesize>_c.config.code_max_load)return;if(["conf","htaccess"].includes(e.ext))return CodeMirror.findModeByName("nginx");if("csv"===e.ext)return{mode:"q"};if(i&&t.extensions.includes(e.ext))return e.is_markdown=!0,{mode:"gfm"};if("text/asp"===e.mime)return{mode:"htmlmixed"};let a=!!e.mime&&CodeMirror.findModeByMIME(e.mime);return a&&"null"!==a.mode||!e.ext||(a=CodeMirror.findModeByExtension(e.ext)||a),a||"text"!==e.mime0?a:{mode:"null"}}(e);e.code_mode=a&&a.mode||!1}return e.code_mode?(te.type="code",U.load_plugin("codemirror"),e.is_markdown&&U.load_plugin("marked"),''):void 0}}function re(i,s){ae.modal.scrollTop=0,ae.code_save_button&&ae.code_save_button.disabled&&(ae.code_save_button.disabled=!1),Object.assign(te,{item:i,codemirror:!1,codemirror_xhr:!1,codemirror_saving:!1,type:i.is_dir?"dir":"file",loaded:!1,marked:!1}),ae.title.innerText=ae.title.title=i.display_name||i.basename||"";let r=se(i)||(()=>{if(i.custom_preview)return te.type="custom-preview",`
`})()||U.get_svg_large(i,"modal-svg")+D(i);s&&K[te.type].fullscreen&&(te.is_fullscreen=!0),i.is_markdown&&!t.remember_mode&&(a=t.modes[0]),P(ae.popup,`modal-popup modal-popup-${te.type} modal-${te.has_nav?"multi":"single"} ${G()} modal-codemirror-theme-${U.get_codemirror_theme()}${te.is_idle?" modal-popup-idle":""}${te.is_fullscreen?" modal-popup-fullscreen":""}${i.is_markdown?` markdown-mode-${a}`:""}`),X.is_pointer&&te.has_nav&&(ae.ArrowLeft.title=Y.list.matchingItems[V(-1)]._values.basename,ae.ArrowRight.title=Y.list.matchingItems[V(1)]._values.basename),ae.popup.style.setProperty("--type-color",`var(--${i.is_dir?"svg-folder-fg":`type-${U.get_icon(i)||"default"}`})`),(()=>{let e=getComputedStyle(ae.popup).getPropertyValue("--type-color");if(!e||-1===e.indexOf("hsl("))return;let t=e.match(/\d+(\.\d+)?/g);!t||t.length<1||ae.popup.style.setProperty("--type-hsl",`${t[0]} ${t[1]}% ${t[2]}%`)})(),P(ae.preview,`modal-preview modal-preview-${te.type}${K[te.type].spinner?" modal-preview-spinner":""}`),ae.preview.innerHTML=K[te.type].anchor?`${r}`:r,["audio","video","embed"].includes(te.type)&&le.create(te.type,ae.preview.firstElementChild,i),fe.modal_picture(i,ae.preview),"document"===te.type&&function(){let e=ae.preview.firstElementChild,t=e.src,i=setInterval((()=>{if(te.loaded||t!==e.src||!e.isConnected||!e.contentDocument)return clearInterval(i);e.src=t}),3e3)}();let c=ae.preview.querySelector("img, iframe");c&&c.addEventListener("load",(e=>{te.loaded=!0,"image"===te.type&&e.target.parentElement.classList.remove("files-img-placeholder"),K[te.type].spinner&&ae.preview.classList.remove("modal-preview-spinner")})),i.code_mode&&(te.codemirror_xhr=O({params:`file=${encodeURIComponent(i.path)}`,url:`${_c.script}?action=load_text_file`,always:()=>{te.open&&i===te.item&&(te.codemirror_xhr=!1)},fail:e=>{e.status&&te.open&&i===te.item&&(F.toggle(!1,(e.status?e.status+" - ":"")+(e.statusText||i.basename)),ae.preview.firstElementChild.remove())},complete:t=>{te.open&&i===te.item&&U.load_plugin("codemirror",(()=>{te.open&&i===te.item&&(ae.preview.firstElementChild.remove(),te.codemirror=CodeMirror(ae.preview,e("codemirror",{value:t,lineWrapping:te.codemirror_lineWrapping,lineNumbers:!0,readOnly:!_c.allow_text_edit,mode:i.code_mode,viewportMargin:i.filesize<2e4?1/0:10,theme:`one-${U.get_codemirror_theme()}`,addModeClass:"css"===i.code_mode,styleActiveLine:!0,extraKeys:Object.assign({F11:Z},_c.allow_text_edit?{[`${l}-S`]:H}:{})})),CodeMirror.autoLoadMode(te.codemirror,i.code_mode),i.is_markdown&&U.load_plugin("marked",(()=>h())))}))}})),ae.info.innerHTML=K[te.type].info?`\n\t\t\t\t\t\t\n\t\t\t\t${i.mime?''+U.get_svg_icon_files(i)+o(i.mime,"modal-info-mime-text")+"":""}${_(i.dimensions,"modal-info-dimensions")}${f(i,"modal-info-filesize")}${function(e,t){var i=e.is_readable&&e.is_writeable;return e.fileperms?''+U.get_svg_icon(i?"lock_open_outline":"lock_outline")+e.fileperms+"":""}(i,"modal-info-permissions")}\n\t\t\t
\n\t\t\t${U.get_svg_icon("date")}${U.get_time(i,"llll","LLLL",!0)}
\n\t\t\t${y(i.image,"modal-info-exif")}\n\t\t\t${b(i.image,"modal-info",!0)}\n\t\t`:""}function ce(){te.idle_timeout&&clearTimeout(te.idle_timeout),te.idle_timeout=setTimeout((()=>pe(!0)),1e3),te.is_idle&&pe(!1)}function pe(e){te.is_idle=e,ae.popup.classList.toggle("modal-popup-idle",e)}function de(e){e&&e.target!==e.currentTarget||(ae.popup.removeEventListener("transitionend",de),te.open||(le.destroy(),ae.modal.style.display="none",m(ae.preview)))}function ue(){te.open&&!I()&&U.close_modal(!1)}function he(){return!te.open||Swal.isVisible()||!I()}function _e(e){return!(!te.has_nav||!["ArrowLeft","ArrowRight"].includes(e))&&(!document.activeElement||document.activeElement===document.body||!["AUDIO","VIDEO","TEXTAREA"].includes(document.activeElement.nodeName)&&!document.activeElement.closest(".plyr"))}function ge(e){if(!e.repeat&&!he())if(document.activeElement&&[ae.ArrowLeft,ae.ArrowRight].includes(document.activeElement)&&document.activeElement.blur(),"p"===e.key&&te.item.is_markdown&&(e.ctrlKey||e.metaKey)){if(s())return e.preventDefault()}else if("Escape"===e.key){if(te.is_fullscreen)return Z();if(te.codemirror&&te.codemirror.hasFocus())return Z();U.close_modal()}else"Enter"!==e.key||ae.popup.contains(document.activeElement)?_e(e.key)&&(ae[e.key].classList.add("modal-nav-active"),z("ArrowLeft"===e.key?-1:1)):U.close_modal()}function ve(e){!he()&&_e(e.key)&&ae[e.key].classList.remove("modal-nav-active")}function be(e){he()||ae.popup.contains(e.target)||Array.from(ae.header.children).find((e=>"BUTTON"==e.nodeName&&e.offsetParent)).focus()}function ye(e){e.target.dataset.action||(matchMedia("(max-width: 575.98px)").matches||te.is_fullscreen||ae.popup.classList.contains("modal-popup-tapped"))&&ae.popup.classList.toggle("modal-popup-tapped")}function xe(e){let t=(e?"add":"remove")+"EventListener";window[t]("popstate",ue),document[t]("keydown",ge),document[t]("keyup",ve),document.body[t]("focus",be,{capture:!0}),X.is_touch&&ae.popup[t]("touchend",ye),function(e){X.is_pointer&&te.has_nav&&(e&&ce(),ae.modal[(e?"add":"remove")+"EventListener"]("mousemove",ce))}(e)}ae.popup=ae.modal.firstElementChild,ae.header=ae.popup.firstElementChild,ae.ArrowLeft=ae.popup.children[1],ae.ArrowRight=ae.popup.children[2],ae.title=ae.header.firstElementChild,ae.code_save_button=!!_c.allow_text_edit&&_query('[data-action="save"]',ae.header),ae.code_wrap_button=_class("modal-code-wrap-button",ae.header)[0],ae.close=ae.header.lastElementChild,ae.info=ae.popup.children[3],ae.preview=ae.popup.children[4],ae.pos_active=_class("modal-pos-active",ae.header)[0],(screen.availWidth>=768||screen.availHeight>=768)&&["start","end"].forEach((e=>ae.popup.addEventListener(`transition${e}`,(t=>{t.target===ae.popup&&"width"===t.propertyName&&"code"===te.type&&ae.popup.classList.toggle("modal-popup-code-transition","start"===e)})))),X.is_touch&&L(ae.preview,(e=>{if("mouse"!==e.pointerType){var t=e.target.closest(".modal-preview-a");t&&!t.dataset.action&&e.preventDefault()}})),["down","up"].forEach((e=>ae.modal.addEventListener("mouse"+e,(t=>te["bg"+e]=t.target===ae.modal)))),u(ae.modal,((e,t)=>{if(!te.open)return t.preventDefault();if("nav-left"===e)z(-1);else if("nav-right"===e)z(1);else if("context"===e)U.create_contextmenu(t,"modal",t.target,te.item);else if("close-bg"===e)te.bgdown&&te.bgup&&U.close_modal();else if("close"===e)U.close_modal();else if("zoom"===e){if(Y.contextmenu.is_open)return t.preventDefault();if(C(t,t.target.closest(".modal-preview-a")))return;U.open_popup(te.item)}else if("copy"===e){if(!te.codemirror)return;let e=!!te.codemirror&&te.codemirror.getValue(),t=e&&A(e);F.toggle(t,ie.get("copy text"))}else if("fullscreen"===e)Z();else if("save"===e)H();else if("markdown-toggle-mode"===e)s();else if("wrap"===e){if(!te.codemirror)return;te.codemirror_lineWrapping=!te.codemirror_lineWrapping,te.codemirror.setOption("lineWrapping",te.codemirror_lineWrapping),ae.code_wrap_button.classList.toggle("wrap-enabled",te.codemirror_lineWrapping),T.set_option("files:codemirror_lineWrapping",te.codemirror_lineWrapping,!0)}else if("toggle-codemirror-theme"===e){let e=te.codemirror_theme;te.codemirror_theme="light"===e?"dark":"light",ae.popup.classList.replace(`modal-codemirror-theme-${e}`,`modal-codemirror-theme-${te.codemirror_theme}`);let t=!(!te.codemirror||!te.codemirror.display)&&te.codemirror.display.wrapper;t&&t.classList.replace(`cm-s-one-${e}`,`cm-s-one-${te.codemirror_theme}`),T.set("files:codemirror_theme",te.codemirror_theme)}else t.target.classList.contains("modal-pos-el")&&(i=e,a=t.target,i!==W&&(G(W,"remove"),G(i,"add"),W=i,ae.pos_active.classList.remove("modal-pos-active"),ae.pos_active=a,ae.pos_active.classList.add("modal-pos-active"),T.set("files:modal:position",i)));var i,a})),U.open_modal=(e,t)=>{if(te.open)return!(te.item===e||!Y.list)&&z(Y.list.matchingItems.findIndex((t=>t._values===e))-te.index);te.is_fullscreen=!1,te.is_idle=!1,te.open=!0,g=document.activeElement||null,ae.modal.removeEventListener("transitionend",de),R(),te.index=_c.files[e.basename]===e&&Y.list?Y.list.matchingItems.findIndex((t=>t._values===e)):-1,te.has_nav=te.index>-1&&Y.list&&Y.list.matchingItems.length>1,te.has_nav&&k(),xe(!0),re(e,!0),t&&M("push"),ae.modal.style.removeProperty("display"),document.activeElement&&ae.popup.addEventListener("transitionend",(()=>document.activeElement.blur()),{once:!0}),Q(1).then((()=>{["file","dir"].includes(te.type)&&$(0),B(!0)}))},U.close_modal=(e=!0)=>{if(te.open&&(te.open=!1,le.pause(),j(),xe(!1),ae.modal.addEventListener("transitionend",de),B(),g&&g.isConnected&&g.focus(),_c.config.history&&e))return history.state?history.replaceState({path:_c.current_path},_c.current_dir.basename||"/",location.pathname+location.search):history.back()}})();var we=function(e,t){var i,a,n,o,s,l,r,p,d,m,u,_,f,g,v,b,y,x=this,A=!1,w=!0,C={timeToIdle:3e3,timeToIdleOutside:1e3,loadingIndicatorDelay:1e3,addCaptionHTMLFn:function(e,i){return e.title?i.firstElementChild.innerHTML=e.title:t.resetEl(i.firstElementChild)},closeEl:!0,captionEl:!0,fullscreenEl:X.fullscreen,zoomEl:!0,downloadEl:!1,mapEl:!0,playEl:!0,panoRotateEl:!0,counterEl:!0,arrowEl:!0,preloaderEl:!0,closeOnOutsideClick:!0,tapToClose:!1,clickToCloseNonZoomable:!1,clickToShowNextNonZoomable:!1,indexIndicatorSep:'',fitControlsWidth:1200},L=function(e){if(v)return!0;e=e||window.event,g.timeToIdle&&g.mouseUsed&&!p&&V();for(var t,i,a=e.target||e.srcElement,n=0;n=.95&&x.toggleControls(!0)})),d("onPinchClose",(function(e){w&&e<.9?(x.toggleControls(),n=!0):n&&!w&&e>.9&&x.toggleControls(!0)})),d("zoomGestureEnded",(function(){(n=!1)&&!w&&x.toggleControls(!0)})),d("beforeChange",x.update),g.downloadEl&&d("afterChange",(function(){var t=c(e.currItem.item);l.setAttribute("href",t||"#"),l.style.display=t?"":"none"})),g.mapEl&&d("afterChange",(function(){var t=e.currItem.item,i=!!(t&&t.image&&t.image.exif)&&t.image.exif.gps;r.style.display=i?"":"none",r.setAttribute("href",i?h(i):"#")})),d("doubleTap",(function(t){var i=e.currItem.initialZoomLevel;e.zoomTo(e.getZoomLevel()===i?g.getDoubleTapZoom(!1,e.currItem):i,t,250)})),d("preventDragEvent",(function(e,t,i){var a=e.target||e.srcElement;a&&a.getAttribute("class")&&e.type.indexOf("mouse")>-1&&(a.getAttribute("class").indexOf("__caption")>0||/(SMALL|STRONG|EM)/i.test(a.tagName))&&(i.prevent=!1,undefined())})),d("bindEvents",(function(){t.bind(i,"pswpTap click",L),t.bind(Y.popup.scrollwrap,"pswpTap",x.onGlobalTap),t.bind(document,"keydown",k)})),d("unbindEvents",(function(){b&&clearInterval(b),t.unbind(document,"mouseout",E),t.unbind(document,"mousemove",V),t.unbind(i,"pswpTap click",L),t.unbind(Y.popup.scrollwrap,"pswpTap",x.onGlobalTap),t.unbind(document,"keydown",k)})),d("destroy",(function(){g.captionEl&&a.classList.remove("pswp__caption--empty"),i.classList.add("pswp__ui--hidden"),y&&clearTimeout(y),x.setIdle(!1)})),g.showAnimationDuration||i.classList.remove("pswp__ui--hidden"),d("initialZoomIn",(function(){g.showAnimationDuration&&i.classList.remove("pswp__ui--hidden")})),d("initialZoomOut",(function(){i.classList.add("pswp__ui--hidden")})),(p=function(e){if(e)for(var t=e.length,i=0;i1&&(t.toggle_class(o,"pswp__element--disabled",0===e.getCurrentIndex()),t.toggle_class(s,"pswp__element--disabled",e.getCurrentIndex()===g.getNumItemsFn()-1))},x.onGlobalTap=function(t){var i=(t=t||window.event).target||t.srcElement;if(!v)if(t.detail&&"mouse"===t.detail.pointerType){if(!t.detail.rightClick)if(("zoom"==g.click||g.getNumItemsFn()<2||e.getZoomLevel()>e.currItem.fitRatio)&&i.classList.contains("pswp__img"))e.currItem.fitRatio<1&&e.toggleDesktopZoom(t.detail.releasePoint);else if(0===i.className.indexOf("pswp__")){var a=(g.getNumItemsFn()>2||!e.getCurrentIndex())&&("next"==g.click||t.detail.releasePoint.x>Y.popup.pswp.clientWidth/2)?"next":"prev";e[a]()}}else X.is_dual_input?X.legacy_ie||x.setIdle(!p):x.toggleControls(!w)},x.toggleControls=function(e){w=e,e&&!A&&x.update(),H(i,"ui--hidden",!e)}},Ce={bind:function(e,t,i,a){var n=(a?"remove":"add")+"EventListener";t=t.split(" ");for(var o=0;ot-1?e-t:e<0?t+e:e},ge={},ve=function(e,t){return ge[e]||(ge[e]=[]),ge[e].push(t)},be=function(e){var t=ge[e];if(t){var i=Array.prototype.slice.call(arguments);i.shift();for(var a=0;an.currItem.fitRatio?he||(Wt(n.currItem,!1,!0),he=!0):he&&(Wt(n.currItem),he=!1)),Ae(G,le.x,le.y,_))},Le=function(e){e.container&&Ae(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},ke=function(e,t){t.transform=g+e+"px, 0px, 0px)"},He=function(e,t){if(!o.loop&&t){var i=c+(de.x*ce-e)/de.x,a=Math.round(e-st.x);(i<0&&a>0||i>=St()-1&&a<0)&&(e=st.x+a*o.mainScrollEndFriction)}st.x=e,ke(e,p)},Me=function(e,t){var i=lt[e]-pe[e];return se[e]+oe[e]+i-i*(t/f)},$e=function(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)},Ve=function(e){e.x=Math.round(e.x),e.y=Math.round(e.y)},Ee=function(){z.is_mouse||(e.classList.add("pswp--has_mouse"),$+=" pswp--has_mouse",z.is_mouse=o.mouseUsed=!0),be("mouseUsed")},ze=null,je=function(){ze&&(Ce.unbind(document,"mousemove",je),Ee()),ze=setTimeout((function(){ze=null}),100)},Ie=function(e,t){var i=Pt(n.currItem,re,e);return t&&(U=i),i},Te=function(e){return(e||n.currItem).initialZoomLevel},Oe=function(e){return(e||n.currItem).w>0?o.maxSpreadZoom:1},Se=function(e,t,i,a){return a===n.currItem.initialZoomLevel?(i[e]=n.currItem.initialPosition[e],!0):(i[e]=Me(e,a),i[e]>t.min[e]?(i[e]=t.min[e],!0):i[e]=a)return Ne(e),o(i),void(s&&s());o((i-t)*n(l/a)+t),De[e].raf=H(c)}};c()},Fe={shout:be,listen:ve,viewportSize:re,options:o,isMainScrollAnimating:function(){return K},getZoomLevel:function(){return _},getCurrentIndex:function(){return c},isDragging:function(){return Z},isZooming:function(){return W},setScrollOffset:function(e,t){pe.x=e,E=pe.y=t},applyZoomPan:function(e,t,i,a){le.x=t,le.y=i,_=e,we(a)},init:function(){if(!s&&!l){var i;for(n.framework=Ce,n.template=e,$=e.className,s=!0,z=Ce.features,H=z.raf,M=z.caf,p=Y.popup.container.style,n.itemHolders=b=[{el:Y.popup.items[0],wrap:0,index:-1},{el:Y.popup.items[1],wrap:0,index:-1},{el:Y.popup.items[2],wrap:0,index:-1}],b[0].el.style.display=b[2].el.style.display="none",g="translate"+(k?"(":"3d("),h={resize:n.updateSize,orientationchange:function(){clearTimeout(j),j=setTimeout((function(){re.x!==Y.popup.scrollwrap.clientWidth&&n.updateSize()}),500)},scroll:Re,keydown:Be,click:Ze},i=0;i=St())&&(c=0),n.currItem=Ot(c),e.setAttribute("aria-hidden","false"),void 0===E&&(be("initialLayout"),E=V=Ce.getScrollY());var a="pswp--open"+(o.showHideOpacity?" pswp--animate_opacity":"")+(X.is_pointer&&("zoom"==o.click||o.getNumItemsFn()<2)?" pswp--zoom-cursor":"");for(DOMTokenList.prototype.add.apply(e.classList,a.split(" ")),n.updateSize(),d=-1,me=null,i=0;i<3;i++)ke((i+d)*de.x,b[i].el.style);Ce.bind(Y.popup.scrollwrap,u,n),ve("initialZoomInEnd",(function(){n.setContent(b[0],c-1),n.setContent(b[2],c+1),b[0].el.style.display=b[2].el.style.display="block",o.focus&&e.focus(),Ce.bind(document,"keydown",n),Ce.bind(Y.popup.scrollwrap,"click",n),z.is_mouse?Ee():X.is_pointer&&Ce.bind(document,"mousemove",je),Ce.bind(window,"resize scroll orientationchange",n),be("bindEvents")})),n.setContent(b[1],c),n.updateCurrItem(),e.classList.add("pswp--visible")}},close:function(){s&&(s=!1,l=!0,be("close"),setTimeout((function(){Ce.unbind(window,"resize scroll orientationchange",n)}),400),Ce.unbind(window,"scroll",h.scroll),Ce.unbind(document,"keydown",n),X.is_pointer&&Ce.unbind(document,"mousemove",je),Ce.unbind(Y.popup.scrollwrap,"click",n),Z&&Ce.unbind(window,m,n),clearTimeout(j),be("unbindEvents"),Bt(n.currItem,null,!0,n.destroy))},destroy:function(){be("destroy"),zt&&clearTimeout(zt),e.setAttribute("aria-hidden","true"),e.className=$,Ce.unbind(Y.popup.scrollwrap,u,n),Ce.unbind(window,"scroll",n),pt(),Qe(),ge={}},panTo:function(e,t,i){i||(e>U.min.x?e=U.min.x:eU.min.y?t=U.min.y:t=3&&(d+=me+(me>0?-3:3),i=3);for(var a=0;a0?(t=b.shift(),b[2]=t,d++,ke((d+2)*de.x,t.el.style),n.setContent(t,c-i+a+1+1)):(t=b.pop(),b.unshift(t),d--,ke(d*de.x,t.el.style),n.setContent(t,c+i-a-1-1));if(G&&1===Math.abs(me)){var o=Ot(y);o.initialZoomLevel!==_&&(Pt(o,re),Wt(o),Le(o))}me=0,n.updateCurrZoomItem(),y=c,be("afterChange")}}},updateSize:function(e){if(re.x=Y.popup.scrollwrap.clientWidth,re.y=Y.popup.scrollwrap.clientHeight,Re(),de.x=re.x+Math.round(re.x*o.spacing),de.y=re.y,He(de.x*ce),be("beforeResize"),void 0!==d){for(var t,i,a,s=0;s<3;s++)t=b[s],ke((s+d)*de.x,t.el.style),a=c+s-1,o.loop&&St()>2&&(a=fe(a)),(i=Ot(a))&&(v||i.needsUpdate||!i.bounds)?(n.cleanSlide(i),n.setContent(t,a),1===s&&(n.currItem=i,n.updateCurrZoomItem(!0)),i.needsUpdate=!1):-1===t.index&&a>=0&&n.setContent(t,a),i&&i.container&&(Pt(i,re),Wt(i),Le(i));v=!1}f=_=n.currItem.initialZoomLevel,(U=n.currItem.bounds)&&(le.x=U.center.x,le.y=U.center.y,we(!0)),be("resize")},zoomTo:function(e,t,i,a,n){t&&(f=_,lt.x=Math.abs(t.x)-le.x,lt.y=Math.abs(t.y)-le.y,$e(se,le));var o=Ie(e,!1),s={};Se("x",o,s,e),Se("y",o,s,e);var l=_,r={x:le.x,y:le.y};Ve(s);var c=function(t){1===t?(_=e,le.x=s.x,le.y=s.y):(_=(e-l)*t+l,le.x=(s.x-r.x)*t+r.x,le.y=(s.y-r.y)*t+r.y),n&&n(t),we(1===t)};i?We("customZoomTo",0,1,i,a||Ce.easing.sine.inOut,c):c(1)}},Ue={},Ge={},Ye={},Ke={},Xe={},Je=[],et={},tt=[],it={},at=0,nt={x:0,y:0},ot=0,st={x:0,y:0},lt={x:0,y:0},rt={x:0,y:0},ct=function(e,t){return it.x=Math.abs(e.x-t.x),it.y=Math.abs(e.y-t.y),Math.sqrt(it.x*it.x+it.y*it.y)},pt=function(){N&&(M(N),N=null)},dt=function(){Z&&(N=H(dt),Lt())},mt=function(e,t){return!(!e||e===document||e===Y.popup.scrollwrap)&&(t(e)?e:mt(e.parentNode,t))},ut={},ht=function(e,t){return ut.prevent=!mt(e.target,o.isClickableElement),be("preventDragEvent",e,t,ut),ut.prevent},_t=function(e,t){return t.x=e.pageX,t.y=e.pageY,t.id=e.identifier,t},ft=function(e,t,i){i.x=.5*(e.x+t.x),i.y=.5*(e.y+t.y)},gt=function(){var e=le.y-n.currItem.initialPosition.y;return 1-Math.abs(e/(re.y/2))},vt={},bt={},yt=[],xt=function(e){for(;yt.length>0;)yt.pop();return L?(ne=0,Je.forEach((function(e){0===ne?yt[0]=e:1===ne&&(yt[1]=e),ne++}))):e.type.indexOf("touch")>-1?e.touches&&e.touches.length>0&&(yt[0]=_t(e.touches[0],vt),e.touches.length>1&&(yt[1]=_t(e.touches[1],bt))):(vt.x=e.pageX,vt.y=e.pageY,vt.id="",yt[0]=vt),yt},At=function(e,t){var i,a,s,l,r=le[e]+t[e],c=t[e]>0,p=st.x+t.x,d=st.x-et.x;if(i=r>U.min[e]||rU.min[e]&&(i=o.panEndFriction,U.min[e]-r,a=U.min[e]-se[e]),(a<=0||d<0)&&St()>1?(l=p,d<0&&p>et.x&&(l=et.x)):U.min.x!==U.max.x&&(s=r)):(r0)&&St()>1?(l=p,d>0&&pn.currItem.fitRatio&&(le[e]+=t[e]*i)},wt=function(e){if("pointerdown"!==e.type||!(e.which>1||e.ctrlKey))if(Tt)e.preventDefault();else{if(ht(e,!0)&&e.preventDefault(),be("pointerDown"),L){var t=Ce.arraySearch(Je,e.pointerId,"id");t<0&&(t=Je.length),Je[t]={x:e.pageX,y:e.pageY,id:e.pointerId}}var i=xt(e),a=i.length;Q=null,Qe(),Z&&1!==a||(Z=ee=!0,Ce.bind(window,m,n),S=ae=te=B=q=P=R=D=!1,J=null,be("firstTouchStart",i),$e(se,le),oe.x=oe.y=0,$e(Ke,i[0]),$e(Xe,Ke),et.x=de.x*ce,tt=[{x:Ke.x,y:Ke.y}],T=I=ye(),Ie(_,!0),pt(),dt()),!W&&a>1&&!K&&!q&&(f=_,D=!1,W=R=!0,oe.y=oe.x=0,$e(se,le),$e(Ue,i[0]),$e(Ge,i[1]),ft(Ue,Ge,rt),lt.x=Math.abs(rt.x)-le.x,lt.y=Math.abs(rt.y)-le.y,F=ct(Ue,Ge))}},Ct=function(e){if(e.preventDefault(),L){var t=Ce.arraySearch(Je,e.pointerId,"id");if(t>-1){var i=Je[t];i.x=e.pageX,i.y=e.pageY}}if(Z){var a=xt(e);if(J||P||W)Q=a;else if(st.x!==de.x*ce)J="h";else{var n=Math.abs(a[0].x-Ke.x)-Math.abs(a[0].y-Ke.y);Math.abs(n)>=10&&(J=n>0?"h":"v",Q=a)}}},Lt=function(){if(Q){var e=Q.length;if(0!==e)if($e(Ue,Q[0]),Ye.x=Ue.x-Ke.x,Ye.y=Ue.y-Ke.y,W&&e>1){if(Ke.x=Ue.x,Ke.y=Ue.y,!Ye.x&&!Ye.y&&function(e,t){return e.x===t.x&&e.y===t.y}(Q[1],Ge))return;$e(Ge,Q[1]),D||(D=!0);var t=ct(Ue,Ge),i=Vt(t);i>n.currItem.initialZoomLevel+n.currItem.initialZoomLevel/15&&(ae=!0);var a=1,s=Te(),l=Oe();if(i1&&(a=1),i=s-a*(s/3);else i>l&&((a=(i-l)/(6*s))>1&&(a=1),i=l+a*s);a<0&&(a=0),ft(Ue,Ge,nt),oe.x+=nt.x-rt.x,oe.y+=nt.y-rt.y,$e(rt,nt),le.x=Me("x",i),le.y=Me("y",i),S=i>_,_=i,we()}else{if(!J)return;if(ee&&(ee=!1,Math.abs(Ye.x)>=10&&(Ye.x-=Q[0].x-Xe.x),Math.abs(Ye.y)>=10&&(Ye.y-=Q[0].y-Xe.y)),Ke.x=Ue.x,Ke.y=Ue.y,0===Ye.x&&0===Ye.y)return;if("v"===J&&o.closeOnVerticalDrag&&_===n.currItem.initialZoomLevel){oe.y+=Ye.y,le.y+=Ye.y;var c=gt();return B=!0,be("onVerticalDrag",c),xe(c),void we()}!function(e,t,i){if(e-T>50){var a=tt.length>2?tt.shift():{};a.x=t,a.y=i,tt.push(a),T=e}}(ye(),Ue.x,Ue.y),P=!0,U=n.currItem.bounds,At("x",Ye)||(At("y",Ye),Ve(le),we())}}},kt=function(e){var t;if(be("pointerUp"),ht(e,!1)&&e.preventDefault(),L){var i=Ce.arraySearch(Je,e.pointerId,"id");if(i>-1)if(t=Je.splice(i,1)[0],navigator.msPointerEnabled){t.type={4:"mouse",2:"touch",3:"pen"}[e.pointerType],t.type||(t.type=e.pointerType||"mouse")}else t.type=e.pointerType||"mouse"}var a,s=xt(e),l=s.length;if("mouseup"===e.type&&(l=0),2===l)return Q=null,!0;1===l&&$e(Xe,s[0]),0!==l||J||K||(t||("mouseup"===e.type?t={x:e.pageX,y:e.pageY,type:"mouse"}:e.changedTouches&&e.changedTouches[0]&&(t={x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,type:"touch"})),be("touchRelease",e,t));var r=-1;if(0===l&&(Z=!1,Ce.unbind(window,m,n),pt(),W?r=0:-1!==ot&&(r=ye()-ot)),ot=1===l?ye():-1,a=-1!==r&&r<150?"zoom":"swipe",W&&l<2&&(W=!1,1===l&&(a="zoomPointerUp"),be("zoomGestureEnded")),Q=null,P||D||K||B)if(Qe(),O||(O=Ht()),O.calculateSwipeSpeed("x"),B){if(gt()n.currItem.fitRatio&&Mt(O):Et())}},Ht=function(){var e,t,i={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(a){tt.length>1?(e=ye()-T+50,t=tt[tt.length-2][a]):(e=ye()-I,t=Xe[a]),i.lastFlickOffset[a]=Ke[a]-t,i.lastFlickDist[a]=Math.abs(i.lastFlickOffset[a]),i.lastFlickDist[a]>20?i.lastFlickSpeed[a]=i.lastFlickOffset[a]/e:i.lastFlickSpeed[a]=0,Math.abs(i.lastFlickSpeed[a])<.1&&(i.lastFlickSpeed[a]=0),i.slowDownRatio[a]=.95,i.slowDownRatioReverse[a]=1-i.slowDownRatio[a],i.speedDecelerationRatio[a]=1},calculateOverBoundsAnimOffset:function(e,t){i.backAnimStarted[e]||(le[e]>U.min[e]?i.backAnimDestination[e]=U.min[e]:le[e]30&&(r||i.lastFlickOffset.x>20)?s=-1:t<-30&&(r||i.lastFlickOffset.x<-20)&&(s=1)}s&&((c+=s)<0?(c=o.loop?St()-1:0,l=!0):c>=St()&&(c=o.loop?0:St()-1,l=!0),l&&!o.loop||(me+=s,ce-=s,a=!0));var p,d=de.x*ce,m=Math.abs(d-st.x);return p=(a||d>st.x==i.lastFlickSpeed.x>0)&&Math.abs(i.lastFlickSpeed.x)>0?Math.max(Math.min(m/Math.abs(i.lastFlickSpeed.x),400),250):333,at===c&&(a=!1),K=!0,a&&Y.popup.toggle_timer(!1),We("mainScroll",st.x,d,p,Ce.easing.cubic.out,He,(function(){Qe(),K=!1,at=-1,(a||at!==c)&&n.updateCurrItem(),be("mainScrollAnimComplete")})),a&&n.updateCurrItem(!0),a},Vt=function(e){return 1/F*e*f},Et=function(){var e=_,t=Te(),i=Oe();_i&&(e=i);var a,o=ie;return te&&!S&&!ae&&_{G.setProperty("--clip-path-transition-duration",a?"0.333s":"0.433s"),G.setProperty("--clip-path",`inset(${e?`${e.y}% ${e.x}%`:"0% 0%"})`)};!function(){var i=r,s=!n.currItem.src||n.currItem.loadError||o.showHideOpacity;t.miniImg&&(t.miniImg.style.webkitBackfaceVisibility="hidden"),a||(_=l.w/t.w,le.x=l.x,le.y=l.y-V,Y.popup[s?"pswp":"bg"].style.opacity=.001,we());let c=(()=>{if(!l||!l.img)return;let e=l.img.offsetWidth,t=l.img.offsetHeight;if(!e||!t)return;let i=Math.max((l.w-e)/l.w*50,0),a=Math.max((l.h-t)/l.h*50,0);return i<1&&a<1?void 0:{x:i,y:a}})();c&&m(a?0:c),qe("initialZoom"),a&&!i&&e.classList.remove("pswp--animated-in"),s&&(a?Ce.toggle_class(e,"pswp--animate_opacity",!i):setTimeout((function(){e.classList.add("pswp--animate_opacity")}),30)),zt=setTimeout((function(){if(be("initialZoom"+(a?"Out":"In")),c&&m(a?c:0),a){var n=l.w/t.w,o={x:le.x,y:le.y},r=_,u=ie,h=function(t){1===t?(_=n,le.x=l.x,le.y=l.y-E):(_=(n-r)*t+r,le.x=(l.x-o.x)*t+o.x,le.y=(l.y-E-o.y)*t+o.y),we(),s?e.style.opacity=1-t:xe(u-t*u)};i?We("initialZoom",0,1,p,Ce.easing.cubic.out,h,d):(h(1),zt=setTimeout(d,p+20))}else _=t.initialZoomLevel,$e(le,t.initialPosition),we(),xe(1),s?e.style.opacity=1:xe(1),zt=setTimeout(d,p+20)}),a?10:20)}()},Zt={},Rt=[],Dt={index:0,errorMsg:'',preload:[1,1],getNumItemsFn:function(){return jt.length}},Pt=function(e,t,i){if(e.src&&!e.loadError){var a=!i;if(Zt.x=t.x,Zt.y=t.y,a){var n=Zt.x/e.w,o=Zt.y/e.h;e.fitRatio=n1&&(i=1),e.initialZoomLevel=i,e.bounds||(e.bounds={center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}})}if(!i)return;return function(e,t,i){var a=e.bounds;a.center.x=Math.round((Zt.x-t)/2),a.center.y=Math.round((Zt.y-i)/2),a.max.x=t>Zt.x?Math.round(Zt.x-t):a.center.x,a.max.y=i>Zt.y?Math.round(Zt.y-i):a.center.y,a.min.x=t>Zt.x?0:a.center.x,a.min.y=i>Zt.y?0:a.center.y}(e,e.w*i,e.h*i),a&&i===e.initialZoomLevel&&(e.initialPosition=e.bounds.center),e.bounds}return e.w=e.h=0,e.initialZoomLevel=e.fitRatio=1,e.bounds={center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}},e.initialPosition=e.bounds.center,e.bounds},Nt=function(e,t,i,a,o,s){t.loadError||a&&(t.imageAppended=!0,Wt(t,a,t===n.currItem&&he),i.appendChild(a),s&&setTimeout((function(){t&&t.loaded&&t.placeholder&&(t.placeholder.style.display="none",t.placeholder=null)}),500))},qt=function(e){e.loading=!0,e.loaded=!1;var t=e.img=Ce.createEl("pswp__img","img"),i=function(){e.loading=!1,e.loaded=!0,"svg"!==e.item.ext&&t.naturalWidth&&t.naturalHeight&&(e.w!==t.naturalWidth||e.h!==t.naturalHeight)&&(e.w=t.naturalWidth,e.h=t.naturalHeight,n.updateSize()),e.loadComplete?e.loadComplete(e):e.img=null,t.onload=t.onerror=null,t=null};return t.onload=i,t.onerror=function(){e.loadError=!0,i()},t.src=e.src,t},Qt=function(e,t){if(e.src&&e.loadError&&e.container)return t&&Ce.resetEl(e.container),e.container.innerHTML=o.errorMsg.replace("%url%",e.src),!0},Wt=function(e,t,i){if(e.src){t||(t=e.container.lastElementChild);var a=i?e.w:Math.round(e.w*e.fitRatio),n=i?e.h:Math.round(e.h*e.fitRatio);e.placeholder&&!e.loaded&&(e.placeholder.style.width=a+"px",e.placeholder.style.height=n+"px"),t.style.width=a+"px",t.style.height=n+"px"}},Ft=function(){if(Rt.length){for(var e,t=0;t=0,s=Math.min(i[0],St()),l=Math.min(i[1],St());for(t=1;t<=(a?l:s);t++)n.lazyLoadItem(c+t);for(t=1;t<=(a?s:l);t++)n.lazyLoadItem(c-t)})),ve("initialLayout",(function(){n.currItem.initialLayout=o.getThumbBoundsFn&&o.getThumbBoundsFn(c)})),ve("mainScrollAnimComplete",Ft),ve("initialZoomInEnd",Ft),ve("destroy",(function(){for(var e,t=0;t=0&&(void 0!==jt[e]&&jt[e])},setContent:function(e,t){o.loop&&(t=fe(t));var i=n.getItemAt(e.index);i&&(i.container=null);var a,l=n.getItemAt(t);if(l){be("gettingData",t,l),e.index=t,e.item=l;var r=l.container=Ce.createEl("pswp__zoom-wrap");if(!l.src&&l.html&&(l.html.tagName?r.appendChild(l.html):r.innerHTML=l.html),Qt(l),Pt(l,re),!l.src||l.loadError||l.loaded)l.src&&!l.loadError&&((a=Ce.createEl("pswp__img","img")).style.opacity=1,a.src=l.src,Wt(l,a),Nt(0,l,r,a));else{l.loadComplete=function(i){if(s){if(e&&e.index===t){if(Qt(i,!0))return i.loadComplete=i.img=null,Pt(i,re),Le(i),void(e.index===c&&n.updateCurrZoomItem());i.imageAppended?!Tt&&i.placeholder&&(i.placeholder.style.display="none",i.placeholder=null):K||Tt?Rt.push({item:i,baseDiv:r,img:i.img,index:t,holder:e,clearPlaceholder:!0}):Nt(0,i,r,i.img,0,!0)}i.loadComplete=null,i.img=null,be("imageLoadComplete",t,i)}};var p=l.msrc&&(l.msrc!==l.src||!It),d=Ce.createEl("pswp__img pswp__img--placeholder"+(p?"":" pswp__img--placeholder--blank"),p?"img":"");p&&(d.src=l.msrc),Wt(l,d),r.appendChild(d),l.placeholder=d,l.loading||qt(l),It?Nt(0,l,r,l.img,0,!0):Rt.push({item:l,baseDiv:r,img:l.img,index:t,holder:e})}It||t!==c?Le(l):(G=r.style,Bt(l,a||l.img)),Ce.resetEl(e.el),e.el.appendChild(r)}else Ce.resetEl(e.el)},cleanSlide:function(e){e.img&&(e.img.onload=e.img.onerror=null),e.loaded=e.loading=e.img=e.imageAppended=!1}}});var Ut,Gt,Yt={},Kt=function(e,t,i){var a=document.createEvent("CustomEvent"),n={origEvent:e,pointerType:i||"touch",releasePoint:t,target:e.target,rightClick:"mouse"===i&&3===e.which};a.initCustomEvent("pswpTap",!0,!0,n),e.target.dispatchEvent(a)};_e("Tap",{publicMethods:{initTap:function(){ve("firstTouchStart",n.onTapStart),ve("touchRelease",n.onTapRelease),ve("destroy",(function(){Yt={},Ut=null}))},onTapStart:function(e){e.length>1&&(clearTimeout(Ut),Ut=null)},onTapRelease:function(e,t){var i,a;if(t&&(!P&&!R&&!Pe&&(!L||Y.popup.container.contains(e.target)))){var n=t;if(Ut&&(clearTimeout(Ut),Ut=null,i=n,a=Yt,Math.abs(i.x-a.x)<25&&Math.abs(i.y-a.y)<25))return void be("doubleTap",n);if("mouse"===t.type)return void Kt(e,t,"mouse");if("A"===e.target.tagName)return;if("BUTTON"===e.target.tagName||e.target.classList.contains("pswp__single-tap"))return void Kt(e,t);$e(Yt,n),Ut=setTimeout((function(){Kt(e,t),Ut=null}),300)}}}}),_e("DesktopZoom",{publicMethods:{initDesktopZoom:function(){X.is_dual_input?ve("mouseUsed",(function(){n.setupDesktopZoom()})):X.is_pointer&&n.setupDesktopZoom(!0)},setupDesktopZoom:function(t){Gt={};var i="wheel mousewheel DOMMouseScroll";ve("bindEvents",(function(){Ce.bind(e,i,n.handleMouseWheel)})),ve("unbindEvents",(function(){Gt&&Ce.unbind(e,i,n.handleMouseWheel)})),n.mouseZoomedIn=!1;var a,o=function(){n.mouseZoomedIn&&(e.classList.remove("pswp--zoomed-in"),n.mouseZoomedIn=!1),Ce.toggle_class(e,"pswp--zoom-allowed",_<1),s()},s=function(){a&&(e.classList.remove("pswp--dragging"),a=!1)};ve("resize",o),ve("afterChange",o),ve("pointerDown",(function(){n.mouseZoomedIn&&(a=!0,e.classList.add("pswp--dragging"))})),ve("pointerUp",s),t||o()},handleMouseWheel:function(e){if(_<=n.currItem.fitRatio)return!o.closeOnScroll||Pe||Z?e.preventDefault():Math.abs(e.deltaY)>2&&(r=!0,n.close()),!0;if(e.stopPropagation(),Gt.x=0,"deltaX"in e)1===e.deltaMode?(Gt.x=18*e.deltaX,Gt.y=18*e.deltaY):(Gt.x=e.deltaX,Gt.y=e.deltaY);else if("wheelDelta"in e)e.wheelDeltaX&&(Gt.x=-.16*e.wheelDeltaX),e.wheelDeltaY?Gt.y=-.16*e.wheelDeltaY:Gt.y=-.16*e.wheelDelta;else{if(!("detail"in e))return;Gt.y=e.detail}Ie(_,!0);var t=le.x-Gt.x,i=le.y-Gt.y;e.preventDefault(),n.panTo(t,i)},toggleDesktopZoom:function(t){t=t||{x:re.x/2+pe.x,y:re.y/2+pe.y};var i=o.getDoubleTapZoom(!0,n.currItem),a=_===i;n.mouseZoomedIn=!a,n.zoomTo(a?n.currItem.initialZoomLevel:i,t,333),Ce.toggle_class(e,"pswp--zoomed-in",!a)}}});var Xt,Jt,ei,ti,ii,ai,ni,oi,si,li,ri={history:!0},ci=function(){return li.hash.substring(1)},pi=function(){Xt&&clearTimeout(Xt),ei&&clearTimeout(ei)},di=function(){if(ei&&clearTimeout(ei),Pe||Z)ei=setTimeout(di,500);else{ti?clearTimeout(Jt):ti=!0;var e=c+1,t=Ot(c);t.hasOwnProperty("pid")&&(e=t.pid);var i=(ai?ai+"&":"")+"pid="+e;ni||-1===li.hash.indexOf(i)&&(si=!0);var a=li.href.split("#")[0]+"#"+i;"#"+i!==window.location.hash&&history[ni?"replaceState":"pushState"]("",document.title,a),ni=!0,Jt=setTimeout((function(){ti=!1}),60)}};_e("History",{publicMethods:{initHistory:function(){if(Ce.copy_unique(o,ri),o.history){li=window.location,si=!1,oi=!1,ni=!1,ai=ci(),ve("afterChange",n.updateURL),ve("unbindEvents",(function(){Ce.unbind(window,"hashchange",n.onHashChange)})),history.scrollRestoration&&(history.scrollRestoration="manual");var e=function(){ii=!0,oi||(si?history.back():ai?li.hash=ai:history.pushState("",document.title,li.pathname+li.search)),pi(),history.scrollRestoration&&(history.scrollRestoration="auto")};ve("unbindEvents",(function(){r&&e()})),ve("destroy",(function(){ii||e()}));var t=ai.indexOf("pid=");t>-1&&"&"===(ai=ai.substring(0,t)).slice(-1)&&(ai=ai.slice(0,-1)),setTimeout((function(){s&&Ce.bind(window,"hashchange",n.onHashChange)}),40)}},onHashChange:function(){if(ci()===ai)return oi=!0,void n.close()},updateURL:function(){pi(),ni?Xt=setTimeout(di,800):di()}}}),Object.assign(n,Fe)};class ke{static active_el;static expand_button;static menu_root;static has_uls;static has_uls_root;static has_uls_not_root;static menu_open={};static menu_expanded;static toggle_duration=200;static init(){if(this.config=e("menu",{hidden:!1,expanded:!1,localStorage:!0}),this.params={},location.search.includes("=")&&["disabled","hidden","expanded"].forEach((e=>{let t=location.search.match(new RegExp(`menu_${e}=(0|1|true|false)`));t&&(this.params[e]=/1|true/.test(t[1]))})),K.sidebar=_id("sidebar"),K.sidebar_inner=_id("sidebar-inner"),K.sidebar_menu=_id("sidebar-menu"),K.sidebar_toggle=_id("sidebar-toggle"),K.sidebar_bg=_id("sidebar-bg"),K.sidebar_topbar=_id("sidebar-topbar"),this.params.disabled)return K.sidebar.remove(),K.sidebar_bg.remove(),document.documentElement.classList.remove("menu-enabled"),document.documentElement.classList.add("menu-disabled","sidebar-closed"),void(_c.menu_exists=!1);this.sidebar_hidden()&&document.documentElement.classList.add("sidebar-closed"),K.sidebar_toggle.innerHTML=U.get_svg_icon_multi("menu","menu_back"),K.sidebar_toggle.addEventListener("click",(()=>this.toggle_open())),K.sidebar_bg.addEventListener("click",(()=>this.toggle_open())),this.get_menu()}static sidebar_hidden(){return!this.is_large_screen()||(this.params.hasOwnProperty("hidden")?this.params.hidden:this.config.localStorage?!T.get_option("files:menu-open",!this.config.hidden):this.config.hidden)}static is_large_screen(){return matchMedia("(min-width: 992px)").matches}static toggle_open(){T.set_option("files:menu-open",!document.documentElement.classList.toggle("sidebar-closed"),!this.config.hidden)}static get_menu(){const e=!!_c.config.localStorage_cache&&T.get_json("files:menu:"+_c.menu_cache_hash);return e?_c.menu_cache_validate||_c.cache&&!_c.menu_cache_file?e.some((e=>e.path.includes("/")))?void this.load_menu(e):this.create_menu(e,"localStorage valid [root dirs only]"):this.create_menu(e,"localStorage valid [menu_cache_validate disabled]"):this.load_menu()}static load_menu(e){K.sidebar_menu.classList.add("sidebar-spinner"),O({params:!_c.menu_cache_file&&[_c.cache?`menu_cache_hash=${_c.menu_cache_hash}`:0,e?"localstorage=1":0].filter(Boolean).join("&"),method:_c.menu_cache_file?"GET":"POST",url:_c.menu_cache_file||_c.script+"?action=dirs",json_response:!0,complete:(t,i,a)=>this.loaded(t,i,a,e)})}static loaded(e,t,i,a){return K.sidebar_menu.classList.remove("sidebar-spinner"),i&&e&&!e.error&&Object.keys(e).length?e.localstorage&&a?this.create_menu(a,"localStorage valid [server]"):(this.create_menu(e,"menu from "+(_c.menu_cache_file?"JSON cache":"xmlhttp")),void(X.local_storage&&_c.config.localStorage_cache&&setTimeout((()=>{U.clean_localstorage(),T.set("files:menu:"+_c.menu_cache_hash,t)}),1e3))):(oe(),j(e.error||"Error or no dirs!"),F.toggle(!1,e.error||"Error or no dirs!"))}static is_expanded(){if(this.params.hasOwnProperty("expanded"))return this.params.expanded;let e=!!this.config.localStorage&&T.get_json(`files:menu-expanded:${_c.location_hash}`);return e?(this.menu_open=e,void Object.keys(this.menu_open).forEach((e=>{_c.dirs[e]||delete this.menu_open[e]}))):this.config.expanded}static create_menu(e,t){if(oe(),j("[MENU] "+t,e),e.forEach((e=>{_c.dirs[e.path]||(_c.dirs[e.path]=e)})),this.is_expanded()){let e=!1;Object.keys(_c.dirs).forEach((t=>{e&&t.startsWith(e+"/")&&(this.menu_open[e]=!0),e=t}))}this.create_menu_html(e),this.menu_root=K.sidebar_menu.firstChild,this.get_has_uls(),_class("menu-li",this.menu_root).forEach((e=>{const t=_c.dirs[e.dataset.path];t&&(t.menu_li=e)})),this.set_active(_c.current_path||_c.start_path||""),this.set_menu_scroll(),this.set_menu_toggle(),_c.config.transitions&&1==getComputedStyle(document.body).getPropertyValue("opacity")&&anime({targets:this.menu_root,opacity:[0,1],easing:"easeOutQuad",duration:300}),L(this.menu_root,(e=>{if(Y.contextmenu.is_open)return e.preventDefault();if(e.target===this.menu_root)return;const t="A"===e.target.nodeName,i=t?e.target.parentElement:e.target.closest(".menu-li"),a=t?e.target:i.firstElementChild;if(!C(e,a))if(t&&a!==this.active_el)U.get_files(i.dataset.path,"push"),this.is_large_screen()?document.documentElement.classList.contains("sidebar-closed")&&w(K.sidebar,"sidebar-clicked",null,1e3):this.toggle_open();else if(!t||i.classList.contains("has-ul")){const e=!i.classList.contains("menu-li-open");this.menu_open_manager(i,e),this.ul_anime(i,e)}}))}static create_menu_html(e){let t="",i=0,a=0,n=!1;e.forEach((e=>{if(!e.path)return;let o=(e.path.match(/\//g)||[]).length+1,s=o-i;i=o,a+=s,n&&(t+=this.add_li(n,s>0)),t+=s>0?`".repeat(-s),n=_c.dirs[e.path]})),t+=this.add_li(n,!1)+"".repeat(a),K.sidebar_menu.innerHTML=t}static add_li(e,t){let i="menu-li",o="menu-a",s=e.path?(e.path.match(/\//g)||[]).length+1:0,l="folder"+(e.is_readable?e.is_link?"_link":"":"_forbid"),r=a(e.path);return t?i+=" has-ul menu-li-"+(this.menu_open[e.path]?"open":"closed"):e.is_readable||(o+=" menu-a-forbidden"),`${t?U.get_svg_icon_multi_class("button-icon menu-icon menu-icon-toggle","plus","minus")+U.get_svg_icon_multi_class("menu-icon menu-icon-folder menu-icon-folder-toggle",l,"folder_plus","folder_minus"):U.get_svg_icon_class(l,"menu-icon menu-icon-folder")}${n(e.basename)}`}static get_has_uls(){this.has_uls=_class("has-ul",this.menu_root),this.has_uls_root=Array.from(this.menu_root.children).filter((e=>e.classList.contains("has-ul"))),this.has_uls_not_root=this.has_uls.filter((e=>!this.has_uls_root.includes(e)))}static set_active(e){this.active_el&&this.active_el.classList.remove("menu-spinner","menu-active");let t=e.split("/");for(;t.length;){let e=_c.dirs[t.join("/")];if(this.active_el=!(!e||!e.menu_li)&&e.menu_li.firstElementChild,this.active_el){this.active_el.classList.add("menu-active");break}t.pop()}}static set_menu_scroll(){if(!X.local_storage)return;const e=T.get("files:menu-scroll"+_c.location_hash);e&&(K.sidebar_menu.scrollTop=e),L(K.sidebar_menu,k((()=>{T.set("files:menu-scroll"+_c.location_hash,K.sidebar_menu.scrollTop,!0)}),1e3),"scroll")}static set_menu_toggle(){this.menu_expanded=this.has_uls_root.length&&Object.keys(this.menu_open).length===this.has_uls.length,K.sidebar_topbar.innerHTML=``,this.expand_button=K.sidebar_topbar.lastElementChild,L(this.expand_button,(e=>{if(!this.has_uls_root.length)return;let t=[],i=[],a=!1,n=window.innerHeight;if(this.menu_expanded)this.has_uls_root.forEach((e=>{if(!e.classList.contains("menu-li-open"))return;if(a)return t.push(e);if(e.getBoundingClientRect().top<=n)return i.push(e);t.push(e),a=!0})),t.length&&t.forEach((e=>this.li_close(e))),i.length&&i.forEach((e=>this.ul_anime(e,!1))),$("menu_inner_close",(()=>{this.has_uls_not_root.forEach((e=>this.li_close(e)))}),i.length?this.toggle_duration+10:10);else{let e=this.has_uls;this.has_uls.length>100&&(e=this.has_uls_root,this.has_uls_not_root.forEach((e=>this.li_open(e)))),e.forEach((e=>{if(e.classList.contains("menu-li-open"))return;if(a||!e.offsetParent)return t.push(e);if(e.getBoundingClientRect().top<=n&&e.lastElementChild.children.length<=50)return i.push(e);t.push(e),a=!0})),t.length&&t.forEach((e=>this.li_open(e))),i.length&&i.forEach((e=>this.ul_anime(e,!0))),clearTimeout(M.menu_inner_close)}this.menu_open_manager("all",!this.menu_expanded)}))}static menu_open_manager(e,t){"all"===e?t?this.has_uls.forEach((e=>this.menu_open[e.dataset.path]=!0)):this.menu_open={}:t?this.menu_open[e.dataset.path]=!0:delete this.menu_open[e.dataset.path],this.update_expanded()}static update_expanded(){const e=Object.keys(this.menu_open).length,t=this.has_uls_root.length&&e===this.has_uls.length;this.menu_expanded!==t&&(this.menu_expanded=t,X.is_pointer&&(this.expand_button.title=ie.get(t?"collapse menu":"expand menu")),this.expand_button.classList.toggle("is-expanded",t)),X.local_storage&&$("menu_expanded_localStorage",(()=>{T.set("files:menu-expanded:"+_c.location_hash,JSON.stringify(this.menu_open))}),1e3)}static ul_anime(e,t){const i=e.lastElementChild;i.style.display="block",anime.remove(i);const a={targets:i,translateY:t?[-2,0]:-2,height:[i.clientHeight+"px",t?i.scrollHeight+"px":0],opacity:t?1:0,easing:"cubicBezier(.6,0,.1,1)",duration:this.toggle_duration,complete:()=>{i.style.cssText="--depth:"+(e.dataset.level||0)}};return anime(a),t?this.li_open(e):this.li_close(e)}static li_open(e){e.classList.replace("menu-li-closed","menu-li-open")}static li_close(e){e.classList.replace("menu-li-open","menu-li-closed")}static loading(e){this.active_el&&this.active_el.classList.toggle("menu-spinner",!!e)}static update(){this.get_has_uls(),this.expand_button.classList.toggle("not-expandable",!this.has_uls_root.length),this.menu_open={},this.has_uls.forEach((e=>{e.classList.contains("menu-li-open")&&(this.menu_open[e.dataset.path]=!0)})),this.update_expanded()}}if(_c.menu_exists&&ke.init(),(()=>{Y.sort={sorting:{name:{prop:"basename",order:"asc"},kind:{prop:"ext",order:"asc"},size:{prop:"filesize",order:"desc"},date:{prop:"mtime",order:"desc"},shuffle:{prop:"mtime",order:"desc"}}};const t=e("sort",{default:"name_asc",dirs_first:!0,function:"locale"});function i(e,t){Object.assign(Y.sort,{sort:e,order:t,multi:"asc"===t?1:-1,index:Y.sort.keys.indexOf(e),prop:Y.sort.sorting[e].prop})}t.options&&Object.keys(Y.sort.sorting).forEach((e=>{t.options.includes(e)||delete Y.sort.sorting[e]})),Y.sort.keys=Object.keys(Y.sort.sorting);let a=([z("sort",!0),T.get("files:sort"),t.default,Y.sort.keys[0]].find((e=>e&&Y.sort.keys.includes(e.split("_")[0])))||"name_asc").split("_"),n=a[0]||"name";i(n,a[1]&&["asc","desc"].includes(a[1])?a[1]:Y.sort.sorting[n].order);const o=_id("change-sort");o&&(o.innerHTML=``);const s=o.firstElementChild,l=(o.children[1],o.lastElementChild),r=_class("dropdown-item",l);function c(e,i){if(t.dirs_first&&e._values.is_dir!==i._values.is_dir)return(i._values.is_dir?1:-1)*Y.sort.multi;if("shuffle"===Y.sort.sort)return.5-Math.random();var a=e._values[Y.sort.prop],n=i._values[Y.sort.prop];return"name"===Y.sort.sort||a===n?m(e._values.basename,i._values.basename):a>n?1:-1}var p={locale:function(e,t){return d.compare(e,t)||p.basic(e,t)},basic:function(e,t){var i=e.toLowerCase(),a=t.toLowerCase();return i===a?e>t?1:-1:i>a?1:-1}},d=new Intl.Collator(t.function&&!["basic","locale"].includes(t.function)?t.function.trim():void 0,{numeric:!0,sensitivity:"base"}),m=p["basic"===t.function?"basic":"locale"];function h(e,t,i){let a=r[Y.sort.index],n=_[Y.sort.index];e&&(a.classList.toggle("active",i),n&&n.classList.toggle("sortbar-active",i)),(e||t)&&(a.classList.toggle("sort-"+Y.sort.order,i),n&&n.classList.toggle("sort-"+Y.sort.order,i))}U.set_sort=function(e){if(e){var a=e!==Y.sort.sort,n=a?Y.sort.sorting[e].order:"asc"===Y.sort.order?"desc":"asc",o=n!==Y.sort.order;h(a,o,!1),i(e,n),s.innerHTML=U.get_svg_icon(`sort_${e}_${n}`),h(a,o,!0),T.set_option("files:sort",Y.sort.sort+"_"+Y.sort.order,t.default)}_c.debug&&console.time("sort"),Y.list&&Y.list.sort(Y.sort.prop,{order:Y.sort.order,sortFunction:c}),_c.debug&&console.timeEnd("sort")},U.dropdown(o,s,(function(){let e=Y.sort.index>=Y.sort.keys.length-1?0:Y.sort.index+1;4!==e||r[4].offsetParent||(e=0),U.set_sort(Y.sort.keys[e])})),u(l,U.set_sort),K.sortbar=_id("files-sortbar"),P(K.sortbar,"sortbar-"+Y.layout.layout),K.sortbar.innerHTML=`${E(Y.sort.keys,(e=>"shuffle"===e?"":`
${ie.get(e)}${U.get_svg_icon_multi_class("svg-icon svg-icon-sort","chevron_down","chevron_up")}
`))}
`;const _=K.sortbar.firstChild.children;L(K.sortbar,(function(e){var t=e.target.closest("[data-action]");t&&U.set_sort(t.dataset.action,e)}))})(),Y.topbar={info:{}},K.filter.placeholder=ie.get("filter"),K.filter.title=X.c_key+"F",ue.hash(),K.filter_container.insertAdjacentHTML("beforeend",`${U.get_svg_icon_class("search","svg-icon filter-search-icon")}`),L(K.filter_container.lastElementChild,(()=>{K.filter.focus(),ue.clear(!0)})),ie.dropdown(),_c.allow_settings&&xe.options.show_button&&(K.topbar_top.insertAdjacentHTML("beforeend",``),K.topbar_top.lastElementChild.addEventListener("click",(e=>new xe))),_c.session_token&&_e.button(),ee.config.button&&(K.topbar_top.insertAdjacentHTML("beforeend",``),K.topbar_top.lastElementChild.addEventListener("click",(()=>ee.next()))),screenfull.isEnabled&&(K.topbar_top.insertAdjacentHTML("beforeend",'"),L(K.topbar_top.lastElementChild,(function(){screenfull.toggle()})),screenfull.on("change",(function(){document.documentElement.classList.toggle("is-fullscreen",screenfull.isFullscreen)}))),U.topbar_info=function(e,t){K.topbar_info.className="info-"+t,K.topbar_info.innerHTML=e},U.topbar_info_search=function(e,t){if(!e)return K.topbar_info.className="info-hidden";K.topbar_info.classList.contains("info-search")?(K.topbar_info.classList.toggle("info-nomatch",!t),K.topbar_info.children[0].textContent=t,K.topbar_info.children[2].textContent=e):U.topbar_info(''+t+''+ie.get("matches found for")+''+e+'","search"+(t?"":" info-nomatch"))},_c.config.favicon&&document.head.insertAdjacentHTML("beforeend",_c.config.favicon),"popup"===_c.config.click&&X.is_pointer&&K.files_container.style.setProperty("--files-cursor","zoom-in"),_c.config.logo){let e=_c.config.logo.startsWith("<")?_c.config.logo:`
`;document.body.insertAdjacentHTML("afterBegin",``),_id("change-sort").insertAdjacentHTML("afterEnd",``)}function He(){const e=e=>Q(100).then((()=>{e&&e.remove()}));[".modal","#files"].forEach((function(t){yall({observeChanges:!0,observeRootSelector:t,lazyClass:"files-lazy",threshold:300,events:{load:function(t){let i=t.target,a=i.parentElement,n=!!a.dataset.name&&_c.files[a.dataset.name],o=i.naturalWidth,s=i.naturalHeight,l=o?o/s:1;if(i.classList.contains("files-folder-preview"))return o&&1!==o?(o&&i.style.setProperty("--ratio",l),i.style.opacity=1):e(i);if(n&&n.embed_img&&n.embed_img.endsWith("/hq720.jpg")&&o*!==*/1280&&(n.embed_img=i.src=`https://img.youtube.com/vi/${n.embed_img.split("/")[4]}/mqdefault.jpg`),n&&o&&_c.config.previews_update&&(n.preview_dimensions||[])[0]!=o&&(n.dimensions&&n.preview_dimensions&&n.preview_dimensions[0]===s&&n.preview_dimensions[1]===o&&(n.dimensions&&n.dimensions.reverse(),n.image&&(n.image.width=n.dimensions[0]),n.image&&(n.image.height=n.dimensions[1]),n.ratio&&(n.ratio=n.image.width/n.image.height)),n.preview_dimensions=[o,s],n.preview_ratio=l,a.style.setProperty("--ratio",n.preview_ratio),i.setAttribute("width",o),i.setAttribute("height",s),delete _c.current_dir.html),["grid","rows","columns"].includes(Y.layout.layout)){let e=a.style;e.setProperty("--files-data-transition-duration","0s"),Q(250).then((()=>e.removeProperty("--files-data-transition-duration")))}i.classList.remove("files-img-placeholder"),a.classList.add("files-a-loaded")},error:{listener:t=>{t.target.classList.contains("files-folder-preview")&&e(t.target)}}}})})),document.body.classList.remove("body-loading"),U.topbar_dropdowns_init();const t=()=>K.topbar_top.classList.toggle("topbar-top-scroll",K.topbar_top.clientWidtht())),t(),!_c.config.prevent_right_click&&_c.config.context_menu&&(K.files_container&&K.files_container.addEventListener("contextmenu",(e=>{let t=e.target.closest(".files-a");U.create_contextmenu(e,"files",t||K.files_container,t?_c.files[t.dataset.name]:_c.current_dir)})),K.sidebar_menu&&K.sidebar_menu.addEventListener("contextmenu",(e=>{let t=e.target.closest(".menu-a"),i=!!t&&t.parentElement;U.create_contextmenu(e,"sidebar",t||K.sidebar_menu,_c.dirs[i?i.dataset.path:""])}))),anime({targets:document.body,opacity:[0,1],duration:500,easing:"easeOutQuad",complete:U.init_files})}if(_c.config.header&&document.body.insertAdjacentHTML("afterBegin",``),_c.config.topbar&&K.main.insertAdjacentHTML("afterBegin",``),_c.config.footer&&K.main.insertAdjacentHTML("beforeEnd",``),_c.config.footer_fixed&&document.body.insertAdjacentHTML("afterEnd",``),_c.index_html&&location.search.indexOf("create_index_cache=")>-1){let e=`./index.php?create_index_cache=${z("create_index_cache",!0)}`;Ae.default.fire({title:"index_cache",html:`Must be triggered from index.php`}).then((t=>{t.isConfirmed&&location.assign(e)}))}else"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype?He():U.load_plugin("intersection-observer",He,{src:["intersection-observer@0.12.2/intersection-observer.js"]})}("undefined"==typeof files?files={}:files);