thursday-agent 0.28.0 → 0.29.0

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.
Files changed (176) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/app/_global-error.html +1 -1
  5. package/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  9. package/.next/server/app/_not-found.html +1 -1
  10. package/.next/server/app/_not-found.rsc +1 -1
  11. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  13. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  15. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  16. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  17. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  18. package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -1
  19. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  20. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  21. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  22. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  23. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  24. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  25. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  26. package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
  27. package/.next/server/app/api/thursday/call/plan/route.js.nft.json +1 -1
  28. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  29. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  30. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  31. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  32. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +11 -11
  33. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  34. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  35. package/.next/server/app/page/server-reference-manifest.json +68 -68
  36. package/.next/server/app/page.js.nft.json +1 -1
  37. package/.next/server/app/page_client-reference-manifest.js +1 -1
  38. package/.next/server/chunks/_0tkzlv1._.js +11 -9
  39. package/.next/server/chunks/_1_0gehg._.js +11 -9
  40. package/.next/server/chunks/features_14kex_m._.js +3 -1
  41. package/.next/server/chunks/features_1xn6un-._.js +3 -1
  42. package/.next/server/chunks/ssr/{[root-of-the-server]__1ngprpi._.js → [root-of-the-server]__07mxab7._.js} +2 -2
  43. package/.next/server/chunks/ssr/[root-of-the-server]__0auk-ke._.js +13 -8
  44. package/.next/server/chunks/ssr/{[root-of-the-server]__11_ws3y._.js → [root-of-the-server]__0bgf9r2._.js} +2 -2
  45. package/.next/server/chunks/ssr/{[root-of-the-server]__1j2x83w._.js → [root-of-the-server]__0nfq6eh._.js} +2 -2
  46. package/.next/server/chunks/ssr/[root-of-the-server]__0utwbb5._.js +1 -1
  47. package/.next/server/chunks/ssr/{[root-of-the-server]__13xx3dr._.js → [root-of-the-server]__18l3o37._.js} +2 -2
  48. package/.next/server/chunks/ssr/{[root-of-the-server]__1qiq402._.js → [root-of-the-server]__1njrrpi._.js} +2 -2
  49. package/.next/server/chunks/ssr/[root-of-the-server]__1t38-p_._.js +1 -1
  50. package/.next/server/chunks/ssr/{[root-of-the-server]__02-kwsg._.js → [root-of-the-server]__1vgf-i-._.js} +2 -2
  51. package/.next/server/chunks/ssr/{_15zznka._.js → _01l1svp._.js} +2 -2
  52. package/.next/server/chunks/ssr/{_1e1qe7w._.js → _01m2s2p._.js} +2 -2
  53. package/.next/server/chunks/ssr/{_0a31ywo._.js → _06o_p34._.js} +2 -2
  54. package/.next/server/chunks/ssr/{_1nnl9sj._.js → _0ps83ki._.js} +2 -2
  55. package/.next/server/chunks/ssr/{_1tc_gbg._.js → _0tfponz._.js} +2 -2
  56. package/.next/server/chunks/ssr/{_0ldpw1q._.js → _0x9aecq._.js} +2 -2
  57. package/.next/server/chunks/ssr/_128r03g._.js +3 -1
  58. package/.next/server/chunks/ssr/{_0nans9v._.js → _16qphtt._.js} +2 -2
  59. package/.next/server/chunks/ssr/_17fa2ns._.js +5 -5
  60. package/.next/server/chunks/ssr/_1_px1o-._.js +1 -1
  61. package/.next/server/chunks/ssr/_1e_9qjr._.js +1 -1
  62. package/.next/server/chunks/ssr/{_19g10gj._.js → _1k5f6cg._.js} +2 -2
  63. package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
  64. package/.next/server/chunks/ssr/_1rlfzdj._.js +6 -0
  65. package/.next/server/chunks/ssr/_1soynbw._.js +2 -2
  66. package/.next/server/chunks/ssr/{_1qtcl42._.js → _1tu2bpk._.js} +2 -2
  67. package/.next/server/chunks/ssr/{components_ui_markdown-body_tsx_13aa4_2._.js → components_ui_markdown-body_tsx_1ac61z0._.js} +2 -2
  68. package/.next/server/chunks/ssr/features_0rrgq_t._.js +1 -1
  69. package/.next/server/chunks/ssr/features_ai_components_model-picker_tsx_0ucb1y9._.js +1 -1
  70. package/.next/server/chunks/ssr/features_bot_components_01ye2wp._.js +1 -1
  71. package/.next/server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js +1 -1
  72. package/.next/server/chunks/ssr/features_bot_components_thread-setting_tsx_0yae7zy._.js +1 -1
  73. package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +1 -1
  74. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  75. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  76. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  77. package/.next/server/chunks/ssr/features_skills_components_skills-setting_tsx_1wtuuip._.js +1 -1
  78. package/.next/server/chunks/ssr/features_thursday_components_thursday-setting_tsx_1_6ydrc._.js +1 -1
  79. package/.next/server/chunks/ssr/{node_modules_107hxun._.js → node_modules_0-8ygub._.js} +1 -1
  80. package/.next/server/chunks/ssr/{node_modules_1v-un0n._.js → node_modules_012orll._.js} +1 -1
  81. package/.next/server/chunks/ssr/{node_modules_1uyu3cc._.js → node_modules_02fw1bp._.js} +1 -1
  82. package/.next/server/chunks/ssr/{node_modules_0wa05ay._.js → node_modules_02t-i_c._.js} +2 -2
  83. package/.next/server/chunks/ssr/{node_modules_069gsbk._.js → node_modules_03ntdqv._.js} +1 -1
  84. package/.next/server/chunks/ssr/{node_modules_150qjpq._.js → node_modules_04e__3n._.js} +2 -2
  85. package/.next/server/chunks/ssr/{node_modules_0kdc_b7._.js → node_modules_0507yvc._.js} +1 -1
  86. package/.next/server/chunks/ssr/{node_modules_1xtd9ml._.js → node_modules_06oedzb._.js} +1 -1
  87. package/.next/server/chunks/ssr/{node_modules_05fihwh._.js → node_modules_0b8revr._.js} +1 -1
  88. package/.next/server/chunks/ssr/{node_modules_0jrjbfv._.js → node_modules_0dfjba7._.js} +1 -1
  89. package/.next/server/chunks/ssr/{node_modules_0walxvo._.js → node_modules_0i3xlf-._.js} +2 -2
  90. package/.next/server/chunks/ssr/{node_modules_0ou72wu._.js → node_modules_0k-r85l._.js} +2 -2
  91. package/.next/server/chunks/ssr/{node_modules_19gok-9._.js → node_modules_0kdzuew._.js} +2 -2
  92. package/.next/server/chunks/ssr/{node_modules_1-vdt7b._.js → node_modules_0mbx677._.js} +1 -1
  93. package/.next/server/chunks/ssr/{node_modules_1vh6nr-._.js → node_modules_0o5tzyn._.js} +1 -1
  94. package/.next/server/chunks/ssr/{node_modules_0z8o0-n._.js → node_modules_0pv4uha._.js} +1 -1
  95. package/.next/server/chunks/ssr/{node_modules_17-v4n4._.js → node_modules_0qrh5xo._.js} +1 -1
  96. package/.next/server/chunks/ssr/{node_modules_0jqaiyb._.js → node_modules_0t4ep0l._.js} +1 -1
  97. package/.next/server/chunks/ssr/{node_modules_0ia9-w8._.js → node_modules_0tx0umb._.js} +2 -2
  98. package/.next/server/chunks/ssr/{node_modules_19acw__._.js → node_modules_0ukjqyk._.js} +1 -1
  99. package/.next/server/chunks/ssr/{node_modules_050v667._.js → node_modules_0w-dsl0._.js} +2 -2
  100. package/.next/server/chunks/ssr/{node_modules_0gb732y._.js → node_modules_0x_do0y._.js} +2 -2
  101. package/.next/server/chunks/ssr/{node_modules_0q8xm6u._.js → node_modules_0x_r46g._.js} +2 -2
  102. package/.next/server/chunks/ssr/{node_modules_152bm83._.js → node_modules_0zw6cf-._.js} +1 -1
  103. package/.next/server/chunks/ssr/{node_modules_1misalx._.js → node_modules_122hfb2._.js} +1 -1
  104. package/.next/server/chunks/ssr/{node_modules_2045nus._.js → node_modules_13rr6rm._.js} +2 -2
  105. package/.next/server/chunks/ssr/{node_modules_0skzy7i._.js → node_modules_152kfg-._.js} +1 -1
  106. package/.next/server/chunks/ssr/{node_modules_0wsygp2._.js → node_modules_15f2sid._.js} +1 -1
  107. package/.next/server/chunks/ssr/{node_modules_06b7g0r._.js → node_modules_162v3_m._.js} +1 -1
  108. package/.next/server/chunks/ssr/{node_modules_1pt7o47._.js → node_modules_16wbh_d._.js} +2 -2
  109. package/.next/server/chunks/ssr/{node_modules_1x7napn._.js → node_modules_1838s3x._.js} +2 -2
  110. package/.next/server/chunks/ssr/{node_modules_0zi89fj._.js → node_modules_1_rbg_o._.js} +1 -1
  111. package/.next/server/chunks/ssr/{node_modules_1jt8w7f._.js → node_modules_1awgatr._.js} +1 -1
  112. package/.next/server/chunks/ssr/{node_modules_1n5ds4a._.js → node_modules_1g9_m7_._.js} +1 -1
  113. package/.next/server/chunks/ssr/{node_modules_1fa_3_c._.js → node_modules_1hgqn53._.js} +2 -2
  114. package/.next/server/chunks/ssr/{node_modules_1si826e._.js → node_modules_1j59ehc._.js} +1 -1
  115. package/.next/server/chunks/ssr/{node_modules_0y_dhgi._.js → node_modules_1jvg854._.js} +1 -1
  116. package/.next/server/chunks/ssr/{node_modules_140qn14._.js → node_modules_1k9u0x_._.js} +2 -2
  117. package/.next/server/chunks/ssr/{node_modules_06p_ayw._.js → node_modules_1kqsyd_._.js} +1 -1
  118. package/.next/server/chunks/ssr/{node_modules_1jrlct1._.js → node_modules_1kv5-zo._.js} +1 -1
  119. package/.next/server/chunks/ssr/{node_modules_1b45v66._.js → node_modules_1lwcjnq._.js} +1 -1
  120. package/.next/server/chunks/ssr/{node_modules_13ccsqp._.js → node_modules_1mxdor4._.js} +1 -1
  121. package/.next/server/chunks/ssr/{node_modules_04qcy8e._.js → node_modules_1o_q011._.js} +2 -2
  122. package/.next/server/chunks/ssr/{node_modules_0ljjw5o._.js → node_modules_1p5__vf._.js} +1 -1
  123. package/.next/server/chunks/ssr/{node_modules_0jaxs1q._.js → node_modules_1p_tdep._.js} +1 -1
  124. package/.next/server/chunks/ssr/{node_modules_0xetrwd._.js → node_modules_1qyanf-._.js} +2 -2
  125. package/.next/server/chunks/ssr/{node_modules_1861d28._.js → node_modules_1rrbt-g._.js} +1 -1
  126. package/.next/server/chunks/ssr/{node_modules_1k0ygyl._.js → node_modules_1rtx020._.js} +1 -1
  127. package/.next/server/chunks/ssr/{node_modules_12409ud._.js → node_modules_1rxd-pq._.js} +1 -1
  128. package/.next/server/chunks/ssr/{node_modules_0_uhcxd._.js → node_modules_1sum8sx._.js} +1 -1
  129. package/.next/server/chunks/ssr/{node_modules_18uwehg._.js → node_modules_1tqxzmp._.js} +1 -1
  130. package/.next/server/chunks/ssr/{node_modules_0ob-uxg._.js → node_modules_1u5xb0j._.js} +1 -1
  131. package/.next/server/chunks/ssr/{node_modules_0-zy1_5._.js → node_modules_1umqska._.js} +1 -1
  132. package/.next/server/chunks/ssr/{node_modules_20llbw8._.js → node_modules_1v065ct._.js} +1 -1
  133. package/.next/server/chunks/ssr/{node_modules_1o1ud40._.js → node_modules_1w2-as3._.js} +1 -1
  134. package/.next/server/chunks/ssr/{node_modules_0v0l095._.js → node_modules_1ywecve._.js} +1 -1
  135. package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0-moq-r._.js → node_modules_katex_dist_katex_mjs_1l3addz._.js} +1 -1
  136. package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_1bf0rdx._.js → node_modules_katex_dist_katex_mjs_1y07ypr._.js} +1 -1
  137. package/.next/server/middleware-build-manifest.js +3 -3
  138. package/.next/server/pages/404.html +1 -1
  139. package/.next/server/pages/500.html +1 -1
  140. package/.next/server/server-reference-manifest.js +1 -1
  141. package/.next/server/server-reference-manifest.json +69 -69
  142. package/.next/static/chunks/{0km5rjf8k0gst.js → 0eepme181mw6f.js} +1 -1
  143. package/.next/static/chunks/{25tttxgpn-fdl.js → 0rx67d-x-1mmv.js} +2 -2
  144. package/.next/static/chunks/{2tlvu360xbisx.js → 0wwq57j09skhy.js} +1 -1
  145. package/.next/static/chunks/0xlr5fmtxb42l.js +4 -0
  146. package/.next/static/chunks/{3f4aku2z0zdxp.js → 0yp1so_h9mfhf.js} +1 -1
  147. package/.next/static/chunks/{1vxq-0uxcm5yl.js → 14e3ie8pgxgdb.js} +1 -1
  148. package/.next/static/chunks/{0_o7o4-itqsz7.js → 1b-3utyj58fn1.js} +1 -1
  149. package/.next/static/chunks/{1o4z63f94c3r-.js → 1c3tarihhldvd.js} +1 -1
  150. package/.next/static/chunks/{2njcedjozdqm7.js → 1j2zjawu_2th7.js} +1 -1
  151. package/.next/static/chunks/{2zvo7b47hhxi5.js → 1l0_q-kf0cbaj.js} +1 -1
  152. package/.next/static/chunks/{1hwehpk3kk-pc.js → 1la1aeosxvwmz.js} +1 -1
  153. package/.next/static/chunks/{29fpns41ml485.js → 1n3a07w81jbc-.js} +1 -1
  154. package/.next/static/chunks/{3ul6m16ba_i3u.js → 227tjgj_th6uf.js} +1 -1
  155. package/.next/static/chunks/{1zwj72bhapocl.js → 29r_coa80ubpw.js} +1 -1
  156. package/.next/static/chunks/{06ymo4xf31ggh.js → 2adz3q18q052w.js} +1 -1
  157. package/.next/static/chunks/{1ki7x6-ehua0u.js → 2b08w7t0hc1fp.js} +1 -1
  158. package/.next/static/chunks/{0i4df8t5_6a-g.js → 2gl-fo_rmmmq0.js} +1 -1
  159. package/.next/static/chunks/{1e3karuzhh7ik.js → 2h5rvagz5wdhy.js} +1 -1
  160. package/.next/static/chunks/2jo02hrgs_zqm.js +1 -0
  161. package/.next/static/chunks/{3ymtwwxmbactm.js → 2voeol7_1tit_.js} +1 -1
  162. package/.next/static/chunks/{277zw6dp5yzks.js → 36hfkcfa5a6be.js} +5 -5
  163. package/.next/static/chunks/{17ow2tmvy65in.js → 3a98r51s8rjtt.js} +1 -1
  164. package/.next/static/chunks/{2jn9y4sol_low.js → 3hl237797_a8e.js} +2 -2
  165. package/.next/static/chunks/3sjv-rshh-98q.js +1 -0
  166. package/.next/static/chunks/{1pxe_gpjic1_h.js → 3tejx8kiotsia.js} +1 -1
  167. package/.next/static/chunks/{1vwqvgit8a1vm.js → 42xlx1decmn82.js} +1 -1
  168. package/guide/calls.md +3 -1
  169. package/package.json +1 -1
  170. package/.next/server/chunks/ssr/_131wmbl._.js +0 -6
  171. package/.next/static/chunks/0lc_77uhatqgd.js +0 -1
  172. package/.next/static/chunks/1gca5ia-a-3e2.js +0 -1
  173. package/.next/static/chunks/3qhhs3dk6cdbq.js +0 -4
  174. /package/.next/static/{pekZvsOZ3_8_ohluwgZtY → mTdCVAiiVKCutbZcekyHn}/_buildManifest.js +0 -0
  175. /package/.next/static/{pekZvsOZ3_8_ohluwgZtY → mTdCVAiiVKCutbZcekyHn}/_clientMiddlewareManifest.js +0 -0
  176. /package/.next/static/{pekZvsOZ3_8_ohluwgZtY → mTdCVAiiVKCutbZcekyHn}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),s=e.i(225913);e.i(271645);var i=e.i(647163);function n({className:e,...s}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,i.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...s})}e.i(652225);let l=(0,s.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:s="vertical",...n}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":s,className:(0,i.cn)(l({orientation:s}),e),...n})},"FieldContent",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,i.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...s})},"FieldLabel",0,function({className:e,...s}){return(0,t.jsx)(n,{"data-slot":"field-label",className:(0,i.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...s})}],986530)},833959,e=>{"use strict";var t=e.i(843476),s=e.i(437750),i=e.i(856539),n=e.i(24071),l=e.i(867927),r=e.i(829600),a=e.i(226091),o=e.i(726067),d=e.i(456420);let c={name:"frame",size:24,node:[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]};c.node;let u=(0,d.default)(c);var m=e.i(91511),x=e.i(77071),f=e.i(566595);let h={name:"square-pen",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aliases:["pen-box","edit","pen-square"]};h.node;let p=(0,d.default)(h);var g=e.i(759659);let v={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};v.node;let b=(0,d.default)(v);var k=e.i(271645),j=e.i(798120),y=e.i(167881),w=e.i(986530),N=e.i(23750),S=e.i(683408),C=e.i(917162),L=e.i(671428),z=e.i(319036),F=e.i(127341),M=e.i(184762),R=e.i(41533),T=e.i(895836),$=e.i(95187);let D=(0,$.createServerReference)("7f266827d3742e29aba07046edf67302a8dedad8d3",$.callServer,void 0,$.findSourceMapURL,"createSkillAction"),A=(0,$.createServerReference)("7f6ffc835d1e76108b56c92d42841edb5be2898af7",$.callServer,void 0,$.findSourceMapURL,"deleteSkillAction"),B=(0,$.createServerReference)("7f2160ae4e1aeef3b554d9d3ca013baa98a33df1be",$.callServer,void 0,$.findSourceMapURL,"setSkillDisabledAction"),q=(0,$.createServerReference)("7f0e5797b287c7a0c6a62e874837ab47220ac0f9dc",$.callServer,void 0,$.findSourceMapURL,"uploadSkillAction"),I=(0,$.createServerReference)("7fbb6cc0290830cfc433f0f3befc081f11ff879bd5",$.callServer,void 0,$.findSourceMapURL,"writeSkillFileAction");var K=e.i(362201);K.union([K.enum(["custom","default"]),K.templateLiteral(["kit:",K.string().regex(/^[\p{L}\p{N}_-]+$/u)]),K.templateLiteral(["own:",K.string().regex(/^[\p{L}\p{N}_-]+$/u)])]);let E=e=>"custom"===e||e.startsWith("own:"),U=K.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long").regex(/^[a-z0-9][a-z0-9_-]*$/i,"Use letters, numbers, dashes and underscores only"),O=K.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long");K.object({name:O,description:K.string().trim().min(1,"Description is required"),metadata:K.record(K.string(),K.unknown()).optional(),disabled:K.boolean().optional(),platforms:K.array(K.string()).optional()}).extend({name:U,content:K.string().trim().min(1,"Content is required")});var P=e.i(609856),W=e.i(283653),_=e.i(647163);let H={artifact:u,browser:m.Globe,computer:s.AppWindow,"find-skills":f.Search,"skill-creator":p};function V({skill:e}){let[s,n]=(0,P.useServerAction)(A,{onOk:()=>(0,W.revalidate)(j.queryKey.skills)}),[r]=(0,P.useServerAction)(B,{onOk:()=>(0,W.revalidate)(j.queryKey.skills)}),a=async()=>{await C.notify.confirm({title:`Delete ${e.name}?`,description:"Every file in this skill is deleted for good.",okText:"Delete",destructive:!0})&&s(e.source,e.dir)},o="default"===e.source&&H[e.dir]||i.BookMarked;return(0,t.jsxs)("div",{className:"group flex items-center transition-colors hover:bg-muted/50",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{var s;return s=e,C.notify.component({className:"sm:max-w-4xl",renderer:({guard:e})=>(0,t.jsx)(G,{skill:s,guard:e})})},className:"flex min-w-0 flex-1 items-center gap-3 py-4 pl-4 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:(0,_.cn)("grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",e.disabled&&"opacity-45"),children:(0,t.jsx)(o,{className:"size-4"})}),(0,t.jsxs)("span",{className:(0,_.cn)("min-w-0 flex-1 space-y-0.5",e.disabled&&"opacity-45"),children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.name}),(0,t.jsx)("span",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:e.description.trim().split(/(?<=[.。])\s|\n/)[0].trim()})]}),(0,t.jsx)(l.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 group-hover:text-foreground"})]}),(0,t.jsxs)("div",{className:"mr-4 ml-5 flex w-18 shrink-0 items-center justify-end gap-3",children:[(0,t.jsx)(z.Switch,{checked:!e.disabled,onCheckedChange:t=>r(e.source,e.dir,!t),"aria-label":`${e.name} on or off`,className:"shrink-0"}),E(e.source)?(0,t.jsx)(y.Button,{size:"icon-sm",variant:"ghost",loading:n,onClick:a,"aria-label":`Delete ${e.name}`,className:"shrink-0 text-muted-foreground",children:(0,t.jsx)(g.Trash2,{})}):(0,t.jsx)("span",{className:"size-7 shrink-0"})]})]})}function G({skill:e,guard:s}){let[i,l]=(0,k.useState)(""),[r,a]=(0,k.useState)("SKILL.md"),o=(0,k.useRef)(!1);(0,k.useEffect)(()=>s(()=>o.current),[s]);let d=async e=>{let t=i?`${i}/${e.name}`:e.name;"dir"===e.kind?l(t):t===r||(!o.current||await C.notify.confirm({title:"Discard your changes?",description:`What you wrote in ${r?.split("/").pop()} is not saved.`,okText:"Discard",destructive:!0}))&&(o.current=!1,a(t))};return(0,t.jsx)(T.SettingDialogContent,{title:e.name,description:(0,t.jsx)(Y,{skill:e,path:r??i}),children:(0,t.jsxs)("div",{className:"flex h-[36rem] divide-x divide-border/60 overflow-hidden rounded-xl border border-border/60 bg-background",children:[(0,t.jsxs)("div",{className:"flex w-44 shrink-0 flex-col overflow-y-auto bg-muted/20 py-1",children:[i&&(0,t.jsxs)("button",{type:"button",onClick:()=>l(i.split("/").slice(0,-1).join("/")),className:"mx-1 mb-1 flex items-center gap-1 rounded-md px-2 py-1 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/50 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)(n.ChevronLeft,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:i.split("/").pop()})]}),(0,t.jsx)(J,{source:e.source,dir:e.dir,path:i,current:r,onPick:d})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r?(0,t.jsx)(X,{source:e.source,dir:e.dir,path:r,editable:E(e.source),onUnsaved:e=>{o.current=e}},r):(0,t.jsx)("p",{className:"p-6 text-sm text-muted-foreground",children:"Pick a file"})})]})})}function Y({skill:e,path:s}){if(!e)return(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:"Pick a skill"});let i=[e.name,...s.split("/").filter(Boolean)];return(0,t.jsx)("span",{className:"flex min-w-0 items-center gap-1 font-mono text-[11px] text-muted-foreground",children:i.map((e,s)=>(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[s>0&&(0,t.jsx)(l.ChevronRight,{className:"size-3 shrink-0 opacity-50"}),(0,t.jsx)("span",{className:(0,_.cn)("truncate",s===i.length-1&&"text-foreground"),children:e})]},`${s}-${e}`))})}function Z({icon:e,label:s,active:i,hasChildren:n,onClick:r}){return(0,t.jsxs)("button",{type:"button",onClick:r,className:(0,_.cn)("mx-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",i?T.PICKED_ROW:"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70 [&>svg]:size-3",children:e}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),n&&(0,t.jsx)(l.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/50"})]})}function J({source:e,dir:s,path:i,current:n,onPick:l}){let{data:d,isLoading:c,error:u}=(0,W.useServerRoute)(j.queryKey.skillNode(e,s,i));return u?(0,t.jsx)("p",{className:"p-3 font-mono text-xs text-destructive",children:u.message}):c||!d?(0,t.jsxs)("div",{className:"space-y-2 p-2",children:[(0,t.jsx)(L.Skeleton,{className:"h-5 w-full"}),(0,t.jsx)(L.Skeleton,{className:"h-5 w-4/5"})]}):"dir"!==d.kind?null:(0,t.jsxs)(t.Fragment,{children:[d.entries.map(e=>(0,t.jsx)(Z,{icon:"dir"===e.kind?(0,t.jsx)(o.Folder,{}):e.name.endsWith(".md")?(0,t.jsx)(a.FileText,{}):(0,t.jsx)(r.File,{}),label:e.name,hasChildren:"dir"===e.kind,active:(i?`${i}/${e.name}`:e.name)===n,onClick:()=>l(e)},e.name)),0===d.entries.length&&(0,t.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:"Empty folder"})]})}function Q({content:e,description:s}){let i=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?/.exec(e),n=s?.trim(),l=i?e.slice(i[0].length):e;return(0,t.jsxs)("div",{className:"min-w-0",children:[n&&(0,t.jsx)("p",{className:"border-b border-border/60 px-5 py-3 text-[13px] leading-relaxed text-muted-foreground",children:n}),(0,t.jsx)("div",{className:"px-5 py-4 text-sm leading-relaxed",children:(0,t.jsx)(S.Markdown,{children:l})})]})}function X({source:e,dir:s,path:i,editable:n,onUnsaved:l}){let[r,a]=(0,k.useState)(null),{data:o,isLoading:d,error:c}=(0,W.useServerRoute)(j.queryKey.skillNode(e,s,i)),u=null!==r&&(o?.kind!=="file"||r!==o.content);(0,k.useEffect)(()=>l?.(u),[u,l]);let[m,x]=(0,P.useServerAction)(I,{okMessage:"Saved",onOk:()=>{a(null),(0,W.revalidate)(j.queryKey.skills)}});if(c)return(0,t.jsx)("p",{className:"p-4 font-mono text-xs text-destructive",children:c.message});if(d||!o)return(0,t.jsxs)("div",{className:"space-y-3 p-5",children:[(0,t.jsx)(L.Skeleton,{className:"h-5 w-2/3"}),(0,t.jsx)(L.Skeleton,{className:"h-4 w-full"}),(0,t.jsx)(L.Skeleton,{className:"h-4 w-5/6"})]});if("file"!==o.kind)return null;let f=i.split("/").pop()??"";return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"sticky top-0 z-20 flex items-center justify-between gap-2 border-b border-border/60 bg-background/90 px-5 py-2 font-mono text-[11px] text-muted-foreground backdrop-blur",children:[(0,t.jsx)("span",{className:"truncate",children:f}),(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,t.jsx)("span",{children:(0,_.formatBytes)(o.size)}),n&&null!==o.content&&null===r&&(0,t.jsxs)(y.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>a(o.content??""),children:[(0,t.jsx)(p,{}),"Edit"]}),null!==r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>a(null),children:"Cancel"}),(0,t.jsx)(y.Button,{size:"xs",className:"font-mono",loading:x,disabled:r===o.content,onClick:()=>m(e,s,i,r),children:"Save"})]})]})]}),null!==r?(0,t.jsx)(M.Textarea,{value:r,onChange:e=>a(e.target.value),spellCheck:!1,"aria-label":`${f} contents`,className:"min-h-120 resize-none rounded-none border-0 font-mono text-[13px] leading-relaxed shadow-none focus-visible:ring-0"}):null===o.content?(0,t.jsx)("p",{className:"px-5 py-4 text-sm text-muted-foreground",children:o.size>R.SKILL_FILES.inlineBytes?"Too long to show here — a bot still reads it from disk.":"Not a text file — a bot can still read it from disk."}):f.toLowerCase().endsWith(".md")?(0,t.jsx)(Q,{content:o.content,description:o.description}):(0,t.jsx)("pre",{className:"overflow-x-auto px-5 py-4 font-mono text-[13px] leading-relaxed whitespace-pre text-foreground/90",children:o.content})]})}function ee(){return C.notify.component({className:"sm:max-w-lg",renderer:({close:e,guard:s})=>(0,t.jsx)(et,{onDone:e,guard:s})})}function et({onDone:e,guard:s}){let[i,n]=(0,k.useState)("write"),[l,r]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),[d,c]=(0,k.useState)(""),[u,m]=(0,k.useState)(null),[f,h]=(0,k.useState)(!1),p=(0,k.useRef)(null),g=(0,k.useRef)(!1);g.current=!!(l.trim()||a.trim()||d.trim()||u),(0,k.useEffect)(()=>s(()=>g.current),[s]);let v={errorMessage:!1,onOk:()=>{(0,W.revalidate)(j.queryKey.skills),e()}},[S,C,,L]=(0,P.useServerAction)(D,v),[z,$,,A]=(0,P.useServerAction)(q,v),B=C||$,I="write"===i?L:A,K=null!==u&&u.size>R.SKILL_FILES.uploadBytes,E=Math.round(R.SKILL_FILES.uploadBytes/1024/1024),U=!B&&("write"===i?l.trim()&&a.trim()&&d.trim():null!==u&&!K),O=async()=>{if(!U)return;if("write"===i)return void S({name:l.trim(),description:a.trim(),content:d});if(!u)return;let e=new FormData;e.append("file",u),z(e)},H=e=>{let t=e?.[0]??null;t&&m(t)};return(0,t.jsxs)(T.SettingDialogContent,{title:"New skill",description:"Instructions a bot reads when a job calls for them.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(y.Button,{disabled:!U,loading:B,onClick:O,children:[!B&&("write"===i?(0,t.jsx)(x.Plus,{}):(0,t.jsx)(b,{})),"write"===i?"Create":"Upload"]})]}),children:[(0,t.jsxs)(F.Tabs,{value:i,onValueChange:e=>n(e),children:[(0,t.jsxs)(F.TabsList,{className:"w-full",children:[(0,t.jsx)(F.TabsTrigger,{value:"write",children:"Write"}),(0,t.jsx)(F.TabsTrigger,{value:"upload",children:"Upload"})]}),(0,t.jsxs)(F.TabsContent,{value:"write",className:"space-y-5 pt-4",children:[(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-name",children:"Name"}),(0,t.jsxs)(w.FieldContent,{children:[(0,t.jsx)(N.Input,{id:"skill-name",value:l,onChange:e=>r(e.target.value),placeholder:"deploy-checklist",spellCheck:!1,autoFocus:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[R.PATHS.skills.custom,"/",l.trim()||"…","/SKILL.md"]})]})]}),(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-description",children:"Description"}),(0,t.jsx)(w.FieldContent,{children:(0,t.jsx)(N.Input,{id:"skill-description",value:a,onChange:e=>o(e.target.value),placeholder:"What it does, then when to use it — a bot reads this to decide"})})]}),(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-content",children:"Content"}),(0,t.jsx)(M.Textarea,{id:"skill-content",value:d,onChange:e=>c(e.target.value),placeholder:"Markdown. The steps, the rules, the examples.",className:"min-h-40 resize-none font-mono text-xs"})]})]}),(0,t.jsxs)(F.TabsContent,{value:"upload",className:"space-y-4 pt-4",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>p.current?.click(),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:e=>{e.preventDefault(),h(!1),H(e.dataTransfer.files)},className:(0,_.cn)("flex w-full flex-col items-center gap-2 rounded-xl border border-dashed px-6 py-10 text-center outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",f?"border-foreground/60 bg-muted/60":"border-border hover:bg-muted/40"),children:[(0,t.jsx)(b,{className:"size-5 text-muted-foreground"}),u?(0,t.jsxs)("span",{className:"text-sm",children:[u.name,(0,t.jsxs)("span",{className:(0,_.cn)("ml-2 font-mono text-[11px]",K?"text-destructive":"text-muted-foreground"),children:[(0,_.formatBytes)(u.size),K&&` \xb7 over ${E} MB`]})]}):(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"Drop a file here, or click to choose"})]}),(0,t.jsx)("input",{ref:p,type:"file",accept:".md,.zip,.skill",className:"hidden",onChange:e=>H(e.target.files)}),(0,t.jsxs)("div",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,t.jsx)("p",{className:"font-medium text-foreground/80",children:"File requirements"}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".md"})," file needs a YAML block with the skill's name and description."]}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".zip"})," or"," ",(0,t.jsx)("span",{className:"font-mono",children:".skill"})," archive needs a SKILL.md inside — the rest of its folder comes along."]}),(0,t.jsxs)("p",{children:["Up to ",E," MB."]})]})]})]}),I&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:I})]})}e.s(["SkillsSetting",0,function(){let[e,s]=(0,k.useState)(""),{data:i,isLoading:n,error:l}=(0,W.useServerRoute)(j.queryKey.skills),r=i??[];if(n)return(0,t.jsx)(T.SettingSkeleton,{rows:4});if(l)return(0,t.jsx)(T.SettingError,{message:l.message});let a=e.trim().toLowerCase(),o=r.filter(e=>!a||`${e.name} ${e.description}`.toLowerCase().includes(a)),d=r.filter(e=>!e.disabled).length,c=r.filter(e=>!e.disabled&&("default"===e.source||"custom"===e.source)).length,u=new Map;for(let e of o)e.bot&&u.set(e.bot,[...u.get(e.bot)??[],e]);return(0,t.jsxs)(T.SettingScreen,{footer:(0,t.jsxs)(T.SettingRailNote,{children:[r.filter(e=>!E(e.source)).length," ","shipped ·"," ",r.filter(e=>E(e.source)).length," ","installed"]}),children:[(0,t.jsx)(T.SettingToolbar,{count:`${d} on \xb7 ${r.length-d} off`,children:(0,t.jsx)(T.SettingFilter,{value:e,onChange:s,placeholder:"Filter skills"})}),(0,t.jsx)(T.SettingGroup,{label:"Custom",hint:"yours — added here · a Default skill of the same name wins",children:(0,t.jsx)(T.SettingItems,{addRow:{label:"Add skill",onClick:ee},children:o.filter(e=>"custom"===e.source).map(e=>(0,t.jsx)(V,{skill:e},`custom/${e.dir}`))})}),[...u].map(([e,s])=>(0,t.jsx)(T.SettingGroup,{label:`${e}'s own`,hint:`only ${e} reads these \xb7 what it found or wrote can be edited or deleted`,children:(0,t.jsx)(T.SettingItems,{children:s.map(e=>(0,t.jsx)(V,{skill:e},`${e.source}/${e.dir}`))})},e)),(0,t.jsx)(T.SettingGroup,{label:"Default",hint:"ships with the app · switch off, can't edit or delete",children:(0,t.jsx)(T.SettingItems,{children:o.filter(e=>"default"===e.source).map(e=>(0,t.jsx)(V,{skill:e},`default/${e.dir}`))})}),c>R.PROMPT_CROWDED.skills&&(0,t.jsxs)(T.SettingNote,{children:[c," skills are on for every bot. Each is a line in every prompt a bot reads, and one more to look past when it picks."]})]})}],833959)},437750,e=>{"use strict";var t=e.i(456420);let s={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};s.node;let i=(0,t.default)(s);e.s(["AppWindow",0,i],437750)},726067,e=>{"use strict";var t=e.i(456420);let s={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};s.node;let i=(0,t.default)(s);e.s(["Folder",0,i],726067)},759659,e=>{"use strict";var t=e.i(456420);let s={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};s.node;let i=(0,t.default)(s);e.s(["Trash2",0,i],759659)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),s=e.i(225913);e.i(271645);var i=e.i(647163);function n({className:e,...s}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,i.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...s})}e.i(652225);let l=(0,s.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:s="vertical",...n}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":s,className:(0,i.cn)(l({orientation:s}),e),...n})},"FieldContent",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,i.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...s})},"FieldLabel",0,function({className:e,...s}){return(0,t.jsx)(n,{"data-slot":"field-label",className:(0,i.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...s})}],986530)},833959,e=>{"use strict";var t=e.i(843476),s=e.i(437750),i=e.i(856539),n=e.i(24071),l=e.i(867927),r=e.i(829600),a=e.i(226091),o=e.i(726067),d=e.i(456420);let c={name:"frame",size:24,node:[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]};c.node;let u=(0,d.default)(c);var m=e.i(91511),x=e.i(77071),f=e.i(566595);let h={name:"square-pen",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aliases:["pen-box","edit","pen-square"]};h.node;let p=(0,d.default)(h);var g=e.i(759659);let v={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};v.node;let b=(0,d.default)(v);var k=e.i(271645),j=e.i(798120),y=e.i(167881),w=e.i(986530),N=e.i(23750),S=e.i(683408),C=e.i(917162),L=e.i(671428),z=e.i(319036),F=e.i(127341),M=e.i(184762),R=e.i(41533),T=e.i(895836),$=e.i(95187);let D=(0,$.createServerReference)("7ff616b1cb86ddc2347988548d5d1fba005f215f37",$.callServer,void 0,$.findSourceMapURL,"createSkillAction"),A=(0,$.createServerReference)("7f351586977a33ca7735f7d3f8d7aaf31ac2264d21",$.callServer,void 0,$.findSourceMapURL,"deleteSkillAction"),B=(0,$.createServerReference)("7f0d6e28feb58fab9203e73d3486914d23d1f0fe45",$.callServer,void 0,$.findSourceMapURL,"setSkillDisabledAction"),q=(0,$.createServerReference)("7ffca4bd85271d75bb0ebc67154b6efde115da0038",$.callServer,void 0,$.findSourceMapURL,"uploadSkillAction"),I=(0,$.createServerReference)("7fddde55c409d36fe2c0f2b727c5f2df333b3a46ad",$.callServer,void 0,$.findSourceMapURL,"writeSkillFileAction");var K=e.i(362201);K.union([K.enum(["custom","default"]),K.templateLiteral(["kit:",K.string().regex(/^[\p{L}\p{N}_-]+$/u)]),K.templateLiteral(["own:",K.string().regex(/^[\p{L}\p{N}_-]+$/u)])]);let E=e=>"custom"===e||e.startsWith("own:"),U=K.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long").regex(/^[a-z0-9][a-z0-9_-]*$/i,"Use letters, numbers, dashes and underscores only"),O=K.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long");K.object({name:O,description:K.string().trim().min(1,"Description is required"),metadata:K.record(K.string(),K.unknown()).optional(),disabled:K.boolean().optional(),platforms:K.array(K.string()).optional()}).extend({name:U,content:K.string().trim().min(1,"Content is required")});var P=e.i(609856),W=e.i(283653),_=e.i(647163);let H={artifact:u,browser:m.Globe,computer:s.AppWindow,"find-skills":f.Search,"skill-creator":p};function V({skill:e}){let[s,n]=(0,P.useServerAction)(A,{onOk:()=>(0,W.revalidate)(j.queryKey.skills)}),[r]=(0,P.useServerAction)(B,{onOk:()=>(0,W.revalidate)(j.queryKey.skills)}),a=async()=>{await C.notify.confirm({title:`Delete ${e.name}?`,description:"Every file in this skill is deleted for good.",okText:"Delete",destructive:!0})&&s(e.source,e.dir)},o="default"===e.source&&H[e.dir]||i.BookMarked;return(0,t.jsxs)("div",{className:"group flex items-center transition-colors hover:bg-muted/50",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{var s;return s=e,C.notify.component({className:"sm:max-w-4xl",renderer:({guard:e})=>(0,t.jsx)(G,{skill:s,guard:e})})},className:"flex min-w-0 flex-1 items-center gap-3 py-4 pl-4 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:(0,_.cn)("grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",e.disabled&&"opacity-45"),children:(0,t.jsx)(o,{className:"size-4"})}),(0,t.jsxs)("span",{className:(0,_.cn)("min-w-0 flex-1 space-y-0.5",e.disabled&&"opacity-45"),children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.name}),(0,t.jsx)("span",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:e.description.trim().split(/(?<=[.。])\s|\n/)[0].trim()})]}),(0,t.jsx)(l.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 group-hover:text-foreground"})]}),(0,t.jsxs)("div",{className:"mr-4 ml-5 flex w-18 shrink-0 items-center justify-end gap-3",children:[(0,t.jsx)(z.Switch,{checked:!e.disabled,onCheckedChange:t=>r(e.source,e.dir,!t),"aria-label":`${e.name} on or off`,className:"shrink-0"}),E(e.source)?(0,t.jsx)(y.Button,{size:"icon-sm",variant:"ghost",loading:n,onClick:a,"aria-label":`Delete ${e.name}`,className:"shrink-0 text-muted-foreground",children:(0,t.jsx)(g.Trash2,{})}):(0,t.jsx)("span",{className:"size-7 shrink-0"})]})]})}function G({skill:e,guard:s}){let[i,l]=(0,k.useState)(""),[r,a]=(0,k.useState)("SKILL.md"),o=(0,k.useRef)(!1);(0,k.useEffect)(()=>s(()=>o.current),[s]);let d=async e=>{let t=i?`${i}/${e.name}`:e.name;"dir"===e.kind?l(t):t===r||(!o.current||await C.notify.confirm({title:"Discard your changes?",description:`What you wrote in ${r?.split("/").pop()} is not saved.`,okText:"Discard",destructive:!0}))&&(o.current=!1,a(t))};return(0,t.jsx)(T.SettingDialogContent,{title:e.name,description:(0,t.jsx)(Y,{skill:e,path:r??i}),children:(0,t.jsxs)("div",{className:"flex h-[36rem] divide-x divide-border/60 overflow-hidden rounded-xl border border-border/60 bg-background",children:[(0,t.jsxs)("div",{className:"flex w-44 shrink-0 flex-col overflow-y-auto bg-muted/20 py-1",children:[i&&(0,t.jsxs)("button",{type:"button",onClick:()=>l(i.split("/").slice(0,-1).join("/")),className:"mx-1 mb-1 flex items-center gap-1 rounded-md px-2 py-1 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/50 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)(n.ChevronLeft,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:i.split("/").pop()})]}),(0,t.jsx)(J,{source:e.source,dir:e.dir,path:i,current:r,onPick:d})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r?(0,t.jsx)(X,{source:e.source,dir:e.dir,path:r,editable:E(e.source),onUnsaved:e=>{o.current=e}},r):(0,t.jsx)("p",{className:"p-6 text-sm text-muted-foreground",children:"Pick a file"})})]})})}function Y({skill:e,path:s}){if(!e)return(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:"Pick a skill"});let i=[e.name,...s.split("/").filter(Boolean)];return(0,t.jsx)("span",{className:"flex min-w-0 items-center gap-1 font-mono text-[11px] text-muted-foreground",children:i.map((e,s)=>(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[s>0&&(0,t.jsx)(l.ChevronRight,{className:"size-3 shrink-0 opacity-50"}),(0,t.jsx)("span",{className:(0,_.cn)("truncate",s===i.length-1&&"text-foreground"),children:e})]},`${s}-${e}`))})}function Z({icon:e,label:s,active:i,hasChildren:n,onClick:r}){return(0,t.jsxs)("button",{type:"button",onClick:r,className:(0,_.cn)("mx-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",i?T.PICKED_ROW:"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70 [&>svg]:size-3",children:e}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),n&&(0,t.jsx)(l.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/50"})]})}function J({source:e,dir:s,path:i,current:n,onPick:l}){let{data:d,isLoading:c,error:u}=(0,W.useServerRoute)(j.queryKey.skillNode(e,s,i));return u?(0,t.jsx)("p",{className:"p-3 font-mono text-xs text-destructive",children:u.message}):c||!d?(0,t.jsxs)("div",{className:"space-y-2 p-2",children:[(0,t.jsx)(L.Skeleton,{className:"h-5 w-full"}),(0,t.jsx)(L.Skeleton,{className:"h-5 w-4/5"})]}):"dir"!==d.kind?null:(0,t.jsxs)(t.Fragment,{children:[d.entries.map(e=>(0,t.jsx)(Z,{icon:"dir"===e.kind?(0,t.jsx)(o.Folder,{}):e.name.endsWith(".md")?(0,t.jsx)(a.FileText,{}):(0,t.jsx)(r.File,{}),label:e.name,hasChildren:"dir"===e.kind,active:(i?`${i}/${e.name}`:e.name)===n,onClick:()=>l(e)},e.name)),0===d.entries.length&&(0,t.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:"Empty folder"})]})}function Q({content:e,description:s}){let i=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?/.exec(e),n=s?.trim(),l=i?e.slice(i[0].length):e;return(0,t.jsxs)("div",{className:"min-w-0",children:[n&&(0,t.jsx)("p",{className:"border-b border-border/60 px-5 py-3 text-[13px] leading-relaxed text-muted-foreground",children:n}),(0,t.jsx)("div",{className:"px-5 py-4 text-sm leading-relaxed",children:(0,t.jsx)(S.Markdown,{children:l})})]})}function X({source:e,dir:s,path:i,editable:n,onUnsaved:l}){let[r,a]=(0,k.useState)(null),{data:o,isLoading:d,error:c}=(0,W.useServerRoute)(j.queryKey.skillNode(e,s,i)),u=null!==r&&(o?.kind!=="file"||r!==o.content);(0,k.useEffect)(()=>l?.(u),[u,l]);let[m,x]=(0,P.useServerAction)(I,{okMessage:"Saved",onOk:()=>{a(null),(0,W.revalidate)(j.queryKey.skills)}});if(c)return(0,t.jsx)("p",{className:"p-4 font-mono text-xs text-destructive",children:c.message});if(d||!o)return(0,t.jsxs)("div",{className:"space-y-3 p-5",children:[(0,t.jsx)(L.Skeleton,{className:"h-5 w-2/3"}),(0,t.jsx)(L.Skeleton,{className:"h-4 w-full"}),(0,t.jsx)(L.Skeleton,{className:"h-4 w-5/6"})]});if("file"!==o.kind)return null;let f=i.split("/").pop()??"";return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"sticky top-0 z-20 flex items-center justify-between gap-2 border-b border-border/60 bg-background/90 px-5 py-2 font-mono text-[11px] text-muted-foreground backdrop-blur",children:[(0,t.jsx)("span",{className:"truncate",children:f}),(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,t.jsx)("span",{children:(0,_.formatBytes)(o.size)}),n&&null!==o.content&&null===r&&(0,t.jsxs)(y.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>a(o.content??""),children:[(0,t.jsx)(p,{}),"Edit"]}),null!==r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>a(null),children:"Cancel"}),(0,t.jsx)(y.Button,{size:"xs",className:"font-mono",loading:x,disabled:r===o.content,onClick:()=>m(e,s,i,r),children:"Save"})]})]})]}),null!==r?(0,t.jsx)(M.Textarea,{value:r,onChange:e=>a(e.target.value),spellCheck:!1,"aria-label":`${f} contents`,className:"min-h-120 resize-none rounded-none border-0 font-mono text-[13px] leading-relaxed shadow-none focus-visible:ring-0"}):null===o.content?(0,t.jsx)("p",{className:"px-5 py-4 text-sm text-muted-foreground",children:o.size>R.SKILL_FILES.inlineBytes?"Too long to show here — a bot still reads it from disk.":"Not a text file — a bot can still read it from disk."}):f.toLowerCase().endsWith(".md")?(0,t.jsx)(Q,{content:o.content,description:o.description}):(0,t.jsx)("pre",{className:"overflow-x-auto px-5 py-4 font-mono text-[13px] leading-relaxed whitespace-pre text-foreground/90",children:o.content})]})}function ee(){return C.notify.component({className:"sm:max-w-lg",renderer:({close:e,guard:s})=>(0,t.jsx)(et,{onDone:e,guard:s})})}function et({onDone:e,guard:s}){let[i,n]=(0,k.useState)("write"),[l,r]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),[d,c]=(0,k.useState)(""),[u,m]=(0,k.useState)(null),[f,h]=(0,k.useState)(!1),p=(0,k.useRef)(null),g=(0,k.useRef)(!1);g.current=!!(l.trim()||a.trim()||d.trim()||u),(0,k.useEffect)(()=>s(()=>g.current),[s]);let v={errorMessage:!1,onOk:()=>{(0,W.revalidate)(j.queryKey.skills),e()}},[S,C,,L]=(0,P.useServerAction)(D,v),[z,$,,A]=(0,P.useServerAction)(q,v),B=C||$,I="write"===i?L:A,K=null!==u&&u.size>R.SKILL_FILES.uploadBytes,E=Math.round(R.SKILL_FILES.uploadBytes/1024/1024),U=!B&&("write"===i?l.trim()&&a.trim()&&d.trim():null!==u&&!K),O=async()=>{if(!U)return;if("write"===i)return void S({name:l.trim(),description:a.trim(),content:d});if(!u)return;let e=new FormData;e.append("file",u),z(e)},H=e=>{let t=e?.[0]??null;t&&m(t)};return(0,t.jsxs)(T.SettingDialogContent,{title:"New skill",description:"Instructions a bot reads when a job calls for them.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(y.Button,{disabled:!U,loading:B,onClick:O,children:[!B&&("write"===i?(0,t.jsx)(x.Plus,{}):(0,t.jsx)(b,{})),"write"===i?"Create":"Upload"]})]}),children:[(0,t.jsxs)(F.Tabs,{value:i,onValueChange:e=>n(e),children:[(0,t.jsxs)(F.TabsList,{className:"w-full",children:[(0,t.jsx)(F.TabsTrigger,{value:"write",children:"Write"}),(0,t.jsx)(F.TabsTrigger,{value:"upload",children:"Upload"})]}),(0,t.jsxs)(F.TabsContent,{value:"write",className:"space-y-5 pt-4",children:[(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-name",children:"Name"}),(0,t.jsxs)(w.FieldContent,{children:[(0,t.jsx)(N.Input,{id:"skill-name",value:l,onChange:e=>r(e.target.value),placeholder:"deploy-checklist",spellCheck:!1,autoFocus:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[R.PATHS.skills.custom,"/",l.trim()||"…","/SKILL.md"]})]})]}),(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-description",children:"Description"}),(0,t.jsx)(w.FieldContent,{children:(0,t.jsx)(N.Input,{id:"skill-description",value:a,onChange:e=>o(e.target.value),placeholder:"What it does, then when to use it — a bot reads this to decide"})})]}),(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-content",children:"Content"}),(0,t.jsx)(M.Textarea,{id:"skill-content",value:d,onChange:e=>c(e.target.value),placeholder:"Markdown. The steps, the rules, the examples.",className:"min-h-40 resize-none font-mono text-xs"})]})]}),(0,t.jsxs)(F.TabsContent,{value:"upload",className:"space-y-4 pt-4",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>p.current?.click(),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:e=>{e.preventDefault(),h(!1),H(e.dataTransfer.files)},className:(0,_.cn)("flex w-full flex-col items-center gap-2 rounded-xl border border-dashed px-6 py-10 text-center outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",f?"border-foreground/60 bg-muted/60":"border-border hover:bg-muted/40"),children:[(0,t.jsx)(b,{className:"size-5 text-muted-foreground"}),u?(0,t.jsxs)("span",{className:"text-sm",children:[u.name,(0,t.jsxs)("span",{className:(0,_.cn)("ml-2 font-mono text-[11px]",K?"text-destructive":"text-muted-foreground"),children:[(0,_.formatBytes)(u.size),K&&` \xb7 over ${E} MB`]})]}):(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"Drop a file here, or click to choose"})]}),(0,t.jsx)("input",{ref:p,type:"file",accept:".md,.zip,.skill",className:"hidden",onChange:e=>H(e.target.files)}),(0,t.jsxs)("div",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,t.jsx)("p",{className:"font-medium text-foreground/80",children:"File requirements"}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".md"})," file needs a YAML block with the skill's name and description."]}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".zip"})," or"," ",(0,t.jsx)("span",{className:"font-mono",children:".skill"})," archive needs a SKILL.md inside — the rest of its folder comes along."]}),(0,t.jsxs)("p",{children:["Up to ",E," MB."]})]})]})]}),I&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:I})]})}e.s(["SkillsSetting",0,function(){let[e,s]=(0,k.useState)(""),{data:i,isLoading:n,error:l}=(0,W.useServerRoute)(j.queryKey.skills),r=i??[];if(n)return(0,t.jsx)(T.SettingSkeleton,{rows:4});if(l)return(0,t.jsx)(T.SettingError,{message:l.message});let a=e.trim().toLowerCase(),o=r.filter(e=>!a||`${e.name} ${e.description}`.toLowerCase().includes(a)),d=r.filter(e=>!e.disabled).length,c=r.filter(e=>!e.disabled&&("default"===e.source||"custom"===e.source)).length,u=new Map;for(let e of o)e.bot&&u.set(e.bot,[...u.get(e.bot)??[],e]);return(0,t.jsxs)(T.SettingScreen,{footer:(0,t.jsxs)(T.SettingRailNote,{children:[r.filter(e=>!E(e.source)).length," ","shipped ·"," ",r.filter(e=>E(e.source)).length," ","installed"]}),children:[(0,t.jsx)(T.SettingToolbar,{count:`${d} on \xb7 ${r.length-d} off`,children:(0,t.jsx)(T.SettingFilter,{value:e,onChange:s,placeholder:"Filter skills"})}),(0,t.jsx)(T.SettingGroup,{label:"Custom",hint:"yours — added here · a Default skill of the same name wins",children:(0,t.jsx)(T.SettingItems,{addRow:{label:"Add skill",onClick:ee},children:o.filter(e=>"custom"===e.source).map(e=>(0,t.jsx)(V,{skill:e},`custom/${e.dir}`))})}),[...u].map(([e,s])=>(0,t.jsx)(T.SettingGroup,{label:`${e}'s own`,hint:`only ${e} reads these \xb7 what it found or wrote can be edited or deleted`,children:(0,t.jsx)(T.SettingItems,{children:s.map(e=>(0,t.jsx)(V,{skill:e},`${e.source}/${e.dir}`))})},e)),(0,t.jsx)(T.SettingGroup,{label:"Default",hint:"ships with the app · switch off, can't edit or delete",children:(0,t.jsx)(T.SettingItems,{children:o.filter(e=>"default"===e.source).map(e=>(0,t.jsx)(V,{skill:e},`default/${e.dir}`))})}),c>R.PROMPT_CROWDED.skills&&(0,t.jsxs)(T.SettingNote,{children:[c," skills are on for every bot. Each is a line in every prompt a bot reads, and one more to look past when it picks."]})]})}],833959)},437750,e=>{"use strict";var t=e.i(456420);let s={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};s.node;let i=(0,t.default)(s);e.s(["AppWindow",0,i],437750)},726067,e=>{"use strict";var t=e.i(456420);let s={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};s.node;let i=(0,t.default)(s);e.s(["Folder",0,i],726067)},759659,e=>{"use strict";var t=e.i(456420);let s={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};s.node;let i=(0,t.default)(s);e.s(["Trash2",0,i],759659)}]);
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,805995,e=>{"use strict";var t,n=e.i(843476),s=e.i(493801),r=e.i(375775),i=e.i(422411),a=e.i(525335),o=e.i(689664),l=e.i(867927),d=e.i(456420);let c={name:"clapperboard",size:24,node:[["path",{d:"m12.296 3.464 3.02 3.956",key:"qash78"}],["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z",key:"1h7j8b"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"4lm6w1"}],["path",{d:"m6.18 5.276 3.1 3.899",key:"zjj9t3"}]]};c.node;let u=(0,d.default)(c);var h=e.i(815170),m=e.i(758925),f=e.i(566595),x=e.i(466787),p=e.i(271645),g=e.i(798120),y=e.i(167881),v=e.i(23750),j=e.i(917162),k=e.i(818125),b=e.i(671428),w=e.i(41533),N=e.i(412294),S=e.i(458898),C=e.i(146538),A=e.i(968978),M=e.i(265402),E=e.i(635963),R=e.i(616816),I=e.i(95187);let F=(0,I.createServerReference)("7f2fffeb7b95d58f7a40d5640e34546b9faff75c1e",I.callServer,void 0,I.findSourceMapURL,"removeConfigAction");var z=e.i(584923),T=e.i(992112),P=e.i(508734),K=e.i(482022),_=e.i(96315),$=((t=$||{})[t.Border=-1]="Border",t[t.Data=0]="Data",t[t.Function=1]="Function",t[t.Position=2]="Position",t[t.Timing=3]="Timing",t[t.Alignment=4]="Alignment",t);let O=[1,0],B=[2,3],L=[3,2],q={L:[0,1],M:O,Q:B,H:L},D=/^\d*$/,H=/^[A-Z0-9 $%*+./:-]*$/,W="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",U=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Y=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];class G{constructor(e,t,n,s){if(this.version=e,this.ecc=t,e<1||e>40)throw RangeError("Version value out of range");if(s<-1||s>7)throw RangeError("Mask value out of range");this.size=4*e+17;const r=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(r.slice()),this.types.push(r.map(()=>0));this.drawFunctionPatterns();const i=this.addEccAndInterleave(n);if(this.drawCodewords(i),-1===s){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);const n=this.getPenaltyScore();n<e&&(s=t,e=n),this.applyMask(t)}}this.mask=s,this.applyMask(s),this.drawFormatBits(s)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,$.Timing),this.setFunctionModule(e,6,e%2==0,$.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let s=0;s<t;s++)(0!==n||0!==s)&&(0!==n||s!==t-1)&&(n!==t-1||0!==s)&&this.drawAlignmentPattern(e[n],e[s]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let s=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,Q(s,e));this.setFunctionModule(8,7,Q(s,6)),this.setFunctionModule(8,8,Q(s,7)),this.setFunctionModule(7,8,Q(s,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,Q(s,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,Q(s,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,Q(s,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=Q(t,e),s=this.size-11+e%3,r=Math.floor(e/3);this.setFunctionModule(s,r,n),this.setFunctionModule(r,s,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let s=-4;s<=4;s++){let r=Math.max(Math.abs(s),Math.abs(n)),i=e+s,a=t+n;i>=0&&i<this.size&&a>=0&&a<this.size&&this.setFunctionModule(i,a,2!==r&&4!==r,$.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let s=-2;s<=2;s++)this.setFunctionModule(e+s,t+n,1!==Math.max(Math.abs(s),Math.abs(n)),$.Alignment)}setFunctionModule(e,t,n,s=$.Function){this.modules[t][e]=n,this.types[t][e]=s}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==er(t,n))throw RangeError("Invalid argument");let s=Y[n[0]][t],r=U[n[0]][t],i=Math.floor(es(t)/8),a=s-i%s,o=Math.floor(i/s),l=[],d=function(e){if(e<1||e>255)throw RangeError("Degree out of range");let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let s=0;s<e;s++){for(let e=0;e<t.length;e++)t[e]=ei(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=ei(n,2)}return t}(r);for(let t=0,n=0;t<s;t++){let s=e.slice(n,n+o-r+(t<a?0:1));n+=s.length;let i=function(e,t){let n=t.map(e=>0);for(let s of e){let e=s^n.shift();n.push(0),t.forEach((t,s)=>n[s]^=ei(t,e))}return n}(s,d);t<a&&s.push(0),l.push(s.concat(i))}let c=[];for(let e=0;e<l[0].length;e++)l.forEach((t,n)=>{(e!==o-r||n>=a)&&c.push(t[e])});return c}drawCodewords(e){if(e.length!==Math.floor(es(this.version)/8))throw RangeError("Invalid argument");let t=0;for(let n=this.size-1;n>=1;n-=2){6===n&&(n=5);for(let s=0;s<this.size;s++)for(let r=0;r<2;r++){let i=n-r,a=(n+1&2)==0?this.size-1-s:s;!this.types[a][i]&&t<8*e.length&&(this.modules[a][i]=Q(e[t>>>3],7-(7&t)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError("Mask value out of range");for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let s;switch(e){case 0:s=(n+t)%2==0;break;case 1:s=t%2==0;break;case 2:s=n%3==0;break;case 3:s=(n+t)%3==0;break;case 4:s=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:s=n*t%2+n*t%3==0;break;case 6:s=(n*t%2+n*t%3)%2==0;break;case 7:s=((n+t)%2+n*t%3)%2==0;break;default:throw Error("Unreachable")}!this.types[t][n]&&s&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,s=0,r=[0,0,0,0,0,0,0];for(let i=0;i<this.size;i++)this.modules[t][i]===n?5==++s?e+=3:s>5&&e++:(this.finderPenaltyAddHistory(s,r),n||(e+=40*this.finderPenaltyCountPatterns(r)),n=this.modules[t][i],s=1);e+=40*this.finderPenaltyTerminateAndCount(n,s,r)}for(let t=0;t<this.size;t++){let n=!1,s=0,r=[0,0,0,0,0,0,0];for(let i=0;i<this.size;i++)this.modules[i][t]===n?5==++s?e+=3:s>5&&e++:(this.finderPenaltyAddHistory(s,r),n||(e+=40*this.finderPenaltyCountPatterns(r)),n=this.modules[i][t],s=1);e+=40*this.finderPenaltyTerminateAndCount(n,s,r)}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let s=this.modules[t][n];s===this.modules[t][n+1]&&s===this.modules[t+1][n]&&s===this.modules[t+1][n+1]&&(e+=3)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size;return e+(Math.ceil(Math.abs(20*t-10*n)/n)-1)*10}getAlignmentPatternPositions(){if(1===this.version)return[];{let e=Math.floor(this.version/7)+2,t=32===this.version?26:2*Math.ceil((4*this.version+4)/(2*e-2)),n=[6];for(let s=this.size-7;n.length<e;s-=t)n.splice(1,0,s);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===3*t&&e[4]===t&&e[5]===t;return(n&&e[0]>=4*t&&e[6]>=t?1:0)+(n&&e[6]>=4*t&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){0===t[0]&&(e+=this.size),t.pop(),t.unshift(e)}}function V(e,t,n){if(t<0||t>31||e>>>t!=0)throw RangeError("Value out of range");for(let s=t-1;s>=0;s--)n.push(e>>>s&1)}function Q(e,t){return(e>>>t&1)!=0}class X{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError("Invalid argument");this.bitData=n.slice()}getData(){return this.bitData.slice()}}let Z=[1,10,12,14],J=[2,9,11,13],ee=[4,8,16,16];function et(e,t){return e[Math.floor((t+7)/17)+1]}function en(e){let t=[];for(let n of e)V(n,8,t);return new X(ee,e.length,t)}function es(e){if(e<1||e>40)throw RangeError("Version number out of range");let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function er(e,t){return Math.floor(es(e)/8)-U[t[0]][e]*Y[t[0]][e]}function ei(e,t){if(e>>>8!=0||t>>>8!=0)throw RangeError("Byte out of range");let n=0;for(let s=7;s>=0;s--)n=n<<1^(n>>>7)*285^(t>>>s&1)*e;return n}var ea=e.i(511769),eo=e.i(660302),el=e.i(895836),ed=e.i(609856),ec=e.i(283653),eu=e.i(647163);let eh=(0,I.createServerReference)("7f8302f47540e585f35860c765976f6594c8873dce",I.callServer,void 0,I.findSourceMapURL,"forgetReachAction"),em=(0,I.createServerReference)("7f990067523e6b9af18d4b572e74a368e5088318f6",I.callServer,void 0,I.findSourceMapURL,"nameReachAction"),ef=(0,I.createServerReference)("7fa66a603bd3b23600dbfb91095f34b0b132ddea79",I.callServer,void 0,I.findSourceMapURL,"removeMailboxAction"),ex=(0,I.createServerReference)("7fc8e63117d6fb7efd91c23b297209306551f572ef",I.callServer,void 0,I.findSourceMapURL,"saveMailboxAction");var ep=e.i(36174);let eg={telegram:"telegram.org",discord:"discord.com",slack:"slack.com"},ey=`display_information:
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,805995,e=>{"use strict";var t,n=e.i(843476),s=e.i(493801),r=e.i(375775),i=e.i(422411),a=e.i(525335),o=e.i(689664),l=e.i(867927),d=e.i(456420);let c={name:"clapperboard",size:24,node:[["path",{d:"m12.296 3.464 3.02 3.956",key:"qash78"}],["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z",key:"1h7j8b"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"4lm6w1"}],["path",{d:"m6.18 5.276 3.1 3.899",key:"zjj9t3"}]]};c.node;let u=(0,d.default)(c);var h=e.i(815170),m=e.i(758925),f=e.i(566595),x=e.i(466787),p=e.i(271645),g=e.i(798120),y=e.i(167881),v=e.i(23750),j=e.i(917162),b=e.i(818125),k=e.i(671428),w=e.i(41533),N=e.i(412294),S=e.i(458898),C=e.i(146538),A=e.i(968978),M=e.i(265402),E=e.i(635963),R=e.i(616816),I=e.i(95187);let F=(0,I.createServerReference)("7f8d3779f43ef17ff5f82f7664bb019983ff84e076",I.callServer,void 0,I.findSourceMapURL,"removeConfigAction");var z=e.i(247632),T=e.i(992112),P=e.i(508734),K=e.i(482022),_=e.i(96315),$=((t=$||{})[t.Border=-1]="Border",t[t.Data=0]="Data",t[t.Function=1]="Function",t[t.Position=2]="Position",t[t.Timing=3]="Timing",t[t.Alignment=4]="Alignment",t);let O=[1,0],B=[2,3],L=[3,2],q={L:[0,1],M:O,Q:B,H:L},D=/^\d*$/,H=/^[A-Z0-9 $%*+./:-]*$/,W="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",U=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Y=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];class G{constructor(e,t,n,s){if(this.version=e,this.ecc=t,e<1||e>40)throw RangeError("Version value out of range");if(s<-1||s>7)throw RangeError("Mask value out of range");this.size=4*e+17;const r=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(r.slice()),this.types.push(r.map(()=>0));this.drawFunctionPatterns();const i=this.addEccAndInterleave(n);if(this.drawCodewords(i),-1===s){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);const n=this.getPenaltyScore();n<e&&(s=t,e=n),this.applyMask(t)}}this.mask=s,this.applyMask(s),this.drawFormatBits(s)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,$.Timing),this.setFunctionModule(e,6,e%2==0,$.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let s=0;s<t;s++)(0!==n||0!==s)&&(0!==n||s!==t-1)&&(n!==t-1||0!==s)&&this.drawAlignmentPattern(e[n],e[s]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let s=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,Q(s,e));this.setFunctionModule(8,7,Q(s,6)),this.setFunctionModule(8,8,Q(s,7)),this.setFunctionModule(7,8,Q(s,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,Q(s,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,Q(s,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,Q(s,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=Q(t,e),s=this.size-11+e%3,r=Math.floor(e/3);this.setFunctionModule(s,r,n),this.setFunctionModule(r,s,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let s=-4;s<=4;s++){let r=Math.max(Math.abs(s),Math.abs(n)),i=e+s,a=t+n;i>=0&&i<this.size&&a>=0&&a<this.size&&this.setFunctionModule(i,a,2!==r&&4!==r,$.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let s=-2;s<=2;s++)this.setFunctionModule(e+s,t+n,1!==Math.max(Math.abs(s),Math.abs(n)),$.Alignment)}setFunctionModule(e,t,n,s=$.Function){this.modules[t][e]=n,this.types[t][e]=s}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==er(t,n))throw RangeError("Invalid argument");let s=Y[n[0]][t],r=U[n[0]][t],i=Math.floor(es(t)/8),a=s-i%s,o=Math.floor(i/s),l=[],d=function(e){if(e<1||e>255)throw RangeError("Degree out of range");let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let s=0;s<e;s++){for(let e=0;e<t.length;e++)t[e]=ei(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=ei(n,2)}return t}(r);for(let t=0,n=0;t<s;t++){let s=e.slice(n,n+o-r+(t<a?0:1));n+=s.length;let i=function(e,t){let n=t.map(e=>0);for(let s of e){let e=s^n.shift();n.push(0),t.forEach((t,s)=>n[s]^=ei(t,e))}return n}(s,d);t<a&&s.push(0),l.push(s.concat(i))}let c=[];for(let e=0;e<l[0].length;e++)l.forEach((t,n)=>{(e!==o-r||n>=a)&&c.push(t[e])});return c}drawCodewords(e){if(e.length!==Math.floor(es(this.version)/8))throw RangeError("Invalid argument");let t=0;for(let n=this.size-1;n>=1;n-=2){6===n&&(n=5);for(let s=0;s<this.size;s++)for(let r=0;r<2;r++){let i=n-r,a=(n+1&2)==0?this.size-1-s:s;!this.types[a][i]&&t<8*e.length&&(this.modules[a][i]=Q(e[t>>>3],7-(7&t)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError("Mask value out of range");for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let s;switch(e){case 0:s=(n+t)%2==0;break;case 1:s=t%2==0;break;case 2:s=n%3==0;break;case 3:s=(n+t)%3==0;break;case 4:s=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:s=n*t%2+n*t%3==0;break;case 6:s=(n*t%2+n*t%3)%2==0;break;case 7:s=((n+t)%2+n*t%3)%2==0;break;default:throw Error("Unreachable")}!this.types[t][n]&&s&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,s=0,r=[0,0,0,0,0,0,0];for(let i=0;i<this.size;i++)this.modules[t][i]===n?5==++s?e+=3:s>5&&e++:(this.finderPenaltyAddHistory(s,r),n||(e+=40*this.finderPenaltyCountPatterns(r)),n=this.modules[t][i],s=1);e+=40*this.finderPenaltyTerminateAndCount(n,s,r)}for(let t=0;t<this.size;t++){let n=!1,s=0,r=[0,0,0,0,0,0,0];for(let i=0;i<this.size;i++)this.modules[i][t]===n?5==++s?e+=3:s>5&&e++:(this.finderPenaltyAddHistory(s,r),n||(e+=40*this.finderPenaltyCountPatterns(r)),n=this.modules[i][t],s=1);e+=40*this.finderPenaltyTerminateAndCount(n,s,r)}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let s=this.modules[t][n];s===this.modules[t][n+1]&&s===this.modules[t+1][n]&&s===this.modules[t+1][n+1]&&(e+=3)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size;return e+(Math.ceil(Math.abs(20*t-10*n)/n)-1)*10}getAlignmentPatternPositions(){if(1===this.version)return[];{let e=Math.floor(this.version/7)+2,t=32===this.version?26:2*Math.ceil((4*this.version+4)/(2*e-2)),n=[6];for(let s=this.size-7;n.length<e;s-=t)n.splice(1,0,s);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===3*t&&e[4]===t&&e[5]===t;return(n&&e[0]>=4*t&&e[6]>=t?1:0)+(n&&e[6]>=4*t&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){0===t[0]&&(e+=this.size),t.pop(),t.unshift(e)}}function V(e,t,n){if(t<0||t>31||e>>>t!=0)throw RangeError("Value out of range");for(let s=t-1;s>=0;s--)n.push(e>>>s&1)}function Q(e,t){return(e>>>t&1)!=0}class X{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError("Invalid argument");this.bitData=n.slice()}getData(){return this.bitData.slice()}}let Z=[1,10,12,14],J=[2,9,11,13],ee=[4,8,16,16];function et(e,t){return e[Math.floor((t+7)/17)+1]}function en(e){let t=[];for(let n of e)V(n,8,t);return new X(ee,e.length,t)}function es(e){if(e<1||e>40)throw RangeError("Version number out of range");let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function er(e,t){return Math.floor(es(e)/8)-U[t[0]][e]*Y[t[0]][e]}function ei(e,t){if(e>>>8!=0||t>>>8!=0)throw RangeError("Byte out of range");let n=0;for(let s=7;s>=0;s--)n=n<<1^(n>>>7)*285^(t>>>s&1)*e;return n}var ea=e.i(511769),eo=e.i(660302),el=e.i(895836),ed=e.i(609856),ec=e.i(283653),eu=e.i(647163);let eh=(0,I.createServerReference)("7f0e7f0495206b1b3d8038b9f86e9ba0bfb1d27998",I.callServer,void 0,I.findSourceMapURL,"forgetReachAction"),em=(0,I.createServerReference)("7f118d18e9f31fe6fcfc97cf512d5aca110223e4e4",I.callServer,void 0,I.findSourceMapURL,"nameReachAction"),ef=(0,I.createServerReference)("7fe188c45bf6be2ca2e2a38db06e5ad0b1b3ba5fea",I.callServer,void 0,I.findSourceMapURL,"removeMailboxAction"),ex=(0,I.createServerReference)("7f77f8e13d63cbd8339276eee6de9b67f2177687f1",I.callServer,void 0,I.findSourceMapURL,"saveMailboxAction");var ep=e.i(36174);let eg={telegram:"telegram.org",discord:"discord.com",slack:"slack.com"},ey=`display_information:
2
2
  name: Thursday
3
3
  features:
4
4
  app_home:
@@ -15,4 +15,4 @@ settings:
15
15
  interactivity:
16
16
  is_enabled: true
17
17
  socket_mode_enabled: true
18
- `,ev=({href:e,children:t})=>(0,n.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",className:"font-medium text-foreground underline underline-offset-4 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:t}),ej=({children:e})=>(0,n.jsx)("span",{className:"font-medium text-foreground",children:e}),ek={telegram:[{body:(0,n.jsxs)(n.Fragment,{children:["In Telegram, write to ",(0,n.jsx)(ej,{children:"@BotFather"}),", send ",(0,n.jsx)(ej,{children:"/newbot"})," and pick a name. It answers with a ",(0,n.jsx)(ej,{children:"token"}),"."]}),slot:{open:"https://t.me/BotFather",label:"Open @BotFather"}},{body:(0,n.jsx)(n.Fragment,{children:"Paste the token here."}),slot:{key:ep.TELEGRAM_TOKEN_KEY,looks:"123456789:AAE…"}},{body:(0,n.jsx)(n.Fragment,{children:"From your phone, write anything to your bot."}),slot:{says:"Point your phone's camera at it to open the chat."}},{body:(0,n.jsxs)(n.Fragment,{children:["A question with a code appears on this computer. Press ",(0,n.jsx)(ej,{children:"Allow"})," if your phone shows the same code."]})}],discord:[{body:(0,n.jsxs)(n.Fragment,{children:["At ",(0,n.jsx)(ej,{children:"discord.com/developers"}),", make a ",(0,n.jsx)(ej,{children:"New Application"}),". So nobody else can add it to a server, set ",(0,n.jsx)(ej,{children:"Install Link"})," to"," ",(0,n.jsx)(ej,{children:"None"})," on its ",(0,n.jsx)(ej,{children:"Installation"})," page and turn off"," ",(0,n.jsx)(ej,{children:"Public Bot"})," on its ",(0,n.jsx)(ej,{children:"Bot"})," page. There, press"," ",(0,n.jsx)(ej,{children:"Reset Token"})," and copy it."]}),slot:{open:"https://discord.com/developers/applications",label:"Open discord.com/developers"}},{body:(0,n.jsx)(n.Fragment,{children:"Paste the token here."}),slot:{key:ep.DISCORD_TOKEN_KEY,looks:"MTE…"}},{body:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ej,{children:"Add the bot to a server of your own"})," — Discord only delivers a message to a bot you share a server with. A private server made for this is fine."]}),slot:{says:"Point your phone's camera at it, or open it here. It asks which server, and adds the bot with no permissions in it.",does:"Add the bot to a server"}},{body:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ej,{children:"Send the bot a direct message"}),", not in the server: on a phone, tap the bot in the server's member list, then ",(0,n.jsx)(ej,{children:"Message"}),". A question with a code appears here: press ",(0,n.jsx)(ej,{children:"Allow"})," if your phone shows the same code."]})}],slack:[{body:(0,n.jsxs)(n.Fragment,{children:["At ",(0,n.jsx)(ev,{href:"https://api.slack.com/apps",children:"api.slack.com/apps"}),","," ",(0,n.jsx)(ej,{children:"Create New App › From a manifest"}),", and paste the manifest."]}),slot:{manifest:!0}},{body:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ej,{children:"Basic Information › App-Level Tokens"}),": generate one with"," ",(0,n.jsx)(ej,{children:"connections:write"}),". It starts with xapp-."]}),slot:{key:ep.SLACK_APP_TOKEN_KEY,looks:"xapp-…"}},{body:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ej,{children:"Install App"})," to your workspace. The Bot User OAuth Token starts with xoxb-."]}),slot:{key:ep.SLACK_BOT_TOKEN_KEY,looks:"xoxb-…"}},{body:(0,n.jsxs)(n.Fragment,{children:["In Slack, open the app under ",(0,n.jsx)(ej,{children:"Apps"})," and write in its"," ",(0,n.jsx)(ej,{children:"Messages"})," tab. A question with a code appears here: press"," ",(0,n.jsx)(ej,{children:"Allow"})," if Slack shows the same code."]})}],email:[{body:(0,n.jsxs)(n.Fragment,{children:["Make a ",(0,n.jsx)(ej,{children:"mailbox of her own"})," — a new account at a mail service that gives app passwords (Outlook no longer does). Turn on"," ",(0,n.jsx)(ej,{children:"two-step sign-in"})," there and create an ",(0,n.jsx)(ej,{children:"app password"})," for Thursday: how on"," ",(0,n.jsx)(ev,{href:"https://support.google.com/accounts/answer/185833",children:"Gmail"}),", ",(0,n.jsx)(ev,{href:"https://support.apple.com/en-us/102654",children:"iCloud"}),","," ",(0,n.jsx)(ev,{href:"https://www.fastmail.help/hc/en-us/articles/360058752854-App-passwords",children:"Fastmail"}),". Your own inbox stays out of it."]})},{body:(0,n.jsx)(n.Fragment,{children:"Her address and the app password."}),slot:{mailbox:!0}},{body:(0,n.jsx)(n.Fragment,{children:"Your own address. Only mail from it reaches her, and only once its mail service vouches it was sent from there."}),slot:{person:!0}},{body:(0,n.jsx)(n.Fragment,{children:"From your address, write anything to hers. She answers in the same thread."}),slot:{write:!0}}]};function eb(){let e=(0,ec.useServerRoute)(g.queryKey.config),t=(0,ec.useServerRoute)(g.queryKey.reach);(0,ea.useAppEvent)({reach:()=>void(0,ec.revalidate)(g.queryKey.reach)});let s=t=>(0,T.isConfigSet)(e.data,t),r=t=>(0,T.isConfigUnreadable)(e.data,t),i=e=>t.data?.channels.find(t=>t.name===e)??null,a=e=>!!i(e)?.allowed,o=ep.REACH_CHANNELS.find(e=>i(e)?.refused||ep.REACH_KEYS[e].some(r)),l=ep.REACH_CHANNELS.find(e=>("email"===e?!!i(e)?.mailbox:ep.REACH_KEYS[e].every(s))&&!a(e)),d=!ep.REACH_CHANNELS.some(a),[c,u]=(0,p.useState)(o??l??(d?ep.REACH_CHANNELS[0]:null));return(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(el.SettingItems,{children:ep.REACH_CHANNELS.map(e=>(0,n.jsx)(ew,{name:e,status:i(e),tokensIn:ep.REACH_KEYS[e].filter(s).length,isSet:s,isLost:r,open:c===e,onOpen:()=>u(c===e?null:e)},e))}),(0,n.jsx)(el.SettingNote,{children:"Only the one person you allow can write: direct messages in a chat app, and by email only mail from the address you name. Nobody else is ever written back to. Work started here runs whether or not a tab is open, while Thursday is running on this computer."})]})}function ew({name:e,status:t,tokensIn:s,isSet:r,isLost:i,open:a,onOpen:o}){var d,c;let u,h,f,x,p,g=ek[e],y=t?.refused??null,v="email"===e,j=v?[(u=(d={mailbox:!!t?.mailbox,stopped:!!y||i(ep.EMAIL_PASSWORD_KEY),named:!!t?.allowed,connected:!!t?.bot}).mailbox&&!d.stopped)?"done":"flat",u?"done":"now",u?d.named?"done":"now":"later",u&&d.named&&d.connected?"flat":"later"]:(c={connected:!!t?.bot,allowed:!!t?.allowed,refused:y},h=g.map(e=>e.slot&&"key"in e.slot?e.slot.key:null),f=e=>!r(e)||e===c.refused,x=h.findIndex(e=>e&&f(e)),p=h.reduce((e,t,n)=>t?n:e,-1),g.map((e,t)=>{let n=h[t];return n?f(n)?t===x?"now":"later":"done":x>=0?t<x?c.refused?"done":"flat":"later":c.allowed||t<p?"done":c.connected?"now":"flat"})),b=!v&&!!t?.bot&&!t?.allowed&&!y;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{type:"button",onClick:o,"aria-expanded":a,className:"flex w-full items-center gap-3 px-4 py-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[v?(0,n.jsx)(_.Mail,{className:"size-4 text-muted-foreground"}):(0,n.jsx)(k.SiteIcon,{host:eg[e],className:"size-4 rounded-[4px]",fallback:(0,n.jsx)(m.KeyRound,{className:"size-4 text-muted-foreground"})}),(0,n.jsx)("span",{className:"text-sm font-medium",children:ep.REACH_LABEL[e]}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:v?(0,n.jsx)(eS,{status:t,lost:i(ep.EMAIL_PASSWORD_KEY)}):(0,n.jsx)(eN,{status:t,tokensIn:s,tokens:ep.REACH_KEYS[e].length,lost:ep.REACH_KEYS[e].some(i)})}),(0,n.jsx)(l.ChevronRight,{className:(0,eu.cn)("size-4 shrink-0 text-muted-foreground transition-transform",a&&"rotate-90")})]}),a&&(0,n.jsxs)("div",{className:"px-4 pt-1 pb-4",children:[(0,n.jsx)("ol",{className:"space-y-3",children:g.map((e,s)=>(0,n.jsx)(eC,{n:s+1,step:e,state:j[s],set:!!e.slot&&"key"in e.slot&&r(e.slot.key),lost:!!e.slot&&"key"in e.slot&&i(e.slot.key),refused:e.slot&&"key"in e.slot&&e.slot.key===y?t?.problem??"":e.slot&&"key"in e.slot&&i(e.slot.key)?(0,T.lostWords)("The token saved here","Paste it again."):null,link:t?.link??null,waiting:b&&s===g.length-1,status:t,lostPassword:v&&i(ep.EMAIL_PASSWORD_KEY)},s))}),t?.allowed&&!v&&(0,n.jsx)(eT,{name:e,who:t.allowed.name,stopped:!!y})]})]})}function eN({status:e,tokensIn:t,tokens:s,lost:r}){let i="text-xs";return r?(0,n.jsx)("span",{className:(0,eu.cn)(i,"text-destructive"),children:"Stopped — the saved token can't be unlocked any more"}):t<s?(0,n.jsx)("span",{className:(0,eu.cn)(i,"text-muted-foreground"),children:t?`${t} of ${s} tokens in`:"Not set"}):e?.refused?(0,n.jsxs)("span",{className:(0,eu.cn)(i,"text-destructive"),children:["Stopped — ",ep.REACH_LABEL[e.name]," turned the token away"]}):e?.problem?(0,n.jsx)(eo.ShinyText,{text:`${e.bot?"Reconnecting":"Connecting"} ${e.problem}`,className:(0,eu.cn)(i,"align-middle")}):e?.allowed?(0,n.jsxs)("span",{className:(0,eu.cn)(i,"text-muted-foreground"),children:["Listening as ",e.bot,". ",e.allowed.name," is let in."]}):e?.bot?(0,n.jsx)(eo.ShinyText,{text:`Listening as ${e.bot} — waiting for your first message`,tone:"waiting",className:(0,eu.cn)(i,"align-middle")}):(0,n.jsx)(eo.ShinyText,{text:"Connecting…",className:(0,eu.cn)(i,"align-middle")})}function eS({status:e,lost:t}){let s="text-xs";return t?(0,n.jsx)("span",{className:(0,eu.cn)(s,"text-destructive"),children:"Stopped — the saved app password can't be unlocked any more"}):e?.mailbox?e.refused?(0,n.jsx)("span",{className:(0,eu.cn)(s,"text-destructive"),children:"Stopped — the mail service turned her mailbox's sign-in away"}):e.problem?(0,n.jsx)(eo.ShinyText,{text:`${e.bot?"Reconnecting":"Connecting"} ${e.problem}`,className:(0,eu.cn)(s,"align-middle")}):e.bot?e.holding?(0,n.jsx)(eo.ShinyText,{text:`Listening as ${e.bot} — a mail is held: ${e.holding}`,className:(0,eu.cn)(s,"align-middle")}):e.allowed?(0,n.jsxs)("span",{className:(0,eu.cn)(s,"text-muted-foreground"),children:["Listening as ",e.bot,". ",e.allowed.name," can write."]}):(0,n.jsx)(eo.ShinyText,{text:`Listening as ${e.bot} — name your own address`,tone:"waiting",className:(0,eu.cn)(s,"align-middle")}):(0,n.jsx)(eo.ShinyText,{text:"Connecting…",className:(0,eu.cn)(s,"align-middle")}):(0,n.jsx)("span",{className:(0,eu.cn)(s,"text-muted-foreground"),children:"Not set"})}function eC({n:e,step:t,state:s,set:r,lost:i,refused:a,link:o,waiting:l,status:d,lostPassword:c}){return(0,n.jsxs)("li",{className:"flex gap-3 text-[13px] leading-relaxed",children:[(0,n.jsx)(eA,{n:e,state:s}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-2.5",children:[(0,n.jsx)("p",{className:(0,eu.cn)("done"===s||"later"===s?"text-muted-foreground/60 **:text-inherit":"text-muted-foreground"),children:t.body}),(0,n.jsx)(eM,{slot:t.slot,state:s,set:r,lost:i,refused:a,link:o,waiting:l,status:d,lostPassword:c})]})]})}function eA({n:e,state:t}){return"done"===t?(0,n.jsx)("span",{className:"mt-0.5 grid size-5 shrink-0 place-items-center rounded-full bg-foreground text-background",children:(0,n.jsx)(o.Check,{className:"size-3"})}):(0,n.jsx)("span",{className:(0,eu.cn)("mt-0.5 grid size-5 shrink-0 place-items-center rounded-full bg-background font-mono text-[10.5px] ring-1","now"===t?(0,eu.cn)(eu.WAITING_INK,"ring-waiting/40"):"text-muted-foreground ring-border/60","later"===t&&"opacity-60"),children:e})}function eM({slot:e,state:t,set:s,lost:r,refused:i,link:a,waiting:o,status:l,lostPassword:d}){let c=o&&(0,n.jsx)(eo.ShinyText,{text:"Waiting for your first message…",tone:"waiting"});return"later"===t?null:e&&"mailbox"in e?(0,n.jsx)(eK,{mailbox:l?.mailbox??null,refused:l?.refused?l.problem??"":d?(0,T.lostWords)("The app password saved here","Save her mailbox again."):null}):e&&"person"in e?(0,n.jsx)(e$,{who:l?.allowed?.chat??null}):e&&"write"in e?l?.mailbox?(0,n.jsx)(eO,{address:l.mailbox.address}):null:e&&"key"in e?(0,n.jsx)(eF,{configKey:e.key,looks:e.looks,set:s,lost:r,refused:i}):"done"===t?e&&"says"in e&&a?(0,n.jsx)(eI,{href:a,children:e.does??eR(a)}):null:e?"open"in e?(0,n.jsx)(eI,{href:e.open,children:e.label}):"manifest"in e?(0,n.jsx)(ez,{}):a?(0,n.jsxs)("div",{className:"space-y-2.5",children:[(0,n.jsx)(eE,{link:a,says:e.says,does:e.does}),c]}):c||null:c||null}function eE({link:e,says:t,does:s}){let{size:r,data:i}=function(e){let{ecc:t="L",boostEcc:n=!1,minVersion:s=1,maxVersion:r=40,maskPattern:i=-1,border:a=1}={},o="string"==typeof e?function(e){var t,n;if(""===e)return[];if(t=e,D.test(t))return[function(e){var t;if(t=e,!D.test(t))throw RangeError("String contains non-numeric characters");let n=[];for(let t=0;t<e.length;){let s=Math.min(e.length-t,3);V(Number.parseInt(e.substring(t,t+s),10),3*s+1,n),t+=s}return new X(Z,e.length,n)}(e)];return(n=e,H.test(n))?[function(e){var t;let n;if(t=e,!H.test(t))throw RangeError("String contains unencodable characters in alphanumeric mode");let s=[];for(n=0;n+2<=e.length;n+=2){let t=45*W.indexOf(e.charAt(n));V(t+=W.indexOf(e.charAt(n+1)),11,s)}return n<e.length&&V(W.indexOf(e.charAt(n)),6,s),new X(J,e.length,s)}(e)]:[en(function(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)"%"!==e.charAt(n)?t.push(e.charCodeAt(n)):(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2);return t}(e))]}(e):Array.isArray(e)?[en(e)]:void 0;if(!o)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=function(e,t,n=1,s=40,r=-1,i=!0){let a,o;if(!(1<=n&&n<=s&&s<=40)||r<-1||r>7)throw RangeError("Invalid value");for(a=n;;a++){let n=8*er(a,t),r=function(e,t){let n=0;for(let s of e){let e=et(s.mode,t);if(s.numChars>=1<<e)return 1/0;n+=4+e+s.bitData.length}return n}(e,a);if(r<=n){o=r;break}if(a>=s)throw RangeError("Data too long")}for(let e of[O,B,L])i&&o<=8*er(a,e)&&(t=e);let l=[];for(let t of e)for(let e of(V(t.mode[0],4,l),V(t.numChars,et(t.mode,a),l),t.getData()))l.push(e);let d=8*er(a,t);V(0,Math.min(4,d-l.length),l),V(0,(8-l.length%8)%8,l);for(let e=236;l.length<d;e^=253)V(e,8,l);let c=Array.from({length:Math.ceil(l.length/8)},()=>0);return l.forEach((e,t)=>c[t>>>3]|=e<<7-(7&t)),new G(a,t,c,r)}(o,q[t],s,r,i,n);return function(e,t=1){if(!t)return e;let{size:n}=e,s=n+2*t;e.size=s,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:s},e=>!1)),e.data.push(Array.from({length:s},e=>!1));let r=$.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(r),e.push(r)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:s},e=>r)),e.types.push(Array.from({length:s},e=>r));return e}({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},a)}(e),a=eR(e);return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,n.jsx)("div",{className:"rounded-lg bg-white p-2.5",children:(0,n.jsx)("svg",{viewBox:`0 0 ${r} ${r}`,className:"block size-31 text-black",role:"img","aria-label":`A picture of ${a} for a phone camera`,children:i.flatMap((e,t)=>e.map((e,s)=>e?(0,n.jsx)("rect",{x:s,y:t,width:1,height:1,fill:"currentColor"},`${s}-${t}`):null))})}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("p",{className:"text-muted-foreground",children:t}),(0,n.jsx)(eI,{href:e,children:s??a})]})]})}let eR=e=>e.replace(/^https:\/\//,"");function eI({href:e,children:t}){return(0,n.jsxs)("a",{href:e,target:"_blank",rel:"noreferrer",className:(0,eu.cn)((0,y.buttonVariants)({variant:"outline",size:"sm"})),children:[(0,n.jsx)(K.ExternalLink,{}),t]})}function eF({configKey:e,looks:t,set:s,lost:r,refused:i}){let[a,o]=(0,p.useState)(""),[l,d]=(0,p.useState)(!1),{data:c}=(0,ec.useServerRoute)(g.queryKey.config),u=(0,T.isConfigFromEnv)(c,e),h=()=>{o(""),d(!1),(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.reach)},[m,f]=(0,ed.useServerAction)(z.setConfigAction,{onOk:h}),[x,k]=(0,ed.useServerAction)(F,{onOk:h}),b=async()=>{await j.notify.confirm({title:"Remove this token?",description:"That service stops, and whoever is let in is let go.",okText:"Remove",destructive:!0})&&x(e)};return u?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"max-w-xl text-muted-foreground",children:(0,T.envWords)(T.CONFIG_ENTRIES[e]?.label??e)}),i&&(0,n.jsx)("p",{className:"max-w-xl text-destructive",children:i})]}):s&&!l&&null===i?(0,n.jsx)(y.Button,{size:"xs",variant:"ghost",onClick:()=>d(!0),className:"-ml-2 text-muted-foreground",children:"Change the token"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("form",{className:"flex flex-wrap items-center gap-2",onSubmit:t=>{t.preventDefault(),m(e,a)},children:[(0,n.jsx)(v.Input,{value:a,onChange:e=>o(e.target.value),placeholder:t,"aria-label":"Token",type:"password",autoComplete:"off",spellCheck:!1,className:"w-72 font-mono"}),(0,n.jsx)(y.Button,{type:"submit",size:"sm",loading:f,disabled:a.trim().length<w.KEY_MIN,children:s?"Replace":"Save"}),(s||r)&&(0,n.jsxs)(n.Fragment,{children:[null===i&&(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",onClick:()=>d(!1),children:"Cancel"}),(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",loading:k,onClick:()=>void b(),className:"ml-auto text-destructive hover:text-destructive",children:"Remove"})]})]}),i&&(0,n.jsx)("p",{className:"max-w-xl text-destructive",children:i})]})}function ez(){let[e,t]=(0,p.useState)(!1);return(0,n.jsxs)(y.Button,{size:"sm",variant:"outline",onClick:()=>void navigator.clipboard.writeText(ey).then(()=>{t(!0),setTimeout(()=>t(!1),2e3)}),children:[e?(0,n.jsx)(o.Check,{}):(0,n.jsx)(P.Copy,{}),e?"Copied":"Copy the manifest"]})}function eT({name:e,who:t,stopped:s}){let[r,i]=(0,ed.useServerAction)(eh,{onOk:()=>(0,ec.revalidate)(g.queryKey.reach)});return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pt-3 pl-8 text-[13px] text-muted-foreground",children:[(0,n.jsx)("span",{children:s?`${t} is let in.`:`${t} can write from a phone.`}),(0,n.jsx)(y.Button,{size:"sm",variant:"outline",loading:i,onClick:async()=>{await j.notify.confirm({title:`Let ${t} go?`,description:"Nobody can write to Thursday through this service until someone is let in again.",okText:"Let them go",destructive:!0})&&r(e)},children:"Let them go"})]})}let eP=(e,t)=>{let n=e?.lastIndexOf(":")??-1;return n>0&&e?{host:e.slice(0,n),port:e.slice(n+1)}:{host:"",port:String(t)}};function eK({mailbox:e,refused:t}){let[s,r]=(0,p.useState)(!1),[i,a]=(0,p.useState)(e?.address??""),[o,l]=(0,p.useState)(""),[d,c]=(0,p.useState)(!1),[u,h]=(0,p.useState)(()=>eP(void 0,993)),[m,f]=(0,p.useState)(()=>eP(void 0,465)),{data:x}=(0,ec.useServerRoute)(g.queryKey.config),k=()=>{l(""),r(!1),c(!1),(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.reach)},[b,w]=(0,ed.useServerAction)(ex,{onOk:e=>{if(e?.found)return k();c(!0)}}),[N,S]=(0,ed.useServerAction)(ef,{onOk:k}),C=async()=>{await j.notify.confirm({title:"Remove her mailbox?",description:"Email stops, and the address that could write is let go. The mailbox itself is not touched.",okText:"Remove",destructive:!0})&&N()};if((0,T.isConfigFromEnv)(x,ep.EMAIL_PASSWORD_KEY))return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"max-w-xl text-muted-foreground",children:(0,T.envWords)("Her mailbox's app password")}),t&&(0,n.jsx)("p",{className:"max-w-xl text-destructive",children:t})]});if(e&&!s&&null===t)return(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[e.address," · ",e.imap," · ",e.smtp]}),(0,n.jsx)(y.Button,{size:"xs",variant:"ghost",onClick:()=>{a(e.address),r(!0)},className:"-ml-2 text-muted-foreground",children:"Change"})]});let A=i.includes("@")?i.slice(i.lastIndexOf("@")+1):"Its domain",M="grid gap-1 font-mono text-[11px] text-muted-foreground";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("form",{className:"space-y-2.5",onSubmit:t=>{t.preventDefault();let n=!d&&e?.address.toLowerCase()===i.trim().toLowerCase();b({address:i.trim(),password:o,...d?{imap:`${u.host.trim()}:${u.port.trim()}`,smtp:`${m.host.trim()}:${m.port.trim()}`}:n?{imap:e.imap,smtp:e.smtp}:{}})},children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[(0,n.jsxs)("label",{className:M,children:["Address",(0,n.jsx)(v.Input,{value:i,onChange:e=>{a(e.target.value),c(!1)},placeholder:"thursday@example.com",type:"email",autoComplete:"off",spellCheck:!1,className:"w-64 font-sans"})]}),(0,n.jsxs)("label",{className:M,children:["App password",(0,n.jsx)(v.Input,{value:o,onChange:e=>l(e.target.value),placeholder:"paste it here",type:"password",autoComplete:"off",spellCheck:!1,className:"w-52 placeholder:font-sans"})]})]}),d&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("p",{className:"max-w-xl text-muted-foreground",children:[A," doesn't say where its mail servers are. Its help pages name them — one for reading mail (IMAP) and one for sending it (SMTP)."]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[(0,n.jsx)(e_,{label:"Reading server",looks:`imap.${A}`,value:u,onChange:h}),(0,n.jsx)(e_,{label:"Sending server",looks:`smtp.${A}`,value:m,onChange:f})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)(y.Button,{type:"submit",size:"sm",loading:w,disabled:!i.includes("@")||o.trim().length<8||d&&!(u.host.trim()&&m.host.trim()),children:e?"Replace":"Save"}),e&&(0,n.jsxs)(n.Fragment,{children:[null===t&&(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",onClick:()=>r(!1),children:"Cancel"}),(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",loading:S,onClick:()=>void C(),className:"ml-auto text-destructive hover:text-destructive",children:"Remove"})]})]})]}),t&&(0,n.jsx)("p",{className:"max-w-xl text-destructive",children:t})]})}function e_({label:e,looks:t,value:s,onChange:r}){let i="grid gap-1 font-mono text-[11px] text-muted-foreground";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{className:i,children:[e,(0,n.jsx)(v.Input,{value:s.host,onChange:e=>r({...s,host:e.target.value}),placeholder:t,autoComplete:"off",spellCheck:!1,className:"w-52 font-mono"})]}),(0,n.jsxs)("label",{className:i,children:["Port",(0,n.jsx)(v.Input,{value:s.port,onChange:e=>r({...s,port:e.target.value}),inputMode:"numeric",autoComplete:"off",className:"w-18 font-mono"})]})]})}function e$({who:e}){let[t,s]=(0,p.useState)(!1),[r,i]=(0,p.useState)(""),a=()=>{i(""),s(!1),(0,ec.revalidate)(g.queryKey.reach)},[o,l]=(0,ed.useServerAction)(em,{onOk:a}),[d,c]=(0,ed.useServerAction)(eh,{onOk:a});return e&&!t?(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground",children:e}),(0,n.jsx)(y.Button,{size:"xs",variant:"ghost",onClick:()=>s(!0),className:"-ml-2 text-muted-foreground",children:"Change"})]}):(0,n.jsxs)("form",{className:"flex flex-wrap items-center gap-2",onSubmit:e=>{e.preventDefault(),o("email",r.trim())},children:[(0,n.jsx)(v.Input,{value:r,onChange:e=>i(e.target.value),placeholder:"you@example.org","aria-label":"Your own address",type:"email",autoComplete:"email",spellCheck:!1,className:"w-64"}),(0,n.jsx)(y.Button,{type:"submit",size:"sm",loading:l,disabled:!r.includes("@"),children:e?"Replace":"Save"}),e&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",onClick:()=>s(!1),children:"Cancel"}),(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",loading:c,onClick:async()=>{await j.notify.confirm({title:`Stop reading mail from ${e}?`,description:"Nobody can write to Thursday by email until an address is named again.",okText:"Stop",destructive:!0})&&d("email")},className:"ml-auto text-destructive hover:text-destructive",children:"Remove"})]})]})}function eO({address:e}){let[t,s]=(0,p.useState)(!1);return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)(eI,{href:`mailto:${e}`,children:["Write to ",e]}),(0,n.jsxs)(y.Button,{size:"sm",variant:"outline",onClick:()=>void navigator.clipboard.writeText(e).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)}),children:[t?(0,n.jsx)(o.Check,{}):(0,n.jsx)(P.Copy,{}),t?"Copied":"Copy her address"]})]})}let eB={[T.EXA_API_KEY]:f.Search},eL={image:h.Image,video:u,speech:i.AudioLines,transcription:a.Captions},eq={keys:["voice","easy","text","search"],models:["bots","studio"]};function eD({screen:e}){let{data:t,isLoading:s,error:r}=(0,ec.useServerRoute)(g.queryKey.config),i=(0,R.useVoiceLine)();if(s)return(0,n.jsx)(el.SettingSkeleton,{rows:4});if(r)return(0,n.jsx)(el.SettingError,{message:r.message});let a=e=>(0,T.isConfigSet)(t,e),o=e=>(0,T.isConfigUnreadable)(t,e),l=e=>(0,T.isConfigFromEnv)(t,e),d=e=>(0,T.groupSatisfied)(e,e.id===T.VOICE_GROUP_ID?i.countsForCall:a),c=e=>t?.find(t=>t.key===e)?.value,u=eq[e].flatMap(e=>T.CONFIG_GROUPS.find(t=>t.id===e)??[]),h=u.filter(e=>"keys"===e.section).flatMap(e=>e.entries),m=h.filter(e=>o(e.key)).length;return(0,n.jsx)(el.SettingScreen,{footer:(0,n.jsx)(el.SettingRailNote,{children:"models"===e?"Her own voice and backend models are in Thursday. A bot can pick its own on its page.":`${h.filter(e=>a(e.key)).length} of ${h.length} set${m?` \xb7 ${m} to enter again`:""}${u.some(e=>!d(e))?" · a call needs the GPT Subscription or an OpenAI key":" · your keys stay on this machine"}`}),children:u.map(e=>(0,n.jsx)(el.SettingGroup,{label:e.title,hint:e.hint,right:(0,n.jsx)(eW,{group:e,met:d(e)}),children:"easy"===e.id?(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:e.entries.map(e=>(0,n.jsx)(eU,{card:!0,entry:e,set:a(e.key),lost:o(e.key),env:l(e.key)},e.key))}):"text"===e.id?(0,n.jsx)("div",{className:"flex flex-wrap gap-x-1.5 gap-y-3.5",children:e.entries.map(e=>(0,n.jsx)(eH,{entry:e,set:a(e.key),lost:o(e.key),env:l(e.key)},e.key))}):(0,n.jsx)(el.SettingItems,{children:e.entries.map(t=>t.effortOf?null:t.choices?(0,n.jsx)(e3,{entry:t,choices:t.choices,value:c(t.key),effort:e8(e,t.key),effortValue:c(T.DEFAULT_EFFORT_KEY)},t.key):(0,n.jsx)(eU,{entry:t,set:a(t.key),lost:o(t.key),env:l(t.key)},t.key))})},e.id))})}function eH({entry:e,set:t,lost:s,env:r}){return(0,n.jsxs)("button",{type:"button",onClick:()=>e5(e,t),"aria-label":`${e.label}: ${r?"set in env":t?"set":s?"enter it again":"not set"}`,className:"group flex w-17 flex-col items-center gap-1.5 rounded-xl py-1 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,n.jsxs)("span",{className:"relative grid size-10.5 place-items-center rounded-[13px] bg-muted/60 transition-colors group-hover:bg-muted",children:[(0,n.jsx)(e2,{entry:e}),t?(0,n.jsx)("span",{className:"absolute -top-1 -right-1 grid size-4 place-items-center rounded-full bg-primary text-primary-foreground ring-2 ring-background",children:(0,n.jsx)(o.Check,{className:"size-2.5"})}):s&&(0,n.jsx)("span",{className:"absolute -top-1 -right-1 grid size-4 place-items-center rounded-full bg-waiting text-background ring-2 ring-background",children:(0,n.jsx)(x.TriangleAlert,{className:"size-2.5"})})]}),(0,n.jsx)("span",{className:(0,eu.cn)("max-w-full truncate text-[11px]",t?"text-foreground":"text-muted-foreground"),children:e.label}),r&&(0,n.jsx)("span",{className:"-mt-1.5 font-mono text-[10px] text-muted-foreground",children:"env"})]})}function eW({group:e,met:t}){return"none"===e.require?null:t?(0,n.jsxs)("span",{className:"flex items-center gap-1 font-mono text-[11px] text-muted-foreground",children:[(0,n.jsx)(o.Check,{className:"size-3"}),"ready"]}):(0,n.jsxs)("span",{className:(0,eu.cn)("flex items-center gap-1 font-mono text-[11px]",eu.WAITING_INK),children:[(0,n.jsx)(x.TriangleAlert,{className:"size-3"}),e.note??"Required"]})}function eU({entry:e,set:t,lost:s,env:r,card:i=!1,narrow:a=!1}){let d=eV(e,t),c=eX(e,t),u=eQ(e,t),h=c.data?eZ(c.data):eG(t,d.data,e.signIn,s,r),m=d.isLoading||c.isLoading,f=(0,n.jsxs)("span",{className:(0,eu.cn)("flex shrink-0 items-center gap-1.5 font-mono text-xs",h.ink),children:[h.warn?(0,n.jsx)(x.TriangleAlert,{className:"size-3"}):t&&(0,n.jsx)(o.Check,{className:"size-3"}),h.text]});return(0,n.jsxs)("button",{type:"button",onClick:()=>{var s;return e.signIn?(s=e,j.notify.component({className:"sm:max-w-md",renderer:({close:e})=>(0,n.jsx)(e4,{entry:s,onDone:e})})):e5(e,t)},className:(0,eu.cn)("group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",i&&"rounded-xl border border-border/60"),children:[(0,n.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,n.jsx)(e2,{entry:e})}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,n.jsxs)("span",{className:"flex items-center gap-2 truncate text-sm font-medium",children:[e.label,e.signIn&&t&&(0,n.jsx)(e0,{usage:c.data,plan:u})]}),a?m?(0,n.jsx)(b.Skeleton,{className:"h-3 w-20"}):f:(0,n.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:e.signIn?t?eJ(c.data)??"signed in":"sign in with your account":e.key}),e.signIn&&t&&c.data&&(0,n.jsx)(e1,{usage:c.data})]}),a?null:m?(0,n.jsx)(b.Skeleton,{className:"h-3 w-20 shrink-0"}):f,(0,n.jsx)(l.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}let eY=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function eG(e,t,n,s=!1,r=!1){var i,a,o;let l=function(e,t,n,s=!1){return!e&&s?{text:n?"Sign in again":"Enter again",ink:eu.WAITING_INK,warn:!0}:e?t?"refused"in t?{text:"Key refused",ink:"text-destructive",warn:!0}:{text:`${eY.format(t.balance)} left`,ink:t.low?eu.WAITING_INK:"text-muted-foreground",warn:t.low}:{text:n?"Signed in":"Set",ink:"text-muted-foreground",warn:!1}:{text:n?"Signed out":"Not set",ink:"text-muted-foreground",warn:!1}}(e,t,n,s);return e?(i=l,a=r,o=!!t,a?o?{...i,text:`${i.text} \xb7 env`}:{...i,text:"Set in env"}:i):l}function eV(e,t){return(0,ec.useServerRoute)(t&&(0,M.isCatalogProvider)(e.provider)?g.queryKey.keyCredits(e.provider):null)}function eQ(e,t){let{data:n}=(0,ec.useServerRoute)(t&&e.signIn?g.queryKey.llmModel:null);return n?.find(t=>t.id===e.provider)?.plan??null}function eX(e,t){return(0,ec.useServerRoute)(t&&e.signIn?g.queryKey.subscriptionUsage:null)}function eZ(e){return"refused"in e?{text:"Sign-in refused",ink:"text-destructive",warn:!0}:{text:e.spent?"Limit reached":`${e.usedPercent}% used`,ink:e.high?eu.WAITING_INK:"text-muted-foreground",warn:e.high}}function eJ(e){let t=!e||"refused"in e?null:e;return t?.resetsAt?`resets in ${(0,s.formatDistanceToNowStrict)(new Date(t.resetsAt))}`:null}function e0({usage:e,plan:t}){let s=(0,M.planName)((!e||"refused"in e?null:e.plan)??t);return s?(0,n.jsx)("span",{className:"rounded-full px-1.5 font-mono text-[9.5px] leading-4 font-normal text-foreground ring-1 ring-border ring-inset",children:s}):null}function e1({usage:e}){return"refused"in e?null:(0,n.jsx)("span",{role:"meter","aria-label":"Plan used","aria-valuenow":e.usedPercent,"aria-valuemin":0,"aria-valuemax":100,className:"mt-1.5 block h-1 w-full max-w-48 overflow-hidden rounded-full bg-muted",children:(0,n.jsx)("span",{className:(0,eu.cn)("block h-full rounded-full transition-[width] duration-500",e.high?"bg-waiting":"bg-foreground/45"),style:{width:`${Math.min(100,Math.max(2,e.usedPercent))}%`}})})}function e2({entry:e}){if(e.provider)return(0,n.jsx)(A.ProviderIcon,{provider:e.provider,className:"size-4"});let t=eB[e.key]??m.KeyRound,s=(0,n.jsx)(t,{className:"size-4 text-muted-foreground"});return e.site?(0,n.jsx)(k.SiteIcon,{host:e.site,className:"size-4 rounded-[4px]",fallback:s}):s}function e3({entry:e,choices:t,value:s,effort:r,effortValue:i}){let a=e.text?(0,M.parseTextModel)(s):(0,M.parseMediaModel)(s),{data:o}=(0,ec.useServerRoute)(e.text&&!s&&g.queryKey.automaticModel),{data:l}=(0,ec.useServerRoute)(e.kind&&!s&&g.queryKey.llmModel),d=l?.find(e=>e.signIn),c=e.kind&&!s?(0,M.planMediaOf)(e.kind,d?.hasKey?{plan:d.plan??null}:null):null,u=e.kind?eL[e.kind]:E.BotsMark,[h]=(0,ed.useServerAction)(z.setConfigAction,{onOk:()=>{(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.automaticModel)}}),[m]=(0,ed.useServerAction)(F,{onOk:()=>{(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.automaticModel)}});return(0,n.jsxs)("div",{className:"flex w-full items-start gap-3 p-4",children:[(0,n.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,n.jsx)(u,{className:"size-4 text-muted-foreground"})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,n.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 pt-1.5",children:[(0,n.jsx)("span",{className:"truncate text-sm font-medium",children:e.label}),!s&&(0,n.jsx)("span",{className:(0,eu.cn)("shrink-0 rounded-[5px] border border-border/60 px-1 font-mono text-[10px]",e.kind&&!c?eu.WAITING_INK:"text-muted-foreground"),children:e.kind&&!c?"off":"auto"})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)("div",{className:"min-w-0",children:(0,n.jsx)(C.ModelPicker,{kind:e.kind,provider:a?.provider??null,model:a?.model??"",unset:e.kind?c?`Automatic \xb7 ${t.find(e=>e.value===`${c.provider}/${c.model}`)?.label??c.model}`:"Not offered to bots until you pick one":function(e,t){if(!e)return"Automatic";if(!e.ref)return e.problem;let{provider:n,model:s}=e.ref,r=t.find(e=>e.value===`${n}/${s}`);return`Automatic \xb7 ${r?.label??s}`}(o,t),onChange:t=>h(e.key,`${t.provider}/${t.model.trim()}`),onUnset:s?()=>{m(e.key),r&&i&&m(r.key)}:void 0})}),r&&a&&(0,n.jsxs)("div",{className:"flex items-start gap-3 pt-0.5",children:[(0,n.jsx)("span",{className:"w-12 shrink-0 pt-1.5 font-mono text-[11px] text-muted-foreground",children:"effort"}),(0,n.jsx)(S.EffortSwitch,{provider:a.provider,model:a.model,value:M.effortSchema.safeParse(i).data??null,onChange:e=>e?h(r.key,e):m(r.key)})]})]})]})]})}let e8=(e,t)=>e.entries.find(e=>e.effortOf===t);function e4({entry:e,onDone:t}){let{data:s}=(0,ec.useServerRoute)(g.queryKey.config),r=(0,T.isConfigSet)(s,e.key),i=(0,T.isConfigUnreadable)(s,e.key),a=(0,T.isConfigFromEnv)(s,e.key),o=eQ(e,r),l=eX(e,r),d=l.data?eZ(l.data):null,[c,u]=(0,ed.useServerAction)(F,{okMessage:`Signed out of ${e.label}`,onOk:()=>{(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.llmModel),t()}});return(0,n.jsx)(el.SettingDialogContent,{title:e.label,description:r?(0,n.jsxs)(n.Fragment,{children:["Signed in ",(0,n.jsx)(e0,{usage:l.data,plan:o}),eJ(l.data)&&(0,n.jsxs)(n.Fragment,{children:[" · ",(0,n.jsx)("span",{className:"font-mono",children:eJ(l.data)})]}),d&&(0,n.jsxs)(n.Fragment,{children:[" · ",(0,n.jsx)("span",{className:(0,eu.cn)("font-mono",d.ink),children:d.text})]})]}):"Sign in with your ChatGPT account instead of a key",footer:(0,n.jsxs)(n.Fragment,{children:[(r||i)&&!a&&(0,n.jsx)(y.Button,{variant:"ghost",loading:u,onClick:async()=>{await j.notify.confirm({title:`Sign out of ${e.label}?`,description:"Nothing runs on your plan until you sign in again.",okText:"Sign out",destructive:!0})&&c(e.key)},children:"Sign out"}),(0,n.jsx)(y.Button,{variant:"ghost",onClick:t,children:r?"Close":"Cancel"}),!r&&(0,n.jsx)(N.ChatGptSignIn,{})]}),children:(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(el.SettingNote,{children:r?"Bots on this subscription spend your plan's usage, not a key. When it runs out, the job stops and says when it resets.":"The sign-in opens in its own window. Approve it there, and this turns to signed in by itself."}),l.data&&"refused"in l.data&&(0,n.jsx)(el.SettingNote,{className:"wrap-break-word text-destructive",children:l.data.refused}),i&&(0,n.jsx)(el.SettingNote,{className:(0,eu.cn)("wrap-break-word",eu.WAITING_INK),children:(0,T.lostWords)("The sign-in saved here","Sign in again.")}),a&&(0,n.jsx)(el.SettingNote,{className:"wrap-break-word",children:(0,T.envWords)(e.label)})]})})}function e5(e,t){return j.notify.component({className:"sm:max-w-md",renderer:({close:s})=>(0,n.jsx)(e6,{entry:e,set:t,onDone:s})})}function e6({entry:e,set:t,onDone:s}){let[i,a]=(0,p.useState)(""),{data:o}=(0,ec.useServerRoute)(g.queryKey.config),l=o?(0,T.isConfigSet)(o,e.key):t,d=(0,T.isConfigUnreadable)(o,e.key),c=(0,T.isConfigFromEnv)(o,e.key),{data:u}=eV(e,l),h=u?eG(l,u):null,m=()=>{(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.llmModel)},[f,x]=(0,ed.useServerAction)(z.setConfigAction,{okMessage:`${e.label} key saved`,onOk:()=>{m(),s()}}),[k,b]=(0,ed.useServerAction)(F,{okMessage:`${e.label} key removed`,onOk:()=>{m(),s()}}),N=async()=>{await j.notify.confirm({title:`Remove the ${e.label} key?`,description:"It is deleted from this computer, and nothing runs on it until a key is pasted again.",okText:"Remove",destructive:!0})&&k(e.key)};return(0,n.jsx)(el.SettingDialogContent,{title:e.label,description:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"font-mono",children:e.key}),c?(0,n.jsx)(n.Fragment,{children:" · set in env"}):e.hint&&(0,n.jsxs)(n.Fragment,{children:[" · ",e.hint]}),h&&(0,n.jsxs)(n.Fragment,{children:[" · ",(0,n.jsx)("span",{className:(0,eu.cn)("font-mono",h.ink),children:h.text})]})]}),footer:c?(0,n.jsx)(y.Button,{onClick:s,children:"Close"}):(0,n.jsxs)(n.Fragment,{children:[(l||d)&&(0,n.jsx)(y.Button,{variant:"ghost",loading:b,onClick:()=>void N(),className:"mr-auto text-destructive hover:text-destructive",children:"Remove"}),(0,n.jsx)(y.Button,{variant:"ghost",onClick:s,children:"Cancel"}),(0,n.jsx)(y.Button,{loading:x,disabled:i.trim().length<w.KEY_MIN,onClick:()=>f(e.key,i),children:l?"Replace":"Save"})]}),children:(0,n.jsxs)("div",{className:"space-y-2",children:[c?(0,n.jsx)(el.SettingNote,{className:"wrap-break-word",children:(0,T.envWords)(e.label)}):(0,n.jsx)(v.Input,{value:i,onChange:e=>a(e.target.value),onKeyDown:t=>{"Enter"===t.key&&i.trim().length>=w.KEY_MIN&&f(e.key,i)},placeholder:l?"New value — replaces the current key":d?"Paste the key again":e.keyLooks??"Paste the key",spellCheck:!1,type:"password",autoFocus:!0}),!l&&e.keysAt&&(0,n.jsxs)("a",{href:e.keysAt,target:"_blank",rel:"noreferrer",className:"flex w-fit items-center gap-1 px-0.5 text-[13px] text-foreground underline underline-offset-3 hover:text-foreground/80",children:["Get a key at ",new URL(e.keysAt).host,(0,n.jsx)(r.ArrowUpRight,{className:"size-3.5"})]}),u&&"refused"in u&&(0,n.jsx)(el.SettingNote,{className:"wrap-break-word text-destructive",children:u.refused}),d&&(0,n.jsx)(el.SettingNote,{className:(0,eu.cn)("wrap-break-word",eu.WAITING_INK),children:(0,T.lostWords)("The key saved here","Paste it again.")})]})})}e.s(["KeysSetting",0,()=>(0,n.jsx)(eD,{screen:"keys"}),"ModelsSetting",0,()=>(0,n.jsx)(eD,{screen:"models"}),"PhoneSetting",0,()=>(0,n.jsx)(el.SettingScreen,{footer:(0,n.jsx)(el.SettingRailNote,{children:"Nothing on this computer is opened to the internet: the app asks the chat service, or her mailbox, what was written."}),children:(0,n.jsx)(eb,{})}),"PlanBadge",0,e0],805995)}]);
18
+ `,ev=({href:e,children:t})=>(0,n.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",className:"font-medium text-foreground underline underline-offset-4 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:t}),ej=({children:e})=>(0,n.jsx)("span",{className:"font-medium text-foreground",children:e}),eb={telegram:[{body:(0,n.jsxs)(n.Fragment,{children:["In Telegram, write to ",(0,n.jsx)(ej,{children:"@BotFather"}),", send ",(0,n.jsx)(ej,{children:"/newbot"})," and pick a name. It answers with a ",(0,n.jsx)(ej,{children:"token"}),"."]}),slot:{open:"https://t.me/BotFather",label:"Open @BotFather"}},{body:(0,n.jsx)(n.Fragment,{children:"Paste the token here."}),slot:{key:ep.TELEGRAM_TOKEN_KEY,looks:"123456789:AAE…"}},{body:(0,n.jsx)(n.Fragment,{children:"From your phone, write anything to your bot."}),slot:{says:"Point your phone's camera at it to open the chat."}},{body:(0,n.jsxs)(n.Fragment,{children:["A question with a code appears on this computer. Press ",(0,n.jsx)(ej,{children:"Allow"})," if your phone shows the same code."]})}],discord:[{body:(0,n.jsxs)(n.Fragment,{children:["At ",(0,n.jsx)(ej,{children:"discord.com/developers"}),", make a ",(0,n.jsx)(ej,{children:"New Application"}),". So nobody else can add it to a server, set ",(0,n.jsx)(ej,{children:"Install Link"})," to"," ",(0,n.jsx)(ej,{children:"None"})," on its ",(0,n.jsx)(ej,{children:"Installation"})," page and turn off"," ",(0,n.jsx)(ej,{children:"Public Bot"})," on its ",(0,n.jsx)(ej,{children:"Bot"})," page. There, press"," ",(0,n.jsx)(ej,{children:"Reset Token"})," and copy it."]}),slot:{open:"https://discord.com/developers/applications",label:"Open discord.com/developers"}},{body:(0,n.jsx)(n.Fragment,{children:"Paste the token here."}),slot:{key:ep.DISCORD_TOKEN_KEY,looks:"MTE…"}},{body:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ej,{children:"Add the bot to a server of your own"})," — Discord only delivers a message to a bot you share a server with. A private server made for this is fine."]}),slot:{says:"Point your phone's camera at it, or open it here. It asks which server, and adds the bot with no permissions in it.",does:"Add the bot to a server"}},{body:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ej,{children:"Send the bot a direct message"}),", not in the server: on a phone, tap the bot in the server's member list, then ",(0,n.jsx)(ej,{children:"Message"}),". A question with a code appears here: press ",(0,n.jsx)(ej,{children:"Allow"})," if your phone shows the same code."]})}],slack:[{body:(0,n.jsxs)(n.Fragment,{children:["At ",(0,n.jsx)(ev,{href:"https://api.slack.com/apps",children:"api.slack.com/apps"}),","," ",(0,n.jsx)(ej,{children:"Create New App › From a manifest"}),", and paste the manifest."]}),slot:{manifest:!0}},{body:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ej,{children:"Basic Information › App-Level Tokens"}),": generate one with"," ",(0,n.jsx)(ej,{children:"connections:write"}),". It starts with xapp-."]}),slot:{key:ep.SLACK_APP_TOKEN_KEY,looks:"xapp-…"}},{body:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ej,{children:"Install App"})," to your workspace. The Bot User OAuth Token starts with xoxb-."]}),slot:{key:ep.SLACK_BOT_TOKEN_KEY,looks:"xoxb-…"}},{body:(0,n.jsxs)(n.Fragment,{children:["In Slack, open the app under ",(0,n.jsx)(ej,{children:"Apps"})," and write in its"," ",(0,n.jsx)(ej,{children:"Messages"})," tab. A question with a code appears here: press"," ",(0,n.jsx)(ej,{children:"Allow"})," if Slack shows the same code."]})}],email:[{body:(0,n.jsxs)(n.Fragment,{children:["Make a ",(0,n.jsx)(ej,{children:"mailbox of her own"})," — a new account at a mail service that gives app passwords (Outlook no longer does). Turn on"," ",(0,n.jsx)(ej,{children:"two-step sign-in"})," there and create an ",(0,n.jsx)(ej,{children:"app password"})," for Thursday: how on"," ",(0,n.jsx)(ev,{href:"https://support.google.com/accounts/answer/185833",children:"Gmail"}),", ",(0,n.jsx)(ev,{href:"https://support.apple.com/en-us/102654",children:"iCloud"}),","," ",(0,n.jsx)(ev,{href:"https://www.fastmail.help/hc/en-us/articles/360058752854-App-passwords",children:"Fastmail"}),". Your own inbox stays out of it."]})},{body:(0,n.jsx)(n.Fragment,{children:"Her address and the app password."}),slot:{mailbox:!0}},{body:(0,n.jsx)(n.Fragment,{children:"Your own address. Only mail from it reaches her, and only once its mail service vouches it was sent from there."}),slot:{person:!0}},{body:(0,n.jsx)(n.Fragment,{children:"From your address, write anything to hers. She answers in the same thread."}),slot:{write:!0}}]};function ek(){let e=(0,ec.useServerRoute)(g.queryKey.config),t=(0,ec.useServerRoute)(g.queryKey.reach);(0,ea.useAppEvent)({reach:()=>void(0,ec.revalidate)(g.queryKey.reach)});let s=t=>(0,T.isConfigSet)(e.data,t),r=t=>(0,T.isConfigUnreadable)(e.data,t),i=e=>t.data?.channels.find(t=>t.name===e)??null,a=e=>!!i(e)?.allowed,o=ep.REACH_CHANNELS.find(e=>i(e)?.refused||ep.REACH_KEYS[e].some(r)),l=ep.REACH_CHANNELS.find(e=>("email"===e?!!i(e)?.mailbox:ep.REACH_KEYS[e].every(s))&&!a(e)),d=!ep.REACH_CHANNELS.some(a),[c,u]=(0,p.useState)(o??l??(d?ep.REACH_CHANNELS[0]:null));return(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(el.SettingItems,{children:ep.REACH_CHANNELS.map(e=>(0,n.jsx)(ew,{name:e,status:i(e),tokensIn:ep.REACH_KEYS[e].filter(s).length,isSet:s,isLost:r,open:c===e,onOpen:()=>u(c===e?null:e)},e))}),(0,n.jsx)(el.SettingNote,{children:"Only the one person you allow can write: direct messages in a chat app, and by email only mail from the address you name. Nobody else is ever written back to. Work started here runs whether or not a tab is open, while Thursday is running on this computer."})]})}function ew({name:e,status:t,tokensIn:s,isSet:r,isLost:i,open:a,onOpen:o}){var d,c;let u,h,f,x,p,g=eb[e],y=t?.refused??null,v="email"===e,j=v?[(u=(d={mailbox:!!t?.mailbox,stopped:!!y||i(ep.EMAIL_PASSWORD_KEY),named:!!t?.allowed,connected:!!t?.bot}).mailbox&&!d.stopped)?"done":"flat",u?"done":"now",u?d.named?"done":"now":"later",u&&d.named&&d.connected?"flat":"later"]:(c={connected:!!t?.bot,allowed:!!t?.allowed,refused:y},h=g.map(e=>e.slot&&"key"in e.slot?e.slot.key:null),f=e=>!r(e)||e===c.refused,x=h.findIndex(e=>e&&f(e)),p=h.reduce((e,t,n)=>t?n:e,-1),g.map((e,t)=>{let n=h[t];return n?f(n)?t===x?"now":"later":"done":x>=0?t<x?c.refused?"done":"flat":"later":c.allowed||t<p?"done":c.connected?"now":"flat"})),k=!v&&!!t?.bot&&!t?.allowed&&!y;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{type:"button",onClick:o,"aria-expanded":a,className:"flex w-full items-center gap-3 px-4 py-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[v?(0,n.jsx)(_.Mail,{className:"size-4 text-muted-foreground"}):(0,n.jsx)(b.SiteIcon,{host:eg[e],className:"size-4 rounded-[4px]",fallback:(0,n.jsx)(m.KeyRound,{className:"size-4 text-muted-foreground"})}),(0,n.jsx)("span",{className:"text-sm font-medium",children:ep.REACH_LABEL[e]}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:v?(0,n.jsx)(eS,{status:t,lost:i(ep.EMAIL_PASSWORD_KEY)}):(0,n.jsx)(eN,{status:t,tokensIn:s,tokens:ep.REACH_KEYS[e].length,lost:ep.REACH_KEYS[e].some(i)})}),(0,n.jsx)(l.ChevronRight,{className:(0,eu.cn)("size-4 shrink-0 text-muted-foreground transition-transform",a&&"rotate-90")})]}),a&&(0,n.jsxs)("div",{className:"px-4 pt-1 pb-4",children:[(0,n.jsx)("ol",{className:"space-y-3",children:g.map((e,s)=>(0,n.jsx)(eC,{n:s+1,step:e,state:j[s],set:!!e.slot&&"key"in e.slot&&r(e.slot.key),lost:!!e.slot&&"key"in e.slot&&i(e.slot.key),refused:e.slot&&"key"in e.slot&&e.slot.key===y?t?.problem??"":e.slot&&"key"in e.slot&&i(e.slot.key)?(0,T.lostWords)("The token saved here","Paste it again."):null,link:t?.link??null,waiting:k&&s===g.length-1,status:t,lostPassword:v&&i(ep.EMAIL_PASSWORD_KEY)},s))}),t?.allowed&&!v&&(0,n.jsx)(eT,{name:e,who:t.allowed.name,stopped:!!y})]})]})}function eN({status:e,tokensIn:t,tokens:s,lost:r}){let i="text-xs";return r?(0,n.jsx)("span",{className:(0,eu.cn)(i,"text-destructive"),children:"Stopped — the saved token can't be unlocked any more"}):t<s?(0,n.jsx)("span",{className:(0,eu.cn)(i,"text-muted-foreground"),children:t?`${t} of ${s} tokens in`:"Not set"}):e?.refused?(0,n.jsxs)("span",{className:(0,eu.cn)(i,"text-destructive"),children:["Stopped — ",ep.REACH_LABEL[e.name]," turned the token away"]}):e?.problem?(0,n.jsx)(eo.ShinyText,{text:`${e.bot?"Reconnecting":"Connecting"} ${e.problem}`,className:(0,eu.cn)(i,"align-middle")}):e?.allowed?(0,n.jsxs)("span",{className:(0,eu.cn)(i,"text-muted-foreground"),children:["Listening as ",e.bot,". ",e.allowed.name," is let in."]}):e?.bot?(0,n.jsx)(eo.ShinyText,{text:`Listening as ${e.bot} — waiting for your first message`,tone:"waiting",className:(0,eu.cn)(i,"align-middle")}):(0,n.jsx)(eo.ShinyText,{text:"Connecting…",className:(0,eu.cn)(i,"align-middle")})}function eS({status:e,lost:t}){let s="text-xs";return t?(0,n.jsx)("span",{className:(0,eu.cn)(s,"text-destructive"),children:"Stopped — the saved app password can't be unlocked any more"}):e?.mailbox?e.refused?(0,n.jsx)("span",{className:(0,eu.cn)(s,"text-destructive"),children:"Stopped — the mail service turned her mailbox's sign-in away"}):e.problem?(0,n.jsx)(eo.ShinyText,{text:`${e.bot?"Reconnecting":"Connecting"} ${e.problem}`,className:(0,eu.cn)(s,"align-middle")}):e.bot?e.holding?(0,n.jsx)(eo.ShinyText,{text:`Listening as ${e.bot} — a mail is held: ${e.holding}`,className:(0,eu.cn)(s,"align-middle")}):e.allowed?(0,n.jsxs)("span",{className:(0,eu.cn)(s,"text-muted-foreground"),children:["Listening as ",e.bot,". ",e.allowed.name," can write."]}):(0,n.jsx)(eo.ShinyText,{text:`Listening as ${e.bot} — name your own address`,tone:"waiting",className:(0,eu.cn)(s,"align-middle")}):(0,n.jsx)(eo.ShinyText,{text:"Connecting…",className:(0,eu.cn)(s,"align-middle")}):(0,n.jsx)("span",{className:(0,eu.cn)(s,"text-muted-foreground"),children:"Not set"})}function eC({n:e,step:t,state:s,set:r,lost:i,refused:a,link:o,waiting:l,status:d,lostPassword:c}){return(0,n.jsxs)("li",{className:"flex gap-3 text-[13px] leading-relaxed",children:[(0,n.jsx)(eA,{n:e,state:s}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-2.5",children:[(0,n.jsx)("p",{className:(0,eu.cn)("done"===s||"later"===s?"text-muted-foreground/60 **:text-inherit":"text-muted-foreground"),children:t.body}),(0,n.jsx)(eM,{slot:t.slot,state:s,set:r,lost:i,refused:a,link:o,waiting:l,status:d,lostPassword:c})]})]})}function eA({n:e,state:t}){return"done"===t?(0,n.jsx)("span",{className:"mt-0.5 grid size-5 shrink-0 place-items-center rounded-full bg-foreground text-background",children:(0,n.jsx)(o.Check,{className:"size-3"})}):(0,n.jsx)("span",{className:(0,eu.cn)("mt-0.5 grid size-5 shrink-0 place-items-center rounded-full bg-background font-mono text-[10.5px] ring-1","now"===t?(0,eu.cn)(eu.WAITING_INK,"ring-waiting/40"):"text-muted-foreground ring-border/60","later"===t&&"opacity-60"),children:e})}function eM({slot:e,state:t,set:s,lost:r,refused:i,link:a,waiting:o,status:l,lostPassword:d}){let c=o&&(0,n.jsx)(eo.ShinyText,{text:"Waiting for your first message…",tone:"waiting"});return"later"===t?null:e&&"mailbox"in e?(0,n.jsx)(eK,{mailbox:l?.mailbox??null,refused:l?.refused?l.problem??"":d?(0,T.lostWords)("The app password saved here","Save her mailbox again."):null}):e&&"person"in e?(0,n.jsx)(e$,{who:l?.allowed?.chat??null}):e&&"write"in e?l?.mailbox?(0,n.jsx)(eO,{address:l.mailbox.address}):null:e&&"key"in e?(0,n.jsx)(eF,{configKey:e.key,looks:e.looks,set:s,lost:r,refused:i}):"done"===t?e&&"says"in e&&a?(0,n.jsx)(eI,{href:a,children:e.does??eR(a)}):null:e?"open"in e?(0,n.jsx)(eI,{href:e.open,children:e.label}):"manifest"in e?(0,n.jsx)(ez,{}):a?(0,n.jsxs)("div",{className:"space-y-2.5",children:[(0,n.jsx)(eE,{link:a,says:e.says,does:e.does}),c]}):c||null:c||null}function eE({link:e,says:t,does:s}){let{size:r,data:i}=function(e){let{ecc:t="L",boostEcc:n=!1,minVersion:s=1,maxVersion:r=40,maskPattern:i=-1,border:a=1}={},o="string"==typeof e?function(e){var t,n;if(""===e)return[];if(t=e,D.test(t))return[function(e){var t;if(t=e,!D.test(t))throw RangeError("String contains non-numeric characters");let n=[];for(let t=0;t<e.length;){let s=Math.min(e.length-t,3);V(Number.parseInt(e.substring(t,t+s),10),3*s+1,n),t+=s}return new X(Z,e.length,n)}(e)];return(n=e,H.test(n))?[function(e){var t;let n;if(t=e,!H.test(t))throw RangeError("String contains unencodable characters in alphanumeric mode");let s=[];for(n=0;n+2<=e.length;n+=2){let t=45*W.indexOf(e.charAt(n));V(t+=W.indexOf(e.charAt(n+1)),11,s)}return n<e.length&&V(W.indexOf(e.charAt(n)),6,s),new X(J,e.length,s)}(e)]:[en(function(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)"%"!==e.charAt(n)?t.push(e.charCodeAt(n)):(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2);return t}(e))]}(e):Array.isArray(e)?[en(e)]:void 0;if(!o)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=function(e,t,n=1,s=40,r=-1,i=!0){let a,o;if(!(1<=n&&n<=s&&s<=40)||r<-1||r>7)throw RangeError("Invalid value");for(a=n;;a++){let n=8*er(a,t),r=function(e,t){let n=0;for(let s of e){let e=et(s.mode,t);if(s.numChars>=1<<e)return 1/0;n+=4+e+s.bitData.length}return n}(e,a);if(r<=n){o=r;break}if(a>=s)throw RangeError("Data too long")}for(let e of[O,B,L])i&&o<=8*er(a,e)&&(t=e);let l=[];for(let t of e)for(let e of(V(t.mode[0],4,l),V(t.numChars,et(t.mode,a),l),t.getData()))l.push(e);let d=8*er(a,t);V(0,Math.min(4,d-l.length),l),V(0,(8-l.length%8)%8,l);for(let e=236;l.length<d;e^=253)V(e,8,l);let c=Array.from({length:Math.ceil(l.length/8)},()=>0);return l.forEach((e,t)=>c[t>>>3]|=e<<7-(7&t)),new G(a,t,c,r)}(o,q[t],s,r,i,n);return function(e,t=1){if(!t)return e;let{size:n}=e,s=n+2*t;e.size=s,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:s},e=>!1)),e.data.push(Array.from({length:s},e=>!1));let r=$.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(r),e.push(r)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:s},e=>r)),e.types.push(Array.from({length:s},e=>r));return e}({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},a)}(e),a=eR(e);return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,n.jsx)("div",{className:"rounded-lg bg-white p-2.5",children:(0,n.jsx)("svg",{viewBox:`0 0 ${r} ${r}`,className:"block size-31 text-black",role:"img","aria-label":`A picture of ${a} for a phone camera`,children:i.flatMap((e,t)=>e.map((e,s)=>e?(0,n.jsx)("rect",{x:s,y:t,width:1,height:1,fill:"currentColor"},`${s}-${t}`):null))})}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("p",{className:"text-muted-foreground",children:t}),(0,n.jsx)(eI,{href:e,children:s??a})]})]})}let eR=e=>e.replace(/^https:\/\//,"");function eI({href:e,children:t}){return(0,n.jsxs)("a",{href:e,target:"_blank",rel:"noreferrer",className:(0,eu.cn)((0,y.buttonVariants)({variant:"outline",size:"sm"})),children:[(0,n.jsx)(K.ExternalLink,{}),t]})}function eF({configKey:e,looks:t,set:s,lost:r,refused:i}){let[a,o]=(0,p.useState)(""),[l,d]=(0,p.useState)(!1),{data:c}=(0,ec.useServerRoute)(g.queryKey.config),u=(0,T.isConfigFromEnv)(c,e),h=()=>{o(""),d(!1),(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.reach)},[m,f]=(0,ed.useServerAction)(z.setConfigAction,{onOk:h}),[x,b]=(0,ed.useServerAction)(F,{onOk:h}),k=async()=>{await j.notify.confirm({title:"Remove this token?",description:"That service stops, and whoever is let in is let go.",okText:"Remove",destructive:!0})&&x(e)};return u?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"max-w-xl text-muted-foreground",children:(0,T.envWords)(T.CONFIG_ENTRIES[e]?.label??e)}),i&&(0,n.jsx)("p",{className:"max-w-xl text-destructive",children:i})]}):s&&!l&&null===i?(0,n.jsx)(y.Button,{size:"xs",variant:"ghost",onClick:()=>d(!0),className:"-ml-2 text-muted-foreground",children:"Change the token"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("form",{className:"flex flex-wrap items-center gap-2",onSubmit:t=>{t.preventDefault(),m(e,a)},children:[(0,n.jsx)(v.Input,{value:a,onChange:e=>o(e.target.value),placeholder:t,"aria-label":"Token",type:"password",autoComplete:"off",spellCheck:!1,className:"w-72 font-mono"}),(0,n.jsx)(y.Button,{type:"submit",size:"sm",loading:f,disabled:a.trim().length<w.KEY_MIN,children:s?"Replace":"Save"}),(s||r)&&(0,n.jsxs)(n.Fragment,{children:[null===i&&(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",onClick:()=>d(!1),children:"Cancel"}),(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",loading:b,onClick:()=>void k(),className:"ml-auto text-destructive hover:text-destructive",children:"Remove"})]})]}),i&&(0,n.jsx)("p",{className:"max-w-xl text-destructive",children:i})]})}function ez(){let[e,t]=(0,p.useState)(!1);return(0,n.jsxs)(y.Button,{size:"sm",variant:"outline",onClick:()=>void navigator.clipboard.writeText(ey).then(()=>{t(!0),setTimeout(()=>t(!1),2e3)}),children:[e?(0,n.jsx)(o.Check,{}):(0,n.jsx)(P.Copy,{}),e?"Copied":"Copy the manifest"]})}function eT({name:e,who:t,stopped:s}){let[r,i]=(0,ed.useServerAction)(eh,{onOk:()=>(0,ec.revalidate)(g.queryKey.reach)});return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pt-3 pl-8 text-[13px] text-muted-foreground",children:[(0,n.jsx)("span",{children:s?`${t} is let in.`:`${t} can write from a phone.`}),(0,n.jsx)(y.Button,{size:"sm",variant:"outline",loading:i,onClick:async()=>{await j.notify.confirm({title:`Let ${t} go?`,description:"Nobody can write to Thursday through this service until someone is let in again.",okText:"Let them go",destructive:!0})&&r(e)},children:"Let them go"})]})}let eP=(e,t)=>{let n=e?.lastIndexOf(":")??-1;return n>0&&e?{host:e.slice(0,n),port:e.slice(n+1)}:{host:"",port:String(t)}};function eK({mailbox:e,refused:t}){let[s,r]=(0,p.useState)(!1),[i,a]=(0,p.useState)(e?.address??""),[o,l]=(0,p.useState)(""),[d,c]=(0,p.useState)(!1),[u,h]=(0,p.useState)(()=>eP(void 0,993)),[m,f]=(0,p.useState)(()=>eP(void 0,465)),{data:x}=(0,ec.useServerRoute)(g.queryKey.config),b=()=>{l(""),r(!1),c(!1),(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.reach)},[k,w]=(0,ed.useServerAction)(ex,{onOk:e=>{if(e?.found)return b();c(!0)}}),[N,S]=(0,ed.useServerAction)(ef,{onOk:b}),C=async()=>{await j.notify.confirm({title:"Remove her mailbox?",description:"Email stops, and the address that could write is let go. The mailbox itself is not touched.",okText:"Remove",destructive:!0})&&N()};if((0,T.isConfigFromEnv)(x,ep.EMAIL_PASSWORD_KEY))return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"max-w-xl text-muted-foreground",children:(0,T.envWords)("Her mailbox's app password")}),t&&(0,n.jsx)("p",{className:"max-w-xl text-destructive",children:t})]});if(e&&!s&&null===t)return(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[e.address," · ",e.imap," · ",e.smtp]}),(0,n.jsx)(y.Button,{size:"xs",variant:"ghost",onClick:()=>{a(e.address),r(!0)},className:"-ml-2 text-muted-foreground",children:"Change"})]});let A=i.includes("@")?i.slice(i.lastIndexOf("@")+1):"Its domain",M="grid gap-1 font-mono text-[11px] text-muted-foreground";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("form",{className:"space-y-2.5",onSubmit:t=>{t.preventDefault();let n=!d&&e?.address.toLowerCase()===i.trim().toLowerCase();k({address:i.trim(),password:o,...d?{imap:`${u.host.trim()}:${u.port.trim()}`,smtp:`${m.host.trim()}:${m.port.trim()}`}:n?{imap:e.imap,smtp:e.smtp}:{}})},children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[(0,n.jsxs)("label",{className:M,children:["Address",(0,n.jsx)(v.Input,{value:i,onChange:e=>{a(e.target.value),c(!1)},placeholder:"thursday@example.com",type:"email",autoComplete:"off",spellCheck:!1,className:"w-64 font-sans"})]}),(0,n.jsxs)("label",{className:M,children:["App password",(0,n.jsx)(v.Input,{value:o,onChange:e=>l(e.target.value),placeholder:"paste it here",type:"password",autoComplete:"off",spellCheck:!1,className:"w-52 placeholder:font-sans"})]})]}),d&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("p",{className:"max-w-xl text-muted-foreground",children:[A," doesn't say where its mail servers are. Its help pages name them — one for reading mail (IMAP) and one for sending it (SMTP)."]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[(0,n.jsx)(e_,{label:"Reading server",looks:`imap.${A}`,value:u,onChange:h}),(0,n.jsx)(e_,{label:"Sending server",looks:`smtp.${A}`,value:m,onChange:f})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)(y.Button,{type:"submit",size:"sm",loading:w,disabled:!i.includes("@")||o.trim().length<8||d&&!(u.host.trim()&&m.host.trim()),children:e?"Replace":"Save"}),e&&(0,n.jsxs)(n.Fragment,{children:[null===t&&(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",onClick:()=>r(!1),children:"Cancel"}),(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",loading:S,onClick:()=>void C(),className:"ml-auto text-destructive hover:text-destructive",children:"Remove"})]})]})]}),t&&(0,n.jsx)("p",{className:"max-w-xl text-destructive",children:t})]})}function e_({label:e,looks:t,value:s,onChange:r}){let i="grid gap-1 font-mono text-[11px] text-muted-foreground";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{className:i,children:[e,(0,n.jsx)(v.Input,{value:s.host,onChange:e=>r({...s,host:e.target.value}),placeholder:t,autoComplete:"off",spellCheck:!1,className:"w-52 font-mono"})]}),(0,n.jsxs)("label",{className:i,children:["Port",(0,n.jsx)(v.Input,{value:s.port,onChange:e=>r({...s,port:e.target.value}),inputMode:"numeric",autoComplete:"off",className:"w-18 font-mono"})]})]})}function e$({who:e}){let[t,s]=(0,p.useState)(!1),[r,i]=(0,p.useState)(""),a=()=>{i(""),s(!1),(0,ec.revalidate)(g.queryKey.reach)},[o,l]=(0,ed.useServerAction)(em,{onOk:a}),[d,c]=(0,ed.useServerAction)(eh,{onOk:a});return e&&!t?(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground",children:e}),(0,n.jsx)(y.Button,{size:"xs",variant:"ghost",onClick:()=>s(!0),className:"-ml-2 text-muted-foreground",children:"Change"})]}):(0,n.jsxs)("form",{className:"flex flex-wrap items-center gap-2",onSubmit:e=>{e.preventDefault(),o("email",r.trim())},children:[(0,n.jsx)(v.Input,{value:r,onChange:e=>i(e.target.value),placeholder:"you@example.org","aria-label":"Your own address",type:"email",autoComplete:"email",spellCheck:!1,className:"w-64"}),(0,n.jsx)(y.Button,{type:"submit",size:"sm",loading:l,disabled:!r.includes("@"),children:e?"Replace":"Save"}),e&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",onClick:()=>s(!1),children:"Cancel"}),(0,n.jsx)(y.Button,{size:"sm",variant:"ghost",loading:c,onClick:async()=>{await j.notify.confirm({title:`Stop reading mail from ${e}?`,description:"Nobody can write to Thursday by email until an address is named again.",okText:"Stop",destructive:!0})&&d("email")},className:"ml-auto text-destructive hover:text-destructive",children:"Remove"})]})]})}function eO({address:e}){let[t,s]=(0,p.useState)(!1);return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsxs)(eI,{href:`mailto:${e}`,children:["Write to ",e]}),(0,n.jsxs)(y.Button,{size:"sm",variant:"outline",onClick:()=>void navigator.clipboard.writeText(e).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)}),children:[t?(0,n.jsx)(o.Check,{}):(0,n.jsx)(P.Copy,{}),t?"Copied":"Copy her address"]})]})}let eB={[T.EXA_API_KEY]:f.Search},eL={image:h.Image,video:u,speech:i.AudioLines,transcription:a.Captions},eq={keys:["voice","easy","text","search"],models:["bots","studio"]};function eD({screen:e}){let{data:t,isLoading:s,error:r}=(0,ec.useServerRoute)(g.queryKey.config),i=(0,R.useVoiceLine)();if(s)return(0,n.jsx)(el.SettingSkeleton,{rows:4});if(r)return(0,n.jsx)(el.SettingError,{message:r.message});let a=e=>(0,T.isConfigSet)(t,e),o=e=>(0,T.isConfigUnreadable)(t,e),l=e=>(0,T.isConfigFromEnv)(t,e),d=e=>(0,T.groupSatisfied)(e,e.id===T.VOICE_GROUP_ID?i.countsForCall:a),c=e=>t?.find(t=>t.key===e)?.value,u=eq[e].flatMap(e=>T.CONFIG_GROUPS.find(t=>t.id===e)??[]),h=u.filter(e=>"keys"===e.section).flatMap(e=>e.entries),m=h.filter(e=>o(e.key)).length;return(0,n.jsx)(el.SettingScreen,{footer:(0,n.jsx)(el.SettingRailNote,{children:"models"===e?"Her own voice and backend models are in Thursday. A bot can pick its own on its page.":`${h.filter(e=>a(e.key)).length} of ${h.length} set${m?` \xb7 ${m} to enter again`:""}${u.some(e=>!d(e))?" · a call needs the GPT Subscription or an OpenAI key":" · your keys stay on this machine"}`}),children:u.map(e=>(0,n.jsx)(el.SettingGroup,{label:e.title,hint:e.hint,right:(0,n.jsx)(eW,{group:e,met:d(e)}),children:"easy"===e.id?(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:e.entries.map(e=>(0,n.jsx)(eU,{card:!0,entry:e,set:a(e.key),lost:o(e.key),env:l(e.key)},e.key))}):"text"===e.id?(0,n.jsx)("div",{className:"flex flex-wrap gap-x-1.5 gap-y-3.5",children:e.entries.map(e=>(0,n.jsx)(eH,{entry:e,set:a(e.key),lost:o(e.key),env:l(e.key)},e.key))}):(0,n.jsx)(el.SettingItems,{children:e.entries.map(t=>t.effortOf?null:t.choices?(0,n.jsx)(e3,{entry:t,choices:t.choices,value:c(t.key),effort:e8(e,t.key),effortValue:c(T.DEFAULT_EFFORT_KEY)},t.key):(0,n.jsx)(eU,{entry:t,set:a(t.key),lost:o(t.key),env:l(t.key)},t.key))})},e.id))})}function eH({entry:e,set:t,lost:s,env:r}){return(0,n.jsxs)("button",{type:"button",onClick:()=>e5(e,t),"aria-label":`${e.label}: ${r?"set in env":t?"set":s?"enter it again":"not set"}`,className:"group flex w-17 flex-col items-center gap-1.5 rounded-xl py-1 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,n.jsxs)("span",{className:"relative grid size-10.5 place-items-center rounded-[13px] bg-muted/60 transition-colors group-hover:bg-muted",children:[(0,n.jsx)(e2,{entry:e}),t?(0,n.jsx)("span",{className:"absolute -top-1 -right-1 grid size-4 place-items-center rounded-full bg-primary text-primary-foreground ring-2 ring-background",children:(0,n.jsx)(o.Check,{className:"size-2.5"})}):s&&(0,n.jsx)("span",{className:"absolute -top-1 -right-1 grid size-4 place-items-center rounded-full bg-waiting text-background ring-2 ring-background",children:(0,n.jsx)(x.TriangleAlert,{className:"size-2.5"})})]}),(0,n.jsx)("span",{className:(0,eu.cn)("max-w-full truncate text-[11px]",t?"text-foreground":"text-muted-foreground"),children:e.label}),r&&(0,n.jsx)("span",{className:"-mt-1.5 font-mono text-[10px] text-muted-foreground",children:"env"})]})}function eW({group:e,met:t}){return"none"===e.require?null:t?(0,n.jsxs)("span",{className:"flex items-center gap-1 font-mono text-[11px] text-muted-foreground",children:[(0,n.jsx)(o.Check,{className:"size-3"}),"ready"]}):(0,n.jsxs)("span",{className:(0,eu.cn)("flex items-center gap-1 font-mono text-[11px]",eu.WAITING_INK),children:[(0,n.jsx)(x.TriangleAlert,{className:"size-3"}),e.note??"Required"]})}function eU({entry:e,set:t,lost:s,env:r,card:i=!1,narrow:a=!1}){let d=eV(e,t),c=eX(e,t),u=eQ(e,t),h=c.data?eZ(c.data):eG(t,d.data,e.signIn,s,r),m=d.isLoading||c.isLoading,f=(0,n.jsxs)("span",{className:(0,eu.cn)("flex shrink-0 items-center gap-1.5 font-mono text-xs",h.ink),children:[h.warn?(0,n.jsx)(x.TriangleAlert,{className:"size-3"}):t&&(0,n.jsx)(o.Check,{className:"size-3"}),h.text]});return(0,n.jsxs)("button",{type:"button",onClick:()=>{var s;return e.signIn?(s=e,j.notify.component({className:"sm:max-w-md",renderer:({close:e})=>(0,n.jsx)(e4,{entry:s,onDone:e})})):e5(e,t)},className:(0,eu.cn)("group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",i&&"rounded-xl border border-border/60"),children:[(0,n.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,n.jsx)(e2,{entry:e})}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,n.jsxs)("span",{className:"flex items-center gap-2 truncate text-sm font-medium",children:[e.label,e.signIn&&t&&(0,n.jsx)(e0,{usage:c.data,plan:u})]}),a?m?(0,n.jsx)(k.Skeleton,{className:"h-3 w-20"}):f:(0,n.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:e.signIn?t?eJ(c.data)??"signed in":"sign in with your account":e.key}),e.signIn&&t&&c.data&&(0,n.jsx)(e1,{usage:c.data})]}),a?null:m?(0,n.jsx)(k.Skeleton,{className:"h-3 w-20 shrink-0"}):f,(0,n.jsx)(l.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}let eY=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function eG(e,t,n,s=!1,r=!1){var i,a,o;let l=function(e,t,n,s=!1){return!e&&s?{text:n?"Sign in again":"Enter again",ink:eu.WAITING_INK,warn:!0}:e?t?"refused"in t?{text:"Key refused",ink:"text-destructive",warn:!0}:{text:`${eY.format(t.balance)} left`,ink:t.low?eu.WAITING_INK:"text-muted-foreground",warn:t.low}:{text:n?"Signed in":"Set",ink:"text-muted-foreground",warn:!1}:{text:n?"Signed out":"Not set",ink:"text-muted-foreground",warn:!1}}(e,t,n,s);return e?(i=l,a=r,o=!!t,a?o?{...i,text:`${i.text} \xb7 env`}:{...i,text:"Set in env"}:i):l}function eV(e,t){return(0,ec.useServerRoute)(t&&(0,M.isCatalogProvider)(e.provider)?g.queryKey.keyCredits(e.provider):null)}function eQ(e,t){let{data:n}=(0,ec.useServerRoute)(t&&e.signIn?g.queryKey.llmModel:null);return n?.find(t=>t.id===e.provider)?.plan??null}function eX(e,t){return(0,ec.useServerRoute)(t&&e.signIn?g.queryKey.subscriptionUsage:null)}function eZ(e){return"refused"in e?{text:"Sign-in refused",ink:"text-destructive",warn:!0}:{text:e.spent?"Limit reached":`${e.usedPercent}% used`,ink:e.high?eu.WAITING_INK:"text-muted-foreground",warn:e.high}}function eJ(e){let t=!e||"refused"in e?null:e;return t?.resetsAt?`resets in ${(0,s.formatDistanceToNowStrict)(new Date(t.resetsAt))}`:null}function e0({usage:e,plan:t}){let s=(0,M.planName)((!e||"refused"in e?null:e.plan)??t);return s?(0,n.jsx)("span",{className:"rounded-full px-1.5 font-mono text-[9.5px] leading-4 font-normal text-foreground ring-1 ring-border ring-inset",children:s}):null}function e1({usage:e}){return"refused"in e?null:(0,n.jsx)("span",{role:"meter","aria-label":"Plan used","aria-valuenow":e.usedPercent,"aria-valuemin":0,"aria-valuemax":100,className:"mt-1.5 block h-1 w-full max-w-48 overflow-hidden rounded-full bg-muted",children:(0,n.jsx)("span",{className:(0,eu.cn)("block h-full rounded-full transition-[width] duration-500",e.high?"bg-waiting":"bg-foreground/45"),style:{width:`${Math.min(100,Math.max(2,e.usedPercent))}%`}})})}function e2({entry:e}){if(e.provider)return(0,n.jsx)(A.ProviderIcon,{provider:e.provider,className:"size-4"});let t=eB[e.key]??m.KeyRound,s=(0,n.jsx)(t,{className:"size-4 text-muted-foreground"});return e.site?(0,n.jsx)(b.SiteIcon,{host:e.site,className:"size-4 rounded-[4px]",fallback:s}):s}function e3({entry:e,choices:t,value:s,effort:r,effortValue:i}){let a=e.text?(0,M.parseTextModel)(s):(0,M.parseMediaModel)(s),{data:o}=(0,ec.useServerRoute)(e.text&&!s&&g.queryKey.automaticModel),{data:l}=(0,ec.useServerRoute)(e.kind&&!s&&g.queryKey.llmModel),d=l?.find(e=>e.signIn),c=e.kind&&!s?(0,M.planMediaOf)(e.kind,d?.hasKey?{plan:d.plan??null}:null):null,u=e.kind?eL[e.kind]:E.BotsMark,[h]=(0,ed.useServerAction)(z.setConfigAction,{onOk:()=>{(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.automaticModel)}}),[m]=(0,ed.useServerAction)(F,{onOk:()=>{(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.automaticModel)}});return(0,n.jsxs)("div",{className:"flex w-full items-start gap-3 p-4",children:[(0,n.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,n.jsx)(u,{className:"size-4 text-muted-foreground"})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,n.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 pt-1.5",children:[(0,n.jsx)("span",{className:"truncate text-sm font-medium",children:e.label}),!s&&(0,n.jsx)("span",{className:(0,eu.cn)("shrink-0 rounded-[5px] border border-border/60 px-1 font-mono text-[10px]",e.kind&&!c?eu.WAITING_INK:"text-muted-foreground"),children:e.kind&&!c?"off":"auto"})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)("div",{className:"min-w-0",children:(0,n.jsx)(C.ModelPicker,{kind:e.kind,provider:a?.provider??null,model:a?.model??"",unset:e.kind?c?`Automatic \xb7 ${t.find(e=>e.value===`${c.provider}/${c.model}`)?.label??c.model}`:"Not offered to bots until you pick one":function(e,t){if(!e)return"Automatic";if(!e.ref)return e.problem;let{provider:n,model:s}=e.ref,r=t.find(e=>e.value===`${n}/${s}`);return`Automatic \xb7 ${r?.label??s}`}(o,t),onChange:t=>h(e.key,`${t.provider}/${t.model.trim()}`),onUnset:s?()=>{m(e.key),r&&i&&m(r.key)}:void 0})}),r&&a&&(0,n.jsxs)("div",{className:"flex items-start gap-3 pt-0.5",children:[(0,n.jsx)("span",{className:"w-12 shrink-0 pt-1.5 font-mono text-[11px] text-muted-foreground",children:"effort"}),(0,n.jsx)(S.EffortSwitch,{provider:a.provider,model:a.model,value:M.effortSchema.safeParse(i).data??null,onChange:e=>e?h(r.key,e):m(r.key)})]})]})]})]})}let e8=(e,t)=>e.entries.find(e=>e.effortOf===t);function e4({entry:e,onDone:t}){let{data:s}=(0,ec.useServerRoute)(g.queryKey.config),r=(0,T.isConfigSet)(s,e.key),i=(0,T.isConfigUnreadable)(s,e.key),a=(0,T.isConfigFromEnv)(s,e.key),o=eQ(e,r),l=eX(e,r),d=l.data?eZ(l.data):null,[c,u]=(0,ed.useServerAction)(F,{okMessage:`Signed out of ${e.label}`,onOk:()=>{(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.llmModel),t()}});return(0,n.jsx)(el.SettingDialogContent,{title:e.label,description:r?(0,n.jsxs)(n.Fragment,{children:["Signed in ",(0,n.jsx)(e0,{usage:l.data,plan:o}),eJ(l.data)&&(0,n.jsxs)(n.Fragment,{children:[" · ",(0,n.jsx)("span",{className:"font-mono",children:eJ(l.data)})]}),d&&(0,n.jsxs)(n.Fragment,{children:[" · ",(0,n.jsx)("span",{className:(0,eu.cn)("font-mono",d.ink),children:d.text})]})]}):"Sign in with your ChatGPT account instead of a key",footer:(0,n.jsxs)(n.Fragment,{children:[(r||i)&&!a&&(0,n.jsx)(y.Button,{variant:"ghost",loading:u,onClick:async()=>{await j.notify.confirm({title:`Sign out of ${e.label}?`,description:"Nothing runs on your plan until you sign in again.",okText:"Sign out",destructive:!0})&&c(e.key)},children:"Sign out"}),(0,n.jsx)(y.Button,{variant:"ghost",onClick:t,children:r?"Close":"Cancel"}),!r&&(0,n.jsx)(N.ChatGptSignIn,{})]}),children:(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(el.SettingNote,{children:r?"Bots on this subscription spend your plan's usage, not a key. When it runs out, the job stops and says when it resets.":"The sign-in opens in its own window. Approve it there, and this turns to signed in by itself."}),l.data&&"refused"in l.data&&(0,n.jsx)(el.SettingNote,{className:"wrap-break-word text-destructive",children:l.data.refused}),i&&(0,n.jsx)(el.SettingNote,{className:(0,eu.cn)("wrap-break-word",eu.WAITING_INK),children:(0,T.lostWords)("The sign-in saved here","Sign in again.")}),a&&(0,n.jsx)(el.SettingNote,{className:"wrap-break-word",children:(0,T.envWords)(e.label)})]})})}function e5(e,t){return j.notify.component({className:"sm:max-w-md",renderer:({close:s})=>(0,n.jsx)(e6,{entry:e,set:t,onDone:s})})}function e6({entry:e,set:t,onDone:s}){let[i,a]=(0,p.useState)(""),{data:o}=(0,ec.useServerRoute)(g.queryKey.config),l=o?(0,T.isConfigSet)(o,e.key):t,d=(0,T.isConfigUnreadable)(o,e.key),c=(0,T.isConfigFromEnv)(o,e.key),{data:u}=eV(e,l),h=u?eG(l,u):null,m=()=>{(0,ec.revalidate)(g.queryKey.config),(0,ec.revalidate)(g.queryKey.llmModel)},[f,x]=(0,ed.useServerAction)(z.setConfigAction,{okMessage:`${e.label} key saved`,onOk:()=>{m(),s()}}),[b,k]=(0,ed.useServerAction)(F,{okMessage:`${e.label} key removed`,onOk:()=>{m(),s()}}),N=async()=>{await j.notify.confirm({title:`Remove the ${e.label} key?`,description:"It is deleted from this computer, and nothing runs on it until a key is pasted again.",okText:"Remove",destructive:!0})&&b(e.key)};return(0,n.jsx)(el.SettingDialogContent,{title:e.label,description:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"font-mono",children:e.key}),c?(0,n.jsx)(n.Fragment,{children:" · set in env"}):e.hint&&(0,n.jsxs)(n.Fragment,{children:[" · ",e.hint]}),h&&(0,n.jsxs)(n.Fragment,{children:[" · ",(0,n.jsx)("span",{className:(0,eu.cn)("font-mono",h.ink),children:h.text})]})]}),footer:c?(0,n.jsx)(y.Button,{onClick:s,children:"Close"}):(0,n.jsxs)(n.Fragment,{children:[(l||d)&&(0,n.jsx)(y.Button,{variant:"ghost",loading:k,onClick:()=>void N(),className:"mr-auto text-destructive hover:text-destructive",children:"Remove"}),(0,n.jsx)(y.Button,{variant:"ghost",onClick:s,children:"Cancel"}),(0,n.jsx)(y.Button,{loading:x,disabled:i.trim().length<w.KEY_MIN,onClick:()=>f(e.key,i),children:l?"Replace":"Save"})]}),children:(0,n.jsxs)("div",{className:"space-y-2",children:[c?(0,n.jsx)(el.SettingNote,{className:"wrap-break-word",children:(0,T.envWords)(e.label)}):(0,n.jsx)(v.Input,{value:i,onChange:e=>a(e.target.value),onKeyDown:t=>{"Enter"===t.key&&i.trim().length>=w.KEY_MIN&&f(e.key,i)},placeholder:l?"New value — replaces the current key":d?"Paste the key again":e.keyLooks??"Paste the key",spellCheck:!1,type:"password",autoFocus:!0}),!l&&e.keysAt&&(0,n.jsxs)("a",{href:e.keysAt,target:"_blank",rel:"noreferrer",className:"flex w-fit items-center gap-1 px-0.5 text-[13px] text-foreground underline underline-offset-3 hover:text-foreground/80",children:["Get a key at ",new URL(e.keysAt).host,(0,n.jsx)(r.ArrowUpRight,{className:"size-3.5"})]}),u&&"refused"in u&&(0,n.jsx)(el.SettingNote,{className:"wrap-break-word text-destructive",children:u.refused}),d&&(0,n.jsx)(el.SettingNote,{className:(0,eu.cn)("wrap-break-word",eu.WAITING_INK),children:(0,T.lostWords)("The key saved here","Paste it again.")})]})})}e.s(["KeysSetting",0,()=>(0,n.jsx)(eD,{screen:"keys"}),"ModelsSetting",0,()=>(0,n.jsx)(eD,{screen:"models"}),"PhoneSetting",0,()=>(0,n.jsx)(el.SettingScreen,{footer:(0,n.jsx)(el.SettingRailNote,{children:"Nothing on this computer is opened to the internet: the app asks the chat service, or her mailbox, what was written."}),children:(0,n.jsx)(ek,{})}),"PlanBadge",0,e0],805995)}]);