mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-21 01:12:59 +00:00
7 lines
26 KiB
JavaScript
7 lines
26 KiB
JavaScript
import{K as ge,s as ve,e as w,a as $,c as T,b as L,g as B,l as X,f as _,m as C,aa as J,i as N,h as v,q as Y,r as Ce,z as Xe,a9 as Ze,I as Ne,n as P,B as Re,D as we,ab as rt,k as te,W as Qe,y as ne,C as lt,t as x,d as ee,j as ie,a8 as it,U as Ue,A as at,ac as ct}from"../chunks/scheduler.CXEVs2ap.js";import{c as ut,h as dt,u as ft,g as ht}from"../chunks/share-url.D1X9O966.js";import{e as be,u as pt,o as _t}from"../chunks/each.CypvCfon.js";import{S as Te,i as Se,e as ce,f as ue,m as de,g as fe,t as j,c as he,a as q,h as pe,j as re}from"../chunks/index.CTdcniaS.js";import{c as Me,b as mt,K as Ie}from"../chunks/keymap-codes.DVdCLxHW.js";import{A as gt,S as bt,F as Le}from"../chunks/SharePopup.DIKEC4Cs.js";import{L as xe}from"../chunks/i18n-svelte.D0STxjoQ.js";import{b as oe,C as se,c as De,t as yt,a as Pe,o as kt}from"../chunks/Action.tNSJ0eLt.js";import{d as $e,w as Ae}from"../chunks/index.Lgv2TFSy.js";import{a as Be,s as ye,c as vt,e as qe,f as Ye}from"../chunks/index.C1YOBj0U.js";import{A as et,b as Ct}from"../chunks/ActionString.Chtx0xAR.js";import{s as tt}from"../chunks/connection.wgaIHNYB.js";function nt(r,e,t){const o=new gt({target:document.body}),n=document.querySelector("dialog > div"),s=document.querySelector("dialog"),l=n.getBoundingClientRect(),i=r.target.getBoundingClientRect(),u=.5,a=`${1-u*(1-i.width/l.width)} ${1-u*(1-i.height/l.height)}`,c=`${u*(i.x-l.x)}px ${u*(i.y-l.y)}px`,g={duration:150,easing:"ease"},S=n.animate([{scale:a,translate:c},{translate:"0 0",scale:"1"}],g),D=s.animate([{opacity:0},{opacity:1}],g);async function h(){S.reverse(),D.reverse(),await S.finished,o.$destroy(),await ge(),t?.()}o.$on("close",h),o.$on("select",({detail:d})=>{e(d),h()})}function ot(r,e){return e?Me.get(r.code):mt.get(r.key)?.code??Me.get(r.code)}function wt(r){let e;return{c(){e=w("div")},l(t){e=T(t,"DIV",{}),L(e).forEach(_)},m(t,o){N(t,e,o)},p:P,i:P,o:P,d(t){t&&_(e)}}}function Tt(r){let e,t,o="add",n,s=`${r[3]}px 0`,l,i,u;return{c(){e=w("div"),t=w("button"),t.textContent=o,this.h()},l(a){e=T(a,"DIV",{class:!0});var c=L(e);t=T(c,"BUTTON",{class:!0,"data-svelte-h":!0}),X(t)!=="svelte-1y7ruzp"&&(t.textContent=o),c.forEach(_),this.h()},h(){C(t,"class","icon svelte-niexr"),C(e,"class","cursor svelte-niexr"),Re(e,"translate",s)},m(a,c){N(a,e,c),v(e,t),r[8](t),l=!0,i||(u=Y(t,"click",r[7]),i=!0)},p(a,c){c&8&&s!==(s=`${a[3]}px 0`)&&Re(e,"translate",s)},i(a){l||(a&&we(()=>{l&&(n||(n=re(e,Be,{},!0)),n.run(1))}),l=!0)},o(a){a&&(n||(n=re(e,Be,{},!1)),n.run(0)),l=!1},d(a){a&&_(e),r[8](null),a&&n&&n.end(),i=!1,u()}}}function St(r){let e,t,o,n,s,l,i,u="•",a,c,f;const g=[Tt,wt],S=[];function D(h,d){return h[4]?0:1}return t=D(r),o=S[t]=g[t](r),s=new et({props:{actions:r[0].phrase}}),{c(){e=w("div"),o.c(),n=$(),ce(s.$$.fragment),l=$(),i=w("sup"),i.textContent=u,this.h()},l(h){e=T(h,"DIV",{role:!0,tabindex:!0,class:!0});var d=L(e);o.l(d),n=B(d),ue(s.$$.fragment,d),l=B(d),i=T(d,"SUP",{class:!0,"data-svelte-h":!0}),X(i)!=="svelte-ouf49e"&&(i.textContent=u),d.forEach(_),this.h()},h(){C(i,"class","svelte-niexr"),C(e,"role","textbox"),C(e,"tabindex","0"),C(e,"class","svelte-niexr"),J(e,"edited",!r[0].deleted&&r[0].phraseChanged)},m(h,d){N(h,e,d),S[t].m(e,null),v(e,n),de(s,e,null),v(e,l),v(e,i),r[9](e),a=!0,c||(f=[Y(e,"keydown",r[5]),Y(e,"mousedown",r[6]),Y(e,"focusin",r[10]),Y(e,"focusout",r[11])],c=!0)},p(h,[d]){let b=t;t=D(h),t===b?S[t].p(h,d):(fe(),j(S[b],1,1,()=>{S[b]=null}),he(),o=S[t],o?o.p(h,d):(o=S[t]=g[t](h),o.c()),q(o,1),o.m(e,n));const m={};d&1&&(m.actions=h[0].phrase),s.$set(m),(!a||d&1)&&J(e,"edited",!h[0].deleted&&h[0].phraseChanged)},i(h){a||(q(o),q(s.$$.fragment,h),a=!0)},o(h){j(o),j(s.$$.fragment,h),a=!1},d(h){h&&_(e),S[t].d(),pe(s),r[9](null),c=!1,Ce(f)}}}function Et(r,e,t){let{chord:o}=e;Xe(()=>{o.phrase.length===0&&f.focus()});function n(p){if(p.key==="ArrowUp")a(p);else if(p.key==="ArrowLeft")s(g-1);else if(p.key==="ArrowRight")s(g+1);else if(p.key==="Backspace")l(g-1),s(g-1);else if(p.key==="Delete")l(g);else{if(p.key==="Shift")return;const A=ot(p,Ze(tt)?.device==="X");A!==void 0&&(i(g,A),ge().then(()=>s(g+1)))}}function s(p){g=Math.max(0,Math.min(p,o.phrase.length));const A=f.children.item(g);t(3,S=A.offsetLeft+A.offsetWidth)}function l(p,A=1){p in o.phrase&&oe.update(O=>(O.push({type:se.Chord,id:o.id,actions:o.actions,phrase:o.phrase.toSpliced(p,A)}),O))}function i(p,A){oe.update(O=>(O.push({type:se.Chord,id:o.id,actions:o.actions,phrase:o.phrase.toSpliced(p,0,A)}),O))}function u(p){if(p.target===c)return;const A=p.layerX;let O=0;for(const I of f.children){const{offsetLeft:y,offsetWidth:E}=I;if(A<y+E/2){s(O-1);return}O++}s(O-1)}function a(p){nt(p,A=>{i(g,A),ge().then(()=>s(g+1))},()=>f.focus())}let c,f,g=0,S=0,D=!1;function h(p){Ne[p?"unshift":"push"](()=>{c=p,t(1,c)})}function d(p){Ne[p?"unshift":"push"](()=>{f=p,t(2,f)})}const b=()=>t(4,D=!0),m=p=>{p.relatedTarget!==c&&t(4,D=!1)};return r.$$set=p=>{"chord"in p&&t(0,o=p.chord)},[o,c,f,S,D,n,u,a,h,d,b,m]}class At extends Te{constructor(e){super(),Se(this,e,Et,St,ve,{chord:0})}}function Ve(r,e,t){const o=r.slice();return o[13]=e[t],o}function Ot(r){let e,t=r[5].configure.chords.NEW_CHORD()+"",o;return{c(){e=w("span"),o=x(t),this.h()},l(n){e=T(n,"SPAN",{class:!0});var s=L(e);o=ee(s,t),s.forEach(_),this.h()},h(){C(e,"class","svelte-1gh96s2")},m(n,s){N(n,e,s),v(e,o)},p(n,s){s&32&&t!==(t=n[5].configure.chords.NEW_CHORD()+"")&&ie(o,t)},d(n){n&&_(e)}}}function Nt(r){let e,t=r[5].configure.chords.HOLD_KEYS()+"",o;return{c(){e=w("span"),o=x(t),this.h()},l(n){e=T(n,"SPAN",{class:!0});var s=L(e);o=ee(s,t),s.forEach(_),this.h()},h(){C(e,"class","svelte-1gh96s2")},m(n,s){N(n,e,s),v(e,o)},p(n,s){s&32&&t!==(t=n[5].configure.chords.HOLD_KEYS()+"")&&ie(o,t)},d(n){n&&_(e)}}}function ze(r){let e,t,o=be(r[3]??[]),n=[];for(let l=0;l<o.length;l+=1)n[l]=He(Ve(r,o,l));let s=r[3]?.length&&je();return{c(){for(let l=0;l<n.length;l+=1)n[l].c();e=$(),s&&s.c(),t=ne()},l(l){for(let i=0;i<n.length;i+=1)n[i].l(l);e=B(l),s&&s.l(l),t=ne()},m(l,i){for(let u=0;u<n.length;u+=1)n[u]&&n[u].m(l,i);N(l,e,i),s&&s.m(l,i),N(l,t,i)},p(l,i){if(i&8){o=be(l[3]??[]);let u;for(u=0;u<o.length;u+=1){const a=Ve(l,o,u);n[u]?n[u].p(a,i):(n[u]=He(a),n[u].c(),n[u].m(e.parentNode,e))}for(;u<n.length;u+=1)n[u].d(1);n.length=o.length}l[3]?.length?s||(s=je(),s.c(),s.m(t.parentNode,t)):s&&(s.d(1),s=null)},d(l){l&&(_(e),_(t)),lt(n,l),s&&s.d(l)}}}function He(r){let e,t=r[13]+"",o;return{c(){e=w("sub"),o=x(t)},l(n){e=T(n,"SUB",{});var s=L(e);o=ee(s,t),s.forEach(_)},m(n,s){N(n,e,s),v(e,o)},p(n,s){s&8&&t!==(t=n[13]+"")&&ie(o,t)},d(n){n&&_(e)}}}function je(r){let e,t="→";return{c(){e=w("span"),e.textContent=t,this.h()},l(o){e=T(o,"SPAN",{class:!0,"data-svelte-h":!0}),X(e)!=="svelte-1flegkm"&&(e.textContent=t),this.h()},h(){C(e,"class","svelte-1gh96s2")},m(o,n){N(o,e,n)},d(o){o&&_(e)}}}function Dt(r){let e,t,o,n,s,l,i="•",u,a,c="add_circle",f,g,S;function D(m,p){if(m[2]&&m[1].size===0)return Nt;if(!m[2]&&!m[0])return Ot}let h=D(r),d=h&&h(r),b=!r[2]&&ze(r);return n=new et({props:{display:"keys",actions:r[2]?[...r[1]].sort(ke):r[4]??[]}}),{c(){e=w("button"),d&&d.c(),t=$(),b&&b.c(),o=$(),ce(n.$$.fragment),s=$(),l=w("sup"),l.textContent=i,u=$(),a=w("button"),a.textContent=c,this.h()},l(m){e=T(m,"BUTTON",{class:!0});var p=L(e);d&&d.l(p),t=B(p),b&&b.l(p),o=B(p),ue(n.$$.fragment,p),s=B(p),l=T(p,"SUP",{class:!0,"data-svelte-h":!0}),X(l)!=="svelte-ouf49e"&&(l.textContent=i),u=B(p),a=T(p,"BUTTON",{class:!0,"data-svelte-h":!0}),X(a)!=="svelte-14i44ur"&&(a.textContent=c),p.forEach(_),this.h()},h(){C(l,"class","svelte-1gh96s2"),C(a,"class","icon add svelte-1gh96s2"),C(e,"class","chord svelte-1gh96s2"),J(e,"deleted",r[0]&&r[0].deleted),J(e,"edited",r[0]&&r[0].actionsChanged),J(e,"invalid",r[0]&&r[4]&&(r[4].length<2||r[4].some(r[10])))},m(m,p){N(m,e,p),d&&d.m(e,null),v(e,t),b&&b.m(e,null),v(e,o),de(n,e,null),v(e,s),v(e,l),v(e,u),v(e,a),f=!0,g||(S=[Y(a,"click",rt(r[9])),Y(e,"click",r[6]),Y(e,"keydown",r[7]),Y(e,"keyup",r[8]),Y(e,"blur",r[8])],g=!0)},p(m,[p]){h===(h=D(m))&&d?d.p(m,p):(d&&d.d(1),d=h&&h(m),d&&(d.c(),d.m(e,t))),m[2]?b&&(b.d(1),b=null):b?b.p(m,p):(b=ze(m),b.c(),b.m(e,o));const A={};p&22&&(A.actions=m[2]?[...m[1]].sort(ke):m[4]??[]),n.$set(A),(!f||p&1)&&J(e,"deleted",m[0]&&m[0].deleted),(!f||p&1)&&J(e,"edited",m[0]&&m[0].actionsChanged),(!f||p&17)&&J(e,"invalid",m[0]&&m[4]&&(m[4].length<2||m[4].some(m[10])))},i(m){f||(q(n.$$.fragment,m),f=!0)},o(m){j(n.$$.fragment,m),f=!1},d(m){m&&_(e),d&&d.d(),b&&b.d(),pe(n),g=!1,Ce(S)}}}function ke(r,e){return r-e}function Rt(r,e,t){let o,n,s;te(r,xe,d=>t(5,s=d));let{chord:l=void 0}=e;const i=Qe();let u=new Set,a=!1;function c(...d){const b=n??[];return[...b,...Array.from({length:12-(b.length+d.length+1)},()=>0),...d.toSorted(ke)]}function f(){t(1,u=new Set),t(2,a=!0)}function g(d){if(d.key==="Tab"||d.key==="Escape"||!a)return;d.preventDefault();const b=ot(d,Ze(tt)?.device==="X");if(b==null){alert("Invalid key");return}u.add(b),t(1,u)}function S(){if(a&&(t(2,a=!1),!(u.size<1))){if(!l)return i("submit",c(...u));oe.update(d=>(d.push({type:se.Chord,id:l.id,actions:c(...u),phrase:l.phrase}),d))}}function D(d){nt(d,b=>{oe.update(m=>(console.log(n,o,b),m.push({type:se.Chord,id:l.id,actions:c(...o,b),phrase:l.phrase}),m))})}const h=(d,b)=>o[b]!==d;return r.$$set=d=>{"chord"in d&&t(0,l=d.chord)},r.$$.update=()=>{r.$$.dirty&1&&t(4,o=l?.actions.slice(l.actions.lastIndexOf(0)+1).toSorted(ke)),r.$$.dirty&1&&t(3,n=l?.actions.slice(0,l.actions.indexOf(0)))},[l,u,a,n,o,s,f,g,S,D,h]}class st extends Te{constructor(e){super(),Se(this,e,Rt,Dt,ve,{chord:0})}}function Ut(r){let e,t="restore_from_trash",o,n,s,l;return{c(){e=w("button"),e.textContent=t,this.h()},l(i){e=T(i,"BUTTON",{class:!0,"data-svelte-h":!0}),X(e)!=="svelte-5y8g5t"&&(e.textContent=t),this.h()},h(){C(e,"class","icon compact svelte-w21w7s")},m(i,u){N(i,e,u),n=!0,s||(l=Y(e,"click",r[2]),s=!0)},p:P,i(i){n||(i&&we(()=>{n&&(o||(o=re(e,ye,{},!0)),o.run(1))}),n=!0)},o(i){i&&(o||(o=re(e,ye,{},!1)),o.run(0)),n=!1},d(i){i&&_(e),i&&o&&o.end(),s=!1,l()}}}function Mt(r){let e,t="delete",o,n,s,l;return{c(){e=w("button"),e.textContent=t,this.h()},l(i){e=T(i,"BUTTON",{class:!0,"data-svelte-h":!0}),X(e)!=="svelte-15f8bc2"&&(e.textContent=t),this.h()},h(){C(e,"class","icon compact svelte-w21w7s")},m(i,u){N(i,e,u),n=!0,s||(l=Y(e,"click",r[1]),s=!0)},p:P,i(i){n||(i&&we(()=>{n&&(o||(o=re(e,ye,{},!0)),o.run(1))}),n=!0)},o(i){i&&(o||(o=re(e,ye,{},!1)),o.run(0)),n=!1},d(i){i&&_(e),i&&o&&o.end(),s=!1,l()}}}function It(r){let e,t,o,n,s,l,i,u,a,c,f,g,S,D,h,d="undo",b,m,p,A,O="share",I,y,E;t=new st({props:{chord:r[0]}}),s=new At({props:{chord:r[0]}});const M=[Mt,Ut],V=[];function G(R,z){return R[0].deleted?1:0}return u=G(r),a=V[u]=M[u](r),{c(){e=w("th"),ce(t.$$.fragment),o=$(),n=w("td"),ce(s.$$.fragment),l=$(),i=w("td"),a.c(),c=$(),f=w("button"),g=x("content_copy"),D=$(),h=w("button"),h.textContent=d,b=$(),m=w("div"),p=$(),A=w("button"),A.textContent=O,this.h()},l(R){e=T(R,"TH",{});var z=L(e);ue(t.$$.fragment,z),z.forEach(_),o=B(R),n=T(R,"TD",{class:!0});var le=L(n);ue(s.$$.fragment,le),le.forEach(_),l=B(R),i=T(R,"TD",{class:!0});var F=L(i);a.l(F),c=B(F),f=T(F,"BUTTON",{class:!0});var k=L(f);g=ee(k,"content_copy"),k.forEach(_),D=B(F),h=T(F,"BUTTON",{class:!0,"data-svelte-h":!0}),X(h)!=="svelte-3tud5p"&&(h.textContent=d),b=B(F),m=T(F,"DIV",{class:!0}),L(m).forEach(_),p=B(F),A=T(F,"BUTTON",{class:!0,"data-svelte-h":!0}),X(A)!=="svelte-19qx12b"&&(A.textContent=O),F.forEach(_),this.h()},h(){C(n,"class","svelte-w21w7s"),f.disabled=S=r[0].deleted,C(f,"class","icon compact svelte-w21w7s"),C(h,"class","icon compact svelte-w21w7s"),J(h,"disabled",r[0].isApplied),C(m,"class","separator svelte-w21w7s"),C(A,"class","icon compact svelte-w21w7s"),C(i,"class","table-buttons svelte-w21w7s")},m(R,z){N(R,e,z),de(t,e,null),N(R,o,z),N(R,n,z),de(s,n,null),N(R,l,z),N(R,i,z),V[u].m(i,null),v(i,c),v(i,f),v(f,g),v(i,D),v(i,h),v(i,b),v(i,m),v(i,p),v(i,A),I=!0,y||(E=[Y(f,"click",r[3]),Y(h,"click",r[2]),Y(A,"click",r[4])],y=!0)},p(R,[z]){const le={};z&1&&(le.chord=R[0]),t.$set(le);const F={};z&1&&(F.chord=R[0]),s.$set(F);let k=u;u=G(R),u===k?V[u].p(R,z):(fe(),j(V[k],1,1,()=>{V[k]=null}),he(),a=V[u],a?a.p(R,z):(a=V[u]=M[u](R),a.c()),q(a,1),a.m(i,c)),(!I||z&1&&S!==(S=R[0].deleted))&&(f.disabled=S),(!I||z&1)&&J(h,"disabled",R[0].isApplied)},i(R){I||(q(t.$$.fragment,R),q(s.$$.fragment,R),q(a),I=!0)},o(R){j(t.$$.fragment,R),j(s.$$.fragment,R),j(a),I=!1},d(R){R&&(_(e),_(o),_(n),_(l),_(i)),pe(t),pe(s),V[u].d(),y=!1,Ce(E)}}}function Lt(r,e){return r.actions.length===e.actions.length&&r.actions.every((t,o)=>t===e.actions[o])}function Pt(r,e,t){let o;te(r,De,c=>t(5,o=c));let{chord:n}=e;const s=Qe();function l(){oe.update(c=>(c.push({type:se.Chord,id:n.id,actions:n.actions,phrase:n.phrase,deleted:!0}),c))}function i(){oe.update(c=>c.filter(f=>!(f.type===se.Chord&&Lt(f,n))))}function u(){const c=[...n.id];for(c.splice(c.indexOf(0),1),c.push(0);o.some(f=>JSON.stringify(f.id)===JSON.stringify(c));)c[c.length-1]++;oe.update(f=>(f.push({type:se.Chord,id:c,actions:[...n.actions],phrase:[...n.phrase]}),f)),s("duplicate")}async function a(c){const f=new URL(window.location.href);f.searchParams.set("import",await ut({charaVersion:1,type:"chords",chords:[[n.actions,n.phrase]]})),await navigator.clipboard.writeText(f.toString());let g;yt(c.target,{onCreate(S){const D=S.popper.querySelector(".tippy-content");g=new bt({target:D})},onHidden(S){S.destroy()},onDestroy(S){g.$destroy()}}).show()}return r.$$set=c=>{"chord"in c&&t(0,n=c.chord)},[n,l,i,u,a]}class $t extends Te{constructor(e){super(),Se(this,e,Pt,It,ve,{chord:0})}}const me=["You can use DUP+i to create chords on the fly in any text box","This site is open source! Check out the full source code on GitHub in the bottom left","Two letter chords can be activated accidentally in chentry. Be cautious around them","More inputs in a chord increase the tolerance, making them easier to activate","The maximum number of outputs in a chord is 256","You can create backups of your device on the top right","For programming you should set your auto-delete timeout to about 200ms","Large parts of this site were written on a CC1","I use VIM btw...","I use NixOS btw...","You can hold shift on the undo button to undo all changes","GTM stands for Generative Text Menu and can be used to change your device's settings anywhere","Ambidextrous Throwover (aka Mirror Mode) is a mode designed for one-handed use","Chentry stands for character entry, or typing letter by letter on a chording enabled device","Chord modifiers are hard-coded (as of now) and can be used in the English language to add conjucations and more","You can use 'cursor warping' by adding arrow key actions to a chord, for example to chord '()' with the cursor in the middle of the brackets","An arpeggiate is a single key press that modifies the preceding chord. Modifiers can be arpeggiated","Some actions are marked as a 'macro', which means the output is generated by a key sequence rather than a pure key press. Be cautious with those, as they can affect other keys when held together!","Spurring is a chording only mode which is more advanced, but can greatly improve typing speed when mastered","The forced chord phenomenon is when typing a word character by character starts to feel unnatural","Don't be afraid to delete chords you keep getting wrong","Most people find it easier to start their chord library from scratch rather than learning someone else's","A common techinque to deal with conflicts is to add DUP or the same key mirrored on the other hand","A longer chord is not always more difficult","Riley Keen made headlines when his Monkeytype score of 500WPM using a CC1 got him banned off the site","A 3d press refers to pressing down into a 5-way switch","The serial communication protocol used by CCOS is documented on docs.charachorder.com","The 'CCOS is ready' message can be turned off in the settings","Most people using the CC1 don't change the a-z key layout, as further modification provides very little benefit","Using VIM on the default CC1 a-z layout is perfectly doable, it's just a matter of getting used to it","You can use Nexus to track words you might want to add to your chord library","The CC1 default layout was 80% science, 20% art","There is little to no reason to use hjkl in VIM on a CC1 since the arrows keys are so close already","The device manager automatically creates a backup for you when you reboot your device into the bootloader",'You can use "compound", "macro", "suffix" and "cursor warp" in the chord search to find specific types of chords','You can search for chord inputs by using a leading "+", for example "+a +DUP" will show all chords with inputs that contain both a and DUP'],{document:Oe}=ht;function We(r,e,t){const o=r.slice();return o[29]=e[t][0],o}function Bt(r){let e;return{c(){e=x("- / -")},l(t){e=ee(t,"- / -")},m(t,o){N(t,e,o)},p:P,d(t){t&&_(e)}}}function qt(r){let e=r[3]+1+"",t,o,n=r[6]+1+"",s;return{c(){t=x(e),o=x(" / "),s=x(n)},l(l){t=ee(l,e),o=ee(l," / "),s=ee(l,n)},m(l,i){N(l,t,i),N(l,o,i),N(l,s,i)},p(l,i){i[0]&8&&e!==(e=l[3]+1+"")&&ie(t,e),i[0]&64&&n!==(n=l[6]+1+"")&&ie(s,n)},d(l){l&&(_(t),_(o),_(s))}}}function Yt(r){return{c:P,l:P,m:P,p:P,i:P,o:P,d:P}}function Vt(r){let e,t,o,n,s,l,i,u,a,c,f,g,S="download",D,h=r[4].configure.chords.VOCABULARY()+"",d,b,m,p;const A=[Ht,zt],O=[];function I(y,E){return y[6]!==-1?0:1}return o=I(r),n=O[o]=A[o](r),{c(){e=w("div"),t=w("table"),n.c(),l=$(),i=w("div"),u=w("textarea"),c=$(),f=w("button"),g=w("span"),g.textContent=S,D=$(),d=x(h),this.h()},l(y){e=T(y,"DIV",{class:!0});var E=L(e);t=T(E,"TABLE",{class:!0});var M=L(t);n.l(M),M.forEach(_),E.forEach(_),l=B(y),i=T(y,"DIV",{class:!0});var V=L(i);u=T(V,"TEXTAREA",{placeholder:!0,class:!0}),L(u).forEach(_),c=B(V),f=T(V,"BUTTON",{class:!0});var G=L(f);g=T(G,"SPAN",{class:!0,"data-svelte-h":!0}),X(g)!=="svelte-cgubnm"&&(g.textContent=S),D=B(G),d=ee(G,h),G.forEach(_),V.forEach(_),this.h()},h(){C(t,"class","svelte-41xh3q"),C(e,"class","results svelte-41xh3q"),C(u,"placeholder",a=r[4].configure.chords.TRY_TYPING()+`
|
|
|
|
Did you know? `+me[Math.floor(me.length*Math.random())]),C(u,"class","svelte-41xh3q"),C(g,"class","icon"),C(f,"class","svelte-41xh3q"),C(i,"class","sidebar svelte-41xh3q")},m(y,E){N(y,e,E),v(e,t),O[o].m(t,null),N(y,l,E),N(y,i,E),v(i,u),v(i,c),v(i,f),v(f,g),v(f,D),v(f,d),b=!0,m||(p=Y(f,"click",r[13]),m=!0)},p(y,E){let M=o;o=I(y),o===M?O[o].p(y,E):(fe(),j(O[M],1,1,()=>{O[M]=null}),he(),n=O[o],n?n.p(y,E):(n=O[o]=A[o](y),n.c()),q(n,1),n.m(t,null)),(!b||E[0]&16&&a!==(a=y[4].configure.chords.TRY_TYPING()+`
|
|
|
|
Did you know? `+me[Math.floor(me.length*Math.random())]))&&C(u,"placeholder",a),(!b||E[0]&16)&&h!==(h=y[4].configure.chords.VOCABULARY()+"")&&ie(d,h)},i(y){b||(q(n),y&&we(()=>{b&&(s||(s=re(t,Ye,{y:48,easing:qe},!0)),s.run(1))}),b=!0)},o(y){j(n),y&&(s||(s=re(t,Ye,{y:48,easing:qe},!1)),s.run(0)),b=!1},d(y){y&&(_(e),_(l),_(i)),O[o].d(),y&&s&&s.end(),m=!1,p()}}}function zt(r){let e,t=r[4].configure.chords.search.NO_RESULTS()+"",o;return{c(){e=w("caption"),o=x(t)},l(n){e=T(n,"CAPTION",{});var s=L(e);o=ee(s,t),s.forEach(_)},m(n,s){N(n,e,s),v(e,o)},p(n,s){s[0]&16&&t!==(t=n[4].configure.chords.search.NO_RESULTS()+"")&&ie(o,t)},i:P,o:P,d(n){n&&_(e)}}}function Ht(r){let e,t=[],o=new Map,n,s,l=r[3]===0&&Ke(r),i=be(r[7].slice(r[3]*r[8]-(r[3]===0?0:1),(r[3]+1)*r[8]-1));const u=a=>JSON.stringify(a[29]?.id);for(let a=0;a<i.length;a+=1){let c=We(r,i,a),f=u(c);o.set(f,t[a]=Ge(f,c))}return{c(){l&&l.c(),e=$();for(let a=0;a<t.length;a+=1)t[a].c();n=ne()},l(a){l&&l.l(a),e=B(a);for(let c=0;c<t.length;c+=1)t[c].l(a);n=ne()},m(a,c){l&&l.m(a,c),N(a,e,c);for(let f=0;f<t.length;f+=1)t[f]&&t[f].m(a,c);N(a,n,c),s=!0},p(a,c){a[3]===0?l?(l.p(a,c),c[0]&8&&q(l,1)):(l=Ke(a),l.c(),q(l,1),l.m(e.parentNode,e)):l&&(fe(),j(l,1,1,()=>{l=null}),he()),c[0]&392&&(i=be(a[7].slice(a[3]*a[8]-(a[3]===0?0:1),(a[3]+1)*a[8]-1)),fe(),t=pt(t,c,u,1,a,i,o,n.parentNode,_t,Ge,n,We),he())},i(a){if(!s){q(l);for(let c=0;c<i.length;c+=1)q(t[c]);s=!0}},o(a){j(l);for(let c=0;c<t.length;c+=1)j(t[c]);s=!1},d(a){a&&(_(e),_(n)),l&&l.d(a);for(let c=0;c<t.length;c+=1)t[c].d(a)}}}function Ke(r){let e,t,o,n,s,l;return o=new st({}),o.$on("submit",r[21]),{c(){e=w("tr"),t=w("th"),ce(o.$$.fragment),n=w("td"),s=w("td"),this.h()},l(i){e=T(i,"TR",{});var u=L(e);t=T(u,"TH",{class:!0});var a=L(t);ue(o.$$.fragment,a),a.forEach(_),n=T(u,"TD",{}),L(n).forEach(_),s=T(u,"TD",{}),L(s).forEach(_),u.forEach(_),this.h()},h(){C(t,"class","new-chord svelte-41xh3q")},m(i,u){N(i,e,u),v(e,t),de(o,t,null),v(e,n),v(e,s),l=!0},p:P,i(i){l||(q(o.$$.fragment,i),l=!0)},o(i){j(o.$$.fragment,i),l=!1},d(i){i&&_(e),pe(o)}}}function Fe(r){let e,t,o,n;return t=new $t({props:{chord:r[29]}}),t.$on("duplicate",r[22]),{c(){e=w("tr"),ce(t.$$.fragment),o=$()},l(s){e=T(s,"TR",{});var l=L(e);ue(t.$$.fragment,l),o=B(l),l.forEach(_)},m(s,l){N(s,e,l),de(t,e,null),v(e,o),n=!0},p(s,l){const i={};l[0]&392&&(i.chord=s[29]),t.$set(i)},i(s){n||(q(t.$$.fragment,s),n=!0)},o(s){j(t.$$.fragment,s),n=!1},d(s){s&&_(e),pe(t)}}}function Ge(r,e){let t,o,n,s=e[29]&&Fe(e);return{key:r,first:null,c(){t=ne(),s&&s.c(),o=ne(),this.h()},l(l){t=ne(),s&&s.l(l),o=ne(),this.h()},h(){this.first=t},m(l,i){N(l,t,i),s&&s.m(l,i),N(l,o,i),n=!0},p(l,i){e=l,e[29]?s?(s.p(e,i),i[0]&392&&q(s,1)):(s=Fe(e),s.c(),q(s,1),s.m(o.parentNode,o)):s&&(fe(),j(s,1,1,()=>{s=null}),he())},i(l){n||(q(s),n=!0)},o(l){j(s),n=!1},d(l){l&&(_(t),_(o)),s&&s.d(l)}}}function jt(r){return{c:P,l:P,m:P,p:P,i:P,o:P,d:P}}function Wt(r){let e,t,o,n,s,l,i,u,a,c="navigate_before",f,g,S="navigate_next",D,h,d,b,m;function p(y,E){return y[6]!==-1?qt:Bt}let A=p(r),O=A(r),I={ctx:r,current:null,token:null,hasCatch:!1,pending:jt,then:Vt,catch:Yt,blocks:[,,,]};return dt(ge(),I),{c(){e=w("meta"),t=$(),o=w("div"),n=w("input"),l=$(),i=w("div"),O.c(),u=$(),a=w("button"),a.textContent=c,f=$(),g=w("button"),g.textContent=S,D=$(),h=w("section"),I.block.c(),this.h()},l(y){const E=it("svelte-2ux8j7",Oe.head);e=T(E,"META",{name:!0,content:!0}),E.forEach(_),t=B(y),o=T(y,"DIV",{class:!0});var M=L(o);n=T(M,"INPUT",{type:!0,placeholder:!0,class:!0}),l=B(M),i=T(M,"DIV",{class:!0});var V=L(i);O.l(V),V.forEach(_),u=B(M),a=T(M,"BUTTON",{class:!0,"data-svelte-h":!0}),X(a)!=="svelte-1shmphf"&&(a.textContent=c),f=B(M),g=T(M,"BUTTON",{class:!0,"data-svelte-h":!0}),X(g)!=="svelte-13x0rs3"&&(g.textContent=S),M.forEach(_),D=B(y),h=T(y,"SECTION",{class:!0});var G=L(h);I.block.l(G),G.forEach(_),this.h()},h(){Oe.title="Chord Manager - CharaChorder Device Manager",C(e,"name","description"),C(e,"content","Manage your chords"),C(n,"type","search"),C(n,"placeholder",s=r[4].configure.chords.search.PLACEHOLDER(r[2]+1)),C(n,"class","svelte-41xh3q"),J(n,"loading",r[2]!==r[0].length-1),C(i,"class","paginator svelte-41xh3q"),C(a,"class","icon"),C(g,"class","icon"),C(o,"class","search-container svelte-41xh3q"),C(h,"class","svelte-41xh3q")},m(y,E){v(Oe.head,e),N(y,t,E),N(y,o,E),v(o,n),v(o,l),v(o,i),O.m(i,null),v(o,u),v(o,a),v(o,f),v(o,g),N(y,D,E),N(y,h,E),I.block.m(h,I.anchor=null),I.mount=()=>h,I.anchor=null,r[23](h),d=!0,b||(m=[Y(n,"input",r[18]),Y(a,"click",r[19]),Ue(Pe.call(null,a,{shortcut:"ctrl+left"})),Y(g,"click",r[20]),Ue(Pe.call(null,g,{shortcut:"ctrl+right"}))],b=!0)},p(y,E){r=y,(!d||E[0]&20&&s!==(s=r[4].configure.chords.search.PLACEHOLDER(r[2]+1)))&&C(n,"placeholder",s),(!d||E[0]&5)&&J(n,"loading",r[2]!==r[0].length-1),A===(A=p(r))&&O?O.p(r,E):(O.d(1),O=A(r),O&&(O.c(),O.m(i,null))),ft(I,r,E)},i(y){d||(q(I.block),d=!0)},o(y){for(let E=0;E<3;E+=1){const M=I.blocks[E];j(M)}d=!1},d(y){y&&(_(t),_(o),_(D),_(h)),_(e),O.d(),I.block.d(),I.token=null,I=null,r[23](null),b=!1,Ce(m)}}}const Je=38;function Kt(r,e,t){let o,n,s,l,i,u,a;te(r,kt,k=>t(17,o=k)),te(r,De,k=>t(0,n=k)),te(r,xe,k=>t(4,s=k));let c;const f=Ae(0);te(r,f,k=>t(8,a=k));let g,S,D=0;Xe(()=>{g=new ResizeObserver(()=>{f.set(Math.floor(c.clientHeight/Je))}),f.set(Math.floor(c.clientHeight/Je)),g.observe(c)}),at(()=>{g?.disconnect()});let h=new Le.Index,d=Ae(void 0);te(r,d,k=>t(5,l=k));function b(k,W){const U=[""],H=[],K=[];for(const Q of k.phrase??[]){const Z=Ie.get(Q);if(!Z){K.push(`0x${Q.toString(16)}`);continue}const _e=Z.keyCode&&W.get(Z.keyCode),ae=_e?.length===1?_e:Z.display||Z.id;if(!ae){K.push(`0x${Z.code.toString(16)}`);continue}/^\s$/.test(ae)&&U.at(-1)!==""?U.push(""):ae.length===1?U[U.length-1]=U[U.length-1]+ae:H.push(ae)}k.phrase?.[0]===298&&U.push("suffix"),["ARROW_LT","ARROW_RT","ARROW_UP","ARROW_DN"].some(Q=>H.includes(Q))&&U.push("cursor warp"),["CTRL","ALT","GUI","ENTER","TAB"].some(Q=>H.includes(Q))&&U.push("macro"),k.actions[0]!==0&&U.push("compound");const Ee=k.actions.slice(k.actions.lastIndexOf(0)+1).map(Q=>{const Z=Ie.get(Q);if(!Z)return`0x${Q.toString(16)}`;const _e=Z.keyCode&&W.get(Z.keyCode);return(_e?.length===1?_e:Z.id)??`0x${Q.toString(16)}`});return[...U,`+${Ee.join("+")}`,...new Set(H),...new Set(K)].join(" ")}async function m(k,W){if(k.length===0||!Ct)return h;h=new Le.Index({tokenize:"full",encode(H){return H.split(/\s+/).flatMap(K=>/^[A-Z_]+$/.test(K)?K:K.startsWith("+")?K.slice(1).split("+").map(Ee=>`+${Ee}`):K.toLowerCase())}});let U=!1;t(16,S=()=>{U=!0});for(let H=0;H<k.length;H++){if(U)return h;const K=k[H];t(2,D=H),"phrase"in K&&(console.log(b(K,W)),await h.addAsync(H,b(K,W)))}return h}const p=Ae(void 0);async function A(k,W){const U=W.target.value;p.set(U&&d?await k.searchAsync(U):void 0),t(3,M=0)}function O(k){const W=JSON.stringify(k);if(n.some(U=>JSON.stringify(U.actions)===W)){alert(s.configure.chords.DUPLICATE());return}oe.update(U=>(U.push({type:se.Chord,id:k,actions:k,phrase:[]}),U))}function I(){const k=new Set(n.map(K=>"phrase"in K?plainPhrase(K.phrase,o).trim():""));k.delete("");const W=new Blob([Array.from(k).join("|")],{type:"text/plain"}),U=URL.createObjectURL(W),H=document.createElement("a");H.href=U,H.download="vocabulary.txt",H.click(),URL.revokeObjectURL(U)}const y=$e([p,De],([k,W])=>k?.map(U=>[W[U],U])??W.map((U,H)=>[U,H]));te(r,y,k=>t(7,u=k));const E=$e([y,f],([k,W])=>Math.ceil((k.length+1)/W)-1);te(r,E,k=>t(6,i=k)),ct("cursor-crossfade",vt({}));let M=0;const V=k=>l&&A(l,k),G=()=>t(3,M=Math.max(M-1,0)),R=()=>t(3,M=Math.min(M+1,i)),z=({detail:k})=>O(k),le=()=>t(3,M=0);function F(k){Ne[k?"unshift":"push"](()=>{c=k,t(1,c)})}return r.$$.update=()=>{r.$$.dirty[0]&196609&&(S?.(),t(2,D=0),m(n,o).then(d.set))},[n,c,D,M,s,l,i,u,a,f,d,A,O,I,y,E,S,o,V,G,R,z,le,F]}class rn extends Te{constructor(e){super(),Se(this,e,Kt,Wt,ve,{},null,[-1,-1])}}export{rn as component};
|
|
//# sourceMappingURL=6.DzO8xybo.js.map
|