1import{A as e,B as t,C as n,D as r,E as i,F as a,Fp as o,G as s,H as c,I as l,Ip as u,K as d,L as f,M as p,N as m,O as h,P as g,R as _,S as v,T as y,U as ee,V as b,Vp as x,W as S,_ as C,_t as te,a as ne,at as w,b as T,bt as re,c as ie,ct as ae,d as oe,dt as se,f as ce,ft as le,g as E,gt as ue,h as D,ht as de,i as fe,j as O,k,l as pe,lt as me,m as he,mt as ge,o as _e,ot as ve,p as ye,pt as be,q as xe,s as Se,st as Ce,t as A,u as we,ut as Te,v as Ee,vt as De,w as Oe,x as ke,y as Ae,yt as je,z as Me}from"./utils-CEi7x_tP.js";import{t as j}from"./createLucideIcon-DiGt6PTD.js";import{n as Ne,t as Pe}from"./header-DblYIUE-.js";import{t as Fe}from"./download-Ct7HKoC5.js";import{t as Ie}from"./plus-DmFD-9jj.js";import{t as Le}from"./save-D5SyjNTT.js";import{t as Re}from"./upload-DeJPHGCK.js";import{t as ze}from"./x-CCRTsJWZ.js";import{t as M}from"./button-P0gs9PeW.js";import{X as Be,c as Ve,d as He,f as Ue,l as We,p as Ge,u as Ke,xt as N}from"./index-DIoMQguZ.js";import{t as P}from"./input-B3ZCgDM3.js";import{a as qe,n as Je,o as Ye,t as Xe}from"./dialog-5qpLWgS4.js";import{t as Ze}from"./switch-D5rzVxc7.js";var Qe=j(`arrow-down-up`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`m21 8-4-4-4 4`,key:`1c9v7m`}],[`path`,{d:`M17 4v16`,key:`7dpous`}]]),$e=j(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),F=x(u(),1),et=[`partner`,`child`,`parent`,`grandparent`,`youngerSibling`,`olderSibling`,`grandchild`,`relative`],tt=[`#f7d774`,`#f6a6b2`,`#8ec5ff`,`#9ee6a0`,`#c9a7f0`,`#ffb877`,`#7ee0d3`,`#d9b38c`,`#b8c0cc`,`#e88fc8`],nt=[``,`Female`,`Male`,`Non-binary`,`Other`],rt=[`female`,`male`,`nb`],it=[{key:`speed`,low:`Slow`,high:`Quick`},{key:`manner`,low:`Polite`,high:`Direct`},{key:`tone`,low:`Flat`,high:`Intense`},{key:`energy`,low:`Serious`,high:`Relaxed`},{key:`quirk`,low:`Normal`,high:`Quirky`}],I=[{type:`Easygoing`,desc:`Calm and friendly. Goes with the flow and rarely sweats the small stuff.`,axes:[35,30,40,80,35]},{type:`Energetic`,desc:`Bright and bouncy. Always up for the next thing on the island.`,axes:[85,70,80,55,60]},{type:`Confident`,desc:`Bold and direct. Says what they mean and leads the room.`,axes:[65,90,70,45,40]},{type:`Gentle`,desc:`Soft-spoken and kind. Puts everyone else at ease first.`,axes:[30,20,35,65,30]},{type:`Quirky`,desc:`Playful and one of a kind. You never quite know what they will do next.`,axes:[70,55,65,60,95]},{type:`Serious`,desc:`Focused and steady. Takes plans and promises to heart.`,axes:[45,60,40,15,25]},{type:`Dreamy`,desc:`Imaginative and inspired. Happiest when making or picturing something new.`,axes:[40,25,55,70,75]},{type:`Outgoing`,desc:`Social and warm. Makes friends with the whole cast in a day.`,axes:[80,75,75,65,55]},{type:`Cool`,desc:`Relaxed and understated. Effortless, never in a rush.`,axes:[40,55,30,85,50]},{type:`Sweet`,desc:`Caring and cheerful. Remembers the little things about everyone.`,axes:[55,30,60,60,45]}];function L(){return{x:0,y:0,scale:1}}function at(){return{speed:50,manner:50,tone:50,energy:50,quirk:50,type:null}}function R(e){return{id:e,name:``,img:null,crop:L(),bg:null,tag:null,textStyle:`overlay`,personality:at(),gender:``,pronouns:``,datingPrefs:[],dob:{month:null,day:null,year:null,age:null,dontAge:!1},pet:{img:null,crop:L(),name:``},family:{partner:[],child:[],parent:[],grandparent:[],youngerSibling:[],olderSibling:[],grandchild:[],relative:[]}}}var z=0;function B(){return z+=1,`r${z.toString(36)}${(70+z).toString(36)}`}function V(e){return!e.img&&!e.name.trim()}function H(){return{version:3,islandName:``,residents:Array.from({length:70},()=>R(B())),tags:[]}}function ot(e,t){let n=e=>t===`tag`?e.tag??``:t===`personality`?e.personality.type??``:t===`gender`?e.gender:e.name;return[...e].sort((e,t)=>{let r=V(e),i=V(t);return r===i?r&&i?0:n(e).localeCompare(n(t),void 0,{sensitivity:`base`}):r?1:-1})}var U={bgTop:`#ffd24a`,bgBottom:`#f4a41c`,card:`#fffdf5`,cardShadow:`#d9a83f`,cardBorder:`#ecd9a6`,board:`#f9c22e`,boardEdge:`#e7a90f`,tileEmpty:`#241f16`,tileEmptyHi:`rgba(255,255,255,0.05)`,ink:`#493718`,muted:`#a2895a`,primary:`#ef8f2b`,onPrimary:`#fffaf0`,blue:`#cfe0f5`,blueInk:`#34557a`},W=`Georgia, 'Noto Serif SC', 'Times New Roman', serif`,G=`'Segoe UI', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif`,st=new Map;function ct(e){let t=st.get(e);return t?Promise.resolve(t):new Promise((t,n)=>{let r=new Image;r.crossOrigin=`anonymous`,r.onload=()=>{st.set(e,r),t(r)},r.onerror=()=>n(Error(`image failed`)),r.src=e})}async function lt(e){try{return await ct(e)}catch{return null}}function K(e,t,n,r,i,a){let o=Math.min(a,r/2,i/2);
1e.beginPath(),e.moveTo(t+o,n),e.arcTo(t+r,n,t+r,n+i,o),e.arcTo(t+r,n+i,t,n+i,o),e.arcTo(t,n+i,t,n,o),e.arcTo(t,n,t+r,n,o),e.closePath()}function ut(e,t,n,r,i,a){let o=Math.max(i/t.width,i/t.height),s=n+i/2+a.x*i,c=r+i/2+a.y*i,l=t.width*o*a.scale,u=t.height*o*a.scale;e.drawImage(t,s-l/2,c-u/2,l,u)}async function dt(e,t,n,r,i){let a=i*.2,o=V(t);if(K(e,n,r,i,i,a),e.fillStyle=o?U.tileEmpty:t.bg||U.tileEmpty,e.fill(),o){K(e,n+3,r+3,i-6,i*.5,a*.8),e.fillStyle=U.tileEmptyHi,e.fill();return}if(t.img){let o=await lt(t.img);o&&(e.save(),K(e,n,r,i,i,a),e.clip(),ut(e,o,n,r,i,t.crop),e.restore())}let s=t.name.trim();if(s&&t.textStyle!==`hidden`){let o=i*.28;if(e.save(),K(e,n,r,i,i,a),e.clip(),t.textStyle===`label`)e.fillStyle=`#fffdf5`,e.fillRect(n,r+i-o,i,o),e.fillStyle=`#3a2a12`;else{let t=e.createLinearGradient(0,r+i-o,0,r+i);t.addColorStop(0,`rgba(0,0,0,0)`),t.addColorStop(1,`rgba(0,0,0,0.7)`),e.fillStyle=t,e.fillRect(n,r+i-o*1.4,i,o*1.4),e.fillStyle=`#ffffff`}e.font=`700 ${Math.round(i*.16)}px ${W}`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(s,n+i/2,r+i-o/2,i-i*.14),e.restore()}K(e,n+1,r+1,i-2,i-2,a-1),e.strokeStyle=`rgba(0,0,0,0.18)`,e.lineWidth=2,e.stroke()}async function ft(e){typeof document<`u`&&document.fonts?.ready&&await document.fonts.ready.catch(()=>void 0);let t=e.islandName.trim(),n=t?66:12,r=1184,i=1256,a=128+n+16+836+18+60+36,o=1336,s=a+80,c=document.createElement(`canvas`);c.width=o*2,c.height=s*2;let l=c.getContext(`2d`);if(!l)throw Error(`canvas unavailable`);l.scale(2,2);let u=l.createLinearGradient(0,0,0,s);u.addColorStop(0,U.bgTop),u.addColorStop(1,U.bgBottom),l.fillStyle=u,l.fillRect(0,0,o,s),K(l,40,48,i,a,34),l.fillStyle=U.cardShadow,l.fill(),K(l,40,40,i,a,34),l.fillStyle=U.card,l.fill(),l.strokeStyle=U.cardBorder,l.lineWidth=3,l.stroke();let d=76,f=await lt(N.app_logo||`/logo.png`);f&&l.drawImage(f,76,d,68,68);let p=76+(f?86:0);l.textAlign=`left`,l.textBaseline=`alphabetic`,l.fillStyle=U.ink,l.font=`700 38px ${W}`,l.fillText(N.app_name||`TomoLingo`,p,d+34),l.fillStyle=U.muted,l.font=`600 18px ${G}`,l.fillText(`Tomodachi Life Island Planner`,p,d+60);let m=`${pt(e)} / 70 residents`;l.font=`700 20px ${G}`;let h=l.measureText(m).width+40,g=1260-h,_=d+28/2;K(l,g,_,h,40,40/2),l.fillStyle=U.blue,l.fill(),l.fillStyle=U.blueInk,l.textAlign=`center`,l.textBaseline=`middle`,l.fillText(m,g+h/2,_+40/2+1),d+=92,t&&(l.textAlign=`center`,l.textBaseline=`alphabetic`,l.fillStyle=U.ink,l.font=`700 46px ${W}`,l.fillText(t,668,d+46,i-72)),d+=n+16,K(l,76,d+5,r,836,26),l.fillStyle=U.boardEdge,l.fill(),K(l,76,d,r,836,26),l.fillStyle=U.board,l.fill();let v=d+18;for(let t=0;t<70;t++){let n=t%10,r=Math.floor(t/10);await dt(l,e.residents[t],94+n*116,v+r*116,104)}d+=854;let y=(N.app_url||``).replace(/^https?:\/\//,``).replace(/\/$/,``);l.font=`700 22px ${G}`;let ee=l.measureText(y).width,b=44+(f?42:0)+ee,x=668-b/2,S=d+12/2;K(l,x,S,b,48,48/2),l.fillStyle=U.card,l.fill(),l.strokeStyle=U.primary,l.lineWidth=3,l.stroke();let C=x+22;return f&&(l.drawImage(f,C,S+18/2,30,30),C+=42),l.fillStyle=U.ink,l.textAlign=`left`,l.textBaseline=`middle`,l.fillText(y,C,S+48/2+1),c.toDataURL(`image/png`)}function pt(e){return e.residents.filter(e=>!V(e)).length}var mt=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function ht(e){let t=4294967295;for(let n=0;n<e.length;n++)t=mt[(t^e[n])&255]^t>>>8;return(t^4294967295)>>>0}async function gt(e,t){let n=new(t===`deflate-raw`?CompressionStream:DecompressionStream)(`deflate-raw`),r=n.writable.getWriter();r.write(e),r.close();let i=[],a=n.readable.getReader();for(;;){let{done:e,value:t}=await a.read();if(e)break;i.push(t)}let o=i.reduce((e,t)=>e+t.length,0),s=new Uint8Array(o),c=0;for(let e of i)s.set(e,c),c+=e.length;return s}var _t=`data.json`;function q(e,t,n){e.setUint16(t,n,!0)}function J(e,t,n){e.setUint32(t,n>>>0,!0)}async function vt(e){let t=new TextEncoder().encode(_t),n=new TextEncoder().encode(e),r=await gt(n,`deflate-raw`),i=ht(n),a=new Uint8Array(30+t.length),o=new DataView(a.buffer);J(o,0,67324752),q(o,4,20),q(o,6,0),q(o,8,8),q(o,10,0),q(o,12,0),J(o,14,i),J(o,18,r.length),J(o,22,n.length),q(o,26,t.length),q(o,28,0),a.set(t,30);let s=new Uint8Array(46+t.length),c=new DataView(s.buffer);J(c,0,33639248),q(c,4,20),q(c,6,20),q(c,8,0),q(c,10,8),q(c,12,0),q(c,14,0),J(c,16,i),J(c,20,r.length),J(c,24,n.length),q(c,28,t.length),q(c,30,0),q(c,32,0),q(c,34,0),q(c,36,0),J(c,38,0),J(c,42,0),s.set(t,46);let l=a.length+r.length,u=new Uint8Array(22),d=new DataView(u.buffer);J(d,0,101010256),q(d,4,0),q(d,6,0),q(d,8,1),q(d,10,1),J(d,12,s.length),J(d,16,l),q(d,20,0);let f=new Uint8Array(l+s.length+u.length),p=0;return f.set(a,p),p+=a.length,f.set(r,p),p+=r.length,f.set(s,p),p+=s.length,f.set(u,p),f}async function yt(e){let t=new Uint8Array(e),n=new DataView(e),r=-1;for(let e=t.length-22;e>=0;e--)if(n.getUint32(e,!0)===101010256){r=e;break}if(r<0)throw Error(`Not a .tomo file (no ZIP directory).`);let i=n.getUint32(r+16,!0),a=n.getUint16(r+10,!0),o=i;for(let e=0;e<a;e++){if(n.getUint32(o,!0)!==33639248)throw Error(`Corrupt .tomo directory.`);let e=n.getUint16(o+10,!0),r=n.getUint32(o+20,!0),i=n.getUint16(o+28,!0),a=n.getUint16(o+30,!0),s=n.getUint16(o+32,!0),c=n.getUint32(o+42,!0),l=new TextDecoder().decode(t.subarray(o+46,o+46+i));if(l===_t||l.endsWith(`/data.json`)){let i=n.getUint16(c+26,!0),a=n.getUint16(c+28,!0),o=c+30+i+a,s=t.subarray(o,o+r),l=e===0?s:await gt(s,`inflate-raw`);return new TextDecoder().decode(l)}o+=46+i+a+s}
1throw Error(`No data.json inside the .tomo file.`)}function bt(e){return JSON.stringify({version:3,app:`tomolingo-island-planner`,islandName:e.islandName,tags:e.tags,residents:e.residents.map(e=>V(e)?null:e)})}function Y(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e){return typeof e==`string`?e:``}function xt(e){return{x:Y(e?.x)??0,y:Y(e?.y)??0,scale:Y(e?.scale)??1}}function Z(e){let t=JSON.parse(e,(e,t)=>e===`__proto__`?void 0:t),n=H();if(n.islandName=X(t.islandName),Array.isArray(t.tags)&&(n.tags=t.tags.filter(e=>typeof e==`string`)),Array.isArray(t.residents))return t.residents.slice(0,70).forEach((e,t)=>{if(!e)return;let r=R(B());Object.assign(r,e,{id:e.id??r.id}),r.crop=xt(e.crop),n.residents[t]=r}),n;if(Array.isArray(t.slots)){let e=t.library??{};return t.slots.slice(0,70).forEach((t,r)=>{if(!t)return;let i=R(B());i.name=X(t.text),i.bg=typeof t.bgColour==`string`?t.bgColour:null,i.tag=typeof t.tag==`string`?t.tag:null,i.textStyle=[`overlay`,`label`,`hidden`].includes(t.textStyle)?t.textStyle:`overlay`,t.thumbnailId&&e[t.thumbnailId]&&(i.img=e[t.thumbnailId]);let a=t.character??{};i.gender=X(a.gender),i.pronouns=X(a.pronouns),Array.isArray(a.datingPrefs)&&(i.datingPrefs=a.datingPrefs.filter(e=>[`male`,`female`,`nb`].includes(e)));let o=a.dob??{};i.dob={month:Y(o.month),day:Y(o.day),year:Y(o.year),age:Y(o.age),dontAge:!!o.dontAge},typeof t.personality==`string`&&(i.personality.type=t.personality),t.pet&&typeof t.pet==`object`&&(i.pet.name=X(t.pet.name)),n.residents[r]=i}),n}throw Error(`Unrecognised .tomo contents.`)}async function St(e){return vt(bt(e))}async function Ct(e){return Z(await yt(e))}function wt(e){return Z(e)}var Q=o(),Tt=`island-planner-v3`,Et=`island-planner-reminder-dismissed`,Dt=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Ot={partner:`Partner of`,child:`Kid of`,parent:`Parent of`,grandparent:`Grandparent of`,youngerSibling:`Younger sibling of`,olderSibling:`Older sibling of`,grandchild:`Grandkid of`,relative:`Relative of`},kt={female:`â Female`,male:`â Male`,nb:`â§ Non-binary`};function At({img:e,crop:t,onImage:n,onCrop:r,onRemove:i}){let a=(0,F.useRef)(null),o=(0,F.useRef)(null),s=e=>{let t=new FileReader;t.onload=()=>n(t.result),t.readAsDataURL(e)},c=n=>{e&&(n.target.setPointerCapture(n.pointerId),o.current={x:n.clientX,y:n.clientY,cx:t.x,cy:t.y})},u=e=>{if(!o.current||!a.current)return;let n=a.current.offsetWidth,i=(e.clientX-o.current.x)/n,s=(e.clientY-o.current.y)/n;r({...t,x:o.current.cx+i,y:o.current.cy+s})},d=()=>{o.current=null},p=e=>r({...t,scale:Math.min(4,Math.max(1,t.scale+e))});return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{ref:a,onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault();let t=e.dataTransfer.files?.[0];t?.type.startsWith(`image/`)&&s(t)},onPointerDown:c,onPointerMove:u,onPointerUp:d,onWheel:t=>e&&p(t.deltaY<0?.1:-.1),className:A(`border-border relative aspect-square w-full overflow-hidden rounded-2xl border-2`,e?`cursor-grab active:cursor-grabbing`:`bg-background`),children:e?(0,Q.jsx)(`img`,{src:e,alt:``,draggable:!1,className:`pointer-events-none absolute inset-0 h-full w-full object-cover`,style:{transform:`translate(${t.x*100}%, ${t.y*100}%) scale(${t.scale})`}}):(0,Q.jsxs)(`label`,{className:`text-muted-foreground flex h-full cursor-pointer flex-col items-center justify-center gap-2 p-4 text-center text-sm font-semibold`,children:[(0,Q.jsx)(Re,{className:`size-6`}),me(),(0,Q.jsx)(`span`,{className:`text-xs font-normal`,children:ae()}),(0,Q.jsx)(`input`,{type:`file`,accept:`image/*`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&s(t),e.target.value=``}})]})}),e&&(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,Q.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>p(-.25),className:`size-8 cursor-pointer rounded-full border-2 p-0 font-bold`,children:`â`}),(0,Q.jsx)(`input`,{type:`range`,min:100,max:400,value:Math.round(t.scale*100),onChange:e=>r({...t,scale:Number(e.target.value)/100}),className:`accent-primary h-2 flex-1 cursor-pointer`}),(0,Q.jsx)(M,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>p(.25),className:`size-8 cursor-pointer rounded-full border-2 p-0 font-bold`,children:`+`}),(0,Q.jsx)(M,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,className:`h-8 cursor-pointer rounded-full px-3 text-xs font-bold text-red-600`,children:f()})]}),e&&(0,Q.jsx)(`p`,{className:`text-muted-foreground mt-1 text-xs`,children:l()})]})}function jt({value:e,options:t,onChange:n}){return(0,Q.jsx)(`div`,{className:`bg-background border-border inline-flex rounded-full border-2 p-1`,children:t.map(t=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>
1n(t.value),className:A(`cursor-pointer rounded-full px-3 py-1 text-sm font-bold transition-colors`,e===t.value?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground`),children:t.label},t.value))})}function $({children:e}){return(0,Q.jsx)(`span`,{className:`text-foreground/80 mb-1.5 block text-sm font-bold`,children:e})}var Mt=`border-border bg-background h-10 w-full cursor-pointer rounded-xl border-2 px-3 font-semibold`;function Nt({r:t,tags:n,patch:r,addTag:i}){let[o,s]=(0,F.useState)(``);return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsx)(At,{img:t.img,crop:t.crop,onImage:e=>r({img:e}),onCrop:e=>r({crop:e}),onRemove:()=>r({img:null})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)($,{children:Ce()}),(0,Q.jsx)(P,{value:t.name,onChange:e=>r({name:e.target.value}),placeholder:ve(),maxLength:24,className:`h-10 rounded-xl border-2 px-3 font-semibold`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)($,{children:a()}),(0,Q.jsx)(jt,{value:t.textStyle,onChange:e=>r({textStyle:e}),options:[{value:`overlay`,label:g()},{value:`label`,label:m()},{value:`hidden`,label:p()}]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)($,{children:w()}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r({bg:null}),className:A(`flex h-8 cursor-pointer items-center rounded-full border-2 px-3 text-xs font-bold`,t.bg===null?`border-foreground`:`border-border text-muted-foreground`),children:O()}),tt.map(e=>(0,Q.jsx)(`button`,{type:`button`,"aria-label":e,onClick:()=>r({bg:e}),className:A(`size-8 cursor-pointer rounded-full border-2 transition-transform hover:scale-110`,t.bg===e?`border-foreground scale-110`:`border-border`),style:{backgroundColor:e}},e)),(0,Q.jsxs)(`label`,{className:`border-border relative size-8 cursor-pointer overflow-hidden rounded-full border-2`,children:[(0,Q.jsx)(`input`,{type:`color`,value:t.bg||`#f7d774`,onChange:e=>r({bg:e.target.value}),className:`absolute inset-0 size-full cursor-pointer opacity-0`}),(0,Q.jsx)(`span`,{className:`block size-full`,style:{background:`conic-gradient(red, orange, yellow, lime, cyan, blue, magenta, red)`}})]})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)($,{children:e()}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r({tag:null}),className:A(`h-8 cursor-pointer rounded-full border-2 px-3 text-xs font-bold`,t.tag===null?`border-foreground`:`border-border text-muted-foreground`),children:k()}),n.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r({tag:e}),className:A(`h-8 cursor-pointer rounded-full border-2 px-3 text-xs font-bold`,t.tag===e?`border-primary bg-primary text-primary-foreground`:`border-border`),children:e},e)),(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:(0,Q.jsx)(P,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&o.trim()&&(i(o.trim()),r({tag:o.trim()}),s(``))},placeholder:h(),className:`h-8 w-28 rounded-full border-2 px-3 text-xs font-semibold`})})]})]})]})}function Pt({p:e,onChange:t}){let n=I.find(t=>t.type===e.type);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:i()}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[I.map(n=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t({type:n.type,speed:n.axes[0],manner:n.axes[1],tone:n.axes[2],energy:n.axes[3],quirk:n.axes[4]}),className:A(`h-8 cursor-pointer rounded-full border-2 px-3 text-xs font-bold`,e.type===n.type?`border-primary bg-primary text-primary-foreground`:`border-border`),children:n.type},n.type)),e.type&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t({...e,type:null}),className:`text-muted-foreground h-8 cursor-pointer rounded-full px-2 text-xs font-bold`,children:y()})]}),n&&(0,Q.jsxs)(`p`,{className:`bg-secondary/50 rounded-xl px-3 py-2 text-sm`,children:[(0,Q.jsxs)(`strong`,{children:[n.type,`.`]}),` `,n.desc]}),(0,Q.jsx)(`div`,{className:`space-y-3`,children:it.map(n=>(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsxs)(`div`,{className:`text-muted-foreground mb-1 flex justify-between text-xs font-bold`,children:[(0,Q.jsx)(`span`,{children:n.low}),(0,Q.jsx)(`span`,{children:n.high})]}),(0,Q.jsx)(`input`,{type:`range`,min:0,max:100,value:e[n.key],onChange:r=>t({...e,type:null,[n.key]:Number(r.target.value)}),className:`accent-primary h-2 w-full cursor-pointer`})]},n.key))})]})}function Ft({r:e,patch:t}){let i=n=>{t({datingPrefs:e.datingPrefs.includes(n)?e.datingPrefs.filter(e=>e!==n):[...e.datingPrefs,n]})};return(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)($,{children:r()}),(0,Q.jsx)(Pt,{p:e.personality,onChange:e=>t({personality:e})})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)($,{children:Oe()}
1),(0,Q.jsx)(`select`,{value:e.gender,onChange:e=>t({gender:e.target.value}),className:Mt,children:nt.map(e=>(0,Q.jsx)(`option`,{value:e,children:e||`â`},e||`none`))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)($,{children:n()}),(0,Q.jsx)(P,{value:e.pronouns,onChange:e=>t({pronouns:e.target.value}),placeholder:v(),className:`h-10 rounded-xl border-2 px-3 font-semibold`})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)($,{children:ke()}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:rt.map(t=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>i(t),className:A(`h-9 cursor-pointer rounded-full border-2 px-3 text-sm font-bold`,e.datingPrefs.includes(t)?`border-primary bg-primary text-primary-foreground`:`border-border text-muted-foreground`),children:kt[t]},t))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)($,{children:T()}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,Q.jsxs)(`select`,{value:e.dob.month??``,onChange:n=>t({dob:{...e.dob,month:n.target.value?Number(n.target.value):null}}),className:Mt,children:[(0,Q.jsx)(`option`,{value:``,children:Ae()}),Dt.map((e,t)=>(0,Q.jsx)(`option`,{value:t+1,children:e},e))]}),(0,Q.jsx)(P,{type:`number`,min:1,max:31,value:e.dob.day??``,onChange:n=>t({dob:{...e.dob,day:n.target.value?Number(n.target.value):null}}),placeholder:Ee(),className:`h-10 rounded-xl border-2 px-3 font-semibold`}),(0,Q.jsx)(P,{type:`number`,value:e.dob.year??``,onChange:n=>t({dob:{...e.dob,year:n.target.value?Number(n.target.value):null}}),placeholder:C(),className:`h-10 rounded-xl border-2 px-3 font-semibold`}),(0,Q.jsx)(P,{type:`number`,value:e.dob.age??``,onChange:n=>t({dob:{...e.dob,age:n.target.value?Number(n.target.value):null}}),placeholder:E(),className:`h-10 rounded-xl border-2 px-3 font-semibold`})]}),(0,Q.jsxs)(`label`,{className:`mt-3 flex cursor-pointer items-center gap-2`,children:[(0,Q.jsx)(Ze,{checked:e.dob.dontAge,onCheckedChange:n=>t({dob:{...e.dob,dontAge:n}})}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold`,children:D()})]})]})]})}function It({r:e,patch:t}){return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsx)(At,{img:e.pet.img,crop:e.pet.crop,onImage:n=>t({pet:{...e.pet,img:n}}),onCrop:n=>t({pet:{...e.pet,crop:n}}),onRemove:()=>t({pet:{...e.pet,img:null}})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)($,{children:he()}),(0,Q.jsx)(P,{value:e.pet.name,onChange:n=>t({pet:{...e.pet,name:n.target.value}}),placeholder:ye(),maxLength:24,className:`h-10 rounded-xl border-2 px-3 font-semibold`})]})]})}function Lt({r:e,residents:t,patch:n}){let r=e=>t.find(t=>t.id===e)?.name.trim()||`â`,i=t.filter(t=>t.id!==e.id&&!V(t)),a=(t,r)=>n({family:{...e.family,[t]:r}});return i.length===0?(0,Q.jsx)(`p`,{className:`text-muted-foreground py-8 text-center text-sm font-semibold`,children:we()}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:ce()}),et.map(t=>{let n=e.family[t],o=i.filter(e=>!n.includes(e.id));return(0,Q.jsxs)(`div`,{className:`border-border rounded-xl border-2 p-3`,children:[(0,Q.jsx)($,{children:Ot[t]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.map(e=>(0,Q.jsxs)(`span`,{className:`bg-secondary text-secondary-foreground inline-flex items-center gap-1 rounded-full px-3 py-1 text-xs font-bold`,children:[r(e),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`remove`,onClick:()=>a(t,n.filter(t=>t!==e)),className:`cursor-pointer`,children:(0,Q.jsx)(ze,{className:`size-3`})})]},e)),o.length>0&&(0,Q.jsxs)(`select`,{value:``,onChange:e=>{e.target.value&&a(t,[...n,e.target.value])},className:`border-border bg-background h-8 cursor-pointer rounded-full border-2 px-3 text-xs font-bold`,children:[(0,Q.jsxs)(`option`,{value:``,children:[`ï¼ `,oe()]}),o.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.name.trim()||`â`},e.id))]})]})]},t)})]})}function Rt({r:e}){let t=e.name.trim()&&e.textStyle!==`hidden`;return(0,Q.jsxs)(Q.Fragment,{children:[e.img&&(0,Q.jsx)(`img`,{src:e.img,alt:``,draggable:!1,className:`pointer-events-none absolute inset-0 h-full w-full object-cover`,style:{transform:`translate(${e.crop.x*100}%, ${e.crop.y*100}%) scale(${e.crop.scale})`}}),t&&(0,Q.jsx)(`span`,{className:A(`absolute inset-x-0 bottom-0 truncate px-1 py-0.5 text-center text-[10px] font-bold`,e.textStyle===`label`?`bg-[#fffdf5] text-[#3a2a12]`:`bg-black/55 text-white`),children:e.name})]})}function zt(){let[e,n]=(0,F.useState)(H),[r,i]=(0,F.useState)(!1),[a,o]=(0,F.useState)(null),[l,u]=(0,F.useState)(`look`),[f,p]=(0,F.useState)(!1),m=(0,F.useRef)(null),h=(0,F.useRef)(null);(0,F.useEffect)(()=>{try{let e=localStorage.getItem(Tt);e&&n(Z(e)),localStorage.getItem(Et)!==`1`&&p(!0)}catch{p(!0)}i(!0)},[]);let g=()=>{p(!1);try{localStorage.setItem(Et,`1`)}catch{}};(0,F.useEffect)(()=>
1{if(r)try{localStorage.setItem(Tt,bt(e))}catch{}},[e,r]);let v=a===null?-1:e.residents.findIndex(e=>e.id===a),y=v>=0?e.residents[v]:null,x=(e,t)=>n(n=>({...n,residents:n.residents.map(n=>n.id===e?{...n,...t}:n)})),C=e=>a&&x(a,e),w=e=>n(t=>t.tags.includes(e)?t:{...t,tags:[...t.tags,e]}),T=()=>{a&&(n(e=>({...e,residents:e.residents.map(e=>e.id===a?R(e.id):e)})),o(null))},ae=e=>{let t=m.current;m.current=null,!(t===null||t===e)&&n(n=>{let r=[...n.residents],[i]=r.splice(t,1);return r.splice(e,0,i),{...n,residents:r}})},oe=e=>n(t=>({...t,residents:ot(t.residents,e)})),ce=async()=>{let t=await ft(e),n=e.islandName.trim().toLowerCase().replace(/\s+/g,`-`)||`tomodachi-life-island`,r=document.createElement(`a`);r.href=t,r.download=`${n}-island-planner.png`,r.click()},E=async()=>{let t=await St(e),n=e.islandName.trim().toLowerCase().replace(/\s+/g,`-`)||`tomodachi-life-island`,r=new Blob([t],{type:`application/octet-stream`}),i=document.createElement(`a`);i.href=URL.createObjectURL(r),i.download=`${n}.tomo`,i.click(),URL.revokeObjectURL(i.href)},D=async e=>{try{n(e.name.endsWith(`.tomo`)?await Ct(await e.arrayBuffer()):wt(await e.text())),o(null)}catch{alert(se())}},O=()=>{confirm(le())&&(n(H()),o(null))},k=[{key:`tag`,label:d()},{key:`personality`,label:s()},{key:`gender`,label:S()},{key:`name`,label:ee()}],me=[{key:`look`,label:b()},{key:`details`,label:t()},{key:`pet`,label:Me()},{key:`family`,label:_()}];return(0,Q.jsxs)(`section`,{className:`px-4 pb-10 sm:pb-16`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[f&&(0,Q.jsxs)(`div`,{className:`border-primary/40 bg-accent mb-5 flex flex-col gap-3 rounded-2xl border-2 p-4 shadow-[0_4px_0_0_var(--border)] sm:flex-row sm:items-center sm:gap-4`,children:[(0,Q.jsx)(`div`,{className:`bg-primary/15 text-primary flex size-10 shrink-0 items-center justify-center rounded-full`,children:(0,Q.jsx)(Be,{className:`size-5`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-foreground font-serif text-base font-bold`,children:Se()}),(0,Q.jsx)(`p`,{className:`text-muted-foreground text-sm leading-relaxed`,children:_e()})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Q.jsxs)(M,{onClick:()=>void E(),className:`h-10 cursor-pointer gap-2 rounded-full px-4 font-bold shadow-[0_3px_0_0_oklch(0.58_0.16_50)] transition-transform active:translate-y-0.5 active:shadow-none`,children:[(0,Q.jsx)(Le,{className:`size-4`}),ne()]}),(0,Q.jsx)(M,{variant:`ghost`,onClick:g,className:`text-muted-foreground h-10 cursor-pointer rounded-full px-4 font-bold`,children:fe()})]})]}),(0,Q.jsxs)(`div`,{id:`tool`,className:`border-border bg-card scroll-mt-20 rounded-3xl border-2 p-5 shadow-[0_6px_0_0_var(--border)] sm:p-8`,children:[(0,Q.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-end justify-between gap-4`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)($,{children:re()}),(0,Q.jsx)(P,{value:e.islandName,onChange:e=>n(t=>({...t,islandName:e.target.value})),placeholder:je(),maxLength:40,className:`h-11 w-64 max-w-full rounded-full border-2 px-4 font-semibold`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsxs)(`span`,{className:`text-muted-foreground inline-flex items-center gap-1 text-sm font-bold`,children:[(0,Q.jsx)(Qe,{className:`size-4`}),xe()]}),k.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>oe(e.key),className:`border-border hover:border-primary/50 h-9 cursor-pointer rounded-full border-2 px-3 text-sm font-bold`,children:e.label},e.key)),(0,Q.jsx)(`span`,{className:`bg-secondary text-secondary-foreground rounded-full px-3 py-1 text-sm font-bold tabular-nums`,children:De({filled:pt(e),total:70})})]})]}),(0,Q.jsx)(`div`,{className:`border-border overflow-x-auto rounded-2xl border-2 bg-[#f9c22e] p-3`,children:(0,Q.jsx)(`div`,{className:`mx-auto grid gap-2`,style:{gridTemplateColumns:`repeat(10, minmax(0,1fr))`,minWidth:`440px`},children:e.residents.map((e,t)=>(0,Q.jsx)(`button`,{type:`button`,draggable:!0,onDragStart:()=>m.current=t,onDragOver:e=>e.preventDefault(),onDrop:()=>ae(t),onClick:()=>{u(`look`),o(e.id)},"aria-label":te({n:t+1}),className:`relative aspect-square cursor-pointer overflow-hidden rounded-xl border-2 border-black/20 transition-transform hover:scale-[1.04]`,style:{backgroundColor:e.bg||`#171717`},children:(0,Q.jsx)(Rt,{r:e})},e.id))})}),(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Q.jsxs)(M,{onClick:()=>void ce(),className:`h-11 cursor-pointer gap-2 rounded-full px-5 font-bold shadow-[0_3px_0_0_oklch(0.58_0.16_50)] transition-transform active:translate-y-0.5 active:shadow-none`,children:[(0,Q.jsx)(Fe,{className:`size-4`}),ue()]}),(0,Q.jsxs)(M,{variant:`outline`,onClick:()=>void E(),className:`h-11 cursor-pointer gap-2 rounded-full border-2 px-4 font-bold`,children:[(0,Q.jsx)(Le,{className:`size-4`}),de()]}),(0,Q.jsxs)(M,{variant:`outline`,onClick:()=>h.current?.click(),className:`h-11 cursor-pointer gap-2 rounded-full border-2 px-4 font-bold`,children:[(0,Q.jsx)(Re,{className:`size-4`}),ge()]}),(0,Q.jsxs)(M,{variant:`ghost`,onClick:O,className:`text-muted-foreground h-11 cursor-pointer gap-2 rounded-full px-4 font-bold`,children:[(0,Q.jsx)($e,{className:`size-4`}),be()]}),(0,Q.jsx)(`input`,{ref:h,type:`file`,accept:`.tomo,application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&D(t),e.target.value=``}})]}),(0,Q.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:Te()})]})]}),(0,Q.jsx)(Xe,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,Q.jsxs)(Je,{className:`max-h-[90vh] gap-0 overflow-hidden p-0 sm:max-w-3xl`,children:[(0,Q.jsx)(qe,{className:`border-border border-b-2 px-5 py-4`,children:(0,Q.jsx)(Ye,{className:`font-serif text-xl`,children:c({n:v+1}
1)})}),y&&(0,Q.jsxs)(`div`,{className:`flex max-h-[70vh] flex-col sm:flex-row`,children:[(0,Q.jsx)(`div`,{className:`border-border flex shrink-0 gap-1 overflow-x-auto border-b-2 p-2 sm:w-40 sm:flex-col sm:border-r-2 sm:border-b-0`,children:me.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>u(e.key),className:A(`cursor-pointer rounded-xl px-3 py-2 text-left text-sm font-bold whitespace-nowrap transition-colors`,l===e.key?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-accent`),children:e.label},e.key))}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-5`,children:[l===`look`&&(0,Q.jsx)(Nt,{r:y,tags:e.tags,patch:C,addTag:w}),l===`details`&&(0,Q.jsx)(Ft,{r:y,patch:C}),l===`pet`&&(0,Q.jsx)(It,{r:y,patch:C}),l===`family`&&(0,Q.jsx)(Lt,{r:y,residents:e.residents,patch:C})]})]}),(0,Q.jsxs)(`div`,{className:`border-border flex items-center justify-between gap-2 border-t-2 px-5 py-3`,children:[(0,Q.jsxs)(M,{variant:`ghost`,onClick:T,className:`h-10 cursor-pointer gap-2 rounded-full px-4 font-bold text-red-600`,children:[(0,Q.jsx)($e,{className:`size-4`}),pe()]}),(0,Q.jsxs)(M,{onClick:()=>o(null),className:`h-10 cursor-pointer gap-2 rounded-full px-6 font-bold`,children:[(0,Q.jsx)(Ie,{className:`size-4 rotate-45`}),ie()]})]})]})})]})}function Bt(){return(0,Q.jsxs)(`div`,{className:`bg-background text-foreground flex min-h-screen flex-col`,children:[(0,Q.jsx)(Pe,{}),(0,Q.jsxs)(`main`,{className:`flex-1`,children:[(0,Q.jsx)(He,{}),(0,Q.jsx)(zt,{}),(0,Q.jsx)(Ke,{}),(0,Q.jsx)(Ue,{}),(0,Q.jsx)(Ge,{}),(0,Q.jsx)(We,{}),(0,Q.jsx)(Ve,{})]}),(0,Q.jsx)(Ne,{})]})}export{Bt as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.