1import{Q as K,S as ue,i as de,s as ce,l as g,a as I,u as fe,P as he,m as b,h as T,c as N,p as P,v as _e,q as n,G as c,b as x,H as Q,R as pe,d as me,f as ve,t as ge,T as ne,U as be,V as ye,W as Te,X as Ee,Y as le,I as ke,g as we,Z as Ue,n as Me}from"../../chunks/index-fd691c2a.js";import{c as S}from"../../chunks/singletons-eca981c1.js";import{a as ie}from"../../chunks/index-671f259b.js";S.disable_scroll_handling;S.goto;const Ie=S.invalidate;S.prefetch;S.prefetch_routes;S.before_navigate;S.after_navigate;function W(d,{pending:e,error:t,result:a}={}){let f;async function v(_){const o=f={};_.preventDefault();const i=new FormData(d);e&&e({data:i,form:d});try{const h=await fetch(d.action,{method:d.method,headers:{accept:"application/json"},body:i});if(o!==f)return;if(h.ok){a&&a({data:i,form:d,response:h});const s=new URL(d.action);s.search=s.hash="",Ie(s.href)}else t?t({data:i,form:d,error:null,response:h}):console.error(await h.text())}catch(h){if(t&&h instanceof Error)t({data:i,form:d,error:h,response:null});else throw h}}return d.addEventListener("submit",v),{destroy(){d.removeEventListener("submit",v)}}}function se(d,{delay:e=0,duration:t=400,easing:a=ie,start:f=0,op
1acity:v=0}={}){const _=getComputedStyle(d),o=+_.opacity,i=_.transform==="none"?"":_.transform,h=1-f,s=o*(1-v);return{delay:e,duration:t,easing:a,css:(w,E)=>` 2 transform: ${i} scale(${1-h*E}); 3 opacity: ${o-s*E} 4 `}}function Ne(d,{from:e,to:t},a={}){const f=getComputedStyle(d),v=f.transform==="none"?"":f.transform,[_,o]=f.transformOrigin.split(" ").map(parseFloat),i=e.left+e.width*_/t.width-(t.left+_),h=e.top+e.height*o/t.height-(t.top+o),{delay:s=0,duration:w=U=>Math.sqrt(U)*120,easing:E=ie}=a;return{delay:s,duration:K(w)?w(Math.sqrt(i*i+h*h)):w,easing:E,css:(U,p)=>{const y=p*i,R=p*h,r=U+p*e.width/t.width,l=U+p*e.height/t.height;return`transform: ${v} translate(${y}px, ${R}px) scale(${r}, ${l});`}}}function oe(d,e,t){const a=d.slice();return a[3]=e[t],a[4]=e,a[5]=t,a}function re(d,e){let t,a,f,v,_,o,i,h,s,w,E,U,p,y,R,r,l,u,B,C,A,O,D,$,X,F,V,j,Y,q,Z,z=Me,M,J,ee;function te(...k){return e[1](e[3],e[4],e[5],...k)}function ae(){return e[2](e[3],e[4],e[5])}return{key:d,first:null,c(){t=g("div"),a=g("form"),f=g("input"),_=I(),o=g("input"),h=I(),s=g("button"),U=I(),p=g("form"),y=g("input"),r=I(),l=g("input"),B=I(),C=g("button"),A=I(),O=g("form"),D=g("input"),X=I(),F=g("button"),Y=I(),this.h()},l(k){t=b(k,"DIV",{class:!0});var m=P(t);a=b(m,"FORM",{action:!0,method:!0});var H=P(a);f=b(H,"INPUT",{type:!0,name:!0,class:!0}),_=N(H),o=b(H,"INPUT",{type:!0,name:!0,class:!0}),h=N(H),s=b(H,"BUTTON",{class:!0,"aria-label":!0}),P(s).forEach(T),H.forEach(T),U=N(m),p=b(m,"FORM",{class:!0,action:!0,method:!0});var L=P(p);y=b(L,"INPUT",{type:!0,name:!0,class:!0}),r=N(L),l=b(L,"INPUT",{"aria-label":!0,type:!0,name:!0,class:!0}),B=N(L),C=b(L,"BUTTON",{class:!0,"aria-label":!0}),P(C).forEach(T),L.forEach(T),A=N(m),O=b(m,"FORM",{action:!0,method:!0});var G=P(O);D=b(G,"INPUT",{type:!0,name:!0,class:!0}),X=N(G),F=b(G,"BUTTON",{class:!0,"aria-label":!0}),P(F).forEach(T),G.forEach(T),Y=N(m),m.forEach(T),this.h()},h(){n(f,"type","hidden"),n(f,"name","uid"),f.value=v=e[3].uid,n(f,"class","svelte-16nsat"),n(o,"type","hidden"),n(o,"name","done"),o.value=i=e[3].done?"":"true",n(o,"class","svelte-16nsat"),n(s,"class","toggle svelte-16nsat"),n(s,"aria-label",w="Mark todo as "+(e[3].done?"not done":"done")),n(a,"action","/todos?_method=PATCH"),n(a,"method","post"),n(y,"type","hidden"),n(y,"name","uid"),y.value=R=e[3].uid,n(y,"class","svelte-16nsat"),n(l,"aria-label","Edit todo"),n(l,"type","text"),n(l,"name","text"),l.value=u=e[3].text,n(l,"class","svelte-16nsat"),n(C,"class","save svelte-16nsat"),n(C,"aria-label","Save todo"),n(p,"class","text svelte-16nsat"),n(p,"action","/todos?_method=PATCH"),n(p,"method","post"),n(D,"type","hidden"),n(D,"name","uid"),D.value=$=e[3].uid,n(D,"class","svelte-16nsat"),n(F,"class","delete svelte-16nsat"),n(F,"aria-label","Delete todo"),F.disabled=V=e[3].pending_delete,n(O,"action","/todos?_method=DELETE"),n(O,"method","post"),n(t,"class","todo svelte-16nsat"),ne(t,"done",e[3].done),this.first=t},m(k,m){x(k,t,m),c(t,a),c(a,f),c(a,_),c(a,o),c(a,h),c(a,s),c(t,U),c(t,p),c(p,y),c(p,r),c(p,l),c(p,B),c(p,C),c(t,A),c(t,O),c(O,D),c(O,X),c(O,F),c(t,Y),M=!0,J||(ee=[Q(E=W.call(null,a,{pending:te})),Q(W.call(null,p)),Q(j=W.call(null,O,{pending:ae}))],J=!0)},p(k,m){e=k,(!M||m&1&&v!==(v=e[3].uid))&&(f.value=v),(!M||m&1&&i!==(i=e[3].done?"":"true"))&&(o.value=i),(!M||m&1&&w!==(w="Mark todo as "+(e[3].done?"not done":"done")))&&n(s,"aria-label",w),E&&K(E.update)&&m&1&&E.update.call(null,{pending:te}),(!M||m&1&&R!==(R=e[3].uid))&&(y.value=R),(!M||m&1&&u!==(u=e[3].text)&&l.value!==u)&&(l.value=u),(!M||m&1&&$!==($=e[3].uid))&&(D.value=$),(!M||m&1&&V!==(V=e[3].pending_delete))&&(F.disabled=V),j&&K(j.update)&&m&1&&j.update.call(null,{pending:ae}),m&1&&ne(t,"done",e[3].done)},r(){Z=t.getBoundingClientRect()},f(){be(t),z(),ye(t,Z)},a(){z(),z=Te(t,Z,Ne,{duration:200})},i(k){M||(k&&Ee(()=>{q||(q=le(t,se,{start:.7},!0)),q.run(1)}),M=!0)},o(k){k&&(q||(q=le(t,se,{start:.7},!1)),q.run(0)),M=!1},d(k){k&&T(t),k&&q&&q.end(),J=!1,ke(ee)}}}function Oe(d){let e,t,a,f,v,_,o,i,h,s=[],w=new Map,E,U,p,y=d[0];const R=r=>r[3].uid;for(let r=0;r<y.length;r+=1){let l=oe(d,y,r),u=R(l);w.set(u,s[r]=re(u,l))}return{c(){e=g("meta"),t=I(),a=g("div"),f=g("h1"),v=fe("Todos"),_=I(),o=g("form"),i=g("input"),h=I();for(let r=0;r<s.length;r+=1)s[r].c();this.h()},l(r){const l=he('[data-svelte="svelte-aw2gey"]',document.head);e=b(l,"META",{name:!0,content:!0}),l.forEach(T),t=N(r),a=b(r,"DIV",{class:!0});var u=P(a);f=b(u,"H1",{});var B=P(f);v=_e(B,"Todos"),B.forEach(T),_=N(u),o=b(u,"FORM",{class:!0,action:!0,method:!0});var C=P(o);i=b(C,"INPUT",{name:!0,"aria-label":!0,placeholder:!0,class:!0}
4),C.forEach(T),h=N(u);for(let A=0;A<s.length;A+=1)s[A].l(u);u.forEach(T),this.h()},h(){document.title="Todos",n(e,"name","description"),n(e,"content","A todo list app"),n(i,"name","text"),n(i,"aria-label","Add todo"),n(i,"placeholder","+ tap to add a todo"),n(i,"class","svelte-16nsat"),n(o,"class","new svelte-16nsat"),n(o,"action","/todos"),n(o,"method","post"),n(a,"class","todos svelte-16nsat")},m(r,l){c(document.head,e),x(r,t,l),x(r,a,l),c(a,f),c(f,v),c(a,_),c(a,o),c(o,i),c(a,h);for(let u=0;u<s.length;u+=1)s[u].m(a,null);E=!0,U||(p=Q(W.call(null,o,{result:Pe})),U=!0)},p(r,[l]){if(l&1){y=r[0],we();for(let u=0;u<s.length;u+=1)s[u].r();s=pe(s,l,R,1,r,y,w,a,Ue,re,null,oe);for(let u=0;u<s.length;u+=1)s[u].a();me()}},i(r){if(!E){for(let l=0;l<y.length;l+=1)ve(s[l]);E=!0}},o(r){for(let l=0;l<s.length;l+=1)ge(s[l]);E=!1},d(r){T(e),r&&T(t),r&&T(a);for(let l=0;l<s.length;l+=1)s[l].d();U=!1,p()}}}const Pe=async({form:d})=>{d.reset()};function Re(d,e,t){let{todos:a}=e;const f=(_,o,i,{data:h})=>{t(0,o[i].done=!!h.get("done"),a)},v=(_,o,i)=>t(0,o[i].pending_delete=!0,a);return d.$$set=_=>{"todos"in _&&t(0,a=_.todos)},[a,f,v]}class qe extends ue{constructor(e){super(),de(this,e,Re,Oe,ce,{todos:0})}}export{qe as default};
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.