diff --git a/docs/assets/find-solution-9f4918d6.js b/docs/assets/find-solution-c2a69917.js similarity index 88% rename from docs/assets/find-solution-9f4918d6.js rename to docs/assets/find-solution-c2a69917.js index e925f89..af37568 100644 --- a/docs/assets/find-solution-9f4918d6.js +++ b/docs/assets/find-solution-c2a69917.js @@ -2,4 +2,4 @@ var Ze=Object.defineProperty;var Je=(m,d,v)=>d in m?Ze(m,d,{enumerable:!0,config * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 - */const m=Symbol("Comlink.proxy"),d=Symbol("Comlink.endpoint"),v=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),T=Symbol("Comlink.thrown"),D=t=>typeof t=="object"&&t!==null||typeof t=="function",wt={canHandle:t=>D(t)&&t[m],serialize(t){const{port1:e,port2:r}=new MessageChannel;return z(t,e),[r,[r]]},deserialize(t){return t.start(),At(t)}},St={canHandle:t=>D(t)&&T in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},V=new Map([["proxy",wt],["throw",St]]);function _t(t,e){for(const r of t)if(e===r||r==="*"||r instanceof RegExp&&r.test(e))return!0;return!1}function z(t,e=globalThis,r=["*"]){e.addEventListener("message",function n(a){if(!a||!a.data)return;if(!_t(r,a.origin)){console.warn(`Invalid origin '${a.origin}' for comlink proxy`);return}const{id:o,type:u,path:i}=Object.assign({path:[]},a.data),s=(a.data.argumentList||[]).map(w);let l;try{const g=i.slice(0,-1).reduce((y,j)=>y[j],t),p=i.reduce((y,j)=>y[j],t);switch(u){case"GET":l=p;break;case"SET":g[i.slice(-1)[0]]=w(a.data.value),l=!0;break;case"APPLY":l=p.apply(g,s);break;case"CONSTRUCT":{const y=new p(...s);l=Rt(y)}break;case"ENDPOINT":{const{port1:y,port2:j}=new MessageChannel;z(t,j),l=Tt(y,[y])}break;case"RELEASE":l=void 0;break;default:return}}catch(g){l={value:g,[T]:0}}Promise.resolve(l).catch(g=>({value:g,[T]:0})).then(g=>{const[p,y]=I(g);e.postMessage(Object.assign(Object.assign({},p),{id:o}),y),u==="RELEASE"&&(e.removeEventListener("message",n),B(e),M in t&&typeof t[M]=="function"&&t[M]())}).catch(g=>{const[p,y]=I({value:new TypeError("Unserializable return value"),[T]:0});e.postMessage(Object.assign(Object.assign({},p),{id:o}),y)})}),e.start&&e.start()}function Ot(t){return t.constructor.name==="MessagePort"}function B(t){Ot(t)&&t.close()}function At(t,e){return $(t,[],e)}function R(t){if(t)throw new Error("Proxy has been released and is not useable")}function G(t){return S(t,{type:"RELEASE"}).then(()=>{B(t)})}const k=new WeakMap,C="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(k.get(t)||0)-1;k.set(t,e),e===0&&G(t)});function bt(t,e){const r=(k.get(e)||0)+1;k.set(e,r),C&&C.register(t,e,t)}function Et(t){C&&C.unregister(t)}function $(t,e=[],r=function(){}){let n=!1;const a=new Proxy(r,{get(o,u){if(R(n),u===v)return()=>{Et(a),G(t),n=!0};if(u==="then"){if(e.length===0)return{then:()=>a};const i=S(t,{type:"GET",path:e.map(s=>s.toString())}).then(w);return i.then.bind(i)}return $(t,[...e,u])},set(o,u,i){R(n);const[s,l]=I(i);return S(t,{type:"SET",path:[...e,u].map(g=>g.toString()),value:s},l).then(w)},apply(o,u,i){R(n);const s=e[e.length-1];if(s===d)return S(t,{type:"ENDPOINT"}).then(w);if(s==="bind")return $(t,e.slice(0,-1));const[l,g]=X(i);return S(t,{type:"APPLY",path:e.map(p=>p.toString()),argumentList:l},g).then(w)},construct(o,u){R(n);const[i,s]=X(u);return S(t,{type:"CONSTRUCT",path:e.map(l=>l.toString()),argumentList:i},s).then(w)}});return bt(a,t),a}function jt(t){return Array.prototype.concat.apply([],t)}function X(t){const e=t.map(I);return[e.map(r=>r[0]),jt(e.map(r=>r[1]))]}const Y=new WeakMap;function Tt(t,e){return Y.set(t,e),t}function Rt(t){return Object.assign(t,{[m]:!0})}function I(t){for(const[e,r]of V)if(r.canHandle(t)){const[n,a]=r.serialize(t);return[{type:"HANDLER",name:e,value:n},a]}return[{type:"RAW",value:t},Y.get(t)||[]]}function w(t){switch(t.type){case"HANDLER":return V.get(t.name).deserialize(t.value);case"RAW":return t.value}}function S(t,e,r){return new Promise(n=>{const a=kt();t.addEventListener("message",function o(u){!u.data||!u.data.id||u.data.id!==a||(t.removeEventListener("message",o),n(u.data))}),t.start&&t.start(),t.postMessage(Object.assign({id:a},e),r)})}function kt(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function c(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function h(t){return function e(r){return arguments.length===0||c(r)?e:t.apply(this,arguments)}}function f(t){return function e(r,n){switch(arguments.length){case 0:return e;case 1:return c(r)?e:h(function(a){return t(r,a)});default:return c(r)&&c(n)?e:c(r)?h(function(a){return t(a,n)}):c(n)?h(function(a){return t(r,a)}):t(r,n)}}}function Z(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,n){return e.apply(this,arguments)};case 3:return function(r,n,a){return e.apply(this,arguments)};case 4:return function(r,n,a,o){return e.apply(this,arguments)};case 5:return function(r,n,a,o,u){return e.apply(this,arguments)};case 6:return function(r,n,a,o,u,i){return e.apply(this,arguments)};case 7:return function(r,n,a,o,u,i,s){return e.apply(this,arguments)};case 8:return function(r,n,a,o,u,i,s,l){return e.apply(this,arguments)};case 9:return function(r,n,a,o,u,i,s,l,g){return e.apply(this,arguments)};case 10:return function(r,n,a,o,u,i,s,l,g,p){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function J(t){return function e(r,n,a){switch(arguments.length){case 0:return e;case 1:return c(r)?e:f(function(o,u){return t(r,o,u)});case 2:return c(r)&&c(n)?e:c(r)?f(function(o,u){return t(o,n,u)}):c(n)?f(function(o,u){return t(r,o,u)}):h(function(o){return t(r,n,o)});default:return c(r)&&c(n)&&c(a)?e:c(r)&&c(n)?f(function(o,u){return t(o,u,a)}):c(r)&&c(a)?f(function(o,u){return t(o,n,u)}):c(n)&&c(a)?f(function(o,u){return t(r,o,u)}):c(r)?h(function(o){return t(o,n,a)}):c(n)?h(function(o){return t(r,o,a)}):c(a)?h(function(o){return t(r,n,o)}):t(r,n,a)}}}var _=Array.isArray||function(e){return e!=null&&e.length>=0&&Object.prototype.toString.call(e)==="[object Array]"};function Ct(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function It(t,e,r){return function(){if(arguments.length===0)return r();var n=arguments[arguments.length-1];if(!_(n)){for(var a=0;a=0;)r=rt[n],O(r,e)&&!Lt(a,r)&&(a[a.length]=r),n-=1;return a}),A=qt,Ft=h(function(e){return e===null?"Null":e===void 0?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}),at=Ft;function ot(t,e,r,n){var a=K(t),o=K(e);function u(i,s){return L(i,s,r.slice(),n.slice())}return!tt(function(i,s){return!tt(u,s,i)},o,a)}function L(t,e,r,n){if(N(t,e))return!0;var a=at(t);if(a!==at(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(a){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&Pt(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&N(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!N(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var o=r.length-1;o>=0;){if(r[o]===t)return n[o]===e;o-=1}switch(a){case"Map":return t.size!==e.size?!1:ot(t.entries(),e.entries(),r.concat([t]),n.concat([e]));case"Set":return t.size!==e.size?!1:ot(t.values(),e.values(),r.concat([t]),n.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var u=A(t);if(u.length!==A(e).length)return!1;var i=r.concat([t]),s=n.concat([e]);for(o=u.length-1;o>=0;){var l=u[o];if(!(O(l,e)&&L(e[l],t[l],i,s)))return!1;o-=1}return!0}var Ht=f(function(e,r){return L(e,r,[],[])}),Ut=Ht;function Wt(t,e,r){var n,a;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(n=1/e;r=0}function q(t,e){for(var r=0,n=e.length,a=Array(n);r":st(u,i)},n=function(o,u){return q(function(i){return F(i)+": "+r(o[i])},u.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+q(r,t).join(", ")+"))";case"[object Array]":return"["+q(r,t).concat(n(t,it(function(o){return/^\d+$/.test(o)},A(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):F(Vt(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":F(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var a=t.toString();if(a!=="[object Object]")return a}return"{"+n(t,A(t)).join(", ")+"}"}}var te=h(function(e){return st(e,[])}),H=te,ee=Number.isInteger||function(e){return e<<0===e};function P(t){return Object.prototype.toString.call(t)==="[object String]"}var re=f(function(e,r){var n=e<0?r.length+e:e;return P(r)?r.charAt(n):r[n]}),ct=re,ne=f(function(e,r){if(r!=null)return ee(e)?ct(e,r):r[e]}),ae=ne,oe=h(function(e){return _(e)?!0:!e||typeof e!="object"||P(e)?!1:e.length===0?!0:e.length>0?e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1):!1}),ue=oe,lt=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function ie(t,e,r){return function(a,o,u){if(ue(u))return t(a,o,u);if(u==null)return o;if(typeof u["fantasy-land/reduce"]=="function")return e(a,o,u,"fantasy-land/reduce");if(u[lt]!=null)return r(a,o,u[lt]());if(typeof u.next=="function")return r(a,o,u);if(typeof u.reduce=="function")return e(a,o,u,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function se(t,e,r){for(var n=0,a=r.length;nu?1:0})}),yt=Ne;$e(1,18).map(t=>`./images/${t}.jpg`);const Le=500,qe=11,Fe=.85,He=({sizeHomogeneity:t,score:e})=>e*t,Ue=t=>t.length>0,We=t=>{const e=it(({score:n})=>n0?e:t);return ke({pictures:yt(ae("url"))},r)},xe=t=>"url"in t,E=(t,e,r)=>{if(xe(r))return[{position:t,dimension:e,url:r.url}];if(r.horizontal){const n=e.height*r.first.aspectRatio,a={x:t.x+n,y:t.y},o={width:n,height:e.height},i={width:e.width-n,height:e.height};return ht(E(t,o,r.first),E(a,i,r.second))}else{const n=e.width/r.first.aspectRatio,a={x:t.x,y:t.y+n},o={width:e.width,height:n},u=e.height-n,i={width:e.width,height:u};return ht(E(t,o,r.first),E(a,i,r.second))}},De=t=>{const e=Math.max(...t.map(o=>o.width)),r=Math.max(...t.map(o=>o.height)),n=Math.min(...t.map(o=>o.width)),a=Math.min(...t.map(o=>o.height));return(n/e+a/r)/2},Ve=(t,e,r)=>{const n=E({x:0,y:0},t,r),a=De(n.map(o=>o.dimension));return{dimension:t,score:e,sizeHomogeneity:a,pictures:n}};class U{constructor(e,r,n){vt(this,"aspectRatio",0);this.horizontal=e,this.first=r,this.second=n;const a=r.aspectRatio+n.aspectRatio;this.aspectRatio=e?a:r.aspectRatio*n.aspectRatio/a}}const W=(t,e)=>t+Math.random()*(e-t+1)|0;function*x(t){if(t.length===1)yield t[0];else for(let e=1;enew U(!!W(0,1),t,e),mt=t=>{const e=t.length-1;if(e===0)return t[0];if(e===1)return dt(t[0],t[1]);const r=W(0,e);let n;do n=W(0,e);while(r===n);const a=dt(t[r],t[n]);return mt(t.with(r,a).toSpliced(n,1))};function*Be(t){for(;;)yield mt(t)}const Ge=(t,e)=>{const r=t.height*e;if(r<=t.width)return{width:r,height:t.height};{const n=t.width/e;return{width:t.width,height:n}}},Xe={maxComputationTime:Le,randomizeThreshold:qe};var Ye=Object.freeze({__proto__:null,findSolution:(t,e,r)=>{const n=Me(r??{},Xe),a=Date.now(),o=e.width/e.height,u=[];console.log(t.lengthn.maxComputationTime){console.log("computation took too long, aborting");break}}if(!Ue(u))throw new Error("No solution");return We(u)}});z(Ye)})(); + */const m=Symbol("Comlink.proxy"),d=Symbol("Comlink.endpoint"),v=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),T=Symbol("Comlink.thrown"),D=t=>typeof t=="object"&&t!==null||typeof t=="function",wt={canHandle:t=>D(t)&&t[m],serialize(t){const{port1:e,port2:r}=new MessageChannel;return z(t,e),[r,[r]]},deserialize(t){return t.start(),At(t)}},St={canHandle:t=>D(t)&&T in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},V=new Map([["proxy",wt],["throw",St]]);function _t(t,e){for(const r of t)if(e===r||r==="*"||r instanceof RegExp&&r.test(e))return!0;return!1}function z(t,e=globalThis,r=["*"]){e.addEventListener("message",function n(a){if(!a||!a.data)return;if(!_t(r,a.origin)){console.warn(`Invalid origin '${a.origin}' for comlink proxy`);return}const{id:o,type:u,path:i}=Object.assign({path:[]},a.data),s=(a.data.argumentList||[]).map(w);let l;try{const g=i.slice(0,-1).reduce((y,j)=>y[j],t),p=i.reduce((y,j)=>y[j],t);switch(u){case"GET":l=p;break;case"SET":g[i.slice(-1)[0]]=w(a.data.value),l=!0;break;case"APPLY":l=p.apply(g,s);break;case"CONSTRUCT":{const y=new p(...s);l=Rt(y)}break;case"ENDPOINT":{const{port1:y,port2:j}=new MessageChannel;z(t,j),l=Tt(y,[y])}break;case"RELEASE":l=void 0;break;default:return}}catch(g){l={value:g,[T]:0}}Promise.resolve(l).catch(g=>({value:g,[T]:0})).then(g=>{const[p,y]=I(g);e.postMessage(Object.assign(Object.assign({},p),{id:o}),y),u==="RELEASE"&&(e.removeEventListener("message",n),B(e),M in t&&typeof t[M]=="function"&&t[M]())}).catch(g=>{const[p,y]=I({value:new TypeError("Unserializable return value"),[T]:0});e.postMessage(Object.assign(Object.assign({},p),{id:o}),y)})}),e.start&&e.start()}function Ot(t){return t.constructor.name==="MessagePort"}function B(t){Ot(t)&&t.close()}function At(t,e){return $(t,[],e)}function R(t){if(t)throw new Error("Proxy has been released and is not useable")}function G(t){return S(t,{type:"RELEASE"}).then(()=>{B(t)})}const k=new WeakMap,C="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(k.get(t)||0)-1;k.set(t,e),e===0&&G(t)});function bt(t,e){const r=(k.get(e)||0)+1;k.set(e,r),C&&C.register(t,e,t)}function Et(t){C&&C.unregister(t)}function $(t,e=[],r=function(){}){let n=!1;const a=new Proxy(r,{get(o,u){if(R(n),u===v)return()=>{Et(a),G(t),n=!0};if(u==="then"){if(e.length===0)return{then:()=>a};const i=S(t,{type:"GET",path:e.map(s=>s.toString())}).then(w);return i.then.bind(i)}return $(t,[...e,u])},set(o,u,i){R(n);const[s,l]=I(i);return S(t,{type:"SET",path:[...e,u].map(g=>g.toString()),value:s},l).then(w)},apply(o,u,i){R(n);const s=e[e.length-1];if(s===d)return S(t,{type:"ENDPOINT"}).then(w);if(s==="bind")return $(t,e.slice(0,-1));const[l,g]=X(i);return S(t,{type:"APPLY",path:e.map(p=>p.toString()),argumentList:l},g).then(w)},construct(o,u){R(n);const[i,s]=X(u);return S(t,{type:"CONSTRUCT",path:e.map(l=>l.toString()),argumentList:i},s).then(w)}});return bt(a,t),a}function jt(t){return Array.prototype.concat.apply([],t)}function X(t){const e=t.map(I);return[e.map(r=>r[0]),jt(e.map(r=>r[1]))]}const Y=new WeakMap;function Tt(t,e){return Y.set(t,e),t}function Rt(t){return Object.assign(t,{[m]:!0})}function I(t){for(const[e,r]of V)if(r.canHandle(t)){const[n,a]=r.serialize(t);return[{type:"HANDLER",name:e,value:n},a]}return[{type:"RAW",value:t},Y.get(t)||[]]}function w(t){switch(t.type){case"HANDLER":return V.get(t.name).deserialize(t.value);case"RAW":return t.value}}function S(t,e,r){return new Promise(n=>{const a=kt();t.addEventListener("message",function o(u){!u.data||!u.data.id||u.data.id!==a||(t.removeEventListener("message",o),n(u.data))}),t.start&&t.start(),t.postMessage(Object.assign({id:a},e),r)})}function kt(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function c(t){return t!=null&&typeof t=="object"&&t["@@functional/placeholder"]===!0}function h(t){return function e(r){return arguments.length===0||c(r)?e:t.apply(this,arguments)}}function f(t){return function e(r,n){switch(arguments.length){case 0:return e;case 1:return c(r)?e:h(function(a){return t(r,a)});default:return c(r)&&c(n)?e:c(r)?h(function(a){return t(a,n)}):c(n)?h(function(a){return t(r,a)}):t(r,n)}}}function Z(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,n){return e.apply(this,arguments)};case 3:return function(r,n,a){return e.apply(this,arguments)};case 4:return function(r,n,a,o){return e.apply(this,arguments)};case 5:return function(r,n,a,o,u){return e.apply(this,arguments)};case 6:return function(r,n,a,o,u,i){return e.apply(this,arguments)};case 7:return function(r,n,a,o,u,i,s){return e.apply(this,arguments)};case 8:return function(r,n,a,o,u,i,s,l){return e.apply(this,arguments)};case 9:return function(r,n,a,o,u,i,s,l,g){return e.apply(this,arguments)};case 10:return function(r,n,a,o,u,i,s,l,g,p){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function J(t){return function e(r,n,a){switch(arguments.length){case 0:return e;case 1:return c(r)?e:f(function(o,u){return t(r,o,u)});case 2:return c(r)&&c(n)?e:c(r)?f(function(o,u){return t(o,n,u)}):c(n)?f(function(o,u){return t(r,o,u)}):h(function(o){return t(r,n,o)});default:return c(r)&&c(n)&&c(a)?e:c(r)&&c(n)?f(function(o,u){return t(o,u,a)}):c(r)&&c(a)?f(function(o,u){return t(o,n,u)}):c(n)&&c(a)?f(function(o,u){return t(r,o,u)}):c(r)?h(function(o){return t(o,n,a)}):c(n)?h(function(o){return t(r,o,a)}):c(a)?h(function(o){return t(r,n,o)}):t(r,n,a)}}}var _=Array.isArray||function(e){return e!=null&&e.length>=0&&Object.prototype.toString.call(e)==="[object Array]"};function Ct(t){return t!=null&&typeof t["@@transducer/step"]=="function"}function It(t,e,r){return function(){if(arguments.length===0)return r();var n=arguments[arguments.length-1];if(!_(n)){for(var a=0;a=0;)r=rt[n],O(r,e)&&!Lt(a,r)&&(a[a.length]=r),n-=1;return a}),A=qt,Ft=h(function(e){return e===null?"Null":e===void 0?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}),at=Ft;function ot(t,e,r,n){var a=K(t),o=K(e);function u(i,s){return L(i,s,r.slice(),n.slice())}return!tt(function(i,s){return!tt(u,s,i)},o,a)}function L(t,e,r,n){if(N(t,e))return!0;var a=at(t);if(a!==at(e))return!1;if(typeof t["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof t["fantasy-land/equals"]=="function"&&t["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](t);if(typeof t.equals=="function"||typeof e.equals=="function")return typeof t.equals=="function"&&t.equals(e)&&typeof e.equals=="function"&&e.equals(t);switch(a){case"Arguments":case"Array":case"Object":if(typeof t.constructor=="function"&&Pt(t.constructor)==="Promise")return t===e;break;case"Boolean":case"Number":case"String":if(!(typeof t==typeof e&&N(t.valueOf(),e.valueOf())))return!1;break;case"Date":if(!N(t.valueOf(),e.valueOf()))return!1;break;case"Error":return t.name===e.name&&t.message===e.message;case"RegExp":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var o=r.length-1;o>=0;){if(r[o]===t)return n[o]===e;o-=1}switch(a){case"Map":return t.size!==e.size?!1:ot(t.entries(),e.entries(),r.concat([t]),n.concat([e]));case"Set":return t.size!==e.size?!1:ot(t.values(),e.values(),r.concat([t]),n.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var u=A(t);if(u.length!==A(e).length)return!1;var i=r.concat([t]),s=n.concat([e]);for(o=u.length-1;o>=0;){var l=u[o];if(!(O(l,e)&&L(e[l],t[l],i,s)))return!1;o-=1}return!0}var Ht=f(function(e,r){return L(e,r,[],[])}),Ut=Ht;function Wt(t,e,r){var n,a;if(typeof t.indexOf=="function")switch(typeof e){case"number":if(e===0){for(n=1/e;r=0}function q(t,e){for(var r=0,n=e.length,a=Array(n);r":st(u,i)},n=function(o,u){return q(function(i){return F(i)+": "+r(o[i])},u.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+q(r,t).join(", ")+"))";case"[object Array]":return"["+q(r,t).concat(n(t,it(function(o){return/^\d+$/.test(o)},A(t)))).join(", ")+"]";case"[object Boolean]":return typeof t=="object"?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):F(Vt(t)))+")";case"[object Map]":return"new Map("+r(Array.from(t))+")";case"[object Null]":return"null";case"[object Number]":return typeof t=="object"?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object Set]":return"new Set("+r(Array.from(t).sort())+")";case"[object String]":return typeof t=="object"?"new String("+r(t.valueOf())+")":F(t);case"[object Undefined]":return"undefined";default:if(typeof t.toString=="function"){var a=t.toString();if(a!=="[object Object]")return a}return"{"+n(t,A(t)).join(", ")+"}"}}var te=h(function(e){return st(e,[])}),H=te,ee=Number.isInteger||function(e){return e<<0===e};function P(t){return Object.prototype.toString.call(t)==="[object String]"}var re=f(function(e,r){var n=e<0?r.length+e:e;return P(r)?r.charAt(n):r[n]}),ct=re,ne=f(function(e,r){if(r!=null)return ee(e)?ct(e,r):r[e]}),ae=ne,oe=h(function(e){return _(e)?!0:!e||typeof e!="object"||P(e)?!1:e.length===0?!0:e.length>0?e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1):!1}),ue=oe,lt=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function ie(t,e,r){return function(a,o,u){if(ue(u))return t(a,o,u);if(u==null)return o;if(typeof u["fantasy-land/reduce"]=="function")return e(a,o,u,"fantasy-land/reduce");if(u[lt]!=null)return r(a,o,u[lt]());if(typeof u.next=="function")return r(a,o,u);if(typeof u.reduce=="function")return e(a,o,u,"reduce");throw new TypeError("reduce: list must be array or iterable")}}function se(t,e,r){for(var n=0,a=r.length;nu?1:0})}),yt=Ne;$e(1,18).map(t=>`./images/${t}.jpg`);const Le=500,qe=11,Fe=.9,He=({sizeHomogeneity:t,score:e})=>e*t,Ue=t=>t.length>0,We=t=>{const e=it(({score:n})=>n0?e:t);return ke({pictures:yt(ae("url"))},r)},xe=t=>"url"in t,E=(t,e,r)=>{if(xe(r))return[{position:t,dimension:e,url:r.url}];if(r.horizontal){const n=e.height*r.first.aspectRatio,a={x:t.x+n,y:t.y},o={width:n,height:e.height},i={width:e.width-n,height:e.height};return ht(E(t,o,r.first),E(a,i,r.second))}else{const n=e.width/r.first.aspectRatio,a={x:t.x,y:t.y+n},o={width:e.width,height:n},u=e.height-n,i={width:e.width,height:u};return ht(E(t,o,r.first),E(a,i,r.second))}},De=t=>{const e=Math.max(...t.map(o=>o.width)),r=Math.max(...t.map(o=>o.height)),n=Math.min(...t.map(o=>o.width)),a=Math.min(...t.map(o=>o.height));return(n/e+a/r)/2},Ve=(t,e,r)=>{const n=E({x:0,y:0},t,r),a=De(n.map(o=>o.dimension));return{dimension:t,score:e,sizeHomogeneity:a,pictures:n}};class U{constructor(e,r,n){vt(this,"aspectRatio",0);this.horizontal=e,this.first=r,this.second=n;const a=r.aspectRatio+n.aspectRatio;this.aspectRatio=e?a:r.aspectRatio*n.aspectRatio/a}}const W=(t,e)=>t+Math.random()*(e-t+1)|0;function*x(t){if(t.length===1)yield t[0];else for(let e=1;enew U(!!W(0,1),t,e),mt=t=>{const e=t.length-1;if(e===0)return t[0];if(e===1)return dt(t[0],t[1]);const r=W(0,e);let n;do n=W(0,e);while(r===n);const a=dt(t[r],t[n]);return mt(t.with(r,a).toSpliced(n,1))};function*Be(t){for(;;)yield mt(t)}const Ge=(t,e)=>{const r=t.height*e;if(r<=t.width)return{width:r,height:t.height};{const n=t.width/e;return{width:t.width,height:n}}},Xe={maxComputationTime:Le,randomizeThreshold:qe};var Ye=Object.freeze({__proto__:null,findSolution:(t,e,r)=>{const n=Me(r??{},Xe),a=Date.now(),o=e.width/e.height,u=[];console.log(t.lengthn.maxComputationTime){console.log("computation took too long, aborting");break}}if(!Ue(u))throw new Error("No solution");return We(u)}});z(Ye)})(); diff --git a/docs/assets/index-297d9624.js b/docs/assets/index-d7371230.js similarity index 99% rename from docs/assets/index-297d9624.js rename to docs/assets/index-d7371230.js index f4f91c7..160b289 100644 --- a/docs/assets/index-297d9624.js +++ b/docs/assets/index-d7371230.js @@ -81,7 +81,7 @@ Error generating stack: `+o.message+` * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 - */const hp=Symbol("Comlink.proxy"),Fv=Symbol("Comlink.endpoint"),Dv=Symbol("Comlink.releaseProxy"),kl=Symbol("Comlink.finalizer"),ji=Symbol("Comlink.thrown"),mp=e=>typeof e=="object"&&e!==null||typeof e=="function",Av={canHandle:e=>mp(e)&&e[hp],serialize(e){const{port1:t,port2:n}=new MessageChannel;return yp(e,t),[n,[n]]},deserialize(e){return e.start(),wp(e)}},Uv={canHandle:e=>mp(e)&&ji in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},gp=new Map([["proxy",Av],["throw",Uv]]);function Bv(e,t){for(const n of e)if(t===n||n==="*"||n instanceof RegExp&&n.test(t))return!0;return!1}function yp(e,t=globalThis,n=["*"]){t.addEventListener("message",function r(i){if(!i||!i.data)return;if(!Bv(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:o,type:l,path:u}=Object.assign({path:[]},i.data),s=(i.data.argumentList||[]).map(Gt);let a;try{const h=u.slice(0,-1).reduce((p,y)=>p[y],e),m=u.reduce((p,y)=>p[y],e);switch(l){case"GET":a=m;break;case"SET":h[u.slice(-1)[0]]=Gt(i.data.value),a=!0;break;case"APPLY":a=m.apply(h,s);break;case"CONSTRUCT":{const p=new m(...s);a=Kv(p)}break;case"ENDPOINT":{const{port1:p,port2:y}=new MessageChannel;yp(e,y),a=Yv(p,[p])}break;case"RELEASE":a=void 0;break;default:return}}catch(h){a={value:h,[ji]:0}}Promise.resolve(a).catch(h=>({value:h,[ji]:0})).then(h=>{const[m,p]=go(h);t.postMessage(Object.assign(Object.assign({},m),{id:o}),p),l==="RELEASE"&&(t.removeEventListener("message",r),vp(t),kl in e&&typeof e[kl]=="function"&&e[kl]())}).catch(h=>{const[m,p]=go({value:new TypeError("Unserializable return value"),[ji]:0});t.postMessage(Object.assign(Object.assign({},m),{id:o}),p)})}),t.start&&t.start()}function Wv(e){return e.constructor.name==="MessagePort"}function vp(e){Wv(e)&&e.close()}function wp(e,t){return Eu(e,[],t)}function yi(e){if(e)throw new Error("Proxy has been released and is not useable")}function Sp(e){return hn(e,{type:"RELEASE"}).then(()=>{vp(e)})}const ho=new WeakMap,mo="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(ho.get(e)||0)-1;ho.set(e,t),t===0&&Sp(e)});function Hv(e,t){const n=(ho.get(t)||0)+1;ho.set(t,n),mo&&mo.register(e,t,e)}function Vv(e){mo&&mo.unregister(e)}function Eu(e,t=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(o,l){if(yi(r),l===Dv)return()=>{Vv(i),Sp(e),r=!0};if(l==="then"){if(t.length===0)return{then:()=>i};const u=hn(e,{type:"GET",path:t.map(s=>s.toString())}).then(Gt);return u.then.bind(u)}return Eu(e,[...t,l])},set(o,l,u){yi(r);const[s,a]=go(u);return hn(e,{type:"SET",path:[...t,l].map(h=>h.toString()),value:s},a).then(Gt)},apply(o,l,u){yi(r);const s=t[t.length-1];if(s===Fv)return hn(e,{type:"ENDPOINT"}).then(Gt);if(s==="bind")return Eu(e,t.slice(0,-1));const[a,h]=gc(u);return hn(e,{type:"APPLY",path:t.map(m=>m.toString()),argumentList:a},h).then(Gt)},construct(o,l){yi(r);const[u,s]=gc(l);return hn(e,{type:"CONSTRUCT",path:t.map(a=>a.toString()),argumentList:u},s).then(Gt)}});return Hv(i,e),i}function Qv(e){return Array.prototype.concat.apply([],e)}function gc(e){const t=e.map(go);return[t.map(n=>n[0]),Qv(t.map(n=>n[1]))]}const kp=new WeakMap;function Yv(e,t){return kp.set(e,t),e}function Kv(e){return Object.assign(e,{[hp]:!0})}function go(e){for(const[t,n]of gp)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},kp.get(e)||[]]}function Gt(e){switch(e.type){case"HANDLER":return gp.get(e.name).deserialize(e.value);case"RAW":return e.value}}function hn(e,t,n){return new Promise(r=>{const i=Gv();e.addEventListener("message",function o(l){!l.data||!l.data.id||l.data.id!==i||(e.removeEventListener("message",o),r(l.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)})}function Gv(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const Xv=wp(new Worker(new URL("/diorama-2023/assets/find-solution-9f4918d6.js",self.location))),qv=(e,t,n)=>Xv.findSolution(e,t,n),Jv=(e,t)=>{const[n,r]=M.useState(0),{subscribe:i}=M.useContext(Ls),[o,l]=Tv(async()=>qv(e,t),[e.length,t.width,t.height,n]);return M.useLayoutEffect(()=>{t.width>0&&t.height>0&&l()},[l,e.length,t.width,t.height,n]),pp(()=>i(po.refresh,()=>r(Yd))),o},yc=Jg(ly(Qd)),Zv=e=>{const{subscribe:t}=M.useContext(Ls),[n,r]=M.useState(Qd(my,e));return pp(()=>{const i=t(po.addImage,()=>r(qa(Za,Yd,yc(e)))),o=t(po.removeImage,()=>r(qa(Za,bg,Eg(1),yc(e))));return()=>{i(),o()}}),n},bv=({picture:{position:e,dimension:t,url:n},scaleX:r,scaleY:i,idx:o})=>{const l=t.width/t.height;return Q.jsx("li",{className:"photo-frame",style:{rotate:`${o%4-1.5}deg`,left:e.x*r,top:e.y*i,aspectRatio:l,width:t.width*r,height:t.height*i},children:Q.jsx("img",{className:"photo",src:n,alt:""})})},e0=(e,t)=>{let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{t(...r)},e)}},t0=e=>({width:e.clientWidth,height:e.clientHeight}),n0=()=>{const e=M.useRef(null),[t,n]=M.useState({width:0,height:0});return M.useLayoutEffect(()=>{var l;const r=(l=e.current)==null?void 0:l.parentElement;if(!r)return;const i=e0(50,()=>{const u=t0(r);M.startTransition(()=>{n(s=>Ud(s,u)?s:u)})}),o=new ResizeObserver(i);return o.observe(r),()=>o.disconnect()},[e]),[e,t]},vc=(e,t,n)=>Ka(n,t)/Ka(n,e.dimension),r0=({images:e})=>{const[t,n]=n0(),r=Zv(e),{error:i,value:o}=Jv(r,n),l=M.useMemo(()=>Q.jsx("ol",{ref:t,className:"diorama-list",children:o==null?void 0:o.pictures.map((u,s)=>Q.jsx(bv,{picture:u,idx:s,scaleX:vc(o,n,"width"),scaleY:vc(o,n,"height")},u.url))}),[t,o]);return Hg(i)?l:Q.jsxs("div",{children:["Failed to layout: ",i.message]})},i0=Os.div` + */const hp=Symbol("Comlink.proxy"),Fv=Symbol("Comlink.endpoint"),Dv=Symbol("Comlink.releaseProxy"),kl=Symbol("Comlink.finalizer"),ji=Symbol("Comlink.thrown"),mp=e=>typeof e=="object"&&e!==null||typeof e=="function",Av={canHandle:e=>mp(e)&&e[hp],serialize(e){const{port1:t,port2:n}=new MessageChannel;return yp(e,t),[n,[n]]},deserialize(e){return e.start(),wp(e)}},Uv={canHandle:e=>mp(e)&&ji in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},gp=new Map([["proxy",Av],["throw",Uv]]);function Bv(e,t){for(const n of e)if(t===n||n==="*"||n instanceof RegExp&&n.test(t))return!0;return!1}function yp(e,t=globalThis,n=["*"]){t.addEventListener("message",function r(i){if(!i||!i.data)return;if(!Bv(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:o,type:l,path:u}=Object.assign({path:[]},i.data),s=(i.data.argumentList||[]).map(Gt);let a;try{const h=u.slice(0,-1).reduce((p,y)=>p[y],e),m=u.reduce((p,y)=>p[y],e);switch(l){case"GET":a=m;break;case"SET":h[u.slice(-1)[0]]=Gt(i.data.value),a=!0;break;case"APPLY":a=m.apply(h,s);break;case"CONSTRUCT":{const p=new m(...s);a=Kv(p)}break;case"ENDPOINT":{const{port1:p,port2:y}=new MessageChannel;yp(e,y),a=Yv(p,[p])}break;case"RELEASE":a=void 0;break;default:return}}catch(h){a={value:h,[ji]:0}}Promise.resolve(a).catch(h=>({value:h,[ji]:0})).then(h=>{const[m,p]=go(h);t.postMessage(Object.assign(Object.assign({},m),{id:o}),p),l==="RELEASE"&&(t.removeEventListener("message",r),vp(t),kl in e&&typeof e[kl]=="function"&&e[kl]())}).catch(h=>{const[m,p]=go({value:new TypeError("Unserializable return value"),[ji]:0});t.postMessage(Object.assign(Object.assign({},m),{id:o}),p)})}),t.start&&t.start()}function Wv(e){return e.constructor.name==="MessagePort"}function vp(e){Wv(e)&&e.close()}function wp(e,t){return Eu(e,[],t)}function yi(e){if(e)throw new Error("Proxy has been released and is not useable")}function Sp(e){return hn(e,{type:"RELEASE"}).then(()=>{vp(e)})}const ho=new WeakMap,mo="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(ho.get(e)||0)-1;ho.set(e,t),t===0&&Sp(e)});function Hv(e,t){const n=(ho.get(t)||0)+1;ho.set(t,n),mo&&mo.register(e,t,e)}function Vv(e){mo&&mo.unregister(e)}function Eu(e,t=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(o,l){if(yi(r),l===Dv)return()=>{Vv(i),Sp(e),r=!0};if(l==="then"){if(t.length===0)return{then:()=>i};const u=hn(e,{type:"GET",path:t.map(s=>s.toString())}).then(Gt);return u.then.bind(u)}return Eu(e,[...t,l])},set(o,l,u){yi(r);const[s,a]=go(u);return hn(e,{type:"SET",path:[...t,l].map(h=>h.toString()),value:s},a).then(Gt)},apply(o,l,u){yi(r);const s=t[t.length-1];if(s===Fv)return hn(e,{type:"ENDPOINT"}).then(Gt);if(s==="bind")return Eu(e,t.slice(0,-1));const[a,h]=gc(u);return hn(e,{type:"APPLY",path:t.map(m=>m.toString()),argumentList:a},h).then(Gt)},construct(o,l){yi(r);const[u,s]=gc(l);return hn(e,{type:"CONSTRUCT",path:t.map(a=>a.toString()),argumentList:u},s).then(Gt)}});return Hv(i,e),i}function Qv(e){return Array.prototype.concat.apply([],e)}function gc(e){const t=e.map(go);return[t.map(n=>n[0]),Qv(t.map(n=>n[1]))]}const kp=new WeakMap;function Yv(e,t){return kp.set(e,t),e}function Kv(e){return Object.assign(e,{[hp]:!0})}function go(e){for(const[t,n]of gp)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},kp.get(e)||[]]}function Gt(e){switch(e.type){case"HANDLER":return gp.get(e.name).deserialize(e.value);case"RAW":return e.value}}function hn(e,t,n){return new Promise(r=>{const i=Gv();e.addEventListener("message",function o(l){!l.data||!l.data.id||l.data.id!==i||(e.removeEventListener("message",o),r(l.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)})}function Gv(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const Xv=wp(new Worker(new URL("/diorama-2023/assets/find-solution-c2a69917.js",self.location))),qv=(e,t,n)=>Xv.findSolution(e,t,n),Jv=(e,t)=>{const[n,r]=M.useState(0),{subscribe:i}=M.useContext(Ls),[o,l]=Tv(async()=>qv(e,t),[e.length,t.width,t.height,n]);return M.useLayoutEffect(()=>{t.width>0&&t.height>0&&l()},[l,e.length,t.width,t.height,n]),pp(()=>i(po.refresh,()=>r(Yd))),o},yc=Jg(ly(Qd)),Zv=e=>{const{subscribe:t}=M.useContext(Ls),[n,r]=M.useState(Qd(my,e));return pp(()=>{const i=t(po.addImage,()=>r(qa(Za,Yd,yc(e)))),o=t(po.removeImage,()=>r(qa(Za,bg,Eg(1),yc(e))));return()=>{i(),o()}}),n},bv=({picture:{position:e,dimension:t,url:n},scaleX:r,scaleY:i,idx:o})=>{const l=t.width/t.height;return Q.jsx("li",{className:"photo-frame",style:{rotate:`${o%4-1.5}deg`,left:e.x*r,top:e.y*i,aspectRatio:l,width:t.width*r,height:t.height*i},children:Q.jsx("img",{className:"photo",src:n,alt:""})})},e0=(e,t)=>{let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{t(...r)},e)}},t0=e=>({width:e.clientWidth,height:e.clientHeight}),n0=()=>{const e=M.useRef(null),[t,n]=M.useState({width:0,height:0});return M.useLayoutEffect(()=>{var l;const r=(l=e.current)==null?void 0:l.parentElement;if(!r)return;const i=e0(50,()=>{const u=t0(r);M.startTransition(()=>{n(s=>Ud(s,u)?s:u)})}),o=new ResizeObserver(i);return o.observe(r),()=>o.disconnect()},[e]),[e,t]},vc=(e,t,n)=>Ka(n,t)/Ka(n,e.dimension),r0=({images:e})=>{const[t,n]=n0(),r=Zv(e),{error:i,value:o}=Jv(r,n),l=M.useMemo(()=>Q.jsx("ol",{ref:t,className:"diorama-list",children:o==null?void 0:o.pictures.map((u,s)=>Q.jsx(bv,{picture:u,idx:s,scaleX:vc(o,n,"width"),scaleY:vc(o,n,"height")},u.url))}),[t,o]);return Hg(i)?l:Q.jsxs("div",{children:["Failed to layout: ",i.message]})},i0=Os.div` width: 98svw; height: 98svh; `,o0=({images:e})=>Q.jsx(Mv,{children:Q.jsx(i0,{children:Q.jsx(r0,{images:e})})});tn.fromNullable(document.getElementById("root")).ifNothing(()=>Id("#root element not found")).map($d).map(e=>Xm(hy).then(t=>{e.render(Q.jsx(M.StrictMode,{children:Q.jsx(o0,{images:t})}))}).catch(()=>alert("Failed to load images"))); diff --git a/docs/index.html b/docs/index.html index 491385d..ce7ae1f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,7 +6,7 @@ - + diff --git a/src/constants.ts b/src/constants.ts index fe5a6e7..40b19ce 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -7,7 +7,7 @@ export const maxComputationTime = 500 as Milliseconds export const randomizeThreshold = 11 // if amount of pics is bigger we have too many permutations to iterate through, switch to random strategy export const iconSize = 20 export const initialImageAmount = 8 -export const aspectRatioThreshold = 0.85 +export const aspectRatioThreshold = 0.9 export const aspectRatioAndSize = ({ sizeHomogeneity, score }: Solution): Ord => { return score * sizeHomogeneity