From f3ed484a226a9b3224bda2466b83b5d999732a66 Mon Sep 17 00:00:00 2001 From: Chase Meadors Date: Thu, 20 Jun 2024 22:06:47 -0600 Subject: [PATCH] Updates --- app.bundle.js | 10 +++++----- app.bundle.js.LICENSE.txt | 6 ------ index.html | 1 + 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app.bundle.js b/app.bundle.js index cd581d3..e31c7b7 100644 --- a/app.bundle.js +++ b/app.bundle.js @@ -1,5 +1,5 @@ /*! For license information please see app.bundle.js.LICENSE.txt */ -(()=>{"use strict";var t={};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{var e;t.g.importScripts&&(e=t.g.location+"");var i=t.g.document;if(!e&&i&&(i.currentScript&&(e=i.currentScript.src),!e)){var s=i.getElementsByTagName("script");if(s.length)for(var o=s.length-1;o>-1&&!e;)e=s[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t.p=e})();const e=globalThis,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;class n{constructor(t,e,i){if(this._$cssResult$=!0,i!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&o.set(e,t))}return t}toString(){return this.cssText}}const r=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new n(i,t,s)},l=(t,s)=>{if(i)t.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of s){const s=document.createElement("style"),o=e.litNonce;void 0!==o&&s.setAttribute("nonce",o),s.textContent=i.cssText,t.appendChild(s)}},a=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,s))(e)})(t):t,{is:c,defineProperty:h,getOwnPropertyDescriptor:d,getOwnPropertyNames:u,getOwnPropertySymbols:p,getPrototypeOf:$}=Object,f=globalThis,m=f.trustedTypes,g=m?m.emptyScript:"",A=f.reactiveElementPolyfillSupport,v=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?g:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},y=(t,e)=>!c(t,e),b={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:y};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class w extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=b){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&h(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=d(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return s?.call(this)},set(e){const n=s?.call(this);o.call(this,e),this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=$(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...u(t),...p(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$ES(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$E_??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$E_?.delete(t)}_$ES(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return l(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$E_?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$E_?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:_).toAttribute(e,i.type);this._$Em=t,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_;this._$Em=s,this[s]=o.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,i,s=!1,o){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??y)(s?o:this[t],e))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$Eg=this._$EP())}C(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t)!0!==i.wrapped||this._$AL.has(e)||void 0===this[e]||this.C(e,this[e],i)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$E_?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$ET()}catch(e){throw t=!1,this._$ET(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$E_?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EO(t,this[t]))),this._$ET()}updated(t){}firstUpdated(t){}}w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[v("elementProperties")]=new Map,w[v("finalized")]=new Map,A?.({ReactiveElement:w}),(f.reactiveElementVersions??=[]).push("2.0.2");const E=globalThis,x=E.trustedTypes,S=x?x.createPolicy("lit-html",{createHTML:t=>t}):void 0,k="$lit$",C=`lit$${(Math.random()+"").slice(9)}$`,M="?"+C,P=`<${M}>`,T=document,H=()=>T.createComment(""),R=t=>null===t||"object"!=typeof t&&"function"!=typeof t,O=Array.isArray,z="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,N=/-->/g,L=/>/g,D=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),I=/'/g,j=/"/g,B=/^(?:script|style|textarea|title)$/i,Q=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),W=Q(1),J=(Q(2),Symbol.for("lit-noChange")),q=Symbol.for("lit-nothing"),G=new WeakMap,K=T.createTreeWalker(T,129);function Y(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const V=(t,e)=>{const i=t.length-1,s=[];let o,n=2===e?"":"",r=U;for(let e=0;e"===a[0]?(r=o??U,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?D:'"'===a[3]?j:I):r===j||r===I?r=D:r===N||r===L?r=U:(r=D,o=void 0);const d=r===D&&t[e+1].startsWith("/>")?" ":"";n+=r===U?i+P:c>=0?(s.push(l),i.slice(0,c)+k+i.slice(c)+C+d):i+C+(-2===c?e:d)}return[Y(t,n+(t[i]||"")+(2===e?"":"")),s]};class F{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,n=0;const r=t.length-1,l=this.parts,[a,c]=V(t,e);if(this.el=F.createElement(a,i),K.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=K.nextNode())&&l.length0){s.textContent=x?x.emptyScript:"";for(let i=0;iO(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==q&&R(this._$AH)?this._$AA.nextSibling.data=t:this.$(T.createTextNode(t)),this._$AH=t}g(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=F.createElement(Y(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new X(s,this),i=t.u(this.options);t.p(e),this.$(i),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new F(t)),e}T(t){O(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new tt(this.k(H()),this.k(H()),this,this.options)):i=e[s],i._$AI(o),s++;s2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=q}_$AI(t,e=this,i,s){const o=this.strings;let n=!1;if(void 0===o)t=Z(this,t,e,0),n=!R(t)||t!==this._$AH&&t!==J,n&&(this._$AH=t);else{const s=t;let r,l;for(t=o[0],r=0;r{const s=i?.renderBefore??e;let o=s._$litPart$;if(void 0===o){const t=i?.renderBefore??null;s._$litPart$=o=new tt(e.insertBefore(H(),t),t,void 0,i??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return J}}lt._$litElement$=!0,lt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:lt});const at=globalThis.litElementPolyfillSupport;function ct(t,e=[...t.keys()]){if(1==e.length)return new Map([[e[0],0]]);for(let[i,s]of e.entries()){const o=t.get(s).filter((t=>e.includes(t)));if(o.length>5)continue;const n=ct(t,e.toSpliced(i,1)),r=o.map((t=>n.get(t)));let l=0;for(;r.includes(l);)l+=1;return n.set(s,l),n}}function ht(t){const e=function(t){const e=new Map(t.map(((t,e)=>[e,[]]))),i=([t,e],[i,s])=>Math.abs(t-i)+Math.abs(e-s);for(let s=0;st[o].some((t=>1==i(e,t)))))&&(e.get(s).push(o),e.get(o).push(s));return e}(t);return ct(e)}function dt(t){return e=>{e.preventDefault(),t(e)}}function ut(t,e){return t[0]==e[0]&&t[1]==e[1]}at?.({LitElement:lt}),(globalThis.litElementVersions??=[]).push("4.0.2");"customElements"in window&&window.customElements.define("polyomino-control",class extends lt{static get properties(){return{mode:{type:String},size:{type:Number},value:{type:Array}}}static get styles(){return r` +(()=>{"use strict";var t={};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{var e;t.g.importScripts&&(e=t.g.location+"");var i=t.g.document;if(!e&&i&&(i.currentScript&&(e=i.currentScript.src),!e)){var o=i.getElementsByTagName("script");if(o.length)for(var s=o.length-1;s>-1&&!e;)e=o[s--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t.p=e})();const e=globalThis,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),s=new WeakMap;class n{constructor(t,e,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(e,t))}return t}toString(){return this.cssText}}const r=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new n(i,t,o)},l=(t,o)=>{if(i)t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of o){const o=document.createElement("style"),s=e.litNonce;void 0!==s&&o.setAttribute("nonce",s),o.textContent=i.cssText,t.appendChild(o)}},a=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,o))(e)})(t):t,{is:c,defineProperty:h,getOwnPropertyDescriptor:d,getOwnPropertyNames:u,getOwnPropertySymbols:p,getPrototypeOf:f}=Object,$=globalThis,g=$.trustedTypes,m=g?g.emptyScript:"",A=$.reactiveElementPolyfillSupport,v=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},_=(t,e)=>!c(t,e),b={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),$.litPropertyMetadata??=new WeakMap;class w extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=b){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(t,i,e);void 0!==o&&h(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){const{get:o,set:s}=d(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return o?.call(this)},set(e){const n=o?.call(this);s.call(this,e),this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=f(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...u(t),...p(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$ES(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$E_??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$E_?.delete(t)}_$ES(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return l(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$E_?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$E_?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e){const i=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,i);if(void 0!==o&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:y).toAttribute(e,i.type);this._$Em=t,null==s?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(t,e){const i=this.constructor,o=i._$Eh.get(t);if(void 0!==o&&this._$Em!==o){const t=i.getPropertyOptions(o),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=o,this[o]=s.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,i,o=!1,s){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??_)(o?s:this[t],e))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$Eg=this._$EP())}C(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t)!0!==i.wrapped||this._$AL.has(e)||void 0===this[e]||this.C(e,this[e],i)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$E_?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$ET()}catch(e){throw t=!1,this._$ET(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$E_?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EO(t,this[t]))),this._$ET()}updated(t){}firstUpdated(t){}}w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[v("elementProperties")]=new Map,w[v("finalized")]=new Map,A?.({ReactiveElement:w}),($.reactiveElementVersions??=[]).push("2.0.2");const E=globalThis,S=E.trustedTypes,k=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",C=`lit$${(Math.random()+"").slice(9)}$`,M="?"+C,P=`<${M}>`,T=document,H=()=>T.createComment(""),L=t=>null===t||"object"!=typeof t&&"function"!=typeof t,O=Array.isArray,R="[ \t\n\f\r]",z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,N=/-->/g,U=/>/g,D=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),I=/'/g,j=/"/g,B=/^(?:script|style|textarea|title)$/i,W=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),Q=W(1),q=(W(2),Symbol.for("lit-noChange")),J=Symbol.for("lit-nothing"),G=new WeakMap,K=T.createTreeWalker(T,129);function Y(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==k?k.createHTML(e):e}const V=(t,e)=>{const i=t.length-1,o=[];let s,n=2===e?"":"",r=z;for(let e=0;e"===a[0]?(r=s??z,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?D:'"'===a[3]?j:I):r===j||r===I?r=D:r===N||r===U?r=z:(r=D,s=void 0);const d=r===D&&t[e+1].startsWith("/>")?" ":"";n+=r===z?i+P:c>=0?(o.push(l),i.slice(0,c)+x+i.slice(c)+C+d):i+C+(-2===c?e:d)}return[Y(t,n+(t[i]||"")+(2===e?"":"")),o]};class F{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let s=0,n=0;const r=t.length-1,l=this.parts,[a,c]=V(t,e);if(this.el=F.createElement(a,i),K.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(o=K.nextNode())&&l.length0){o.textContent=S?S.emptyScript:"";for(let i=0;iO(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==J&&L(this._$AH)?this._$AA.nextSibling.data=t:this.$(T.createTextNode(t)),this._$AH=t}g(t){const{values:e,_$litType$:i}=t,o="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=F.createElement(Y(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===o)this._$AH.p(e);else{const t=new X(o,this),i=t.u(this.options);t.p(e),this.$(i),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new F(t)),e}T(t){O(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const s of t)o===e.length?e.push(i=new tt(this.k(H()),this.k(H()),this,this.options)):i=e[o],i._$AI(s),o++;o2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=J}_$AI(t,e=this,i,o){const s=this.strings;let n=!1;if(void 0===s)t=Z(this,t,e,0),n=!L(t)||t!==this._$AH&&t!==q,n&&(this._$AH=t);else{const o=t;let r,l;for(t=s[0],r=0;r{const o=i?.renderBefore??e;let s=o._$litPart$;if(void 0===s){const t=i?.renderBefore??null;o._$litPart$=s=new tt(e.insertBefore(H(),t),t,void 0,i??{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return q}}lt._$litElement$=!0,lt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:lt});const at=globalThis.litElementPolyfillSupport;function ct(t,e=[...t.keys()]){if(1==e.length)return new Map([[e[0],0]]);for(let[i,o]of e.entries()){const s=t.get(o).filter((t=>e.includes(t)));if(s.length>5)continue;const n=ct(t,e.toSpliced(i,1)),r=s.map((t=>n.get(t)));let l=0;for(;r.includes(l);)l+=1;return n.set(o,l),n}}function ht(t){const e=function(t){const e=new Map(t.map(((t,e)=>[e,[]]))),i=([t,e],[i,o])=>Math.abs(t-i)+Math.abs(e-o);for(let o=0;ot[s].some((t=>1==i(e,t)))))&&(e.get(o).push(s),e.get(s).push(o));return e}(t);return ct(e)}function dt(t){return e=>{e.preventDefault(),t(e)}}function ut(t,e){return t[0]==e[0]&&t[1]==e[1]}at?.({LitElement:lt}),(globalThis.litElementVersions??=[]).push("4.0.2");"customElements"in window&&window.customElements.define("polyomino-control",class extends lt{static get properties(){return{mode:{type:String},size:{type:Number},value:{type:Array}}}static get styles(){return r` :host { display: block; touch-action: none; @@ -45,12 +45,12 @@ .grid-container.create-region .cell.active { outline: 2px solid black; } - `}constructor(){super(),this.mode="create",this.size=4,this.value=[],this.pointerDown=!1,this.cachedColorClassMap=null}updated(t){t.has("value")&&"display-multiple"==this.mode&&this.computeColoring()}computeColoring(){const t=ht(this.value.slice(1)),e=Array.from({length:this.value.length-1},((e,i)=>`c${t.get(i)}`));this.cachedColorClassMap=["white",...e]}render(){const t="display-multiple"==this.mode?this.value:[[],this.value];let e=null;return"display-multiple"==this.mode?(null==this.cachedColorClassMap&&this.computeColoring(),e=this.cachedColorClassMap):e="create-region"==this.mode?["white","white"]:["white","cell-color"],W` + `}constructor(){super(),this.mode="create",this.size=4,this.value=[],this.pointerDown=!1,this.cachedColorClassMap=null}updated(t){t.has("value")&&"display-multiple"==this.mode&&this.computeColoring()}computeColoring(){const t=ht(this.value.slice(1)),e=Array.from({length:this.value.length-1},((e,i)=>`c${t.get(i)}`));this.cachedColorClassMap=["white",...e]}render(){const t="display-multiple"==this.mode?this.value:[[],this.value];let e=null;return"display-multiple"==this.mode?(null==this.cachedColorClassMap&&this.computeColoring(),e=this.cachedColorClassMap):e="create-region"==this.mode?["white","white"]:["white","cell-color"],Q`
- ${Array.from(function*(t){for(let e=0;e{const o=i+1,n=this.size-s;let r="";for(let[o,n]of t.entries())n.some((t=>ut(t,[i,s])))&&(r=`active ${e[o]}`);const l=dt((t=>{this.pointerDown=!0,this.toggle(i,s),t.target.releasePointerCapture(t.pointerId)})),a=dt((t=>this.pointerDown?this.toggle(i,s):null)),c=dt((t=>{this.pointerDown=!1})),h=this.mode.startsWith("create");return W` + ${Array.from(function*(t){for(let e=0;e{const s=i+1,n=this.size-o;let r="";for(let[s,n]of t.entries())n.some((t=>ut(t,[i,o])))&&(r=`active ${e[s]}`);const l=dt((t=>{this.pointerDown=!0,this.toggle(i,o),t.target.releasePointerCapture(t.pointerId)})),a=dt((t=>this.pointerDown?this.toggle(i,o):null)),c=dt((t=>{this.pointerDown=!1})),h=this.mode.startsWith("create");return Q`
`}))}
- `}toggle(t,e){const i=[t,e];let s=this.value.findIndex((t=>ut(t,i)));this.value=s>=0?this.value.filter(((t,e)=>e!=s)):[...this.value,i],this.dispatchEvent(new Event("change"))}}),new Set;const pt="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;class $t{_listeners="WeakMap"in pt?new WeakMap:void 0;_observer=void 0;options;constructor(t){this.options=t}observe(t,e){return this._listeners.set(t,e),this._getObserver().observe(t,this.options),()=>{this._listeners.delete(t),this._observer.unobserve(t)}}_getObserver(){return this._observer??(this._observer=new ResizeObserver((t=>{for(const e of t)$t.entries.set(e.target,e),this._listeners.get(e.target)?.(e)})))}}$t.entries="WeakMap"in pt?new WeakMap:void 0;let ft,mt=!1;function gt(t,e){t.appendChild(e)}function At(t,e,i){t.insertBefore(e,i||null)}function vt(t){t.parentNode&&t.parentNode.removeChild(t)}function _t(t){return document.createElement(t)}function yt(t){return document.createTextNode(t)}function bt(){return yt(" ")}function wt(t,e,i,s){return t.addEventListener(e,i,s),()=>t.removeEventListener(e,i,s)}function Et(t){return function(e){return e.preventDefault(),t.call(this,e)}}function xt(t,e,i){null==i?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function St(t,e,i){const s=e.toLowerCase();s in t?t[s]="boolean"==typeof t[s]&&""===i||i:e in t?t[e]="boolean"==typeof t[e]&&""===i||i:xt(t,e,i)}function kt(t,e){t.value=null==e?"":e}function Ct(t,e,i,s){null==i?t.style.removeProperty(e):t.style.setProperty(e,i,s?"important":"")}function Mt(t,e,i){t.classList.toggle(e,!!i)}function Pt(){}function Tt(t){return t()}function Ht(){return Object.create(null)}function Rt(t){t.forEach(Tt)}function Ot(t){return"function"==typeof t}function zt(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function Ut(t){ft=t}new Map;const Nt=[],Lt=[];let Dt=[];const It=[],jt=Promise.resolve();let Bt=!1;function Qt(t){Dt.push(t)}const Wt=new Set;let Jt=0;function qt(){if(0!==Jt)return;const t=ft;do{try{for(;Jt{const n=s.length?s[0]:i;return c.ctx&&o(c.ctx[e],c.ctx[e]=n)&&(!c.skip_bound&&c.bound[e]&&c.bound[e](n),h&&function(t,e){-1===t.$$.dirty[0]&&(Nt.push(t),Bt||(Bt=!0,jt.then(qt)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const e=t.$$.on_mount.map(Tt).filter(Ot);t.$$.on_destroy?t.$$.on_destroy.push(...e):Rt(e),t.$$.on_mount=[]})),o.forEach(Qt)}(t,e.target,e.anchor),mt=!1,qt()}var d;Ut(a)}function te(t,e,i,s){const o=i[t]?.type;if(e="Boolean"===o&&"boolean"!=typeof e?null!=e:e,!s||!i[t])return e;if("toAttribute"===s)switch(o){case"Object":case"Array":return null==e?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return null==e?null:e;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":default:return e;case"Number":return null!=e?+e:e}}new Set(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),"function"==typeof HTMLElement&&(Zt=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(t,e,i){super(),this.$$ctor=t,this.$$s=e,i&&this.attachShadow({mode:"open"})}addEventListener(t,e,i){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const i=this.$$c.$on(t,e);this.$$l_u.set(e,i)}super.addEventListener(t,e,i)}removeEventListener(t,e,i){if(super.removeEventListener(t,e,i),this.$$c){const t=this.$$l_u.get(e);t&&(t(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){if(await Promise.resolve(),!this.$$cn)return;function t(t){return()=>{let e;return{c:function(){e=_t("slot"),"default"!==t&&xt(e,"name",t)},m:function(t,i){At(t,e,i)},d:function(t){t&&vt(e)}}}}const e={},i=function(t){const e={};return t.childNodes.forEach((t=>{e[t.slot||"default"]=!0})),e}(this);for(const o of this.$$s)o in i&&(e[o]=[t(o)]);for(const n of this.attributes){const r=this.$$g_p(n.name);r in this.$$d||(this.$$d[r]=te(r,n.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)l in this.$$d||void 0===this[l]||(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});const s=()=>{this.$$r=!0;for(const t in this.$$p_d)if(this.$$d[t]=this.$$c.$$.ctx[this.$$c.$$.props[t]],this.$$p_d[t].reflect){const e=te(t,this.$$d[t],this.$$p_d,"toAttribute");null==e?this.removeAttribute(this.$$p_d[t].attribute||t):this.setAttribute(this.$$p_d[t].attribute||t,e)}this.$$r=!1};this.$$c.$$.after_update.push(s),s();for(const a in this.$$l)for(const c of this.$$l[a]){const h=this.$$c.$on(a,c);this.$$l_u.set(c,h)}this.$$l={}}}attributeChangedCallback(t,e,i){this.$$r||(t=this.$$g_p(t),this.$$d[t]=te(t,i,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then((()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)}))}$$g_p(t){return Object.keys(this.$$p_d).find((e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t))||t}});class ee{$$=void 0;$$set=void 0;$destroy(){(function(t,e){const i=t.$$;null!==i.fragment&&(function(t){const e=[],i=[];Dt.forEach((s=>-1===t.indexOf(s)?e.push(s):i.push(s))),i.forEach((t=>t())),Dt=e}(i.after_update),Rt(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])})(this,1),this.$destroy=Pt}$on(t,e){if(!Ot(e))return Pt;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(e),()=>{const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const ie="data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==",se=[([t,e])=>[t,e],([t,e])=>[-e,t],([t,e])=>[-t,-e],([t,e])=>[e,-t]],oe=([t,e])=>[-t,e],ne=([t,e])=>t,re=([t,e])=>e;class le{constructor(t){this.coords=t}clone(){return new le(this.coords)}normalize(){let t=Math.min(...this.coords.map(ne)),e=Math.min(...this.coords.map(re)),i=this.translate(-t,-e).coords.toSorted((([t,e],[i,s])=>t-i!=0?t-i:e-s));return new le(i)}equals(t){return this.coords.length==t.coords.length&&this.coords.every(((e,i)=>(([t,e],[i,s])=>t==i&&e==s)(e,t.coords[i])))}isEmpty(){return 0==this.coords.length}rotate(t){let e=t%4;return new le(this.coords.map(se[e]))}reflect(){return new le(this.coords.map(oe))}translate(t,e){return new le(this.coords.map((([i,s])=>[i+t,s+e])))}isDisjointFrom(t){for(let e of this.coords)for(let i of t.coords)if(e[0]==i[0]&&e[1]==i[1])return!1;return!0}getWidth(){let t=this.coords.map(ne);return Math.max(...t)-Math.min(...t)+1}getHeight(){let t=this.coords.map(re);return Math.max(...t)-Math.min(...t)+1}getSize(){return Math.max(this.getWidth(),this.getHeight())}getLargestX(){return Math.max(...this.coords.map(ne))}getLargestY(){return Math.max(...this.coords.map(re))}containsCoordinate(t){return this.coords.some((([e,i])=>e==t[0]&&i==t[1]))}}const ae={I:new le([[0,0],[0,1],[0,2],[0,3]]),O:new le([[0,0],[0,1],[1,1],[1,0]]),T:new le([[0,1],[1,1],[1,0],[2,1]]),J:new le([[0,0],[1,0],[1,1],[1,2]]),L:new le([[0,2],[0,1],[0,0],[1,0]]),S:new le([[0,0],[1,0],[1,1],[2,1]]),Z:new le([[0,1],[1,1],[1,0],[2,0]])};function ce(){return new Worker(t.p+"SatSolverWorker.bundle.worker.js")}function he(t,e,i){const s=t.slice();return s[42]=e[i],s[44]=i,s}function de(t,e,i){const s=t.slice();return s[45]=e[i][0],s[46]=e[i][1],s}function ue(t){let e,i,s,o;return{c(){e=_t("polyomino-control"),St(e,"size","4"),St(e,"mode","display"),St(e,"class","tetromino svelte-1i0gjcq"),St(e,"value",i=t[46].coords)},m(i,n){At(i,e,n),s||(o=wt(e,"click",t[23]),s=!0)},p:Pt,d(t){t&&vt(e),s=!1,o()}}}function pe(t,e){let i,s,o,n;function r(...t){return e[24](e[44],...t)}return{key:t,first:null,c(){i=_t("polyomino-control"),St(i,"size",e[12]),St(i,"mode","display"),St(i,"class","tetromino svelte-1i0gjcq"),St(i,"value",s=e[42]),this.first=i},m(t,e){At(t,i,e),o||(n=wt(i,"click",r),o=!0)},p(t,o){e=t,4096&o[0]&&St(i,"size",e[12]),1&o[0]&&s!==(s=e[42])&&St(i,"value",s)},d(t){t&&vt(i),o=!1,n()}}}function $e(t){let e,i,s,o,n;return{c(){e=_t("p"),e.innerHTML="Destination region",i=bt(),s=_t("polyomino-control"),St(s,"id","region-create"),St(s,"size",t[3]),St(s,"mode","create-region"),St(s,"class","svelte-1i0gjcq")},m(r,l){At(r,e,l),At(r,i,l),At(r,s,l),t[25](s),o||(n=wt(s,"change",t[26]),o=!0)},p(t,e){8&e[0]&&St(s,"size",t[3])},d(r){r&&(vt(e),vt(i),vt(s)),t[25](null),o=!1,n()}}}function fe(t){let e,i,s,o;return{c(){e=_t("p"),e.innerHTML="Solution",i=bt(),s=_t("polyomino-control"),St(s,"id","solution-display"),St(s,"size",t[3]),St(s,"mode","display-multiple"),St(s,"value",o=t[4].solutionCoords||[]),St(s,"class","svelte-1i0gjcq")},m(t,o){At(t,e,o),At(t,i,o),At(t,s,o)},p(t,e){8&e[0]&&St(s,"size",t[3]),16&e[0]&&o!==(o=t[4].solutionCoords||[])&&St(s,"value",o)},d(t){t&&(vt(e),vt(i),vt(s))}}}function me(t){let e;return{c(){e=_t("div"),e.innerHTML=`
loading
`,xt(e,"id","loading"),Ct(e,"margin-top","15px"),Ct(e,"margin-bottom","15px"),xt(e,"class","grid-x")},m(t,i){At(t,e,i)},d(t){t&&vt(e)}}}function ge(t){let e,i,s,o,n=(t[4].time/1e3).toFixed(3)+"";function r(t,e){return t[10]?ve:Ae}let l=r(t),a=l(t);return{c(){e=_t("div"),a.c(),i=yt(" in "),s=yt(n),o=yt(" seconds."),xt(e,"id","solution-info"),xt(e,"class","callout"),Mt(e,"alert",!t[10]),Mt(e,"primary",t[10])},m(t,n){At(t,e,n),a.m(e,null),gt(e,i),gt(e,s),gt(e,o)},p(t,o){var c,h;l!==(l=r(t))&&(a.d(1),a=l(t),a&&(a.c(),a.m(e,i))),16&o[0]&&n!==(n=(t[4].time/1e3).toFixed(3)+"")&&(h=""+(h=n),(c=s).data!==h&&(c.data=h)),1024&o[0]&&Mt(e,"alert",!t[10]),1024&o[0]&&Mt(e,"primary",t[10])},d(t){t&&vt(e),a.d()}}}function Ae(t){let e;return{c(){e=_t("strong"),e.textContent="No solution"},m(t,i){At(t,e,i)},d(t){t&&vt(e)}}}function ve(t){let e;return{c(){e=yt("Found solution")},m(t,i){At(t,e,i)},d(t){t&&vt(e)}}}function _e(t){let e,i,s,o,n,r,l,a,c,h,d,u,p,$,f,m,g,A,v,_,y,b,w,E,x,S,k,C,M,P,T,H,R,O,z,U,N,L,D,I,j,B,Q,W,J,q,G,K,Y,V,F,Z,X,tt,et,it,st,ot,nt,rt,lt,at,ct,ht,dt,ut,pt,$t,ft,mt,Tt,Ht,Ot,zt,Ut,Nt,Lt,Dt,It,jt,Bt,Qt,Wt,Jt,qt,Gt,Kt=[],Zt=new Map,Xt=t[11]?"Reset":"Solve",te=Vt(Object.entries(ae)),ee=[];for(let e=0;et[42];for(let e=0;et.push(e)))},r(){e.forEach((e=>t.splice(t.indexOf(e),1)))}}}(t[33][0]),{c(){e=_t("div"),e.innerHTML='
',i=bt(),s=_t("div"),o=_t("div"),n=_t("ul"),r=_t("li"),l=_t("a"),a=yt("Polyomino"),h=bt(),d=_t("li"),u=_t("a"),p=yt("Tetrominos"),f=bt(),m=_t("div"),g=_t("div"),A=_t("polyomino-control"),v=bt(),_=_t("div"),y=_t("div"),b=_t("button"),b.textContent="⇲",w=bt(),E=_t("button"),E.textContent="⇱",x=bt(),S=_t("button"),S.textContent="⎚",k=bt(),C=_t("div"),M=_t("button"),M.textContent="Add",P=bt(),T=_t("div");for(let t=0;tPolyominos to be fit (click to remove)",z=bt(),U=_t("div");for(let t=0;tSettings",F=bt(),Z=_t("div"),X=_t("input"),tt=yt(" Allow rotations"),et=bt(),it=_t("div"),st=_t("input"),ot=yt(" Allow reflections"),nt=bt(),rt=_t("hr"),lt=bt(),at=_t("div"),ct=_t("input"),ht=yt(" \n Algorithm X (Dancing Links)\n\t\t\t"),dt=_t("p"),dt.innerHTML='Reduces to an exact cover problem.\n\t\t\t\tOnly finds exact solutions, but usually gives the best performance when an exact solution exists.',ut=bt(),pt=_t("div"),$t=_t("input"),ft=yt(" \n SAT (JavaScript)\n\t\t\t"),mt=_t("p"),mt.innerHTML='Reduces to SAT.\n\t\t\t\tWill find partial (inexact) solutions, and is nondeterministic.\n\t\t\t\tUses a JavaScript SAT solver, and usually gives the best performance for small or easy problems.',Tt=bt(),Ht=_t("div"),Ot=_t("input"),zt=yt(" \n\t\t\tSAT (Z3)\n\t\t\t"),Ut=_t("p"),Ut.innerHTML='Reduces to SAT.\n\t\t\t\tWill find partial (inexact) solutions, and is deterministic.\n\t\t\t\tSolves SAT via a Webassembly build of the Z3 Theorem Prover, and gives better performance for larger problems.',Nt=bt(),Lt=_t("hr"),Dt=bt(),It=_t("button"),jt=bt(),le&&le.c(),Bt=bt(),Qt=_t("a"),Qt.textContent="Clear",Wt=bt(),ce&&ce.c(),xt(e,"class","top-bar"),xt(l,"href","#tab-polyomino"),xt(l,"role","tab"),xt(l,"aria-selected",c="polyomino"==t[7]),xt(r,"class","tabs-title flex-child-auto"),Mt(r,"is-active","polyomino"==t[7]),xt(u,"href","#tab-tetromino"),xt(u,"role","tab"),xt(u,"aria-selected",$="tetromino"==t[7]),xt(d,"class","tabs-title flex-child-auto"),Mt(d,"is-active","tetromino"==t[7]),xt(n,"class","tabs flex-container"),xt(n,"data-tabs",""),xt(n,"id","create-tabs"),St(A,"id","poly-create"),St(A,"size",t[6]),St(A,"class","svelte-1i0gjcq"),xt(b,"class","button hollow size-button svelte-1i0gjcq"),xt(b,"title","grid size down"),xt(E,"class","button hollow size-button svelte-1i0gjcq"),xt(E,"title","grid size up"),xt(S,"class","button hollow size-button svelte-1i0gjcq"),xt(S,"title","clear"),xt(y,"class","cell shrink"),xt(M,"class","button expanded"),xt(C,"class","cell auto"),xt(_,"class","grid-x grid-padding-x align-middle"),xt(g,"class","tabs-panel"),Mt(g,"is-active","polyomino"==t[7]),xt(T,"class","tabs-panel"),Mt(T,"is-active","tetromino"==t[7]),xt(m,"class","tabs-content"),xt(o,"class","cell xlarge-3 medium-6 small-12"),xt(U,"class","callout"),xt(R,"class","cell xlarge-3 medium-6 small-12"),xt(I,"class","button hollow size-button svelte-1i0gjcq"),I.disabled=t[11],xt(I,"title","grid size down"),Mt(I,"disabled",t[11]),xt(Q,"class","button hollow size-button svelte-1i0gjcq"),Q.disabled=t[11],xt(Q,"title","grid size up"),Mt(Q,"disabled",t[11]),xt(q,"class","button hollow size-button svelte-1i0gjcq"),q.disabled=t[11],xt(q,"title","clear"),Mt(q,"disabled",t[11]),xt(L,"class","cell xlarge-3 medium-6 small-12"),xt(X,"type","checkbox"),xt(st,"type","checkbox"),xt(ct,"type","radio"),ct.__value="method-dlx",kt(ct,ct.__value),xt($t,"type","radio"),$t.__value="method-sat",kt($t,$t.__value),xt(Ot,"type","radio"),Ot.__value="method-z3",kt(Ot,Ot.__value),xt(It,"class","button expanded"),It.disabled=t[8],Mt(It,"success",!t[11]),Mt(It,"hollow",t[11]),Mt(It,"disabled",t[8]),xt(Qt,"id","clear-button"),Ct(Qt,"display","none"),xt(Qt,"class","button expanded"),xt(Y,"class","cell xlarge-3 medium-6 small-12"),xt(s,"class","grid-x grid-padding-x grid-padding-y"),Jt.p(ct,$t,Ot)},m(c,$){At(c,e,$),At(c,i,$),At(c,s,$),gt(s,o),gt(o,n),gt(n,r),gt(r,l),gt(l,a),gt(n,h),gt(n,d),gt(d,u),gt(u,p),gt(o,f),gt(o,m),gt(m,g),gt(g,A),t[19](A),gt(g,v),gt(g,_),gt(_,y),gt(y,b),gt(y,w),gt(y,E),gt(y,x),gt(y,S),gt(_,k),gt(_,C),gt(C,M),gt(m,P),gt(m,T);for(let t=0;tl.p(t,e))):(l=c(s,t),l.c()),g.set(s,m[$]=l),s in f&&A.set(s,Math.abs($-f[s]))}const _=new Set,y=new Set;function b(t){Yt(t,1),t.m(l,h),r.set(t.key,t),h=t.first,p--}for(;u&&p;){const e=m[p-1],i=t[u-1],s=e.key,o=i.key;e===i?(h=e.first,u--,p--):g.has(o)?!r.has(s)||_.has(s)?b(e):y.has(o)?u--:A.get(s)>A.get(o)?(y.add(s),b(e)):(_.add(o),u--):(a(i,r),u--)}for(;u--;){const e=t[u];g.has(e.key)||a(e,r)}for(;p;)b(m[p-1]);return Rt(v),m}(Kt,e,se,0,t,ie,Zt,U,Ft,pe,null,he)),ne===(ne=oe(t))&&re?re.p(t,e):(re.d(1),re=ne(t),re&&(re.c(),re.m(L,D))),2048&e[0]&&(I.disabled=t[11]),2048&e[0]&&Mt(I,"disabled",t[11]),2048&e[0]&&(Q.disabled=t[11]),2048&e[0]&&Mt(Q,"disabled",t[11]),2048&e[0]&&(q.disabled=t[11]),2048&e[0]&&Mt(q,"disabled",t[11]),4&e[0]&&(X.checked=t[2].allowRotation),4&e[0]&&(st.checked=t[2].allowReflection),4&e[0]&&(ct.checked=ct.__value===t[2].method),4&e[0]&&($t.checked=$t.__value===t[2].method),4&e[0]&&(Ot.checked=Ot.__value===t[2].method),2048&e[0]&&Xt!==(Xt=t[11]?"Reset":"Solve")&&(It.innerHTML=Xt),256&e[0]&&(It.disabled=t[8]),2048&e[0]&&Mt(It,"success",!t[11]),2048&e[0]&&Mt(It,"hollow",t[11]),256&e[0]&&Mt(It,"disabled",t[8]),t[8]?le||(le=me(),le.c(),le.m(Y,Bt)):le&&(le.d(1),le=null),t[11]?ce?ce.p(t,e):(ce=ge(t),ce.c(),ce.m(Y,null)):ce&&(ce.d(1),ce=null)},i:Pt,o:Pt,d(o){o&&(vt(e),vt(i),vt(s)),t[19](null),function(t,e){for(let i=0;it.coords))],f),i(8,v=!1)}};let _=null;function y(){let t={pieces:c,region:h,allowRotation:d.allowRotation,allowReflection:d.allowReflection},e=d.method.split("-")[1];i(4,f={problemData:t}),A.postMessage({type:e,problem:t}),i(8,v=!0)}return t.$$.update=()=>{1&t.$$.dirty[0]&&i(12,s=Math.max(2,...c.map((t=>new le(t).getSize())))),11&t.$$.dirty[0]&&(null!=l&&clearTimeout(l),l=setTimeout((()=>{localStorage.setItem("polyomino-solver-state",JSON.stringify({savedPolyomino:c,size:p,regionCoords:h}))}),1500)),4&t.$$.dirty[0]&&m(),1&t.$$.dirty[0]&&m(),16&t.$$.dirty[0]&&(o=null!=f.problemData&&null==f.time),16&t.$$.dirty[0]&&i(11,n=null!=f.time),16&t.$$.dirty[0]&&i(10,r=null!=f.solutionCoords),65540&t.$$.dirty[0]&&"method-z3"==d.method&&(A.postMessage("loadZ3"),i(8,v=!0)),34&t.$$.dirty[0]&&null!=_&&_.value!=h&&i(5,_.value=h,_)},[c,h,d,p,f,_,u,$,v,g,r,n,s,m,function(){let t=new le(g.value).normalize();i(0,c=[...c,t.coords])},y,A,t=>i(7,$="polyomino"),t=>i(7,$="tetromino"),function(t){Lt[t?"unshift":"push"]((()=>{g=t,i(9,g)}))},t=>i(6,u=Math.max(2,u-1)),t=>i(6,u+=1),t=>i(9,g.value=[],g),t=>{i(0,c=[...c,[...t.target.value]])},(t,e)=>{i(0,c=c.toSpliced(t,1))},function(t){Lt[t?"unshift":"push"]((()=>{_=t,i(5,_),i(1,h)}))},t=>i(1,h=t.target.value),t=>i(3,p=Math.max(2,p-1)),t=>i(3,p+=1),t=>i(1,h=[]),function(){d.allowRotation=this.checked,i(2,d)},function(){d.allowReflection=this.checked,i(2,d)},function(){d.method=this.__value,i(2,d)},[[]],function(){d.method=this.__value,i(2,d)},function(){d.method=this.__value,i(2,d)},t=>n?m():y()]}new class extends ee{constructor(t){super(),Xt(this,t,ye,_e,zt,{},null,[-1,-1])}}({target:document.body})})(); \ No newline at end of file + `}toggle(t,e){const i=[t,e];let o=this.value.findIndex((t=>ut(t,i)));this.value=o>=0?this.value.filter(((t,e)=>e!=o)):[...this.value,i],this.dispatchEvent(new Event("change"))}}),new Set;const pt="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;class ft{_listeners="WeakMap"in pt?new WeakMap:void 0;_observer=void 0;options;constructor(t){this.options=t}observe(t,e){return this._listeners.set(t,e),this._getObserver().observe(t,this.options),()=>{this._listeners.delete(t),this._observer.unobserve(t)}}_getObserver(){return this._observer??(this._observer=new ResizeObserver((t=>{for(const e of t)ft.entries.set(e.target,e),this._listeners.get(e.target)?.(e)})))}}ft.entries="WeakMap"in pt?new WeakMap:void 0;let $t,gt=!1;function mt(t,e){t.appendChild(e)}function At(t,e,i){t.insertBefore(e,i||null)}function vt(t){t.parentNode&&t.parentNode.removeChild(t)}function yt(t){return document.createElement(t)}function _t(t){return document.createTextNode(t)}function bt(){return _t(" ")}function wt(t,e,i,o){return t.addEventListener(e,i,o),()=>t.removeEventListener(e,i,o)}function Et(t){return function(e){return e.preventDefault(),t.call(this,e)}}function St(t,e,i){null==i?t.removeAttribute(e):t.getAttribute(e)!==i&&t.setAttribute(e,i)}function kt(t,e,i){const o=e.toLowerCase();o in t?t[o]="boolean"==typeof t[o]&&""===i||i:e in t?t[e]="boolean"==typeof t[e]&&""===i||i:St(t,e,i)}function xt(t,e){t.value=null==e?"":e}function Ct(t,e,i,o){null==i?t.style.removeProperty(e):t.style.setProperty(e,i,o?"important":"")}function Mt(t,e,i){t.classList.toggle(e,!!i)}function Pt(){}function Tt(t){return t()}function Ht(){return Object.create(null)}function Lt(t){t.forEach(Tt)}function Ot(t){return"function"==typeof t}function Rt(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function zt(t){$t=t}new Map;const Nt=[],Ut=[];let Dt=[];const It=[],jt=Promise.resolve();let Bt=!1;function Wt(t){Dt.push(t)}const Qt=new Set;let qt=0;function Jt(){if(0!==qt)return;const t=$t;do{try{for(;qt{const n=o.length?o[0]:i;return c.ctx&&s(c.ctx[e],c.ctx[e]=n)&&(!c.skip_bound&&c.bound[e]&&c.bound[e](n),h&&function(t,e){-1===t.$$.dirty[0]&&(Nt.push(t),Bt||(Bt=!0,jt.then(Jt)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const e=t.$$.on_mount.map(Tt).filter(Ot);t.$$.on_destroy?t.$$.on_destroy.push(...e):Lt(e),t.$$.on_mount=[]})),s.forEach(Wt)}(t,e.target,e.anchor),gt=!1,Jt()}var d;zt(a)}function te(t,e,i,o){const s=i[t]?.type;if(e="Boolean"===s&&"boolean"!=typeof e?null!=e:e,!o||!i[t])return e;if("toAttribute"===o)switch(s){case"Object":case"Array":return null==e?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return null==e?null:e;default:return e}else switch(s){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":default:return e;case"Number":return null!=e?+e:e}}new Set(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),"function"==typeof HTMLElement&&(Zt=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(t,e,i){super(),this.$$ctor=t,this.$$s=e,i&&this.attachShadow({mode:"open"})}addEventListener(t,e,i){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const i=this.$$c.$on(t,e);this.$$l_u.set(e,i)}super.addEventListener(t,e,i)}removeEventListener(t,e,i){if(super.removeEventListener(t,e,i),this.$$c){const t=this.$$l_u.get(e);t&&(t(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){if(await Promise.resolve(),!this.$$cn)return;function t(t){return()=>{let e;return{c:function(){e=yt("slot"),"default"!==t&&St(e,"name",t)},m:function(t,i){At(t,e,i)},d:function(t){t&&vt(e)}}}}const e={},i=function(t){const e={};return t.childNodes.forEach((t=>{e[t.slot||"default"]=!0})),e}(this);for(const s of this.$$s)s in i&&(e[s]=[t(s)]);for(const n of this.attributes){const r=this.$$g_p(n.name);r in this.$$d||(this.$$d[r]=te(r,n.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)l in this.$$d||void 0===this[l]||(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const t in this.$$p_d)if(this.$$d[t]=this.$$c.$$.ctx[this.$$c.$$.props[t]],this.$$p_d[t].reflect){const e=te(t,this.$$d[t],this.$$p_d,"toAttribute");null==e?this.removeAttribute(this.$$p_d[t].attribute||t):this.setAttribute(this.$$p_d[t].attribute||t,e)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const a in this.$$l)for(const c of this.$$l[a]){const h=this.$$c.$on(a,c);this.$$l_u.set(c,h)}this.$$l={}}}attributeChangedCallback(t,e,i){this.$$r||(t=this.$$g_p(t),this.$$d[t]=te(t,i,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then((()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)}))}$$g_p(t){return Object.keys(this.$$p_d).find((e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t))||t}});class ee{$$=void 0;$$set=void 0;$destroy(){(function(t,e){const i=t.$$;null!==i.fragment&&(function(t){const e=[],i=[];Dt.forEach((o=>-1===t.indexOf(o)?e.push(o):i.push(o))),i.forEach((t=>t())),Dt=e}(i.after_update),Lt(i.on_destroy),i.fragment&&i.fragment.d(e),i.on_destroy=i.fragment=null,i.ctx=[])})(this,1),this.$destroy=Pt}$on(t,e){if(!Ot(e))return Pt;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(e),()=>{const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const ie="data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==",oe=[([t,e])=>[t,e],([t,e])=>[-e,t],([t,e])=>[-t,-e],([t,e])=>[e,-t]],se=([t,e])=>[-t,e],ne=([t,e])=>t,re=([t,e])=>e;class le{constructor(t){this.coords=t}clone(){return new le(this.coords)}normalize(){let t=Math.min(...this.coords.map(ne)),e=Math.min(...this.coords.map(re)),i=this.translate(-t,-e).coords.toSorted((([t,e],[i,o])=>t-i!=0?t-i:e-o));return new le(i)}equals(t){return this.coords.length==t.coords.length&&this.coords.every(((e,i)=>(([t,e],[i,o])=>t==i&&e==o)(e,t.coords[i])))}isEmpty(){return 0==this.coords.length}rotate(t){let e=t%4;return new le(this.coords.map(oe[e]))}reflect(){return new le(this.coords.map(se))}translate(t,e){return new le(this.coords.map((([i,o])=>[i+t,o+e])))}isDisjointFrom(t){for(let e of this.coords)for(let i of t.coords)if(e[0]==i[0]&&e[1]==i[1])return!1;return!0}getWidth(){let t=this.coords.map(ne);return Math.max(...t)-Math.min(...t)+1}getHeight(){let t=this.coords.map(re);return Math.max(...t)-Math.min(...t)+1}getSize(){return Math.max(this.getWidth(),this.getHeight())}getLargestX(){return Math.max(...this.coords.map(ne))}getLargestY(){return Math.max(...this.coords.map(re))}containsCoordinate(t){return this.coords.some((([e,i])=>e==t[0]&&i==t[1]))}}const ae={I:new le([[0,0],[0,1],[0,2],[0,3]]),O:new le([[0,0],[0,1],[1,1],[1,0]]),T:new le([[0,1],[1,1],[1,0],[2,1]]),J:new le([[0,0],[1,0],[1,1],[1,2]]),L:new le([[0,2],[0,1],[0,0],[1,0]]),S:new le([[0,0],[1,0],[1,1],[2,1]]),Z:new le([[0,1],[1,1],[1,0],[2,0]])};function ce(){return new Worker(t.p+"SatSolverWorker.bundle.worker.js")}function he(t,e,i){const o=t.slice();return o[42]=e[i],o[44]=i,o}function de(t,e,i){const o=t.slice();return o[45]=e[i][0],o[46]=e[i][1],o}function ue(t){let e,i,o,s;return{c(){e=yt("polyomino-control"),kt(e,"size","4"),kt(e,"mode","display"),kt(e,"class","tetromino svelte-1i0gjcq"),kt(e,"value",i=t[46].coords)},m(i,n){At(i,e,n),o||(s=wt(e,"click",t[23]),o=!0)},p:Pt,d(t){t&&vt(e),o=!1,s()}}}function pe(t,e){let i,o,s,n;function r(...t){return e[24](e[44],...t)}return{key:t,first:null,c(){i=yt("polyomino-control"),kt(i,"size",e[12]),kt(i,"mode","display"),kt(i,"class","tetromino svelte-1i0gjcq"),kt(i,"value",o=e[42]),this.first=i},m(t,e){At(t,i,e),s||(n=wt(i,"click",r),s=!0)},p(t,s){e=t,4096&s[0]&&kt(i,"size",e[12]),1&s[0]&&o!==(o=e[42])&&kt(i,"value",o)},d(t){t&&vt(i),s=!1,n()}}}function fe(t){let e,i,o,s,n;return{c(){e=yt("p"),e.innerHTML="Destination region",i=bt(),o=yt("polyomino-control"),kt(o,"id","region-create"),kt(o,"size",t[3]),kt(o,"mode","create-region"),kt(o,"class","svelte-1i0gjcq")},m(r,l){At(r,e,l),At(r,i,l),At(r,o,l),t[25](o),s||(n=wt(o,"change",t[26]),s=!0)},p(t,e){8&e[0]&&kt(o,"size",t[3])},d(r){r&&(vt(e),vt(i),vt(o)),t[25](null),s=!1,n()}}}function $e(t){let e,i,o,s;return{c(){e=yt("p"),e.innerHTML="Solution",i=bt(),o=yt("polyomino-control"),kt(o,"id","solution-display"),kt(o,"size",t[3]),kt(o,"mode","display-multiple"),kt(o,"value",s=t[4].solutionCoords||[]),kt(o,"class","svelte-1i0gjcq")},m(t,s){At(t,e,s),At(t,i,s),At(t,o,s)},p(t,e){8&e[0]&&kt(o,"size",t[3]),16&e[0]&&s!==(s=t[4].solutionCoords||[])&&kt(o,"value",s)},d(t){t&&(vt(e),vt(i),vt(o))}}}function ge(t){let e;return{c(){e=yt("div"),e.innerHTML=`
loading
`,St(e,"id","loading"),Ct(e,"margin-top","15px"),Ct(e,"margin-bottom","15px"),St(e,"class","grid-x")},m(t,i){At(t,e,i)},d(t){t&&vt(e)}}}function me(t){let e,i,o,s,n=(t[4].time/1e3).toFixed(3)+"";function r(t,e){return t[10]?ve:Ae}let l=r(t),a=l(t);return{c(){e=yt("div"),a.c(),i=_t(" in "),o=_t(n),s=_t(" seconds."),St(e,"id","solution-info"),St(e,"class","callout"),Mt(e,"alert",!t[10]),Mt(e,"primary",t[10])},m(t,n){At(t,e,n),a.m(e,null),mt(e,i),mt(e,o),mt(e,s)},p(t,s){var c,h;l!==(l=r(t))&&(a.d(1),a=l(t),a&&(a.c(),a.m(e,i))),16&s[0]&&n!==(n=(t[4].time/1e3).toFixed(3)+"")&&(h=""+(h=n),(c=o).data!==h&&(c.data=h)),1024&s[0]&&Mt(e,"alert",!t[10]),1024&s[0]&&Mt(e,"primary",t[10])},d(t){t&&vt(e),a.d()}}}function Ae(t){let e;return{c(){e=yt("strong"),e.textContent="No solution"},m(t,i){At(t,e,i)},d(t){t&&vt(e)}}}function ve(t){let e;return{c(){e=_t("Found solution")},m(t,i){At(t,e,i)},d(t){t&&vt(e)}}}function ye(t){let e,i,o,s,n,r,l,a,c,h,d,u,p,f,$,g,m,A,v,y,_,b,w,E,S,k,x,C,M,P,T,H,L,O,R,z,N,U,D,I,j,B,W,Q,q,J,G,K,Y,V,F,Z,X,tt,et,it,ot,st,nt,rt,lt,at,ct,ht,dt,ut,pt,ft,$t,gt,Tt,Ht,Ot,Rt,zt,Nt,Ut,Dt,It,jt,Bt,Wt,Qt,qt,Jt,Gt,Kt=[],Zt=new Map,Xt=t[11]?"Reset":"Solve",te=Vt(Object.entries(ae)),ee=[];for(let e=0;et[42];for(let e=0;et.push(e)))},r(){e.forEach((e=>t.splice(t.indexOf(e),1)))}}}(t[33][0]),{c(){e=yt("div"),e.innerHTML='
',i=bt(),o=yt("div"),s=yt("div"),n=yt("ul"),r=yt("li"),l=yt("a"),a=_t("Polyomino"),h=bt(),d=yt("li"),u=yt("a"),p=_t("Tetrominos"),$=bt(),g=yt("div"),m=yt("div"),A=yt("polyomino-control"),v=bt(),y=yt("div"),_=yt("div"),b=yt("button"),b.textContent="⇲",w=bt(),E=yt("button"),E.textContent="⇱",S=bt(),k=yt("button"),k.textContent="⎚",x=bt(),C=yt("div"),M=yt("button"),M.textContent="Add",P=bt(),T=yt("div");for(let t=0;tPolyominos to be fit (click to remove)",R=bt(),z=yt("div");for(let t=0;tSettings",F=bt(),Z=yt("div"),X=yt("input"),tt=_t(" Allow rotations"),et=bt(),it=yt("div"),ot=yt("input"),st=_t(" Allow reflections"),nt=bt(),rt=yt("hr"),lt=bt(),at=yt("div"),ct=yt("input"),ht=_t(" \n Algorithm X (Dancing Links)\n\t\t\t"),dt=yt("p"),dt.innerHTML='Reduces to an exact cover problem.\n\t\t\t\tOnly finds exact solutions, but usually gives the best performance when an exact solution exists.',ut=bt(),pt=yt("div"),ft=yt("input"),$t=_t(" \n SAT (JavaScript)\n\t\t\t"),gt=yt("p"),gt.innerHTML='Reduces to SAT.\n\t\t\t\tWill find partial (inexact) solutions, and is nondeterministic.\n\t\t\t\tUses a JavaScript SAT solver, and usually gives the best performance for small or easy problems.',Tt=bt(),Ht=yt("div"),Ot=yt("input"),Rt=_t(" \n\t\t\tSAT (Z3)\n\t\t\t"),zt=yt("p"),zt.innerHTML='Reduces to SAT.\n\t\t\t\tWill find partial (inexact) solutions, and is deterministic.\n\t\t\t\tSolves SAT via a Webassembly build of the Z3 Theorem Prover, and gives better performance for larger problems.',Nt=bt(),Ut=yt("hr"),Dt=bt(),It=yt("button"),jt=bt(),le&&le.c(),Bt=bt(),Wt=yt("a"),Wt.textContent="Clear",Qt=bt(),ce&&ce.c(),St(e,"class","top-bar"),St(l,"href","#tab-polyomino"),St(l,"role","tab"),St(l,"aria-selected",c="polyomino"==t[7]),St(r,"class","tabs-title flex-child-auto"),Mt(r,"is-active","polyomino"==t[7]),St(u,"href","#tab-tetromino"),St(u,"role","tab"),St(u,"aria-selected",f="tetromino"==t[7]),St(d,"class","tabs-title flex-child-auto"),Mt(d,"is-active","tetromino"==t[7]),St(n,"class","tabs flex-container"),St(n,"data-tabs",""),St(n,"id","create-tabs"),kt(A,"id","poly-create"),kt(A,"size",t[6]),kt(A,"class","svelte-1i0gjcq"),St(b,"class","button hollow size-button svelte-1i0gjcq"),St(b,"title","grid size down"),St(E,"class","button hollow size-button svelte-1i0gjcq"),St(E,"title","grid size up"),St(k,"class","button hollow size-button svelte-1i0gjcq"),St(k,"title","clear"),St(_,"class","cell shrink"),St(M,"class","button expanded"),St(C,"class","cell auto"),St(y,"class","grid-x grid-padding-x align-middle"),St(m,"class","tabs-panel"),Mt(m,"is-active","polyomino"==t[7]),St(T,"class","tabs-panel"),Mt(T,"is-active","tetromino"==t[7]),St(g,"class","tabs-content"),St(s,"class","cell xlarge-3 medium-6 small-12"),St(z,"class","callout"),St(L,"class","cell xlarge-3 medium-6 small-12"),St(I,"class","button hollow size-button svelte-1i0gjcq"),I.disabled=t[11],St(I,"title","grid size down"),Mt(I,"disabled",t[11]),St(W,"class","button hollow size-button svelte-1i0gjcq"),W.disabled=t[11],St(W,"title","grid size up"),Mt(W,"disabled",t[11]),St(J,"class","button hollow size-button svelte-1i0gjcq"),J.disabled=t[11],St(J,"title","clear"),Mt(J,"disabled",t[11]),St(U,"class","cell xlarge-3 medium-6 small-12"),St(X,"type","checkbox"),St(ot,"type","checkbox"),St(ct,"type","radio"),ct.__value="method-dlx",xt(ct,ct.__value),St(ft,"type","radio"),ft.__value="method-sat",xt(ft,ft.__value),St(Ot,"type","radio"),Ot.__value="method-z3",xt(Ot,Ot.__value),St(It,"class","button expanded"),It.disabled=t[8],Mt(It,"success",!t[11]),Mt(It,"hollow",t[11]),Mt(It,"disabled",t[8]),St(Wt,"id","clear-button"),Ct(Wt,"display","none"),St(Wt,"class","button expanded"),St(Y,"class","cell xlarge-3 medium-6 small-12"),St(o,"class","grid-x grid-padding-x grid-padding-y"),qt.p(ct,ft,Ot)},m(c,f){At(c,e,f),At(c,i,f),At(c,o,f),mt(o,s),mt(s,n),mt(n,r),mt(r,l),mt(l,a),mt(n,h),mt(n,d),mt(d,u),mt(u,p),mt(s,$),mt(s,g),mt(g,m),mt(m,A),t[19](A),mt(m,v),mt(m,y),mt(y,_),mt(_,b),mt(_,w),mt(_,E),mt(_,S),mt(_,k),mt(y,x),mt(y,C),mt(C,M),mt(g,P),mt(g,T);for(let t=0;tl.p(t,e))):(l=c(o,t),l.c()),m.set(o,g[f]=l),o in $&&A.set(o,Math.abs(f-$[o]))}const y=new Set,_=new Set;function b(t){Yt(t,1),t.m(l,h),r.set(t.key,t),h=t.first,p--}for(;u&&p;){const e=g[p-1],i=t[u-1],o=e.key,s=i.key;e===i?(h=e.first,u--,p--):m.has(s)?!r.has(o)||y.has(o)?b(e):_.has(s)?u--:A.get(o)>A.get(s)?(_.add(o),b(e)):(y.add(s),u--):(a(i,r),u--)}for(;u--;){const e=t[u];m.has(e.key)||a(e,r)}for(;p;)b(g[p-1]);return Lt(v),g}(Kt,e,oe,0,t,ie,Zt,z,Ft,pe,null,he)),ne===(ne=se(t))&&re?re.p(t,e):(re.d(1),re=ne(t),re&&(re.c(),re.m(U,D))),2048&e[0]&&(I.disabled=t[11]),2048&e[0]&&Mt(I,"disabled",t[11]),2048&e[0]&&(W.disabled=t[11]),2048&e[0]&&Mt(W,"disabled",t[11]),2048&e[0]&&(J.disabled=t[11]),2048&e[0]&&Mt(J,"disabled",t[11]),4&e[0]&&(X.checked=t[2].allowRotation),4&e[0]&&(ot.checked=t[2].allowReflection),4&e[0]&&(ct.checked=ct.__value===t[2].method),4&e[0]&&(ft.checked=ft.__value===t[2].method),4&e[0]&&(Ot.checked=Ot.__value===t[2].method),2048&e[0]&&Xt!==(Xt=t[11]?"Reset":"Solve")&&(It.innerHTML=Xt),256&e[0]&&(It.disabled=t[8]),2048&e[0]&&Mt(It,"success",!t[11]),2048&e[0]&&Mt(It,"hollow",t[11]),256&e[0]&&Mt(It,"disabled",t[8]),t[8]?le||(le=ge(),le.c(),le.m(Y,Bt)):le&&(le.d(1),le=null),t[11]?ce?ce.p(t,e):(ce=me(t),ce.c(),ce.m(Y,null)):ce&&(ce.d(1),ce=null)},i:Pt,o:Pt,d(s){s&&(vt(e),vt(i),vt(o)),t[19](null),function(t,e){for(let i=0;it.coords))],$),i(8,v=!1)}};let y=null;function _(){let t={pieces:c,region:h,allowRotation:d.allowRotation,allowReflection:d.allowReflection},e=d.method.split("-")[1];i(4,$={problemData:t}),A.postMessage({type:e,problem:t}),i(8,v=!0)}return t.$$.update=()=>{1&t.$$.dirty[0]&&i(12,o=Math.max(2,...c.map((t=>new le(t).getSize())))),11&t.$$.dirty[0]&&(null!=l&&clearTimeout(l),l=setTimeout((()=>{localStorage.setItem("polyomino-solver-state",JSON.stringify({savedPolyomino:c,size:p,regionCoords:h}))}),1500)),4&t.$$.dirty[0]&&g(),1&t.$$.dirty[0]&&g(),16&t.$$.dirty[0]&&(s=null!=$.problemData&&null==$.time),16&t.$$.dirty[0]&&i(11,n=null!=$.time),16&t.$$.dirty[0]&&i(10,r=null!=$.solutionCoords),65540&t.$$.dirty[0]&&"method-z3"==d.method&&(A.postMessage("loadZ3"),i(8,v=!0)),34&t.$$.dirty[0]&&null!=y&&y.value!=h&&i(5,y.value=h,y)},[c,h,d,p,$,y,u,f,v,m,r,n,o,g,function(){let t=new le(m.value).normalize();i(0,c=[...c,t.coords])},_,A,t=>i(7,f="polyomino"),t=>i(7,f="tetromino"),function(t){Ut[t?"unshift":"push"]((()=>{m=t,i(9,m)}))},t=>i(6,u=Math.max(2,u-1)),t=>i(6,u+=1),t=>i(9,m.value=[],m),t=>{i(0,c=[...c,[...t.target.value]])},(t,e)=>{i(0,c=c.toSpliced(t,1))},function(t){Ut[t?"unshift":"push"]((()=>{y=t,i(5,y),i(1,h)}))},t=>i(1,h=t.target.value),t=>i(3,p=Math.max(2,p-1)),t=>i(3,p+=1),t=>i(1,h=[]),function(){d.allowRotation=this.checked,i(2,d)},function(){d.allowReflection=this.checked,i(2,d)},function(){d.method=this.__value,i(2,d)},[[]],function(){d.method=this.__value,i(2,d)},function(){d.method=this.__value,i(2,d)},t=>n?g():_()]}(function(t){const e=(e,i,o)=>{!function(t,e,i){const o=/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*:)*?:?0*1$/.test(location.hostname)||"file:"===location.protocol;if(!e.trackLocalhost&&o)return console.warn("[Plausible] Ignoring event because website is running locally");try{if("true"===window.localStorage.plausible_ignore)return console.warn('[Plausible] Ignoring event because "plausible_ignore" is set to "true" in localStorage')}catch(t){}const s={n:t,u:e.url,d:e.domain,r:e.referrer,w:e.deviceWidth,h:e.hashMode?1:0,p:i&&i.props?JSON.stringify(i.props):void 0},n=new XMLHttpRequest;n.open("POST",`${e.apiHost}/api/event`,!0),n.setRequestHeader("Content-Type","text/plain"),n.send(JSON.stringify(s)),n.onreadystatechange=()=>{4===n.readyState&&i&&i.callback&&i.callback()}}(e,{...{hashMode:!1,trackLocalhost:!1,url:location.href,domain:location.hostname,referrer:document.referrer||null,deviceWidth:window.innerWidth,apiHost:"https://plausible.io",...t},...o},i)},i=(t,i)=>{e("pageview",i,t)};return{trackEvent:e,trackPageview:i,enableAutoPageviews:()=>{const e=()=>i(),o=history.pushState;return o&&(history.pushState=function(t,i,s){o.apply(this,[t,i,s]),e()},addEventListener("popstate",e)),t&&t.hashMode&&addEventListener("hashchange",e),i(),function(){o&&(history.pushState=o,removeEventListener("popstate",e)),t&&t.hashMode&&removeEventListener("hashchange",e)}},enableAutoOutboundTracking:(t=document,i={subtree:!0,childList:!0,attributes:!0,attributeFilter:["href"]})=>{function o(t){e("Outbound Link: Click",{props:{url:this.href}}),"undefined"!=typeof process&&process,setTimeout((()=>{location.href=this.href}),150),t.preventDefault()}const s=new Set;function n(t){t instanceof HTMLAnchorElement?t.host!==location.host&&(t.addEventListener("click",o),s.add(t)):"querySelectorAll"in t&&t.querySelectorAll("a").forEach(n)}function r(t){t instanceof HTMLAnchorElement?(t.removeEventListener("click",o),s.delete(t)):"querySelectorAll"in t&&t.querySelectorAll("a").forEach(r)}const l=new MutationObserver((t=>{t.forEach((t=>{"attributes"===t.type?(r(t.target),n(t.target)):"childList"===t.type&&(t.addedNodes.forEach(n),t.removedNodes.forEach(r))}))}));return t.querySelectorAll("a").forEach(n),l.observe(t,i),function(){s.forEach((t=>{t.removeEventListener("click",o)})),s.clear(),l.disconnect()}}}})({domain:"cemulate.github.io/polyomino-solver",apiHost:"https://plausible.351321.xyz"}).enableAutoPageviews(),new class extends ee{constructor(t){super(),Xt(this,t,_e,ye,Rt,{},null,[-1,-1])}}({target:document.body})})(); \ No newline at end of file diff --git a/app.bundle.js.LICENSE.txt b/app.bundle.js.LICENSE.txt index 4e8243e..bd0a731 100644 --- a/app.bundle.js.LICENSE.txt +++ b/app.bundle.js.LICENSE.txt @@ -3,9 +3,3 @@ * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ - -/** - * @license - * Copyright 2019 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ diff --git a/index.html b/index.html index 8f2dae3..aaa8b2a 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ Polyomino Solver +