5 lines
102 KiB
JavaScript
5 lines
102 KiB
JavaScript
|
/* h5ai v0.29.2 - https://larsjung.de/h5ai/ */
|
||
|
!function(e){function t(e,t){if(!t)throw i.className=r,new Error(r+": "+e)}function n(e){return"function"==typeof e}if(!e||e.window!==e||!e.document)throw new Error("no-window");var r="no-browser",i=e.document.documentElement;i.className="",t("console",e.console&&n(e.console.log)),t("assign",e.Object&&n(e.Object.assign)),t("promise",n(e.Promise)),t("xhr",e.XMLHttpRequest)}(this),function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";n(1)},function(e,t,n){"use strict";var r=n(2),i=r.dom,o=r.awaitReady,a=n(7),s=i("script[data-module]").attr("data-module"),c={action:"get",setup:!0,options:!0,types:!0};if("index"===s)c.theme=!0,c.langs=!0;else{if("info"!==s)throw new Error("no-main-module: '"+s+"'");c.refresh=!0}a._update(c).then(function(){return o()}).then(function(){return n(9)("./"+s)})},function(e,t,n){"use strict";e.exports=Object.assign({},n(3),n(4),n(5),n(6))},function(e,t){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(e){return void 0!==e&&null!==e},i=function(e,t){return("undefined"==typeof e?"undefined":n(e))===t},o=function(e){return i(e,"string")},a=function(e){return i(e,"function")},s=function(e){return i(e,"number")},c=function(e){return e&&e.hasOwnProperty("length")},u=function(e){return!e||o(e)?[]:(c(e)&&(e=Array.from(e)),Object.keys(e))},l=function(e){return u(e).map(function(t){return e[t]})},f=function(e,t){return u(e).forEach(function(n){return t(e[n],n)})},d=function(e,t){return l(e).filter(t)},p=function(e,t){return l(e).map(t)},h=function(e,t){return l(e).indexOf(t)>=0},g=function(e){return d(e,function(e){return!!e})},m=function(e,t){return!!e&&e instanceof t},v=function(e){return Array.from(e)},b=function(e,t){return t=l(t),d(e,function(e){return t.indexOf(e)<0})},w=function(e,t){return t=l(t),d(e,function(e){return t.indexOf(e)>=0})},y=function(e,t){return e<t?-1:e>t?1:0},x=function(e,t){var n=a(t)?t:function(e){return e[t]},r=function(e,t){return y(n(e),n(t))};return l(e).sort(r)},k=function(e,t){var n=null;return function(){clearTimeout(n),n=setTimeout(e,t)}};e.exports={is:r,isStr:o,isFn:a,isNum:s,hasLength:c,keys:u,values:l,each:f,filter:d,map:p,includes:h,compact:g,isInstanceOf:m,toArray:v,difference:b,intersection:w,cmp:y,sortBy:x,debounce:k}},function(e,t,n){(function(t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var i=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=n(3),a=o.each,s=o.filter,c=o.hasLength,u=o.is,l=o.isStr,f=o.map,d=o.isInstanceOf,p=o.toArray,h=t.window,g=h.document,m=function(){var e=function(e){return g.createElement(e)},t=[[/^<t(head|body|foot)|^<c(ap|olg)/i,e("table")],[/^<col/i,e("colgroup")],[/^<tr/i,e("tbody")],[/^<t[dh]/i,e("tr")]],n=e("div"),r=function(e){var r=!0,o=!1,a=void 0;try{for(var s,c=t[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var u=s.value,l=i(u,2),f=l[0],d=l[1];if(f.test(e))return d}}catch(e){o=!0,a=e}finally{try{!r&&c.return&&c.return()}finally{if(o)throw a}}return n};return function(e){var t=r(e);t.innerHTML=e;var n=p(t.childNodes);return a(n,function(e){return t.removeChild(e)}),t.innerHTML="",n}}(),v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;try{return p(t.querySelectorAll(e))}catch(e){return[]}},b=function(e){return d(e,h.Element)},w=function(e){return d(e,h.Document)},y=function(e){return u(e)&&e.window=
|
||
|
return r?"|":" |"}),r=n.split(/ \|/),i=0;if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(/\\\|/g,"|");return r}function m(e,t,n){if(0===e.length)return"";for(var r=0;r<e.length;){var i=e.charAt(e.length-r-1);if(i!==t||n){if(i===t||!n)break;r++}else r++}return e.substr(0,e.length-r)}function v(e,t){if(e.indexOf(t[1])===-1)return-1;for(var n=0,r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return-1}function b(e,t,r){if("undefined"==typeof e||null===e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if(r||"function"==typeof t){r||(r=t,t=null),t=h({},b.defaults,t||{});var i,o,s=t.highlight,u=0;try{i=n.lex(e,t)}catch(e){return r(e)}o=i.length;var l=function(e){if(e)return t.highlight=s,r(e);var n;try{n=a.parse(i,t)}catch(t){e=t}return t.highlight=s,e?r(e):r(null,n)};if(!s||s.length<3)return l();if(delete t.highlight,!o)return l();for(;u<i.length;u++)!function(e){return"code"!==e.type?--o||l():s(e.text,e.lang,function(t,n){return t?l(t):null==n||n===e.text?--o||l():(e.text=n,e.escaped=!0,void(--o||l()))})}(i[u])}else try{return t&&(t=h({},b.defaults,t)),a.parse(n.lex(e,t),t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",(t||b.defaults).silent)return"<p>An error occurred:</p><pre>"+c(e.message+"",!0)+"</pre>";throw e}}var w={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:p,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:p,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:p,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};w._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,w._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,w.def=l(w.def).replace("label",w._label).replace("title",w._title).getRegex(),w.bullet=/(?:[*+-]|\d{1,9}\.)/,w.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,w.item=l(w.item,"gm").replace(/bull/g,w.bullet).getRegex(),w.list=l(w.list).replace(/bull/g,w.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+w.def.source+")").getRegex(),w._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",w._comment=/<!--(?!-?>)[\s\S]*?-->/,w.html=l(w.html,"i").replace("comment",w._comment).replace("tag",w._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),w.paragraph=l(w.paragraph).replace("hr",w.hr).replace("heading",w.heading).replace("lheading",w.lheading).replace("tag",w._tag).getRegex(),w.blockquote=l(w.blockquote).replace("paragraph",w.paragraph).getRegex(),w.normal=h({},w),w.gfm=h({},w.normal,{fences:/^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),w.gfm.paragraph=l(w.paragraph).replace("(?!","(?!"+w.gfm.fences.source.replace("\\1","\\2")+"|"+w.list.so
|
||
|
return v.isDark(a,o)?0:1}return 1})},v};t.stringToBytes=function(e){for(var t=new Array,n=0;n<e.length;n+=1){var r=e.charCodeAt(n);t.push(255&r)}return t},t.createStringToBytes=function(e,t){var n=function(){for(var n=d(e),r=function(){var e=n.read();if(e==-1)throw new Error;return e},i=0,o={};;){var a=n.read();if(a==-1)break;var s=r(),c=r(),u=r(),l=String.fromCharCode(a<<8|s),f=c<<8|u;o[l]=f,i+=1}if(i!=t)throw new Error(i+" != "+t);return o}(),r="?".charCodeAt(0);return function(e){for(var t=new Array,i=0;i<e.length;i+=1){var o=e.charCodeAt(i);if(o<128)t.push(o);else{var a=n[e.charAt(i)];"number"==typeof a?(255&a)==a?t.push(a):(t.push(a>>>8),t.push(255&a)):t.push(r)}}return t}};var n={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},r={L:1,M:0,Q:3,H:2},i={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o=function(){var t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],r=1335,o=7973,s=21522,c={},u=function(e){for(var t=0;0!=e;)t+=1,e>>>=1;return t};return c.getBCHTypeInfo=function(e){for(var t=e<<10;u(t)-u(r)>=0;)t^=r<<u(t)-u(r);return(e<<10|t)^s},c.getBCHTypeNumber=function(e){for(var t=e<<12;u(t)-u(o)>=0;)t^=o<<u(t)-u(o);return e<<12|t},c.getPatternPosition=function(e){return t[e-1]},c.getMaskFunction=function(e){switch(e){case i.PATTERN000:return function(e,t){return(e+t)%2==0};case i.PATTERN001:return function(e,t){return e%2==0};case i.PATTERN010:return function(e,t){return t%3==0};case i.PATTERN011:return function(e,t){return(e+t)%3==0};case i.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case i.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case i.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case i.PATTERN111:return function(e,t){return(e*t%3+(e+t)%2)%2==0};default:throw new Error("bad maskPattern:"+e)}},c.getErrorCorrectPolynomial=function(t){for(var n=e([1],0),r=0;r<t;r+=1)n=n.multiply(e([1,a.gexp(r)],0));return n},c.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case n.MODE_NUMBER:return 10;case n.MODE_ALPHA_NUM:return 9;case n.MODE_8BIT_BYTE:return 8;case n.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case n.MODE_NUMBER:return 12;case n.MODE_ALPHA_NUM:return 11;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else{if(!(t<41))throw new Error("type:"+t);switch(e){case n.MODE_NUMBER:return 14;case n.MODE_ALPHA_NUM:return 13;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}}},c.getLostPoint=function(e){for(var t=e.getModuleCount(),n=0,r=0;r<t;r+=1)for(var i=0;i<t;i+=1){for(var o=0,a=e.isDark(r,i),s=-1;s<=1;s+=1)if(!(r+s<0||t<=r+s))for(var c=-1;c<=1;c+=1)i+c<0||t<=i+c||0==s&&0==c||a==e.isDark(r+s,i+c)&&(o+=1);o>5&&(n+=3+o-5)}for(var r=0;r<t-1;r+=1)for(var i=0;i<t-1;i+=1){var u=0;e.isDark(r,i)&&(u+=1),e.isDark(r+1,i)&&(u+=1),e.isDark(r,i+1)&&(u+=1),e.isDark(r+1,i+1)&&(u+=1),0!=u&&4!=u||(n+=3)}for(var r=0;r<t;r+=1)for(var i=0;i<t-6;i+=1)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(var i=0;i<t;i+=1)for(var r=0;r<t-6;r+=1)e.isDark(r,i)&&!e.isDark(r+1,i)&&e.isDark(r+2,i)&&e.isDark(r+3,i)&&e.isDark(r+4,i)&&!e.isDark(r+5,i)&&e.isDark(r+6,i)&&(n+=40);for(var l=0,i=0;i<t;i+=1)for(var r=0;r<t;r+=1)e.isDark(r,i)&&(l+=1);var f=Math.abs(100*l/t/t-50)/5;return n+=10*f},c}(),a=function(){for(var e=new Array(256),t=new Array(256),n=0;n<8;n+
|
||
|
return e.isFolder()?p.folders:1},v={0:"label",1:"time",2:"size"},b={0:"label",1:"date",2:"size"},w=function(e,t,n,r){return function(i,o){var a=i._item,u=o._item,l=m(a)-m(u);if(0!==l)return l;var f=a[e],d=u[e];return(isNaN(f)||isNaN(d))&&(f=String(f),d=String(d),n&&(f=f.toLowerCase(),d=d.toLowerCase())),l=r?c(f,d):s(f,d),t?-l:l}},y=function(e,t){var n=a("#items li.header a"),r=a("#items li.header a."+b[e]),i=w(v[e],t,p.ignorecase,p.natural);d.put(h,{column:e,reverse:t}),n.rmCls("ascending").rmCls("descending"),r.addCls(t?"descending":"ascending"),a(o(a("#items .item:not(.folder-parent)")).sort(i)).appTo("#items")},x=function(){var e=d.get(h),t=e&&e.column||p.column,n=e&&e.reverse||p.reverse;y(t,n)},k=function(){var e=a("#items li.header");i(b,function(t,n){var r="0"===n?"app":"pre";e.find("a."+t)[r](g).on("click",function(e){y(n,a(e.currentTarget).hasCls("ascending")),e.preventDefault()})})},_=function(){p.enabled&&(k(),u.sub("view.changed",x))};_()},function(e,t,n){"use strict";var r=n(2),i=r.each,o=r.map,a=r.includes,s=n(8),c=n(12),u=n(14),l=Object.assign({enabled:!1,img:["img-bmp","img-gif","img-ico","img-jpg","img-png"],mov:["vid-avi","vid-flv","vid-mkv","vid-mov","vid-mp4","vid-mpg","vid-webm"],doc:["x-pdf","x-ps"],delay:1,size:100,exif:!1,chunksize:20},u.thumbnails),f=4/3,d=function(e,t){var n=null;if(a(l.img,t.type))n="img";else if(a(l.mov,t.type))n="mov";else{if(!a(l.doc,t.type))return;n="doc"}t.thumbSquare?t.$view.find(".icon.square img").addCls("thumb").attr("src",t.thumbSquare):e.push({type:n,href:t.absHref,ratio:1,callback:function(e){e&&t.$view&&(t.thumbSquare=e,t.$view.find(".icon.square img").addCls("thumb").attr("src",e))}}),t.thumbRational?t.$view.find(".icon.landscape img").addCls("thumb").attr("src",t.thumbRational):e.push({type:n,href:t.absHref,ratio:f,callback:function(e){e&&t.$view&&(t.thumbRational=e,t.$view.find(".icon.landscape img").addCls("thumb").attr("src",e))}})},p=function(e){var t=o(e,function(e){return{type:e.type,href:e.href,width:Math.round(l.size*e.ratio),height:l.size}});return s.request({action:"get",thumbs:t}).then(function(t){i(e,function(e,n){e.callback(t&&t.thumbs?t.thumbs[n]:null)})})},h=function(e){for(var t=e.length,n=l.chunksize,r=Promise.resolve(),i=function(t){r=r.then(function(){return p(e.slice(t,t+n))})},o=0;o<t;o+=n)i(o)},g=function(e){var t=[];i(e,function(e){return d(t,e)}),h(t)},m=function(e){setTimeout(function(){return g(e)},l.delay)},v=function(){l.enabled&&c.sub("view.changed",m)};v()},function(e,t,n){(function(e){"use strict";var t=n(12),r=n(14),i=e.window.document,o=Object.assign({enabled:!1},r.title),a=function(e){var t=e.getCrumb().map(function(e){return e.label}),n=t.join(" > ");t.length>1&&(n=t[t.length-1]+" - "+n),i.title=n},s=function(){o.enabled&&t.sub("location.changed",a)};s()}).call(t,function(){return this}())},function(e,t,n){"use strict";var r=n(2),i=r.each,o=r.dom,a=r.cmp,s=r.naturalCmp,c=n(12),u=n(20),l=n(13),f=n(14),d=n(16),p=Object.assign({enabled:!1,show:!0,maxSubfolders:50,naturalSort:!1,ignorecase:!0},f.tree),h='<div class="item folder">\n <span class="indicator">\n <img src="'+l.image("tree-indicator")+'"/>\n </span>\n <a>\n <span class="icon"><img src="'+l.icon("folder")+'"/></span>\n <span class="label"></span>\n </a>\n </span>',g='<div class="block">\n <h1 class="l10n-tree">Tree</h1>\n <div id="view-tree" class="button view">\n <img src="'+l.image("tree-toggle")+'" alt="view-tree"/>\n </div>\n </div>',m="ext/tree",v=function(e){for(;!e._item&&e.parentNode;)e=e.parentNode;return e._item},b=function(e){var t=v(e.target);"unknown"===t._treeState?t.fetchContent().then(function(){t._treeState="open",y(t)}):"open"===t._treeState?(t._treeState="closed",t._$tree.rmCls("open").addCls("closed")):"closed"===t._treeState&&(t._treeState="open",t._$tree.rmCls("closed").addCls("open"))},w=function(e,t){var n=e.label,r=t.label;return p.ignorecase&&(n=n.toLowerCase(),r=r.toLowerCase()),p.naturalSort?s(n,r
|