GameSentenceMiner 2.17.0__py3-none-any.whl → 2.17.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of GameSentenceMiner might be problematic. Click here for more details.

Files changed (31) hide show
  1. GameSentenceMiner/anki.py +31 -3
  2. GameSentenceMiner/config_gui.py +26 -2
  3. GameSentenceMiner/gametext.py +4 -3
  4. GameSentenceMiner/gsm.py +19 -23
  5. GameSentenceMiner/obs.py +17 -7
  6. GameSentenceMiner/ocr/owocr_helper.py +11 -8
  7. GameSentenceMiner/owocr/owocr/run.py +11 -5
  8. GameSentenceMiner/util/configuration.py +7 -5
  9. GameSentenceMiner/util/db.py +176 -8
  10. GameSentenceMiner/util/downloader/download_tools.py +57 -24
  11. GameSentenceMiner/util/ffmpeg.py +5 -2
  12. GameSentenceMiner/util/get_overlay_coords.py +3 -0
  13. GameSentenceMiner/util/gsm_utils.py +0 -54
  14. GameSentenceMiner/vad.py +5 -2
  15. GameSentenceMiner/web/database_api.py +12 -1
  16. GameSentenceMiner/web/gsm_websocket.py +1 -1
  17. GameSentenceMiner/web/static/css/shared.css +20 -0
  18. GameSentenceMiner/web/static/css/stats.css +496 -1
  19. GameSentenceMiner/web/static/js/anki_stats.js +87 -3
  20. GameSentenceMiner/web/static/js/shared.js +2 -49
  21. GameSentenceMiner/web/static/js/stats.js +274 -39
  22. GameSentenceMiner/web/templates/anki_stats.html +36 -0
  23. GameSentenceMiner/web/templates/index.html +1 -1
  24. GameSentenceMiner/web/templates/stats.html +35 -15
  25. GameSentenceMiner/web/texthooking_page.py +31 -8
  26. {gamesentenceminer-2.17.0.dist-info → gamesentenceminer-2.17.2.dist-info}/METADATA +1 -1
  27. {gamesentenceminer-2.17.0.dist-info → gamesentenceminer-2.17.2.dist-info}/RECORD +31 -31
  28. {gamesentenceminer-2.17.0.dist-info → gamesentenceminer-2.17.2.dist-info}/WHEEL +0 -0
  29. {gamesentenceminer-2.17.0.dist-info → gamesentenceminer-2.17.2.dist-info}/entry_points.txt +0 -0
  30. {gamesentenceminer-2.17.0.dist-info → gamesentenceminer-2.17.2.dist-info}/licenses/LICENSE +0 -0
  31. {gamesentenceminer-2.17.0.dist-info → gamesentenceminer-2.17.2.dist-info}/top_level.txt +0 -0
@@ -25,7 +25,7 @@ var Yu=Object.defineProperty;var Ku=(e,n,t)=>n in e?Yu(e,n,{enumerable:!0,config
25
25
  transform: ${c} translate(${(1-p)*i}px, ${(1-p)*o}px);
26
26
  opacity: ${a-u*m}`}}var rn=(e=>(e.LIGHT="light",e.DARK="dark",e.CUPCAKE="cupcake",e.BUMBLEBEE="bumblebee",e.EMERALD="emerald",e.CORPORATE="corporate",e.SYNTHWAVE="synthwave",e.RETRO="retro",e.CYBERPUNK="cyberpunk",e.VALENTINE="valentine",e.HALLOWEEN="halloween",e.GARDEN="garden",e.FOREST="forest",e.AQUA="aqua",e.LOFI="lofi",e.PASTEL="pastel",e.FANTASY="fantasy",e.WIREFRAME="wireframe",e.BLACK="black",e.LUXURY="luxury",e.DRACULA="dracula",e.CMYK="cmyk",e.AUTUMN="autumn",e.BUSINESS="business",e.ACID="acid",e.LEMONADE="lemonade",e.NIGHT="night",e.COFFEE="coffee",e.WINTER="winter",e))(rn||{}),on=(e=>(e.OFF="Off",e.NOTO="Noto Serif JP",e.KLEE="Klee One",e.SHIPPORI="Shippori Mincho",e.ACKAISYO="Ackaisyo",e.CINECAPTION226="CineCaption226",e))(on||{}),nn=(e=>(e.SOCKET="socket",e.PASTE="paste",e.EXTERNAL="external",e.EDIT="edit",e.UNDO="undo",e.RESETCHECKBOXES="resetcheckboxes",e.TL="tl",e))(nn||{});const hi=[];function Ji(e,n=Oe){let t;const r=new Set;function i(l){if(Et(e,l)&&(e=l,t)){const a=!hi.length;for(const c of r)c[1](),hi.push(c,e);if(a){for(let c=0;c<hi.length;c+=2)hi[c][0](hi[c+1]);hi.length=0}}}function o(l){i(l(e))}function s(l,a=Oe){const c=[l,a];return r.add(c),r.size===1&&(t=n(i)||Oe),l(e),()=>{r.delete(c),r.size===0&&(t(),t=null)}}return{set:i,update:o,subscribe:s}}function Yh(e){return e.set=e.next,e}function Kr(e){return Yh(new Zf(e))}function Jl(e,n){return(t,r,i)=>{const o=Kh()(t,r,e),s=Kr(o);let l=!0;return i&&i.subscribe(a=>l=a),s.pipe(Fh(1)).subscribe(a=>{l&&window.localStorage.setItem(t,n(a??r))}),s}}function Kh(){return(e,n,t)=>{const r=window.localStorage.getItem(e);return r?t(r):n}}function Ae(){return Jl(e=>!!+e,e=>e?"1":"0")}function Fn(){return Jl(e=>+e,e=>`${e}`)}function Gh(e){return Jl(n=>JSON.parse(n||e),n=>JSON.stringify(n))}function Lo(){return Gh("[]")}function ur(){return Jl(e=>e,e=>e)}const L={theme$:rn.BUSINESS,replacements$:[],windowTitle$:"",websocketUrl$:"ws://localhost:55001",secondaryWebsocketUrl$:"",fontSize$:32,characterMilestone$:0,onlineFont$:on.OFF,preventLastDuplicate$:0,maxLines$:0,maxPipLines$:1,afkTimer$:0,adjustTimerOnAfk$:!1,enableExternalClipboardMonitor$:!1,showPresetQuickSwitch$:!1,skipResetConfirmations$:!1,persistStats$:!0,persistNotes$:!0,persistLines$:!0,persistActionHistory$:!1,enablePaste$:!1,blockCopyOnPage$:!1,allowPasteDuringPause$:!1,allowNewLineDuringPause$:!0,autoStartTimerDuringPausePaste$:!1,autoStartTimerDuringPause$:!1,preventGlobalDuplicate$:!1,mergeEqualLineStarts$:!1,filterNonCJKLines:!1,flashOnMissedLine$:!0,displayVertical$:!1,reverseLineOrder$:!1,preserveWhitespace$:!0,removeAllWhitespace$:!1,showTimer$:!0,showSpeed$:!0,showCharacterCount$:!0,showLineCount$:!0,blurStats$:!1,enableLineAnimation$:!1,enableAfkBlur$:!1,enableAfkBlurRestart$:!1,continuousReconnect$:!0,showConnectionErrors$:!1,customCSS$:""},Or=ur()("bannou-texthooker-theme",L.theme$),_n=Lo()("bannou-texthooker-settingPresets",[]),ln=Lo()("bannou-texthooker-replacements",[]),_o=ur()("bannou-texthooker-windowTitle",L.windowTitle$),Mn=ur()("bannou-texthooker-websocketUrl",L.websocketUrl$),$n=ur()("bannou-texthooker-secondary-websocketUrl",L.secondaryWebsocketUrl$),Ir=Fn()("bannou-texthooker-fontSize",L.fontSize$),Mr=Fn()("bannou-texthooker-characterMilestone",L.characterMilestone$),ki=ur()("bannou-texthooker-onlineFont",L.onlineFont$),$r=Fn()("bannou-texthooker-preventLastDuplicate",L.preventLastDuplicate$),Dr=Fn()("bannou-texthooker-maxLines",L.maxLines$),Hr=Fn()("bannou-texthooker-maxPipLines",L.maxPipLines$),ar=Fn()("bannou-texthooker-afkTimer",L.afkTimer$),Si=Ae()("bannou-texthooker-adjustTimerOnAfk",L.adjustTimerOnAfk$),wo=Ae()("bannou-texthooker-enableExternalClipboardMonitor",L.enableExternalClipboardMonitor$),yo=Ae()("bannou-texthooker-showPresetQuickSwitch",L.showPresetQuickSwitch$),Ci=Ae()("bannou-texthooker-skipResetConfirmations",L.skipResetConfirmations$),Ei=Ae()("bannou-texthooker-persistStats",L.persistStats$),Li=Ae()("bannou-texthooker-persistNotes",L.persistNotes$),xi=Ae()("bannou-texthooker-persistLines",L.persistLines$),Pi=Ae()("bannou-texthooker-persistActionHistory",L.persistActionHistory$),Ai=Ae()("bannou-texthooker-enablePaste",L.enablePaste$),Ti=Ae()("bannou-texthooker-blockCopyOnPage",L.blockCopyOnPage$),Di=Ae()("bannou-texthooker-allowPasteDuringPause",L.allowPasteDuringPause$),Oi=Ae()("bannou-texthooker-allowNewLineDuringPause",L.allowNewLineDuringPause$),Ii=Ae()("bannou-texthooker-autoStartTimerDuringPausePaste",L.autoStartTimerDuringPausePaste$),Mi=Ae()("bannou-texthooker-autoStartTimerDuringPause",L.autoStartTimerDuringPause$),Fr=Ae()("bannou-texthooker-preventGlobalDuplicate",L.preventGlobalDuplicate$),$i=Ae()("bannou-texthooker-mergeEqualLineStarts",L.mergeEqualLineStarts$),Hi=Ae()("bannou-texthooker-filterNonCJKLines",L.mergeEqualLineStarts$),Ni=Ae()("bannou-texthooker-flashOnMissedLine",L.flashOnMissedLine$),Wr=Ae()("bannou-texthooker-displayVertical",L.displayVertical$),jr=Ae()("bannou-texthooker-reverseLineOrder",L.reverseLineOrder$),Ri=Ae()("bannou-texthooker-preserveWhitespace",L.preserveWhitespace$),Vi=Ae()("bannou-texthooker-removeAllWhitespace",L.removeAllWhitespace$),Fi=Ae()("bannou-texthooker-showTimer",L.showTimer$),Wi=Ae()("bannou-texthooker-showSpeed",L.showSpeed$),ji=Ae()("bannou-texthooker-showCharacterCount",L.showCharacterCount$),Bi=Ae()("bannou-texthooker-showLineCount",L.showLineCount$),Ui=Ae()("bannou-texthooker-blurStats",L.blurStats$),zi=Ae()("bannou-texthooker-enableLineAnimation",L.enableLineAnimation$),Yi=Ae()("bannou-texthooker-enableAfkBlur",L.enableAfkBlur$),Ki=Ae()("bannou-texthooker-enableAfkBlurRestart",L.enableAfkBlurRestart$),Br=Ae()("bannou-texthooker-continuousReconnect",L.continuousReconnect$),Gi=Ae()("bannou-texthooker-showConnectionErrors",L.showConnectionErrors$),qi=ur()("bannou-texthooker-customCSS",L.customCSS$),wn=Fn()("bannou-texthooker-timeValue",0,Ei),Hl=Kr(!1),ko=ur()("bannou-texthooker-userNotes","",Li),Us=Kr(-1),zs=Kr(-1),Ue=Kr(void 0),Nl=Kr(!1),lr=ur()("bannou-texthooker-lastSettingPreset",""),at=Lo()("bannou-texthooker-lineData",[],xi),Cl=Lo()("bannou-texthooker-lineIDs",[]),Ur=Ji(new Map),nr=Lo()("bannou-texthooker-actionHistory",[],Pi),Ls=Ji(void 0),Xt=Kr(!0),Nr=new Zi,Ql=new Zi,es=new Zi,El=Ji(!1),xs=Ji([]),Ps=Ji(!1),za=Ji(!1),Ya=Fn()("bannou-texthooker-lastPipHeight",0),Ka=Fn()("bannou-texthooker-lastPipWidth",0);async function qh(){if(!Ci.getValue()){const{canceled:e}=await new Promise(n=>{Ue.next({icon:tn,message:"All Settings and Data will be reset",callback:n})});if(e)return}lr.next(""),_n.next([]),Xt.next(!0),wn.next(0),ko.next(""),at.next([]),nr.next([]),Ls.set(void 0),window.localStorage.removeItem("bannou-texthooker-timeValue"),window.localStorage.removeItem("bannou-texthooker-userNotes"),window.localStorage.removeItem("bannou-texthooker-lineData"),window.localStorage.removeItem("bannou-texthooker-actionHistory"),Or.next(L.theme$),ln.next(L.replacements$),_o.next(L.windowTitle$),Mn.next(L.websocketUrl$),$n.next(L.secondaryWebsocketUrl$),Ir.next(L.fontSize$),Mr.next(L.characterMilestone$),ki.next(L.onlineFont$),$r.next(L.preventLastDuplicate$),Hr.next(L.maxPipLines$),ar.next(L.afkTimer$),Si.next(L.adjustTimerOnAfk$),wo.next(L.enableExternalClipboardMonitor$),yo.next(L.showPresetQuickSwitch$),Ci.next(L.skipResetConfirmations$),Ei.next(L.persistStats$),Li.next(L.persistNotes$),xi.next(L.persistLines$),Pi.next(L.persistActionHistory$),Ai.next(L.enablePaste$),Ti.next(L.blockCopyOnPage$),Di.next(L.allowPasteDuringPause$),Oi.next(L.allowNewLineDuringPause$),Ii.next(L.autoStartTimerDuringPausePaste$),Mi.next(L.autoStartTimerDuringPause$),Fr.next(L.preventGlobalDuplicate$),$i.next(L.mergeEqualLineStarts$),Hi.next(L.filterNonCJKLines),Ni.next(L.flashOnMissedLine$),Wr.next(L.displayVertical$),jr.next(L.reverseLineOrder$),Ri.next(L.preserveWhitespace$),Vi.next(L.removeAllWhitespace$),Fi.next(L.showTimer$),Wi.next(L.showSpeed$),ji.next(L.showCharacterCount$),Bi.next(L.showLineCount$),Ui.next(L.blurStats$),zi.next(L.enableLineAnimation$),Yi.next(L.enableAfkBlur$),Ki.next(L.enableAfkBlurRestart$),Br.next(L.continuousReconnect$),Gi.next(L.showConnectionErrors$),qi.next(L.customCSS$)}function jt(){}function rr(){return zf(Xl(()=>""),Zl((e,n)=>!n))}function Rl(e,n,t,r,i="auto"){console.log(n),n&&setTimeout(()=>{t?r?n.scrollTo({top:0,left:n.scrollWidth,behavior:i}):e.scrollTo({top:-n.scrollHeight,left:0,behavior:i}):r?n.scrollTo({top:0,left:-n.scrollWidth,behavior:i}):e.scrollTo({top:n.scrollHeight+100,left:0,behavior:i}),i==="smooth"&&setTimeout(()=>Rl(e,n,t,r),250)})}function Xh(e){const n=Math.floor(e/3600),t=Math.floor((e-n*3600)/60),r=e-n*3600-t*60;return`${`${n}`.padStart(2,"0")}:${`${t}`.padStart(2,"0")}:${`${r}`.padStart(2,"0")}`}function Zh(e){const[n,t,r]=e.split(":").map(i=>Number.parseInt(i,10));return n*60*60+t*60+r}function Jh(){const e=new Uint8Array(16);return crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,Array.prototype.map.call(e,(t,r)=>(t<16?"0":"")+t.toString(16)+(r%2&&r<10&&r>2?"-":"")).join("")}function Cu(e,n){if(!e||!n.length)return e;let t=e;for(let r=0,{length:i}=n;r<i;r+=1){const o=n[r];t=t.replace(new RegExp(o.pattern,o.flags.join("")),o.replaces.replace(/\\t/gm," ").replace(/\\n/gm,`
27
27
  `))}return t}function Eu(e,n){const t=e.createTextNode(n||"");let r=e.getElementById("user-css");r?r.replaceChild(t,r.firstChild):(r=e.createElement("style"),r.id="user-css",r.appendChild(t),e.head.append(r))}function Ga(e,n){n?(e.body.style.filter="blur(8px)",e.body.style.pointerEvents="none"):(e.body.style.filter=null,e.body.style.pointerEvents="auto")}const Lu=`
28
- `;function Qh(e){let n,t,r,i;return{c(){n=vs("svg"),t=vs("path"),h(t,"d",e[1]),be(n,"width",e[2]),be(n,"height",e[3]),h(n,"viewBox","0 0 24 24"),h(n,"fill","currentColor"),h(n,"class",e[4])},m(o,s){F(o,n,s),f(n,t),e[7](n),r||(i=[x(n,"click",e[5]),x(n,"keyup",e[6])],r=!0)},p(o,[s]){s&2&&h(t,"d",o[1]),s&4&&be(n,"width",o[2]),s&8&&be(n,"height",o[3]),s&16&&h(n,"class",o[4])},i:Oe,o:Oe,d(o){o&&R(n),e[7](null),r=!1,At(i)}}}function ep(e,n,t){let{path:r}=n,{width:i="1.5rem"}=n,{height:o="1.5rem"}=n,{element:s=void 0}=n,{class:l=""}=n;function a(p){mo.call(this,e,p)}function c(p){mo.call(this,e,p)}function u(p){mt[p?"unshift":"push"](()=>{s=p,t(0,s)})}return e.$$set=p=>{"path"in p&&t(1,r=p.path),"width"in p&&t(2,i=p.width),"height"in p&&t(3,o=p.height),"element"in p&&t(0,s=p.element),"class"in p&&t(4,l=p.class)},[s,r,i,o,l,a,c,u]}class we extends Ut{constructor(n){super(),Bt(this,n,ep,Qh,Et,{path:1,width:2,height:3,element:0,class:4})}}function qa(e){let n,t;return n=new we({props:{path:e[1]}}),{c(){se(n.$$.fragment)},m(r,i){re(n,r,i),t=!0},p(r,i){const o={};i&2&&(o.path=r[1]),n.$set(o)},i(r){t||($(n.$$.fragment,r),t=!0)},o(r){W(n.$$.fragment,r),t=!1},d(r){ie(n,r)}}}function tp(e){let n;return{c(){n=dt(e[2])},m(t,r){F(t,n,r)},p(t,r){r&4&&$t(n,t[2])},d(t){t&&R(n)}}}function np(e){let n,t=e[5]==="text"&&Xa(e);return{c(){n=g("div"),t&&t.c()},m(r,i){F(r,n,i),t&&t.m(n,null)},p(r,i){r[5]==="text"?t?t.p(r,i):(t=Xa(r),t.c(),t.m(n,null)):t&&(t.d(1),t=null)},d(r){r&&R(n),t&&t.d()}}}function Xa(e){let n,t,r;return{c(){n=g("input"),h(n,"type",e[5]),h(n,"class","input input-bordered h-8 ml-2"),n.value=e[0]},m(i,o){F(i,n,o),t||(r=x(n,"change",e[8]),t=!0)},p(i,o){o&32&&h(n,"type",i[5]),o&1&&n.value!==i[0]&&(n.value=i[0])},d(i){i&&R(n),t=!1,r()}}}function Za(e){let n,t,r;return{c(){n=g("button"),n.textContent="Cancel",h(n,"class","btn btn-sm btn-ghost")},m(i,o){F(i,n,o),t||(r=x(n,"click",e[9]),t=!0)},p:Oe,d(i){i&&R(n),t=!1,r()}}}function rp(e){let n,t,r,i,o,s,l,a,c,u,p,m,b=e[1]&&qa(e);function k(D,P){return D[5]?np:tp}let S=k(e),V=S(e),O=e[4]&&Za(e);return{c(){n=g("div"),t=g("div"),r=g("div"),b&&b.c(),i=w(),o=g("span"),V.c(),s=w(),l=g("div"),O&&O.c(),a=w(),c=g("button"),c.textContent="Confirm",h(c,"class","btn btn-sm btn-primary"),h(l,"class","flex-none"),h(t,"class","alert shadow-lg max-w-xl"),q(t,"alert-info",e[3]==="info"),q(t,"alert-error",e[3]==="error"),h(n,"class","fixed top-12 flex justify-center w-full z-30")},m(D,P){F(D,n,P),f(n,t),f(t,r),b&&b.m(r,null),f(r,i),f(r,o),V.m(o,null),f(t,s),f(t,l),O&&O.m(l,null),f(l,a),f(l,c),u=!0,p||(m=x(c,"click",e[10]),p=!0)},p(D,[P]){D[1]?b?(b.p(D,P),P&2&&$(b,1)):(b=qa(D),b.c(),$(b,1),b.m(r,i)):b&&(nt(),W(b,1,1,()=>{b=null}),rt()),S===(S=k(D))&&V?V.p(D,P):(V.d(1),V=S(D),V&&(V.c(),V.m(o,null))),D[4]?O?O.p(D,P):(O=Za(D),O.c(),O.m(l,a)):O&&(O.d(1),O=null),(!u||P&8)&&q(t,"alert-info",D[3]==="info"),(!u||P&8)&&q(t,"alert-error",D[3]==="error")},i(D){u||($(b),u=!0)},o(D){W(b),u=!1},d(D){D&&R(n),b&&b.d(),V.d(),O&&O.d(),p=!1,m()}}}function ip(e,n,t){let{icon:r}=n,{message:i}=n,{type:o="info"}=n,{showCancel:s=!0}=n,{askForData:l=""}=n,{dataValue:a}=n,{callback:c}=n;const u=zr();function p(k){const S=k.target;t(0,a=S.value)}const m=()=>{c==null||c({canceled:!0,data:a}),u("close")},b=()=>{c==null||c({canceled:!1,data:a}),u("close")};return e.$$set=k=>{"icon"in k&&t(1,r=k.icon),"message"in k&&t(2,i=k.message),"type"in k&&t(3,o=k.type),"showCancel"in k&&t(4,s=k.showCancel),"askForData"in k&&t(5,l=k.askForData),"dataValue"in k&&t(0,a=k.dataValue),"callback"in k&&t(6,c=k.callback)},[a,r,i,o,s,l,c,u,p,m,b]}class op extends Ut{constructor(n){super(),Bt(this,n,ip,rp,Et,{icon:1,message:2,type:3,showCancel:4,askForData:5,dataValue:0,callback:6})}}function Ja(e){let n,t;const r=[e[0]];let i={};for(let o=0;o<r.length;o+=1)i=qu(i,r[o]);return n=new op({props:i}),n.$on("close",e[1]),{c(){se(n.$$.fragment)},m(o,s){re(n,o,s),t=!0},p(o,s){const l=s&1?df(r,[mf(o[0])]):{};n.$set(l)},i(o){t||($(n.$$.fragment,o),t=!0)},o(o){W(n.$$.fragment,o),t=!1},d(o){ie(n,o)}}}function lp(e){let n,t,r=e[0]&&Ja(e);return{c(){r&&r.c(),n=Nn()},m(i,o){r&&r.m(i,o),F(i,n,o),t=!0},p(i,[o]){i[0]?r?(r.p(i,o),o&1&&$(r,1)):(r=Ja(i),r.c(),$(r,1),r.m(n.parentNode,n)):r&&(nt(),W(r,1,1,()=>{r=null}),rt())},i(i){t||($(r),t=!0)},o(i){W(r),t=!1},d(i){r&&r.d(i),i&&R(n)}}}function sp(e,n,t){let r;y(e,Nl,a=>t(2,r=a));let i,o=[];const s=Ue.subscribe(a=>{!a||(a.message.includes("Lost Connection to")||a.message.includes("Unable to connect to"))&&((i==null?void 0:i.message)===a.message||o.find(c=>c.message===a.message))||(o.unshift(a),i||l())});function l(){t(0,i=o.pop()),N(Nl,r=!!i,r)}return Uc(()=>s==null?void 0:s.unsubscribe()),[i,l]}class ap extends Ut{constructor(n){super(),Bt(this,n,sp,lp,Et,{})}}function So(e){return window.location.port==="4173"||window.location.port==="5174"?"http://localhost:"+55e3+e:e}function Qa(e){let n,t,r,i,o;return{c(){n=g("input"),h(n,"type","checkbox"),h(n,"class","multi-line-checkbox svelte-i377rk"),h(n,"id",t="multi-line-checkbox-"+e[0].id),h(n,"aria-label",r=e[0].id)},m(s,l){F(s,n,l),i||(o=x(n,"change",e[18]),i=!0)},p(s,l){l&1&&t!==(t="multi-line-checkbox-"+s[0].id)&&h(n,"id",t),l&1&&r!==(r=s[0].id)&&h(n,"aria-label",r)},d(s){s&&R(n),i=!1,o()}}}function ec(e){let n,t,r,i,o,s,l,a;return{c(){n=g("div"),t=g("button"),t.textContent="📷",r=w(),i=g("button"),i.textContent="🔊",o=w(),s=g("button"),s.textContent="🌐",h(t,"title","Screenshot"),be(t,"background-color","#333"),be(t,"color","#fff"),be(t,"border","1px solid #555"),be(t,"padding","6px 10px"),be(t,"font-size","10px"),be(t,"border-radius","4px"),be(t,"cursor","pointer"),be(t,"transition","background-color 0.3s"),h(t,"tabindex","-1"),h(t,"class","svelte-i377rk"),h(i,"title","Audio"),be(i,"background-color","#333"),be(i,"color","#fff"),be(i,"border","1px solid #555"),be(i,"padding","6px 10px"),be(i,"font-size","10px"),be(i,"border-radius","4px"),be(i,"cursor","pointer"),be(i,"transition","background-color 0.3s"),h(i,"tabindex","-1"),h(i,"class","svelte-i377rk"),h(s,"title","Translate"),be(s,"background-color","#333"),be(s,"color","#fff"),be(s,"border","1px solid #555"),be(s,"padding","6px 10px"),be(s,"font-size","10px"),be(s,"border-radius","4px"),be(s,"cursor","pointer"),be(s,"transition","background-color 0.3s"),h(s,"tabindex","-1"),h(s,"class","svelte-i377rk"),h(n,"class","textline-buttons unselectable svelte-i377rk")},m(c,u){F(c,n,u),f(n,t),f(n,r),f(n,i),f(n,o),f(n,s),l||(a=[x(t,"click",e[20]),x(i,"click",e[21]),x(s,"click",e[22])],l=!0)},p:Oe,d(c){c&&R(n),l=!1,At(a)}}}function tc(e){let n,t=e[6]&&e[6].includes(e[0].id),r,i,o=e[0].text+"",s,l,a,c=e[6]&&e[6].includes(e[0].id),u,p,m=t&&Qa(e),b=c&&ec(e);return{c(){n=g("div"),m&&m.c(),r=w(),i=g("p"),s=dt(o),a=w(),b&&b.c(),h(i,"class","my-2 cursor-pointer border-2 svelte-i377rk"),h(i,"contenteditable",e[4]),q(i,"py-4",!e[5]),q(i,"px-2",!e[5]),q(i,"py-2",e[5]),q(i,"px-4",e[5]),q(i,"border-transparent",!e[3]),q(i,"cursor-text",e[4]),q(i,"border-primary",e[3]),q(i,"border-accent-focus",e[4]),q(i,"whitespace-pre-wrap",e[8]),h(n,"class","textline2 svelte-i377rk")},m(k,S){F(k,n,S),m&&m.m(n,null),f(n,r),f(n,i),f(i,s),e[19](i),f(n,a),b&&b.m(n,null),u||(p=[x(i,"dblclick",e[10]),x(i,"keyup",jt)],u=!0)},p(k,S){e=k,S&65&&(t=e[6]&&e[6].includes(e[0].id)),t?m?m.p(e,S):(m=Qa(e),m.c(),m.m(n,r)):m&&(m.d(1),m=null),S&1&&o!==(o=e[0].text+"")&&$t(s,o),S&16&&h(i,"contenteditable",e[4]),S&32&&q(i,"py-4",!e[5]),S&32&&q(i,"px-2",!e[5]),S&32&&q(i,"py-2",e[5]),S&32&&q(i,"px-4",e[5]),S&8&&q(i,"border-transparent",!e[3]),S&16&&q(i,"cursor-text",e[4]),S&8&&q(i,"border-primary",e[3]),S&16&&q(i,"border-accent-focus",e[4]),S&256&&q(i,"whitespace-pre-wrap",e[8]),S&65&&(c=e[6]&&e[6].includes(e[0].id)),c?b?b.p(e,S):(b=ec(e),b.c(),b.m(n,null)):b&&(b.d(1),b=null)},i(k){l||Rr(()=>{l=Gc(i,Su,{x:e[5]?100:-100,duration:e[7]?250:0}),l.start()})},o:Oe,d(k){k&&R(n),m&&m.d(),e[19](null),b&&b.d(),u=!1,At(p)}}}function nc(e){let n,t,r,i,o,s=e[9].get(e[0].id)+"",l,a;return r=new we({props:{class:e[1]?"":"mr-2",path:$f}}),{c(){n=g("div"),t=g("div"),se(r.$$.fragment),i=w(),o=g("span"),l=dt(s),q(o,"mt-2",e[1]),h(t,"class","flex items-center"),h(n,"class","flex justify-center text-xs my-2 py-2 border-primary border-dashed milestone"),q(n,"border-x-2",e[1]),q(n,"border-y-2",!e[1]),q(n,"py-4",!e[5]),q(n,"px-2",!e[5]),q(n,"py-2",e[5]),q(n,"px-4",e[5])},m(c,u){F(c,n,u),f(n,t),re(r,t,null),f(t,i),f(t,o),f(o,l),a=!0},p(c,u){const p={};u&2&&(p.class=c[1]?"":"mr-2"),r.$set(p),(!a||u&513)&&s!==(s=c[9].get(c[0].id)+"")&&$t(l,s),(!a||u&2)&&q(o,"mt-2",c[1]),(!a||u&2)&&q(n,"border-x-2",c[1]),(!a||u&2)&&q(n,"border-y-2",!c[1]),(!a||u&32)&&q(n,"py-4",!c[5]),(!a||u&32)&&q(n,"px-2",!c[5]),(!a||u&32)&&q(n,"py-2",c[5]),(!a||u&32)&&q(n,"px-4",c[5])},i(c){a||($(r.$$.fragment,c),a=!0)},o(c){W(r.$$.fragment,c),a=!1},d(c){c&&R(n),ie(r)}}}function cp(e){let n=e[0].text,t,r,i,o=e[9].has(e[0].id),s,l,a=tc(e),c=o&&nc(e);return{c(){a.c(),t=w(),r=new Bc(!1),i=w(),c&&c.c(),s=Nn(),r.a=i},m(u,p){a.m(u,p),F(u,t,p),r.m(Lu,u,p),F(u,i,p),c&&c.m(u,p),F(u,s,p),l=!0},p(u,[p]){p&1&&Et(n,n=u[0].text)?(nt(),W(a,1,1,Oe),rt(),a=tc(u),a.c(),$(a,1),a.m(t.parentNode,t)):a.p(u,p),p&513&&(o=u[9].has(u[0].id)),o?c?(c.p(u,p),p&513&&$(c,1)):(c=nc(u),c.c(),$(c,1),c.m(s.parentNode,s)):c&&(nt(),W(c,1,1,()=>{c=null}),rt())},i(u){l||($(a),$(c),l=!0)},o(u){W(a),W(c),l=!1},d(u){a.d(u),u&&R(t),u&&r.d(),u&&R(i),c&&c.d(u),u&&R(s)}}}function up(e,n,t){let r,i,o,s,l,a,c,u;y(e,Ps,A=>t(24,i=A)),y(e,Cl,A=>t(6,o=A)),y(e,zi,A=>t(7,s=A)),y(e,jr,A=>t(25,l=A)),y(e,Wr,A=>t(1,a=A)),y(e,Ri,A=>t(8,c=A)),y(e,Ur,A=>t(9,u=A));let{line:p}=n,{index:m}=n,{isLast:b}=n,{pipWindow:k=void 0}=n;function S(){t(3,I=!1)}function V(A){return I||A.intersectsNode(D)?p.id:void 0}const O=zr();let D,P="",I=!1,Z=!1;zl(()=>{b&&Rl(k||window,D.parentElement.parentElement,l,r,s?"smooth":"auto"),o&&o.includes(p.id)&&i&&E(p.id,"TL")}),Uc(()=>{document.removeEventListener("click",K,!1),O("edit",{inEdit:!1})});function J(A){var T;k||((T=window.getSelection())==null||T.removeAllRanges(),A.ctrlKey||A.metaKey?I?(t(3,I=!1),O("deselected",p.id)):(t(3,I=!0),O("selected",p.id)):(P=D.innerText,t(4,Z=!0),O("edit",{inEdit:!0}),document.addEventListener("click",K,!1),go().then(()=>{D.focus()})))}function K(A){const T=A.target;D.contains(T)||(t(4,Z=!1),document.removeEventListener("click",K,!1),O("edit",{inEdit:!1,data:{originalText:P,newText:D.innerText,lineIndex:m,line:p}}))}async function j(A){try{const T=await fetch(So("/update_checkbox"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A})});if(!T.ok)throw new Error(`HTTP error! Status: ${T.status}`)}catch(T){console.error("Error updating checkbox:",T)}}function E(A,T,z=!1){console.log(A);let ue={TL:"/translate-line",Screenshot:"/get-screenshot",Audio:"/play-audio"}[T]??"";fetch(So(ue),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A})}).then(_e=>{if(!_e.ok)throw new Error(`HTTP error! Status: ${_e.status}`);return _e.json()}).then(_e=>{T==="TL"&&(z||t(0,p.text=p.text+`
28
+ `;function Qh(e){let n,t,r,i;return{c(){n=vs("svg"),t=vs("path"),h(t,"d",e[1]),be(n,"width",e[2]),be(n,"height",e[3]),h(n,"viewBox","0 0 24 24"),h(n,"fill","currentColor"),h(n,"class",e[4])},m(o,s){F(o,n,s),f(n,t),e[7](n),r||(i=[x(n,"click",e[5]),x(n,"keyup",e[6])],r=!0)},p(o,[s]){s&2&&h(t,"d",o[1]),s&4&&be(n,"width",o[2]),s&8&&be(n,"height",o[3]),s&16&&h(n,"class",o[4])},i:Oe,o:Oe,d(o){o&&R(n),e[7](null),r=!1,At(i)}}}function ep(e,n,t){let{path:r}=n,{width:i="1.5rem"}=n,{height:o="1.5rem"}=n,{element:s=void 0}=n,{class:l=""}=n;function a(p){mo.call(this,e,p)}function c(p){mo.call(this,e,p)}function u(p){mt[p?"unshift":"push"](()=>{s=p,t(0,s)})}return e.$$set=p=>{"path"in p&&t(1,r=p.path),"width"in p&&t(2,i=p.width),"height"in p&&t(3,o=p.height),"element"in p&&t(0,s=p.element),"class"in p&&t(4,l=p.class)},[s,r,i,o,l,a,c,u]}class we extends Ut{constructor(n){super(),Bt(this,n,ep,Qh,Et,{path:1,width:2,height:3,element:0,class:4})}}function qa(e){let n,t;return n=new we({props:{path:e[1]}}),{c(){se(n.$$.fragment)},m(r,i){re(n,r,i),t=!0},p(r,i){const o={};i&2&&(o.path=r[1]),n.$set(o)},i(r){t||($(n.$$.fragment,r),t=!0)},o(r){W(n.$$.fragment,r),t=!1},d(r){ie(n,r)}}}function tp(e){let n;return{c(){n=dt(e[2])},m(t,r){F(t,n,r)},p(t,r){r&4&&$t(n,t[2])},d(t){t&&R(n)}}}function np(e){let n,t=e[5]==="text"&&Xa(e);return{c(){n=g("div"),t&&t.c()},m(r,i){F(r,n,i),t&&t.m(n,null)},p(r,i){r[5]==="text"?t?t.p(r,i):(t=Xa(r),t.c(),t.m(n,null)):t&&(t.d(1),t=null)},d(r){r&&R(n),t&&t.d()}}}function Xa(e){let n,t,r;return{c(){n=g("input"),h(n,"type",e[5]),h(n,"class","input input-bordered h-8 ml-2"),n.value=e[0]},m(i,o){F(i,n,o),t||(r=x(n,"change",e[8]),t=!0)},p(i,o){o&32&&h(n,"type",i[5]),o&1&&n.value!==i[0]&&(n.value=i[0])},d(i){i&&R(n),t=!1,r()}}}function Za(e){let n,t,r;return{c(){n=g("button"),n.textContent="Cancel",h(n,"class","btn btn-sm btn-ghost")},m(i,o){F(i,n,o),t||(r=x(n,"click",e[9]),t=!0)},p:Oe,d(i){i&&R(n),t=!1,r()}}}function rp(e){let n,t,r,i,o,s,l,a,c,u,p,m,b=e[1]&&qa(e);function k(D,P){return D[5]?np:tp}let S=k(e),V=S(e),O=e[4]&&Za(e);return{c(){n=g("div"),t=g("div"),r=g("div"),b&&b.c(),i=w(),o=g("span"),V.c(),s=w(),l=g("div"),O&&O.c(),a=w(),c=g("button"),c.textContent="Confirm",h(c,"class","btn btn-sm btn-primary"),h(l,"class","flex-none"),h(t,"class","alert shadow-lg max-w-xl"),q(t,"alert-info",e[3]==="info"),q(t,"alert-error",e[3]==="error"),h(n,"class","fixed top-12 flex justify-center w-full z-30")},m(D,P){F(D,n,P),f(n,t),f(t,r),b&&b.m(r,null),f(r,i),f(r,o),V.m(o,null),f(t,s),f(t,l),O&&O.m(l,null),f(l,a),f(l,c),u=!0,p||(m=x(c,"click",e[10]),p=!0)},p(D,[P]){D[1]?b?(b.p(D,P),P&2&&$(b,1)):(b=qa(D),b.c(),$(b,1),b.m(r,i)):b&&(nt(),W(b,1,1,()=>{b=null}),rt()),S===(S=k(D))&&V?V.p(D,P):(V.d(1),V=S(D),V&&(V.c(),V.m(o,null))),D[4]?O?O.p(D,P):(O=Za(D),O.c(),O.m(l,a)):O&&(O.d(1),O=null),(!u||P&8)&&q(t,"alert-info",D[3]==="info"),(!u||P&8)&&q(t,"alert-error",D[3]==="error")},i(D){u||($(b),u=!0)},o(D){W(b),u=!1},d(D){D&&R(n),b&&b.d(),V.d(),O&&O.d(),p=!1,m()}}}function ip(e,n,t){let{icon:r}=n,{message:i}=n,{type:o="info"}=n,{showCancel:s=!0}=n,{askForData:l=""}=n,{dataValue:a}=n,{callback:c}=n;const u=zr();function p(k){const S=k.target;t(0,a=S.value)}const m=()=>{c==null||c({canceled:!0,data:a}),u("close")},b=()=>{c==null||c({canceled:!1,data:a}),u("close")};return e.$$set=k=>{"icon"in k&&t(1,r=k.icon),"message"in k&&t(2,i=k.message),"type"in k&&t(3,o=k.type),"showCancel"in k&&t(4,s=k.showCancel),"askForData"in k&&t(5,l=k.askForData),"dataValue"in k&&t(0,a=k.dataValue),"callback"in k&&t(6,c=k.callback)},[a,r,i,o,s,l,c,u,p,m,b]}class op extends Ut{constructor(n){super(),Bt(this,n,ip,rp,Et,{icon:1,message:2,type:3,showCancel:4,askForData:5,dataValue:0,callback:6})}}function Ja(e){let n,t;const r=[e[0]];let i={};for(let o=0;o<r.length;o+=1)i=qu(i,r[o]);return n=new op({props:i}),n.$on("close",e[1]),{c(){se(n.$$.fragment)},m(o,s){re(n,o,s),t=!0},p(o,s){const l=s&1?df(r,[mf(o[0])]):{};n.$set(l)},i(o){t||($(n.$$.fragment,o),t=!0)},o(o){W(n.$$.fragment,o),t=!1},d(o){ie(n,o)}}}function lp(e){let n,t,r=e[0]&&Ja(e);return{c(){r&&r.c(),n=Nn()},m(i,o){r&&r.m(i,o),F(i,n,o),t=!0},p(i,[o]){i[0]?r?(r.p(i,o),o&1&&$(r,1)):(r=Ja(i),r.c(),$(r,1),r.m(n.parentNode,n)):r&&(nt(),W(r,1,1,()=>{r=null}),rt())},i(i){t||($(r),t=!0)},o(i){W(r),t=!1},d(i){r&&r.d(i),i&&R(n)}}}function sp(e,n,t){let r;y(e,Nl,a=>t(2,r=a));let i,o=[];const s=Ue.subscribe(a=>{!a||(a.message.includes("Lost Connection to")||a.message.includes("Unable to connect to"))&&((i==null?void 0:i.message)===a.message||o.find(c=>c.message===a.message))||(o.unshift(a),i||l())});function l(){t(0,i=o.pop()),N(Nl,r=!!i,r)}return Uc(()=>s==null?void 0:s.unsubscribe()),[i,l]}class ap extends Ut{constructor(n){super(),Bt(this,n,sp,lp,Et,{})}}function So(e){return window.location.port==="4173"||window.location.port==="5174"?"http://localhost:"+55e3+e:e}function Qa(e){let n,t,r,i,o;return{c(){n=g("input"),h(n,"type","checkbox"),h(n,"class","multi-line-checkbox svelte-i377rk"),h(n,"id",t="multi-line-checkbox-"+e[0].id),h(n,"aria-label",r=e[0].id)},m(s,l){F(s,n,l),i||(o=x(n,"change",e[18]),i=!0)},p(s,l){l&1&&t!==(t="multi-line-checkbox-"+s[0].id)&&h(n,"id",t),l&1&&r!==(r=s[0].id)&&h(n,"aria-label",r)},d(s){s&&R(n),i=!1,o()}}}function ec(e){let n,t,r,i,o,s,l,a;return{c(){n=g("div"),t=g("button"),t.textContent="📷",r=w(),i=g("button"),i.textContent="🔊",o=w(),s=g("button"),s.textContent="🌐",h(t,"title","Screenshot"),be(t,"background-color","#333"),be(t,"color","#fff"),be(t,"border","1px solid #555"),be(t,"padding","6px 10px"),be(t,"font-size","10px"),be(t,"border-radius","4px"),be(t,"cursor","pointer"),be(t,"transition","background-color 0.3s"),h(t,"tabindex","-1"),h(t,"class","svelte-i377rk"),h(i,"title","Audio"),be(i,"background-color","#333"),be(i,"color","#fff"),be(i,"border","1px solid #555"),be(i,"padding","6px 10px"),be(i,"font-size","10px"),be(i,"border-radius","4px"),be(i,"cursor","pointer"),be(i,"transition","background-color 0.3s"),h(i,"tabindex","-1"),h(i,"class","svelte-i377rk"),h(s,"title","Translate"),be(s,"background-color","#333"),be(s,"color","#fff"),be(s,"border","1px solid #555"),be(s,"padding","6px 10px"),be(s,"font-size","10px"),be(s,"border-radius","4px"),be(s,"cursor","pointer"),be(s,"transition","background-color 0.3s"),h(s,"tabindex","-1"),h(s,"class","svelte-i377rk"),h(n,"class","textline-buttons unselectable svelte-i377rk")},m(c,u){F(c,n,u),f(n,t),f(n,r),f(n,i),f(n,o),f(n,s),l||(a=[x(t,"click",e[20]),x(i,"click",e[21]),x(s,"click",e[22])],l=!0)},p:Oe,d(c){c&&R(n),l=!1,At(a)}}}function tc(e){let n,t=e[6]&&e[6].includes(e[0].id),r,i,o=e[0].text+"",s,l,a,c=e[6]&&e[6].includes(e[0].id),u,p,m=t&&Qa(e),b=c&&ec(e);return{c(){n=g("div"),m&&m.c(),r=w(),i=g("p"),s=dt(o),a=w(),b&&b.c(),h(i,"class","my-2 cursor-pointer border-2 svelte-i377rk"),h(i,"contenteditable",e[4]),q(i,"py-4",!e[5]),q(i,"px-2",!e[5]),q(i,"py-2",e[5]),q(i,"px-4",e[5]),q(i,"border-transparent",!e[3]),q(i,"cursor-text",e[4]),q(i,"border-primary",e[3]),q(i,"border-accent-focus",e[4]),q(i,"whitespace-pre-wrap",e[8]),h(n,"class","textline2 svelte-i377rk")},m(k,S){F(k,n,S),m&&m.m(n,null),f(n,r),f(n,i),f(i,s),e[19](i),f(n,a),b&&b.m(n,null),u||(p=[x(i,"dblclick",e[10]),x(i,"keyup",jt)],u=!0)},p(k,S){e=k,S&65&&(t=e[6]&&e[6].includes(e[0].id)),t?m?m.p(e,S):(m=Qa(e),m.c(),m.m(n,r)):m&&(m.d(1),m=null),S&1&&o!==(o=e[0].text+"")&&$t(s,o),S&16&&h(i,"contenteditable",e[4]),S&32&&q(i,"py-4",!e[5]),S&32&&q(i,"px-2",!e[5]),S&32&&q(i,"py-2",e[5]),S&32&&q(i,"px-4",e[5]),S&8&&q(i,"border-transparent",!e[3]),S&16&&q(i,"cursor-text",e[4]),S&8&&q(i,"border-primary",e[3]),S&16&&q(i,"border-accent-focus",e[4]),S&256&&q(i,"whitespace-pre-wrap",e[8]),S&65&&(c=e[6]&&e[6].includes(e[0].id)),c?b?b.p(e,S):(b=ec(e),b.c(),b.m(n,null)):b&&(b.d(1),b=null)},i(k){l||Rr(()=>{l=Gc(i,Su,{x:e[5]?100:-100,duration:e[7]?250:0}),l.start()})},o:Oe,d(k){k&&R(n),m&&m.d(),e[19](null),b&&b.d(),u=!1,At(p)}}}function nc(e){let n,t,r,i,o,s=e[9].get(e[0].id)+"",l,a;return r=new we({props:{class:e[1]?"":"mr-2",path:$f}}),{c(){n=g("div"),t=g("div"),se(r.$$.fragment),i=w(),o=g("span"),l=dt(s),q(o,"mt-2",e[1]),h(t,"class","flex items-center"),h(n,"class","flex justify-center text-xs my-2 py-2 border-primary border-dashed milestone"),q(n,"border-x-2",e[1]),q(n,"border-y-2",!e[1]),q(n,"py-4",!e[5]),q(n,"px-2",!e[5]),q(n,"py-2",e[5]),q(n,"px-4",e[5])},m(c,u){F(c,n,u),f(n,t),re(r,t,null),f(t,i),f(t,o),f(o,l),a=!0},p(c,u){const p={};u&2&&(p.class=c[1]?"":"mr-2"),r.$set(p),(!a||u&513)&&s!==(s=c[9].get(c[0].id)+"")&&$t(l,s),(!a||u&2)&&q(o,"mt-2",c[1]),(!a||u&2)&&q(n,"border-x-2",c[1]),(!a||u&2)&&q(n,"border-y-2",!c[1]),(!a||u&32)&&q(n,"py-4",!c[5]),(!a||u&32)&&q(n,"px-2",!c[5]),(!a||u&32)&&q(n,"py-2",c[5]),(!a||u&32)&&q(n,"px-4",c[5])},i(c){a||($(r.$$.fragment,c),a=!0)},o(c){W(r.$$.fragment,c),a=!1},d(c){c&&R(n),ie(r)}}}function cp(e){let n=e[0].text,t,r,i,o=e[9].has(e[0].id),s,l,a=tc(e),c=o&&nc(e);return{c(){a.c(),t=w(),r=new Bc(!1),i=w(),c&&c.c(),s=Nn(),r.a=i},m(u,p){a.m(u,p),F(u,t,p),r.m(Lu,u,p),F(u,i,p),c&&c.m(u,p),F(u,s,p),l=!0},p(u,[p]){p&1&&Et(n,n=u[0].text)?(nt(),W(a,1,1,Oe),rt(),a=tc(u),a.c(),$(a,1),a.m(t.parentNode,t)):a.p(u,p),p&513&&(o=u[9].has(u[0].id)),o?c?(c.p(u,p),p&513&&$(c,1)):(c=nc(u),c.c(),$(c,1),c.m(s.parentNode,s)):c&&(nt(),W(c,1,1,()=>{c=null}),rt())},i(u){l||($(a),$(c),l=!0)},o(u){W(a),W(c),l=!1},d(u){a.d(u),u&&R(t),u&&r.d(),u&&R(i),c&&c.d(u),u&&R(s)}}}function up(e,n,t){let r,i,o,s,l,a,c,u;y(e,Ps,A=>t(24,i=A)),y(e,Cl,A=>t(6,o=A)),y(e,zi,A=>t(7,s=A)),y(e,jr,A=>t(25,l=A)),y(e,Wr,A=>t(1,a=A)),y(e,Ri,A=>t(8,c=A)),y(e,Ur,A=>t(9,u=A));let{line:p}=n,{index:m}=n,{isLast:b}=n,{pipWindow:k=void 0}=n;function S(){t(3,I=!1)}function V(A){return I||A.intersectsNode(D)?p.id:void 0}const O=zr();let D,P="",I=!1,Z=!1;zl(()=>{b&&Rl(k||window,D.parentElement.parentElement,l,r,s?"smooth":"auto"),o&&o.includes(p.id)&&i&&E(p.id,"TL")}),Uc(()=>{document.removeEventListener("click",K,!1),O("edit",{inEdit:!1})});function J(A){var T;k||((T=window.getSelection())==null||T.removeAllRanges(),A.ctrlKey||A.metaKey?I?(t(3,I=!1),O("deselected",p.id)):(t(3,I=!0),O("selected",p.id)):(P=D.innerText,t(4,Z=!0),O("edit",{inEdit:!0}),document.addEventListener("click",K,!1),go().then(()=>{D.focus()})))}function K(A){const T=A.target;D.contains(T)||(t(4,Z=!1),document.removeEventListener("click",K,!1),O("edit",{inEdit:!1,data:{originalText:P,newText:D.innerText,lineIndex:m,line:p}}))}async function j(A){try{const T=await fetch(So("/update_checkbox"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A})});if(!T.ok)throw new Error(`HTTP error! Status: ${T.status}`)}catch(T){console.error("Error updating checkbox:",T)}}function E(A,T,z=!1){console.log(A);let ue={TL:"/translate-line",Screenshot:"/get-screenshot",Audio:"/play-audio"}[T]??"";fetch(So(ue),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A,text:p.text})}).then(_e=>{if(!_e.ok)throw new Error(`HTTP error! Status: ${_e.status}`);return _e.json()}).then(_e=>{T==="TL"&&(z||t(0,p.text=p.text+`
29
29
  `+_e.TL,p)),console.log(`${T} action completed for event ID: ${A}`,_e)}).catch(_e=>{console.error(`Error performing ${T} action for event ID: ${A}`,_e)})}const B=()=>j(p.id);function U(A){mt[A?"unshift":"push"](()=>{D=A,t(2,D)})}const X=()=>E(p.id,"Screenshot"),ve=()=>E(p.id,"Audio"),ne=()=>E(p.id,"TL");return e.$$set=A=>{"line"in A&&t(0,p=A.line),"index"in A&&t(13,m=A.index),"isLast"in A&&t(14,b=A.isLast),"pipWindow"in A&&t(15,k=A.pipWindow)},e.$$.update=()=>{e.$$.dirty&32770&&t(5,r=!k&&a)},[p,a,D,I,Z,r,o,s,c,u,J,j,E,m,b,k,S,V,B,U,X,ve,ne]}class xu extends Ut{constructor(n){super(),Bt(this,n,up,cp,Et,{line:0,index:13,isLast:14,pipWindow:15,deselect:16,getIdIfSelected:17})}get deselect(){return this.$$.ctx[16]}get getIdIfSelected(){return this.$$.ctx[17]}}function fp(e){let n,t,r,i,o,s,l,a;return r=new we({props:{path:Xc}}),{c(){n=g("div"),t=g("div"),se(r.$$.fragment),i=w(),o=g("textarea"),h(t,"class","flex cursor-pointer items-end md:items-center"),h(n,"class","flex justify-end p-4"),h(o,"class","flex-1 overflow-auto ml-10 mr-2 mb-4 p-1 pb-2"),be(o,"resize","none"),o.value=e[0]},m(c,u){F(c,n,u),f(n,t),re(r,t,null),F(c,i,u),F(c,o,u),s=!0,l||(a=[x(t,"click",e[3]),x(t,"keyup",jt),x(o,"blur",e[2])],l=!0)},p(c,[u]){(!s||u&1)&&(o.value=c[0])},i(c){s||($(r.$$.fragment,c),s=!0)},o(c){W(r.$$.fragment,c),s=!1},d(c){c&&R(n),ie(r),c&&R(i),c&&R(o),l=!1,At(a)}}}function hp(e,n,t){let r,i;y(e,ko,l=>t(0,r=l)),y(e,Hl,l=>t(1,i=l));function o(l){N(ko,r=l.target.value,r)}return[r,i,o,()=>N(Hl,i=!1,i)]}class pp extends Ut{constructor(n){super(),Bt(this,n,hp,fp,Et,{})}}const{Map:Pu}=$s;function rc(e,n,t){const r=e.slice();return r[62]=n[t],r}function ic(e,n,t){const r=e.slice();return r[62]=n[t],r}function dp(e){let n,t,r,i,o,s=[],l=new Pu,a,c,u,p,m,b,k,S,V,O,D,P,I,Z,J,K,j,E,B,U,X,ve,ne,A=e[2].length?e[2]:e[4];const T=z=>z[62].name;for(let z=0;z<A.length;z+=1){let oe=rc(e,A,z),ue=T(oe);l.set(ue,s[z]=oc(ue,oe))}return u=new we({props:{path:yf}}),S=new we({props:{path:ys}}),I=new we({props:{path:Tf}}),E=new we({props:{path:so}}),{c(){n=g("details"),t=g("summary"),t.textContent="Presets",r=w(),i=g("div"),o=g("select");for(let z=0;z<s.length;z+=1)s[z].c();a=w(),c=g("div"),se(u.$$.fragment),p=w(),m=g("span"),m.textContent="Save",b=w(),k=g("div"),se(S.$$.fragment),V=w(),O=g("span"),O.textContent="Export/Import",D=w(),P=g("div"),se(I.$$.fragment),Z=w(),J=g("span"),J.textContent="Reload",K=w(),j=g("div"),se(E.$$.fragment),B=w(),U=g("span"),U.textContent="Delete",h(o,"class","select flex-1 max-w-md"),h(m,"class","label-text"),h(c,"role","button"),h(c,"class","flex flex-col items-center hover:text-primary ml-3"),h(O,"class","label-text"),h(k,"role","button"),h(k,"class","flex flex-col items-center hover:text-primary ml-3"),h(J,"class","label-text"),h(P,"role","button"),h(P,"class","flex flex-col items-center hover:text-primary ml-3"),q(P,"invisible",!e[1]),h(U,"class","label-text"),h(j,"role","button"),h(j,"class","flex flex-col items-center hover:text-primary ml-3"),q(j,"invisible",!e[1]),h(i,"class","flex items-center justify-between mt-2"),h(n,"role","button"),h(n,"class","col-span-4 mb-2")},m(z,oe){F(z,n,oe),f(n,t),f(n,r),f(n,i),f(i,o);for(let ue=0;ue<s.length;ue+=1)s[ue].m(o,null);wi(o,e[1]),f(i,a),f(i,c),re(u,c,null),f(c,p),f(c,m),f(i,b),f(i,k),re(S,k,null),f(k,V),f(k,O),f(i,D),f(i,P),re(I,P,null),f(P,Z),f(P,J),f(i,K),f(i,j),re(E,j,null),f(j,B),f(j,U),X=!0,ve||(ne=[x(o,"change",e[6]),x(c,"click",e[8]),x(c,"keyup",jt),x(k,"click",e[12]),x(k,"keyup",jt),x(P,"click",e[13]),x(P,"keyup",jt),x(j,"click",e[9]),x(j,"keyup",jt)],ve=!0)},p(z,oe){oe[0]&20&&(A=z[2].length?z[2]:z[4],s=Yr(s,oe,T,1,z,A,l,o,Yl,oc,null,rc)),(!X||oe[0]&22)&&wi(o,z[1]),(!X||oe[0]&2)&&q(P,"invisible",!z[1]),(!X||oe[0]&2)&&q(j,"invisible",!z[1])},i(z){X||($(u.$$.fragment,z),$(S.$$.fragment,z),$(I.$$.fragment,z),$(E.$$.fragment,z),X=!0)},o(z){W(u.$$.fragment,z),W(S.$$.fragment,z),W(I.$$.fragment,z),W(E.$$.fragment,z),X=!1},d(z){z&&R(n);for(let oe=0;oe<s.length;oe+=1)s[oe].d();ie(u),ie(S),ie(I),ie(E),ve=!1,At(ne)}}}function mp(e){let n,t=[],r=new Pu,i,o,s=e[2].length?e[2]:e[4];const l=a=>a[62].name;for(let a=0;a<s.length;a+=1){let c=ic(e,s,a),u=l(c);r.set(u,t[a]=lc(u,c))}return{c(){n=g("select");for(let a=0;a<t.length;a+=1)t[a].c();h(n,"class","w-48 hidden sm:block"),q(n,"sm:hidden",!e[3]||e[2].length<2)},m(a,c){F(a,n,c);for(let u=0;u<t.length;u+=1)t[u].m(n,null);wi(n,e[1]),i||(o=x(n,"change",e[6]),i=!0)},p(a,c){c[0]&20&&(s=a[2].length?a[2]:a[4],t=Yr(t,c,l,1,a,s,r,n,Yl,lc,null,ic)),c[0]&22&&wi(n,a[1]),c[0]&12&&q(n,"sm:hidden",!a[3]||a[2].length<2)},i:Oe,o:Oe,d(a){a&&R(n);for(let c=0;c<t.length;c+=1)t[c].d();i=!1,o()}}}function oc(e,n){let t,r=(n[62].name||"No Presets stored")+"",i,o,s;return{key:e,first:null,c(){t=g("option"),i=dt(r),o=w(),t.__value=s=n[62].name,t.value=t.__value,this.first=t},m(l,a){F(l,t,a),f(t,i),f(t,o)},p(l,a){n=l,a[0]&4&&r!==(r=(n[62].name||"No Presets stored")+"")&&$t(i,r),a[0]&4&&s!==(s=n[62].name)&&(t.__value=s,t.value=t.__value)},d(l){l&&R(t)}}}function lc(e,n){let t,r=n[62].name+"",i,o,s;return{key:e,first:null,c(){t=g("option"),i=dt(r),o=w(),t.__value=s=n[62].name,t.value=t.__value,this.first=t},m(l,a){F(l,t,a),f(t,i),f(t,o)},p(l,a){n=l,a[0]&4&&r!==(r=n[62].name+"")&&$t(i,r),a[0]&4&&s!==(s=n[62].name)&&(t.__value=s,t.value=t.__value)},d(l){l&&R(t)}}}function gp(e){let n,t,r,i;const o=[mp,dp],s=[];function l(a,c){return a[0]?0:1}return n=l(e),t=s[n]=o[n](e),{c(){t.c(),r=Nn()},m(a,c){s[n].m(a,c),F(a,r,c),i=!0},p(a,c){let u=n;n=l(a),n===u?s[n].p(a,c):(nt(),W(s[u],1,1,()=>{s[u]=null}),rt(),t=s[n],t?t.p(a,c):(t=s[n]=o[n](a),t.c()),$(t,1),t.m(r.parentNode,r))},i(a){i||($(t),i=!0)},o(a){W(t),i=!1},d(a){s[n].d(a),a&&R(r)}}}function bp(e,n,t){let r,i,o,s,l,a,c,u,p,m,b,k,S,V,O,D,P,I,Z,J,K,j,E,B,U,X,ve,ne,A,T,z,oe,ue,_e,Xe,Ve,Ze,Ye,He,yt,gt,Ne,ze,Fe,ye,Ie,bt,he,ut,We,Re;y(e,lr,_=>t(1,r=_)),y(e,_n,_=>t(2,i=_)),y(e,Ue,_=>t(14,o=_)),y(e,Ci,_=>t(15,s=_)),y(e,Br,_=>t(16,l=_)),y(e,zs,_=>t(17,a=_)),y(e,Us,_=>t(18,c=_)),y(e,Ur,_=>t(19,u=_)),y(e,Mr,_=>t(20,p=_)),y(e,qi,_=>t(21,m=_)),y(e,Gi,_=>t(22,b=_)),y(e,Ki,_=>t(23,k=_)),y(e,Yi,_=>t(24,S=_)),y(e,zi,_=>t(25,V=_)),y(e,Ui,_=>t(26,O=_)),y(e,Bi,_=>t(27,D=_)),y(e,ji,_=>t(28,P=_)),y(e,Wi,_=>t(29,I=_)),y(e,Fi,_=>t(30,Z=_)),y(e,Vi,_=>t(31,J=_)),y(e,Ri,_=>t(32,K=_)),y(e,jr,_=>t(33,j=_)),y(e,Wr,_=>t(34,E=_)),y(e,Ni,_=>t(35,B=_)),y(e,Hi,_=>t(36,U=_)),y(e,$i,_=>t(37,X=_)),y(e,Fr,_=>t(38,ve=_)),y(e,Mi,_=>t(39,ne=_)),y(e,Ii,_=>t(40,A=_)),y(e,Oi,_=>t(41,T=_)),y(e,Di,_=>t(42,z=_)),y(e,Ti,_=>t(43,oe=_)),y(e,Ai,_=>t(44,ue=_)),y(e,Pi,_=>t(45,_e=_)),y(e,xi,_=>t(46,Xe=_)),y(e,Li,_=>t(47,Ve=_)),y(e,Ei,_=>t(48,Ze=_)),y(e,yo,_=>t(3,Ye=_)),y(e,wo,_=>t(49,He=_)),y(e,Si,_=>t(50,yt=_)),y(e,ar,_=>t(51,gt=_)),y(e,Hr,_=>t(52,Ne=_)),y(e,Dr,_=>t(53,ze=_)),y(e,$r,_=>t(54,Fe=_)),y(e,ki,_=>t(55,ye=_)),y(e,Ir,_=>t(56,Ie=_)),y(e,$n,_=>t(57,bt=_)),y(e,Mn,_=>t(58,he=_)),y(e,_o,_=>t(59,ut=_)),y(e,ln,_=>t(60,We=_)),y(e,Or,_=>t(61,Re=_));let{isQuickSwitch:it=!1}=n;function vt(){return{theme$:Re,replacements$:We,windowTitle$:ut,websocketUrl$:he,secondaryWebsocketUrl$:bt,fontSize$:Ie,characterMilestone$:p,onlineFont$:ye,preventLastDuplicate$:Fe,maxLines$:ze,maxPipLines$:Ne,afkTimer$:gt,adjustTimerOnAfk$:yt,enableExternalClipboardMonitor$:He,showPresetQuickSwitch$:Ye,skipResetConfirmations$:s,persistStats$:Ze,persistNotes$:Ve,persistLines$:Xe,persistActionHistory$:_e,enablePaste$:ue,blockCopyOnPage$:oe,allowPasteDuringPause$:z,allowNewLineDuringPause$:T,autoStartTimerDuringPausePaste$:A,autoStartTimerDuringPause$:ne,preventGlobalDuplicate$:ve,mergeEqualLineStarts$:X,filterNonCJKLines:U,flashOnMissedLine$:B,displayVertical$:E,reverseLineOrder$:j,preserveWhitespace$:K,removeAllWhitespace$:J,showTimer$:Z,showSpeed$:I,showCharacterCount$:P,showLineCount$:D,blurStats$:O,enableLineAnimation$:V,enableAfkBlur$:S,enableAfkBlurRestart$:k,continuousReconnect$:l,showConnectionErrors$:b,customCSS$:m}}function je(_,de=!0){Or.next(_.settings.theme$??L.theme$),ln.next(_.settings.replacements$??L.replacements$),_o.next(_.settings.windowTitle$??L.windowTitle$),Mn.next(_.settings.websocketUrl$??L.websocketUrl$),$n.next(_.settings.secondaryWebsocketUrl$??""),Ir.next(_.settings.fontSize$??L.fontSize$),Mr.next(_.settings.characterMilestone$??L.characterMilestone$),ki.next(_.settings.onlineFont$??L.onlineFont$),$r.next(_.settings.preventLastDuplicate$??L.preventLastDuplicate$),Dr.next(_.settings.maxLines$??L.maxLines$),Hr.next(_.settings.maxPipLines$??L.maxPipLines$),ar.next(_.settings.afkTimer$??L.afkTimer$),Si.next(_.settings.adjustTimerOnAfk$??L.adjustTimerOnAfk$),wo.next(_.settings.enableExternalClipboardMonitor$??L.enableExternalClipboardMonitor$),yo.next(_.settings.showPresetQuickSwitch$??L.showPresetQuickSwitch$),Ci.next(_.settings.skipResetConfirmations$??L.skipResetConfirmations$),Ei.next(_.settings.persistStats$??L.persistStats$),Li.next(_.settings.persistNotes$??L.persistNotes$),xi.next(_.settings.persistLines$??L.persistLines$),Pi.next(_.settings.persistActionHistory$??L.persistActionHistory$),Ai.next(_.settings.enablePaste$??L.enablePaste$),Ti.next(_.settings.blockCopyOnPage$??L.blockCopyOnPage$),Di.next(_.settings.allowPasteDuringPause$??L.allowPasteDuringPause$),Oi.next(_.settings.allowNewLineDuringPause$??L.allowNewLineDuringPause$),Ii.next(_.settings.autoStartTimerDuringPausePaste$??L.autoStartTimerDuringPausePaste$),Mi.next(_.settings.autoStartTimerDuringPause$??L.autoStartTimerDuringPause$),Fr.next(_.settings.preventGlobalDuplicate$??L.preventGlobalDuplicate$),$i.next(_.settings.mergeEqualLineStarts$??L.mergeEqualLineStarts$),Hi.next(_.settings.filterNonCJKLines??L.filterNonCJKLines),Ni.next(_.settings.flashOnMissedLine$??L.flashOnMissedLine$),Wr.next(_.settings.displayVertical$??L.displayVertical$),jr.next(_.settings.reverseLineOrder$??L.reverseLineOrder$),Ri.next(_.settings.preserveWhitespace$??L.preserveWhitespace$),Vi.next(_.settings.removeAllWhitespace$??L.removeAllWhitespace$),Fi.next(_.settings.showTimer$??L.showTimer$),Wi.next(_.settings.showSpeed$??L.showSpeed$),ji.next(_.settings.showCharacterCount$??L.showCharacterCount$),Bi.next(_.settings.showLineCount$??L.showLineCount$),Ui.next(_.settings.blurStats$??L.blurStats$),zi.next(_.settings.enableLineAnimation$??L.enableLineAnimation$),Yi.next(_.settings.enableAfkBlur$??L.enableAfkBlur$),Ki.next(_.settings.enableAfkBlurRestart$??L.enableAfkBlurRestart$),Br.next(_.settings.continuousReconnect$??L.continuousReconnect$),Gi.next(_.settings.showConnectionErrors$??L.showConnectionErrors$),qi.next(_.settings.customCSS$??L.customCSS$),de&&N(lr,r=_.name,r),p===0&&N(Ur,u=new Map,u),go().then(()=>{Be("layoutChange"),c!==1&&l&&Ql.next(),a!==1&&l&&es.next()})}const ae=[{name:""}],Be=zr();function _t(_){const de=_.target;Se(de.selectedOptions[0].value)}function Se(_){const de=i.find(Dt=>Dt.name===_);de&&je(de)}async function ke(){const{canceled:_,data:de}=await new Promise(ot=>{N(Ue,o={icon:tn,askForData:"text",dataValue:r||"Preset Name",message:"",callback:ot},o)});if(_||!de)return;const Dt=i.findIndex(ot=>ot.name===de),Pe={name:de,settings:vt()};Dt>-1?N(_n,i[Dt]=Pe,i):N(_n,i=[...i,Pe],i),N(lr,r=de,r)}async function kt(){if(!s){const{canceled:_}=await new Promise(de=>{N(Ue,o={icon:tn,message:"Preset will be deleted",callback:de},o)});if(_)return}N(_n,i=i.filter(_=>_.name!==r),i),N(lr,r="",r)}const Tt=_=>Be("exportImportPreset",_),Ee=()=>Se(r);return e.$$set=_=>{"isQuickSwitch"in _&&t(0,it=_.isQuickSwitch)},[it,r,i,Ye,ae,Be,_t,Se,ke,kt,vt,je,Tt,Ee]}class Au extends Ut{constructor(n){super(),Bt(this,n,bp,gp,Et,{isQuickSwitch:0,getCurrentSettings:10,updateSettingsWithPreset:11},null,[-1,-1,-1])}get getCurrentSettings(){return this.$$.ctx[10]}get updateSettingsWithPreset(){return this.$$.ctx[11]}}function vp(e,n){const t=r=>{!r.defaultPrevented&&!e.contains(r.target)&&n(r)};return document.addEventListener("click",t,!0),{destroy(){document.removeEventListener("click",t,!0)}}}function sc(e,n,t){const r=e.slice();return r[22]=n[t],r}function ac(e){let n,t,r,i,o;return t=new we({props:{path:Cf}}),{c(){n=g("button"),se(t.$$.fragment),h(n,"title","Save"),h(n,"class","hover:text-primary")},m(s,l){F(s,n,l),re(t,n,null),r=!0,i||(o=x(n,"click",e[10]),i=!0)},p:Oe,i(s){r||($(t.$$.fragment,s),r=!0)},o(s){W(t.$$.fragment,s),r=!1},d(s){s&&R(n),ie(t),i=!1,o()}}}function cc(e,n){let t,r,i,o=n[22].label+"",s,l,a,c;return{key:e,first:null,c(){t=g("label"),r=g("input"),i=w(),s=dt(o),l=w(),h(r,"type","checkbox"),r.__value=n[22].value,r.value=r.__value,n[18][0].push(r),this.first=t},m(u,p){F(u,t,p),f(t,r),r.checked=~n[0].flags.indexOf(r.__value),f(t,i),f(t,s),f(t,l),a||(c=[x(r,"change",n[17]),x(r,"change",n[9])],a=!0)},p(u,p){n=u,p&1&&(r.checked=~n[0].flags.indexOf(r.__value))},d(u){u&&R(t),n[18][0].splice(n[18][0].indexOf(r),1),a=!1,At(c)}}}function _p(e){let n=(e[5]??"")+"",t,r,i,o,s,l,a,c,u,p,m,b,k,S,V,O,D=[],P=new Map,I,Z,J,K,j=(e[4]||e[3])+"",E,B,U,X=e[0].pattern&&ac(e);l=new we({props:{path:qc}}),u=new we({props:{path:Ef}});let ve=e[7];const ne=A=>A[22].value;for(let A=0;A<ve.length;A+=1){let T=sc(e,ve,A),z=ne(T);P.set(z,D[A]=cc(z,T))}return{c(){t=dt(n),r=w(),i=g("div"),X&&X.c(),o=w(),s=g("button"),se(l.$$.fragment),a=w(),c=g("button"),se(u.$$.fragment),p=w(),m=g("div"),b=g("input"),k=w(),S=g("input"),V=w(),O=g("div");for(let A=0;A<D.length;A+=1)D[A].c();I=w(),Z=g("textarea"),J=w(),K=g("div"),h(s,"title","Cancel"),h(s,"class","ml-2 hover:text-primary"),h(c,"title","Cancel"),h(c,"class","ml-2 hover:text-primary"),h(i,"class","flex justify-end my-2"),h(b,"placeholder","text pattern"),h(b,"class","w-full my-2"),h(S,"placeholder","replacement pattern"),h(S,"class","w-full my-2"),h(O,"class","flex justify-between my-4"),h(Z,"name","test-value"),h(Z,"placeholder","test value"),h(Z,"class","w-full my-4"),h(Z,"rows","3"),h(K,"class","whitespace-pre-wrap break-all")},m(A,T){F(A,t,T),F(A,r,T),F(A,i,T),X&&X.m(i,null),f(i,o),f(i,s),re(l,s,null),f(i,a),f(i,c),re(u,c,null),F(A,p,T),F(A,m,T),f(m,b),wt(b,e[0].pattern),e[15](b),f(m,k),f(m,S),wt(S,e[0].replaces),f(m,V),f(m,O);for(let z=0;z<D.length;z+=1)D[z].m(O,null);f(m,I),f(m,Z),wt(Z,e[2]),f(m,J),f(m,K),K.innerHTML=j,E=!0,B||(U=[x(s,"click",e[12]),x(c,"click",e[13]),x(b,"input",e[14]),x(b,"input",e[9]),x(S,"input",e[16]),x(S,"input",e[9]),x(Z,"input",e[19]),x(Z,"input",e[9])],B=!0)},p(A,[T]){(!E||T&32)&&n!==(n=(A[5]??"")+"")&&$t(t,n),A[0].pattern?X?(X.p(A,T),T&1&&$(X,1)):(X=ac(A),X.c(),$(X,1),X.m(i,o)):X&&(nt(),W(X,1,1,()=>{X=null}),rt()),T&1&&b.value!==A[0].pattern&&wt(b,A[0].pattern),T&1&&S.value!==A[0].replaces&&wt(S,A[0].replaces),T&641&&(ve=A[7],D=Yr(D,T,ne,1,A,ve,P,O,Yl,cc,null,sc)),T&4&&wt(Z,A[2]),(!E||T&24)&&j!==(j=(A[4]||A[3])+"")&&(K.innerHTML=j)},i(A){E||($(X),$(l.$$.fragment,A),$(u.$$.fragment,A),E=!0)},o(A){W(X),W(l.$$.fragment,A),W(u.$$.fragment,A),E=!1},d(A){A&&R(t),A&&R(r),A&&R(i),X&&X.d(),ie(l),ie(u),A&&R(p),A&&R(m),e[15](null);for(let T=0;T<D.length;T+=1)D[T].d();B=!1,At(U)}}}function wp(e,n,t){let r,i;y(e,ln,E=>t(20,r=E));let{currentReplacement:o}=n;const s=zr(),l=new Zi,a=o?JSON.parse(JSON.stringify(o)):{pattern:"",replaces:"",flags:[],enabled:!0},c=[{label:"global",value:"g"},{label:"multiline",value:"m"},{label:"insensitive",value:"i"},{label:"unicode",value:"u"}],u=l.pipe(Bs(500),tr(()=>{try{if(t(4,k=""),!a.pattern||!m)return;t(3,b=Cu(m,[a]))}catch({message:E}){t(4,k=`Error: ${E}`)}}),rr());y(e,u,E=>t(5,i=E));let p,m="",b="",k="";function S(){p.setCustomValidity(k),l.next()}function V(){if(!o&&r.find(E=>E.pattern===a.pattern))return p.setCustomValidity("This pattern already exists"),p.reportValidity();o?N(ln,r=r.map(E=>E.pattern===o.pattern?a:E),r):N(ln,r=[...r,a],r),s("close")}const O=[[]],D=()=>s("close"),P=()=>window.open("https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#description","_blank");function I(){a.pattern=this.value,t(0,a)}function Z(E){mt[E?"unshift":"push"](()=>{p=E,t(1,p)})}function J(){a.replaces=this.value,t(0,a)}function K(){a.flags=rf(O[0],this.__value,this.checked),t(0,a)}function j(){m=this.value,t(2,m)}return e.$$set=E=>{"currentReplacement"in E&&t(11,o=E.currentReplacement)},[a,p,m,b,k,i,s,c,u,S,V,o,D,P,I,Z,J,K,O,j]}class yp extends Ut{constructor(n){super(),Bt(this,n,wp,_p,Et,{currentReplacement:11})}}function uc(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,r)}return t}function kn(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};n%2?uc(Object(t),!0).forEach(function(r){kp(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):uc(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function Ll(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ll=function(n){return typeof n}:Ll=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ll(e)}function kp(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Sn(){return Sn=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Sn.apply(this,arguments)}function Sp(e,n){if(e==null)return{};var t={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(n.indexOf(i)>=0)&&(t[i]=e[i]);return t}function Cp(e,n){if(e==null)return{};var t=Sp(e,n),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(n.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}var Ep="1.15.2";function Hn(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var Wn=Hn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),xo=Hn(/Edge/i),fc=Hn(/firefox/i),ao=Hn(/safari/i)&&!Hn(/chrome/i)&&!Hn(/android/i),Tu=Hn(/iP(ad|od|hone)/i),Du=Hn(/chrome/i)&&Hn(/android/i),Ou={capture:!1,passive:!1};function De(e,n,t){e.addEventListener(n,t,!Wn&&Ou)}function xe(e,n,t){e.removeEventListener(n,t,!Wn&&Ou)}function Vl(e,n){if(n){if(n[0]===">"&&(n=n.substring(1)),e)try{if(e.matches)return e.matches(n);if(e.msMatchesSelector)return e.msMatchesSelector(n);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(n)}catch{return!1}return!1}}function Lp(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function fn(e,n,t,r){if(e){t=t||document;do{if(n!=null&&(n[0]===">"?e.parentNode===t&&Vl(e,n):Vl(e,n))||r&&e===t)return e;if(e===t)break}while(e=Lp(e))}return null}var hc=/\s+/g;function xt(e,n,t){if(e&&n)if(e.classList)e.classList[t?"add":"remove"](n);else{var r=(" "+e.className+" ").replace(hc," ").replace(" "+n+" "," ");e.className=(r+(t?" "+n:"")).replace(hc," ")}}function fe(e,n,t){var r=e&&e.style;if(r){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(t=e.currentStyle),n===void 0?t:t[n];!(n in r)&&n.indexOf("webkit")===-1&&(n="-webkit-"+n),r[n]=t+(typeof t=="string"?"":"px")}}function _i(e,n){var t="";if(typeof e=="string")t=e;else do{var r=fe(e,"transform");r&&r!=="none"&&(t=r+" "+t)}while(!n&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(t)}function Iu(e,n,t){if(e){var r=e.getElementsByTagName(n),i=0,o=r.length;if(t)for(;i<o;i++)t(r[i],i);return r}return[]}function yn(){var e=document.scrollingElement;return e||document.documentElement}function ct(e,n,t,r,i){if(!(!e.getBoundingClientRect&&e!==window)){var o,s,l,a,c,u,p;if(e!==window&&e.parentNode&&e!==yn()?(o=e.getBoundingClientRect(),s=o.top,l=o.left,a=o.bottom,c=o.right,u=o.height,p=o.width):(s=0,l=0,a=window.innerHeight,c=window.innerWidth,u=window.innerHeight,p=window.innerWidth),(n||t)&&e!==window&&(i=i||e.parentNode,!Wn))do if(i&&i.getBoundingClientRect&&(fe(i,"transform")!=="none"||t&&fe(i,"position")!=="static")){var m=i.getBoundingClientRect();s-=m.top+parseInt(fe(i,"border-top-width")),l-=m.left+parseInt(fe(i,"border-left-width")),a=s+o.height,c=l+o.width;break}while(i=i.parentNode);if(r&&e!==window){var b=_i(i||e),k=b&&b.a,S=b&&b.d;b&&(s/=S,l/=k,p/=k,u/=S,a=s+u,c=l+p)}return{top:s,left:l,bottom:a,right:c,width:p,height:u}}}function pc(e,n,t){for(var r=sr(e,!0),i=ct(e)[n];r;){var o=ct(r)[t],s=void 0;if(t==="top"||t==="left"?s=i>=o:s=i<=o,!s)return r;if(r===yn())break;r=sr(r,!1)}return!1}function Xi(e,n,t,r){for(var i=0,o=0,s=e.children;o<s.length;){if(s[o].style.display!=="none"&&s[o]!==ce.ghost&&(r||s[o]!==ce.dragged)&&fn(s[o],t.draggable,e,!1)){if(i===n)return s[o];i++}o++}return null}function Ys(e,n){for(var t=e.lastElementChild;t&&(t===ce.ghost||fe(t,"display")==="none"||n&&!Vl(t,n));)t=t.previousElementSibling;return t||null}function Wt(e,n){var t=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==ce.clone&&(!n||Vl(e,n))&&t++;return t}function dc(e){var n=0,t=0,r=yn();if(e)do{var i=_i(e),o=i.a,s=i.d;n+=e.scrollLeft*o,t+=e.scrollTop*s}while(e!==r&&(e=e.parentNode));return[n,t]}function xp(e,n){for(var t in e)if(e.hasOwnProperty(t)){for(var r in n)if(n.hasOwnProperty(r)&&n[r]===e[t][r])return Number(t)}return-1}function sr(e,n){if(!e||!e.getBoundingClientRect)return yn();var t=e,r=!1;do if(t.clientWidth<t.scrollWidth||t.clientHeight<t.scrollHeight){var i=fe(t);if(t.clientWidth<t.scrollWidth&&(i.overflowX=="auto"||i.overflowX=="scroll")||t.clientHeight<t.scrollHeight&&(i.overflowY=="auto"||i.overflowY=="scroll")){if(!t.getBoundingClientRect||t===document.body)return yn();if(r||n)return t;r=!0}}while(t=t.parentNode);return yn()}function Pp(e,n){if(e&&n)for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e}function as(e,n){return Math.round(e.top)===Math.round(n.top)&&Math.round(e.left)===Math.round(n.left)&&Math.round(e.height)===Math.round(n.height)&&Math.round(e.width)===Math.round(n.width)}var co;function Mu(e,n){return function(){if(!co){var t=arguments,r=this;t.length===1?e.call(r,t[0]):e.apply(r,t),co=setTimeout(function(){co=void 0},n)}}}function Ap(){clearTimeout(co),co=void 0}function $u(e,n,t){e.scrollLeft+=n,e.scrollTop+=t}function Hu(e){var n=window.Polymer,t=window.jQuery||window.Zepto;return n&&n.dom?n.dom(e).cloneNode(!0):t?t(e).clone(!0)[0]:e.cloneNode(!0)}function Nu(e,n,t){var r={};return Array.from(e.children).forEach(function(i){var o,s,l,a;if(!(!fn(i,n.draggable,e,!1)||i.animated||i===t)){var c=ct(i);r.left=Math.min((o=r.left)!==null&&o!==void 0?o:1/0,c.left),r.top=Math.min((s=r.top)!==null&&s!==void 0?s:1/0,c.top),r.right=Math.max((l=r.right)!==null&&l!==void 0?l:-1/0,c.right),r.bottom=Math.max((a=r.bottom)!==null&&a!==void 0?a:-1/0,c.bottom)}}),r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}var Zt="Sortable"+new Date().getTime();function Tp(){var e=[],n;return{captureAnimationState:function(){if(e=[],!!this.options.animation){var r=[].slice.call(this.el.children);r.forEach(function(i){if(!(fe(i,"display")==="none"||i===ce.ghost)){e.push({target:i,rect:ct(i)});var o=kn({},e[e.length-1].rect);if(i.thisAnimationDuration){var s=_i(i,!0);s&&(o.top-=s.f,o.left-=s.e)}i.fromRect=o}})}},addAnimationState:function(r){e.push(r)},removeAnimationState:function(r){e.splice(xp(e,{target:r}),1)},animateAll:function(r){var i=this;if(!this.options.animation){clearTimeout(n),typeof r=="function"&&r();return}var o=!1,s=0;e.forEach(function(l){var a=0,c=l.target,u=c.fromRect,p=ct(c),m=c.prevFromRect,b=c.prevToRect,k=l.rect,S=_i(c,!0);S&&(p.top-=S.f,p.left-=S.e),c.toRect=p,c.thisAnimationDuration&&as(m,p)&&!as(u,p)&&(k.top-p.top)/(k.left-p.left)===(u.top-p.top)/(u.left-p.left)&&(a=Op(k,m,b,i.options)),as(p,u)||(c.prevFromRect=u,c.prevToRect=p,a||(a=i.options.animation),i.animate(c,k,p,a)),a&&(o=!0,s=Math.max(s,a),clearTimeout(c.animationResetTimer),c.animationResetTimer=setTimeout(function(){c.animationTime=0,c.prevFromRect=null,c.fromRect=null,c.prevToRect=null,c.thisAnimationDuration=null},a),c.thisAnimationDuration=a)}),clearTimeout(n),o?n=setTimeout(function(){typeof r=="function"&&r()},s):typeof r=="function"&&r(),e=[]},animate:function(r,i,o,s){if(s){fe(r,"transition",""),fe(r,"transform","");var l=_i(this.el),a=l&&l.a,c=l&&l.d,u=(i.left-o.left)/(a||1),p=(i.top-o.top)/(c||1);r.animatingX=!!u,r.animatingY=!!p,fe(r,"transform","translate3d("+u+"px,"+p+"px,0)"),this.forRepaintDummy=Dp(r),fe(r,"transition","transform "+s+"ms"+(this.options.easing?" "+this.options.easing:"")),fe(r,"transform","translate3d(0,0,0)"),typeof r.animated=="number"&&clearTimeout(r.animated),r.animated=setTimeout(function(){fe(r,"transition",""),fe(r,"transform",""),r.animated=!1,r.animatingX=!1,r.animatingY=!1},s)}}}}function Dp(e){return e.offsetWidth}function Op(e,n,t,r){return Math.sqrt(Math.pow(n.top-e.top,2)+Math.pow(n.left-e.left,2))/Math.sqrt(Math.pow(n.top-t.top,2)+Math.pow(n.left-t.left,2))*r.animation}var pi=[],cs={initializeByDefault:!0},Po={mount:function(n){for(var t in cs)cs.hasOwnProperty(t)&&!(t in n)&&(n[t]=cs[t]);pi.forEach(function(r){if(r.pluginName===n.pluginName)throw"Sortable: Cannot mount plugin ".concat(n.pluginName," more than once")}),pi.push(n)},pluginEvent:function(n,t,r){var i=this;this.eventCanceled=!1,r.cancel=function(){i.eventCanceled=!0};var o=n+"Global";pi.forEach(function(s){t[s.pluginName]&&(t[s.pluginName][o]&&t[s.pluginName][o](kn({sortable:t},r)),t.options[s.pluginName]&&t[s.pluginName][n]&&t[s.pluginName][n](kn({sortable:t},r)))})},initializePlugins:function(n,t,r,i){pi.forEach(function(l){var a=l.pluginName;if(!(!n.options[a]&&!l.initializeByDefault)){var c=new l(n,t,n.options);c.sortable=n,c.options=n.options,n[a]=c,Sn(r,c.defaults)}});for(var o in n.options)if(n.options.hasOwnProperty(o)){var s=this.modifyOption(n,o,n.options[o]);typeof s<"u"&&(n.options[o]=s)}},getEventProperties:function(n,t){var r={};return pi.forEach(function(i){typeof i.eventProperties=="function"&&Sn(r,i.eventProperties.call(t[i.pluginName],n))}),r},modifyOption:function(n,t,r){var i;return pi.forEach(function(o){n[o.pluginName]&&o.optionListeners&&typeof o.optionListeners[t]=="function"&&(i=o.optionListeners[t].call(n[o.pluginName],r))}),i}};function Ip(e){var n=e.sortable,t=e.rootEl,r=e.name,i=e.targetEl,o=e.cloneEl,s=e.toEl,l=e.fromEl,a=e.oldIndex,c=e.newIndex,u=e.oldDraggableIndex,p=e.newDraggableIndex,m=e.originalEvent,b=e.putSortable,k=e.extraEventProperties;if(n=n||t&&t[Zt],!!n){var S,V=n.options,O="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!Wn&&!xo?S=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(S=document.createEvent("Event"),S.initEvent(r,!0,!0)),S.to=s||t,S.from=l||t,S.item=i||t,S.clone=o,S.oldIndex=a,S.newIndex=c,S.oldDraggableIndex=u,S.newDraggableIndex=p,S.originalEvent=m,S.pullMode=b?b.lastPutMode:void 0;var D=kn(kn({},k),Po.getEventProperties(r,n));for(var P in D)S[P]=D[P];t&&t.dispatchEvent(S),V[O]&&V[O].call(n,S)}}var Mp=["evt"],Ft=function(n,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.evt,o=Cp(r,Mp);Po.pluginEvent.bind(ce)(n,t,kn({dragEl:Y,parentEl:Qe,ghostEl:me,rootEl:Ge,nextEl:Ar,lastDownEl:xl,cloneEl:qe,cloneHidden:ir,dragStarted:ro,putSortable:Ct,activeSortable:ce.active,originalEvent:i,oldIndex:gi,oldDraggableIndex:uo,newIndex:qt,newDraggableIndex:er,hideGhostForTarget:Wu,unhideGhostForTarget:ju,cloneNowHidden:function(){ir=!0},cloneNowShown:function(){ir=!1},dispatchSortableEvent:function(l){Mt({sortable:t,name:l,originalEvent:i})}},o))};function Mt(e){Ip(kn({putSortable:Ct,cloneEl:qe,targetEl:Y,rootEl:Ge,oldIndex:gi,oldDraggableIndex:uo,newIndex:qt,newDraggableIndex:er},e))}var Y,Qe,me,Ge,Ar,xl,qe,ir,gi,qt,uo,er,bl,Ct,mi=!1,Fl=!1,Wl=[],xr,un,us,fs,mc,gc,ro,di,fo,ho=!1,vl=!1,Pl,Lt,hs=[],As=!1,jl=[],ts=typeof document<"u",_l=Tu,bc=xo||Wn?"cssFloat":"float",$p=ts&&!Du&&!Tu&&"draggable"in document.createElement("div"),Ru=function(){if(ts){if(Wn)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),Vu=function(n,t){var r=fe(n),i=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),o=Xi(n,0,t),s=Xi(n,1,t),l=o&&fe(o),a=s&&fe(s),c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+ct(o).width,u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+ct(s).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&l.float&&l.float!=="none"){var p=l.float==="left"?"left":"right";return s&&(a.clear==="both"||a.clear===p)?"vertical":"horizontal"}return o&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||c>=i&&r[bc]==="none"||s&&r[bc]==="none"&&c+u>i)?"vertical":"horizontal"},Hp=function(n,t,r){var i=r?n.left:n.top,o=r?n.right:n.bottom,s=r?n.width:n.height,l=r?t.left:t.top,a=r?t.right:t.bottom,c=r?t.width:t.height;return i===l||o===a||i+s/2===l+c/2},Np=function(n,t){var r;return Wl.some(function(i){var o=i[Zt].options.emptyInsertThreshold;if(!(!o||Ys(i))){var s=ct(i),l=n>=s.left-o&&n<=s.right+o,a=t>=s.top-o&&t<=s.bottom+o;if(l&&a)return r=i}}),r},Fu=function(n){function t(o,s){return function(l,a,c,u){var p=l.options.group.name&&a.options.group.name&&l.options.group.name===a.options.group.name;if(o==null&&(s||p))return!0;if(o==null||o===!1)return!1;if(s&&o==="clone")return o;if(typeof o=="function")return t(o(l,a,c,u),s)(l,a,c,u);var m=(s?l:a).options.group.name;return o===!0||typeof o=="string"&&o===m||o.join&&o.indexOf(m)>-1}}var r={},i=n.group;(!i||Ll(i)!="object")&&(i={name:i}),r.name=i.name,r.checkPull=t(i.pull,!0),r.checkPut=t(i.put),r.revertClone=i.revertClone,n.group=r},Wu=function(){!Ru&&me&&fe(me,"display","none")},ju=function(){!Ru&&me&&fe(me,"display","")};ts&&!Du&&document.addEventListener("click",function(e){if(Fl)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Fl=!1,!1},!0);var Pr=function(n){if(Y){n=n.touches?n.touches[0]:n;var t=Np(n.clientX,n.clientY);if(t){var r={};for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);r.target=r.rootEl=t,r.preventDefault=void 0,r.stopPropagation=void 0,t[Zt]._onDragOver(r)}}},Rp=function(n){Y&&Y.parentNode[Zt]._isOutsideThisEl(n.target)};function ce(e,n){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=n=Sn({},n),e[Zt]=this;var t={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Vu(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(s,l){s.setData("Text",l.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:ce.supportPointer!==!1&&"PointerEvent"in window&&!ao,emptyInsertThreshold:5};Po.initializePlugins(this,e,t);for(var r in t)!(r in n)&&(n[r]=t[r]);Fu(n);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=n.forceFallback?!1:$p,this.nativeDraggable&&(this.options.touchStartThreshold=1),n.supportPointer?De(e,"pointerdown",this._onTapStart):(De(e,"mousedown",this._onTapStart),De(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(De(e,"dragover",this),De(e,"dragenter",this)),Wl.push(this.el),n.store&&n.store.get&&this.sort(n.store.get(this)||[]),Sn(this,Tp())}ce.prototype={constructor:ce,_isOutsideThisEl:function(n){!this.el.contains(n)&&n!==this.el&&(di=null)},_getDirection:function(n,t){return typeof this.options.direction=="function"?this.options.direction.call(this,n,t,Y):this.options.direction},_onTapStart:function(n){if(n.cancelable){var t=this,r=this.el,i=this.options,o=i.preventOnFilter,s=n.type,l=n.touches&&n.touches[0]||n.pointerType&&n.pointerType==="touch"&&n,a=(l||n).target,c=n.target.shadowRoot&&(n.path&&n.path[0]||n.composedPath&&n.composedPath()[0])||a,u=i.filter;if(Yp(r),!Y&&!(/mousedown|pointerdown/.test(s)&&n.button!==0||i.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&ao&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=fn(a,i.draggable,r,!1),!(a&&a.animated)&&xl!==a)){if(gi=Wt(a),uo=Wt(a,i.draggable),typeof u=="function"){if(u.call(this,n,a,this)){Mt({sortable:t,rootEl:c,name:"filter",targetEl:a,toEl:r,fromEl:r}),Ft("filter",t,{evt:n}),o&&n.cancelable&&n.preventDefault();return}}else if(u&&(u=u.split(",").some(function(p){if(p=fn(c,p.trim(),r,!1),p)return Mt({sortable:t,rootEl:p,name:"filter",targetEl:a,fromEl:r,toEl:r}),Ft("filter",t,{evt:n}),!0}),u)){o&&n.cancelable&&n.preventDefault();return}i.handle&&!fn(c,i.handle,r,!1)||this._prepareDragStart(n,l,a)}}},_prepareDragStart:function(n,t,r){var i=this,o=i.el,s=i.options,l=o.ownerDocument,a;if(r&&!Y&&r.parentNode===o){var c=ct(r);if(Ge=o,Y=r,Qe=Y.parentNode,Ar=Y.nextSibling,xl=r,bl=s.group,ce.dragged=Y,xr={target:Y,clientX:(t||n).clientX,clientY:(t||n).clientY},mc=xr.clientX-c.left,gc=xr.clientY-c.top,this._lastX=(t||n).clientX,this._lastY=(t||n).clientY,Y.style["will-change"]="all",a=function(){if(Ft("delayEnded",i,{evt:n}),ce.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!fc&&i.nativeDraggable&&(Y.draggable=!0),i._triggerDragStart(n,t),Mt({sortable:i,name:"choose",originalEvent:n}),xt(Y,s.chosenClass,!0)},s.ignore.split(",").forEach(function(u){Iu(Y,u.trim(),ps)}),De(l,"dragover",Pr),De(l,"mousemove",Pr),De(l,"touchmove",Pr),De(l,"mouseup",i._onDrop),De(l,"touchend",i._onDrop),De(l,"touchcancel",i._onDrop),fc&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Y.draggable=!0),Ft("delayStart",this,{evt:n}),s.delay&&(!s.delayOnTouchOnly||t)&&(!this.nativeDraggable||!(xo||Wn))){if(ce.eventCanceled){this._onDrop();return}De(l,"mouseup",i._disableDelayedDrag),De(l,"touchend",i._disableDelayedDrag),De(l,"touchcancel",i._disableDelayedDrag),De(l,"mousemove",i._delayedDragTouchMoveHandler),De(l,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&De(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(a,s.delay)}else a()}},_delayedDragTouchMoveHandler:function(n){var t=n.touches?n.touches[0]:n;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Y&&ps(Y),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var n=this.el.ownerDocument;xe(n,"mouseup",this._disableDelayedDrag),xe(n,"touchend",this._disableDelayedDrag),xe(n,"touchcancel",this._disableDelayedDrag),xe(n,"mousemove",this._delayedDragTouchMoveHandler),xe(n,"touchmove",this._delayedDragTouchMoveHandler),xe(n,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(n,t){t=t||n.pointerType=="touch"&&n,!this.nativeDraggable||t?this.options.supportPointer?De(document,"pointermove",this._onTouchMove):t?De(document,"touchmove",this._onTouchMove):De(document,"mousemove",this._onTouchMove):(De(Y,"dragend",this),De(Ge,"dragstart",this._onDragStart));try{document.selection?Al(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(n,t){if(mi=!1,Ge&&Y){Ft("dragStarted",this,{evt:t}),this.nativeDraggable&&De(document,"dragover",Rp);var r=this.options;!n&&xt(Y,r.dragClass,!1),xt(Y,r.ghostClass,!0),ce.active=this,n&&this._appendGhost(),Mt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(un){this._lastX=un.clientX,this._lastY=un.clientY,Wu();for(var n=document.elementFromPoint(un.clientX,un.clientY),t=n;n&&n.shadowRoot&&(n=n.shadowRoot.elementFromPoint(un.clientX,un.clientY),n!==t);)t=n;if(Y.parentNode[Zt]._isOutsideThisEl(n),t)do{if(t[Zt]){var r=void 0;if(r=t[Zt]._onDragOver({clientX:un.clientX,clientY:un.clientY,target:n,rootEl:t}),r&&!this.options.dragoverBubble)break}n=t}while(t=t.parentNode);ju()}},_onTouchMove:function(n){if(xr){var t=this.options,r=t.fallbackTolerance,i=t.fallbackOffset,o=n.touches?n.touches[0]:n,s=me&&_i(me,!0),l=me&&s&&s.a,a=me&&s&&s.d,c=_l&&Lt&&dc(Lt),u=(o.clientX-xr.clientX+i.x)/(l||1)+(c?c[0]-hs[0]:0)/(l||1),p=(o.clientY-xr.clientY+i.y)/(a||1)+(c?c[1]-hs[1]:0)/(a||1);if(!ce.active&&!mi){if(r&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<r)return;this._onDragStart(n,!0)}if(me){s?(s.e+=u-(us||0),s.f+=p-(fs||0)):s={a:1,b:0,c:0,d:1,e:u,f:p};var m="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");fe(me,"webkitTransform",m),fe(me,"mozTransform",m),fe(me,"msTransform",m),fe(me,"transform",m),us=u,fs=p,un=o}n.cancelable&&n.preventDefault()}},_appendGhost:function(){if(!me){var n=this.options.fallbackOnBody?document.body:Ge,t=ct(Y,!0,_l,!0,n),r=this.options;if(_l){for(Lt=n;fe(Lt,"position")==="static"&&fe(Lt,"transform")==="none"&&Lt!==document;)Lt=Lt.parentNode;Lt!==document.body&&Lt!==document.documentElement?(Lt===document&&(Lt=yn()),t.top+=Lt.scrollTop,t.left+=Lt.scrollLeft):Lt=yn(),hs=dc(Lt)}me=Y.cloneNode(!0),xt(me,r.ghostClass,!1),xt(me,r.fallbackClass,!0),xt(me,r.dragClass,!0),fe(me,"transition",""),fe(me,"transform",""),fe(me,"box-sizing","border-box"),fe(me,"margin",0),fe(me,"top",t.top),fe(me,"left",t.left),fe(me,"width",t.width),fe(me,"height",t.height),fe(me,"opacity","0.8"),fe(me,"position",_l?"absolute":"fixed"),fe(me,"zIndex","100000"),fe(me,"pointerEvents","none"),ce.ghost=me,n.appendChild(me),fe(me,"transform-origin",mc/parseInt(me.style.width)*100+"% "+gc/parseInt(me.style.height)*100+"%")}},_onDragStart:function(n,t){var r=this,i=n.dataTransfer,o=r.options;if(Ft("dragStart",this,{evt:n}),ce.eventCanceled){this._onDrop();return}Ft("setupClone",this),ce.eventCanceled||(qe=Hu(Y),qe.removeAttribute("id"),qe.draggable=!1,qe.style["will-change"]="",this._hideClone(),xt(qe,this.options.chosenClass,!1),ce.clone=qe),r.cloneId=Al(function(){Ft("clone",r),!ce.eventCanceled&&(r.options.removeCloneOnHide||Ge.insertBefore(qe,Y),r._hideClone(),Mt({sortable:r,name:"clone"}))}),!t&&xt(Y,o.dragClass,!0),t?(Fl=!0,r._loopId=setInterval(r._emulateDragOver,50)):(xe(document,"mouseup",r._onDrop),xe(document,"touchend",r._onDrop),xe(document,"touchcancel",r._onDrop),i&&(i.effectAllowed="move",o.setData&&o.setData.call(r,i,Y)),De(document,"drop",r),fe(Y,"transform","translateZ(0)")),mi=!0,r._dragStartId=Al(r._dragStarted.bind(r,t,n)),De(document,"selectstart",r),ro=!0,ao&&fe(document.body,"user-select","none")},_onDragOver:function(n){var t=this.el,r=n.target,i,o,s,l=this.options,a=l.group,c=ce.active,u=bl===a,p=l.sort,m=Ct||c,b,k=this,S=!1;if(As)return;function V(oe,ue){Ft(oe,k,kn({evt:n,isOwner:u,axis:b?"vertical":"horizontal",revert:s,dragRect:i,targetRect:o,canSort:p,fromSortable:m,target:r,completed:D,onMove:function(Xe,Ve){return wl(Ge,t,Y,i,Xe,ct(Xe),n,Ve)},changed:P},ue))}function O(){V("dragOverAnimationCapture"),k.captureAnimationState(),k!==m&&m.captureAnimationState()}function D(oe){return V("dragOverCompleted",{insertion:oe}),oe&&(u?c._hideClone():c._showClone(k),k!==m&&(xt(Y,Ct?Ct.options.ghostClass:c.options.ghostClass,!1),xt(Y,l.ghostClass,!0)),Ct!==k&&k!==ce.active?Ct=k:k===ce.active&&Ct&&(Ct=null),m===k&&(k._ignoreWhileAnimating=r),k.animateAll(function(){V("dragOverAnimationComplete"),k._ignoreWhileAnimating=null}),k!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(r===Y&&!Y.animated||r===t&&!r.animated)&&(di=null),!l.dragoverBubble&&!n.rootEl&&r!==document&&(Y.parentNode[Zt]._isOutsideThisEl(n.target),!oe&&Pr(n)),!l.dragoverBubble&&n.stopPropagation&&n.stopPropagation(),S=!0}function P(){qt=Wt(Y),er=Wt(Y,l.draggable),Mt({sortable:k,name:"change",toEl:t,newIndex:qt,newDraggableIndex:er,originalEvent:n})}if(n.preventDefault!==void 0&&n.cancelable&&n.preventDefault(),r=fn(r,l.draggable,t,!0),V("dragOver"),ce.eventCanceled)return S;if(Y.contains(n.target)||r.animated&&r.animatingX&&r.animatingY||k._ignoreWhileAnimating===r)return D(!1);if(Fl=!1,c&&!l.disabled&&(u?p||(s=Qe!==Ge):Ct===this||(this.lastPutMode=bl.checkPull(this,c,Y,n))&&a.checkPut(this,c,Y,n))){if(b=this._getDirection(n,r)==="vertical",i=ct(Y),V("dragOverValid"),ce.eventCanceled)return S;if(s)return Qe=Ge,O(),this._hideClone(),V("revert"),ce.eventCanceled||(Ar?Ge.insertBefore(Y,Ar):Ge.appendChild(Y)),D(!0);var I=Ys(t,l.draggable);if(!I||jp(n,b,this)&&!I.animated){if(I===Y)return D(!1);if(I&&t===n.target&&(r=I),r&&(o=ct(r)),wl(Ge,t,Y,i,r,o,n,!!r)!==!1)return O(),I&&I.nextSibling?t.insertBefore(Y,I.nextSibling):t.appendChild(Y),Qe=t,P(),D(!0)}else if(I&&Wp(n,b,this)){var Z=Xi(t,0,l,!0);if(Z===Y)return D(!1);if(r=Z,o=ct(r),wl(Ge,t,Y,i,r,o,n,!1)!==!1)return O(),t.insertBefore(Y,Z),Qe=t,P(),D(!0)}else if(r.parentNode===t){o=ct(r);var J=0,K,j=Y.parentNode!==t,E=!Hp(Y.animated&&Y.toRect||i,r.animated&&r.toRect||o,b),B=b?"top":"left",U=pc(r,"top","top")||pc(Y,"top","top"),X=U?U.scrollTop:void 0;di!==r&&(K=o[B],ho=!1,vl=!E&&l.invertSwap||j),J=Bp(n,r,o,b,E?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,vl,di===r);var ve;if(J!==0){var ne=Wt(Y);do ne-=J,ve=Qe.children[ne];while(ve&&(fe(ve,"display")==="none"||ve===me))}if(J===0||ve===r)return D(!1);di=r,fo=J;var A=r.nextElementSibling,T=!1;T=J===1;var z=wl(Ge,t,Y,i,r,o,n,T);if(z!==!1)return(z===1||z===-1)&&(T=z===1),As=!0,setTimeout(Fp,30),O(),T&&!A?t.appendChild(Y):r.parentNode.insertBefore(Y,T?A:r),U&&$u(U,0,X-U.scrollTop),Qe=Y.parentNode,K!==void 0&&!vl&&(Pl=Math.abs(K-ct(r)[B])),P(),D(!0)}if(t.contains(Y))return D(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){xe(document,"mousemove",this._onTouchMove),xe(document,"touchmove",this._onTouchMove),xe(document,"pointermove",this._onTouchMove),xe(document,"dragover",Pr),xe(document,"mousemove",Pr),xe(document,"touchmove",Pr)},_offUpEvents:function(){var n=this.el.ownerDocument;xe(n,"mouseup",this._onDrop),xe(n,"touchend",this._onDrop),xe(n,"pointerup",this._onDrop),xe(n,"touchcancel",this._onDrop),xe(document,"selectstart",this)},_onDrop:function(n){var t=this.el,r=this.options;if(qt=Wt(Y),er=Wt(Y,r.draggable),Ft("drop",this,{evt:n}),Qe=Y&&Y.parentNode,qt=Wt(Y),er=Wt(Y,r.draggable),ce.eventCanceled){this._nulling();return}mi=!1,vl=!1,ho=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ts(this.cloneId),Ts(this._dragStartId),this.nativeDraggable&&(xe(document,"drop",this),xe(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ao&&fe(document.body,"user-select",""),fe(Y,"transform",""),n&&(ro&&(n.cancelable&&n.preventDefault(),!r.dropBubble&&n.stopPropagation()),me&&me.parentNode&&me.parentNode.removeChild(me),(Ge===Qe||Ct&&Ct.lastPutMode!=="clone")&&qe&&qe.parentNode&&qe.parentNode.removeChild(qe),Y&&(this.nativeDraggable&&xe(Y,"dragend",this),ps(Y),Y.style["will-change"]="",ro&&!mi&&xt(Y,Ct?Ct.options.ghostClass:this.options.ghostClass,!1),xt(Y,this.options.chosenClass,!1),Mt({sortable:this,name:"unchoose",toEl:Qe,newIndex:null,newDraggableIndex:null,originalEvent:n}),Ge!==Qe?(qt>=0&&(Mt({rootEl:Qe,name:"add",toEl:Qe,fromEl:Ge,originalEvent:n}),Mt({sortable:this,name:"remove",toEl:Qe,originalEvent:n}),Mt({rootEl:Qe,name:"sort",toEl:Qe,fromEl:Ge,originalEvent:n}),Mt({sortable:this,name:"sort",toEl:Qe,originalEvent:n})),Ct&&Ct.save()):qt!==gi&&qt>=0&&(Mt({sortable:this,name:"update",toEl:Qe,originalEvent:n}),Mt({sortable:this,name:"sort",toEl:Qe,originalEvent:n})),ce.active&&((qt==null||qt===-1)&&(qt=gi,er=uo),Mt({sortable:this,name:"end",toEl:Qe,originalEvent:n}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),Ge=Y=Qe=me=Ar=qe=xl=ir=xr=un=ro=qt=er=gi=uo=di=fo=Ct=bl=ce.dragged=ce.ghost=ce.clone=ce.active=null,jl.forEach(function(n){n.checked=!0}),jl.length=us=fs=0},handleEvent:function(n){switch(n.type){case"drop":case"dragend":this._onDrop(n);break;case"dragenter":case"dragover":Y&&(this._onDragOver(n),Vp(n));break;case"selectstart":n.preventDefault();break}},toArray:function(){for(var n=[],t,r=this.el.children,i=0,o=r.length,s=this.options;i<o;i++)t=r[i],fn(t,s.draggable,this.el,!1)&&n.push(t.getAttribute(s.dataIdAttr)||zp(t));return n},sort:function(n,t){var r={},i=this.el;this.toArray().forEach(function(o,s){var l=i.children[s];fn(l,this.options.draggable,i,!1)&&(r[o]=l)},this),t&&this.captureAnimationState(),n.forEach(function(o){r[o]&&(i.removeChild(r[o]),i.appendChild(r[o]))}),t&&this.animateAll()},save:function(){var n=this.options.store;n&&n.set&&n.set(this)},closest:function(n,t){return fn(n,t||this.options.draggable,this.el,!1)},option:function(n,t){var r=this.options;if(t===void 0)return r[n];var i=Po.modifyOption(this,n,t);typeof i<"u"?r[n]=i:r[n]=t,n==="group"&&Fu(r)},destroy:function(){Ft("destroy",this);var n=this.el;n[Zt]=null,xe(n,"mousedown",this._onTapStart),xe(n,"touchstart",this._onTapStart),xe(n,"pointerdown",this._onTapStart),this.nativeDraggable&&(xe(n,"dragover",this),xe(n,"dragenter",this)),Array.prototype.forEach.call(n.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Wl.splice(Wl.indexOf(this.el),1),this.el=n=null},_hideClone:function(){if(!ir){if(Ft("hideClone",this),ce.eventCanceled)return;fe(qe,"display","none"),this.options.removeCloneOnHide&&qe.parentNode&&qe.parentNode.removeChild(qe),ir=!0}},_showClone:function(n){if(n.lastPutMode!=="clone"){this._hideClone();return}if(ir){if(Ft("showClone",this),ce.eventCanceled)return;Y.parentNode==Ge&&!this.options.group.revertClone?Ge.insertBefore(qe,Y):Ar?Ge.insertBefore(qe,Ar):Ge.appendChild(qe),this.options.group.revertClone&&this.animate(Y,qe),fe(qe,"display",""),ir=!1}}};function Vp(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}function wl(e,n,t,r,i,o,s,l){var a,c=e[Zt],u=c.options.onMove,p;return window.CustomEvent&&!Wn&&!xo?a=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(a=document.createEvent("Event"),a.initEvent("move",!0,!0)),a.to=n,a.from=e,a.dragged=t,a.draggedRect=r,a.related=i||n,a.relatedRect=o||ct(n),a.willInsertAfter=l,a.originalEvent=s,e.dispatchEvent(a),u&&(p=u.call(c,a,s)),p}function ps(e){e.draggable=!1}function Fp(){As=!1}function Wp(e,n,t){var r=ct(Xi(t.el,0,t.options,!0)),i=Nu(t.el,t.options,me),o=10;return n?e.clientX<i.left-o||e.clientY<r.top&&e.clientX<r.right:e.clientY<i.top-o||e.clientY<r.bottom&&e.clientX<r.left}function jp(e,n,t){var r=ct(Ys(t.el,t.options.draggable)),i=Nu(t.el,t.options,me),o=10;return n?e.clientX>i.right+o||e.clientY>r.bottom&&e.clientX>r.left:e.clientY>i.bottom+o||e.clientX>r.right&&e.clientY>r.top}function Bp(e,n,t,r,i,o,s,l){var a=r?e.clientY:e.clientX,c=r?t.height:t.width,u=r?t.top:t.left,p=r?t.bottom:t.right,m=!1;if(!s){if(l&&Pl<c*i){if(!ho&&(fo===1?a>u+c*o/2:a<p-c*o/2)&&(ho=!0),ho)m=!0;else if(fo===1?a<u+Pl:a>p-Pl)return-fo}else if(a>u+c*(1-i)/2&&a<p-c*(1-i)/2)return Up(n)}return m=m||s,m&&(a<u+c*o/2||a>p-c*o/2)?a>u+c/2?1:-1:0}function Up(e){return Wt(Y)<Wt(e)?1:-1}function zp(e){for(var n=e.tagName+e.className+e.src+e.href+e.textContent,t=n.length,r=0;t--;)r+=n.charCodeAt(t);return r.toString(36)}function Yp(e){jl.length=0;for(var n=e.getElementsByTagName("input"),t=n.length;t--;){var r=n[t];r.checked&&jl.push(r)}}function Al(e){return setTimeout(e,0)}function Ts(e){return clearTimeout(e)}ts&&De(document,"touchmove",function(e){(ce.active||mi)&&e.cancelable&&e.preventDefault()});ce.utils={on:De,off:xe,css:fe,find:Iu,is:function(n,t){return!!fn(n,t,n,!1)},extend:Pp,throttle:Mu,closest:fn,toggleClass:xt,clone:Hu,index:Wt,nextTick:Al,cancelNextTick:Ts,detectDirection:Vu,getChild:Xi};ce.get=function(e){return e[Zt]};ce.mount=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];n[0].constructor===Array&&(n=n[0]),n.forEach(function(r){if(!r.prototype||!r.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(r));r.utils&&(ce.utils=kn(kn({},ce.utils),r.utils)),Po.mount(r)})};ce.create=function(e,n){return new ce(e,n)};ce.version=Ep;var st=[],io,Ds,Os=!1,ds,ms,Bl,oo;function Kp(){function e(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}return e.prototype={dragStarted:function(t){var r=t.originalEvent;this.sortable.nativeDraggable?De(document,"dragover",this._handleAutoScroll):this.options.supportPointer?De(document,"pointermove",this._handleFallbackAutoScroll):r.touches?De(document,"touchmove",this._handleFallbackAutoScroll):De(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var r=t.originalEvent;!this.options.dragOverBubble&&!r.rootEl&&this._handleAutoScroll(r)},drop:function(){this.sortable.nativeDraggable?xe(document,"dragover",this._handleAutoScroll):(xe(document,"pointermove",this._handleFallbackAutoScroll),xe(document,"touchmove",this._handleFallbackAutoScroll),xe(document,"mousemove",this._handleFallbackAutoScroll)),vc(),Tl(),Ap()},nulling:function(){Bl=Ds=io=Os=oo=ds=ms=null,st.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,r){var i=this,o=(t.touches?t.touches[0]:t).clientX,s=(t.touches?t.touches[0]:t).clientY,l=document.elementFromPoint(o,s);if(Bl=t,r||this.options.forceAutoScrollFallback||xo||Wn||ao){gs(t,this.options,l,r);var a=sr(l,!0);Os&&(!oo||o!==ds||s!==ms)&&(oo&&vc(),oo=setInterval(function(){var c=sr(document.elementFromPoint(o,s),!0);c!==a&&(a=c,Tl()),gs(t,i.options,c,r)},10),ds=o,ms=s)}else{if(!this.options.bubbleScroll||sr(l,!0)===yn()){Tl();return}gs(t,this.options,sr(l,!1),!1)}}},Sn(e,{pluginName:"scroll",initializeByDefault:!0})}function Tl(){st.forEach(function(e){clearInterval(e.pid)}),st=[]}function vc(){clearInterval(oo)}var gs=Mu(function(e,n,t,r){if(n.scroll){var i=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,s=n.scrollSensitivity,l=n.scrollSpeed,a=yn(),c=!1,u;Ds!==t&&(Ds=t,Tl(),io=n.scroll,u=n.scrollFn,io===!0&&(io=sr(t,!0)));var p=0,m=io;do{var b=m,k=ct(b),S=k.top,V=k.bottom,O=k.left,D=k.right,P=k.width,I=k.height,Z=void 0,J=void 0,K=b.scrollWidth,j=b.scrollHeight,E=fe(b),B=b.scrollLeft,U=b.scrollTop;b===a?(Z=P<K&&(E.overflowX==="auto"||E.overflowX==="scroll"||E.overflowX==="visible"),J=I<j&&(E.overflowY==="auto"||E.overflowY==="scroll"||E.overflowY==="visible")):(Z=P<K&&(E.overflowX==="auto"||E.overflowX==="scroll"),J=I<j&&(E.overflowY==="auto"||E.overflowY==="scroll"));var X=Z&&(Math.abs(D-i)<=s&&B+P<K)-(Math.abs(O-i)<=s&&!!B),ve=J&&(Math.abs(V-o)<=s&&U+I<j)-(Math.abs(S-o)<=s&&!!U);if(!st[p])for(var ne=0;ne<=p;ne++)st[ne]||(st[ne]={});(st[p].vx!=X||st[p].vy!=ve||st[p].el!==b)&&(st[p].el=b,st[p].vx=X,st[p].vy=ve,clearInterval(st[p].pid),(X!=0||ve!=0)&&(c=!0,st[p].pid=setInterval(function(){r&&this.layer===0&&ce.active._onTouchMove(Bl);var A=st[this.layer].vy?st[this.layer].vy*l:0,T=st[this.layer].vx?st[this.layer].vx*l:0;typeof u=="function"&&u.call(ce.dragged.parentNode[Zt],T,A,e,Bl,st[this.layer].el)!=="continue"||$u(st[this.layer].el,T,A)}.bind({layer:p}),24))),p++}while(n.bubbleScroll&&m!==a&&(m=sr(m,!1)));Os=c}},30),Bu=function(n){var t=n.originalEvent,r=n.putSortable,i=n.dragEl,o=n.activeSortable,s=n.dispatchSortableEvent,l=n.hideGhostForTarget,a=n.unhideGhostForTarget;if(t){var c=r||o;l();var u=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,p=document.elementFromPoint(u.clientX,u.clientY);a(),c&&!c.el.contains(p)&&(s("spill"),this.onSpill({dragEl:i,putSortable:r}))}};function Ks(){}Ks.prototype={startIndex:null,dragStart:function(n){var t=n.oldDraggableIndex;this.startIndex=t},onSpill:function(n){var t=n.dragEl,r=n.putSortable;this.sortable.captureAnimationState(),r&&r.captureAnimationState();var i=Xi(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(t,i):this.sortable.el.appendChild(t),this.sortable.animateAll(),r&&r.animateAll()},drop:Bu};Sn(Ks,{pluginName:"revertOnSpill"});function Gs(){}Gs.prototype={onSpill:function(n){var t=n.dragEl,r=n.putSortable,i=r||this.sortable;i.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),i.animateAll()},drop:Bu};Sn(Gs,{pluginName:"removeOnSpill"});var en;function Gp(){function e(){this.defaults={swapClass:"sortable-swap-highlight"}}return e.prototype={dragStart:function(t){var r=t.dragEl;en=r},dragOverValid:function(t){var r=t.completed,i=t.target,o=t.onMove,s=t.activeSortable,l=t.changed,a=t.cancel;if(s.options.swap){var c=this.sortable.el,u=this.options;if(i&&i!==c){var p=en;o(i)!==!1?(xt(i,u.swapClass,!0),en=i):en=null,p&&p!==en&&xt(p,u.swapClass,!1)}l(),r(!0),a()}},drop:function(t){var r=t.activeSortable,i=t.putSortable,o=t.dragEl,s=i||this.sortable,l=this.options;en&&xt(en,l.swapClass,!1),en&&(l.swap||i&&i.options.swap)&&o!==en&&(s.captureAnimationState(),s!==r&&r.captureAnimationState(),qp(o,en),s.animateAll(),s!==r&&r.animateAll())},nulling:function(){en=null}},Sn(e,{pluginName:"swap",eventProperties:function(){return{swapItem:en}}})}function qp(e,n){var t=e.parentNode,r=n.parentNode,i,o;!t||!r||t.isEqualNode(n)||r.isEqualNode(e)||(i=Wt(e),o=Wt(n),t.isEqualNode(r)&&i<o&&o++,t.insertBefore(n,t.children[i]),r.insertBefore(e,r.children[o]))}ce.mount(new Kp);ce.mount(Gs,Ks);function _c(e,n,t){const r=e.slice();return r[22]=n[t],r[23]=n,r[24]=t,r}function wc(e,n){let t,r,i=n[22].pattern+"",o,s,l,a,c,u,p,m,b,k,S,V,O,D,P;c=new we({props:{path:Pf,height:"1rem"}});function I(){return n[15](n[22])}m=new we({props:{path:Jc,height:"1rem"}});function Z(){return n[16](n[22])}function J(){n[17].call(k,n[23],n[24])}return{key:e,first:null,c(){t=g("div"),r=g("div"),o=dt(i),s=w(),l=g("div"),a=g("button"),se(c.$$.fragment),u=w(),p=g("button"),se(m.$$.fragment),b=w(),k=g("input"),S=w(),h(r,"class","break-all"),h(a,"title","Edit"),h(a,"class","hover:text-primary"),h(p,"title","Remove"),h(p,"class","hover:text-primary"),h(k,"type","checkbox"),h(k,"class","ml-1"),h(l,"class","min-w-max ml-2"),h(t,"class","border my-2 p-2 flex items-center justify-between"),h(t,"data-id",V=n[22].pattern),this.first=t},m(K,j){F(K,t,j),f(t,r),f(r,o),f(t,s),f(t,l),f(l,a),re(c,a,null),f(l,u),f(l,p),re(m,p,null),f(l,b),f(l,k),k.checked=n[22].enabled,f(t,S),O=!0,D||(P=[x(a,"click",I),x(p,"click",Z),x(k,"change",J),x(k,"change",n[6])],D=!0)},p(K,j){n=K,(!O||j&2)&&i!==(i=n[22].pattern+"")&&$t(o,i),j&2&&(k.checked=n[22].enabled),(!O||j&2&&V!==(V=n[22].pattern))&&h(t,"data-id",V)},i(K){O||($(c.$$.fragment,K),$(m.$$.fragment,K),O=!0)},o(K){W(c.$$.fragment,K),W(m.$$.fragment,K),O=!1},d(K){K&&R(t),ie(c),ie(m),D=!1,At(P)}}}function Xp(e){let n,t,r,i,o,s,l,a,c,u,p,m,b,k,S,V,O,D,P=[],I=new Map,Z,J,K;r=new we({props:{path:Sf}}),l=new we({props:{path:Zc}}),u=new we({props:{path:Mf}}),b=new we({props:{path:If}}),V=new we({props:{path:Jc}});let j=e[1];const E=B=>B[22].pattern;for(let B=0;B<j.length;B+=1){let U=_c(e,j,B),X=E(U);I.set(X,P[B]=wc(X,U))}return{c(){n=g("div"),t=g("button"),se(r.$$.fragment),o=w(),s=g("button"),se(l.$$.fragment),a=w(),c=g("button"),se(u.$$.fragment),p=w(),m=g("button"),se(b.$$.fragment),k=w(),S=g("button"),se(V.$$.fragment),O=w(),D=g("div");for(let B=0;B<P.length;B+=1)P[B].c();h(t,"title","Apply to current lines"),t.disabled=i=!e[2],q(t,"hover:text-primary",e[2]),q(t,"cursor-not-allowed",!e[2]),h(s,"title","Add replacement"),h(s,"class","ml-2 hover:text-primary"),h(c,"title","Enable all"),h(c,"class","ml-2 hover:text-primary"),h(m,"title","Disable all"),h(m,"class","ml-2 hover:text-primary"),h(S,"title","Remove all"),h(S,"class","ml-2 hover:text-primary"),h(n,"class","flex justify-end my-2"),h(D,"class","max-h-72 overflow-auto")},m(B,U){F(B,n,U),f(n,t),re(r,t,null),f(n,o),f(n,s),re(l,s,null),f(n,a),f(n,c),re(u,c,null),f(n,p),f(n,m),re(b,m,null),f(n,k),f(n,S),re(V,S,null),F(B,O,U),F(B,D,U);for(let X=0;X<P.length;X+=1)P[X].m(D,null);e[18](D),Z=!0,J||(K=[x(t,"click",e[10]),x(s,"click",e[11]),x(c,"click",e[12]),x(m,"click",e[13]),x(S,"click",e[14])],J=!0)},p(B,[U]){(!Z||U&4&&i!==(i=!B[2]))&&(t.disabled=i),(!Z||U&4)&&q(t,"hover:text-primary",B[2]),(!Z||U&4)&&q(t,"cursor-not-allowed",!B[2]),U&218&&(j=B[1],nt(),P=Yr(P,U,E,1,B,j,I,D,Hs,wc,null,_c),rt())},i(B){if(!Z){$(r.$$.fragment,B),$(l.$$.fragment,B),$(u.$$.fragment,B),$(b.$$.fragment,B),$(V.$$.fragment,B);for(let U=0;U<j.length;U+=1)$(P[U]);Z=!0}},o(B){W(r.$$.fragment,B),W(l.$$.fragment,B),W(u.$$.fragment,B),W(b.$$.fragment,B),W(V.$$.fragment,B);for(let U=0;U<P.length;U+=1)W(P[U]);Z=!1},d(B){B&&R(n),ie(r),ie(l),ie(u),ie(b),ie(V),B&&R(O),B&&R(D);for(let U=0;U<P.length;U+=1)P[U].d();e[18](null),J=!1,At(K)}}}function Zp(e,n,t){let r,i,o,s;y(e,ln,E=>t(3,i=E)),y(e,xs,E=>t(8,o=E)),y(e,at,E=>t(9,s=E));const l=zr();let a,c,u=JSON.parse(JSON.stringify(i));zl(()=>{try{ce.mount(new Gp)}catch{}return a=ce.create(c,{swap:!0,swapClass:"swap",animation:150,store:{get:k,set:m}}),()=>a==null?void 0:a.destroy()});function p(E){const B=S();t(1,u=B.map(U=>({...U,enabled:E}))),N(ln,i=u,i)}function m(){N(ln,i=S(),i)}function b(E){t(1,u=E),N(ln,i=E,i),a.sort(k(),!1)}function k(){return[...u.map(E=>E.pattern)]}function S(){const E=a.toArray();return u.slice().sort((B,U)=>E.indexOf(B.pattern)-E.indexOf(U.pattern))}const V=()=>l("applyReplacements"),O=()=>l("edit",void 0),D=()=>p(!0),P=()=>p(!1),I=()=>b([]),Z=E=>l("edit",E),J=E=>b(i.filter(B=>B.pattern!==E.pattern));function K(E,B){E[B].enabled=this.checked,t(1,u)}function j(E){mt[E?"unshift":"push"](()=>{c=E,t(0,c)})}return e.$$.update=()=>{e.$$.dirty&768&&t(2,r=!!s.length&&!!o.length)},[c,u,r,i,l,p,m,b,o,s,V,O,D,P,I,Z,J,K,j]}class Jp extends Ut{constructor(n){super(),Bt(this,n,Zp,Xp,Et,{})}}function Qp(e){let n,t,r,i,o,s,l,a;return r=new we({props:{path:Zc}}),{c(){n=g("div"),t=g("button"),se(r.$$.fragment),i=w(),o=g("div"),o.textContent="You have currently no replacements configured",h(t,"title","Add replacement"),h(t,"class","ml-2 hover:text-primary"),h(n,"class","flex justify-end my-2")},m(c,u){F(c,n,u),f(n,t),re(r,t,null),F(c,i,u),F(c,o,u),s=!0,l||(a=x(t,"click",e[7]),l=!0)},p:Oe,i(c){s||($(r.$$.fragment,c),s=!0)},o(c){W(r.$$.fragment,c),s=!1},d(c){c&&R(n),ie(r),c&&R(i),c&&R(o),l=!1,a()}}}function e1(e){let n=e[0],t,r,i=yc(e);return{c(){i.c(),t=Nn()},m(o,s){i.m(o,s),F(o,t,s),r=!0},p(o,s){s&1&&Et(n,n=o[0])?(nt(),W(i,1,1,Oe),rt(),i=yc(o),i.c(),$(i,1),i.m(t.parentNode,t)):i.p(o,s)},i(o){r||($(i),r=!0)},o(o){W(i),r=!1},d(o){o&&R(t),i.d(o)}}}function t1(e){let n,t;return n=new yp({props:{currentReplacement:e[2]}}),n.$on("close",e[4]),{c(){se(n.$$.fragment)},m(r,i){re(n,r,i),t=!0},p(r,i){const o={};i&4&&(o.currentReplacement=r[2]),n.$set(o)},i(r){t||($(n.$$.fragment,r),t=!0)},o(r){W(n.$$.fragment,r),t=!1},d(r){ie(n,r)}}}function yc(e){let n,t;return n=new Jp({}),n.$on("edit",e[5]),n.$on("applyReplacements",e[6]),{c(){se(n.$$.fragment)},m(r,i){re(n,r,i),t=!0},p:Oe,i(r){t||($(n.$$.fragment,r),t=!0)},o(r){W(n.$$.fragment,r),t=!1},d(r){ie(n,r)}}}function n1(e){let n,t,r,i,o,s,l;const a=[t1,e1,Qp],c=[];function u(p,m){return p[1]?0:p[3]?1:2}return o=u(e),s=c[o]=a[o](e),{c(){n=g("details"),t=g("summary"),t.textContent="Replacements",r=w(),i=g("div"),s.c(),h(i,"class","mb-8"),h(n,"class","col-span-4 mb-2 cursor-pointer max-w-lg")},m(p,m){F(p,n,m),f(n,t),f(n,r),f(n,i),c[o].m(i,null),l=!0},p(p,[m]){let b=o;o=u(p),o===b?c[o].p(p,m):(nt(),W(c[b],1,1,()=>{c[b]=null}),rt(),s=c[o],s?s.p(p,m):(s=c[o]=a[o](p),s.c()),$(s,1),s.m(i,null))},i(p){l||($(s),l=!0)},o(p){W(s),l=!1},d(p){p&&R(n),c[o].d()}}}function r1(e,n,t){let r,i;y(e,ln,m=>t(0,i=m));let o=!1,s;function l(m){t(1,o=!1)}const a=()=>{t(1,o=!1),t(2,s=void 0)},c=({detail:m})=>{t(2,s=m),t(1,o=!0)};function u(m){mo.call(this,e,m)}const p=()=>t(1,o=!0);return e.$$.update=()=>{e.$$.dirty&1&&t(3,r=!!i.length),e.$$.dirty&1&&l()},[i,o,s,r,a,c,u,p]}class i1 extends Ut{constructor(n){super(),Bt(this,n,r1,n1,Et,{})}}const{Map:o1,document:kc}=$s;function Sc(e,n,t){const r=e.slice();return r[156]=n[t],r}function Cc(e){let n,t,r,i,o,s,l,a,c,u,p,m,b,k,S,V,O,D,P,I,Z,J,K,j,E,B,U,X,ve,ne,A,T,z,oe,ue,_e,Xe,Ve,Ze,Ye,He,yt,gt,Ne,ze,Fe,ye,Ie,bt,he,ut,We,Re,it,vt,je,ae,Be,_t,Se,ke,kt,Tt,Ee,_,de,Dt,Pe,ot,Ce,Te,lt,hn,pn,jn,ft,zt,Ht,Ke,Le,C,H,St,et,Je=[],Jt=new o1,Ot,Nt,Qt,Yt,Gr,Bn,qr,Kt,Un,En,zn,Xr,Rt,Zr,Yn,Jr,an,Qr,Kn,ei,cn,v,Q,te,pe,ge,ht,dn,Gt,fr,ti,Ao,mn,To,ni,Do,gn,Oo,ri,Io,bn,Mo,ii,$o,vn,Ho,oi,No,Ln,Ro,li,Vo,xn,Fo,si,Wo,Pn,jo,ai,Bo,An,Uo,ci,zo,Tn,Yo,ui,Ko,Dn,Go,fi,qo,d,G,le,Me,tt,pt,It,hr,pr,qs,Xo,Xs,dr,Zs,Zo,Js,Gn,Qs,Jo,ea,qn,ta,Qo,na,mr,ra,el,ia,Xn,oa,tl,la,gr,sa,nl,aa,br,ca,rl,ua,vr,fa,il,ha,_r,pa,ol,da,wr,ma,ll,ga,yr,ba,sl,va,kr,_a,al,wa,Sr,ya,cl,ka,Zn,Sa,ul,Ca,Cr,Ea,fl,La,Er,xa,hl,Pa,Lr,Aa,Qi,Ta,Jn,On,ns,Da;p=new we({props:{path:Of}}),V=new we({props:{path:Df}}),Z=new we({props:{path:so}}),B=new we({props:{path:so}}),A=new we({props:{path:so}}),_e=new we({props:{path:ys}}),He=new we({props:{path:ys}}),he=new we({props:{class:"swap-on",path:Hf}}),We=new we({props:{class:"swap-off",path:Nf}});let zu={};Be=new Au({props:zu}),e[84](Be),Be.$on("layoutChange",e[85]),Be.$on("exportImportPreset",e[86]),Se=new i1({}),Se.$on("applyReplacements",e[87]);let pl=e[55];const Oa=M=>M[156];for(let M=0;M<pl.length;M+=1){let ee=Sc(e,pl,M),Qn=Oa(ee);Jt.set(Qn,Je[M]=Ec(Qn,ee))}let Vt=e[1]&&Lc(e);return{c(){n=g("input"),t=w(),r=g("input"),i=w(),o=g("input"),s=w(),l=g("div"),a=g("div"),c=g("div"),u=g("div"),se(p.$$.fragment),m=w(),b=g("span"),b.textContent="Set Timer",k=w(),S=g("div"),se(V.$$.fragment),O=w(),D=g("span"),D.textContent="Reset Timer",P=w(),I=g("div"),se(Z.$$.fragment),J=w(),K=g("span"),K.textContent="Reset Lines",j=w(),E=g("div"),se(B.$$.fragment),U=w(),X=g("span"),X.textContent="Reset Data",ve=w(),ne=g("div"),se(A.$$.fragment),T=w(),z=g("span"),z.textContent="Reset All",oe=w(),ue=g("div"),se(_e.$$.fragment),Xe=w(),Ve=g("span"),Ve.textContent="Ex-/Import Data",Ze=w(),Ye=g("div"),se(He.$$.fragment),yt=w(),gt=g("span"),gt.textContent="Ex-/Import Settings",Ne=w(),ze=g("div"),Fe=g("label"),ye=g("input"),bt=w(),se(he.$$.fragment),ut=w(),se(We.$$.fragment),Re=w(),it=g("span"),it.textContent="Theme",vt=w(),je=g("details"),je.innerHTML=`<summary>Links</summary>
30
30
  <ul><li class="my-0.5 hover:text-primary"><a href="https://github.com/Renji-XD/texthooker-ui" target="_blank" rel="noreferrer">texthooker-ui Repository</a></li>
31
31
  <li class="my-0.5 hover:text-primary"><a href="https://github.com/Artikash/Textractor" target="_blank" rel="noreferrer">Textractor</a></li>
@@ -32,6 +32,41 @@
32
32
  <!-- Include shared navigation -->
33
33
  {% include 'components/navigation.html' %}
34
34
 
35
+ <div class="dashboard-card date-range">
36
+ <div class="dashboard-card-header">
37
+ <h3 class="dashboard-card-title">
38
+ <span class="dashboard-card-icon">📅</span>
39
+ Date Range
40
+ </h3>
41
+ </div>
42
+
43
+ <div class="dashboard-date-range">
44
+ <div class="dashboard-date-item tooltip" data-tooltip="Select the start date for your stats">
45
+ <label for="fromDate">From</label>
46
+ <input type="date" id="fromDate" class="dashboard-date-input">
47
+ </div>
48
+ <div class="dashboard-date-item tooltip" data-tooltip="Select the end date for your stats">
49
+ <label for="toDate">To</label>
50
+ <input type="date" id="toDate" class="dashboard-date-input">
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ <div id="dateErrorPopup" class="dashboard-popup hidden">
56
+ <div class="dashboard-popup-content">
57
+ <div class="dashboard-popup-icon">⚠️</div>
58
+ <div class="dashboard-popup-message">"From" date cannot be later than "To" date.</div>
59
+ <button id="closePopupBtn" class="dashboard-popup-btn">OK</button>
60
+ </div>
61
+ </div>
62
+
63
+ <div id="noDataPopup" class="no-data-popup hidden">
64
+ <div class="no-data-content">
65
+ <p>No data found for the selected range.</p>
66
+ <button id="closeNoDataPopup">OK</button>
67
+ </div>
68
+ </div>
69
+
35
70
  <!-- Dashboard Statistics Sections -->
36
71
  <div class="dashboard-container">
37
72
  <!-- Current Game Statistics Panel -->
@@ -383,21 +418,6 @@
383
418
  </small>
384
419
  </div>
385
420
 
386
- <div style="margin-bottom: 20px;">
387
- <label for="heatmapYear"
388
- style="display: block; font-weight: 600; margin-bottom: 8px; color: var(--text-primary);">
389
- Heatmap Display Year
390
- </label>
391
- <select id="heatmapYear" name="heatmap_year"
392
- style="width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 5px; background: var(--bg-tertiary); color: var(--text-primary); font-size: 14px;">
393
- <option value="all">All Years</option>
394
- </select>
395
- <small
396
- style="color: var(--text-tertiary); font-size: 12px; margin-top: 4px; display: block;">
397
- Select which year to display in the reading activity heatmap
398
- </small>
399
- </div>
400
-
401
421
  <div style="margin-bottom: 20px;">
402
422
  <label for="streakRequirement"
403
423
  style="display: block; font-weight: 600; margin-bottom: 8px; color: var(--text-primary);">
@@ -208,12 +208,14 @@ def play_audio():
208
208
  def translate_line():
209
209
  data = request.get_json()
210
210
  event_id = data.get('id')
211
+ text = data.get('text', '').strip()
211
212
  if event_id is None:
212
213
  return jsonify({'error': 'Missing id'}), 400
213
- line_to_translate = get_line_by_id(event_id)
214
- translation = get_ai_prompt_result(get_all_lines(), line_to_translate.text,
215
- line_to_translate, get_current_game())
216
- line_to_translate.set_TL(translation)
214
+ line = get_line_by_id(event_id)
215
+ line_to_translate = text if text else line.text
216
+ translation = get_ai_prompt_result(get_all_lines(), line_to_translate,
217
+ line, get_current_game())
218
+ line.set_TL(translation)
217
219
  return jsonify({'TL': translation}), 200
218
220
 
219
221
  @app.route('/translate-multiple', methods=['POST'])
@@ -267,6 +269,15 @@ def stats():
267
269
  master_config=get_master_config(),
268
270
  stats_config=get_stats_config())
269
271
 
272
+ @app.route('/api/anki_earliest_date')
273
+ def anki_earliest_date():
274
+ """Returns the timestamp of earliest available card in anki collection."""
275
+ from GameSentenceMiner.anki import get_anki_earliest_date
276
+ earliest_card = get_anki_earliest_date()
277
+ return jsonify({
278
+ "earliest_card": earliest_card
279
+ })
280
+
270
281
  @app.route('/api/anki_stats')
271
282
  def api_anki_stats():
272
283
  """
@@ -283,14 +294,26 @@ def api_anki_stats():
283
294
  from GameSentenceMiner.web.stats import calculate_kanji_frequency, is_kanji
284
295
  from GameSentenceMiner.util.db import GameLinesTable
285
296
 
286
- # Get all GSM lines and calculate kanji frequency
287
- all_lines = GameLinesTable.all()
297
+ start_timestamp = int(request.args.get('start_timestamp')) if request.args.get('start_timestamp') else None
298
+ end_timestamp = int(request.args.get('end_timestamp')) if request.args.get('end_timestamp') else None
299
+
300
+ # Get GSM lines and calculate kanji frequency
301
+ try:
302
+ all_lines = (
303
+ GameLinesTable.get_lines_filtered_by_timestamp(start_timestamp / 1000, end_timestamp / 1000)
304
+ if start_timestamp is not None and end_timestamp is not None
305
+ else GameLinesTable.all()
306
+ )
307
+ except Exception as e:
308
+ logger.warning(f"Failed to filter lines by timestamp: {e}, fetching all lines instead")
309
+ all_lines = GameLinesTable.all()
310
+
288
311
  gsm_kanji_stats = calculate_kanji_frequency(all_lines)
289
312
  gsm_kanji_list = gsm_kanji_stats.get("kanji_data", [])
290
313
  gsm_kanji_set = set([k["kanji"] for k in gsm_kanji_list])
291
314
 
292
315
  # Get all kanji in Anki (first field only)
293
- anki_kanji_set = get_all_anki_first_field_kanji()
316
+ anki_kanji_set = get_all_anki_first_field_kanji(start_timestamp, end_timestamp)
294
317
 
295
318
  # Find missing kanji (in GSM but not in Anki)
296
319
  missing_kanji = [
@@ -362,7 +385,7 @@ def start_web_server():
362
385
  # FOR TEXTHOOKER DEVELOPMENT, UNCOMMENT THE FOLLOWING LINE WITH Flask-CORS INSTALLED:
363
386
  # from flask_cors import CORS
364
387
  # CORS(app, resources={r"/*": {"origins": "http://localhost:5174"}})
365
- app.run(host='0.0.0.0', port=port, debug=False)
388
+ app.run(host=get_config().advanced.localhost_bind_address, port=port, debug=False)
366
389
 
367
390
 
368
391
  async def texthooker_page_coro():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.17.0
3
+ Version: 2.17.2
4
4
  Summary: A tool for mining sentences from games. Update: Overlay?
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -1,10 +1,10 @@
1
1
  GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- GameSentenceMiner/anki.py,sha256=4XHTmdlPHa7IgCYqfrnZiRzM3yRbXL9hKwNfcMOzB1c,26537
3
- GameSentenceMiner/config_gui.py,sha256=kyAK3s1tkYmjO_zdJDYWR0rubAsS0vHiT46HdMTxJGk,146121
4
- GameSentenceMiner/gametext.py,sha256=Qk4g1OnGKW3isZEmn5DTJfbnhIDDyrW10M9oblR303Q,10431
5
- GameSentenceMiner/gsm.py,sha256=1eq5nkYulfm85749g8g2s_WkqqiQWDopUXyimJLIy6M,33814
6
- GameSentenceMiner/obs.py,sha256=VY7bNIcOGTWLNaxlDDgXBCnaIlyMu5Nz1UJnCtKKD74,28825
7
- GameSentenceMiner/vad.py,sha256=klkxPA1pNbziZWG1MGjWVRRmOIt9UwlcB8ZV-lSnHsQ,19736
2
+ GameSentenceMiner/anki.py,sha256=o1mq9y-PZh4Sjo1qWfdONZEc7_7PJlx_nymaxqtgVSk,27433
3
+ GameSentenceMiner/config_gui.py,sha256=Ko5vjzpnbDPMevoLrLFoucL-uh-LyUGTO6W5VOvh-Hg,148170
4
+ GameSentenceMiner/gametext.py,sha256=fQYVsXO9VirzKwca_ktek0oTnerhStIDVsxHiyG3_AM,10533
5
+ GameSentenceMiner/gsm.py,sha256=JZUj8PkwHW6RPzJ-rvpOYMY7F-TO7EsHRWSzlZqPE8w,34069
6
+ GameSentenceMiner/obs.py,sha256=Xa4-SFm2Ftlnk6KX_XaDWjhSEPW_7rSDRe9WDNW8JLY,29377
7
+ GameSentenceMiner/vad.py,sha256=cujto_lzAuljldBBnve4JuK54tInWVGSp7NGg-xkaCY,19830
8
8
  GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  GameSentenceMiner/ai/ai_prompting.py,sha256=41xdBzE88Jlt12A0D-T_cMfLO5j6MSxfniOptpwNZm0,24068
10
10
  GameSentenceMiner/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -22,14 +22,14 @@ GameSentenceMiner/ocr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
22
22
  GameSentenceMiner/ocr/gsm_ocr_config.py,sha256=Ov04c-nKzh3sADxO-5JyZWVe4DlrHM9edM9tc7-97Jo,5970
23
23
  GameSentenceMiner/ocr/ocrconfig.py,sha256=_tY8mjnzHMJrLS8E5pHqYXZjMuLoGKYgJwdhYgN-ny4,6466
24
24
  GameSentenceMiner/ocr/owocr_area_selector.py,sha256=4MjItlaZ78Smxa3uxMxbjU0n2z_IBTG-iBpDB9COSL8,29270
25
- GameSentenceMiner/ocr/owocr_helper.py,sha256=wsI9HaDFcP9is71wf0YoLjf-FjgQ2Dps-e1e-l-HDl0,31722
25
+ GameSentenceMiner/ocr/owocr_helper.py,sha256=kuwEiOOyOMHDdsDboyDqB_MI8WL9bsN9XubACfgw1KQ,32036
26
26
  GameSentenceMiner/ocr/ss_picker.py,sha256=0IhxUdaKruFpZyBL-8SpxWg7bPrlGpy3lhTcMMZ5rwo,5224
27
27
  GameSentenceMiner/owocr/owocr/__init__.py,sha256=87hfN5u_PbL_onLfMACbc0F5j4KyIK9lKnRCj6oZgR0,49
28
28
  GameSentenceMiner/owocr/owocr/__main__.py,sha256=XQaqZY99EKoCpU-gWQjNbTs7Kg17HvBVE7JY8LqIE0o,157
29
29
  GameSentenceMiner/owocr/owocr/config.py,sha256=qM7kISHdUhuygGXOxmgU6Ef2nwBShrZtdqu4InDCViE,8103
30
30
  GameSentenceMiner/owocr/owocr/lens_betterproto.py,sha256=oNoISsPilVVRBBPVDtb4-roJtAhp8ZAuFTci3TGXtMc,39141
31
31
  GameSentenceMiner/owocr/owocr/ocr.py,sha256=vRTMKLzi6GDBFZWCyf0tYi6es3cP1cvQOBjZqaZmnBg,70482
32
- GameSentenceMiner/owocr/owocr/run.py,sha256=9Z_gIMCZkP5AGY6Lqz3QamSc6YOa5PeweXz9f4o8Msg,81222
32
+ GameSentenceMiner/owocr/owocr/run.py,sha256=bIXC_7PltyVvlA8beCVqdLcKVai8LvVHBRqEueq2GkQ,81545
33
33
  GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=Na6XStbQBtpQUSdbN3QhEswtKuU1JjReFk_K8t5ezQE,3395
34
34
  GameSentenceMiner/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  GameSentenceMiner/tools/audio_offset_selector.py,sha256=8Stk3BP-XVIuzRv9nl9Eqd2D-1yD3JrgU-CamBywJmY,8542
@@ -37,12 +37,12 @@ GameSentenceMiner/tools/furigana_filter_preview.py,sha256=BXv7FChPEJW_VeG5XYt6su
37
37
  GameSentenceMiner/tools/ss_selector.py,sha256=cbjMxiKOCuOfbRvLR_PCRlykBrGtm1LXd6u5czPqkmc,4793
38
38
  GameSentenceMiner/tools/window_transparency.py,sha256=GtbxbmZg0-UYPXhfHff-7IKZyY2DKe4B9GdyovfmpeM,8166
39
39
  GameSentenceMiner/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
- GameSentenceMiner/util/configuration.py,sha256=qATOwZahVQNP8-ZnWiAKuR7UJLW25QNDmFKYNBYzkmE,42443
41
- GameSentenceMiner/util/db.py,sha256=B2Qwg7i0Qn_yxov-NhcT9QdFkF218Cqea_V7ZPzYBzM,21365
40
+ GameSentenceMiner/util/configuration.py,sha256=B-vXvOt5OfdJZ6WbAPLbvXfT4hMAjqd3pT3gGSxenKg,42623
41
+ GameSentenceMiner/util/db.py,sha256=nUVKUBk0wtRocxVXhiFRXfaiVD77DGCsMp4uj1Rrvd8,28088
42
42
  GameSentenceMiner/util/electron_config.py,sha256=KfeJToeFFVw0IR5MKa-gBzpzaGrU-lyJbR9z-sDEHYU,8767
43
- GameSentenceMiner/util/ffmpeg.py,sha256=g3v1aJnv3qWekDnO0FdYozB-MG9di4WUvPA3NyXY9Ws,28998
44
- GameSentenceMiner/util/get_overlay_coords.py,sha256=lUD2YU4iVoXRHvQzkCN0Re3IQkYKemU2NV81MtQ94Uk,22028
45
- GameSentenceMiner/util/gsm_utils.py,sha256=Piwv88Q9av2LBeN7M6QDi0Mp0_R2lNbkcI6ekK5hd2o,11851
43
+ GameSentenceMiner/util/ffmpeg.py,sha256=Wf7I4Ko0rykvm5fAuhedP1Gu5550mMHm_qtlK3arJTM,29080
44
+ GameSentenceMiner/util/get_overlay_coords.py,sha256=RE0aZHTPORe2TI2vJI1GkqEmgP-ljudMz4PYkeslFcw,22150
45
+ GameSentenceMiner/util/gsm_utils.py,sha256=OUCBmYwEFSmAb0E0s9mtcE2VSyCWbbjG-5bLk6p1ngw,9340
46
46
  GameSentenceMiner/util/model.py,sha256=R-_RYTYLSDNgBoVTPuPBcIHeOznIqi_vBzQ7VQ20WYk,6727
47
47
  GameSentenceMiner/util/notification.py,sha256=YBhf_mSo_i3cjBz-pmeTPx3wchKiG9BK2VBdZSa2prQ,4597
48
48
  GameSentenceMiner/util/text_log.py,sha256=eqLchRrRsWeuex13f5IoxENLWMhjfZtJgUnh9N5jnJQ,6782
@@ -51,17 +51,17 @@ GameSentenceMiner/util/communication/send.py,sha256=Wki9qIY2CgYnuHbmnyKVIYkcKAN_
51
51
  GameSentenceMiner/util/communication/websocket.py,sha256=Zpnqsy8RUeYxMFNGVUaPrWrlbAHjuNxCsn908iWL_kU,3344
52
52
  GameSentenceMiner/util/downloader/Untitled_json.py,sha256=RUUl2bbbCpUDUUS0fP0tdvf5FngZ7ILdA_J5TFYAXUQ,15272
53
53
  GameSentenceMiner/util/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- GameSentenceMiner/util/downloader/download_tools.py,sha256=po2tdglVz6lw0UoWAmKpCgTw-5LfWA7XJTP_u9WtxLA,10068
54
+ GameSentenceMiner/util/downloader/download_tools.py,sha256=axKhUplGx3ATZv83n-EajSK8iCXm41AprbixQt6yJKA,11522
55
55
  GameSentenceMiner/util/downloader/oneocr_dl.py,sha256=l3s9Z-x1b57GX048o5h-MVv0UTZo4H-Q-zb-JREkMLI,10439
56
56
  GameSentenceMiner/util/win10toast/__init__.py,sha256=6TL2w6rzNmpJEp6_v2cAJP_7ExA3UsKzwdM08pNcVfE,5341
57
57
  GameSentenceMiner/util/win10toast/__main__.py,sha256=5MYnBcFj8y_6Dyc1kiPd0_FsUuh4yl1cv5wsleU6V4w,668
58
58
  GameSentenceMiner/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
- GameSentenceMiner/web/database_api.py,sha256=Wz0haPJjCfrMDmN5OSl4fTeLjeAk49PER2PBgElf7Dg,52105
59
+ GameSentenceMiner/web/database_api.py,sha256=bFtU427dQEVqtp4y7nqQzhmuaL0FHS3drWc3KIlRJr8,52643
60
60
  GameSentenceMiner/web/events.py,sha256=6Vyz5c9MdpMIa7Zqljqhap2XFQnAVYJ0CdQV64TSZsA,5119
61
- GameSentenceMiner/web/gsm_websocket.py,sha256=IwwQo6VtgPqeOuc-datgfJyLpX3LwB2MISDqA6EkiSA,4131
61
+ GameSentenceMiner/web/gsm_websocket.py,sha256=B0VKpxmsRu0WRh5nFWlpDPBQ6-K2ed7TEIa0O6YWeoo,4166
62
62
  GameSentenceMiner/web/service.py,sha256=YZchmScTn7AX_GkwV1ULEK6qjdOnJcpc3qfMwDf7cUE,5363
63
63
  GameSentenceMiner/web/stats.py,sha256=h4tRA_00OdQ9uVYrQuAE5SmeSGHMLfTUHPOy6re_h5s,22366
64
- GameSentenceMiner/web/texthooking_page.py,sha256=zQx9c8AQ4pWN8JgxvW0MKWkvtoIyrhXBlGdT-acBupU,13484
64
+ GameSentenceMiner/web/texthooking_page.py,sha256=IgHsm7l-5pPaYBD8moJnFxRpcvPo_AHNYRi77cPhyRM,14515
65
65
  GameSentenceMiner/web/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
66
  GameSentenceMiner/web/static/apple-touch-icon.png,sha256=OcMI8af_68DA_tweOsQ5LytTyMwm7-hPW07IfrOVgEs,46132
67
67
  GameSentenceMiner/web/static/favicon-96x96.png,sha256=lOePzjiKl1JY2J1kT_PMdyEnrlJmi5GWbmXJunM12B4,16502
@@ -73,26 +73,26 @@ GameSentenceMiner/web/static/web-app-manifest-192x192.png,sha256=EfSNnBmsSaLfESb
73
73
  GameSentenceMiner/web/static/web-app-manifest-512x512.png,sha256=wyqgCWCrLEUxSRXmaA3iJEESd-vM-ZmlTtZFBY4V8Pk,230819
74
74
  GameSentenceMiner/web/static/css/kanji-grid.css,sha256=FjgoZW77Uy8mTM6lHGO85tjzoNhkAS6cdXzLDcLLMh8,2449
75
75
  GameSentenceMiner/web/static/css/search.css,sha256=x06xsErfThUpE1NAG4CA2sCPSZ-ofNWEI_ekV2Ok5hY,253
76
- GameSentenceMiner/web/static/css/shared.css,sha256=66kQvgoyBhw3AFNUpGhTJDRvb7T3b7hO63lMealCqnk,17198
77
- GameSentenceMiner/web/static/css/stats.css,sha256=Ybjm_XzEqo0A0tnQtdPvGgdfz9o8Gy2ghJSKzQ2a0TQ,14418
78
- GameSentenceMiner/web/static/js/anki_stats.js,sha256=wZfr9vXGF--OTXOszjB3XX1pI2RrMBxGHoGwGvJ20xg,3171
76
+ GameSentenceMiner/web/static/css/shared.css,sha256=NjnWdZwlmMn-OoN_4q7CG2rwcS4zRuP9rwnYQogo5Wc,17835
77
+ GameSentenceMiner/web/static/css/stats.css,sha256=4-rKsi6DuCxd4EoBxKRxZVXAmqkdkuXBQe7oswXAC7w,24284
78
+ GameSentenceMiner/web/static/js/anki_stats.js,sha256=1NWGAD2qJnfQpPWzENZdRjxz3xO2iN8ApegsDz9Mb9w,6843
79
79
  GameSentenceMiner/web/static/js/database.js,sha256=-SjMmhXzU8a3QNGrwGtJCu55ZXXfkBxlYSkySEBdclU,22097
80
80
  GameSentenceMiner/web/static/js/kanji-grid.js,sha256=rUa8_TGFm4Z8CtURoAlZjCN032PLe0YmHvN52S4_sE0,7181
81
81
  GameSentenceMiner/web/static/js/search.js,sha256=QrjsVXf90c1LzD09TPaK93RbIN9yEiXF8IKAKrDY4hw,10482
82
- GameSentenceMiner/web/static/js/shared.js,sha256=gFGDMDsuwH3j8bobJhVUtu5ddejzqeyEsCZWwIlcjzU,21010
83
- GameSentenceMiner/web/static/js/stats.js,sha256=uAh_J0JngC1QjB_Y9YxRKfWrxfPsdyy6Ypk5WFerZKU,86149
84
- GameSentenceMiner/web/templates/anki_stats.html,sha256=FdIMl-kY0-3as9Wn0i-wKIIkl1xXn4nWMbWPypN_1T0,10955
82
+ GameSentenceMiner/web/static/js/shared.js,sha256=LM4NN3YhAMqyyFAcgwKyKs3cLm5beL9VidGK-k5uFnU,19134
83
+ GameSentenceMiner/web/static/js/stats.js,sha256=3mSUn77PwaxqB7CXAlkUYKUHSkdUTQG0gw7YfEmjvN0,95373
84
+ GameSentenceMiner/web/templates/anki_stats.html,sha256=FMRtl0voshXhAUCxCZaM4PQJEGgbwvK7KV-UMCDGLII,12388
85
85
  GameSentenceMiner/web/templates/database.html,sha256=Gd54rgZmfcV7ufoJ69COeMncs5Q5u-rSJcsIvROVCEo,13732
86
- GameSentenceMiner/web/templates/index.html,sha256=7ChQ1j602MOiYU95wXAKP_Ezsh_JgdlGz2uXIzS2j0g,227894
86
+ GameSentenceMiner/web/templates/index.html,sha256=3vWLV0sz8dGwce6CYNXzsUcQzO2bVqn7rrar32EqfZk,227906
87
87
  GameSentenceMiner/web/templates/search.html,sha256=nao3M_hAbm5ftzThi91NtQ3ZiINMPUNx4ngFmqLnLQ4,4060
88
- GameSentenceMiner/web/templates/stats.html,sha256=G3S2YBZ2sQ-D4wTQQBe8411cVTE9QPQq-wr4kyDPi_w,32508
88
+ GameSentenceMiner/web/templates/stats.html,sha256=i6kVMx6Up2Ilc0nf-Uh70GbloUcYRqxOYrA7XwLZxd4,33035
89
89
  GameSentenceMiner/web/templates/utility.html,sha256=KtqnZUMAYs5XsEdC9Tlsd40NKAVic0mu6sh-ReMDJpU,16940
90
90
  GameSentenceMiner/web/templates/components/navigation.html,sha256=6y9PvM3nh8LY6JWrZb6zVOm0vqkBLDc6d3gB9X5lT_w,1055
91
91
  GameSentenceMiner/web/templates/components/theme-styles.html,sha256=hiq3zdJljpRjQO1iUA7gfFKwXebltG-IWW-gnKS4GHA,3439
92
92
  GameSentenceMiner/wip/__init___.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
- gamesentenceminer-2.17.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
94
- gamesentenceminer-2.17.0.dist-info/METADATA,sha256=Ey5ePBW7u-KCsH3gK40CVD-vNy51KYEOZCQkzPc9Jh4,7348
95
- gamesentenceminer-2.17.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
96
- gamesentenceminer-2.17.0.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
97
- gamesentenceminer-2.17.0.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
98
- gamesentenceminer-2.17.0.dist-info/RECORD,,
93
+ gamesentenceminer-2.17.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
94
+ gamesentenceminer-2.17.2.dist-info/METADATA,sha256=hK_CR5Cp3-IudCznpqCNwnOQH73s5HXZt4tMFNAzfg8,7348
95
+ gamesentenceminer-2.17.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
96
+ gamesentenceminer-2.17.2.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
97
+ gamesentenceminer-2.17.2.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
98
+ gamesentenceminer-2.17.2.dist-info/RECORD,,