mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-19 03:48:18 -07:00
1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
|
!function t(r,o,i){function n(a,h){if(!o[a]){if(!r[a]){var u="function"==typeof require&&require;if(!h&&u)return u(a,!0);if(e)return e(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var c=o[a]={exports:{}};r[a][0].call(c.exports,function(t){var o=r[a][1][t];return n(o?o:t)},c,c.exports,t,r,o,i)}return o[a].exports}for(var e="function"==typeof require&&require,a=0;a<i.length;a++)n(i[a]);return n}({1:[function(t,r,o){if(!i)var i={map:function(t,r){var o={};return r?t.map(function(t,i){return o.index=i,r.call(o,t)}):t.slice()},naturalOrder:function(t,r){return r>t?-1:t>r?1:0},sum:function(t,r){var o={};return t.reduce(r?function(t,i,n){return o.index=n,t+r.call(o,i)}:function(t,r){return t+r},0)},max:function(t,r){return Math.max.apply(null,r?i.map(t,r):t)}};var n=function(){function t(t,r,o){return(t<<2*s)+(r<<s)+o}function r(t){function r(){o.sort(t),i=!0}var o=[],i=!1;return{push:function(t){o.push(t),i=!1},peek:function(t){return i||r(),void 0===t&&(t=o.length-1),o[t]},pop:function(){return i||r(),o.pop()},size:function(){return o.length},map:function(t){return o.map(t)},debug:function(){return i||r(),o}}}function o(t,r,o,i,n,e,a){var h=this;h.r1=t,h.r2=r,h.g1=o,h.g2=i,h.b1=n,h.b2=e,h.histo=a}function n(){this.vboxes=new r(function(t,r){return i.naturalOrder(t.vbox.count()*t.vbox.volume(),r.vbox.count()*r.vbox.volume())})}function e(r){var o,i,n,e,a=1<<3*s,h=new Array(a);return r.forEach(function(r){i=r[0]>>c,n=r[1]>>c,e=r[2]>>c,o=t(i,n,e),h[o]=(h[o]||0)+1}),h}function a(t,r){var i,n,e,a=1e6,h=0,u=1e6,s=0,p=1e6,f=0;return t.forEach(function(t){i=t[0]>>c,n=t[1]>>c,e=t[2]>>c,a>i?a=i:i>h&&(h=i),u>n?u=n:n>s&&(s=n),p>e?p=e:e>f&&(f=e)}),new o(a,h,u,s,p,f,r)}function h(r,o){function n(t){var r,i,n,e,a,h=t+"1",u=t+"2",c=0;for(s=o[h];s<=o[u];s++)if(v[s]>A/2){for(n=o.copy(),e=o.copy(),r=s-o[h],i=o[u]-s,a=i>=r?Math.min(o[u]-1,~~(s+i/2)):Math.max(o[h],~~(s-1-r/2));!v[a];)a++;for(c=T[a];!c&&v[a-1];)c=T[--a];return n[u]=a,e[h]=n[u]+1,[n,e]}}if(o.count()){var e=o.r2-o.r1+1,a=o.g2-o.g1+1,h=o.b2-o.b1+1,u=i.max([e,a,h]);if(1==o.count())return[o.copy()];var s,c,p,f,l,A=0,v=[],T=[];if(u==e)for(s=o.r1;s<=o.r2;s++){for(f=0,c=o.g1;c<=o.g2;c++)for(p=o.b1;p<=o.b2;p++)l=t(s,c,p),f+=r[l]||0;A+=f,v[s]=A}else if(u==a)for(s=o.g1;s<=o.g2;s++){for(f=0,c=o.r1;c<=o.r2;c++)for(p=o.b1;p<=o.b2;p++)l=t(c,s,p),f+=r[l]||0;A+=f,v[s]=A}else for(s=o.b1;s<=o.b2;s++){for(f=0,c=o.r1;c<=o.r2;c++)for(p=o.g1;p<=o.g2;p++)l=t(c,p,s),f+=r[l]||0;A+=f,v[s]=A}return v.forEach(function(t,r){T[r]=A-t}),n(u==e?"r":u==a?"g":"b")}}function u(t,o){function u(t,r){for(var o,i=1,n=0;p>n;)if(o=t.pop(),o.count()){var e=h(s,o),a=e[0],u=e[1];if(!a)return;if(t.push(a),u&&(t.push(u),i++),i>=r)return;if(n++>p)return}else t.push(o),n++}if(!t.length||2>o||o>256)return!1;var s=e(t),c=0;s.forEach(function(){c++});var l=a(t,s),A=new r(function(t,r){return i.naturalOrder(t.count(),r.count())});A.push(l),u(A,f*o);for(var v=new r(function(t,r){return i.naturalOrder(t.count()*t.volume(),r.count()*r.volume())});A.size();)v.push(A.pop());u(v,o-v.size());for(var T=new n;v.size();)T.push(v.pop());return T}var s=5,c=8-s,p=1e3,f=.75;return o.prototype={volume:function(t){var r=this;return(!r._volume||t)&&(r._volume=(r.r2-r.r1+1)*(r.g2-r.g1+1)*(r.b2-r.b1+1)),r._volume},count:function(r){var o=this,i=o.histo;if(!o._count_set||r){var n,e,a,h,u=0;for(n=o.r1;n<=o.r2;n++)for(e=o.g1;e<=o.g2;e++)for(a=o.b1;a<=o.b2;a++)h=t(n,e,a),u+=i[h]||0;o._count=u,o._count_set=!0}return o._count},copy:function(){var t=this;return new o(t.r1,t.r2,t.g1,t.g2,t.b1,t.b2,t.histo)},avg:function(r){var o=this,i=o.histo;if(!o._avg||r){var n,e,a,h,u,c=0,p=1<<8-s,f=0,l=0,A=0;for(e=o.r1;e<=o.r2;e++)for(a=o.g1;a<=o.g2;a++)for(h=o.b1;h<=o.b2;h++)u=t(e,a,h),n=i[u]||0,c+=n,f+=n*(e+.5)*p,l+=n*(a+.5)*p,A+=n*(h+.5)*p;c?o._avg=[~~(f/c),~~(l/c),~~(A/c)]:o._avg=[~~(p*(o.r1+o.r2+1)/2),~~(p*(o.g1+o.g2+1)/2),~~(p*(o.b1+o.b2+1)/2)]}return o._avg},contains:function(t){var r=this,o=t[0]>>c;return gval=t[1]>>c,bval=t[2]>>c,o>=r.r1&&o<=r.r2&&gval>=r.g1&&gval<=r.g2&&bval>=r.b1&&bval<=r.b2}},n.prototype={push:functio
|