PageSourceSearch

https://ams-osram.com/o/ams-osram-frontend-loader/assets/smartcrop.642cf748d06f0da4e250.js

js ams-osram.com collected 2026-10-02 04:05:55 UTC 6,417 bytes, 2 lines download raw bytes

1(self.webpackChunk=self.webpackChunk||[]).push([[1908],{31718:function(t,e,r){var i;!function(){"use strict";var a={};function n(t,e,r){for(var i=r.data,a=r.width,n=~~t.x,o=~~(t.x+t.width),h=~~t.y,s=~~(t.y+t.height),u=255*t.weight,d=h;d<s;d++)for(var g=n;g<o;g++){i[4*(d*a+g)+3]+=u}}function o(t,e,r){for(var i={detail:0,saturation:0,skin:0,boost:0,total:0},a=e.data,n=t.scoreDownSample,o=1/n,s=e.height*n,u=e.width*n,d=e.width,g=0;g<s;g+=n)for(var c=0;c<u;c+=n){var l=4*(~~(g*o)*d+~~(c*o)),f=h(t,r,c,g),p=a[l+1]/255;i.skin+=a[l]/255*(p+t.skinBias)*f,i.detail+=p*f,i.saturation+=a[l+2]/255*(p+t.saturationBias)*f,i.boost+=a[l+3]/255*f}return i.total=(i.detail*t.detailWeight+i.skin*t.skinWeight+i.saturation*t.saturationWeight+i.boost*t.boostWeight)/(r.width*r.height),i}function h(t,e,r,i){if(e.x>r||r>=e.x+e.width||e.y>i||i>=e.y+e.height)return t.outsideImportance;r=(r-e.x)/e.width,i=(i-e.y)/e.height;var a=2*p(.5-r),n=2*p(.5-i),o=Math.max(a-1+t.edgeRadius,0),h=Math.max(n-1+t.edgeRadius,0),s=(o*o+h*h)*t.edgeWeight,u=1.41-v(a*a+n*n);return t.ruleOfThirds&&(u+=1.2*Math.max(0,u+s+.5)*(m(a)+m(n))),u+s}function s(t,e,r,i){var a=v(e*e+r*r+i*i),n=e/a-t.skinColor[0],o=r/a-t.skinColor[1],h=i/a-t.skinColor[2];return 1-v(n*n+o*o+h*h)}function u(t,e,r){this.width=t,this.height=e,this.data=r?new Uint8ClampedArray(r):new Uint8ClampedArray(t*e*4)}function d(t,e){for(var r=t.data,i=t.width,a=Math.floor(t.width/e),n=Math.floor(t.height/e),o=new u(a,n),h=o.data,s=1/(e*e),d=0;d<n;d++)for(var g=0;g<a;g++){for(var c=4*(d*a+g),l=0,f=0,p=0,v=0,w=0,m=0,x=0;x<e;x++)for(var k=0;k<e;k++){var b=4*((d*e+x)*i+(g*e+k));l+=r[b],f+=r[b+1],p+=r[b+2],v+=r[b+3],w=Math.max(w,r[b]),m=Math.max(m,r[b+1])}h[c]=l*s*.5+.5*w,h[c+1]=f*s*.7+.3*m,h[c+2]=p*s,h[c+3]=v*s}return o}function g(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,r}function c(t){return{open:function(e){var r=e.naturalWidth||e.width,i=e.naturalHeight||e.height,n=t(r,i),o=n.getContext("2d");return!e.naturalWidth||e.naturalWidth==e.width&&e.naturalHeight==e.height?(n.width=e.width,n.height=e.height):(n.width=e.naturalWidth,n.height=e.naturalHeight),o.drawImage(e,0,0),a.Promise.resolve(n)},resample:function(e,r,i){return Promise.resolve(e).then(function(e){var n=t(~~r,~~i);return n.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,n.width,n.height),a.Promise.resolve(n)})},getData:function(t){return Promise.resolve(t).then(function(t){var e=t.getContext("2d").getImageData(0,0,t.width,t.height);return new u(t.width,t.height,e.data)})}}}a.Promise="undefined"!=typeof Promise?Promise:function(){throw new Error("No native promises and smartcrop.Promise not set.")},a.DEFAULTS={width:0,height:0,aspect:0,cropWidth:0,cropHeight:0,detailWeight:.2,skinColor:[.78,.57,.44],skinBias:.01,skinBrightnessMin:.2,skinBrightnessMax:1,skinThreshold:.8,skinWeight:1.8,saturationBrightnessMin:.05,saturationBrightnessMax:.9,saturationThreshold:.4,saturationBias:.2,saturationWeight:.1,scoreDownSample:8,step:8,scaleStep:.1,minScale:1,maxScale:1,edgeRadius:.4,edgeWeight:-20,outsideImportance:-.5,boostWeight:100,ruleOfThirds:!0,prescale:!0,imageOperations:null,canvasFactory:g,debug:!1},a.crop=function(t,e,r){var i=w({},a.DEFAULTS,e);i.aspect&&(i.width=i.aspect,i.height=1),null===i.imageOperations&&(i.imageOperations=c(i.canvasFactory));var h=i.imageOperations,g=1,p=1;return h.open(t,i.input).then(function(t){return i.width&&i.height&&(g=l(t.width/i.width,t.height/i.height),i.cropWidth=~~(i.width*g),i.cropHeight=~~(i.height*g),i.minScale=l(i.maxScale,f(1/g,i.minScale)),!1!==i.prescale&&((p=l(f(256/t.width,256/t.height),1))<1?(t=h.resample(t,t.width*p,t.height*p),i.cropWidth=~~(i.cropWidth*p),i.cropHeight=~~(i.cropHeight*p),i.boost&&(i.boost=i.boost.map(function(t){return{x:~~(t.x*p),y:~~(t.y*p),width:~~(t.width*p),height:~~(t.height*p),weight:t.weight}}))):p=1)),t}).then(function(t){return h.getData(t).then(function(t){for(var e=function(t,e){var r={},i=new u(e.width,e.height);(function(t,e){for(var r=t.data,i=e.data,a=t.width,n=t.height,o=0;o<n;o++)for(var h=0;h<a;h++){var s,u=4*(o*a+h);s=0===h||h>=a-1||0===o||o>=n-1?k(r,u):4*k(r,u)-k(r,u-4*a)-k(r,u-4)-k(r,u+4)-k(r,u+4*a),i[u+1]=s}})(e,i),function(t,e,r){for(var i=e.data,a=r.data,n=e.width,o=e.height,h=0;h<o;h++)for(var u=0;u<n;u++){var d=4*(h*n+u),g=x(i[d],i[d+1],i[d+2])/255,c=s(t,i[d],i[d+1],i[d+2]),l=c>t.skinThreshold,f=g>=t.skinBrightnessMin&&g<=t.skinBrightnessMax;a[d]=l&&f?(c-t.skinThreshold)*(255/(1-t.skinThreshold)):0}}(t,e,i),function(t,e,r){for(var i=e.data,a=r.data,n=e.width,o=e.height,h=0;h<o;h++)for(var s=0;s<n;s++){var u=4*(h*n+s),d=x(i[u],i[u+1],i[u+2])/255,g=b(i[u],i[u+1],i[u+2]),c=g>t.saturationThreshold,l=d>=t.saturationBrightnessMin&&d<=t.saturationBrightnessMax;a[u+2]=l&&c?(g-t.saturationThreshold)*(255/(1-t.saturationThreshold)):0}}(t,e,i),function(t,e){if(!t.boost)return;for(var r=e.data,i=0;i<e.width;i+=4)r[i+3]=0;for(i=0;i<t.boost.length;i++)n(t.boost[i],t,e)}(t,i);for(var a=d(i,t.scoreDownSample),h=-1/0,g=null,c=function(t,e,r){for(var i=[],a=l(e,r),n=t.cropWidth||a,o=t.cropHeight||a,h=t.maxScale;h>=t.minScale;h-=t.scaleStep)for(var s=0;s+o*h<=r;s+=t.step)for(var u=0;u+n*h<=e;u+=t.step)i.push({x:u,y:s,width:n*h,height:o*h});return i}(t,e.width,e.height),f=0,p=c.length;f<p;f++){var v=c[f];v.score=o(t,a,v),v.score.total>h&&(g=v,h=v.score.total)}r.topCrop=g,t.debug&&g&&(r.crops=c,r.debugOutput=i,r.debugOptions=t,r.debugTopCrop=w({},r.topCrop));return r}(i,t),a=e.crops||[e.topCrop],h=0,g=a.length;h<g;h++){var c=a[h];c.x=~~(c.x/p),c.y=~~(c.y/p),c.width=~~(c.width/p),c.height=~~(c.height/p)}return r&&r(e),e})})},a.isAvailable=function(t){if(!a.Promise)return!1;if((t?t.canvasFactory:g)===g&&!document.createElement("canvas").getContext("2d"))return!1;return!0},a.importance=h,a.ImgData=u,a._downSample=d,a._canvasImageOperations=c;var l=Math.min,f=Math.max,p=Math.abs,v=Math.sqrt;function w(t){for(var e=1,r=arguments.length;e<r;e++){var i=arguments[e];if(i)for(var a in i)t[a]=i[a]}return t}function m(t){return t=16*((t-1/3+1)%2*.5-.5),Math.max(1-t*t,0)}function x(t,e,r){return.5126*r+.7152*e+.0722*t}function k(t,e){return x(t[e],t[e+1],t[e+2])}function b(t,e,r){var i=f(t/255,e/255,r/255),a=l(t/255,e/255,r/255);if(i===a)return 0;var n=i-a;return(i+a)/2>.5?n/(2-i-a):n/(i+a)}void 0===(i=function(){return a}.call(e,r,e,t))||(t.exports=i),e.smartcrop=a,t.exports=a}()}}]);
2//# sourceMappingURL=smartcrop.642cf748d06f0da4e250.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.