diff --git a/assets/AgentLogos-BBl9UNVD.js b/assets/AgentLogos-j-Qekw7T.js similarity index 99% rename from assets/AgentLogos-BBl9UNVD.js rename to assets/AgentLogos-j-Qekw7T.js index 08fcbca3ea64b65ff90dfe39f3c42c0968d79722..419afe23ed61aefb0de35cd00fd33a38babb344f 100644 --- a/assets/AgentLogos-BBl9UNVD.js +++ b/assets/AgentLogos-j-Qekw7T.js @@ -1 +1 @@ -import{j as e}from"./index-CbgxfyGU.js";const s="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='256'%20height='257'%20preserveAspectRatio='xMidYMid'%20viewBox='0%200%20256%20257'%3e%3cpath%20fill='%23D97757'%20d='m50.228%20170.321%2050.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0%20125.796l.583-3.759%205.12-3.434%207.324.648%2016.202%201.101%2024.304%201.685%2017.629%201.037%2026.118%202.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758%207-7.713%209.397.649%202.398.648%209.527%207.323%2020.35%2015.75L94.817%2091.9l3.889%203.24%201.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42%200%2082.05%201.426l4.472%203.888%206.61%2015.101%2010.694%2023.786%2016.591%2032.34%204.861%209.592%202.592%208.879.973%202.722h1.685v-1.556l1.36-18.211%202.528-22.36%202.463-28.776.843-8.1%204.018-9.722%207.971-5.25%206.222%202.981%205.12%207.324-.713%204.73-3.046%2019.768-5.962%2030.98-3.889%2020.739h2.268l2.593-2.593%2010.499-13.934%2017.628-22.036%207.778-8.749%209.073-9.657%205.833-4.601h11.018l8.1%2012.055-3.628%2012.443-11.342%2014.388-9.398%2012.184-13.48%2018.147-8.426%2014.518.778%201.166%202.01-.194%2030.46-6.481%2016.462-2.982%2019.637-3.37%208.88%204.148.971%204.213-3.5%208.62-20.998%205.184-24.628%204.926-36.682%208.685-.454.324.519.648%2016.526%201.555%207.065.389h17.304l32.21%202.398%208.426%205.574%205.055%206.805-.843%205.184-12.962%206.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666%2011.406%2021.387%2019.314%2026.767%2024.887%201.36%206.157-3.434%204.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73%206.935%2025.017%2037.59%201.296%2011.536-1.814%203.76-6.481%202.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194%2077.448-3.37%203.953-7.778%202.981-6.48-4.925-3.436-7.972%203.435-15.749%204.148-20.544%203.37-16.333%203.046-20.285%201.815-6.74-.13-.454-1.49.194-15.295%2020.999-23.267%2031.433-18.406%2019.702-4.407%201.75-7.648-3.954.713-7.064%204.277-6.286%2025.47-32.405%2015.36-20.092%209.917-11.6-.065-1.686h-.583L44.07%20198.125l-12.055%201.555-5.185-4.86.648-7.972%202.463-2.593%2020.35-13.999-.064.065Z'/%3e%3c/svg%3e",a="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='256'%20height='257'%20preserveAspectRatio='xMidYMid'%20viewBox='0%200%20256%20257'%3e%3cpath%20fill='%23D97757'%20d='m50.228%20170.321%2050.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0%20125.796l.583-3.759%205.12-3.434%207.324.648%2016.202%201.101%2024.304%201.685%2017.629%201.037%2026.118%202.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758%207-7.713%209.397.649%202.398.648%209.527%207.323%2020.35%2015.75L94.817%2091.9l3.889%203.24%201.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42%200%2082.05%201.426l4.472%203.888%206.61%2015.101%2010.694%2023.786%2016.591%2032.34%204.861%209.592%202.592%208.879.973%202.722h1.685v-1.556l1.36-18.211%202.528-22.36%202.463-28.776.843-8.1%204.018-9.722%207.971-5.25%206.222%202.981%205.12%207.324-.713%204.73-3.046%2019.768-5.962%2030.98-3.889%2020.739h2.268l2.593-2.593%2010.499-13.934%2017.628-22.036%207.778-8.749%209.073-9.657%205.833-4.601h11.018l8.1%2012.055-3.628%2012.443-11.342%2014.388-9.398%2012.184-13.48%2018.147-8.426%2014.518.778%201.166%202.01-.194%2030.46-6.481%2016.462-2.982%2019.637-3.37%208.88%204.148.971%204.213-3.5%208.62-20.998%205.184-24.628%204.926-36.682%208.685-.454.324.519.648%2016.526%201.555%207.065.389h17.304l32.21%202.398%208.426%205.574%205.055%206.805-.843%205.184-12.962%206.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666%2011.406%2021.387%2019.314%2026.767%2024.887%201.36%206.157-3.434%204.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73%206.935%2025.017%2037.59%201.296%2011.536-1.814%203.76-6.481%202.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194%2077.448-3.37%203.953-7.778%202.981-6.48-4.925-3.436-7.972%203.435-15.749%204.148-20.544%203.37-16.333%203.046-20.285%201.815-6.74-.13-.454-1.49.194-15.295%2020.999-23.267%2031.433-18.406%2019.702-4.407%201.75-7.648-3.954.713-7.064%204.277-6.286%2025.47-32.405%2015.36-20.092%209.917-11.6-.065-1.686h-.583L44.07%20198.125l-12.055%201.555-5.185-4.86.648-7.972%202.463-2.593%2020.35-13.999-.064.065Z'/%3e%3c/svg%3e",h="data:image/svg+xml,%3csvg%20fill='%23111'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M8.086.457a6.105%206.105%200%20013.046-.415c1.333.153%202.521.72%203.564%201.7a.117.117%200%2000.107.029c1.408-.346%202.762-.224%204.061.366l.063.03.154.076c1.357.703%202.33%201.77%202.918%203.198.278.679.418%201.388.421%202.126a5.655%205.655%200%2001-.18%201.631.167.167%200%2000.04.155%205.982%205.982%200%20011.578%202.891c.385%201.901-.01%203.615-1.183%205.14l-.182.22a6.063%206.063%200%2001-2.934%201.851.162.162%200%2000-.108.102c-.255.736-.511%201.364-.987%201.992-1.199%201.582-2.962%202.462-4.948%202.451-1.583-.008-2.986-.587-4.21-1.736a.145.145%200%2000-.14-.032c-.518.167-1.04.191-1.604.185a5.924%205.924%200%2001-2.595-.622%206.058%206.058%200%2001-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74%207.74%200%2001-.495-1.283%206.11%206.11%200%2001-.017-3.064.166.166%200%2000.008-.074.115.115%200%2000-.037-.064%205.958%205.958%200%2001-1.38-2.202%205.196%205.196%200%2001-.333-1.589%206.915%206.915%200%2001.188-2.132c.45-1.484%201.309-2.648%202.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129%200%2000.087-.087A6.016%206.016%200%20015.635%202.31C6.315%201.464%207.132.846%208.086.457zm-.804%207.85a.848.848%200%2000-1.473.842l1.694%202.965-1.688%202.848a.849.849%200%20001.46.864l1.94-3.272a.849.849%200%2000.007-.854l-1.94-3.393zm5.446%206.24a.849.849%200%20000%201.695h4.848a.849.849%200%20000-1.696h-4.848z'%3e%3c/path%3e%3c/svg%3e",o="data:image/svg+xml,%3csvg%20fill='%23fff'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M8.086.457a6.105%206.105%200%20013.046-.415c1.333.153%202.521.72%203.564%201.7a.117.117%200%2000.107.029c1.408-.346%202.762-.224%204.061.366l.063.03.154.076c1.357.703%202.33%201.77%202.918%203.198.278.679.418%201.388.421%202.126a5.655%205.655%200%2001-.18%201.631.167.167%200%2000.04.155%205.982%205.982%200%20011.578%202.891c.385%201.901-.01%203.615-1.183%205.14l-.182.22a6.063%206.063%200%2001-2.934%201.851.162.162%200%2000-.108.102c-.255.736-.511%201.364-.987%201.992-1.199%201.582-2.962%202.462-4.948%202.451-1.583-.008-2.986-.587-4.21-1.736a.145.145%200%2000-.14-.032c-.518.167-1.04.191-1.604.185a5.924%205.924%200%2001-2.595-.622%206.058%206.058%200%2001-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74%207.74%200%2001-.495-1.283%206.11%206.11%200%2001-.017-3.064.166.166%200%2000.008-.074.115.115%200%2000-.037-.064%205.958%205.958%200%2001-1.38-2.202%205.196%205.196%200%2001-.333-1.589%206.915%206.915%200%2001.188-2.132c.45-1.484%201.309-2.648%202.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129%200%2000.087-.087A6.016%206.016%200%20015.635%202.31C6.315%201.464%207.132.846%208.086.457zm-.804%207.85a.848.848%200%2000-1.473.842l1.694%202.965-1.688%202.848a.849.849%200%20001.46.864l1.94-3.272a.849.849%200%2000.007-.854l-1.94-3.393zm5.446%206.24a.849.849%200%20000%201.695h4.848a.849.849%200%20000-1.696h-4.848z'%3e%3c/path%3e%3c/svg%3e",r="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='cursor_light__Ebene_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20466.73%20532.09'%3e%3c!--Generator:%20Adobe%20Illustrator%2029.6.1,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%209)--%3e%3cdefs%3e%3cstyle%3e.cursor_light__st0{fill:%2326251e}%3c/style%3e%3c/defs%3e%3cpath%20class='cursor_light__st0'%20d='M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z'/%3e%3c/svg%3e",d="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='cursor_dark__Ebene_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20466.73%20532.09'%3e%3c!--Generator:%20Adobe%20Illustrator%2029.6.1,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%209)--%3e%3cdefs%3e%3cstyle%3e.cursor_dark__st0{fill:%23edecec}%3c/style%3e%3c/defs%3e%3cpath%20class='cursor_dark__st0'%20d='M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z'/%3e%3c/svg%3e",n="data:image/svg+xml,%3csvg%20width='512'%20height='512'%20viewBox='0%200%20512%20512'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='512'%20height='512'%20fill='%23FDFCFC'/%3e%3cpath%20d='M320%20224V352H192V224H320Z'%20fill='%23E6E5E6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M384%20416H128V96H384V416ZM320%20160H192V352H320V160Z'%20fill='%2317181C'/%3e%3c/svg%3e",g="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='512'%20height='512'%3e%3csvg%20width='512'%20height='512'%20viewBox='0%200%20512%20512'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='512'%20height='512'%20fill='%23131010'%3e%3c/rect%3e%3cpath%20d='M320%20224V352H192V224H320Z'%20fill='%235A5858'%3e%3c/path%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M384%20416H128V96H384V416ZM320%20160H192V352H320V160Z'%20fill='white'%3e%3c/path%3e%3c/svg%3e%3cstyle%3e@media%20(prefers-color-scheme:%20light)%20{%20:root%20{%20filter:%20none;%20}%20}%20@media%20(prefers-color-scheme:%20dark)%20{%20:root%20{%20filter:%20none;%20}%20}%20%3c/style%3e%3c/svg%3e",i=[{name:"Claude",light:s,dark:a},{name:"Codex",light:h,dark:o},{name:"Cursor",light:r,dark:d},{name:"OpenCode",light:n,dark:g}];function w(){return e.jsx("span",{className:"ml-1 inline-flex shrink-0 items-center gap-1.5","aria-hidden":"true",children:i.map(({name:l,light:t,dark:c})=>e.jsxs("span",{title:l,className:"inline-flex h-[18px] w-[18px]",children:[e.jsx("img",{src:t,alt:"",width:18,height:18,className:"h-full w-full object-contain dark:hidden"}),e.jsx("img",{src:c,alt:"",width:18,height:18,className:"hidden h-full w-full object-contain dark:block"})]},l))})}function m(){return e.jsx("ul",{className:"flex flex-wrap gap-2","aria-label":"Supported coding agents",children:i.map(({name:l,light:t,dark:c})=>e.jsxs("li",{className:"inline-flex items-center gap-2 rounded-full border px-3 py-1 text-sm",children:[e.jsx("img",{src:t,alt:"",width:18,height:18,className:"h-[18px] w-[18px] object-contain dark:hidden"}),e.jsx("img",{src:c,alt:"",width:18,height:18,className:"hidden h-[18px] w-[18px] object-contain dark:block"}),l]},l))})}export{w as A,m as a}; +import{j as e}from"./index-DyXq7-Tg.js";const s="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='256'%20height='257'%20preserveAspectRatio='xMidYMid'%20viewBox='0%200%20256%20257'%3e%3cpath%20fill='%23D97757'%20d='m50.228%20170.321%2050.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0%20125.796l.583-3.759%205.12-3.434%207.324.648%2016.202%201.101%2024.304%201.685%2017.629%201.037%2026.118%202.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758%207-7.713%209.397.649%202.398.648%209.527%207.323%2020.35%2015.75L94.817%2091.9l3.889%203.24%201.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42%200%2082.05%201.426l4.472%203.888%206.61%2015.101%2010.694%2023.786%2016.591%2032.34%204.861%209.592%202.592%208.879.973%202.722h1.685v-1.556l1.36-18.211%202.528-22.36%202.463-28.776.843-8.1%204.018-9.722%207.971-5.25%206.222%202.981%205.12%207.324-.713%204.73-3.046%2019.768-5.962%2030.98-3.889%2020.739h2.268l2.593-2.593%2010.499-13.934%2017.628-22.036%207.778-8.749%209.073-9.657%205.833-4.601h11.018l8.1%2012.055-3.628%2012.443-11.342%2014.388-9.398%2012.184-13.48%2018.147-8.426%2014.518.778%201.166%202.01-.194%2030.46-6.481%2016.462-2.982%2019.637-3.37%208.88%204.148.971%204.213-3.5%208.62-20.998%205.184-24.628%204.926-36.682%208.685-.454.324.519.648%2016.526%201.555%207.065.389h17.304l32.21%202.398%208.426%205.574%205.055%206.805-.843%205.184-12.962%206.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666%2011.406%2021.387%2019.314%2026.767%2024.887%201.36%206.157-3.434%204.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73%206.935%2025.017%2037.59%201.296%2011.536-1.814%203.76-6.481%202.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194%2077.448-3.37%203.953-7.778%202.981-6.48-4.925-3.436-7.972%203.435-15.749%204.148-20.544%203.37-16.333%203.046-20.285%201.815-6.74-.13-.454-1.49.194-15.295%2020.999-23.267%2031.433-18.406%2019.702-4.407%201.75-7.648-3.954.713-7.064%204.277-6.286%2025.47-32.405%2015.36-20.092%209.917-11.6-.065-1.686h-.583L44.07%20198.125l-12.055%201.555-5.185-4.86.648-7.972%202.463-2.593%2020.35-13.999-.064.065Z'/%3e%3c/svg%3e",a="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='256'%20height='257'%20preserveAspectRatio='xMidYMid'%20viewBox='0%200%20256%20257'%3e%3cpath%20fill='%23D97757'%20d='m50.228%20170.321%2050.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0%20125.796l.583-3.759%205.12-3.434%207.324.648%2016.202%201.101%2024.304%201.685%2017.629%201.037%2026.118%202.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758%207-7.713%209.397.649%202.398.648%209.527%207.323%2020.35%2015.75L94.817%2091.9l3.889%203.24%201.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42%200%2082.05%201.426l4.472%203.888%206.61%2015.101%2010.694%2023.786%2016.591%2032.34%204.861%209.592%202.592%208.879.973%202.722h1.685v-1.556l1.36-18.211%202.528-22.36%202.463-28.776.843-8.1%204.018-9.722%207.971-5.25%206.222%202.981%205.12%207.324-.713%204.73-3.046%2019.768-5.962%2030.98-3.889%2020.739h2.268l2.593-2.593%2010.499-13.934%2017.628-22.036%207.778-8.749%209.073-9.657%205.833-4.601h11.018l8.1%2012.055-3.628%2012.443-11.342%2014.388-9.398%2012.184-13.48%2018.147-8.426%2014.518.778%201.166%202.01-.194%2030.46-6.481%2016.462-2.982%2019.637-3.37%208.88%204.148.971%204.213-3.5%208.62-20.998%205.184-24.628%204.926-36.682%208.685-.454.324.519.648%2016.526%201.555%207.065.389h17.304l32.21%202.398%208.426%205.574%205.055%206.805-.843%205.184-12.962%206.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666%2011.406%2021.387%2019.314%2026.767%2024.887%201.36%206.157-3.434%204.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73%206.935%2025.017%2037.59%201.296%2011.536-1.814%203.76-6.481%202.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194%2077.448-3.37%203.953-7.778%202.981-6.48-4.925-3.436-7.972%203.435-15.749%204.148-20.544%203.37-16.333%203.046-20.285%201.815-6.74-.13-.454-1.49.194-15.295%2020.999-23.267%2031.433-18.406%2019.702-4.407%201.75-7.648-3.954.713-7.064%204.277-6.286%2025.47-32.405%2015.36-20.092%209.917-11.6-.065-1.686h-.583L44.07%20198.125l-12.055%201.555-5.185-4.86.648-7.972%202.463-2.593%2020.35-13.999-.064.065Z'/%3e%3c/svg%3e",h="data:image/svg+xml,%3csvg%20fill='%23111'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M8.086.457a6.105%206.105%200%20013.046-.415c1.333.153%202.521.72%203.564%201.7a.117.117%200%2000.107.029c1.408-.346%202.762-.224%204.061.366l.063.03.154.076c1.357.703%202.33%201.77%202.918%203.198.278.679.418%201.388.421%202.126a5.655%205.655%200%2001-.18%201.631.167.167%200%2000.04.155%205.982%205.982%200%20011.578%202.891c.385%201.901-.01%203.615-1.183%205.14l-.182.22a6.063%206.063%200%2001-2.934%201.851.162.162%200%2000-.108.102c-.255.736-.511%201.364-.987%201.992-1.199%201.582-2.962%202.462-4.948%202.451-1.583-.008-2.986-.587-4.21-1.736a.145.145%200%2000-.14-.032c-.518.167-1.04.191-1.604.185a5.924%205.924%200%2001-2.595-.622%206.058%206.058%200%2001-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74%207.74%200%2001-.495-1.283%206.11%206.11%200%2001-.017-3.064.166.166%200%2000.008-.074.115.115%200%2000-.037-.064%205.958%205.958%200%2001-1.38-2.202%205.196%205.196%200%2001-.333-1.589%206.915%206.915%200%2001.188-2.132c.45-1.484%201.309-2.648%202.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129%200%2000.087-.087A6.016%206.016%200%20015.635%202.31C6.315%201.464%207.132.846%208.086.457zm-.804%207.85a.848.848%200%2000-1.473.842l1.694%202.965-1.688%202.848a.849.849%200%20001.46.864l1.94-3.272a.849.849%200%2000.007-.854l-1.94-3.393zm5.446%206.24a.849.849%200%20000%201.695h4.848a.849.849%200%20000-1.696h-4.848z'%3e%3c/path%3e%3c/svg%3e",o="data:image/svg+xml,%3csvg%20fill='%23fff'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M8.086.457a6.105%206.105%200%20013.046-.415c1.333.153%202.521.72%203.564%201.7a.117.117%200%2000.107.029c1.408-.346%202.762-.224%204.061.366l.063.03.154.076c1.357.703%202.33%201.77%202.918%203.198.278.679.418%201.388.421%202.126a5.655%205.655%200%2001-.18%201.631.167.167%200%2000.04.155%205.982%205.982%200%20011.578%202.891c.385%201.901-.01%203.615-1.183%205.14l-.182.22a6.063%206.063%200%2001-2.934%201.851.162.162%200%2000-.108.102c-.255.736-.511%201.364-.987%201.992-1.199%201.582-2.962%202.462-4.948%202.451-1.583-.008-2.986-.587-4.21-1.736a.145.145%200%2000-.14-.032c-.518.167-1.04.191-1.604.185a5.924%205.924%200%2001-2.595-.622%206.058%206.058%200%2001-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74%207.74%200%2001-.495-1.283%206.11%206.11%200%2001-.017-3.064.166.166%200%2000.008-.074.115.115%200%2000-.037-.064%205.958%205.958%200%2001-1.38-2.202%205.196%205.196%200%2001-.333-1.589%206.915%206.915%200%2001.188-2.132c.45-1.484%201.309-2.648%202.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129%200%2000.087-.087A6.016%206.016%200%20015.635%202.31C6.315%201.464%207.132.846%208.086.457zm-.804%207.85a.848.848%200%2000-1.473.842l1.694%202.965-1.688%202.848a.849.849%200%20001.46.864l1.94-3.272a.849.849%200%2000.007-.854l-1.94-3.393zm5.446%206.24a.849.849%200%20000%201.695h4.848a.849.849%200%20000-1.696h-4.848z'%3e%3c/path%3e%3c/svg%3e",r="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='cursor_light__Ebene_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20466.73%20532.09'%3e%3c!--Generator:%20Adobe%20Illustrator%2029.6.1,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%209)--%3e%3cdefs%3e%3cstyle%3e.cursor_light__st0{fill:%2326251e}%3c/style%3e%3c/defs%3e%3cpath%20class='cursor_light__st0'%20d='M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z'/%3e%3c/svg%3e",d="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='cursor_dark__Ebene_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20466.73%20532.09'%3e%3c!--Generator:%20Adobe%20Illustrator%2029.6.1,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%209)--%3e%3cdefs%3e%3cstyle%3e.cursor_dark__st0{fill:%23edecec}%3c/style%3e%3c/defs%3e%3cpath%20class='cursor_dark__st0'%20d='M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z'/%3e%3c/svg%3e",n="data:image/svg+xml,%3csvg%20width='512'%20height='512'%20viewBox='0%200%20512%20512'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='512'%20height='512'%20fill='%23FDFCFC'/%3e%3cpath%20d='M320%20224V352H192V224H320Z'%20fill='%23E6E5E6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M384%20416H128V96H384V416ZM320%20160H192V352H320V160Z'%20fill='%2317181C'/%3e%3c/svg%3e",g="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='512'%20height='512'%3e%3csvg%20width='512'%20height='512'%20viewBox='0%200%20512%20512'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='512'%20height='512'%20fill='%23131010'%3e%3c/rect%3e%3cpath%20d='M320%20224V352H192V224H320Z'%20fill='%235A5858'%3e%3c/path%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M384%20416H128V96H384V416ZM320%20160H192V352H320V160Z'%20fill='white'%3e%3c/path%3e%3c/svg%3e%3cstyle%3e@media%20(prefers-color-scheme:%20light)%20{%20:root%20{%20filter:%20none;%20}%20}%20@media%20(prefers-color-scheme:%20dark)%20{%20:root%20{%20filter:%20none;%20}%20}%20%3c/style%3e%3c/svg%3e",i=[{name:"Claude",light:s,dark:a},{name:"Codex",light:h,dark:o},{name:"Cursor",light:r,dark:d},{name:"OpenCode",light:n,dark:g}];function w(){return e.jsx("span",{className:"ml-1 inline-flex shrink-0 items-center gap-1.5","aria-hidden":"true",children:i.map(({name:l,light:t,dark:c})=>e.jsxs("span",{title:l,className:"inline-flex h-[18px] w-[18px]",children:[e.jsx("img",{src:t,alt:"",width:18,height:18,className:"h-full w-full object-contain dark:hidden"}),e.jsx("img",{src:c,alt:"",width:18,height:18,className:"hidden h-full w-full object-contain dark:block"})]},l))})}function m(){return e.jsx("ul",{className:"flex flex-wrap gap-2","aria-label":"Supported coding agents",children:i.map(({name:l,light:t,dark:c})=>e.jsxs("li",{className:"inline-flex items-center gap-2 rounded-full border px-3 py-1 text-sm",children:[e.jsx("img",{src:t,alt:"",width:18,height:18,className:"h-[18px] w-[18px] object-contain dark:hidden"}),e.jsx("img",{src:c,alt:"",width:18,height:18,className:"hidden h-[18px] w-[18px] object-contain dark:block"}),l]},l))})}export{w as A,m as a}; diff --git a/assets/AiDeadlinesView--bEB1R4q.js b/assets/AiDeadlinesView--bEB1R4q.js new file mode 100644 index 0000000000000000000000000000000000000000..ce5c4c9a01bf7c81c75de7d1fda1b2f2a8695ec0 --- /dev/null +++ b/assets/AiDeadlinesView--bEB1R4q.js @@ -0,0 +1,3 @@ +import{d as g,j as t,b as R,T as A}from"./index-DyXq7-Tg.js";import{c as L}from"./catalog-CRar2olQ.js";import{S as B}from"./switch-nfvTohnt.js";import{S as U}from"./skeleton-C3IIzpSL.js";import{A as W,a as M}from"./alert-gbJBhAVE.js";import{s as $}from"./safeExternalHref-CkBrsh84.js";import{D as O,a as V,c as P,b as G,d as H}from"./dialog-CfM0Uql2.js";import{s as K,n as S,f as _,p as Y,u as N,l as k,a as I,c as b,D as q,b as z,d as Q}from"./deadlines-BH32v7D1.js";import"./index-C041TDos.js";const w={fontFamily:"var(--mono)",fontSize:10,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--ink-faint)"},J=(e,l)=>{const s=Math.ceil((e-l)/q);return s<=0?"passed":`${s} ${s===1?"day":"days"}`},F=(e,l)=>{const s=_(e.start_date,e.end_date),r=e.venue||[e.city,e.country].filter(Boolean).join(", ");return[`${l.label||l.type||"Deadline"} for ${e.name}`,s?`Dates: ${s}`:null,r?`Location: ${r}`:null,e.url?`Website: ${e.url}`:null].filter(Boolean).join(` +`)},C=e=>e.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),X=(e,l)=>{const s=new Date(l.deadline_at),r=new Date(s.getTime()+60*60*1e3),o=`${e.short_name||e.name} ${l.label||l.type||"deadline"}`,h=e.venue||[e.city,e.country].filter(Boolean).join(", "),n=`https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(o)}&dates=${C(s)}/${C(r)}&details=${encodeURIComponent(F(e,l))}&location=${encodeURIComponent(h)}`,p=$(n);p&&window.open(p,"_blank","noopener,noreferrer")},Z=(e,l)=>{const s=new Date(l.deadline_at),r=new Date(s.getTime()+60*60*1e3),o=`${e.short_name||e.name} ${l.label||l.type||"deadline"}`,h=e.venue||[e.city,e.country].filter(Boolean).join(", "),n=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",e.url?`URL:${e.url}`:null,`DTSTART:${C(s)}`,`DTEND:${C(r)}`,`SUMMARY:${o}`,`DESCRIPTION:${F(e,l).replace(/\n/g,"\\n")}`,h?`LOCATION:${h}`:null,"END:VEVENT","END:VCALENDAR"].filter(Boolean).join(` +`),p=new Blob([n],{type:"text/calendar;charset=utf-8"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=`${(e.short_name||e.name).toLowerCase().replace(/\s+/g,"-")}-deadline.ics`,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(d.href)},ee=({conf:e,open:l,onOpenChange:s})=>{const[r,o]=g.useState(()=>Date.now());g.useEffect(()=>{if(!l)return;o(Date.now());const i=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(i)},[l]);const h=g.useMemo(()=>e?K(e):[],[e]),n=g.useMemo(()=>e?S(e,r):null,[e,r]),p=e?_(e.start_date,e.end_date):null,d=e?e.venue||[e.city,e.country].filter(Boolean).join(", ")||e.location:null,m=n?new Date(n.deadline_at).getTime():null;return t.jsx(O,{open:l,onOpenChange:s,children:t.jsx(V,{className:"max-w-xl",style:{background:"var(--bg-elevated)",maxHeight:"85vh",overflowY:"auto"},children:e&&t.jsxs(t.Fragment,{children:[t.jsxs(P,{children:[t.jsx(G,{asChild:!0,children:t.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.01em",margin:0},children:e.short_name?`${e.short_name} ${e.year??""}`.trim():e.name})}),e.short_name&&e.name||e.description?t.jsx(H,{asChild:!0,children:t.jsx("span",{style:{fontFamily:"var(--serif)",fontSize:14,color:"var(--ink-soft)"},children:e.short_name?e.name:e.description})}):null]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,marginTop:4},children:[t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:24},children:[p&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("span",{style:w,children:"Dates"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-soft)"},children:p})]}),d&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("span",{style:w,children:"Venue"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-soft)"},children:d})]})]}),m!=null&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"12px 14px",borderRadius:8,background:"var(--bg-subtle)",border:"1px solid var(--hairline)"},children:[t.jsx("span",{style:w,children:"Next deadline in"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:22,fontWeight:600,color:N(m,r)},children:Y(m,r)})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx("span",{style:w,children:"Important deadlines"}),h.length===0?t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-faint)"},children:"No deadlines listed"}):h.map((i,c)=>{const y=new Date(i.deadline_at).getTime(),a=n!=null&&i.deadline_at===n.deadline_at&&i.type===n.type,u=y<=r;return t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,padding:"8px 12px",borderRadius:6,background:a?"var(--accent-soft)":"transparent",border:a?"1px solid var(--hairline-strong)":"1px solid var(--hairline)",opacity:u&&!a?.55:1},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsxs("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink)",fontWeight:a?600:400},children:[i.label||k(i.type||"deadline"),a&&t.jsx("span",{style:{...w,marginLeft:8},children:"Next"})]}),t.jsxs("span",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-faint)"},children:[I(i.deadline_at),i.timezone?` · ${i.timezone}`:""]})]}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:12,fontWeight:600,whiteSpace:"nowrap",color:N(u?null:y,r)},children:J(y,r)})]},`${i.type??"deadline"}-${c}`)})]}),b(e).length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:b(e).map(i=>t.jsx("span",{className:"tag-chip",style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:k(i)},i))}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:16,paddingTop:12,borderTop:"1px solid var(--hairline)"},children:[e.url&&t.jsx("a",{href:$(e.url)??void 0,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--accent-text)"},children:"Visit website ↗"}),n&&t.jsxs("div",{style:{display:"flex",gap:12,marginLeft:"auto"},children:[t.jsx("button",{type:"button",className:"tag-chip",onClick:()=>X(e,n),style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:"+ Google Calendar"}),t.jsx("button",{type:"button",className:"tag-chip",onClick:()=>Z(e,n),style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:"+ Apple / .ics"})]})]})]})]})})})},E=({id:e,label:l,checked:s,onChange:r})=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:[t.jsx(B,{id:e,checked:s,onCheckedChange:r}),t.jsx("label",{htmlFor:e,style:{cursor:"pointer"},children:l})]}),te=({conf:e,now:l,selectedDomains:s,onToggleDomain:r,onOpen:o})=>{const h=S(e,l),n=h??z(e),p=n?new Date(n.deadline_at).getTime():null,d=N(h?p:null,l),m=_(e.start_date,e.end_date),i=[e.city??null,e.country??null].filter(Boolean).join(", ");return t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(e),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),o(e))},style:{border:"1px solid var(--hairline)",borderRadius:8,padding:20,background:"var(--bg-elevated)",display:"flex",flexDirection:"column",gap:12,cursor:"pointer"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12},children:[t.jsx("h3",{style:{fontFamily:"var(--serif)",fontSize:20,fontWeight:500,letterSpacing:"-0.01em",margin:0},children:e.short_name?`${e.short_name} ${e.year??""}`.trim():e.name}),e.url&&t.jsx("a",{href:$(e.url)??void 0,target:"_blank",rel:"noopener noreferrer",onClick:c=>c.stopPropagation(),style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",whiteSpace:"nowrap"},children:"website ↗"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,paddingBottom:12,borderBottom:"1px solid var(--hairline)"},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)"},children:(n==null?void 0:n.label)||(n==null?void 0:n.type)||"Deadline"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:n?`${I(n.deadline_at)}${n.timezone?` · ${n.timezone}`:""}`:"TBD"})]}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:14,fontWeight:600,color:d,whiteSpace:"nowrap"},children:p!=null?Q(p,l):"TBD"})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)"},children:[m&&t.jsx("span",{children:m}),i&&t.jsx("span",{children:i})]}),b(e).length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:b(e).map(c=>{const y=s.has(c);return t.jsx("button",{className:"tag-chip",onClick:a=>{a.stopPropagation(),r(c)},style:{background:y?"var(--ink)":"var(--bg-subtle)",color:y?"var(--bg)":"var(--ink-soft)"},children:k(c)},c)})})]})},pe=()=>{const[e,l]=g.useState(!0),[s,r]=g.useState(!1),[o,h]=g.useState(new Set),[n,p]=g.useState(null),d=g.useMemo(()=>Date.now(),[]),m=R({queryKey:["conference-deadlines"],queryFn:()=>L.conferenceDeadlines(),staleTime:A}),i=a=>{h(u=>{const x=new Set(u);return x.has(a)?x.delete(a):x.add(a),x})},c=g.useMemo(()=>{var u;const a=new Map;return(u=m.data)==null||u.results.forEach(x=>{b(x).forEach(j=>a.set(j,(a.get(j)??0)+1))}),Array.from(a.entries()).sort((x,j)=>j[1]-x[1]).map(([x])=>x)},[m.data]),y=g.useMemo(()=>{var j;const u=(((j=m.data)==null?void 0:j.results)??[]).filter(f=>!(e&&f.tier!=="a"||o.size>0&&!b(f).some(v=>o.has(v))||!s&&!S(f,d))),x=f=>{const D=S(f,d);if(D)return{group:0,time:new Date(D.deadline_at).getTime()};const v=z(f);return{group:1,time:-(v?new Date(v.deadline_at).getTime():0)}};return[...u].sort((f,D)=>{const v=x(f),T=x(D);return v.group!==T.group?v.group-T.group:v.time-T.time})},[m.data,e,s,o,d]);return m.error?t.jsx("div",{className:"page",children:t.jsx(W,{variant:"destructive",children:t.jsx(M,{children:"Failed to load conference deadlines. Please try again."})})}):t.jsxs("div",{className:"page",children:[t.jsx("div",{className:"feed-header",children:t.jsxs("div",{children:[t.jsxs("h1",{className:"feed-title",children:["AI Conference ",t.jsx("em",{children:"Deadlines"})]}),t.jsx("div",{className:"feed-subtitle",children:"Upcoming submission deadlines for major AI conferences, counting down."})]})}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:20,padding:"16px 0",borderBottom:"1px solid var(--hairline)",marginBottom:24},children:[t.jsx(E,{id:"top-tier-only",label:"Top tier only",checked:e,onChange:l}),t.jsx(E,{id:"show-past",label:"Show past conferences",checked:s,onChange:r})]}),c.length>0&&t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:24},children:[c.map(a=>{const u=o.has(a);return t.jsx("button",{className:"tag-chip",onClick:()=>i(a),style:{background:u?"var(--ink)":"var(--bg-subtle)",color:u?"var(--bg)":"var(--ink-soft)"},children:k(a)},a)}),o.size>0&&t.jsx("button",{className:"tag-chip",onClick:()=>h(new Set),style:{background:"transparent",color:"var(--ink-faint)"},children:"Clear ✕"})]}),t.jsx("div",{className:"sort-bar",children:t.jsx("div",{className:"results-count",children:m.isLoading?"…":`${y.length} conferences`})}),m.isLoading?t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:16},children:Array.from({length:6}).map((a,u)=>t.jsx(U,{className:"h-44"},u))}):y.length===0?t.jsxs("div",{className:"no-results",children:["No conferences match these filters",s?".":" — try enabling “Show past conferences”."]}):t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:16},children:y.map(a=>t.jsx(te,{conf:a,now:d,selectedDomains:o,onToggleDomain:i,onOpen:p},a.id))}),t.jsx(ee,{conf:n,open:n!==null,onOpenChange:a=>{a||p(null)}})]})};export{pe as default}; diff --git a/assets/AiDeadlinesView-BhXjtcbF.js b/assets/AiDeadlinesView-BhXjtcbF.js deleted file mode 100644 index 2b0309900eb1acce8dd883729bc6dede6d552323..0000000000000000000000000000000000000000 --- a/assets/AiDeadlinesView-BhXjtcbF.js +++ /dev/null @@ -1,3 +0,0 @@ -import{r as g,j as t}from"./index-CbgxfyGU.js";import{u as R}from"./useQuery-Bx9s5-D2.js";import{c as A}from"./catalog-DhK7_9-6.js";import{S as L}from"./switch-BSZohE4x.js";import{S as B}from"./skeleton-HwvdxvSN.js";import{A as W,a as U}from"./alert-CFDDvdIM.js";import{s as $}from"./safeExternalHref-CkBrsh84.js";import{D as M,a as O,c as V,b as P,d as G}from"./dialog-Cfp_d3CC.js";import{s as H,n as S,f as _,p as K,u as N,l as k,a as I,c as b,D as Y,b as E,d as q}from"./deadlines-BH32v7D1.js";import"./index-CxPKwmVQ.js";const w={fontFamily:"var(--mono)",fontSize:10,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--ink-faint)"},Q=(e,l)=>{const s=Math.ceil((e-l)/Y);return s<=0?"passed":`${s} ${s===1?"day":"days"}`},F=(e,l)=>{const s=_(e.start_date,e.end_date),r=e.venue||[e.city,e.country].filter(Boolean).join(", ");return[`${l.label||l.type||"Deadline"} for ${e.name}`,s?`Dates: ${s}`:null,r?`Location: ${r}`:null,e.url?`Website: ${e.url}`:null].filter(Boolean).join(` -`)},C=e=>e.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),J=(e,l)=>{const s=new Date(l.deadline_at),r=new Date(s.getTime()+60*60*1e3),o=`${e.short_name||e.name} ${l.label||l.type||"deadline"}`,h=e.venue||[e.city,e.country].filter(Boolean).join(", "),n=`https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(o)}&dates=${C(s)}/${C(r)}&details=${encodeURIComponent(F(e,l))}&location=${encodeURIComponent(h)}`,p=$(n);p&&window.open(p,"_blank","noopener,noreferrer")},X=(e,l)=>{const s=new Date(l.deadline_at),r=new Date(s.getTime()+60*60*1e3),o=`${e.short_name||e.name} ${l.label||l.type||"deadline"}`,h=e.venue||[e.city,e.country].filter(Boolean).join(", "),n=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",e.url?`URL:${e.url}`:null,`DTSTART:${C(s)}`,`DTEND:${C(r)}`,`SUMMARY:${o}`,`DESCRIPTION:${F(e,l).replace(/\n/g,"\\n")}`,h?`LOCATION:${h}`:null,"END:VEVENT","END:VCALENDAR"].filter(Boolean).join(` -`),p=new Blob([n],{type:"text/calendar;charset=utf-8"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=`${(e.short_name||e.name).toLowerCase().replace(/\s+/g,"-")}-deadline.ics`,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(d.href)},Z=({conf:e,open:l,onOpenChange:s})=>{const[r,o]=g.useState(()=>Date.now());g.useEffect(()=>{if(!l)return;o(Date.now());const i=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(i)},[l]);const h=g.useMemo(()=>e?H(e):[],[e]),n=g.useMemo(()=>e?S(e,r):null,[e,r]),p=e?_(e.start_date,e.end_date):null,d=e?e.venue||[e.city,e.country].filter(Boolean).join(", ")||e.location:null,m=n?new Date(n.deadline_at).getTime():null;return t.jsx(M,{open:l,onOpenChange:s,children:t.jsx(O,{className:"max-w-xl",style:{background:"var(--bg-elevated)",maxHeight:"85vh",overflowY:"auto"},children:e&&t.jsxs(t.Fragment,{children:[t.jsxs(V,{children:[t.jsx(P,{asChild:!0,children:t.jsx("h2",{style:{fontFamily:"var(--serif)",fontSize:26,fontWeight:500,letterSpacing:"-0.01em",margin:0},children:e.short_name?`${e.short_name} ${e.year??""}`.trim():e.name})}),e.short_name&&e.name||e.description?t.jsx(G,{asChild:!0,children:t.jsx("span",{style:{fontFamily:"var(--serif)",fontSize:14,color:"var(--ink-soft)"},children:e.short_name?e.name:e.description})}):null]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,marginTop:4},children:[t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:24},children:[p&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("span",{style:w,children:"Dates"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-soft)"},children:p})]}),d&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("span",{style:w,children:"Venue"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-soft)"},children:d})]})]}),m!=null&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:"12px 14px",borderRadius:8,background:"var(--bg-subtle)",border:"1px solid var(--hairline)"},children:[t.jsx("span",{style:w,children:"Next deadline in"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:22,fontWeight:600,color:N(m,r)},children:K(m,r)})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx("span",{style:w,children:"Important deadlines"}),h.length===0?t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink-faint)"},children:"No deadlines listed"}):h.map((i,c)=>{const y=new Date(i.deadline_at).getTime(),a=n!=null&&i.deadline_at===n.deadline_at&&i.type===n.type,u=y<=r;return t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,padding:"8px 12px",borderRadius:6,background:a?"var(--accent-soft)":"transparent",border:a?"1px solid var(--hairline-strong)":"1px solid var(--hairline)",opacity:u&&!a?.55:1},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsxs("span",{style:{fontFamily:"var(--mono)",fontSize:13,color:"var(--ink)",fontWeight:a?600:400},children:[i.label||k(i.type||"deadline"),a&&t.jsx("span",{style:{...w,marginLeft:8},children:"Next"})]}),t.jsxs("span",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-faint)"},children:[I(i.deadline_at),i.timezone?` · ${i.timezone}`:""]})]}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:12,fontWeight:600,whiteSpace:"nowrap",color:N(u?null:y,r)},children:Q(y,r)})]},`${i.type??"deadline"}-${c}`)})]}),b(e).length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:b(e).map(i=>t.jsx("span",{className:"tag-chip",style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:k(i)},i))}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:16,paddingTop:12,borderTop:"1px solid var(--hairline)"},children:[e.url&&t.jsx("a",{href:$(e.url)??void 0,target:"_blank",rel:"noopener noreferrer",style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--accent-text)"},children:"Visit website ↗"}),n&&t.jsxs("div",{style:{display:"flex",gap:12,marginLeft:"auto"},children:[t.jsx("button",{type:"button",className:"tag-chip",onClick:()=>J(e,n),style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:"+ Google Calendar"}),t.jsx("button",{type:"button",className:"tag-chip",onClick:()=>X(e,n),style:{background:"var(--bg-subtle)",color:"var(--ink-soft)"},children:"+ Apple / .ics"})]})]})]})]})})})},z=({id:e,label:l,checked:s,onChange:r})=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:[t.jsx(L,{id:e,checked:s,onCheckedChange:r}),t.jsx("label",{htmlFor:e,style:{cursor:"pointer"},children:l})]}),ee=({conf:e,now:l,selectedDomains:s,onToggleDomain:r,onOpen:o})=>{const h=S(e,l),n=h??E(e),p=n?new Date(n.deadline_at).getTime():null,d=N(h?p:null,l),m=_(e.start_date,e.end_date),i=[e.city??null,e.country??null].filter(Boolean).join(", ");return t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(e),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),o(e))},style:{border:"1px solid var(--hairline)",borderRadius:8,padding:20,background:"var(--bg-elevated)",display:"flex",flexDirection:"column",gap:12,cursor:"pointer"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12},children:[t.jsx("h3",{style:{fontFamily:"var(--serif)",fontSize:20,fontWeight:500,letterSpacing:"-0.01em",margin:0},children:e.short_name?`${e.short_name} ${e.year??""}`.trim():e.name}),e.url&&t.jsx("a",{href:$(e.url)??void 0,target:"_blank",rel:"noopener noreferrer",onClick:c=>c.stopPropagation(),style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",whiteSpace:"nowrap"},children:"website ↗"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,paddingBottom:12,borderBottom:"1px solid var(--hairline)"},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)"},children:(n==null?void 0:n.label)||(n==null?void 0:n.type)||"Deadline"}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:n?`${I(n.deadline_at)}${n.timezone?` · ${n.timezone}`:""}`:"TBD"})]}),t.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:14,fontWeight:600,color:d,whiteSpace:"nowrap"},children:p!=null?q(p,l):"TBD"})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)"},children:[m&&t.jsx("span",{children:m}),i&&t.jsx("span",{children:i})]}),b(e).length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:b(e).map(c=>{const y=s.has(c);return t.jsx("button",{className:"tag-chip",onClick:a=>{a.stopPropagation(),r(c)},style:{background:y?"var(--ink)":"var(--bg-subtle)",color:y?"var(--bg)":"var(--ink-soft)"},children:k(c)},c)})})]})},pe=()=>{const[e,l]=g.useState(!0),[s,r]=g.useState(!1),[o,h]=g.useState(new Set),[n,p]=g.useState(null),d=g.useMemo(()=>Date.now(),[]),m=R({queryKey:["conference-deadlines"],queryFn:()=>A.conferenceDeadlines(),staleTime:10*60*1e3}),i=a=>{h(u=>{const x=new Set(u);return x.has(a)?x.delete(a):x.add(a),x})},c=g.useMemo(()=>{var u;const a=new Map;return(u=m.data)==null||u.results.forEach(x=>{b(x).forEach(j=>a.set(j,(a.get(j)??0)+1))}),Array.from(a.entries()).sort((x,j)=>j[1]-x[1]).map(([x])=>x)},[m.data]),y=g.useMemo(()=>{var j;const u=(((j=m.data)==null?void 0:j.results)??[]).filter(f=>!(e&&f.tier!=="a"||o.size>0&&!b(f).some(v=>o.has(v))||!s&&!S(f,d))),x=f=>{const D=S(f,d);if(D)return{group:0,time:new Date(D.deadline_at).getTime()};const v=E(f);return{group:1,time:-(v?new Date(v.deadline_at).getTime():0)}};return[...u].sort((f,D)=>{const v=x(f),T=x(D);return v.group!==T.group?v.group-T.group:v.time-T.time})},[m.data,e,s,o,d]);return m.error?t.jsx("div",{className:"page",children:t.jsx(W,{variant:"destructive",children:t.jsx(U,{children:"Failed to load conference deadlines. Please try again."})})}):t.jsxs("div",{className:"page",children:[t.jsx("div",{className:"feed-header",children:t.jsxs("div",{children:[t.jsxs("h1",{className:"feed-title",children:["AI Conference ",t.jsx("em",{children:"Deadlines"})]}),t.jsx("div",{className:"feed-subtitle",children:"Upcoming submission deadlines for major AI conferences, counting down."})]})}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:20,padding:"16px 0",borderBottom:"1px solid var(--hairline)",marginBottom:24},children:[t.jsx(z,{id:"top-tier-only",label:"Top tier only",checked:e,onChange:l}),t.jsx(z,{id:"show-past",label:"Show past conferences",checked:s,onChange:r})]}),c.length>0&&t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:24},children:[c.map(a=>{const u=o.has(a);return t.jsx("button",{className:"tag-chip",onClick:()=>i(a),style:{background:u?"var(--ink)":"var(--bg-subtle)",color:u?"var(--bg)":"var(--ink-soft)"},children:k(a)},a)}),o.size>0&&t.jsx("button",{className:"tag-chip",onClick:()=>h(new Set),style:{background:"transparent",color:"var(--ink-faint)"},children:"Clear ✕"})]}),t.jsx("div",{className:"sort-bar",children:t.jsx("div",{className:"results-count",children:m.isLoading?"…":`${y.length} conferences`})}),m.isLoading?t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:16},children:Array.from({length:6}).map((a,u)=>t.jsx(B,{className:"h-44"},u))}):y.length===0?t.jsxs("div",{className:"no-results",children:["No conferences match these filters",s?".":" — try enabling “Show past conferences”."]}):t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:16},children:y.map(a=>t.jsx(ee,{conf:a,now:d,selectedDomains:o,onToggleDomain:i,onOpen:p},a.id))}),t.jsx(Z,{conf:n,open:n!==null,onOpenChange:a=>{a||p(null)}})]})};export{pe as default}; diff --git a/assets/ApiDocsView-DhYUFS5g.js b/assets/ApiDocsView-DhYUFS5g.js new file mode 100644 index 0000000000000000000000000000000000000000..c96d217d4e40a5eb00f89b97fa569fc0d4300433 --- /dev/null +++ b/assets/ApiDocsView-DhYUFS5g.js @@ -0,0 +1,9 @@ +import{ac as m,b as f,d as h,j as e}from"./index-DyXq7-Tg.js";import{u as g}from"./useDocumentTitle-DcxM2Zv_.js";import{M as y}from"./index-mCi_y_l3.js";const b={queryKey:["public-api-schema"],queryFn:()=>m("/openapi.json",{credentials:"omit"}),staleTime:5*60*1e3};function w(s,r){const n=new URLSearchParams;for(const[a,t]of Object.entries(r["x-example-parameters"]))s.includes(`{${a}}`)?s=s.replace(`{${a}}`,encodeURIComponent(String(t))):n.append(a,String(t));return`https://paperswithcode.co${s}${n.size?`?${n}`:""}`}function v(s,r){return r==="Python"?`import requests + +response = requests.get(${JSON.stringify(s)}, timeout=30) +response.raise_for_status() +print(response.json())`:r==="JavaScript"?`const response = await fetch(${JSON.stringify(s)}, { + credentials: "omit", +}); +if (!response.ok) throw new Error(\`HTTP \${response.status}\`); +console.log(await response.json());`:`curl --fail-with-body ${JSON.stringify(s)}`}function d(s){return s.$ref?s.$ref.split("/").pop()??"object":s.anyOf?s.anyOf.map(d).join(" | "):s.allOf?s.allOf.map(d).join(" & "):s.enum?s.enum.map(r=>JSON.stringify(r)).join(" | "):s.type==="array"?`array<${d(s.items??{})}>`:s.type??"object"}const k=["curl","Python","JavaScript"],q="https://github.com/huggingface/paperswithcode/issues/new?template=api.yml";function l({value:s}){const[r,n]=h.useState("Copy");async function a(){try{await navigator.clipboard.writeText(s),n("Copied")}catch{n("Select and copy the code below")}}return e.jsxs("div",{className:"api-code",children:[e.jsx("pre",{children:e.jsx("code",{children:s})}),e.jsx("button",{onClick:a,"aria-live":"polite",children:r})]})}function c({schema:s}){if(s.$ref){const r=d(s);return e.jsx("a",{href:`#model-${r}`,children:r})}return s.anyOf||s.allOf?e.jsx(e.Fragment,{children:(s.anyOf??s.allOf).map((r,n)=>e.jsxs("span",{children:[n>0&&" | ",e.jsx(c,{schema:r})]},n))}):s.type==="array"?e.jsxs(e.Fragment,{children:["array of ",e.jsx(c,{schema:s.items??{}})]}):e.jsx("code",{children:d(s)})}function x({schema:s}){return e.jsxs(e.Fragment,{children:[["minimum","maximum","minLength","maxLength"].map(r=>s[r]!==void 0&&e.jsxs("small",{children:[r,": ",s[r]]},r)),(s.anyOf??s.allOf??[]).map((r,n)=>e.jsx(x,{schema:r},n))]})}function j({schema:s}){return s.properties?e.jsx("div",{className:"api-table-wrap",children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Field"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Description"})]})}),e.jsx("tbody",{children:Object.entries(s.properties).map(([r,n])=>{var a;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("code",{children:r}),((a=s.required)==null?void 0:a.includes(r))&&e.jsx("small",{children:"required"})]}),e.jsx("td",{children:e.jsx(c,{schema:n})}),e.jsxs("td",{children:[n.description,n.format&&e.jsxs("small",{children:["Format: ",n.format]}),n.default!==void 0&&e.jsxs("small",{children:["Default: ",JSON.stringify(n.default)]}),n.properties&&e.jsx(j,{schema:n}),typeof n.additionalProperties=="object"&&e.jsxs("p",{children:["Values:"," ",e.jsx(c,{schema:n.additionalProperties})]})]})]},r)})})]})}):e.jsx(c,{schema:s})}function P({path:s,operation:r}){var t;const[n,a]=h.useState("curl");return e.jsxs("section",{id:r.operationId,className:"api-endpoint",children:[e.jsx("h2",{children:r.summary}),e.jsxs("p",{className:"api-path",children:[e.jsx("b",{children:"GET"})," ",e.jsx("code",{children:s})]}),e.jsx("div",{className:"api-description",children:e.jsx(y,{children:r.description})}),!!((t=r.parameters)!=null&&t.length)&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{children:"Parameters"}),e.jsx("div",{className:"api-table-wrap",children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Parameter"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Description"})]})}),e.jsx("tbody",{children:r.parameters.map(i=>e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("code",{children:i.name}),e.jsxs("small",{children:[i.in," ·"," ",i.required?"required":"optional"]})]}),e.jsx("td",{children:e.jsx(c,{schema:i.schema})}),e.jsxs("td",{children:[i.description,i.schema.default!==void 0&&e.jsxs("small",{children:["Default: ",JSON.stringify(i.schema.default)]}),e.jsx(x,{schema:i.schema})]})]},`${i.in}-${i.name}`))})]})})]}),e.jsx("h3",{children:"Example request"}),e.jsx("div",{className:"api-languages",role:"group","aria-label":`Example language for ${r.summary}`,children:k.map(i=>e.jsx("button",{"aria-pressed":n===i,onClick:()=>a(i),children:i},i))}),e.jsx(l,{value:v(w(s,r),n)}),e.jsx("h3",{children:"Responses"}),Object.entries(r.responses).map(([i,o])=>{var p,u;return e.jsxs("div",{className:"api-response",children:[e.jsx("strong",{children:i})," ",o.description,((u=(p=o.content)==null?void 0:p["application/json"])==null?void 0:u.schema)&&e.jsx("p",{children:e.jsx(c,{schema:o.content["application/json"].schema})})]},i)})]})}function S(){const{data:s,isPending:r,isError:n,refetch:a}=f(b);return g("API documentation — Papers With Code",{restorePrevious:!0}),h.useEffect(()=>{if(!s||!window.location.hash)return;const t=requestAnimationFrame(()=>{var i;(i=document.getElementById(window.location.hash.slice(1)))==null||i.scrollIntoView()});return()=>cancelAnimationFrame(t)},[s]),e.jsxs("div",{className:"api-docs",children:[e.jsxs("nav",{className:"api-sidebar","aria-label":"API documentation",children:[e.jsx("strong",{children:"API documentation"}),e.jsx("a",{href:"#getting-started",children:"Getting started"}),e.jsx("a",{href:"#limits",children:"Traffic limits"}),e.jsx("a",{href:"#pagination",children:"Pagination & identifiers"}),e.jsx("a",{href:"#benchmarks",children:"Reading leaderboards"}),e.jsx("a",{href:"#errors",children:"Errors"}),e.jsx("a",{href:"#changelog",children:"Changelog"}),s&&Object.entries(s.paths).map(([t,{get:i}])=>e.jsx("a",{href:`#${i.operationId}`,children:i.summary},t)),e.jsx("a",{href:"#response-models",children:"Response models"})]}),e.jsxs("main",{className:"api-content",children:[e.jsxs("section",{id:"getting-started",children:[e.jsx("span",{className:"api-beta",children:"Experimental beta"}),e.jsx("h1",{children:"Papers With Code API"}),e.jsx("p",{className:"api-lead",children:"Find papers, explore benchmarks, and bring research results into your scripts and applications."}),e.jsx("p",{children:"Free, anonymous, read-only access. No account or API key required. The public beta covers keyword search and core catalog lookups."}),e.jsxs("p",{children:[e.jsx("a",{href:"https://paperswithcode.co/api/v1/openapi.json",children:"Download the public OpenAPI specification"})," ","· ",e.jsx("a",{href:q,children:"Report a bug or request a feature"})]}),e.jsx("h2",{children:"Your first request"}),e.jsx(l,{value:'curl --fail-with-body "https://paperswithcode.co/api/v1/papers/search?q=attention&mode=keyword&page_size=5"'}),e.jsxs("p",{children:["Responses are JSON. Python examples require"," ",e.jsx("code",{children:"pip install requests"}),"; JavaScript examples use built-in"," ",e.jsx("code",{children:"fetch"}),". Browser requests from any origin are supported for these public reads: omit cookies and authorization headers."]}),e.jsxs("p",{children:["Base URL: ",e.jsx("code",{children:"https://paperswithcode.co/api/v1"})]})]}),e.jsxs("section",{id:"limits",children:[e.jsx("h2",{children:"Traffic limits"}),e.jsx("p",{children:"Each IP address shares a catalog allowance of 120 requests/minute. List and search endpoints also share a stricter allowance of 60 requests/minute. These are sustained rates with short bursts of up to 60 and 20 excess requests respectively, not fixed-minute quotas."}),e.jsxs("p",{children:["Website browsing and scripts on the same network share these limits. Send requests sequentially, cache results, and avoid parallel crawls. On HTTP 429, wait at least the ",e.jsx("code",{children:"Retry-After"})," ","duration, then retry with increasing delays and jitter. Browser preflight requests do not consume this allowance."]})]}),e.jsxs("section",{id:"pagination",children:[e.jsx("h2",{children:"Pagination & identifiers"}),e.jsxs("p",{children:["Paginated endpoints return ",e.jsx("code",{children:"results"}),","," ",e.jsx("code",{children:"next_page"}),", and ",e.jsx("code",{children:"previous_page"}),". Catalog lists also return ",e.jsx("code",{children:"count"}),"; paper search omits it. Pass"," ",e.jsx("code",{children:"page"})," and ",e.jsx("code",{children:"page_size"}),"; stop when"," ",e.jsx("code",{children:"next_page"})," is null. Recent and trending endpoints instead return arrays bounded by ",e.jsx("code",{children:"limit"}),"."]}),e.jsx("p",{children:"Paper listing and search stop at page 100. Other bounds are shown per endpoint. Counts and page contents may change as the catalog updates; pagination is not a snapshot or a bulk export interface."}),e.jsxs("p",{children:["Use identifiers returned by lookups. Paper detail accepts an arXiv ID or numeric catalog ID; the arXiv endpoint takes an arXiv ID. Task and dataset detail accept their catalog IDs or slugs. Leaderboard metrics require numeric task and dataset IDs. Evaluation filters such as ",e.jsx("code",{children:"dataset_id"})," and ",e.jsx("code",{children:"task_id"})," require numeric catalog IDs. Example IDs may no longer exist: replace them with current lookup results."]})]}),e.jsxs("section",{id:"benchmarks",children:[e.jsx("h2",{children:"Reading leaderboards"}),e.jsxs("p",{children:["Search datasets, select a dataset, then fetch its tasks and the metrics for a dataset/task pair. Fetch"," ",e.jsx("code",{children:"/evaluations/?dataset_id=…&task_id=…&ordering=best_rank"})," ","using the numeric IDs. An evaluation includes reported scores and source information; check metric direction, split, and evaluation setup before comparing results."]}),e.jsxs("p",{children:["Use ",e.jsx("code",{children:"include_resources=true"})," on paper list/detail requests for linked repositories and project pages. Missing fields or null values mean data is unavailable; they are not zero scores. Keyword search examples explicitly send ",e.jsx("code",{children:"mode=keyword"}),"; semantic and hybrid search are outside this beta."]})]}),e.jsxs("section",{id:"errors",children:[e.jsx("h2",{children:"Errors"}),e.jsxs("p",{children:["Check the HTTP status before parsing a successful result. Errors usually contain a ",e.jsx("code",{children:"detail"})," field, which can be a string, object, or validation-error array."]}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("b",{children:"400:"})," invalid request."]}),e.jsxs("li",{children:[e.jsx("b",{children:"404:"})," record not found."]}),e.jsxs("li",{children:[e.jsx("b",{children:"422:"})," invalid parameter type, value, or missing parameter."]}),e.jsxs("li",{children:[e.jsx("b",{children:"429:"})," traffic limit exceeded; obey ",e.jsx("code",{children:"Retry-After"}),"."]}),e.jsxs("li",{children:[e.jsx("b",{children:"5xx:"})," temporary server failure; retry with bounded backoff."]})]}),e.jsx(l,{value:'{ "detail": "API traffic limit exceeded. Retry with backoff." }'})]}),e.jsxs("section",{id:"changelog",children:[e.jsx("h2",{children:"Changelog"}),e.jsx("h3",{children:"Initial experimental beta"}),e.jsx("p",{children:"Core catalog reads, keyword search, public schemas, and anonymous browser access. Planned breaking changes will be announced here at least 14 days before they take effect. Urgent security and service-restoration fixes may take effect immediately. This beta has no uptime or support-response guarantee."})]}),r&&e.jsx("p",{role:"status",children:"Loading endpoint reference…"}),n&&e.jsxs("div",{role:"alert",children:[e.jsx("p",{children:"Could not load the endpoint reference."}),e.jsx("button",{onClick:()=>void a(),children:"Retry"})]}),s&&e.jsxs(e.Fragment,{children:[Object.entries(s.paths).map(([t,{get:i}])=>e.jsx(P,{path:t,operation:i},t)),e.jsxs("section",{id:"response-models",children:[e.jsx("h2",{children:"Response models"}),Object.entries(s.components.schemas).map(([t,i])=>e.jsxs("article",{id:`model-${t}`,children:[e.jsx("h3",{children:t}),e.jsx("p",{children:i.description}),e.jsx(j,{schema:i})]},t))]})]})]})]})}export{S as default}; diff --git a/assets/ApiDocsView-hjoHKqpf.js b/assets/ApiDocsView-hjoHKqpf.js deleted file mode 100644 index 9dc09cf59e1b496eb783915f9fee75ce2adb0016..0000000000000000000000000000000000000000 --- a/assets/ApiDocsView-hjoHKqpf.js +++ /dev/null @@ -1,9 +0,0 @@ -import{a6 as m,r as o,j as e}from"./index-CbgxfyGU.js";import{u as f}from"./useQuery-Bx9s5-D2.js";import{M as g}from"./index-ZkEATkOr.js";const y={queryKey:["public-api-schema"],queryFn:()=>m("/openapi.json",{credentials:"omit"}),staleTime:5*60*1e3};function b(s,r){const n=new URLSearchParams;for(const[a,t]of Object.entries(r["x-example-parameters"]))s.includes(`{${a}}`)?s=s.replace(`{${a}}`,encodeURIComponent(String(t))):n.append(a,String(t));return`https://paperswithcode.co${s}${n.size?`?${n}`:""}`}function w(s,r){return r==="Python"?`import requests - -response = requests.get(${JSON.stringify(s)}, timeout=30) -response.raise_for_status() -print(response.json())`:r==="JavaScript"?`const response = await fetch(${JSON.stringify(s)}, { - credentials: "omit", -}); -if (!response.ok) throw new Error(\`HTTP \${response.status}\`); -console.log(await response.json());`:`curl --fail-with-body ${JSON.stringify(s)}`}function d(s){return s.$ref?s.$ref.split("/").pop()??"object":s.anyOf?s.anyOf.map(d).join(" | "):s.allOf?s.allOf.map(d).join(" & "):s.enum?s.enum.map(r=>JSON.stringify(r)).join(" | "):s.type==="array"?`array<${d(s.items??{})}>`:s.type??"object"}const v=["curl","Python","JavaScript"],k="https://github.com/huggingface/paperswithcode/issues/new?template=api.yml";function h({value:s}){const[r,n]=o.useState("Copy");async function a(){try{await navigator.clipboard.writeText(s),n("Copied")}catch{n("Select and copy the code below")}}return e.jsxs("div",{className:"api-code",children:[e.jsx("pre",{children:e.jsx("code",{children:s})}),e.jsx("button",{onClick:a,"aria-live":"polite",children:r})]})}function c({schema:s}){if(s.$ref){const r=d(s);return e.jsx("a",{href:`#model-${r}`,children:r})}return s.anyOf||s.allOf?e.jsx(e.Fragment,{children:(s.anyOf??s.allOf).map((r,n)=>e.jsxs("span",{children:[n>0&&" | ",e.jsx(c,{schema:r})]},n))}):s.type==="array"?e.jsxs(e.Fragment,{children:["array of ",e.jsx(c,{schema:s.items??{}})]}):e.jsx("code",{children:d(s)})}function x({schema:s}){return e.jsxs(e.Fragment,{children:[["minimum","maximum","minLength","maxLength"].map(r=>s[r]!==void 0&&e.jsxs("small",{children:[r,": ",s[r]]},r)),(s.anyOf??s.allOf??[]).map((r,n)=>e.jsx(x,{schema:r},n))]})}function j({schema:s}){return s.properties?e.jsx("div",{className:"api-table-wrap",children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Field"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Description"})]})}),e.jsx("tbody",{children:Object.entries(s.properties).map(([r,n])=>{var a;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("code",{children:r}),((a=s.required)==null?void 0:a.includes(r))&&e.jsx("small",{children:"required"})]}),e.jsx("td",{children:e.jsx(c,{schema:n})}),e.jsxs("td",{children:[n.description,n.format&&e.jsxs("small",{children:["Format: ",n.format]}),n.default!==void 0&&e.jsxs("small",{children:["Default: ",JSON.stringify(n.default)]}),n.properties&&e.jsx(j,{schema:n}),typeof n.additionalProperties=="object"&&e.jsxs("p",{children:["Values:"," ",e.jsx(c,{schema:n.additionalProperties})]})]})]},r)})})]})}):e.jsx(c,{schema:s})}function q({path:s,operation:r}){var t;const[n,a]=o.useState("curl");return e.jsxs("section",{id:r.operationId,className:"api-endpoint",children:[e.jsx("h2",{children:r.summary}),e.jsxs("p",{className:"api-path",children:[e.jsx("b",{children:"GET"})," ",e.jsx("code",{children:s})]}),e.jsx("div",{className:"api-description",children:e.jsx(g,{children:r.description})}),!!((t=r.parameters)!=null&&t.length)&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{children:"Parameters"}),e.jsx("div",{className:"api-table-wrap",children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Parameter"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Description"})]})}),e.jsx("tbody",{children:r.parameters.map(i=>e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("code",{children:i.name}),e.jsxs("small",{children:[i.in," ·"," ",i.required?"required":"optional"]})]}),e.jsx("td",{children:e.jsx(c,{schema:i.schema})}),e.jsxs("td",{children:[i.description,i.schema.default!==void 0&&e.jsxs("small",{children:["Default: ",JSON.stringify(i.schema.default)]}),e.jsx(x,{schema:i.schema})]})]},`${i.in}-${i.name}`))})]})})]}),e.jsx("h3",{children:"Example request"}),e.jsx("div",{className:"api-languages",role:"group","aria-label":`Example language for ${r.summary}`,children:v.map(i=>e.jsx("button",{"aria-pressed":n===i,onClick:()=>a(i),children:i},i))}),e.jsx(h,{value:w(b(s,r),n)}),e.jsx("h3",{children:"Responses"}),Object.entries(r.responses).map(([i,l])=>{var p,u;return e.jsxs("div",{className:"api-response",children:[e.jsx("strong",{children:i})," ",l.description,((u=(p=l.content)==null?void 0:p["application/json"])==null?void 0:u.schema)&&e.jsx("p",{children:e.jsx(c,{schema:l.content["application/json"].schema})})]},i)})]})}function I(){const{data:s,isPending:r,isError:n,refetch:a}=f(y);return o.useEffect(()=>{const t=document.title;return document.title="API documentation — Papers With Code",()=>{document.title=t}},[]),o.useEffect(()=>{if(!s||!window.location.hash)return;const t=requestAnimationFrame(()=>{var i;(i=document.getElementById(window.location.hash.slice(1)))==null||i.scrollIntoView()});return()=>cancelAnimationFrame(t)},[s]),e.jsxs("div",{className:"api-docs",children:[e.jsxs("nav",{className:"api-sidebar","aria-label":"API documentation",children:[e.jsx("strong",{children:"API documentation"}),e.jsx("a",{href:"#getting-started",children:"Getting started"}),e.jsx("a",{href:"#limits",children:"Traffic limits"}),e.jsx("a",{href:"#pagination",children:"Pagination & identifiers"}),e.jsx("a",{href:"#benchmarks",children:"Reading leaderboards"}),e.jsx("a",{href:"#errors",children:"Errors"}),e.jsx("a",{href:"#changelog",children:"Changelog"}),s&&Object.entries(s.paths).map(([t,{get:i}])=>e.jsx("a",{href:`#${i.operationId}`,children:i.summary},t)),e.jsx("a",{href:"#response-models",children:"Response models"})]}),e.jsxs("main",{className:"api-content",children:[e.jsxs("section",{id:"getting-started",children:[e.jsx("span",{className:"api-beta",children:"Experimental beta"}),e.jsx("h1",{children:"Papers With Code API"}),e.jsx("p",{className:"api-lead",children:"Find papers, explore benchmarks, and bring research results into your scripts and applications."}),e.jsx("p",{children:"Free, anonymous, read-only access. No account or API key required. The public beta covers keyword search and core catalog lookups."}),e.jsxs("p",{children:[e.jsx("a",{href:"https://paperswithcode.co/api/v1/openapi.json",children:"Download the public OpenAPI specification"})," ","· ",e.jsx("a",{href:k,children:"Report a bug or request a feature"})]}),e.jsx("h2",{children:"Your first request"}),e.jsx(h,{value:'curl --fail-with-body "https://paperswithcode.co/api/v1/papers/search?q=attention&mode=keyword&page_size=5"'}),e.jsxs("p",{children:["Responses are JSON. Python examples require"," ",e.jsx("code",{children:"pip install requests"}),"; JavaScript examples use built-in"," ",e.jsx("code",{children:"fetch"}),". Browser requests from any origin are supported for these public reads: omit cookies and authorization headers."]}),e.jsxs("p",{children:["Base URL: ",e.jsx("code",{children:"https://paperswithcode.co/api/v1"})]})]}),e.jsxs("section",{id:"limits",children:[e.jsx("h2",{children:"Traffic limits"}),e.jsx("p",{children:"Each IP address shares a catalog allowance of 120 requests/minute. List and search endpoints also share a stricter allowance of 60 requests/minute. These are sustained rates with short bursts of up to 60 and 20 excess requests respectively, not fixed-minute quotas."}),e.jsxs("p",{children:["Website browsing and scripts on the same network share these limits. Send requests sequentially, cache results, and avoid parallel crawls. On HTTP 429, wait at least the ",e.jsx("code",{children:"Retry-After"})," ","duration, then retry with increasing delays and jitter. Browser preflight requests do not consume this allowance."]})]}),e.jsxs("section",{id:"pagination",children:[e.jsx("h2",{children:"Pagination & identifiers"}),e.jsxs("p",{children:["Paginated endpoints return ",e.jsx("code",{children:"results"}),","," ",e.jsx("code",{children:"next_page"}),", and ",e.jsx("code",{children:"previous_page"}),". Catalog lists also return ",e.jsx("code",{children:"count"}),"; paper search omits it. Pass"," ",e.jsx("code",{children:"page"})," and ",e.jsx("code",{children:"page_size"}),"; stop when"," ",e.jsx("code",{children:"next_page"})," is null. Recent and trending endpoints instead return arrays bounded by ",e.jsx("code",{children:"limit"}),"."]}),e.jsx("p",{children:"Paper listing and search stop at page 100. Other bounds are shown per endpoint. Counts and page contents may change as the catalog updates; pagination is not a snapshot or a bulk export interface."}),e.jsxs("p",{children:["Use identifiers returned by lookups. Paper detail accepts an arXiv ID or numeric catalog ID; the arXiv endpoint takes an arXiv ID. Task and dataset detail accept their catalog IDs or slugs. Leaderboard metrics require numeric task and dataset IDs. Evaluation filters such as ",e.jsx("code",{children:"dataset_id"})," and ",e.jsx("code",{children:"task_id"})," require numeric catalog IDs. Example IDs may no longer exist: replace them with current lookup results."]})]}),e.jsxs("section",{id:"benchmarks",children:[e.jsx("h2",{children:"Reading leaderboards"}),e.jsxs("p",{children:["Search datasets, select a dataset, then fetch its tasks and the metrics for a dataset/task pair. Fetch"," ",e.jsx("code",{children:"/evaluations/?dataset_id=…&task_id=…&ordering=best_rank"})," ","using the numeric IDs. An evaluation includes reported scores and source information; check metric direction, split, and evaluation setup before comparing results."]}),e.jsxs("p",{children:["Use ",e.jsx("code",{children:"include_resources=true"})," on paper list/detail requests for linked repositories and project pages. Missing fields or null values mean data is unavailable; they are not zero scores. Keyword search examples explicitly send ",e.jsx("code",{children:"mode=keyword"}),"; semantic and hybrid search are outside this beta."]})]}),e.jsxs("section",{id:"errors",children:[e.jsx("h2",{children:"Errors"}),e.jsxs("p",{children:["Check the HTTP status before parsing a successful result. Errors usually contain a ",e.jsx("code",{children:"detail"})," field, which can be a string, object, or validation-error array."]}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("b",{children:"400:"})," invalid request."]}),e.jsxs("li",{children:[e.jsx("b",{children:"404:"})," record not found."]}),e.jsxs("li",{children:[e.jsx("b",{children:"422:"})," invalid parameter type, value, or missing parameter."]}),e.jsxs("li",{children:[e.jsx("b",{children:"429:"})," traffic limit exceeded; obey ",e.jsx("code",{children:"Retry-After"}),"."]}),e.jsxs("li",{children:[e.jsx("b",{children:"5xx:"})," temporary server failure; retry with bounded backoff."]})]}),e.jsx(h,{value:'{ "detail": "API traffic limit exceeded. Retry with backoff." }'})]}),e.jsxs("section",{id:"changelog",children:[e.jsx("h2",{children:"Changelog"}),e.jsx("h3",{children:"Initial experimental beta"}),e.jsx("p",{children:"Core catalog reads, keyword search, public schemas, and anonymous browser access. Planned breaking changes will be announced here at least 14 days before they take effect. Urgent security and service-restoration fixes may take effect immediately. This beta has no uptime or support-response guarantee."})]}),r&&e.jsx("p",{role:"status",children:"Loading endpoint reference…"}),n&&e.jsxs("div",{role:"alert",children:[e.jsx("p",{children:"Could not load the endpoint reference."}),e.jsx("button",{onClick:()=>void a(),children:"Retry"})]}),s&&e.jsxs(e.Fragment,{children:[Object.entries(s.paths).map(([t,{get:i}])=>e.jsx(q,{path:t,operation:i},t)),e.jsxs("section",{id:"response-models",children:[e.jsx("h2",{children:"Response models"}),Object.entries(s.components.schemas).map(([t,i])=>e.jsxs("article",{id:`model-${t}`,children:[e.jsx("h3",{children:t}),e.jsx("p",{children:i.description}),e.jsx(j,{schema:i})]},t))]})]})]})]})}export{I as default}; diff --git a/assets/AreaSection-NWvfO4Sb.js b/assets/AreaSection-BxnKzNK0.js similarity index 88% rename from assets/AreaSection-NWvfO4Sb.js rename to assets/AreaSection-BxnKzNK0.js index ef4caf1c5902ae9a8cf7cba0455c80491410790f..21ed214b45723ad2fad82a3661b75f75269b3d30 100644 --- a/assets/AreaSection-NWvfO4Sb.js +++ b/assets/AreaSection-BxnKzNK0.js @@ -1 +1 @@ -import{j as s}from"./index-CbgxfyGU.js";import{S as l}from"./skeleton-HwvdxvSN.js";const m=({id:t,title:a,description:e,meta:r,style:c,children:i})=>s.jsxs("section",{id:t,className:"area-section",style:c,children:[s.jsxs("div",{className:"area-section-head",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"area-section-title",children:a}),e&&s.jsx("div",{className:"area-section-description",children:e})]}),s.jsx("div",{className:"area-section-meta",children:r})]}),s.jsx("div",{className:"tag-grid",children:i})]}),h=({sections:t=4,tiles:a,tileClassName:e})=>s.jsx("div",{className:"area-directory-skeleton",children:Array.from({length:t}).map((r,c)=>s.jsxs("div",{children:[s.jsx(l,{className:"h-8 w-1/3 mb-4"}),s.jsx("div",{className:"tag-grid",children:Array.from({length:a}).map((i,n)=>s.jsx(l,{className:e},n))})]},c))}),x=({areas:t})=>{const a=t.filter(r=>r.tasks.length>0),e=a.reduce((r,c)=>r+c.tasks.length,0);return e===0?null:s.jsxs("div",{className:"area-directory-footer",children:[e," tasks across ",a.length," areas."]})};export{h as A,m as a,x as b}; +import{j as s}from"./index-DyXq7-Tg.js";import{S as l}from"./skeleton-C3IIzpSL.js";const m=({id:t,title:a,description:e,meta:r,style:c,children:i})=>s.jsxs("section",{id:t,className:"area-section",style:c,children:[s.jsxs("div",{className:"area-section-head",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"area-section-title",children:a}),e&&s.jsx("div",{className:"area-section-description",children:e})]}),s.jsx("div",{className:"area-section-meta",children:r})]}),s.jsx("div",{className:"tag-grid",children:i})]}),h=({sections:t=4,tiles:a,tileClassName:e})=>s.jsx("div",{className:"area-directory-skeleton",children:Array.from({length:t}).map((r,c)=>s.jsxs("div",{children:[s.jsx(l,{className:"h-8 w-1/3 mb-4"}),s.jsx("div",{className:"tag-grid",children:Array.from({length:a}).map((i,n)=>s.jsx(l,{className:e},n))})]},c))}),x=({areas:t})=>{const a=t.filter(r=>r.tasks.length>0),e=a.reduce((r,c)=>r+c.tasks.length,0);return e===0?null:s.jsxs("div",{className:"area-directory-footer",children:[e," tasks across ",a.length," areas."]})};export{h as A,m as a,x as b}; diff --git a/assets/ArtifactWorkspace-Cwix1Wp6.js b/assets/ArtifactWorkspace-Ya79_F5k.js similarity index 99% rename from assets/ArtifactWorkspace-Cwix1Wp6.js rename to assets/ArtifactWorkspace-Ya79_F5k.js index 0726f72a6e3e8fb5744316124b60aff17453f7ce..8d5cb0c67f0801c49b88c3e7f53a4a35a39d38e1 100644 --- a/assets/ArtifactWorkspace-Cwix1Wp6.js +++ b/assets/ArtifactWorkspace-Ya79_F5k.js @@ -1,4 +1,4 @@ -var TL=Object.defineProperty;var yA=n=>{throw TypeError(n)};var PL=(n,e,t)=>e in n?TL(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var oe=(n,e,t)=>PL(n,typeof e!="symbol"?e+"":e,t),av=(n,e,t)=>e.has(n)||yA("Cannot "+t);var f=(n,e,t)=>(av(n,e,"read from private field"),t?t.call(n):e.get(n)),M=(n,e,t)=>e.has(n)?yA("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),$=(n,e,t,s)=>(av(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t),P=(n,e,t)=>(av(n,e,"access private method"),t);var hs=(n,e,t,s)=>({set _(i){$(n,e,i,t)},get _(){return f(n,e,s)}});import{n as Mo,r as q,j as S,M as ee,$ as eS,a0 as rn,a1 as gm,a2 as l0,L as Nd,a3 as RL,X as c0,a4 as ML,f as ZC,C as IL}from"./index-CbgxfyGU.js";import{u as XC,a as OL,c as NL,P as YC,i as LL,b as JC,e as tS,A as DL,v as jL,Z as FL,_ as zL,$ as HL,a0 as QC,a1 as BL}from"./chatSessions-DwLUbLRo.js";/* empty css */import{H as Np,a as Lp,b as Dp}from"./hover-card-ufez2uMo.js";import{u as wo}from"./useQuery-Bx9s5-D2.js";import{f as UL,i as e$,p as qL,C as VL,a as WL,T as GL}from"./CatalogEntityPreviewLink-Cvehtzvn.js";import{G as h0}from"./github-BYklgHDz.js";import{F as t$}from"./file-text-BK_7Q2rV.js";import{r as KL,a as ZL,P as u0,c as XL}from"./PaperPreviewLink-DZDNIh1g.js";import{M as YL,d as JL}from"./index-ZkEATkOr.js";import{r as QL}from"./index-BH3yOoza.js";import{c as vA}from"./chat-DzTo2WUO.js";import{C as eD}from"./copy-bzw7JVus.js";import{T as tD}from"./thumbs-up-CDCzGuPd.js";import{u as ym}from"./useMutation-P_trTy9i.js";import{A as nD}from"./arrow-left-Czeu3VzJ.js";import{E as n$}from"./external-link-DZIH4GGr.js";import{P as sD}from"./plus-UK0TEjgd.js";import{S as iD}from"./search-CLtAJGOp.js";import{C as s$,a as i$}from"./chevron-up-Cpt5JLeI.js";import{A as rD}from"./AuthorAvatar-CUJMmp_z.js";import{a as oD}from"./paperQueryKeys-B8u1BWlI.js";/** +var TL=Object.defineProperty;var yA=n=>{throw TypeError(n)};var PL=(n,e,t)=>e in n?TL(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var oe=(n,e,t)=>PL(n,typeof e!="symbol"?e+"":e,t),av=(n,e,t)=>e.has(n)||yA("Cannot "+t);var f=(n,e,t)=>(av(n,e,"read from private field"),t?t.call(n):e.get(n)),M=(n,e,t)=>e.has(n)?yA("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),$=(n,e,t,s)=>(av(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t),P=(n,e,t)=>(av(n,e,"access private method"),t);var hs=(n,e,t,s)=>({set _(i){$(n,e,i,t)},get _(){return f(n,e,s)}});import{s as Mo,d as q,j as S,V as ee,b as wo,a5 as eS,a6 as rn,a7 as gm,a8 as l0,L as Nd,a9 as RL,X as c0,aa as ML,i as ZC,C as IL}from"./index-DyXq7-Tg.js";import{u as XC,a as OL,c as NL,P as YC,i as LL,b as JC,e as tS,A as DL,v as jL,Z as FL,_ as zL,$ as HL,a0 as QC,a1 as BL}from"./chatSessions-Ck_dyM0d.js";/* empty css */import{H as Np,a as Lp,b as Dp}from"./hover-card-B45EJIn_.js";import{f as UL,i as e$,p as qL,C as VL,a as WL,T as GL}from"./CatalogEntityPreviewLink-BktpwL3_.js";import{G as h0}from"./github-RNrgGHRT.js";import{F as t$}from"./file-text-dvKtHbmD.js";import{r as KL,a as ZL,P as u0,c as XL}from"./PaperPreviewLink-CpCZSa8K.js";import{M as YL,d as JL}from"./index-mCi_y_l3.js";import{r as QL}from"./index-2CvJmBVB.js";import{c as vA}from"./chat-Ix1IrIwq.js";import{C as eD}from"./copy-CxR0OKx2.js";import{T as tD}from"./thumbs-up-CPLlGli7.js";import{u as ym}from"./useMutation-UWxBeqtn.js";import{A as nD}from"./arrow-left-PA_b6law.js";import{E as n$}from"./external-link-orY1Xz1I.js";import{P as sD}from"./plus-Yh42pKZz.js";import{S as iD}from"./search-8ssWDP68.js";import{C as s$,a as i$}from"./chevron-up-DYSYRyvz.js";import{A as rD}from"./AuthorAvatar-B-9xS2Wo.js";import{p as oD}from"./papers-Dh3ljlL0.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. @@ -43,7 +43,7 @@ var TL=Object.defineProperty;var yA=n=>{throw TypeError(n)};var PL=(n,e,t)=>e in * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dD=Mo("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);function d0({selection:n,editable:e=!1,onRemove:t}){const s=q.useId(),i=q.useRef(null),[r,o]=q.useState(!1),[a,l]=q.useState(!1),c=`Selection · Page ${n.page}`;return q.useEffect(()=>{const h=i.current;!h||r||l(h.scrollHeight>h.clientHeight+1)},[r,n.text]),S.jsxs("div",{className:`chat-paper-selection${e?" is-editable":""}`,children:[S.jsxs("div",{className:"chat-paper-selection-header",children:[S.jsx("span",{className:"chat-paper-selection-label",children:c}),S.jsxs("div",{className:"chat-paper-selection-actions",children:[(a||r)&&S.jsx("button",{type:"button",className:"chat-paper-selection-toggle","aria-expanded":r,"aria-controls":s,onClick:()=>o(h=>!h),children:r?"Collapse":"Expand"}),e&&t&&S.jsx("button",{type:"button",className:"chat-paper-selection-remove","aria-label":"Remove selected paper passage",onClick:t,children:"Remove"})]})]}),S.jsx("blockquote",{id:s,ref:i,className:`chat-paper-selection-quote${r?" is-expanded":""}`,children:n.text})]})}const fD=jL(),tse=({onSend:n,busy:e,placeholder:t,autoFocus:s,draft:i,onDraftChange:r,onStop:o,disabled:a=!1,describedBy:l,paperMentionsEnabled:c=!1,paperSelectionEnabled:h=!0,paperArtifactsEnabled:u=!1})=>{const[d,p]=q.useState(fD),m=i??d,y=q.useRef(null),[v,g]=q.useState(0),_=H=>{i||p(H),r==null||r(H)},b=XC({draft:m,onChange:_,enabled:c,textareaRef:y}),x=u&&m.text==="/",{completion:A,trackCaret:T}=OL(m,b.open||x);q.useEffect(()=>{const H=y.current;H&&(H.style.height="auto",H.style.height=`${Math.min(NL(H),200)}px`)},[m.text,A]),q.useEffect(()=>{var H;s&&((H=y.current)==null||H.focus())},[s]);const C=()=>{const H=m.text.length-m.text.trimStart().length,j=m.text.trim(),U=!!m.paperSelection&&!h;if(!j||e||a||U)return;const B=H+j.length,L={text:j,paperMentions:m.paperMentions.filter(X=>X.start>=H&&X.end<=B).map(X=>({...X,start:X.start-H,end:X.end-H})),...m.paperSelection?{paperSelection:m.paperSelection}:{}};n(L)},I=!!m.paperSelection&&!h,D=!!m.text.trim()&&!I;return S.jsxs("div",{className:"chat-composer ph-no-capture","data-ph-no-autocapture":"true","data-ph-no-capture":"true",children:[m.paperSelection&&S.jsx(d0,{selection:m.paperSelection,editable:!0,onRemove:()=>{var H;_({text:m.text,paperMentions:m.paperMentions}),(H=y.current)==null||H.focus()}}),I&&S.jsx("div",{className:"chat-paper-selection-disabled",role:"status",children:"Paper selection is currently disabled. Remove the selected passage or wait for the feature to recover."}),S.jsxs("div",{className:"chat-composer-textarea-wrap",children:[S.jsx(YC,{text:m.text,mentions:m.paperMentions,scrollTop:v,completion:A}),S.jsx("textarea",{className:"ph-no-capture","data-ph-no-autocapture":"true","data-ph-no-capture":"true",ref:y,rows:1,value:m.text,placeholder:t||(m.paperSelection?"Ask about this selection…":"Ask anything about research…"),onChange:H=>{b.updateText(H.target.value,H.target.selectionStart),T(H.target)},onSelect:H=>{b.refresh(H.currentTarget.selectionStart),T(H.currentTarget)},onClick:H=>{b.refresh(H.currentTarget.selectionStart),T(H.currentTarget)},onScroll:H=>g(H.currentTarget.scrollTop),onBlur:H=>{var j,U;(U=(j=H.relatedTarget)==null?void 0:j.closest)!=null&&U.call(j,".chat-paper-picker, .chat-slash-command")||window.setTimeout(b.close,0)},onKeyDown:H=>{if(!b.keyDown(H)){if(LL(H)&&A){H.preventDefault();const j=m.text+A;b.updateText(j,j.length),window.requestAnimationFrame(()=>{var U;return(U=y.current)==null?void 0:U.setSelectionRange(j.length,j.length)});return}H.key==="Enter"&&!H.shiftKey&&!H.nativeEvent.isComposing&&(H.preventDefault(),C())}},role:"combobox","aria-expanded":b.open||x,"aria-controls":b.open?b.pickerId:x?"chat-write-paper-command":void 0,"aria-activedescendant":b.open&&b.results.length?`${b.optionIdPrefix}-${b.activeIndex}`:x?"chat-write-paper-command":void 0,"aria-autocomplete":"list","aria-describedby":[l,b.message?"chat-paper-mention-message":null].filter(Boolean).join(" ")||void 0}),S.jsx(JC,{open:b.open,query:b.query,results:b.results,activeIndex:b.activeIndex,loading:b.loading,error:b.error,onSelect:b.select,id:b.pickerId,optionIdPrefix:b.optionIdPrefix}),x&&S.jsxs("button",{type:"button",id:"chat-write-paper-command",className:"chat-slash-command",role:"option",onMouseDown:H=>{var j;H.preventDefault(),_({...m,text:"/write-paper "}),(j=y.current)==null||j.focus()},children:[S.jsx("code",{children:"/write-paper"}),S.jsx("span",{children:"Draft a paper from this research chat"})]})]}),b.message&&S.jsx("div",{id:"chat-paper-mention-message",className:"chat-paper-mention-message",role:"alert",children:b.message}),S.jsxs("div",{className:"chat-composer-row",children:[S.jsx("div",{className:"chat-composer-tools",children:S.jsxs("span",{className:"chat-composer-hint",children:[A?"Tab to complete · ":"","Enter to send · Shift+Enter for newline"]})}),S.jsx("button",{type:"button",className:`chat-send${e||D?" chat-send-on":""}`,onClick:e?o:C,disabled:a||(e?!o:!D),"aria-label":e?"Stop generating":"Send message",children:e?o?S.jsx("span",{"aria-hidden":"true",children:"■"}):S.jsx(tS,{light:!0}):S.jsx(DL,{})})]})]})};function pD(){const[n,e]=q.useState(!1);return q.useEffect(()=>{const t=window.setTimeout(()=>e(!0),15e3);return()=>window.clearTimeout(t)},[]),S.jsxs("div",{className:"chat-waiting chat-compaction-status",role:"status","aria-live":"polite",children:[S.jsx("span",{className:"chat-thinking",children:"Summarizing earlier context…"}),n&&S.jsx("span",{className:"chat-compaction-explanation",children:"This conversation is long. Preserving its details may take up to a minute."})]})}const lv=new Map,o$=n=>{if(!n)return Promise.resolve();const e=lv.get(n);if(e)return e;const t=new Promise(s=>{const i=new Image;i.onload=()=>{s()},i.onerror=()=>{lv.delete(n),s()},i.src=n});return lv.set(n,t),t},mD=new Set(["huggingface.co","www.huggingface.co"]),gD=new Set(["api","blog","chat","collections","docs","enterprise","join","login","models","new","organizations","papers","posts","pricing","search","settings","spaces","tasks"]);function yD(n){let e;try{e=new URL(n)}catch{return null}if(e.protocol!=="https:"||!mD.has(e.hostname))return null;const t=e.pathname.split("/").filter(Boolean),s=t[0]==="datasets"?"dataset":"model",i=s==="dataset"?t.slice(1):t;if(i.length!==2||s==="model"&&gD.has(i[0])||i.some(c=>!c||c==="."||c===".."))return null;const r=i.join("/"),o=i.map(encodeURIComponent).join("/"),a=s==="dataset"?`datasets/${o}`:o,l=s==="dataset"?"datasets":"models";return{type:s,repoId:r,url:`https://huggingface.co/${a}`,thumbnailUrl:`https://cdn-thumbnails.huggingface.co/social-thumbnails/${l}/${o}.png`}}const vD=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,bD=({repo:n})=>{const[e,t]=ee.useState(!1);return S.jsxs("div",{className:"hf-preview-card",children:[e?S.jsx("div",{className:"hf-preview-fallback","aria-hidden":"true",children:"🤗"}):S.jsx("img",{className:"hf-preview-image","data-testid":"hf-preview-image",src:n.thumbnailUrl,alt:"",loading:"eager",decoding:"async",onError:()=>t(!0)}),S.jsxs("div",{className:"hf-preview-meta",children:[S.jsxs("span",{className:"hf-preview-kind",children:["Hugging Face ",n.type]}),S.jsx("strong",{children:n.repoId}),S.jsx("span",{children:"huggingface.co"})]})]})},wD=({repo:n,children:e})=>{const[t,s]=ee.useState(!1),i=ee.useRef(null),r=ee.useCallback(()=>{o$(n.thumbnailUrl)},[n.thumbnailUrl]);return ee.useEffect(()=>{const o=i.current;if(!o||typeof IntersectionObserver>"u")return;const a=new IntersectionObserver(([l])=>{l.isIntersecting&&(r(),a.disconnect())},{rootMargin:"200px"});return a.observe(o),()=>a.disconnect()},[r]),S.jsxs(Np,{open:t,onOpenChange:o=>{(!o||!vD())&&s(o)},openDelay:150,closeDelay:100,children:[S.jsx(Lp,{asChild:!0,children:S.jsx("a",{ref:i,className:"chat-paper-link chat-hf-link",href:n.url,target:"_blank",rel:"noopener noreferrer",onPointerEnter:r,onFocus:r,children:e})}),S.jsx(Dp,{className:"hf-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:S.jsx(bD,{repo:n})})]})},_D=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,SD=({repo:n,preview:e,unavailable:t})=>{const[s,i]=ee.useState(!1),r=!!(e!=null&&e.avatarUrl)&&!s;return S.jsxs("div",{className:"github-preview-card",children:[r?S.jsx("img",{className:"github-preview-image","data-testid":"github-preview-image",src:e==null?void 0:e.avatarUrl,alt:"",loading:"eager",decoding:"async",onError:()=>i(!0)}):S.jsx("div",{className:"github-preview-fallback","aria-hidden":"true",children:S.jsx(h0,{})}),S.jsxs("div",{className:"github-preview-meta",children:[S.jsx("span",{className:"github-preview-kind",children:"GitHub repository"}),S.jsx("strong",{children:n.repoId}),(e==null?void 0:e.description)&&S.jsx("span",{className:"github-preview-description",children:e.description}),e?S.jsxs("span",{className:"github-preview-stats",children:[e.language&&S.jsxs(S.Fragment,{children:[e.language," · "]}),"★ ",e.stars.toLocaleString()," · ⑂ ",e.forks.toLocaleString(),e.archived&&S.jsx(S.Fragment,{children:" · Archived"})]}):S.jsx("span",{children:t?"Preview unavailable":"Loading preview…"})]})]})},xD=({repo:n,children:e})=>{var c;const[t,s]=ee.useState(!1),[i,r]=ee.useState(!1),o=ee.useRef(null),a=ee.useCallback(()=>r(!0),[]),l=wo({queryKey:["github-repository-preview",n.repoId.toLowerCase()],queryFn:({signal:h})=>UL(n,h),enabled:t||i,staleTime:30*60*1e3,gcTime:60*60*1e3,retry:!1});return ee.useEffect(()=>{const h=o.current;if(!h||typeof IntersectionObserver>"u")return;const u=new IntersectionObserver(([d])=>{d.isIntersecting&&(a(),u.disconnect())},{rootMargin:"200px"});return u.observe(h),()=>u.disconnect()},[a]),ee.useEffect(()=>{var h;(h=l.data)!=null&&h.avatarUrl&&o$(l.data.avatarUrl)},[(c=l.data)==null?void 0:c.avatarUrl]),S.jsxs(Np,{open:t,onOpenChange:h=>{(!h||!_D())&&s(h)},openDelay:150,closeDelay:100,children:[S.jsx(Lp,{asChild:!0,children:S.jsxs("a",{ref:o,className:"chat-github-link",href:n.url,target:"_blank",rel:"noopener noreferrer",onPointerEnter:a,onFocus:a,children:[S.jsx(h0,{"aria-hidden":"true"}),e]})}),S.jsx(Dp,{className:"github-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:S.jsx(SD,{repo:n,preview:l.data,unavailable:l.isError})})]})},AD=/^p\d+b\d+$/;function nse(n,e){const t=n.blocks[e];return t?t.label!=="Section-Header"?[{page:t.page,bbox:t.bbox}]:Object.entries(n.blocks).filter(([s,i])=>s===e||i.section===e).map(([,s])=>({page:s.page,bbox:s.bbox})):[]}function kD(n){const e=[...n.matchAll(/\]\(pdf:(p\d+b\d+)\)/g)].map(t=>t[1]);return[...new Set(e)]}const ED=320,wA=12,CD=170;function $D(n,e){const t=Math.min(ED,e*.7),s=e-wA-t-n.left,i=wA-n.left;return{left:Math.max(i,Math.min(0,s)),below:n.topq.useContext(PD);function l$(n){return n.length>220?`${n.slice(0,220).trimEnd()}…`:n}function RD({anchor:n,children:e}){var l;const t=a$(),[s,i]=q.useState({left:0,below:!1}),r=(l=t==null?void 0:t.layout)==null?void 0:l.blocks[n];if(!t||!r)return S.jsx("span",{className:"chat-invalid-citation",children:e});const o=r.label==="Section-Header",a=c=>i($D(c.getBoundingClientRect(),window.innerWidth));return S.jsxs("button",{type:"button",className:"chat-pdf-citation",onClick:()=>t.open(n),onMouseEnter:c=>a(c.currentTarget),onFocus:c=>a(c.currentTarget),"aria-label":`${o?"Jump to section":"Jump to passage"} on page ${r.page}`,children:[S.jsx(t$,{"aria-hidden":"true"}),S.jsx("span",{children:q.Children.map(e,(c,h)=>h===0&&typeof c=="string"?TD(c):c)}),S.jsxs("span",{className:`chat-pdf-citation-preview${s.below?" is-below":""}`,role:"tooltip",style:{left:s.left},children:[S.jsxs("strong",{children:["Page ",r.page,o?" · section":""]}),r.text&&S.jsx("span",{children:l$(r.text)})]})]})}function MD({text:n}){const e=a$(),t=e==null?void 0:e.layout;if(!e||!t)return null;const s=kD(n).filter(i=>t.blocks[i]);return s.length?S.jsxs("details",{className:"chat-pdf-sources",children:[S.jsxs("summary",{children:["Sources (",s.length,")"]}),S.jsx("ol",{children:s.map(i=>{const r=t.blocks[i];return S.jsx("li",{children:S.jsxs("button",{type:"button",onClick:()=>e.open(i),children:[S.jsxs("span",{className:"chat-pdf-sources-page",children:["p. ",r.page]}),S.jsx("span",{children:l$(r.text)||r.label})]})},i)})})]}):null}const ID=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches;function OD(n){try{return new URL(n).hostname.replace(/^www\./,"")}catch{return"Web source"}}const ND=({citation:n})=>{const[e,t]=ee.useState(!1),[s,i]=ee.useState(!1),r=n.thumbnail_url,o=n.favicon_url;return S.jsxs("div",{className:"web-preview-card",children:[r&&!e&&S.jsx("img",{className:"web-preview-image","data-testid":"web-preview-image",src:r,alt:"",loading:"eager",decoding:"async",referrerPolicy:"no-referrer",onError:()=>t(!0)}),S.jsxs("div",{className:"web-preview-meta",children:[S.jsxs("div",{className:"web-preview-source",children:[o&&!s&&S.jsx("img",{src:o,alt:"",loading:"eager",decoding:"async",referrerPolicy:"no-referrer",onError:()=>i(!0)}),S.jsx("span",{children:OD(n.url??"")}),n.published&&S.jsxs(S.Fragment,{children:[S.jsx("span",{"aria-hidden":"true",children:"·"}),S.jsx("time",{children:n.published.slice(0,10)})]})]}),S.jsx("strong",{children:n.title}),n.excerpt&&S.jsx("p",{children:n.excerpt.replace(/\s+/g," ").trim()})]})]})},LD=({citation:n,children:e})=>{const[t,s]=ee.useState(!1),i=n.url??"";return S.jsxs(Np,{open:t,onOpenChange:r=>{(!r||!ID())&&s(r)},openDelay:150,closeDelay:100,children:[S.jsx(Lp,{asChild:!0,children:S.jsx("a",{href:i,className:"chat-web-citation",target:"_blank",rel:"noopener noreferrer",children:e})}),S.jsx(Dp,{className:"web-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:S.jsx(ND,{citation:n})})]})},DD=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,jD=n=>n==="semantic_scholar"?"Semantic Scholar":"External paper",FD=({citation:n})=>{var e,t;return S.jsxs("div",{className:"external-paper-preview-card",children:[S.jsxs("div",{className:"external-paper-preview-source",children:[S.jsx("span",{children:jD(n.provider)}),n.published&&S.jsxs(S.Fragment,{children:[S.jsx("span",{"aria-hidden":"true",children:"·"}),S.jsx("time",{children:n.published.slice(0,10)})]})]}),S.jsx("strong",{children:n.title}),(((e=n.authors)==null?void 0:e.length)??0)>0&&S.jsx("p",{className:"external-paper-preview-authors",children:(t=n.authors)==null?void 0:t.join(", ")}),n.excerpt&&S.jsx("p",{children:n.excerpt.replace(/\s+/g," ").trim()}),n.citation_count!==null&&n.citation_count!==void 0&&S.jsxs("span",{className:"external-paper-preview-citations",children:[n.citation_count.toLocaleString()," citations"]})]})},zD=({citation:n,children:e})=>{const[t,s]=ee.useState(!1);return S.jsxs(Np,{open:t,onOpenChange:i=>{(!i||!DD())&&s(i)},openDelay:150,closeDelay:100,children:[S.jsx(Lp,{asChild:!0,children:S.jsx("a",{href:n.url??"",className:"chat-external-paper-citation",target:"_blank",rel:"noopener noreferrer",children:e})}),S.jsx(Dp,{className:"external-paper-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:S.jsx(FD,{citation:n})})]})};function HD(n){const e=[];let t=0,s=null;for(const i of n.match(/.*(?:\n|$)/g)??[]){if(!i)continue;const r=i.endsWith(` + */const dD=Mo("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);function d0({selection:n,editable:e=!1,onRemove:t}){const s=q.useId(),i=q.useRef(null),[r,o]=q.useState(!1),[a,l]=q.useState(!1),c=`Selection · Page ${n.page}`;return q.useEffect(()=>{const h=i.current;!h||r||l(h.scrollHeight>h.clientHeight+1)},[r,n.text]),S.jsxs("div",{className:`chat-paper-selection${e?" is-editable":""}`,children:[S.jsxs("div",{className:"chat-paper-selection-header",children:[S.jsx("span",{className:"chat-paper-selection-label",children:c}),S.jsxs("div",{className:"chat-paper-selection-actions",children:[(a||r)&&S.jsx("button",{type:"button",className:"chat-paper-selection-toggle","aria-expanded":r,"aria-controls":s,onClick:()=>o(h=>!h),children:r?"Collapse":"Expand"}),e&&t&&S.jsx("button",{type:"button",className:"chat-paper-selection-remove","aria-label":"Remove selected paper passage",onClick:t,children:"Remove"})]})]}),S.jsx("blockquote",{id:s,ref:i,className:`chat-paper-selection-quote${r?" is-expanded":""}`,children:n.text})]})}const fD=jL(),ese=({onSend:n,busy:e,placeholder:t,autoFocus:s,draft:i,onDraftChange:r,onStop:o,disabled:a=!1,describedBy:l,paperMentionsEnabled:c=!1,paperSelectionEnabled:h=!0,paperArtifactsEnabled:u=!1})=>{const[d,p]=q.useState(fD),m=i??d,y=q.useRef(null),[v,g]=q.useState(0),_=H=>{i||p(H),r==null||r(H)},b=XC({draft:m,onChange:_,enabled:c,textareaRef:y}),x=u&&m.text==="/",{completion:A,trackCaret:T}=OL(m,b.open||x);q.useEffect(()=>{const H=y.current;H&&(H.style.height="auto",H.style.height=`${Math.min(NL(H),200)}px`)},[m.text,A]),q.useEffect(()=>{var H;s&&((H=y.current)==null||H.focus())},[s]);const C=()=>{const H=m.text.length-m.text.trimStart().length,j=m.text.trim(),U=!!m.paperSelection&&!h;if(!j||e||a||U)return;const B=H+j.length,L={text:j,paperMentions:m.paperMentions.filter(X=>X.start>=H&&X.end<=B).map(X=>({...X,start:X.start-H,end:X.end-H})),...m.paperSelection?{paperSelection:m.paperSelection}:{}};n(L)},I=!!m.paperSelection&&!h,D=!!m.text.trim()&&!I;return S.jsxs("div",{className:"chat-composer ph-no-capture","data-ph-no-autocapture":"true","data-ph-no-capture":"true",children:[m.paperSelection&&S.jsx(d0,{selection:m.paperSelection,editable:!0,onRemove:()=>{var H;_({text:m.text,paperMentions:m.paperMentions}),(H=y.current)==null||H.focus()}}),I&&S.jsx("div",{className:"chat-paper-selection-disabled",role:"status",children:"Paper selection is currently disabled. Remove the selected passage or wait for the feature to recover."}),S.jsxs("div",{className:"chat-composer-textarea-wrap",children:[S.jsx(YC,{text:m.text,mentions:m.paperMentions,scrollTop:v,completion:A}),S.jsx("textarea",{className:"ph-no-capture","data-ph-no-autocapture":"true","data-ph-no-capture":"true",ref:y,rows:1,value:m.text,placeholder:t||(m.paperSelection?"Ask about this selection…":"Ask anything about research…"),onChange:H=>{b.updateText(H.target.value,H.target.selectionStart),T(H.target)},onSelect:H=>{b.refresh(H.currentTarget.selectionStart),T(H.currentTarget)},onClick:H=>{b.refresh(H.currentTarget.selectionStart),T(H.currentTarget)},onScroll:H=>g(H.currentTarget.scrollTop),onBlur:H=>{var j,U;(U=(j=H.relatedTarget)==null?void 0:j.closest)!=null&&U.call(j,".chat-paper-picker, .chat-slash-command")||window.setTimeout(b.close,0)},onKeyDown:H=>{if(!b.keyDown(H)){if(LL(H)&&A){H.preventDefault();const j=m.text+A;b.updateText(j,j.length),window.requestAnimationFrame(()=>{var U;return(U=y.current)==null?void 0:U.setSelectionRange(j.length,j.length)});return}H.key==="Enter"&&!H.shiftKey&&!H.nativeEvent.isComposing&&(H.preventDefault(),C())}},role:"combobox","aria-expanded":b.open||x,"aria-controls":b.open?b.pickerId:x?"chat-write-paper-command":void 0,"aria-activedescendant":b.open&&b.results.length?`${b.optionIdPrefix}-${b.activeIndex}`:x?"chat-write-paper-command":void 0,"aria-autocomplete":"list","aria-describedby":[l,b.message?"chat-paper-mention-message":null].filter(Boolean).join(" ")||void 0}),S.jsx(JC,{open:b.open,query:b.query,results:b.results,activeIndex:b.activeIndex,loading:b.loading,error:b.error,onSelect:b.select,id:b.pickerId,optionIdPrefix:b.optionIdPrefix}),x&&S.jsxs("button",{type:"button",id:"chat-write-paper-command",className:"chat-slash-command",role:"option",onMouseDown:H=>{var j;H.preventDefault(),_({...m,text:"/write-paper "}),(j=y.current)==null||j.focus()},children:[S.jsx("code",{children:"/write-paper"}),S.jsx("span",{children:"Draft a paper from this research chat"})]})]}),b.message&&S.jsx("div",{id:"chat-paper-mention-message",className:"chat-paper-mention-message",role:"alert",children:b.message}),S.jsxs("div",{className:"chat-composer-row",children:[S.jsx("div",{className:"chat-composer-tools",children:S.jsxs("span",{className:"chat-composer-hint",children:[A?"Tab to complete · ":"","Enter to send · Shift+Enter for newline"]})}),S.jsx("button",{type:"button",className:`chat-send${e||D?" chat-send-on":""}`,onClick:e?o:C,disabled:a||(e?!o:!D),"aria-label":e?"Stop generating":"Send message",children:e?o?S.jsx("span",{"aria-hidden":"true",children:"■"}):S.jsx(tS,{light:!0}):S.jsx(DL,{})})]})]})};function pD(){const[n,e]=q.useState(!1);return q.useEffect(()=>{const t=window.setTimeout(()=>e(!0),15e3);return()=>window.clearTimeout(t)},[]),S.jsxs("div",{className:"chat-waiting chat-compaction-status",role:"status","aria-live":"polite",children:[S.jsx("span",{className:"chat-thinking",children:"Summarizing earlier context…"}),n&&S.jsx("span",{className:"chat-compaction-explanation",children:"This conversation is long. Preserving its details may take up to a minute."})]})}const lv=new Map,o$=n=>{if(!n)return Promise.resolve();const e=lv.get(n);if(e)return e;const t=new Promise(s=>{const i=new Image;i.onload=()=>{s()},i.onerror=()=>{lv.delete(n),s()},i.src=n});return lv.set(n,t),t},mD=new Set(["huggingface.co","www.huggingface.co"]),gD=new Set(["api","blog","chat","collections","docs","enterprise","join","login","models","new","organizations","papers","posts","pricing","search","settings","spaces","tasks"]);function yD(n){let e;try{e=new URL(n)}catch{return null}if(e.protocol!=="https:"||!mD.has(e.hostname))return null;const t=e.pathname.split("/").filter(Boolean),s=t[0]==="datasets"?"dataset":"model",i=s==="dataset"?t.slice(1):t;if(i.length!==2||s==="model"&&gD.has(i[0])||i.some(c=>!c||c==="."||c===".."))return null;const r=i.join("/"),o=i.map(encodeURIComponent).join("/"),a=s==="dataset"?`datasets/${o}`:o,l=s==="dataset"?"datasets":"models";return{type:s,repoId:r,url:`https://huggingface.co/${a}`,thumbnailUrl:`https://cdn-thumbnails.huggingface.co/social-thumbnails/${l}/${o}.png`}}const vD=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,bD=({repo:n})=>{const[e,t]=ee.useState(!1);return S.jsxs("div",{className:"hf-preview-card",children:[e?S.jsx("div",{className:"hf-preview-fallback","aria-hidden":"true",children:"🤗"}):S.jsx("img",{className:"hf-preview-image","data-testid":"hf-preview-image",src:n.thumbnailUrl,alt:"",loading:"eager",decoding:"async",onError:()=>t(!0)}),S.jsxs("div",{className:"hf-preview-meta",children:[S.jsxs("span",{className:"hf-preview-kind",children:["Hugging Face ",n.type]}),S.jsx("strong",{children:n.repoId}),S.jsx("span",{children:"huggingface.co"})]})]})},wD=({repo:n,children:e})=>{const[t,s]=ee.useState(!1),i=ee.useRef(null),r=ee.useCallback(()=>{o$(n.thumbnailUrl)},[n.thumbnailUrl]);return ee.useEffect(()=>{const o=i.current;if(!o||typeof IntersectionObserver>"u")return;const a=new IntersectionObserver(([l])=>{l.isIntersecting&&(r(),a.disconnect())},{rootMargin:"200px"});return a.observe(o),()=>a.disconnect()},[r]),S.jsxs(Np,{open:t,onOpenChange:o=>{(!o||!vD())&&s(o)},openDelay:150,closeDelay:100,children:[S.jsx(Lp,{asChild:!0,children:S.jsx("a",{ref:i,className:"chat-paper-link chat-hf-link",href:n.url,target:"_blank",rel:"noopener noreferrer",onPointerEnter:r,onFocus:r,children:e})}),S.jsx(Dp,{className:"hf-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:S.jsx(bD,{repo:n})})]})},_D=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,SD=({repo:n,preview:e,unavailable:t})=>{const[s,i]=ee.useState(!1),r=!!(e!=null&&e.avatarUrl)&&!s;return S.jsxs("div",{className:"github-preview-card",children:[r?S.jsx("img",{className:"github-preview-image","data-testid":"github-preview-image",src:e==null?void 0:e.avatarUrl,alt:"",loading:"eager",decoding:"async",onError:()=>i(!0)}):S.jsx("div",{className:"github-preview-fallback","aria-hidden":"true",children:S.jsx(h0,{})}),S.jsxs("div",{className:"github-preview-meta",children:[S.jsx("span",{className:"github-preview-kind",children:"GitHub repository"}),S.jsx("strong",{children:n.repoId}),(e==null?void 0:e.description)&&S.jsx("span",{className:"github-preview-description",children:e.description}),e?S.jsxs("span",{className:"github-preview-stats",children:[e.language&&S.jsxs(S.Fragment,{children:[e.language," · "]}),"★ ",e.stars.toLocaleString()," · ⑂ ",e.forks.toLocaleString(),e.archived&&S.jsx(S.Fragment,{children:" · Archived"})]}):S.jsx("span",{children:t?"Preview unavailable":"Loading preview…"})]})]})},xD=({repo:n,children:e})=>{var c;const[t,s]=ee.useState(!1),[i,r]=ee.useState(!1),o=ee.useRef(null),a=ee.useCallback(()=>r(!0),[]),l=wo({queryKey:["github-repository-preview",n.repoId.toLowerCase()],queryFn:({signal:h})=>UL(n,h),enabled:t||i,staleTime:30*60*1e3,gcTime:60*60*1e3,retry:!1});return ee.useEffect(()=>{const h=o.current;if(!h||typeof IntersectionObserver>"u")return;const u=new IntersectionObserver(([d])=>{d.isIntersecting&&(a(),u.disconnect())},{rootMargin:"200px"});return u.observe(h),()=>u.disconnect()},[a]),ee.useEffect(()=>{var h;(h=l.data)!=null&&h.avatarUrl&&o$(l.data.avatarUrl)},[(c=l.data)==null?void 0:c.avatarUrl]),S.jsxs(Np,{open:t,onOpenChange:h=>{(!h||!_D())&&s(h)},openDelay:150,closeDelay:100,children:[S.jsx(Lp,{asChild:!0,children:S.jsxs("a",{ref:o,className:"chat-github-link",href:n.url,target:"_blank",rel:"noopener noreferrer",onPointerEnter:a,onFocus:a,children:[S.jsx(h0,{"aria-hidden":"true"}),e]})}),S.jsx(Dp,{className:"github-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:S.jsx(SD,{repo:n,preview:l.data,unavailable:l.isError})})]})},AD=/^p\d+b\d+$/;function tse(n,e){const t=n.blocks[e];return t?t.label!=="Section-Header"?[{page:t.page,bbox:t.bbox}]:Object.entries(n.blocks).filter(([s,i])=>s===e||i.section===e).map(([,s])=>({page:s.page,bbox:s.bbox})):[]}function kD(n){const e=[...n.matchAll(/\]\(pdf:(p\d+b\d+)\)/g)].map(t=>t[1]);return[...new Set(e)]}const ED=320,wA=12,CD=170;function $D(n,e){const t=Math.min(ED,e*.7),s=e-wA-t-n.left,i=wA-n.left;return{left:Math.max(i,Math.min(0,s)),below:n.topq.useContext(PD);function l$(n){return n.length>220?`${n.slice(0,220).trimEnd()}…`:n}function RD({anchor:n,children:e}){var l;const t=a$(),[s,i]=q.useState({left:0,below:!1}),r=(l=t==null?void 0:t.layout)==null?void 0:l.blocks[n];if(!t||!r)return S.jsx("span",{className:"chat-invalid-citation",children:e});const o=r.label==="Section-Header",a=c=>i($D(c.getBoundingClientRect(),window.innerWidth));return S.jsxs("button",{type:"button",className:"chat-pdf-citation",onClick:()=>t.open(n),onMouseEnter:c=>a(c.currentTarget),onFocus:c=>a(c.currentTarget),"aria-label":`${o?"Jump to section":"Jump to passage"} on page ${r.page}`,children:[S.jsx(t$,{"aria-hidden":"true"}),S.jsx("span",{children:q.Children.map(e,(c,h)=>h===0&&typeof c=="string"?TD(c):c)}),S.jsxs("span",{className:`chat-pdf-citation-preview${s.below?" is-below":""}`,role:"tooltip",style:{left:s.left},children:[S.jsxs("strong",{children:["Page ",r.page,o?" · section":""]}),r.text&&S.jsx("span",{children:l$(r.text)})]})]})}function MD({text:n}){const e=a$(),t=e==null?void 0:e.layout;if(!e||!t)return null;const s=kD(n).filter(i=>t.blocks[i]);return s.length?S.jsxs("details",{className:"chat-pdf-sources",children:[S.jsxs("summary",{children:["Sources (",s.length,")"]}),S.jsx("ol",{children:s.map(i=>{const r=t.blocks[i];return S.jsx("li",{children:S.jsxs("button",{type:"button",onClick:()=>e.open(i),children:[S.jsxs("span",{className:"chat-pdf-sources-page",children:["p. ",r.page]}),S.jsx("span",{children:l$(r.text)||r.label})]})},i)})})]}):null}const ID=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches;function OD(n){try{return new URL(n).hostname.replace(/^www\./,"")}catch{return"Web source"}}const ND=({citation:n})=>{const[e,t]=ee.useState(!1),[s,i]=ee.useState(!1),r=n.thumbnail_url,o=n.favicon_url;return S.jsxs("div",{className:"web-preview-card",children:[r&&!e&&S.jsx("img",{className:"web-preview-image","data-testid":"web-preview-image",src:r,alt:"",loading:"eager",decoding:"async",referrerPolicy:"no-referrer",onError:()=>t(!0)}),S.jsxs("div",{className:"web-preview-meta",children:[S.jsxs("div",{className:"web-preview-source",children:[o&&!s&&S.jsx("img",{src:o,alt:"",loading:"eager",decoding:"async",referrerPolicy:"no-referrer",onError:()=>i(!0)}),S.jsx("span",{children:OD(n.url??"")}),n.published&&S.jsxs(S.Fragment,{children:[S.jsx("span",{"aria-hidden":"true",children:"·"}),S.jsx("time",{children:n.published.slice(0,10)})]})]}),S.jsx("strong",{children:n.title}),n.excerpt&&S.jsx("p",{children:n.excerpt.replace(/\s+/g," ").trim()})]})]})},LD=({citation:n,children:e})=>{const[t,s]=ee.useState(!1),i=n.url??"";return S.jsxs(Np,{open:t,onOpenChange:r=>{(!r||!ID())&&s(r)},openDelay:150,closeDelay:100,children:[S.jsx(Lp,{asChild:!0,children:S.jsx("a",{href:i,className:"chat-web-citation",target:"_blank",rel:"noopener noreferrer",children:e})}),S.jsx(Dp,{className:"web-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:S.jsx(ND,{citation:n})})]})},DD=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,jD=n=>n==="semantic_scholar"?"Semantic Scholar":"External paper",FD=({citation:n})=>{var e,t;return S.jsxs("div",{className:"external-paper-preview-card",children:[S.jsxs("div",{className:"external-paper-preview-source",children:[S.jsx("span",{children:jD(n.provider)}),n.published&&S.jsxs(S.Fragment,{children:[S.jsx("span",{"aria-hidden":"true",children:"·"}),S.jsx("time",{children:n.published.slice(0,10)})]})]}),S.jsx("strong",{children:n.title}),(((e=n.authors)==null?void 0:e.length)??0)>0&&S.jsx("p",{className:"external-paper-preview-authors",children:(t=n.authors)==null?void 0:t.join(", ")}),n.excerpt&&S.jsx("p",{children:n.excerpt.replace(/\s+/g," ").trim()}),n.citation_count!==null&&n.citation_count!==void 0&&S.jsxs("span",{className:"external-paper-preview-citations",children:[n.citation_count.toLocaleString()," citations"]})]})},zD=({citation:n,children:e})=>{const[t,s]=ee.useState(!1);return S.jsxs(Np,{open:t,onOpenChange:i=>{(!i||!DD())&&s(i)},openDelay:150,closeDelay:100,children:[S.jsx(Lp,{asChild:!0,children:S.jsx("a",{href:n.url??"",className:"chat-external-paper-citation",target:"_blank",rel:"noopener noreferrer",children:e})}),S.jsx(Dp,{className:"external-paper-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:S.jsx(FD,{citation:n})})]})};function HD(n){const e=[];let t=0,s=null;for(const i of n.match(/.*(?:\n|$)/g)??[]){if(!i)continue;const r=i.endsWith(` `)?i.slice(0,-1):i;if(s){const l=r.match(/^ {0,3}(`+|~+)[ \t]*$/);l&&l[1][0]===s.marker&&l[1].length>=s.length&&(e.push({start:s.start,end:t+i.length}),s=null),t+=i.length;continue}const o=r.match(/^ {0,3}(`{3,}|~{3,})/);if(o){s={marker:o[1][0],length:o[1].length,start:t},t+=i.length;continue}let a=0;for(;ae>=t.start&&e=0&&n[s]==="\\";s-=1)t+=1;return t%2===0}function xA(n,e,t,s){const i=[];let r=0;for(;rs.name),published:e.metadata.published,conference:e.metadata.conference,citationCount:e.metadata.citation_count,tasks:e.metadata.tasks};if(t)return{routeId:n,title:t.title,arxivId:t.arxiv_id??null,source:t.arxiv_id?"arxiv":"external",sourceUrl:t.source_url,thumbnailUrl:t.thumbnail_url??null,authors:t.authors??[],published:t.published??null,conference:t.conference??null,citationCount:t.citation_count??null,tasks:[]}}const c$=({routeId:n,paper:e,citation:t,className:s="chat-paper-link",children:i})=>S.jsx(u0,{routeId:n,initialData:UD(n,e,t),className:s,target:"_blank",children:i});function qD(n){const e=n.lastIndexOf("[");if(e===-1)return n;const t=n.slice(e);return/^\[[^\]]*(\]\(?[^)\s]*)?$/.test(t)?n.slice(0,e):n}const VD=n=>n.startsWith("paper:")||n.startsWith("pdf:")||e$(n)?n:JL(n);function WD(n){try{const e=new URL(n);return e.protocol==="https:"&&(e.hostname==="github.com"||e.hostname==="www.github.com")}catch{return!1}}const sb=({text:n,streaming:e,papers:t,citations:s,webCitations:i})=>{const r=BD(e?qD(n):n);return S.jsxs(S.Fragment,{children:[S.jsx(YL,{remarkPlugins:[QL,ZL],rehypePlugins:[KL],urlTransform:VD,components:{a:({href:o,children:a})=>{if(o!=null&&o.startsWith("paper:")){const h=o.slice(6);return!t[h]&&!(s!=null&&s[h])?S.jsx("span",{className:"chat-invalid-citation",children:a}):S.jsx(c$,{routeId:h,paper:t[h],citation:s==null?void 0:s[h],children:a})}if(o!=null&&o.startsWith("pdf:")){const h=o.slice(4);return AD.test(h)?S.jsx(RD,{anchor:h,children:a}):S.jsx("span",{className:"chat-invalid-citation",children:a})}if(o&&e$(o)){const h=qL(o);return h?S.jsx(VL,{entity:h,children:a}):S.jsx("span",{className:"chat-invalid-citation",children:a})}const l=o?yD(o):null;if(l)return S.jsx(wD,{repo:l,children:a});const c=o?WL(o):null;return c?S.jsx(xD,{repo:c,children:a}):o&&WD(o)?S.jsxs("a",{href:o,className:"chat-github-link",target:"_blank",rel:"noopener noreferrer",children:[S.jsx(h0,{"aria-hidden":"true"}),a]}):o!=null&&o.startsWith("https://")&&(i!=null&&i[o])?i[o].source_type==="paper"?S.jsx(zD,{citation:i[o],children:a}):S.jsx(LD,{citation:i[o],children:a}):o!=null&&o.startsWith("https://")?S.jsx("a",{href:o,className:"chat-external-link",target:"_blank",rel:"noopener noreferrer",children:a}):S.jsx("span",{children:a})}},children:r}),!e&&S.jsx(MD,{text:r})]})},GD=Object.freeze({status:"aborted"});function Q(n,e,t){function s(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(n),e(a,l);for(const h in o.prototype)h in a||Object.defineProperty(a,h,{value:o.prototype[h].bind(a)});a._zod.constr=o,a._zod.def=l}const i=(t==null?void 0:t.Parent)??Object;class r extends i{}Object.defineProperty(r,"name",{value:n});function o(a){var l;const c=t!=null&&t.Parent?new r:this;s(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const h of c._zod.deferred)h();return c}return Object.defineProperty(o,"init",{value:s}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var l,c;return t!=null&&t.Parent&&a instanceof t.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(n)}}),Object.defineProperty(o,"name",{value:n}),o}class nf extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const h$={};function $a(n){return h$}function KD(n){const e=Object.values(n).filter(s=>typeof s=="number");return Object.entries(n).filter(([s,i])=>e.indexOf(+s)===-1).map(([s,i])=>i)}function ZD(n,e){return typeof e=="bigint"?e.toString():e}function sS(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function iS(n){return n==null}function rS(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function XD(n,e){const t=(n.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,i=t>s?t:s,r=Number.parseInt(n.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return r%o/10**i}function Pt(n,e,t){Object.defineProperty(n,e,{get(){{const s=t();return n[e]=s,s}},set(s){Object.defineProperty(n,e,{value:s})},configurable:!0})}function f0(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Yu(n){return JSON.stringify(n)}const u$=Error.captureStackTrace?Error.captureStackTrace:(...n)=>{};function Qg(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const YD=sS(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ey(n){if(Qg(n)===!1)return!1;const e=n.constructor;if(e===void 0)return!0;const t=e.prototype;return!(Qg(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}const JD=new Set(["string","number","symbol"]);function jp(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cc(n,e,t){const s=new n._zod.constr(e??n._zod.def);return(!e||t!=null&&t.parent)&&(s._zod.parent=n),s}function ve(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function QD(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const e2={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function t2(n,e){const t={},s=n._zod.def;for(const i in e){if(!(i in s.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&(t[i]=s.shape[i])}return Cc(n,{...n._zod.def,shape:t,checks:[]})}function n2(n,e){const t={...n._zod.def.shape},s=n._zod.def;for(const i in e){if(!(i in s.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&delete t[i]}return Cc(n,{...n._zod.def,shape:t,checks:[]})}function s2(n,e){if(!ey(e))throw new Error("Invalid input to extend: expected a plain object");const t={...n._zod.def,get shape(){const s={...n._zod.def.shape,...e};return f0(this,"shape",s),s},checks:[]};return Cc(n,t)}function i2(n,e){return Cc(n,{...n._zod.def,get shape(){const t={...n._zod.def.shape,...e._zod.def.shape};return f0(this,"shape",t),t},catchall:e._zod.def.catchall,checks:[]})}function r2(n,e,t){const s=e._zod.def.shape,i={...s};if(t)for(const r in t){if(!(r in s))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(i[r]=n?new n({type:"optional",innerType:s[r]}):s[r])}else for(const r in s)i[r]=n?new n({type:"optional",innerType:s[r]}):s[r];return Cc(e,{...e._zod.def,shape:i,checks:[]})}function o2(n,e,t){const s=e._zod.def.shape,i={...s};if(t)for(const r in t){if(!(r in i))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(i[r]=new n({type:"nonoptional",innerType:s[r]}))}else for(const r in s)i[r]=new n({type:"nonoptional",innerType:s[r]});return Cc(e,{...e._zod.def,shape:i,checks:[]})}function Ld(n,e=0){var t;for(let s=e;s{var s;return(s=t).path??(s.path=[]),t.path.unshift(n),t})}function vm(n){return typeof n=="string"?n:n==null?void 0:n.message}function Ta(n,e,t){var i,r,o,a,l,c;const s={...n,path:n.path??[]};if(!n.message){const h=vm((o=(r=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:r.error)==null?void 0:o.call(r,n))??vm((a=e==null?void 0:e.error)==null?void 0:a.call(e,n))??vm((l=t.customError)==null?void 0:l.call(t,n))??vm((c=t.localeError)==null?void 0:c.call(t,n))??"Invalid input";s.message=h}return delete s.inst,delete s.continue,e!=null&&e.reportInput||delete s.input,s}function oS(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function sf(...n){const[e,t,s]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:s}:{...e}}const d$=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),Object.defineProperty(n,"message",{get(){return JSON.stringify(e,ZD,2)},enumerable:!0}),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},f$=Q("$ZodError",d$),p$=Q("$ZodError",d$,{Parent:Error});function a2(n,e=t=>t.message){const t={},s=[];for(const i of n.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):s.push(e(i));return{formErrors:s,fieldErrors:t}}function l2(n,e){const t=e||function(r){return r.message},s={_errors:[]},i=r=>{for(const o of r.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>i({issues:a}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)s._errors.push(t(o));else{let a=s,l=0;for(;l(e,t,s,i)=>{const r=s?Object.assign(s,{async:!1}):{async:!1},o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)throw new nf;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(l=>Ta(l,r,$a())));throw u$(a,i==null?void 0:i.callee),a}return o.value},h2=n=>async(e,t,s,i)=>{const r=s?Object.assign(s,{async:!0}):{async:!0};let o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(l=>Ta(l,r,$a())));throw u$(a,i==null?void 0:i.callee),a}return o.value},m$=n=>(e,t,s)=>{const i=s?{...s,async:!1}:{async:!1},r=e._zod.run({value:t,issues:[]},i);if(r instanceof Promise)throw new nf;return r.issues.length?{success:!1,error:new(n??f$)(r.issues.map(o=>Ta(o,i,$a())))}:{success:!0,data:r.value}},g$=m$(p$),y$=n=>async(e,t,s)=>{const i=s?Object.assign(s,{async:!0}):{async:!0};let r=e._zod.run({value:t,issues:[]},i);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new n(r.issues.map(o=>Ta(o,i,$a())))}:{success:!0,data:r.value}},u2=y$(p$),d2=/^[cC][^\s-]{8,}$/,f2=/^[0-9a-z]+$/,p2=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,m2=/^[0-9a-vA-V]{20}$/,g2=/^[A-Za-z0-9]{27}$/,y2=/^[a-zA-Z0-9_-]{21}$/,v2=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,b2=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,AA=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,w2=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function S2(){return new RegExp(_2,"u")}const x2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,A2=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,k2=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,E2=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,C2=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,v$=/^[A-Za-z0-9_-]*$/,$2=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,T2=/^\+(?:[0-9]){6,14}[0-9]$/,b$="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",P2=new RegExp(`^${b$}$`);function w$(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function R2(n){return new RegExp(`^${w$(n)}$`)}function M2(n){const e=w$({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-]\\d{2}:\\d{2})");const s=`${e}(?:${t.join("|")})`;return new RegExp(`^${b$}T(?:${s})$`)}const I2=n=>{const e=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},O2=/^\d+$/,N2=/^-?\d+(?:\.\d+)?/i,L2=/true|false/i,D2=/null/i,j2=/undefined/i,F2=/^[^A-Z]*$/,z2=/^[^a-z]*$/,Bs=Q("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),_$={number:"number",bigint:"bigint",object:"date"},S$=Q("$ZodCheckLessThan",(n,e)=>{Bs.init(n,e);const t=_$[typeof e.value];n._zod.onattach.push(s=>{const i=s._zod.bag,r=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?s.value<=e.value:s.value{Bs.init(n,e);const t=_$[typeof e.value];n._zod.onattach.push(s=>{const i=s._zod.bag,r=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>r&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),n._zod.check=s=>{(e.inclusive?s.value>=e.value:s.value>e.value)||s.issues.push({origin:t,code:"too_small",minimum:e.value,input:s.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),H2=Q("$ZodCheckMultipleOf",(n,e)=>{Bs.init(n,e),n._zod.onattach.push(t=>{var s;(s=t._zod.bag).multipleOf??(s.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):XD(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),B2=Q("$ZodCheckNumberFormat",(n,e)=>{var o;Bs.init(n,e),e.format=e.format||"float64";const t=(o=e.format)==null?void 0:o.includes("int"),s=t?"int":"number",[i,r]=e2[e.format];n._zod.onattach.push(a=>{const l=a._zod.bag;l.format=e.format,l.minimum=i,l.maximum=r,t&&(l.pattern=O2)}),n._zod.check=a=>{const l=a.value;if(t){if(!Number.isInteger(l)){a.issues.push({expected:s,format:e.format,code:"invalid_type",input:l,inst:n});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:s,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:s,continue:!e.abort});return}}lr&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:r,inst:n})}}),U2=Q("$ZodCheckMaxLength",(n,e)=>{var t;Bs.init(n,e),(t=n._zod.def).when??(t.when=s=>{const i=s.value;return!iS(i)&&i.length!==void 0}),n._zod.onattach.push(s=>{const i=s._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{const i=s.value;if(i.length<=e.maximum)return;const o=oS(i);s.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),q2=Q("$ZodCheckMinLength",(n,e)=>{var t;Bs.init(n,e),(t=n._zod.def).when??(t.when=s=>{const i=s.value;return!iS(i)&&i.length!==void 0}),n._zod.onattach.push(s=>{const i=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(s._zod.bag.minimum=e.minimum)}),n._zod.check=s=>{const i=s.value;if(i.length>=e.minimum)return;const o=oS(i);s.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),V2=Q("$ZodCheckLengthEquals",(n,e)=>{var t;Bs.init(n,e),(t=n._zod.def).when??(t.when=s=>{const i=s.value;return!iS(i)&&i.length!==void 0}),n._zod.onattach.push(s=>{const i=s._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),n._zod.check=s=>{const i=s.value,r=i.length;if(r===e.length)return;const o=oS(i),a=r>e.length;s.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:s.value,inst:n,continue:!e.abort})}}),p0=Q("$ZodCheckStringFormat",(n,e)=>{var t,s;Bs.init(n,e),n._zod.onattach.push(i=>{const r=i._zod.bag;r.format=e.format,e.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(s=n._zod).check??(s.check=()=>{})}),W2=Q("$ZodCheckRegex",(n,e)=>{p0.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),G2=Q("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=F2),p0.init(n,e)}),K2=Q("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=z2),p0.init(n,e)}),Z2=Q("$ZodCheckIncludes",(n,e)=>{Bs.init(n,e);const t=jp(e.includes),s=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=s,n._zod.onattach.push(i=>{const r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(s)}),n._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:n,continue:!e.abort})}}),X2=Q("$ZodCheckStartsWith",(n,e)=>{Bs.init(n,e);const t=new RegExp(`^${jp(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=s=>{s.value.startsWith(e.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:s.value,inst:n,continue:!e.abort})}}),Y2=Q("$ZodCheckEndsWith",(n,e)=>{Bs.init(n,e);const t=new RegExp(`.*${jp(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=s=>{s.value.endsWith(e.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:s.value,inst:n,continue:!e.abort})}}),J2=Q("$ZodCheckOverwrite",(n,e)=>{Bs.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class Q2{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const s=e.split(` `).filter(o=>o),i=Math.min(...s.map(o=>o.length-o.trimStart().length)),r=s.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of r)this.content.push(o)}compile(){const e=Function,t=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(r=>` ${r}`)];return new e(...t,i.join(` `))}}const ej={major:4,minor:0,patch:0},At=Q("$ZodType",(n,e)=>{var i;var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=ej;const s=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&s.unshift(n);for(const r of s)for(const o of r._zod.onattach)o(n);if(s.length===0)(t=n._zod).deferred??(t.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const r=(o,a,l)=>{let c=Ld(o),h;for(const u of a){if(u._zod.def.when){if(!u._zod.def.when(o))continue}else if(c)continue;const d=o.issues.length,p=u._zod.check(o);if(p instanceof Promise&&(l==null?void 0:l.async)===!1)throw new nf;if(h||p instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await p,o.issues.length!==d&&(c||(c=Ld(o,d)))});else{if(o.issues.length===d)continue;c||(c=Ld(o,d))}}return h?h.then(()=>o):o};n._zod.run=(o,a)=>{const l=n._zod.parse(o,a);if(l instanceof Promise){if(a.async===!1)throw new nf;return l.then(c=>r(c,s,a))}return r(l,s,a)}}n["~standard"]={validate:r=>{var o;try{const a=g$(n,r);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return u2(n,r).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),aS=Q("$ZodString",(n,e)=>{var t;At.init(n,e),n._zod.pattern=[...((t=n==null?void 0:n._zod.bag)==null?void 0:t.patterns)??[]].pop()??I2(n._zod.bag),n._zod.parse=(s,i)=>{if(e.coerce)try{s.value=String(s.value)}catch{}return typeof s.value=="string"||s.issues.push({expected:"string",code:"invalid_type",input:s.value,inst:n}),s}}),Nt=Q("$ZodStringFormat",(n,e)=>{p0.init(n,e),aS.init(n,e)}),tj=Q("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=b2),Nt.init(n,e)}),nj=Q("$ZodUUID",(n,e)=>{if(e.version){const s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(s===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=AA(s))}else e.pattern??(e.pattern=AA());Nt.init(n,e)}),sj=Q("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=w2),Nt.init(n,e)}),ij=Q("$ZodURL",(n,e)=>{Nt.init(n,e),n._zod.check=t=>{try{const s=t.value,i=new URL(s),r=i.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:$2.source,input:t.value,inst:n,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:n,continue:!e.abort})),!s.endsWith("/")&&r.endsWith("/")?t.value=r.slice(0,-1):t.value=r;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:n,continue:!e.abort})}}}),rj=Q("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=S2()),Nt.init(n,e)}),oj=Q("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=y2),Nt.init(n,e)}),aj=Q("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=d2),Nt.init(n,e)}),lj=Q("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=f2),Nt.init(n,e)}),cj=Q("$ZodULID",(n,e)=>{e.pattern??(e.pattern=p2),Nt.init(n,e)}),hj=Q("$ZodXID",(n,e)=>{e.pattern??(e.pattern=m2),Nt.init(n,e)}),uj=Q("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=g2),Nt.init(n,e)}),dj=Q("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=M2(e)),Nt.init(n,e)}),fj=Q("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=P2),Nt.init(n,e)}),pj=Q("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=R2(e)),Nt.init(n,e)}),mj=Q("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=v2),Nt.init(n,e)}),gj=Q("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=x2),Nt.init(n,e),n._zod.onattach.push(t=>{const s=t._zod.bag;s.format="ipv4"})}),yj=Q("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=A2),Nt.init(n,e),n._zod.onattach.push(t=>{const s=t._zod.bag;s.format="ipv6"}),n._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:n,continue:!e.abort})}}}),vj=Q("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=k2),Nt.init(n,e)}),bj=Q("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=E2),Nt.init(n,e),n._zod.check=t=>{const[s,i]=t.value.split("/");try{if(!i)throw new Error;const r=Number(i);if(`${r}`!==i)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${s}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:n,continue:!e.abort})}}});function A$(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const wj=Q("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=C2),Nt.init(n,e),n._zod.onattach.push(t=>{t._zod.bag.contentEncoding="base64"}),n._zod.check=t=>{A$(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function _j(n){if(!v$.test(n))return!1;const e=n.replace(/[-_]/g,s=>s==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return A$(t)}const Sj=Q("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=v$),Nt.init(n,e),n._zod.onattach.push(t=>{t._zod.bag.contentEncoding="base64url"}),n._zod.check=t=>{_j(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),xj=Q("$ZodE164",(n,e)=>{e.pattern??(e.pattern=T2),Nt.init(n,e)});function Aj(n,e=null){try{const t=n.split(".");if(t.length!==3)return!1;const[s]=t;if(!s)return!1;const i=JSON.parse(atob(s));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const kj=Q("$ZodJWT",(n,e)=>{Nt.init(n,e),n._zod.check=t=>{Aj(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),k$=Q("$ZodNumber",(n,e)=>{At.init(n,e),n._zod.pattern=n._zod.bag.pattern??N2,n._zod.parse=(t,s)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}const i=t.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return t;const r=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...r?{received:r}:{}}),t}}),Ej=Q("$ZodNumber",(n,e)=>{B2.init(n,e),k$.init(n,e)}),Cj=Q("$ZodBoolean",(n,e)=>{At.init(n,e),n._zod.pattern=L2,n._zod.parse=(t,s)=>{if(e.coerce)try{t.value=!!t.value}catch{}const i=t.value;return typeof i=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),t}}),$j=Q("$ZodUndefined",(n,e)=>{At.init(n,e),n._zod.pattern=j2,n._zod.values=new Set([void 0]),n._zod.optin="optional",n._zod.optout="optional",n._zod.parse=(t,s)=>{const i=t.value;return typeof i>"u"||t.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:n}),t}}),Tj=Q("$ZodNull",(n,e)=>{At.init(n,e),n._zod.pattern=D2,n._zod.values=new Set([null]),n._zod.parse=(t,s)=>{const i=t.value;return i===null||t.issues.push({expected:"null",code:"invalid_type",input:i,inst:n}),t}}),Pj=Q("$ZodAny",(n,e)=>{At.init(n,e),n._zod.parse=t=>t}),Rj=Q("$ZodUnknown",(n,e)=>{At.init(n,e),n._zod.parse=t=>t}),Mj=Q("$ZodNever",(n,e)=>{At.init(n,e),n._zod.parse=(t,s)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function kA(n,e,t){n.issues.length&&e.issues.push(...cl(t,n.issues)),e.value[t]=n.value}const Ij=Q("$ZodArray",(n,e)=>{At.init(n,e),n._zod.parse=(t,s)=>{const i=t.value;if(!Array.isArray(i))return t.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),t;t.value=Array(i.length);const r=[];for(let o=0;okA(c,t,o))):kA(l,t,o)}return r.length?Promise.all(r).then(()=>t):t}});function bm(n,e,t){n.issues.length&&e.issues.push(...cl(t,n.issues)),e.value[t]=n.value}function EA(n,e,t,s){n.issues.length?s[t]===void 0?t in s?e.value[t]=void 0:e.value[t]=n.value:e.issues.push(...cl(t,n.issues)):n.value===void 0?t in s&&(e.value[t]=void 0):e.value[t]=n.value}const Oj=Q("$ZodObject",(n,e)=>{At.init(n,e);const t=sS(()=>{const u=Object.keys(e.shape);for(const p of u)if(!(e.shape[p]instanceof At))throw new Error(`Invalid element at key "${p}": expected a Zod schema`);const d=QD(e.shape);return{shape:e.shape,keys:u,keySet:new Set(u),numKeys:u.length,optionalKeys:new Set(d)}});Pt(n._zod,"propValues",()=>{const u=e.shape,d={};for(const p in u){const m=u[p]._zod;if(m.values){d[p]??(d[p]=new Set);for(const y of m.values)d[p].add(y)}}return d});const s=u=>{const d=new Q2(["shape","payload","ctx"]),p=t.value,m=_=>{const b=Yu(_);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};d.write("const input = payload.value;");const y=Object.create(null);let v=0;for(const _ of p.keys)y[_]=`key_${v++}`;d.write("const newResult = {}");for(const _ of p.keys)if(p.optionalKeys.has(_)){const b=y[_];d.write(`const ${b} = ${m(_)};`);const x=Yu(_);d.write(` @@ -158,6 +158,6 @@ ${T}`,u++;break;case"id":T.includes("\0")||(c=T);break;case"retry":/^\d+$/.test( `))};if((de.mac||de.android)&&u.from==o-1&&/^\. ?$/.test(s.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(u={from:a,to:l,insert:lt.of([s.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let d=this.to-this.from+(u.to-u.from+u.insert.length);Gx(e,u,te.single(this.toEditorPos(s.selectionStart,d),this.toEditorPos(s.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,s.updateRangeStart-1),Math.min(t.text.length,s.updateRangeStart+1)))&&this.handlers.compositionend(s)},this.handlers.characterboundsupdate=s=>{let i=[],r=null;for(let o=this.toEditorPos(s.rangeStart),a=this.toEditorPos(s.rangeEnd);o{let i=[];for(let r of s.getTextFormats()){let o=r.underlineStyle,a=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(r.rangeStart),c=this.toEditorPos(r.rangeEnd);if(l{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:s}=this.composing;this.composing=null,s&&this.reset(e.state)}};for(let s in this.handlers)t.addEventListener(s,this.handlers[s]);this.measureReq={read:s=>{let i=mf(s.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,s=!1,i=this.pendingContextChange;return e.changes.iterChanges((r,o,a,l,c)=>{if(s)return;let h=c.length-(o-r);if(i&&o>=i.to)if(i.from==r&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,t+=h,this.to+=h;return}else i=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=h,this.to+=h;else if(rthis.to||this.to-this.from+c.length>3e4){s=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),c.toString()),this.to+=h}t+=h}),i&&!s&&this.revertPending(e.state),!s}update(e){let t=this.pendingContextChange,s=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(s.from,s.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,s=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=s||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(s,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let s=this.composing;return s&&s.drifted?s.editorBase+(e-s.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class xe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:s}=e;this.dispatchTransactions=e.dispatchTransactions||s&&(i=>i.forEach(r=>s(r,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||b7(e.parent)||document,this.viewState=new sC(this,e.state||at.create(e)),e.scrollTo&&e.scrollTo.is(Bm)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(sh).map(i=>new jv(i));for(let i of this.plugins)i.update(this);this.observer=new UJ(this),this.inputState=new uJ(this),this.inputState.ensureHandlers(this.plugins),this.docView=new qE(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof yn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,s=!1,i,r=this.state;for(let d of e){if(d.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=d.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(GO))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=KO(r,o),l||(a=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(h=null)):this.observer.clear(),r.facet(at.phrases)!=this.state.facet(at.phrases))return this.setState(r);i=Ty.create(this,r,e),i.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(u&&(u=u.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection,{x:m,y}=this.state.facet(xe.cursorScrollMargin);u=new yh(p.empty?p:te.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",y,m)}for(let p of d.effects)p.is(Bm)&&(u=p.value.clip(this.state))}this.viewState.update(i,u),this.bidiCache=Oy.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(Md)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Km)!=i.state.facet(Km)&&(this.viewState.mustMeasureContent=!0),(t||s||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let d of this.state.facet(I_))try{d(i)}catch(p){Mr(this.state,p,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!zO(this,h)&&c.force&&gh(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let s of this.plugins)s.destroy(this);this.viewState=new sC(this,e),this.plugins=e.facet(sh).map(s=>new jv(s)),this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy(),this.docView=new qE(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(sh),s=e.state.facet(sh);if(t!=s){let i=[];for(let r of s){let o=t.indexOf(r);if(o<0)i.push(new jv(r));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,s=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(fO(s||this.win))r=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);r=p.from,o=p.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(p=>{try{return p.read(this)}catch(m){return Mr(this.state,m),lC}}),u=Ty.create(this,this.state,[]),d=!1;u.flags|=l,t?t.flags|=l:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let p=0;p1||m<-1)&&!(de.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(s==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+m,s?r<0?s.scrollTop=s.scrollHeight:s.scrollTop+=m:this.win.scrollBy(0,m),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(I_))a(t)}get themeClasses(){return F_+" "+(this.state.facet(j_)?JO:YO)+" "+this.state.facet(Km)}updateAttrs(){let e=cC(this,RO,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(bo)?"true":"false",class:"cm-content",style:`${de.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),cC(this,Vx,t);let s=this.observer.ignore(()=>{let i=jE(this.contentDOM,this.contentAttrs,t),r=jE(this.dom,this.editorAttrs,e);return i||r});return this.editorAttrs=e,this.contentAttrs=t,s}showAnnouncements(e){let t=!0;for(let s of e)for(let i of s.effects)if(i.is(xe.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Md);let e=this.state.facet(xe.cspNonce);ku.mount(this.root,this.styleModules.concat(HJ).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ts.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,s){return Bv(this,e,VE(this,e,t,s))}moveByGroup(e,t){return Bv(this,e,VE(this,e,t,s=>tJ(this,e.head,s)))}visualLineSide(e,t){let s=this.bidiSpans(e),i=this.textDirectionAt(e.from),r=s[t?s.length-1:0];return te.cursor(r.side(t,i)+e.from,r.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,s=!0){return eJ(this,e,t,s)}moveVertically(e,t,s){return Bv(this,e,nJ(this,e,t,s))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let s=L_(this,e,t);return s&&s.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),L_(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),r=i[Rr.find(i,e-s.from,-1,t)];return this.docView.coordsAt(e,t,r.dir==It.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(CO)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>WJ)return bO(e.length);let t=this.textDirectionAt(e.from),s;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||vO(r.isolates,s=HE(this,e))))return r.order;s||(s=HE(this,e));let i=C7(e.text,t,s);return this.bidiCache.push(new Oy(e.from,e.to,t,s,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||de.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{dO(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var s,i,r,o;return Bm.of(new yh(typeof e=="number"?te.cursor(e):e,(s=t.y)!==null&&s!==void 0?s:"nearest",(i=t.x)!==null&&i!==void 0?i:"nearest",(r=t.yMargin)!==null&&r!==void 0?r:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,s=this.viewState.scrollAnchorAt(e);return Bm.of(new yh(te.cursor(s.from),"start","start",s.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return ri.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ri.define(()=>({}),{eventObservers:e})}static theme(e,t){let s=ku.newName(),i=[Km.of(s),Md.of(z_(`.${s}`,e))];return t&&t.dark&&i.push(j_.of(!0)),i}static baseTheme(e){return q0.lowest(Md.of(z_("."+F_,e,QO)))}static findFromDOM(e){var t;let s=e.querySelector(".cm-content"),i=s&&Gt.get(s)||Gt.get(e);return((t=i==null?void 0:i.root)===null||t===void 0?void 0:t.view)||null}}xe.styleModule=Md;xe.inputHandler=kO;xe.clipboardInputFilter=Ux;xe.clipboardOutputFilter=qx;xe.scrollHandler=TO;xe.focusChangeEffect=EO;xe.perLineTextDirection=CO;xe.exceptionSink=AO;xe.updateListener=I_;xe.editable=bo;xe.mouseSelectionStyle=xO;xe.dragMovesSelection=SO;xe.clickAddsSelectionRange=_O;xe.decorations=K0;xe.blockWrappers=MO;xe.outerDecorations=Wx;xe.atomicRanges=am;xe.bidiIsolatedRanges=IO;xe.cursorScrollMargin=be.define({combine:n=>{let e=5,t=5;for(let s of n)typeof s=="number"?e=t=s:{x:e,y:t}=s;return{x:e,y:t}}});xe.scrollMargins=OO;xe.darkTheme=j_;xe.cspNonce=be.define({combine:n=>n.length?n[0]:""});xe.contentAttributes=Vx;xe.editorAttributes=RO;xe.lineWrapping=xe.contentAttributes.of({class:"cm-lineWrapping"});xe.announce=St.define();const WJ=4096,lC={};class Oy{constructor(e,t,s,i,r,o){this.from=e,this.to=t,this.dir=s,this.isolates=i,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let s=[],i=e.length?e[e.length-1].dir:It.LTR;for(let r=Math.max(0,e.length-10);r=0;i--){let r=s[i],o=typeof r=="function"?r(n):r;o&&zx(o,t)}return t}const GJ=de.mac?"mac":de.windows?"win":de.linux?"linux":"key";function KJ(n,e){const t=n.split(/-(?!$)/);let s=t[t.length-1];s=="Space"&&(s=" ");let i,r,o,a;for(let l=0;ls.concat(i),[]))),t}function XJ(n,e,t){return nN(tN(n.state),e,n,t)}let Vo=null;const YJ=4e3;function JJ(n,e=GJ){let t=Object.create(null),s=Object.create(null),i=(o,a)=>{let l=s[o];if(l==null)s[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,a,l,c,h)=>{var u,d;let p=t[o]||(t[o]=Object.create(null)),m=a.split(/ (?!$)/).map(g=>KJ(g,e));for(let g=1;g{let x=Vo={view:b,prefix:_,scope:o};return setTimeout(()=>{Vo==x&&(Vo=null)},YJ),!0}]})}let y=m.join(" ");i(y,!1);let v=p[y]||(p[y]={preventDefault:!1,stopPropagation:!1,run:((d=(u=p._any)===null||u===void 0?void 0:u.run)===null||d===void 0?void 0:d.slice())||[]});l&&v.run.push(l),c&&(v.preventDefault=!0),h&&(v.stopPropagation=!0)};for(let o of n){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let h=t[c]||(t[c]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:u}=o;for(let d in h)h[d].run.push(p=>u(p,H_))}let l=o[e]||o.key;if(l)for(let c of a)r(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}let H_=null;function nN(n,e,t,s){H_=e;let i=d7(e),r=qI(i,0),o=VI(r)==i.length&&i!=" ",a="",l=!1,c=!1,h=!1;Vo&&Vo.view==t&&Vo.scope==s&&(a=Vo.prefix+" ",UO.indexOf(e.keyCode)<0&&(c=!0,Vo=null));let u=new Set,d=v=>{if(v){for(let g of v.run)if(!u.has(g)&&(u.add(g),g(t)))return v.stopPropagation&&(h=!0),!0;v.preventDefault&&(v.stopPropagation&&(h=!0),c=!0)}return!1},p=n[s],m,y;return p&&(d(p[a+Zm(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(de.windows&&e.ctrlKey&&e.altKey)&&!(de.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=Ma[e.keyCode])&&m!=i?(d(p[a+Zm(m,e,!0)])||e.shiftKey&&(y=ff[e.keyCode])!=i&&y!=m&&d(p[a+Zm(y,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(p[a+Zm(i,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),c&&(l=!0),l&&h&&e.stopPropagation(),H_=null,l}class ac{constructor(e,t,s,i,r){this.className=e,this.left=t,this.top=s,this.width=i,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,s){if(s.empty){let i=e.coordsAtPos(s.head,s.assoc||1);if(!i)return[];let r=sN(e);return[new ac(t,i.left-r.left,i.top-r.top,null,i.bottom-i.top)]}else return QJ(e,t,s)}}function sN(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==It.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function uC(n,e,t,s){let i=n.coordsAtPos(e,t*2);if(!i)return s;let r=n.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=n.posAtCoords({x:r.left+1,y:o}),l=n.posAtCoords({x:r.right-1,y:o});return a==null||l==null?s:{from:Math.max(s.from,Math.min(a,l)),to:Math.min(s.to,Math.max(a,l))}}function QJ(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let s=Math.max(t.from,n.viewport.from),i=Math.min(t.to,n.viewport.to),r=n.textDirection==It.LTR,o=n.contentDOM,a=o.getBoundingClientRect(),l=sN(n),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),p=N_(n,s,1),m=N_(n,i,-1),y=p.type==Vn.Text?p:null,v=m.type==Vn.Text?m:null;if(y&&(n.lineWrapping||p.widgetLineBreaks)&&(y=uC(n,s,1,y)),v&&(n.lineWrapping||m.widgetLineBreaks)&&(v=uC(n,i,-1,v)),y&&v&&y.from==v.from&&y.to==v.to)return _(b(t.from,t.to,y));{let A=y?b(t.from,null,y):x(p,!1),T=v?b(null,t.to,v):x(m,!0),C=[];return(y||p).to<(v||m).from-(y&&v?1:0)||p.widgetLineBreaks>1&&A.bottom+n.defaultLineHeight/2U&&L.from=se)break;z>X&&j(Math.max(ge,X),A==null&&ge<=U,Math.min(z,se),T==null&&z>=B,Y.dir)}if(X=J.to+1,X>=se)break}return H.length==0&&j(U,A==null,B,T==null,n.textDirection),{top:I,bottom:D,horizontal:H}}function x(A,T){let C=a.top+(T?A.top:A.bottom);return{top:C,bottom:C,horizontal:[]}}}function eQ(n,e){return n.constructor==e.constructor&&n.eq(e)}class tQ{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Xg)!=e.state.facet(Xg)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,s=e.facet(Xg);for(;t!eQ(t,this.drawn[s]))){let t=this.dom.firstChild,s=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[s].constructor&&i.update(t,this.drawn[s])?(t=t.nextSibling,s++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e,de.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Xg=be.define();function iN(n){return[ri.define(e=>new tQ(e,n)),Xg.of(n)]}const Tu=be.define({combine(n){return Hu(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function nQ(n={}){return[Tu.of(n),sQ,iQ,oQ,$O.of(!0)]}function rN(n){return n.startState.facet(Tu)!=n.state.facet(Tu)}const sQ=iN({above:!0,markers(n){let{state:e}=n,t=e.facet(Tu),s=[];for(let i of e.selection.ranges){let r=i==e.selection.main;if(i.empty||t.drawRangeCursor&&!(r&&de.ios&&t.iosSelectionHandles)){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:te.cursor(i.head,i.assoc);for(let l of ac.forRange(n,o,a))s.push(l)}}return s},update(n,e){n.transactions.some(s=>s.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=rN(n);return t&&dC(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){dC(e.state,n)},class:"cm-cursorLayer"});function dC(n,e){e.style.animationDuration=n.facet(Tu).cursorBlinkRate+"ms"}const iQ=iN({above:!1,markers(n){let e=[],{main:t,ranges:s}=n.state.selection;for(let i of s)if(!i.empty)for(let r of ac.forRange(n,"cm-selectionBackground",i))e.push(r);if(de.ios&&!t.empty&&n.state.facet(Tu).iosSelectionHandles){for(let i of ac.forRange(n,"cm-selectionHandle cm-selectionHandle-start",te.cursor(t.from,1)))e.push(i);for(let i of ac.forRange(n,"cm-selectionHandle cm-selectionHandle-end",te.cursor(t.to,1)))e.push(i)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||rN(n)},class:"cm-selectionLayer"}),rQ=de.gecko&&de.gecko_version==153?"#ffffff01":"transparent",oQ=q0.highest(xe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${rQ} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));function aQ(){return cQ}const lQ=Qe.line({class:"cm-activeLine"}),cQ=ri.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let s of n.state.selection.ranges){let i=n.lineBlockAt(s.head);i.from>e&&(t.push(lQ.range(i.from)),e=i.from)}return Qe.set(t)}},{decorations:n=>n.decorations}),fC=be.define({combine(n){let e,t;for(let s of n)e=e||s.topContainer,t=t||s.bottomContainer;return{topContainer:e,bottomContainer:t}}});function oN(n,e){let t=n.plugin(aN),s=t?t.specs.indexOf(e):-1;return s>-1?t.panels[s]:null}const aN=ri.fromClass(class{constructor(n){this.input=n.state.facet(Ny),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(fC);this.top=new Xm(n,!0,e.topContainer),this.bottom=new Xm(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(fC);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Xm(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Xm(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Ny);if(t!=this.input){let s=t.filter(l=>l),i=[],r=[],o=[],a=[];for(let l of s){let c=this.specs.indexOf(l),h;c<0?(h=l(n.view),a.push(h)):(h=this.panels[c],h.update&&h.update(n)),i.push(h),(h.top?r:o).push(h)}this.specs=s,this.panels=i,this.top.sync(r),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let s of this.panels)s.update&&s.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>xe.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Xm{constructor(e,t,s){this.view=e,this.top=t,this.container=s,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=pC(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=pC(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function pC(n){let e=n.nextSibling;return n.remove(),e}const Ny=be.define({enables:aN});function hQ(n,e){let t,s=new Promise(o=>t=o),i=o=>uQ(o,e,t);n.state.field(Vv,!1)?n.dispatch({effects:lN.of(i)}):n.dispatch({effects:St.appendConfig.of(Vv.init(()=>[i]))});let r=cN.of(i);return{close:r,result:s.then(o=>((n.win.queueMicrotask||(l=>n.win.setTimeout(l,10)))(()=>{n.state.field(Vv).indexOf(i)>-1&&n.dispatch({effects:r})}),o))}}const Vv=Fr.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(lN)?n=[t.value].concat(n):t.is(cN)&&(n=n.filter(s=>s!=t.value));return n},provide:n=>Ny.computeN([n],e=>e.field(n))}),lN=St.define(),cN=St.define();function uQ(n,e,t){let s=e.content?e.content(n,()=>o(null)):null;if(!s){if(s=Cn("form"),e.input){let a=Cn("input",e.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),s.appendChild(Cn("label",(e.label||"")+": ",a))}else s.appendChild(document.createTextNode(e.label||""));s.appendChild(document.createTextNode(" ")),s.appendChild(Cn("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let i=s.nodeName=="FORM"?[s]:s.querySelectorAll("form");for(let a=0;a{c.keyCode==27?(c.preventDefault(),o(null)):c.keyCode==13&&(c.preventDefault(),o(l))}),l.addEventListener("submit",c=>{c.preventDefault(),o(l)})}let r=Cn("div",s,Cn("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(r.className=e.class),r.classList.add("cm-dialog");function o(a){r.contains(r.ownerDocument.activeElement)&&n.focus(),t(a)}return{dom:r,top:e.top,mount:()=>{if(e.focus){let a;typeof e.focus=="string"?a=s.querySelector(e.focus):a=s.querySelector("input")||s.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class xc extends bc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}xc.prototype.elementClass="";xc.prototype.toDOM=void 0;xc.prototype.mapMode=si.TrackBefore;xc.prototype.startSide=xc.prototype.endSide=-1;xc.prototype.point=!0;const Wv=be.define(),dQ=be.define(),Yg=be.define(),mC=be.define({combine:n=>n.some(e=>e)});function fQ(n){return[pQ]}const pQ=ri.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(Yg).map(e=>new yC(n,e)),this.fixed=!n.state.facet(mC);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,s=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(s<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(mC)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=st.iter(this.view.state.facet(Wv),this.view.viewport.from),s=[],i=this.gutters.map(r=>new mQ(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(s.length&&(s=[]),Array.isArray(r.type)){let o=!0;for(let a of r.type)if(a.type==Vn.Text&&o){B_(t,s,a.from);for(let l of i)l.line(this.view,a,s);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(r.type==Vn.Text){B_(t,s,r.from);for(let o of i)o.line(this.view,r,s)}else if(r.widget)for(let o of i)o.widget(this.view,r);for(let r of i)r.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Yg),t=n.state.facet(Yg),s=n.docChanged||n.heightChanged||n.viewportChanged||!st.eq(n.startState.facet(Wv),n.state.facet(Wv),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(n)&&(s=!0);else{s=!0;let i=[];for(let r of t){let o=e.indexOf(r);o<0?i.push(new yC(this.view,r)):(this.gutters[o].update(n),i.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),i.indexOf(r)<0&&r.destroy();for(let r of i)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=i}return s}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>xe.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let s=t.dom.offsetWidth*e.scaleX,i=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==It.LTR?{left:s,right:i}:{right:s,left:i}})});function gC(n){return Array.isArray(n)?n:[n]}function B_(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class mQ{constructor(e,t,s){this.gutter=e,this.height=s,this.i=0,this.cursor=st.iter(e.markers,t.from)}addElement(e,t,s){let{gutter:i}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let a=new hN(e,o,r,s);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,r,s);this.height=t.bottom,this.i++}line(e,t,s){let i=[];B_(this.cursor,i,t.from),s.length&&(i=i.concat(s));let r=this.gutter.config.lineMarker(e,t,i);r&&i.unshift(r);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let s=this.gutter.config.widgetMarker(e,t.widget,t),i=s?[s]:null;for(let r of e.state.facet(dQ)){let o=r(e,t.widget,t);o&&(i||(i=[])).push(o)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class yC{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let s in t.domEventHandlers)this.dom.addEventListener(s,i=>{let r=i.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let l=r.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[s](e,a,i)&&i.preventDefault()});this.markers=gC(t.markers(e)),t.initialSpacer&&(this.spacer=new hN(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=gC(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let s=e.view.viewport;return!st.eq(this.markers,t,s.from,s.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class hN{constructor(e,t,s,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,s,i)}update(e,t,s,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=s&&(this.dom.style.marginTop=(this.above=s)?s+"px":""),gQ(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let s="cm-gutterElement",i=this.dom.firstChild;for(let r=0,o=0;;){let a=o,l=rr(a,l,c)||o(a,l,c):o}return s}})}});class Gv extends xc{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Kv(n,e){return n.state.facet(ih).formatNumber(e,n.state)}const bQ=Yg.compute([ih],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(yQ)},lineMarker(e,t,s){return s.some(i=>i.toDOM)?null:new Gv(Kv(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,s)=>{for(let i of e.state.facet(vQ)){let r=i(e,t,s);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(ih)!=e.state.facet(ih),initialSpacer(e){return new Gv(Kv(e,vC(e.state.doc.lines)))},updateSpacer(e,t){let s=Kv(t.view,vC(t.view.state.doc.lines));return s==e.number?e:new Gv(s)},domEventHandlers:n.facet(ih).domEventHandlers,side:"before"}));function wQ(n={}){return[ih.of(n),fQ(),bQ]}function vC(n){let e=9;for(;e{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Hs.match(e)),t=>{let s=e(t);return s===void 0?null:[this,s]}}}nt.closedBy=new nt({deserialize:n=>n.split(" ")});nt.openedBy=new nt({deserialize:n=>n.split(" ")});nt.group=new nt({deserialize:n=>n.split(" ")});nt.isolate=new nt({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});nt.contextHash=new nt({perNode:!0});nt.lookAhead=new nt({perNode:!0});nt.mounted=new nt({perNode:!0});class ef{constructor(e,t,s,i=!1){this.tree=e,this.overlay=t,this.parser=s,this.bracketed=i}static get(e){return e&&e.props&&e.props[nt.mounted.id]}}const xQ=Object.create(null);class Hs{constructor(e,t,s,i=0){this.name=e,this.props=t,this.id=s,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):xQ,s=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Hs(e.name||"",t,e.id,s);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(i)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(nt.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let s in e)for(let i of s.split(" "))t[i]=e[s];return s=>{for(let i=s.prop(nt.group),r=-1;r<(i?i.length:0);r++){let o=t[r<0?s.name:i[r]];if(o)return o}}}}Hs.none=new Hs("",Object.create(null),0,8);class Xx{constructor(e){this.types=e;for(let t=0;t0;for(let l=this.cursor(o|Qt.IncludeAnonymous);;){let c=!1;if(l.from<=r&&l.to>=i&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&s&&(a||!l.type.isAnonymous)&&s(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Qx(Hs.none,this.children,this.positions,0,this.children.length,0,this.length,(t,s,i)=>new Ot(this.type,t,s,i,this.propValues),e.makeTree||((t,s,i)=>new Ot(Hs.none,t,s,i)))}static build(e){return CQ(e)}}Ot.empty=new Ot(Hs.none,[],[],0);class Yx{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Yx(this.buffer,this.index)}}class Oa{constructor(e,t,s){this.buffer=e,this.length=t,this.set=s}get type(){return Hs.none}toString(){let e=[];for(let t=0;t0));l=o[l+3]);return a}slice(e,t,s){let i=this.buffer,r=new Uint16Array(t-e),o=0;for(let a=e,l=0;a=e&&te;case 1:return t<=e&&s>e;case 2:return s>e;case 4:return!0}}function yf(n,e,t,s){for(var i;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?a.length:-1;e!=c;e+=t){let h=a[e],u=l[e]+o.from,d;if(!(!(r&Qt.EnterBracketed&&h instanceof Ot&&(d=ef.get(h))&&!d.overlay&&d.bracketed&&s>=u&&s<=u+h.length)&&!uN(i,s,u,u+h.length))){if(h instanceof Oa){if(r&Qt.ExcludeBuffers)continue;let p=h.findChild(0,h.buffer.length,t,s-u,i);if(p>-1)return new Aa(new AQ(o,h,e,u),null,p)}else if(r&Qt.IncludeAnonymous||!h.type.isAnonymous||Jx(h)){let p;if(!(r&Qt.IgnoreMounts)&&(p=ef.get(h))&&!p.overlay)return new _i(p.tree,u,e,o);let m=new _i(h,u,e,o);return r&Qt.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?h.children.length-1:0,t,s,i,r)}}}if(r&Qt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,s=0){let i;if(!(s&Qt.IgnoreOverlays)&&(i=ef.get(this._tree))&&i.overlay){let r=e-this.from,o=s&Qt.EnterBracketed&&i.bracketed;for(let{from:a,to:l}of i.overlay)if((t>0||o?a<=r:a=r:l>r))return new _i(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,s)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function wC(n,e,t,s){let i=n.cursor(),r=[];if(!i.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!i.nextSibling())return r}for(;;){if(s!=null&&i.type.is(s))return r;if(i.type.is(e)&&r.push(i.node),!i.nextSibling())return s==null?r:[]}}function U_(n,e,t=e.length-1){for(let s=n;t>=0;s=s.parent){if(!s)return!1;if(!s.type.isAnonymous){if(e[t]&&e[t]!=s.name)return!1;t--}}return!0}class AQ{constructor(e,t,s,i){this.parent=e,this.buffer=t,this.index=s,this.start=i}}class Aa extends dN{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,s){super(),this.context=e,this._parent=t,this.index=s,this.type=e.buffer.set.types[e.buffer.buffer[s]]}child(e,t,s){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,s);return r<0?null:new Aa(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,s=0){if(s&Qt.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Aa(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Aa(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Aa(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:s}=this.context,i=this.index+4,r=s.buffer[this.index+3];if(r>i){let o=s.buffer[this.index+1];e.push(s.slice(i,r,o)),t.push(0)}return new Ot(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function fN(n){if(!n.length)return null;let e=0,t=n[0];for(let r=1;rt.from||o.to=e){let a=new _i(o.tree,o.overlay[0].from+r.from,-1,r);(i||(i=[s])).push(yf(a,e,t,!1))}}return i?fN(i):s}class q_{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Qt.EnterBracketed,e instanceof _i)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let s=e._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:s,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=s+i.buffer[e+1],this.to=s+i.buffer[e+2],!0}yield(e){return e?e instanceof _i?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,s){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,s,this.mode));let{buffer:i}=this.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,s);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,s=this.mode){return this.buffer?s&Qt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Qt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Qt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,s=this.stack.length-1;if(e<0){let i=s<0?0:this.stack[s]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(s<0?t.buffer.length:t.buffer[this.stack[s]+3]))return this.yieldBuf(i)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,s,{buffer:i}=this;if(i){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:s._tree.children.length;r!=o;r+=e){let a=s._tree.children[r];if(this.mode&Qt.IncludeAnonymous||a instanceof Oa||!a.type.isAnonymous||Jx(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,s=r+1;break e}i=this.stack[--r]}for(let i=s;i=0;r--){if(r<0)return U_(this._tree,e,i);let o=s[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Jx(n){return n.children.some(e=>e instanceof Oa||!e.type.isAnonymous||Jx(e))}function CQ(n){var e;let{buffer:t,nodeSet:s,maxBufferLength:i=_Q,reused:r=[],minRepeatType:o=s.types.length}=n,a=Array.isArray(t)?new Yx(t,t.length):t,l=s.types,c=0,h=0;function u(A,T,C,I,D,H){let{id:j,start:U,end:B,size:L}=a,X=h,se=c;if(L<0)if(a.next(),L==-1){let E=r[j];C.push(E),I.push(U-A);return}else if(L==-3){c=j;return}else if(L==-4){h=j;return}else throw new RangeError(`Unrecognized record size: ${L}`);let J=l[j],Y,ge,z=U-A;if(B-U<=i&&(ge=v(a.pos-T,D))){let E=new Uint16Array(ge.size-ge.skip),O=a.pos-ge.size,R=E.length;for(;a.pos>O;)R=g(ge.start,E,R);Y=new Oa(E,B-ge.start,s),z=ge.start-A}else{let E=a.pos-L;a.next();let O=[],R=[],w=j>=o?j:-1,k=0,N=B;for(;a.pos>E;)w>=0&&a.id==w&&a.size>=0?(a.end<=N-i&&(m(O,R,U,k,a.end,N,w,X,se),k=O.length,N=a.end),a.next()):H>2500?d(U,E,O,R):u(U,E,O,R,w,H+1);if(w>=0&&k>0&&k-1&&k>0){let G=p(J,se);Y=Qx(J,O,R,0,O.length,0,B-U,G,G)}else Y=y(J,O,R,B-U,X-B,se)}C.push(Y),I.push(z)}function d(A,T,C,I){let D=[],H=0,j=-1;for(;a.pos>T;){let{id:U,start:B,end:L,size:X}=a;if(X>4)a.next();else{if(j>-1&&B=0;L-=3)U[X++]=D[L],U[X++]=D[L+1]-B,U[X++]=D[L+2]-B,U[X++]=X;C.push(new Oa(U,D[2]-B,s)),I.push(B-A)}}function p(A,T){return(C,I,D)=>{let H=0,j=C.length-1,U,B;if(j>=0&&(U=C[j])instanceof Ot){if(!j&&U.type==A&&U.length==D)return U;(B=U.prop(nt.lookAhead))&&(H=I[j]+U.length+B)}return y(A,C,I,D,H,T)}}function m(A,T,C,I,D,H,j,U,B){let L=[],X=[];for(;A.length>I;)L.push(A.pop()),X.push(T.pop()+C-D);A.push(y(s.types[j],L,X,H-D,U-H,B)),T.push(D-C)}function y(A,T,C,I,D,H,j){if(H){let U=[nt.contextHash,H];j=j?[U].concat(j):[U]}if(D>25){let U=[nt.lookAhead,D];j=j?[U].concat(j):[U]}return new Ot(A,T,C,I,j)}function v(A,T){let C=a.fork(),I=0,D=0,H=0,j=C.end-i,U={size:0,start:0,skip:0};e:for(let B=C.pos-A;C.pos>B;){let L=C.size;if(C.id==T&&L>=0){U.size=I,U.start=D,U.skip=H,H+=4,I+=4,C.next();continue}let X=C.pos-L;if(L<0||X=o?4:0,J=C.start;for(C.next();C.pos>X;){if(C.size<0)if(C.size==-3||C.size==-4)se+=4;else break e;else C.id>=o&&(se+=4);C.next()}D=J,I+=L,H+=se}return(T<0||I==A)&&(U.size=I,U.start=D,U.skip=H),U.size>4?U:void 0}function g(A,T,C){let{id:I,start:D,end:H,size:j}=a;if(a.next(),j>=0&&I4){let B=a.pos-(j-4);for(;a.pos>B;)C=g(A,T,C)}T[--C]=U,T[--C]=H-A,T[--C]=D-A,T[--C]=I}else j==-3?c=I:j==-4&&(h=I);return C}let _=[],b=[];for(;a.pos>0;)u(n.start||0,n.bufferStart||0,_,b,-1,0);let x=(e=n.length)!==null&&e!==void 0?e:_.length?b[0]+_[0].length:0;return new Ot(l[n.topID],_.reverse(),b.reverse(),x)}const _C=new WeakMap;function Jg(n,e){if(!n.isAnonymous||e instanceof Oa||e.type!=n)return 1;let t=_C.get(e);if(t==null){t=1;for(let s of e.children){if(s.type!=n||!(s instanceof Ot)){t=1;break}t+=Jg(n,s)}_C.set(e,t)}return t}function Qx(n,e,t,s,i,r,o,a,l){let c=0;for(let m=s;m=h)break;T+=C}if(b==x+1){if(T>h){let C=m[x];p(C.children,C.positions,0,C.children.length,y[x]+_);continue}u.push(m[x])}else{let C=y[b-1]+m[b-1].length-A;u.push(Qx(n,m,y,x,b,A,C,null,l))}d.push(A+_-r)}}return p(e,t,s,i,0),(a||l)(u,d,o)}class lc{constructor(e,t,s,i,r=!1,o=!1){this.from=e,this.to=t,this.tree=s,this.offset=i,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],s=!1){let i=[new lc(0,e.length,e,0,!1,s)];for(let r of t)r.to>e.length&&i.push(r);return i}static applyChanges(e,t,s=128){if(!t.length)return e;let i=[],r=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let h=a=s)for(;o&&o.from=d.from||u<=d.to||c){let p=Math.max(d.from,l)-c,m=Math.min(d.to,u)-c;d=p>=m?null:new lc(p,m,d.tree,d.offset+c,a>0,!!h)}if(d&&i.push(d),o.to>u)break;o=rnew Zv(i.from,i.to)):[new Zv(0,0)]:[new Zv(0,e.length)],this.createParse(e,t||[],s)}parse(e,t,s){let i=this.startParse(e,t,s);for(;;){let r=i.advance();if(r)return r}}}class $Q{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new nt({perNode:!0});let TQ=0;class gi{constructor(e,t,s,i){this.name=e,this.set=t,this.base=s,this.modified=i,this.id=TQ++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let s=typeof e=="string"?e:"?";if(e instanceof gi&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let i=new gi(s,[],null,[]);if(i.set.push(i),t)for(let r of t.set)i.set.push(r);return i}static defineModifier(e){let t=new Ly(e);return s=>s.modified.indexOf(t)>-1?s:Ly.get(s.base||s,s.modified.concat(t).sort((i,r)=>i.id-r.id))}}let PQ=0;class Ly{constructor(e){this.name=e,this.instances=[],this.id=PQ++}static get(e,t){if(!t.length)return e;let s=t[0].instances.find(a=>a.base==e&&RQ(t,a.modified));if(s)return s;let i=[],r=new gi(e.name,i,e,t);for(let a of t)a.instances.push(r);let o=MQ(t);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(Ly.get(a,l));return r}}function RQ(n,e){return n.length==e.length&&n.every((t,s)=>t==e[s])}function MQ(n){let e=[[]];for(let t=0;ts.length-t.length)}function IQ(n){let e=Object.create(null);for(let t in n){let s=n[t];Array.isArray(s)||(s=[s]);for(let i of t.split(" "))if(i){let r=[],o=2,a=i;for(let u=0;;){if(a=="..."&&u>0&&u+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+i);if(r.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),u+=d[0].length,u==i.length)break;let p=i[u++];if(u==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(u)}let l=r.length-1,c=r[l];if(!c)throw new RangeError("Invalid path: "+i);let h=new Dy(s,o,l>0?r.slice(0,l):null);e[c]=h.sort(e[c])}}return OQ.add(e)}const OQ=new nt({combine(n,e){let t,s,i;for(;n||e;){if(!n||e&&n.depth>=e.depth?(i=e,e=e.next):(i=n,n=n.next),t&&t.mode==i.mode&&!i.context&&!t.context)continue;let r=new Dy(i.tags,i.mode,i.context);t?t.next=r:s=r,t=r}return s}});class Dy{constructor(e,t,s,i){this.tags=e,this.mode=t,this.context=s,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=i;for(let a of r)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:s}}const he=gi.define,Jm=he(),Ho=he(),SC=he(Ho),xC=he(Ho),Bo=he(),Qm=he(Bo),Xv=he(Bo),or=he(),Wa=he(or),ir=he(),rr=he(),V_=he(),ld=he(V_),eg=he(),ze={comment:Jm,lineComment:he(Jm),blockComment:he(Jm),docComment:he(Jm),name:Ho,variableName:he(Ho),typeName:SC,tagName:he(SC),propertyName:xC,attributeName:he(xC),className:he(Ho),labelName:he(Ho),namespace:he(Ho),macroName:he(Ho),literal:Bo,string:Qm,docString:he(Qm),character:he(Qm),attributeValue:he(Qm),number:Xv,integer:he(Xv),float:he(Xv),bool:he(Bo),regexp:he(Bo),escape:he(Bo),color:he(Bo),url:he(Bo),keyword:ir,self:he(ir),null:he(ir),atom:he(ir),unit:he(ir),modifier:he(ir),operatorKeyword:he(ir),controlKeyword:he(ir),definitionKeyword:he(ir),moduleKeyword:he(ir),operator:rr,derefOperator:he(rr),arithmeticOperator:he(rr),logicOperator:he(rr),bitwiseOperator:he(rr),compareOperator:he(rr),updateOperator:he(rr),definitionOperator:he(rr),typeOperator:he(rr),controlOperator:he(rr),punctuation:V_,separator:he(V_),bracket:ld,angleBracket:he(ld),squareBracket:he(ld),paren:he(ld),brace:he(ld),content:or,heading:Wa,heading1:he(Wa),heading2:he(Wa),heading3:he(Wa),heading4:he(Wa),heading5:he(Wa),heading6:he(Wa),contentSeparator:he(or),list:he(or),quote:he(or),emphasis:he(or),strong:he(or),link:he(or),monospace:he(or),strikethrough:he(or),inserted:he(),deleted:he(),changed:he(),invalid:he(),meta:eg,documentMeta:he(eg),annotation:he(eg),processingInstruction:he(eg),definition:gi.defineModifier("definition"),constant:gi.defineModifier("constant"),function:gi.defineModifier("function"),standard:gi.defineModifier("standard"),local:gi.defineModifier("local"),special:gi.defineModifier("special")};for(let n in ze){let e=ze[n];e instanceof gi&&(e.name=n)}NQ([{tag:ze.link,class:"tok-link"},{tag:ze.heading,class:"tok-heading"},{tag:ze.emphasis,class:"tok-emphasis"},{tag:ze.strong,class:"tok-strong"},{tag:ze.keyword,class:"tok-keyword"},{tag:ze.atom,class:"tok-atom"},{tag:ze.bool,class:"tok-bool"},{tag:ze.url,class:"tok-url"},{tag:ze.labelName,class:"tok-labelName"},{tag:ze.inserted,class:"tok-inserted"},{tag:ze.deleted,class:"tok-deleted"},{tag:ze.literal,class:"tok-literal"},{tag:ze.string,class:"tok-string"},{tag:ze.number,class:"tok-number"},{tag:[ze.regexp,ze.escape,ze.special(ze.string)],class:"tok-string2"},{tag:ze.variableName,class:"tok-variableName"},{tag:ze.local(ze.variableName),class:"tok-variableName tok-local"},{tag:ze.definition(ze.variableName),class:"tok-variableName tok-definition"},{tag:ze.special(ze.variableName),class:"tok-variableName2"},{tag:ze.definition(ze.propertyName),class:"tok-propertyName tok-definition"},{tag:ze.typeName,class:"tok-typeName"},{tag:ze.namespace,class:"tok-namespace"},{tag:ze.className,class:"tok-className"},{tag:ze.macroName,class:"tok-macroName"},{tag:ze.propertyName,class:"tok-propertyName"},{tag:ze.operator,class:"tok-operator"},{tag:ze.comment,class:"tok-comment"},{tag:ze.meta,class:"tok-meta"},{tag:ze.invalid,class:"tok-invalid"},{tag:ze.punctuation,class:"tok-punctuation"}]);var Yv;const Od=new nt;function LQ(n){return be.define({combine:n?e=>e.concat(n):void 0})}const DQ=new nt;class Ir{constructor(e,t,s=[],i=""){this.data=e,this.name=i,at.prototype.hasOwnProperty("tree")||Object.defineProperty(at.prototype,"tree",{get(){return Na(this)}}),this.parser=t,this.extension=[Mu.of(this),at.languageData.of((r,o,a)=>{let l=AC(r,o,a),c=l.type.prop(Od);if(!c)return[];let h=r.facet(c),u=l.type.prop(DQ);if(u){let d=l.resolve(o-l.from,a);for(let p of u)if(p.test(d,r)){let m=r.facet(p.facet);return p.type=="replace"?m:m.concat(h)}}return h})].concat(s)}isActiveAt(e,t,s=-1){return AC(e,t,s).type.prop(Od)==this.data}findRegions(e){let t=e.facet(Mu);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let s=[],i=(r,o)=>{if(r.prop(Od)==this.data){s.push({from:o,to:o+r.length});return}let a=r.prop(nt.mounted);if(a){if(a.tree.prop(Od)==this.data){if(a.overlay)for(let l of a.overlay)s.push({from:l.from+o,to:l.to+o});else s.push({from:o,to:o+r.length});return}else if(a.overlay){let l=s.length;if(i(a.tree,a.overlay[0].from+o),s.length>l)return}}for(let l=0;l=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-s,t-s)}}let cd=null;class Pu{constructor(e,t,s=[],i,r,o,a,l){this.parser=e,this.state=t,this.fragments=s,this.tree=i,this.treeLen=r,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,s){return new Pu(e,t,[],Ot.empty,0,s,[],null)}startParse(){return this.parser.startParse(new jQ(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Ot.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var s;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(lc.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=cd;cd=this;try{return e()}finally{cd=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=kC(e,t.from,t.to);return e}changes(e,t){let{fragments:s,tree:i,treeLen:r,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,h,u,d)=>l.push({fromA:c,toA:h,fromB:u,toB:d})),s=lc.applyChanges(s,l),i=Ot.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),u=e.mapPos(c.to,-1);he.from&&(this.fragments=kC(this.fragments,i,r),this.skipped.splice(s--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends pN{createParse(t,s,i){let r=i[0].from,o=i[i.length-1].to;return{parsedPos:r,advance(){let l=cd;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new Ot(Hs.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return cd}}function kC(n,e,t){return lc.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ru{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),s=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,s)||t.takeTree(),new Ru(t)}static init(e){let t=Math.min(3e3,e.doc.length),s=Pu.create(e.facet(Mu).parser,e,{from:0,to:t});return s.work(20,t)||s.takeTree(),new Ru(s)}}Ir.state=Fr.define({create:Ru.init,update(n,e){for(let t of e.effects)if(t.is(Ir.setState))return t.value;return e.startState.facet(Mu)!=e.state.facet(Mu)?Ru.init(e.state):n.apply(e)}});let mN=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(mN=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Jv=typeof navigator<"u"&&(!((Yv=navigator.scheduling)===null||Yv===void 0)&&Yv.isInputPending)?()=>navigator.scheduling.isInputPending():null,FQ=ri.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Ir.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Ir.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=mN(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndi+1e3,l=r.context.work(()=>Jv&&Jv()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Ir.setState.of(new Ru(r.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Mr(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Mu=be.define({combine(n){return n.length?n[0]:null},enables:n=>[Ir.state,FQ,xe.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]}),zQ=be.define(),eA=be.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Ac(n){let e=n.facet(eA);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function jy(n,e){let t="",s=n.tabSize,i=n.facet(eA)[0];if(i==" "){for(;e>=s;)t+=" ",e-=s;i=" "}for(let r=0;r=e?HQ(n,t,e):null}class J0{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ac(e)}lineAt(e,t=1){let s=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:r}=this.options;return i!=null&&i>=s.from&&i<=s.to?r&&i==e?{text:"",from:e}:(t<0?i-1&&(r+=o-this.countColumn(s,s.search(/\S|$/))),r}countColumn(e,t=e.length){return V0(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:s,from:i}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(i);if(o>-1)return o}return this.countColumn(s,s.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const yN=new nt;function HQ(n,e,t){let s=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=s.node){let r=[];for(let o=i;o&&!(o.froms.node.to||o.from==s.node.from&&o.type==s.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)s={node:r[o],next:s}}return vN(s,n,t)}function vN(n,e,t){for(let s=n;s;s=s.next){let i=UQ(s.node);if(i)return i(tA.create(e,t,s))}return 0}function BQ(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function UQ(n){let e=n.type.prop(yN);if(e)return e;let t=n.firstChild,s;if(t&&(s=t.type.prop(nt.closedBy))){let i=n.lastChild,r=i&&s.indexOf(i.name)>-1;return o=>GQ(o,!0,1,void 0,r&&!BQ(o)?i.from:void 0)}return n.parent==null?qQ:null}function qQ(){return 0}class tA extends J0{constructor(e,t,s){super(e.state,e.options),this.base=e,this.pos=t,this.context=s}get node(){return this.context.node}static create(e,t,s){return new tA(e,t,s)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let s=e.resolve(t.from);for(;s.parent&&s.parent.from==s.from;)s=s.parent;if(VQ(s,e))break;t=this.state.doc.lineAt(s.from)}return this.lineIndent(t.from)}continue(){return vN(this.context.next,this.base,this.pos)}}function VQ(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function WQ(n){let e=n.node,t=e.childAfter(e.from),s=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=i==null||i<=r.from?r.to:Math.min(r.to,i);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==s)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+c}}a=l.to}}function GQ(n,e,t,s,i){let r=n.textAfter,o=r.match(/^\s*/)[0].length,a=s&&r.slice(o,o+s.length)==s||i==n.pos+o,l=WQ(n);return l?a?n.column(l.from):n.column(l.to):n.baseIndent+(a?0:n.unit*t)}const KQ=xe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),bN=1e4,wN="()[]{}",_N=be.define({combine(n){return Hu(n,{afterCursor:!0,brackets:wN,maxScanDistance:bN,renderMatch:YQ})}}),ZQ=Qe.mark({class:"cm-matchingBracket"}),XQ=Qe.mark({class:"cm-nonmatchingBracket"});function YQ(n){let e=[],t=n.matched?ZQ:XQ;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function EC(n){let e=[],t=n.facet(_N);for(let s of n.selection.ranges){if(!s.empty)continue;let i=Or(n,s.head,-1,t)||s.head>0&&Or(n,s.head-1,1,t)||t.afterCursor&&(Or(n,s.head,1,t)||s.headn.decorations}),QQ=[JQ,KQ];function eee(n={}){return[_N.of(n),QQ]}const tee=new nt;function W_(n,e,t){let s=n.prop(e<0?nt.openedBy:nt.closedBy);if(s)return s;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function G_(n){let e=n.type.prop(tee);return e?e(n.node):n}function Or(n,e,t,s={}){let i=s.maxScanDistance||bN,r=s.brackets||wN,o=Na(n),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=W_(l.type,t,r);if(c&&l.from0?e>=h.from&&eh.from&&e<=h.to))return nee(n,e,t,l,h,c,r)}}return see(n,e,t,o,a.type,i,r)}function nee(n,e,t,s,i,r,o){let a=s.parent,l={from:i.from,to:i.to},c=0,h=a==null?void 0:a.cursor();if(h&&(t<0?h.childBefore(s.from):h.childAfter(s.to)))do if(t<0?h.to<=s.from:h.from>=s.to){if(c==0&&r.indexOf(h.type.name)>-1&&h.from0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},h=n.doc.iterRange(e,t>0?n.doc.length:0),u=0;for(let d=0;!h.next().done&&d<=r;){let p=h.value;t<0&&(d+=p.length);let m=e+d*t;for(let y=t>0?0:p.length-1,v=t>0?p.length:-1;y!=v;y+=t){let g=o.indexOf(p[y]);if(!(g<0||s.resolveInner(m+y,1).type!=i))if(g%2==0==t>0)u++;else{if(u==1)return{start:c,end:{from:m+y,to:m+y+1},matched:g>>1==l>>1};u--}}t>0&&(d+=p.length)}return h.done?{start:c,matched:!1}:null}function CC(n,e,t,s=0,i=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=i;for(let o=s;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPoss?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return i(r)==i(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&t!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function iee(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||ree,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||iA,mergeTokens:n.mergeTokens!==!1}}function ree(n){if(typeof n!="object")return n;let e={};for(let t in n){let s=n[t];e[t]=s instanceof Array?s.slice():s}return e}const $C=new WeakMap;class nA extends Ir{constructor(e){let t=LQ(e.languageData),s=iee(e),i,r=new class extends pN{createParse(o,a,l){return new aee(i,o,a,l)}};super(t,r,[],e.name),this.topNode=hee(t,this),i=this,this.streamParser=s,this.stateAfter=new nt({perNode:!0}),this.tokenTable=e.tokenTable?new EN(s.tokenTable):cee}static define(e){return new nA(e)}getIndent(e){let t,{overrideIndentation:s}=e.options;s&&(t=$C.get(e.state),t!=null&&t1e4)return null;for(;r=s&&t+e.length<=i&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=t+e.positions[o],c=a instanceof Ot&&l=e.length)return e;!i&&t==0&&e.type==n.topNode&&(i=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],a=e.children[r],l;if(ot&&sA(n,r.tree,0-r.offset,t,a),c;if(l&&l.pos<=s&&(c=xN(n,r.tree,t+r.offset,l.pos+r.offset,!1)))return{state:l.state,tree:c}}return{state:n.streamParser.startState(i?Ac(i):4),tree:Ot.empty}}class aee{constructor(e,t,s,i){this.lang=e,this.input=t,this.fragments=s,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let r=Pu.get(),o=i[0].from,{state:a,tree:l}=oee(e,s,o,this.to,r==null?void 0:r.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let c=0;cc.from<=r.viewport.from&&c.to>=r.viewport.from)&&(this.state=this.lang.streamParser.startState(Ac(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let e=Pu.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),s=Math.min(t,this.chunkStart+512);for(e&&(s=Math.min(s,e.viewport.to));this.parsedPos=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` `&&(t="");else{let s=t.indexOf(` `);s>-1&&(t=t.slice(0,s))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),s=e+t.length;for(let i=this.rangeIndex;;){let r=this.ranges[i].to;if(r>=s||(t=t.slice(0,r-(s-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);t+=a,s=o+a.length}return{line:t,end:s}}skipGapsTo(e,t,s){for(;;){let i=this.ranges[this.rangeIndex].to,r=e+t;if(s>0?i>r:i>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){i=this.skipGapsTo(t,i,1),t+=i;let a=this.chunk.length;i=this.skipGapsTo(s,i,-1),s+=i,r+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&r==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=s:this.chunk.push(e,t,s,r),i}parseLine(e){let{line:t,end:s}=this.nextLine(),i=0,{streamParser:r}=this.lang,o=new SN(t,e?e.state.tabSize:4,e?Ac(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=AN(r.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,i)),o.start>1e4)break}this.parsedPos=s,this.moveRangeIndex(),this.parsedPose.start)return i}throw new Error("Stream parser failed to advance stream.")}const iA=Object.create(null),vf=[Hs.none],lee=new Xx(vf),TC=[],PC=Object.create(null),kN=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])kN[n]=CN(iA,e);class EN{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),kN)}resolve(e){return e?this.table[e]||(this.table[e]=CN(this.extra,e)):0}}const cee=new EN(iA);function Qv(n,e){TC.indexOf(n)>-1||(TC.push(n),console.warn(e))}function CN(n,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let h=n[c]||ze[c];h?typeof h=="function"?l.length?l=l.map(h):Qv(c,`Modifier ${c} used at start of tag`):l.length?Qv(c,`Tag ${c} used as modifier`):l=Array.isArray(h)?h:[h]:Qv(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let s=e.replace(/ /g,"_"),i=s+" "+t.map(a=>a.id),r=PC[i];if(r)return r.id;let o=PC[i]=Hs.define({id:vf.length,name:s,props:[IQ({[s]:t})]});return vf.push(o),o.id}function hee(n,e){let t=Hs.define({id:vf.length,name:"Document",props:[Od.add(()=>n),yN.add(()=>s=>e.getIndent(s))],top:!0});return vf.push(t),t}It.RTL,It.LTR;const uee=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),s=oA(n.state,t.from);return s.line?dee(n):s.block?pee(n):!1};function rA(n,e){return({state:t,dispatch:s})=>{if(t.readOnly)return!1;let i=n(e,t);return i?(s(t.update(i)),!0):!1}}const dee=rA(yee,0),fee=rA($N,0),pee=rA((n,e)=>$N(n,e,gee(e)),0);function oA(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const hd=50;function mee(n,{open:e,close:t},s,i){let r=n.sliceDoc(s-hd,s),o=n.sliceDoc(i,i+hd),a=/\s*$/.exec(r)[0].length,l=/^\s*/.exec(o)[0].length,c=r.length-a;if(r.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:s-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let h,u;i-s<=2*hd?h=u=n.sliceDoc(s,i):(h=n.sliceDoc(s,s+hd),u=n.sliceDoc(i-hd,i));let d=/^\s*/.exec(h)[0].length,p=/\s*$/.exec(u)[0].length,m=u.length-p-t.length;return h.slice(d,d+e.length)==e&&u.slice(m,m+t.length)==t?{open:{pos:s+d+e.length,margin:/\s/.test(h.charAt(d+e.length))?1:0},close:{pos:i-p-t.length,margin:/\s/.test(u.charAt(m-1))?1:0}}:null}function gee(n){let e=[];for(let t of n.selection.ranges){let s=n.doc.lineAt(t.from),i=t.to<=s.to?s:n.doc.lineAt(t.to);i.from>s.from&&i.from==t.to&&(i=t.to==s.to+1?s:n.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>s.from?e[r].to=i.to:e.push({from:s.from+/^\s*/.exec(s.text)[0].length,to:i.to})}return e}function $N(n,e,t=e.selection.ranges){let s=t.map(r=>oA(e,r.from).block);if(!s.every(r=>r))return null;let i=t.map((r,o)=>mee(e,s[o],r.from,r.to));if(n!=2&&!i.every(r=>r))return{changes:e.changes(t.map((r,o)=>i[o]?[]:[{from:r.from,insert:s[o].open+" "},{from:r.to,insert:" "+s[o].close}]))};if(n!=1&&i.some(r=>r)){let r=[];for(let o=0,a;oi&&(r==o||o>u.from)){i=u.from;let d=/^\s*/.exec(u.text)[0].length,p=d==u.length,m=u.text.slice(d,d+c.length)==c?d:-1;dr.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:a,token:l,indent:c,empty:h,single:u}of s)(u||!h)&&r.push({from:a.from+c,insert:l+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&s.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:a,token:l}of s)if(a>=0){let c=o.from+a,h=c+l.length;o.text[h-o.from]==" "&&h++,r.push({from:c,to:h})}return{changes:r}}return null}const K_=Fa.define(),vee=Fa.define(),bee=be.define(),TN=be.define({combine(n){return Hu(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(s,i)=>e(s,i)||t(s,i)})}}),PN=Fr.define({create(){return Nr.empty},update(n,e){let t=e.state.facet(TN),s=e.annotation(K_);if(s){let l=Fs.fromTransaction(e,s.selection),c=s.side,h=c==0?n.undone:n.done;return l?h=Fy(h,h.length,t.minDepth,l):h=IN(h,e.startState.selection),new Nr(c==0?s.rest:h,c==0?h:s.rest)}let i=e.annotation(vee);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(yn.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=Fs.fromTransaction(e),o=e.annotation(yn.time),a=e.annotation(yn.userEvent);return r?n=n.addChanges(r,o,a,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Nr(n.done.map(Fs.fromJSON),n.undone.map(Fs.fromJSON))}});function wee(n={}){return[PN,TN.of(n),xe.domEventHandlers({beforeinput(e,t){let s=e.inputType=="historyUndo"?RN:e.inputType=="historyRedo"?Z_:null;return s?(e.preventDefault(),s(t)):!1}})]}function Q0(n,e){return function({state:t,dispatch:s}){if(!e&&t.readOnly)return!1;let i=t.field(PN,!1);if(!i)return!1;let r=i.pop(n,t,e);return r?(s(r),!0):!1}}const RN=Q0(0,!1),Z_=Q0(1,!1),_ee=Q0(0,!0),See=Q0(1,!0);class Fs{constructor(e,t,s,i,r){this.changes=e,this.effects=t,this.mapped=s,this.startSelection=i,this.selectionsAfter=r}setSelAfter(e){return new Fs(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,s;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(s=this.startSelection)===null||s===void 0?void 0:s.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new Fs(e.changes&&pn.fromJSON(e.changes),[],e.mapped&&Lr.fromJSON(e.mapped),e.startSelection&&te.fromJSON(e.startSelection),e.selectionsAfter.map(te.fromJSON))}static fromTransaction(e,t){let s=wi;for(let i of e.startState.facet(bee)){let r=i(e);r.length&&(s=s.concat(r))}return!s.length&&e.changes.empty?null:new Fs(e.changes.invert(e.startState.doc),s,void 0,t||e.startState.selection,wi)}static selection(e){return new Fs(void 0,wi,void 0,void 0,e)}}function Fy(n,e,t,s){let i=e+1>t+20?e-t-1:0,r=n.slice(i,e);return r.push(s),r}function xee(n,e){let t=[],s=!1;return n.iterChangedRanges((i,r)=>t.push(i,r)),e.iterChangedRanges((i,r,o,a)=>{for(let l=0;l=c&&o<=h&&(s=!0)}}),s}function Aee(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,s)=>t.empty!=e.ranges[s].empty).length===0}function MN(n,e){return n.length?e.length?n.concat(e):n:e}const wi=[],kee=200;function IN(n,e){if(n.length){let t=n[n.length-1],s=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-kee));return s.length&&s[s.length-1].eq(e)?n:(s.push(e),Fy(n,n.length-1,1e9,t.setSelAfter(s)))}else return[Fs.selection([e])]}function Eee(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function eb(n,e){if(!n.length)return n;let t=n.length,s=wi;for(;t;){let i=Cee(n[t-1],e,s);if(i.changes&&!i.changes.empty||i.effects.length){let r=n.slice(0,t);return r[t-1]=i,r}else e=i.mapped,t--,s=i.selectionsAfter}return s.length?[Fs.selection(s)]:wi}function Cee(n,e,t){let s=MN(n.selectionsAfter.length?n.selectionsAfter.map(a=>a.map(e)):wi,t);if(!n.changes)return Fs.selection(s);let i=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new Fs(i,St.mapEffects(n.effects,e),o,n.startSelection.map(r),s)}const $ee=/^(input\.type|delete)($|\.)/;class Nr{constructor(e,t,s=0,i=void 0){this.done=e,this.undone=t,this.prevTime=s,this.prevUserEvent=i}isolate(){return this.prevTime?new Nr(this.done,this.undone):this}addChanges(e,t,s,i,r){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!s||$ee.test(s))&&(!a.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):ev(t,e))}function as(n){return n.textDirectionAt(n.state.selection.main.head)==It.LTR}const NN=n=>ON(n,!as(n)),LN=n=>ON(n,as(n));function DN(n,e){return tr(n,t=>t.empty?n.moveByGroup(t,e):ev(t,e))}const Pee=n=>DN(n,!as(n)),Ree=n=>DN(n,as(n));function Mee(n,e,t){if(e.type.prop(t))return!0;let s=e.to-e.from;return s&&(s>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function tv(n,e,t){let s=Na(n).resolveInner(e.head),i=t?nt.closedBy:nt.openedBy;for(let l=e.head;;){let c=t?s.childAfter(l):s.childBefore(l);if(!c)break;Mee(n,c,i)?s=c:l=t?c.to:c.from}let r=s.type.prop(i),o,a;return r&&(o=t?Or(n,s.from,1):Or(n,s.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?s.to:s.from,te.cursor(a,t?-1:1)}const Iee=n=>tr(n,e=>tv(n.state,e,!as(n))),Oee=n=>tr(n,e=>tv(n.state,e,as(n)));function jN(n,e){return tr(n,t=>{if(!t.empty)return ev(t,e);let s=n.moveVertically(t,e);return s.head!=t.head?s:n.moveToLineBoundary(t,e)})}const FN=n=>jN(n,!1),zN=n=>jN(n,!0);function HN(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):ev(o,e));if(i.eq(s.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(s.selection.main.head),a=n.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottomBN(n,!1),X_=n=>BN(n,!0);function za(n,e,t){let s=n.lineBlockAt(e.head),i=n.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?s.to:s.from)&&(i=n.moveToLineBoundary(e,t,!1)),!t&&i.head==s.from&&s.length){let r=/^\s*/.exec(n.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;r&&e.head!=s.from+r&&(i=te.cursor(s.from+r))}return i}const Nee=n=>tr(n,e=>za(n,e,!0)),Lee=n=>tr(n,e=>za(n,e,!1)),Dee=n=>tr(n,e=>za(n,e,!as(n))),jee=n=>tr(n,e=>za(n,e,as(n))),Fee=n=>tr(n,e=>te.cursor(n.lineBlockAt(e.head).from,1)),zee=n=>tr(n,e=>te.cursor(n.lineBlockAt(e.head).to,-1));function Hee(n,e,t){let s=!1,i=Bu(n.selection,r=>{let o=Or(n,r.head,-1)||Or(n,r.head,1)||r.head>0&&Or(n,r.head-1,1)||r.headHee(n,e);function Ei(n,e,t){let s=Bu(n.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=e&&(i=te.range(i.head,i.anchor));let r=t(i);return te.range(i.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return s.eq(n.state.selection)?!1:(n.dispatch(er(n.state,s)),!0)}function UN(n,e){return Ei(n,e,t=>n.moveByChar(t,e))}const qN=n=>UN(n,!as(n)),VN=n=>UN(n,as(n));function WN(n,e){return Ei(n,e,t=>n.moveByGroup(t,e))}const Uee=n=>WN(n,!as(n)),qee=n=>WN(n,as(n)),Vee=n=>{let e=!as(n);return Ei(n,e,t=>tv(n.state,t,e))},Wee=n=>{let e=as(n);return Ei(n,e,t=>tv(n.state,t,e))};function GN(n,e){return Ei(n,e,t=>n.moveVertically(t,e))}const KN=n=>GN(n,!1),ZN=n=>GN(n,!0);function XN(n,e){return Ei(n,e,t=>n.moveVertically(t,e,HN(n).height))}const MC=n=>XN(n,!1),IC=n=>XN(n,!0),Gee=n=>Ei(n,!0,e=>za(n,e,!0)),Kee=n=>Ei(n,!1,e=>za(n,e,!1)),Zee=n=>{let e=!as(n);return Ei(n,e,t=>za(n,t,e))},Xee=n=>{let e=as(n);return Ei(n,e,t=>za(n,t,e))},Yee=n=>Ei(n,!1,e=>te.cursor(n.lineBlockAt(e.head).from)),Jee=n=>Ei(n,!0,e=>te.cursor(n.lineBlockAt(e.head).to)),OC=({state:n,dispatch:e})=>(e(er(n,{anchor:0})),!0),NC=({state:n,dispatch:e})=>(e(er(n,{anchor:n.doc.length})),!0),LC=({state:n,dispatch:e})=>(e(er(n,{anchor:n.selection.main.anchor,head:0})),!0),DC=({state:n,dispatch:e})=>(e(er(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Qee=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),ete=({state:n,dispatch:e})=>{let t=nv(n).map(({from:s,to:i})=>te.undirectionalRange(s,Math.min(i+1,n.doc.length)));return e(n.update({selection:te.create(t),userEvent:"select"})),!0},tte=({state:n,dispatch:e})=>{let t=Bu(n.selection,s=>{let i=Na(n),r=i.resolveStack(s.from,1);if(s.empty){let o=i.resolveStack(s.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:a}=o;if((a.from=s.to||a.to>s.to&&a.from<=s.from)&&o.next)return te.undirectionalRange(a.from,a.to)}return s});return t.eq(n.selection)?!1:(e(er(n,t)),!0)};function YN(n,e){let{state:t}=n,s=t.selection,i=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to0)for(let a=r;;){let l=n.moveVertically(a,e);if(l.heado.to){i.some(c=>c.head==l.head)||i.push(l);break}else{if(l.head==a.head)break;a=l}}}return i.length==s.ranges.length?!1:(n.dispatch(er(t,te.create(i,i.length-1))),!0)}const nte=n=>YN(n,!1),ste=n=>YN(n,!0),ite=({state:n,dispatch:e})=>{let t=n.selection,s=null;return t.ranges.length>1?s=te.create([t.main]):t.main.empty||(s=te.create([te.cursor(t.main.head)])),s?(e(er(n,s)),!0):!1};function lm(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:s}=n,i=s.changeByRange(r=>{let{from:o,to:a}=r;if(o==a){let l=e(r);lo&&(t="delete.forward",l=tg(n,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=tg(n,o,!1),a=tg(n,a,!0);return o==a?{range:r}:{changes:{from:o,to:a},range:te.cursor(o,oi(n)))s.between(e,e,(i,r)=>{ie&&(e=t?r:i)});return e}const JN=(n,e,t)=>lm(n,s=>{let i=s.from,{state:r}=n,o=r.doc.lineAt(i),a,l;if(t&&!e&&i>o.from&&iJN(n,!1,!0),QN=n=>JN(n,!0,!1),eL=(n,e)=>lm(n,t=>{let s=t.head,{state:i}=n,r=i.doc.lineAt(s),o=i.charCategorizer(s);for(let a=null;;){if(s==(e?r.to:r.from)){s==t.head&&r.number!=(e?i.doc.lines:1)&&(s+=e?1:-1);break}let l=$n(r.text,s-r.from,e)+r.from,c=r.text.slice(Math.min(s,l)-r.from,Math.max(s,l)-r.from),h=o(c);if(a!=null&&h!=a)break;(c!=" "||s!=t.head)&&(a=h),s=l}return s}),tL=n=>eL(n,!1),rte=n=>eL(n,!0),ote=n=>lm(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headlm(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),lte=n=>lm(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(s=>({changes:{from:s.from,to:s.to,insert:lt.of(["",""])},range:te.cursor(s.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},hte=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(s=>{if(!s.empty||s.from==0||s.from==n.doc.length)return{range:s};let i=s.from,r=n.doc.lineAt(i),o=i==r.from?i-1:$n(r.text,i-r.from,!1)+r.from,a=i==r.to?i+1:$n(r.text,i-r.from,!0)+r.from;return{changes:{from:o,to:a,insert:n.doc.slice(i,a).append(n.doc.slice(o,i))},range:te.cursor(a)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function nv(n){let e=[],t=-1;for(let s of n.selection.ranges){let i=n.doc.lineAt(s.from),r=n.doc.lineAt(s.to);if(!s.empty&&s.to==r.from&&(r=n.doc.lineAt(s.to-1)),t>=i.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(s)}else e.push({from:i.from,to:r.to,ranges:[s]});t=r.number+1}return e}function nL(n,e,t){if(n.readOnly)return!1;let s=[],i=[];for(let r of nv(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),a=o.length+1;if(t){s.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let l of r.ranges)i.push(te.range(Math.min(n.doc.length,l.anchor+a),Math.min(n.doc.length,l.head+a)))}else{s.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let l of r.ranges)i.push(te.range(l.anchor-a,l.head-a))}}return s.length?(e(n.update({changes:s,scrollIntoView:!0,selection:te.create(i,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const ute=({state:n,dispatch:e})=>nL(n,e,!1),dte=({state:n,dispatch:e})=>nL(n,e,!0);function sL(n,e,t){if(n.readOnly)return!1;let s=[];for(let r of nv(n))t?s.push({from:r.from,insert:n.doc.slice(r.from,r.to)+n.lineBreak}):s.push({from:r.to,insert:n.lineBreak+n.doc.slice(r.from,r.to)});let i=n.changes(s);return e(n.update({changes:i,selection:n.selection.map(i,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const fte=({state:n,dispatch:e})=>sL(n,e,!1),pte=({state:n,dispatch:e})=>sL(n,e,!0),mte=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(nv(e).map(({from:i,to:r})=>(i>0?i--:r{let r;if(n.lineWrapping){let o=n.lineBlockAt(i.head),a=n.coordsAtPos(i.head,i.assoc||1);a&&(r=o.bottom+n.documentTop-a.bottom+n.defaultLineHeight/2)}return n.moveVertically(i,!0,r)}).map(t);return n.dispatch({changes:t,selection:s,scrollIntoView:!0,userEvent:"delete.line"}),!0};function gte(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Na(n).resolveInner(e),s=t.childBefore(e),i=t.childAfter(e),r;return s&&i&&s.to<=e&&i.from>=e&&(r=s.type.prop(nt.closedBy))&&r.indexOf(i.name)>-1&&n.doc.lineAt(s.to).from==n.doc.lineAt(i.from).from&&!/\S/.test(n.sliceDoc(s.to,i.from))?{from:s.to,to:i.from}:null}const jC=iL(!1),yte=iL(!0);function iL(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let s=e.changeByRange(i=>{let{from:r,to:o}=i,a=e.doc.lineAt(r),l=!n&&r==o&>e(e,r);n&&(r=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new J0(e,{simulateBreak:r,simulateDoubleBreak:!!l}),h=gN(c,r);for(h==null&&(h=V0(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));oa.from&&r{let i=[];for(let o=s.from;o<=s.to;){let a=n.doc.lineAt(o);a.number>t&&(s.empty||s.to>a.from)&&(e(a,i,s),t=a.number),o=a.to+1}let r=n.changes(i);return{changes:i,range:te.range(r.mapPos(s.anchor,1),r.mapPos(s.head,1))}})}const vte=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),s=new J0(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),i=aA(n,(r,o,a)=>{let l=gN(s,r.from);if(l==null)return;/\S/.test(r.text)||(l=0);let c=/^\s*/.exec(r.text)[0],h=jy(n,l);(c!=h||a.fromn.readOnly?!1:(e(n.update(aA(n,(t,s)=>{s.push({from:t.from,insert:n.facet(eA)})}),{userEvent:"input.indent"})),!0),oL=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(aA(n,(t,s)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let r=V0(i,n.tabSize),o=0,a=jy(n,Math.max(0,r-Ac(n)));for(;o(n.setTabFocusMode(),!0),wte=[{key:"Ctrl-b",run:NN,shift:qN,preventDefault:!0},{key:"Ctrl-f",run:LN,shift:VN},{key:"Ctrl-p",run:FN,shift:KN},{key:"Ctrl-n",run:zN,shift:ZN},{key:"Ctrl-a",run:Fee,shift:Yee},{key:"Ctrl-e",run:zee,shift:Jee},{key:"Ctrl-d",run:QN},{key:"Ctrl-h",run:Y_},{key:"Ctrl-k",run:ote},{key:"Ctrl-Alt-h",run:tL},{key:"Ctrl-o",run:cte},{key:"Ctrl-t",run:hte},{key:"Ctrl-v",run:X_}],_te=[{key:"ArrowLeft",run:NN,shift:qN,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Pee,shift:Uee,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Dee,shift:Zee,preventDefault:!0},{key:"ArrowRight",run:LN,shift:VN,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Ree,shift:qee,preventDefault:!0},{mac:"Cmd-ArrowRight",run:jee,shift:Xee,preventDefault:!0},{key:"ArrowUp",run:FN,shift:KN,preventDefault:!0},{mac:"Cmd-ArrowUp",run:OC,shift:LC},{mac:"Ctrl-ArrowUp",run:RC,shift:MC},{key:"ArrowDown",run:zN,shift:ZN,preventDefault:!0},{mac:"Cmd-ArrowDown",run:NC,shift:DC},{mac:"Ctrl-ArrowDown",run:X_,shift:IC},{key:"PageUp",run:RC,shift:MC},{key:"PageDown",run:X_,shift:IC},{key:"Home",run:Lee,shift:Kee,preventDefault:!0},{key:"Mod-Home",run:OC,shift:LC},{key:"End",run:Nee,shift:Gee,preventDefault:!0},{key:"Mod-End",run:NC,shift:DC},{key:"Enter",run:jC,shift:jC},{key:"Mod-a",run:Qee},{key:"Backspace",run:Y_,shift:Y_,preventDefault:!0},{key:"Delete",run:QN,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:tL,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:rte,preventDefault:!0},{mac:"Mod-Backspace",run:ate,preventDefault:!0},{mac:"Mod-Delete",run:lte,preventDefault:!0}].concat(wte.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),Ste=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Iee,shift:Vee},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Oee,shift:Wee},{key:"Alt-ArrowUp",run:ute},{key:"Shift-Alt-ArrowUp",run:fte},{key:"Alt-ArrowDown",run:dte},{key:"Shift-Alt-ArrowDown",run:pte},{key:"Mod-Alt-ArrowUp",run:nte},{key:"Mod-Alt-ArrowDown",run:ste},{key:"Escape",run:ite},{key:"Mod-Enter",run:yte},{key:"Alt-l",mac:"Ctrl-l",run:ete},{key:"Mod-i",run:tte,preventDefault:!0},{key:"Mod-[",run:oL},{key:"Mod-]",run:rL},{key:"Mod-Alt-\\",run:vte},{key:"Shift-Mod-k",run:mte},{key:"Shift-Mod-\\",run:Bee},{key:"Mod-/",run:uee},{key:"Alt-A",mac:"Ctrl-A",run:fee},{key:"Ctrl-m",mac:"Shift-Alt-m",run:bte}].concat(_te),xte={key:"Tab",run:rL,shift:oL};function aL(n){function e(u,d){u.cmdState.push(d)}function t(u){return u.cmdState.length>0?u.cmdState[u.cmdState.length-1]:null}function s(u){var d=u.cmdState.pop();d&&d.closeBracket()}function i(u){for(var d=u.cmdState,p=d.length-1;p>=0;p--){var m=d[p];if(m.name!="DEFAULT")return m}return{styleIdentifier:function(){return null}}}function r(u,d,p){return function(){this.name=u,this.bracketNo=0,this.style=d,this.styles=p,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var o={};o.importmodule=r("importmodule","tag",["string","builtin"]),o.documentclass=r("documentclass","tag",["","atom"]),o.usepackage=r("usepackage","tag",["atom"]),o.begin=r("begin","tag",["atom"]),o.end=r("end","tag",["atom"]),o.label=r("label","tag",["atom"]),o.ref=r("ref","tag",["atom"]),o.eqref=r("eqref","tag",["atom"]),o.cite=r("cite","tag",["atom"]),o.bibitem=r("bibitem","tag",["atom"]),o.Bibitem=r("Bibitem","tag",["atom"]),o.RBibitem=r("RBibitem","tag",["atom"]),o.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function a(u,d){u.f=d}function l(u,d){var p;if(u.match(/^\\[a-zA-Z@\xc0-\u1fff\u2060-\uffff]+/)){var m=u.current().slice(1);return p=o.hasOwnProperty(m)?o[m]:o.DEFAULT,p=new p,e(d,p),a(d,h),p.style}if(u.match(/^\\[$&%#{}_]/)||u.match(/^\\[,;!\/\\]/))return"tag";if(u.match("\\["))return a(d,function(v,g){return c(v,g,"\\]")}),"keyword";if(u.match("\\("))return a(d,function(v,g){return c(v,g,"\\)")}),"keyword";if(u.match("$$"))return a(d,function(v,g){return c(v,g,"$$")}),"keyword";if(u.match("$"))return a(d,function(v,g){return c(v,g,"$")}),"keyword";var y=u.next();if(y=="%")return u.skipToEnd(),"comment";if(y=="}"||y=="]"){if(p=t(d),p)p.closeBracket(y),a(d,h);else return"error";return"bracket"}else return y=="{"||y=="["?(p=o.DEFAULT,p=new p,e(d,p),"bracket"):/\d/.test(y)?(u.eatWhile(/[\w.%]/),"atom"):(u.eatWhile(/[\w\-_]/),p=i(d),p.name=="begin"&&(p.argument=u.current()),p.styleIdentifier())}function c(u,d,p){if(u.eatSpace())return null;if(p&&u.match(p))return a(d,l),"keyword";if(u.match(/^\\[a-zA-Z@]+/))return"tag";if(u.match(/^[a-zA-Z]+/))return"variableName.special";if(u.match(/^\\[$&%#{}_]/)||u.match(/^\\[,;!\/]/)||u.match(/^[\^_&]/))return"tag";if(u.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(u.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var m=u.next();return m=="{"||m=="}"||m=="["||m=="]"||m=="("||m==")"?"bracket":m=="%"?(u.skipToEnd(),"comment"):"error"}function h(u,d){var p=u.peek(),m;return p=="{"||p=="["?(m=t(d),m.openBracket(p),u.eat(p),a(d,l),"bracket"):/[ \t\r]/.test(p)?(u.eat(p),null):(a(d,l),s(d),l(u,d))}return{name:"stex",startState:function(){var u=n?function(d,p){return c(d,p)}:l;return{cmdState:[],f:u}},copyState:function(u){return{cmdState:u.cmdState.slice(),f:u.f}},token:function(u,d){return d.f(u,d)},blankLine:function(u){u.f=l,u.cmdState.length=0},languageData:{commentTokens:{line:"%"}}}}const Ate=aL(!1);aL(!0);const FC=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class Iu{constructor(e,t,s=0,i=e.length,r,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(s,i),this.bufferStart=s,this.normalize=r?a=>r(FC(a)):FC,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return qI(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=ZY(e),s=this.bufferStart+this.bufferPos;this.bufferPos+=VI(e);let i=this.normalize(t);if(i.length)for(let r=0,o=s,a=!0;;r++){let l=i.charCodeAt(r),c=this.match(l,o,a,this.bufferPos+this.bufferStart,r==i.length-1);if(c)return this.value=c,this;if(r==i.length-1)break;a&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let s=this.curLineStart+t.index,i=s+t[0].length;if(this.matchPos=zy(this.text,i+(s==i?1:0)),s==this.curLineStart+this.curLine.length&&this.nextLine(),(sthis.value.to)&&(!this.test||this.test(s,i,t)))return this.value={from:s,to:i,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=s||i.to<=t){let a=new vh(t,e.sliceString(t,s));return tb.set(e,a),a}if(i.from==t&&i.to==s)return i;let{text:r,from:o}=i;return o>t&&(r=e.sliceString(t,o)+r,o=t),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let s=this.flat.from+t.index,i=s+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(s,i,t)))return this.value={from:s,to:i,precise:!0,match:t},this.matchPos=zy(this.text,i+(s==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=vh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(cL.prototype[Symbol.iterator]=hL.prototype[Symbol.iterator]=function(){return this});function kte(n){try{return new RegExp(n,lA),!0}catch{return!1}}function zy(n,e){if(e>=n.length)return e;let t=n.lineAt(e),s;for(;e=56320&&s<57344;)e++;return e}const Ete=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:s,result:i}=hQ(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return i.then(r=>{let o=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!o){n.dispatch({effects:s});return}let a=e.doc.lineAt(e.selection.main.head),[,l,c,h,u]=o,d=h?+h.slice(1):0,p=c?+c:a.number;if(c&&u){let v=p/100;l&&(v=v*(l=="-"?-1:1)+a.number/e.doc.lines),p=Math.round(e.doc.lines*v)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=e.doc.line(Math.max(1,Math.min(e.doc.lines,p))),y=te.cursor(m.from+Math.max(0,Math.min(d,m.length)));n.dispatch({effects:[s,xe.scrollIntoView(y.from,{y:"center"})],selection:y})}),!0},Cte={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},$te=be.define({combine(n){return Hu(n,Cte,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Tte(n){return[Ote,Ite]}const Pte=Qe.mark({class:"cm-selectionMatch"}),Rte=Qe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function zC(n,e,t,s){return(t==0||n(e.sliceDoc(t-1,t))!=en.Word)&&(s==e.doc.length||n(e.sliceDoc(s,s+1))!=en.Word)}function Mte(n,e,t,s){return n(e.sliceDoc(t,t+1))==en.Word&&n(e.sliceDoc(s-1,s))==en.Word}const Ite=ri.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet($te),{state:t}=n,s=t.selection;if(s.ranges.length>1)return Qe.none;let i=s.main,r,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return Qe.none;let l=t.wordAt(i.head);if(!l)return Qe.none;o=t.charCategorizer(i.head),r=t.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l200)return Qe.none;if(e.wholeWords){if(r=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(zC(o,t,i.from,i.to)&&Mte(o,t,i.from,i.to)))return Qe.none}else if(r=t.sliceDoc(i.from,i.to),!r)return Qe.none}let a=[];for(let l of n.visibleRanges){let c=new Iu(t.doc,r,l.from,l.to);for(;!c.next().done;){let{from:h,to:u}=c.value;if((!o||zC(o,t,h,u))&&(i.empty&&h<=i.from&&u>=i.to?a.push(Rte.range(h,u)):(h>=i.to||u<=i.from)&&a.push(Pte.range(h,u)),a.length>e.maxMatches))return Qe.none}}return Qe.set(a)}},{decorations:n=>n.decorations}),Ote=xe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Nte=({state:n,dispatch:e})=>{let{selection:t}=n,s=te.create(t.ranges.map(i=>n.wordAt(i.head)||te.cursor(i.head)),t.mainIndex);return s.eq(t)?!1:(e(n.update({selection:s})),!0)};function Lte(n,e){let{main:t,ranges:s}=n.selection,i=n.wordAt(t.head),r=i&&i.from==t.from&&i.to==t.to;for(let o=!1,a=new Iu(n.doc,e,s[s.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Iu(n.doc,e,0,Math.max(0,s[s.length-1].from-1)),o=!0}else{if(o&&s.some(l=>l.from==a.value.from))continue;if(r){let l=n.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const Dte=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return Nte({state:n,dispatch:e});let s=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=s))return!1;let i=Lte(n,s);return i?(e(n.update({selection:n.selection.addRange(te.range(i.from,i.to),!1),effects:xe.scrollIntoView(i.to)})),!0):!1},Uu=be.define({combine(n){return Hu(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Yte(e),scrollToMatch:e=>xe.scrollIntoView(e)})}});class uL{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||kte(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,s)=>s=="n"?` -`:s=="r"?"\r":s=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Ute(this):new zte(this)}getCursor(e,t=0,s){let i=e.doc?e:at.create({doc:e});return s==null&&(s=i.doc.length),this.regexp?Qc(this,i,t,s):Jc(this,i,t,s)}}class dL{constructor(e){this.spec=e}}function jte(n,e,t){return(s,i,r,o)=>{if(t&&!t(s,i,r,o))return!1;let a=s>=o&&i<=o+r.length?r.slice(s-o,i-o):e.doc.sliceString(s,i);return n(a,e,s,i)}}function Jc(n,e,t,s){let i;return n.wholeWord&&(i=Fte(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(i=jte(n.test,e,i)),new Iu(e.doc,n.unquoted,t,s,n.caseSensitive?void 0:r=>r.toLowerCase(),i)}function Fte(n,e){return(t,s,i,r)=>((r>t||r+i.length=t)return null;i.push(s.value)}return i}highlight(e,t,s,i){let r=Jc(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(s+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}function Hte(n,e,t){return(s,i,r)=>(!t||t(s,i,r))&&n(r[0],e,s,i)}function Qc(n,e,t,s){let i;return n.wholeWord&&(i=Bte(e.charCategorizer(e.selection.main.head))),n.test&&(i=Hte(n.test,e,i)),new cL(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:i},t,s)}function Hy(n,e){return n.slice($n(n,e,!1),e)}function By(n,e){return n.slice(e,$n(n,e))}function Bte(n){return(e,t,s)=>!s[0].length||(n(Hy(s.input,s.index))!=en.Word||n(By(s.input,s.index))!=en.Word)&&(n(By(s.input,s.index+s[0].length))!=en.Word||n(Hy(s.input,s.index+s[0].length))!=en.Word)}class Ute extends dL{nextMatch(e,t,s){let i=Qc(this.spec,e,s,e.doc.length).next();return i.done&&(i=Qc(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,s){for(let i=1;;i++){let r=Math.max(t,s-i*1e4),o=Qc(this.spec,e,r,s),a=null;for(;!o.next().done;)a=o.value;if(a&&(r==t||a.from>r+10))return a;if(r==t)return null}}prevMatch(e,t,s){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,s,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,s)=>{if(s=="&")return e.match[0];if(s=="$")return"$";for(let i=s.length;i>0;i--){let r=+s.slice(0,i);if(r>0&&r=t)return null;i.push(s.value)}return i}highlight(e,t,s,i){let r=Qc(this.spec,e,Math.max(0,t-250),Math.min(s+250,e.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}const bf=St.define(),cA=St.define(),Ca=Fr.define({create(n){return new nb(J_(n).create(),null)},update(n,e){for(let t of e.effects)t.is(bf)?n=new nb(t.value.create(),n.panel):t.is(cA)&&(n=new nb(n.query,t.value?hA:null));return n},provide:n=>Ny.from(n,e=>e.panel)});class nb{constructor(e,t){this.query=e,this.panel=t}}const qte=Qe.mark({class:"cm-searchMatch"}),Vte=Qe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Wte=ri.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(Ca))}update(n){let e=n.state.field(Ca);(e!=n.startState.field(Ca)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Qe.none;let{view:t}=this,s=new uf;for(let i=0,r=t.visibleRanges,o=r.length;ir[i+1].from-2*250;)l=r[++i].to;n.highlight(t.state,a,l,(c,h)=>{let u=t.state.selection.ranges.some(d=>d.from==c&&d.to==h);s.add(c,h,u?Vte:qte)})}return s.finish()}},{decorations:n=>n.decorations});function cm(n){return e=>{let t=e.state.field(Ca,!1);return t&&t.query.spec.valid?n(e,t):mL(e)}}const Uy=cm((n,{query:e})=>{let{to:t}=n.state.selection.main,s=e.nextMatch(n.state,t,t);if(!s)return!1;let i=te.single(s.from,s.to),r=n.state.facet(Uu);return n.dispatch({selection:i,effects:[uA(n,s),r.scrollToMatch(i.main,n)],userEvent:"select.search"}),pL(n),!0}),qy=cm((n,{query:e})=>{let{state:t}=n,{from:s}=t.selection.main,i=e.prevMatch(t,s,s);if(!i)return!1;let r=te.single(i.from,i.to),o=n.state.facet(Uu);return n.dispatch({selection:r,effects:[uA(n,i),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),pL(n),!0}),Gte=cm((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:te.create(t.map(s=>te.range(s.from,s.to))),userEvent:"select.search.matches"}),!0)}),Kte=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:s,to:i}=t.main,r=[],o=0;for(let a=new Iu(n.doc,n.sliceDoc(s,i));!a.next().done;){if(r.length>1e3)return!1;a.value.from==s&&(o=r.length),r.push(te.range(a.value.from,a.value.to))}return e(n.update({selection:te.create(r,o),userEvent:"select.search.matches"})),!0},HC=cm((n,{query:e})=>{let{state:t}=n,{from:s,to:i}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,s,s);if(!r)return!1;let o=r,a=[],l,c,h=[];o.precise?o.from==s&&o.to==i&&(c=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(t,o.from,o.to),h.push(xe.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(s).number)+"."))):o=e.nextMatch(t,o.from,o.to);let u=n.state.changes(a);return o&&(l=te.single(o.from,o.to).map(u),h.push(uA(n,o)),h.push(t.facet(Uu).scrollToMatch(l.main,n))),n.dispatch({changes:u,selection:l,effects:h,userEvent:"input.replace"}),!0}),Zte=cm((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let i of e.matchAll(n.state,1e9)){let{from:r,to:o,precise:a}=i;a&&t.push({from:r,to:o,insert:e.getReplacement(i)})}if(!t.length)return!1;let s=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:xe.announce.of(s),userEvent:"input.replace.all"}),!0});function hA(n){return n.state.facet(Uu).createPanel(n)}function J_(n,e){var t,s,i,r,o;let a=n.selection.main,l=a.empty||a.to>a.from+100?"":n.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=n.facet(Uu);return new uL({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(s=e==null?void 0:e.caseSensitive)!==null&&s!==void 0?s:c.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function fL(n){let e=oN(n,hA);return e&&e.dom.querySelector("[main-field]")}function pL(n){let e=fL(n);e&&e==n.root.activeElement&&e.select()}const mL=n=>{let e=n.state.field(Ca,!1);if(e&&e.panel){let t=fL(n);if(t&&t!=n.root.activeElement){let s=J_(n.state,e.query.spec);s.valid&&n.dispatch({effects:bf.of(s)}),t.focus(),t.select()}}else n.dispatch({effects:[cA.of(!0),e?bf.of(J_(n.state,e.query.spec)):St.appendConfig.of(Qte)]});return!0},gL=n=>{let e=n.state.field(Ca,!1);if(!e||!e.panel)return!1;let t=oN(n,hA);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:cA.of(!1)}),!0},Xte=[{key:"Mod-f",run:mL,scope:"editor search-panel"},{key:"F3",run:Uy,shift:qy,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Uy,shift:qy,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:gL,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Kte},{key:"Mod-Alt-g",run:Ete},{key:"Mod-d",run:Dte,preventDefault:!0}];class Yte{constructor(e){this.view=e;let t=this.query=e.state.field(Ca).query.spec;this.commit=this.commit.bind(this),this.searchField=Cn("input",{value:t.search,placeholder:Vs(e,"Find"),"aria-label":Vs(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Cn("input",{value:t.replace,placeholder:Vs(e,"Replace"),"aria-label":Vs(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Cn("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Cn("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Cn("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function s(i,r,o){return Cn("button",{class:"cm-button",name:i,onclick:r,type:"button"},o)}this.dom=Cn("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,s("next",()=>Uy(e),[Vs(e,"next")]),s("prev",()=>qy(e),[Vs(e,"previous")]),s("select",()=>Gte(e),[Vs(e,"all")]),Cn("label",null,[this.caseField,Vs(e,"match case")]),Cn("label",null,[this.reField,Vs(e,"regexp")]),Cn("label",null,[this.wordField,Vs(e,"by word")]),...e.state.readOnly?[]:[Cn("br"),this.replaceField,s("replace",()=>HC(e),[Vs(e,"replace")]),s("replaceAll",()=>Zte(e),[Vs(e,"replace all")])],Cn("button",{name:"close",onclick:()=>gL(e),"aria-label":Vs(e,"close"),type:"button"},["×"])])}commit(){let e=new uL({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:bf.of(e)}))}keydown(e){XJ(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?qy:Uy)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),HC(this.view))}update(e){for(let t of e.transactions)for(let s of t.effects)s.is(bf)&&!s.value.eq(this.query)&&this.setQuery(s.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Uu).top}}function Vs(n,e){return n.state.phrase(e)}const ng=30,sg=/[\s\.,:;?!]/;function uA(n,{from:e,to:t}){let s=n.state.doc.lineAt(e),i=n.state.doc.lineAt(t).to,r=Math.max(s.from,e-ng),o=Math.min(i,t+ng),a=n.state.sliceDoc(r,o);if(r!=s.from){for(let l=0;la.length-ng;l--)if(!sg.test(a[l-1])&&sg.test(a[l])){a=a.slice(0,l);break}}return xe.announce.of(`${n.state.phrase("current match")}. ${a} ${n.state.phrase("on line")} ${s.number}.`)}const Jte=xe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Qte=[Ca,q0.low(Wte),Jte],ene=({path:n,value:e,readOnly:t,onChange:s})=>{const i=ee.useRef(null),r=ee.useRef(null),o=ee.useRef(new im),a=ee.useRef(s);return a.current=s,ee.useEffect(()=>{if(!i.current)return;const l=at.create({doc:e,extensions:[wQ(),nQ(),aQ(),wee(),Tte(),eee(),nA.define(Ate),eN.of([...Ste,...Tee,...Xte,xte]),xe.contentAttributes.of({"aria-label":`Editing ${n}`,class:"ph-no-capture","data-ph-no-autocapture":"true","data-ph-no-capture":"true"}),o.current.of(xe.editable.of(!t)),xe.updateListener.of(c=>{c.docChanged&&a.current(c.state.doc.toString())})]});return r.current=new xe({state:l,parent:i.current}),()=>{var c;return(c=r.current)==null?void 0:c.destroy()}},[n]),ee.useEffect(()=>{const l=r.current;!l||l.state.doc.toString()===e||l.dispatch({changes:{from:0,to:l.state.doc.length,insert:e}})},[e]),ee.useEffect(()=>{var l;(l=r.current)==null||l.dispatch({effects:o.current.reconfigure(xe.editable.of(!t))})},[t]),S.jsx("div",{className:"latex-source-editor ph-no-capture","data-ph-no-autocapture":"true","data-ph-no-capture":"true","data-testid":"latex-source-editor",ref:i})},tne="pwc:artifact-navigation";function dse(){return typeof window>"u"?!0:window.dispatchEvent(new Event(tne,{cancelable:!0}))}const yL=()=>({open:!1,selectedKey:null,selected:null,selectedVersionId:null,tab:"preview",sourceFile:null,panelPercent:55,requestNonce:0,registry:{},autoOpened:{},manuallyClosed:{}});function nne(n,e){if(e.type==="reset")return{...yL(),panelPercent:n.panelPercent};if(e.type==="register"){const t=n.registry[e.key];if(t&&JSON.stringify(t)===JSON.stringify(e.block))return n;const s={...n.registry,[e.key]:e.block},i=n.selectedKey===e.key?e.block:n.selected,r=(t==null?void 0:t.status)==="generating"&&e.block.status==="ready",o=e.autoOpenOnMount&&!t&&e.block.status==="ready"&&!Object.values(n.autoOpened).some(Boolean);return(r||o)&&!n.autoOpened[e.key]&&!n.manuallyClosed[e.key]?{...n,registry:s,open:!0,selectedKey:e.key,selected:e.block,selectedVersionId:e.block.version_id??null,tab:"preview",sourceFile:null,requestNonce:n.requestNonce+1,autoOpened:{...n.autoOpened,[e.key]:!0}}:{...n,registry:s,selected:i}}return e.type==="unregister"?n:e.type==="open"?{...n,open:!0,selectedKey:e.key,selected:e.block,selectedVersionId:e.block.version_id??null,tab:"preview",sourceFile:null,requestNonce:n.requestNonce+1,manuallyClosed:{...n.manuallyClosed,[e.key]:!1}}:e.type==="close"?{...n,open:!1,manuallyClosed:n.selectedKey?{...n.manuallyClosed,[n.selectedKey]:!0}:n.manuallyClosed}:e.type==="tab"?{...n,tab:e.tab}:e.type==="source"?{...n,sourceFile:e.path}:e.type==="version"?{...n,selectedVersionId:e.versionId,tab:"preview",sourceFile:null}:{...n,panelPercent:e.percent}}function Q_(n){return n.publication_id||n.public_capability||n.version_id||`${n.scope}:${n.identifier}:${n.version??"pending"}`}const vL=ee.createContext(null),fse=({children:n,workspaceKey:e,autoOpenOnMount:t=!1,onAskAiFix:s})=>{const[i,r]=ee.useReducer(nne,void 0,yL),o=ee.useRef(null),a=ee.useRef(e);ee.useEffect(()=>{a.current!==e&&(a.current=e,o.current=null,r({type:"reset"}))},[e]);const l=ee.useCallback(()=>{r({type:"close"}),window.setTimeout(()=>{var b;(b=o.current)!=null&&b.isConnected&&o.current.focus()},0)},[]),c=ee.useCallback(b=>r({type:"register",key:Q_(b),block:b,autoOpenOnMount:t}),[t]),h=ee.useCallback(b=>r({type:"unregister",key:b}),[]),u=ee.useCallback((b,x)=>{const A=document.activeElement;o.current=x??(A instanceof HTMLElement&&A!==document.body?A:null),r({type:"open",key:Q_(b),block:b})},[]),d=ee.useCallback(b=>r({type:"tab",tab:b}),[]),p=ee.useCallback(b=>r({type:"source",path:b}),[]),m=ee.useCallback(b=>r({type:"version",versionId:b}),[]),y=ee.useCallback(b=>r({type:"width",percent:b}),[]),v=ee.useCallback(b=>s==null?void 0:s(b),[s]),g=ee.useCallback(()=>r({type:"reset"}),[]),_=ee.useMemo(()=>({state:i,autoOpenOnMount:t,register:c,unregister:h,open:u,close:l,setTab:d,setSourceFile:p,setVersion:m,setPanelPercent:y,askAiToFix:v,reset:g}),[v,t,l,u,c,g,y,p,d,m,i,h]);return S.jsx(vL.Provider,{value:_,children:n})};function hm(){const n=ee.useContext(vL);if(!n)throw new Error("Poster artifacts require an ArtifactPanelProvider");return n}function sne(n,e,t){return rn(`/api/v1/chat/artifacts/${encodeURIComponent(n)}/versions/${encodeURIComponent(e)}/source/${t.split("/").map(encodeURIComponent).join("/")}`)}function ine(n,e,t){return rn(`/api/v1/chat/artifacts/${encodeURIComponent(n)}/versions/${encodeURIComponent(e)}/figures/${t.split("/").map(encodeURIComponent).join("/")}`)}function rne(n){return rn(`/api/v1/chat/artifacts/${encodeURIComponent(n)}/export/pdf`)}function BC(n,e){return rn(`/api/v1/chat/artifacts/${encodeURIComponent(n)}/versions/${encodeURIComponent(e)}/export/source.zip`)}function ig(n){return`pwc:latex-paper-draft:${n}`}function one(n,e){const t=Object.keys(n).sort(),s=Object.keys(e).sort();return t.length===s.length&&t.every((i,r)=>i===s[r]&&n[i]===e[i])}function UC(n){return!n.includes("\\")&&/^(?!\/)(?!.*(?:^|\/)\.\.?\/)[^\0]{1,300}\.(?:tex|bib)$/iu.test(n)}function ane(n){var s,i;const e=((s=n.provenance)==null?void 0:s.action)??(n.actor_type==="restore"?"restore":n.actor_type==="ai"?"ai_draft":"human_save"),t={human_save:"Human save",ai_draft:"AI draft",ai_repair:"AI repair",restore:"Restore"}[e];return(i=n.provenance)!=null&&i.model_identity?`${t} · ${n.provenance.model_identity}`:t}const lne=({block:n,forceDialog:e=!1})=>{var ks,cs,wn,Kt,Zn,an,Es,qu,Io;const t=hm(),s=ZC(),i=t.close,[r,o]=ee.useState(()=>{var V;return typeof window<"u"&&((V=window.matchMedia)==null?void 0:V.call(window,"(max-width: 760px)").matches)}),[a,l]=ee.useState({}),[c,h]=ee.useState({}),[u,d]=ee.useState(null),[p,m]=ee.useState(!1),[y,v]=ee.useState(!1),[g,_]=ee.useState(null),[b,x]=ee.useState(!1),[A,T]=ee.useState(null),C=ee.useRef(null),I=ee.useRef(null),D=ee.useRef(!1),H=e||r,j=u!==null&&!one(a,c);ee.useEffect(()=>{var Ce,rt;const V=(Ce=window.matchMedia)==null?void 0:Ce.call(window,"(max-width: 760px)");if(!V)return;const ye=()=>o(V.matches);return ye(),(rt=V.addEventListener)==null||rt.call(V,"change",ye),()=>{var qt;return(qt=V.removeEventListener)==null?void 0:qt.call(V,"change",ye)}},[]),ee.useEffect(()=>{var Ce,rt;if(!H)return;(rt=(Ce=I.current)==null?void 0:Ce.querySelector("[data-artifact-close]"))==null||rt.focus(),window.history.pushState({...window.history.state,pwcArtifactPanel:!0},""),D.current=!0;const V=()=>{if(j&&!window.confirm("Leave this view? Unsaved paper edits remain in this browser.")){window.history.pushState({...window.history.state,pwcArtifactPanel:!0},""),D.current=!0;return}D.current=!1,i()},ye=qt=>{qt.key==="Escape"&&(qt.preventDefault(),!(j&&!window.confirm("Leave this view? Unsaved paper edits remain in this browser."))&&(i(),D.current&&(D.current=!1,window.history.back())))};return window.addEventListener("popstate",V),document.addEventListener("keydown",ye),()=>{window.removeEventListener("popstate",V),document.removeEventListener("keydown",ye)}},[i,H,j]),ee.useEffect(()=>{if(!H)return;const V=ye=>{if(ye.key!=="Tab"||!I.current)return;const Ce=[...I.current.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), [contenteditable="true"], [tabindex]:not([tabindex="-1"])')];if(!Ce.length)return;const rt=Ce[0],qt=Ce.at(-1);ye.shiftKey&&document.activeElement===rt?(ye.preventDefault(),qt.focus()):!ye.shiftKey&&document.activeElement===qt&&(ye.preventDefault(),rt.focus())};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[H]),ee.useEffect(()=>{const V=ye=>{j&&(ye.preventDefault(),ye.returnValue="")};return window.addEventListener("beforeunload",V),()=>window.removeEventListener("beforeunload",V)},[j]),ee.useEffect(()=>{const V=ye=>{j&&!window.confirm("Leave this view? Unsaved paper edits remain in this browser.")&&ye.preventDefault()};return window.addEventListener("pwc:artifact-navigation",V),()=>window.removeEventListener("pwc:artifact-navigation",V)},[j]);const U=wo({queryKey:["chat-latex-paper",n.artifact_id],queryFn:async()=>{const V=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}`),{credentials:"include",cache:"no-store"});if(!V.ok)throw new Error("Could not load paper details");return V.json()},enabled:!!n.artifact_id,staleTime:5e3}),B=U.data,L=B==null?void 0:B.source_head,X=B==null?void 0:B.preview_head,se=wo({queryKey:["chat-latex-paper-history",n.artifact_id,A],queryFn:async()=>{const V=new URLSearchParams({limit:"20"});A&&V.set("cursor",A);const ye=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/versions?${V}`),{credentials:"include",cache:"no-store"});if(!ye.ok)throw new Error("Could not load paper history");return ye.json()},enabled:b&&!!n.artifact_id,staleTime:Number.POSITIVE_INFINITY}),J=wo({queryKey:["chat-latex-paper-manifest",n.artifact_id,L==null?void 0:L.version_id],queryFn:async()=>{const V=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/versions/${encodeURIComponent(L.version_id)}/manifest`),{credentials:"include",cache:"no-store"});if(!V.ok)throw new Error("Could not load paper files");return V.json()},enabled:t.state.tab==="files"&&!!(L!=null&&L.version_id),staleTime:Number.POSITIVE_INFINITY}),Y=((ks=J.data)==null?void 0:ks.files.filter(V=>V.media_type==="text/x-tex"||V.media_type==="application/x-bibtex"))??[],ge=((cs=J.data)==null?void 0:cs.files.filter(V=>V.media_type==="image/png"||V.media_type==="image/jpeg"||V.media_type==="application/pdf"))??[],z=wo({queryKey:["chat-latex-paper-source-files",n.artifact_id,L==null?void 0:L.version_id],queryFn:async()=>Object.fromEntries(await Promise.all(Y.map(async V=>{const ye=await fetch(sne(n.artifact_id,L.version_id,V.path),{credentials:"include",cache:"no-store"});if(!ye.ok)throw new Error("Could not load paper source");return[V.path,await ye.text()]}))),enabled:t.state.tab==="files"&&!!(L!=null&&L.version_id&&Y.length),staleTime:Number.POSITIVE_INFINITY});ee.useEffect(()=>{m(!1)},[L==null?void 0:L.version_id]),ee.useEffect(()=>{var qt;if(!(L!=null&&L.version_id)||!z.data||C.current===L.version_id)return;const V=z.data;let ye=V,Ce=!1,rt=L.version_id;try{const zr=window.localStorage.getItem(ig(n.artifact_id)),Cs=zr?JSON.parse(zr):null;Cs!=null&&Cs.files&&typeof Cs.files=="object"&&(ye=Cs.files,Ce=Cs.parentVersionId!==L.version_id,rt=Cs.parentVersionId)}catch{}C.current=L.version_id,l(ye),h(V),d(rt),v(Ce),m(!0),Ce&&_("This local draft is based on an older paper version. Copy or discard it before saving the latest version."),(!t.state.sourceFile||!ye[t.state.sourceFile])&&t.setSourceFile(((qt=J.data)==null?void 0:qt.root_document)??null)},[n.artifact_id,(wn=J.data)==null?void 0:wn.root_document,t,L==null?void 0:L.version_id,z.data]),ee.useEffect(()=>{if(!u||!n.artifact_id)return;const V=ig(n.artifact_id);if(!j){window.localStorage.removeItem(V);return}window.localStorage.setItem(V,JSON.stringify({parentVersionId:u,files:a}))},[n.artifact_id,j,u,a]);const E=ym({mutationFn:async()=>{var Ce;if(!(L!=null&&L.version_id))throw new Error("Paper source is not ready to save");const V=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/save-compile`),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({expected_parent_version_id:L.version_id,files:Object.entries(a).map(([rt,qt])=>({path:rt,content:qt}))})}),ye=await V.json().catch(()=>null);if(!V.ok)throw new Error(((Ce=ye==null?void 0:ye.detail)==null?void 0:Ce.message)??"Could not save paper");return ye},onSuccess:V=>{var ye,Ce;s.setQueryData(["chat-latex-paper",n.artifact_id],V),s.invalidateQueries({queryKey:["chat-latex-paper-manifest",n.artifact_id]}),s.invalidateQueries({queryKey:["chat-latex-paper-source-files",n.artifact_id]}),C.current=((ye=V.source_head)==null?void 0:ye.version_id)??null,h(a),d(((Ce=V.source_head)==null?void 0:Ce.version_id)??null),window.localStorage.removeItem(ig(n.artifact_id)),_(null),v(!1),t.setTab("preview")},onError:V=>_(V instanceof Error?V.message:"Could not save paper")}),O=ym({mutationFn:async V=>{var rt;if(!(L!=null&&L.version_id))throw new Error("Paper source is not ready to restore");const ye=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/versions/restore`),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({source_version_id:V,expected_parent_version_id:L.version_id})}),Ce=await ye.json().catch(()=>null);if(!ye.ok)throw new Error(((rt=Ce==null?void 0:Ce.detail)==null?void 0:rt.message)??"Could not restore paper version");return Ce},onSuccess:V=>{s.setQueryData(["chat-latex-paper",n.artifact_id],V),s.invalidateQueries({queryKey:["chat-latex-paper-history",n.artifact_id]}),s.invalidateQueries({queryKey:["chat-latex-paper-manifest",n.artifact_id]}),s.invalidateQueries({queryKey:["chat-latex-paper-source-files",n.artifact_id]}),C.current=null,m(!1),T(null),_(null),t.setTab("preview")},onError:V=>_(V instanceof Error?V.message:"Could not restore paper version")}),R=ym({mutationFn:async V=>{var qt;if(!(L!=null&&L.version_id))throw new Error("Paper source is not ready to upload a figure");if(j)throw new Error("Save or discard text edits before uploading a figure");const ye=new FormData;ye.set("expected_parent_version_id",L.version_id),ye.set("path",`figures/${V.name}`),ye.set("figure",V);const Ce=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/figures`),{method:"POST",credentials:"include",body:ye}),rt=await Ce.json().catch(()=>null);if(!Ce.ok)throw new Error(((qt=rt==null?void 0:rt.detail)==null?void 0:qt.message)??"Could not upload figure");return rt},onSuccess:V=>{s.setQueryData(["chat-latex-paper",n.artifact_id],V),s.invalidateQueries({queryKey:["chat-latex-paper-manifest",n.artifact_id]}),s.invalidateQueries({queryKey:["chat-latex-paper-source-files",n.artifact_id]}),_(null)},onError:V=>_(V instanceof Error?V.message:"Could not upload figure")}),k=ym({mutationFn:async()=>{const V=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/refresh-compile`),{method:"POST",credentials:"include"});if(!V.ok)throw new Error("Could not refresh paper compilation");return V.json()},onSuccess:V=>s.setQueryData(["chat-latex-paper",n.artifact_id],V)}).mutate,N=L==null?void 0:L.version_id,G=L==null?void 0:L.compile_status;ee.useEffect(()=>{if(!N||!n.artifact_id||!["queued","compiling"].includes(G??""))return;const V=window.setTimeout(()=>k(),2e3);return()=>window.clearTimeout(V)},[n.artifact_id,k,G,N]);const Z=t.state.sourceFile??((Kt=J.data)==null?void 0:Kt.root_document)??null,ae=(B==null?void 0:B.editing_enabled)===!0&&!!(L!=null&&L.version_id)&&p&&!y&&!E.isPending,ie=new Map(((Zn=se.data)==null?void 0:Zn.items.map(V=>[V.version_id,V.version]))??[]),Ae=X?rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/versions/${encodeURIComponent(X.version_id)}/preview`):null,ct=!!(L&&X&&L.version_id!==X.version_id),Ie=()=>!j||window.confirm("Leave this view? Unsaved paper edits remain in this browser."),Fe=V=>V!==t.state.tab&&!Ie()?!1:(t.setTab(V),!0),Je=V=>{var Ce,rt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(V.key))return;V.preventDefault();const ye=V.key==="ArrowLeft"||V.key==="Home"?"preview":"files";Fe(ye)&&((rt=(Ce=V.currentTarget.parentElement)==null?void 0:Ce.querySelector(`#paper-${ye}-tab`))==null||rt.focus())},it=V=>{V!==Z&&j&&!window.confirm("Switch files? Unsaved edits stay in this browser.")||t.setSourceFile(V)},bn=()=>{const V=window.prompt("New TeX or BibTeX file name","section.tex");if(V){if(!UC(V)||a[V]){_("Choose a new safe .tex or .bib filename.");return}if(Object.keys(a).length>=100){_("A paper can contain at most 100 files.");return}l({...a,[V]:""}),_(null),t.setSourceFile(V)}},ut=()=>{var Ce;if(!Z||Z===((Ce=J.data)==null?void 0:Ce.root_document))return;const V=window.prompt("Rename file",Z);if(!V||V===Z)return;if(!UC(V)||a[V]){_("Choose a new safe .tex or .bib filename.");return}const ye={...a,[V]:a[Z]};delete ye[Z],l(ye),t.setSourceFile(V)},Ss=()=>{var ye,Ce;if(!Z||Z===((ye=J.data)==null?void 0:ye.root_document)||!window.confirm(`Delete ${Z}?`))return;const V={...a};delete V[Z],l(V),t.setSourceFile(((Ce=J.data)==null?void 0:Ce.root_document)??null)},xs=()=>{!y||!window.confirm("Discard this stale local draft?")||(window.localStorage.removeItem(ig(n.artifact_id)),l(c),d((L==null?void 0:L.version_id)??null),v(!1),_(null))},Pn=()=>{Ie()&&(i(),H&&D.current&&(D.current=!1,window.history.back()))},ls=()=>{if(!L||L.compile_status!=="failed"||L.repair_exhausted)return;const V=(L.compile_diagnostics??[]).slice(0,20).map(ye=>`${ye.file??"project"}${ye.line?`:${ye.line}`:""}: ${ye.message}`).join(` +`:s=="r"?"\r":s=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Ute(this):new zte(this)}getCursor(e,t=0,s){let i=e.doc?e:at.create({doc:e});return s==null&&(s=i.doc.length),this.regexp?Qc(this,i,t,s):Jc(this,i,t,s)}}class dL{constructor(e){this.spec=e}}function jte(n,e,t){return(s,i,r,o)=>{if(t&&!t(s,i,r,o))return!1;let a=s>=o&&i<=o+r.length?r.slice(s-o,i-o):e.doc.sliceString(s,i);return n(a,e,s,i)}}function Jc(n,e,t,s){let i;return n.wholeWord&&(i=Fte(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(i=jte(n.test,e,i)),new Iu(e.doc,n.unquoted,t,s,n.caseSensitive?void 0:r=>r.toLowerCase(),i)}function Fte(n,e){return(t,s,i,r)=>((r>t||r+i.length=t)return null;i.push(s.value)}return i}highlight(e,t,s,i){let r=Jc(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(s+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}function Hte(n,e,t){return(s,i,r)=>(!t||t(s,i,r))&&n(r[0],e,s,i)}function Qc(n,e,t,s){let i;return n.wholeWord&&(i=Bte(e.charCategorizer(e.selection.main.head))),n.test&&(i=Hte(n.test,e,i)),new cL(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:i},t,s)}function Hy(n,e){return n.slice($n(n,e,!1),e)}function By(n,e){return n.slice(e,$n(n,e))}function Bte(n){return(e,t,s)=>!s[0].length||(n(Hy(s.input,s.index))!=en.Word||n(By(s.input,s.index))!=en.Word)&&(n(By(s.input,s.index+s[0].length))!=en.Word||n(Hy(s.input,s.index+s[0].length))!=en.Word)}class Ute extends dL{nextMatch(e,t,s){let i=Qc(this.spec,e,s,e.doc.length).next();return i.done&&(i=Qc(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,s){for(let i=1;;i++){let r=Math.max(t,s-i*1e4),o=Qc(this.spec,e,r,s),a=null;for(;!o.next().done;)a=o.value;if(a&&(r==t||a.from>r+10))return a;if(r==t)return null}}prevMatch(e,t,s){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,s,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,s)=>{if(s=="&")return e.match[0];if(s=="$")return"$";for(let i=s.length;i>0;i--){let r=+s.slice(0,i);if(r>0&&r=t)return null;i.push(s.value)}return i}highlight(e,t,s,i){let r=Qc(this.spec,e,Math.max(0,t-250),Math.min(s+250,e.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}const bf=St.define(),cA=St.define(),Ca=Fr.define({create(n){return new nb(J_(n).create(),null)},update(n,e){for(let t of e.effects)t.is(bf)?n=new nb(t.value.create(),n.panel):t.is(cA)&&(n=new nb(n.query,t.value?hA:null));return n},provide:n=>Ny.from(n,e=>e.panel)});class nb{constructor(e,t){this.query=e,this.panel=t}}const qte=Qe.mark({class:"cm-searchMatch"}),Vte=Qe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Wte=ri.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(Ca))}update(n){let e=n.state.field(Ca);(e!=n.startState.field(Ca)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Qe.none;let{view:t}=this,s=new uf;for(let i=0,r=t.visibleRanges,o=r.length;ir[i+1].from-2*250;)l=r[++i].to;n.highlight(t.state,a,l,(c,h)=>{let u=t.state.selection.ranges.some(d=>d.from==c&&d.to==h);s.add(c,h,u?Vte:qte)})}return s.finish()}},{decorations:n=>n.decorations});function cm(n){return e=>{let t=e.state.field(Ca,!1);return t&&t.query.spec.valid?n(e,t):mL(e)}}const Uy=cm((n,{query:e})=>{let{to:t}=n.state.selection.main,s=e.nextMatch(n.state,t,t);if(!s)return!1;let i=te.single(s.from,s.to),r=n.state.facet(Uu);return n.dispatch({selection:i,effects:[uA(n,s),r.scrollToMatch(i.main,n)],userEvent:"select.search"}),pL(n),!0}),qy=cm((n,{query:e})=>{let{state:t}=n,{from:s}=t.selection.main,i=e.prevMatch(t,s,s);if(!i)return!1;let r=te.single(i.from,i.to),o=n.state.facet(Uu);return n.dispatch({selection:r,effects:[uA(n,i),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),pL(n),!0}),Gte=cm((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:te.create(t.map(s=>te.range(s.from,s.to))),userEvent:"select.search.matches"}),!0)}),Kte=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:s,to:i}=t.main,r=[],o=0;for(let a=new Iu(n.doc,n.sliceDoc(s,i));!a.next().done;){if(r.length>1e3)return!1;a.value.from==s&&(o=r.length),r.push(te.range(a.value.from,a.value.to))}return e(n.update({selection:te.create(r,o),userEvent:"select.search.matches"})),!0},HC=cm((n,{query:e})=>{let{state:t}=n,{from:s,to:i}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,s,s);if(!r)return!1;let o=r,a=[],l,c,h=[];o.precise?o.from==s&&o.to==i&&(c=t.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(t,o.from,o.to),h.push(xe.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(s).number)+"."))):o=e.nextMatch(t,o.from,o.to);let u=n.state.changes(a);return o&&(l=te.single(o.from,o.to).map(u),h.push(uA(n,o)),h.push(t.facet(Uu).scrollToMatch(l.main,n))),n.dispatch({changes:u,selection:l,effects:h,userEvent:"input.replace"}),!0}),Zte=cm((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let i of e.matchAll(n.state,1e9)){let{from:r,to:o,precise:a}=i;a&&t.push({from:r,to:o,insert:e.getReplacement(i)})}if(!t.length)return!1;let s=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:xe.announce.of(s),userEvent:"input.replace.all"}),!0});function hA(n){return n.state.facet(Uu).createPanel(n)}function J_(n,e){var t,s,i,r,o;let a=n.selection.main,l=a.empty||a.to>a.from+100?"":n.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=n.facet(Uu);return new uL({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(s=e==null?void 0:e.caseSensitive)!==null&&s!==void 0?s:c.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function fL(n){let e=oN(n,hA);return e&&e.dom.querySelector("[main-field]")}function pL(n){let e=fL(n);e&&e==n.root.activeElement&&e.select()}const mL=n=>{let e=n.state.field(Ca,!1);if(e&&e.panel){let t=fL(n);if(t&&t!=n.root.activeElement){let s=J_(n.state,e.query.spec);s.valid&&n.dispatch({effects:bf.of(s)}),t.focus(),t.select()}}else n.dispatch({effects:[cA.of(!0),e?bf.of(J_(n.state,e.query.spec)):St.appendConfig.of(Qte)]});return!0},gL=n=>{let e=n.state.field(Ca,!1);if(!e||!e.panel)return!1;let t=oN(n,hA);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:cA.of(!1)}),!0},Xte=[{key:"Mod-f",run:mL,scope:"editor search-panel"},{key:"F3",run:Uy,shift:qy,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Uy,shift:qy,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:gL,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Kte},{key:"Mod-Alt-g",run:Ete},{key:"Mod-d",run:Dte,preventDefault:!0}];class Yte{constructor(e){this.view=e;let t=this.query=e.state.field(Ca).query.spec;this.commit=this.commit.bind(this),this.searchField=Cn("input",{value:t.search,placeholder:Vs(e,"Find"),"aria-label":Vs(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Cn("input",{value:t.replace,placeholder:Vs(e,"Replace"),"aria-label":Vs(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Cn("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Cn("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Cn("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function s(i,r,o){return Cn("button",{class:"cm-button",name:i,onclick:r,type:"button"},o)}this.dom=Cn("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,s("next",()=>Uy(e),[Vs(e,"next")]),s("prev",()=>qy(e),[Vs(e,"previous")]),s("select",()=>Gte(e),[Vs(e,"all")]),Cn("label",null,[this.caseField,Vs(e,"match case")]),Cn("label",null,[this.reField,Vs(e,"regexp")]),Cn("label",null,[this.wordField,Vs(e,"by word")]),...e.state.readOnly?[]:[Cn("br"),this.replaceField,s("replace",()=>HC(e),[Vs(e,"replace")]),s("replaceAll",()=>Zte(e),[Vs(e,"replace all")])],Cn("button",{name:"close",onclick:()=>gL(e),"aria-label":Vs(e,"close"),type:"button"},["×"])])}commit(){let e=new uL({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:bf.of(e)}))}keydown(e){XJ(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?qy:Uy)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),HC(this.view))}update(e){for(let t of e.transactions)for(let s of t.effects)s.is(bf)&&!s.value.eq(this.query)&&this.setQuery(s.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Uu).top}}function Vs(n,e){return n.state.phrase(e)}const ng=30,sg=/[\s\.,:;?!]/;function uA(n,{from:e,to:t}){let s=n.state.doc.lineAt(e),i=n.state.doc.lineAt(t).to,r=Math.max(s.from,e-ng),o=Math.min(i,t+ng),a=n.state.sliceDoc(r,o);if(r!=s.from){for(let l=0;la.length-ng;l--)if(!sg.test(a[l-1])&&sg.test(a[l])){a=a.slice(0,l);break}}return xe.announce.of(`${n.state.phrase("current match")}. ${a} ${n.state.phrase("on line")} ${s.number}.`)}const Jte=xe.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Qte=[Ca,q0.low(Wte),Jte],ene=({path:n,value:e,readOnly:t,onChange:s})=>{const i=ee.useRef(null),r=ee.useRef(null),o=ee.useRef(new im),a=ee.useRef(s);return a.current=s,ee.useEffect(()=>{if(!i.current)return;const l=at.create({doc:e,extensions:[wQ(),nQ(),aQ(),wee(),Tte(),eee(),nA.define(Ate),eN.of([...Ste,...Tee,...Xte,xte]),xe.contentAttributes.of({"aria-label":`Editing ${n}`,class:"ph-no-capture","data-ph-no-autocapture":"true","data-ph-no-capture":"true"}),o.current.of(xe.editable.of(!t)),xe.updateListener.of(c=>{c.docChanged&&a.current(c.state.doc.toString())})]});return r.current=new xe({state:l,parent:i.current}),()=>{var c;return(c=r.current)==null?void 0:c.destroy()}},[n]),ee.useEffect(()=>{const l=r.current;!l||l.state.doc.toString()===e||l.dispatch({changes:{from:0,to:l.state.doc.length,insert:e}})},[e]),ee.useEffect(()=>{var l;(l=r.current)==null||l.dispatch({effects:o.current.reconfigure(xe.editable.of(!t))})},[t]),S.jsx("div",{className:"latex-source-editor ph-no-capture","data-ph-no-autocapture":"true","data-ph-no-capture":"true","data-testid":"latex-source-editor",ref:i})},tne="pwc:artifact-navigation";function use(){return typeof window>"u"?!0:window.dispatchEvent(new Event(tne,{cancelable:!0}))}const yL=()=>({open:!1,selectedKey:null,selected:null,selectedVersionId:null,tab:"preview",sourceFile:null,panelPercent:55,requestNonce:0,registry:{},autoOpened:{},manuallyClosed:{}});function nne(n,e){if(e.type==="reset")return{...yL(),panelPercent:n.panelPercent};if(e.type==="register"){const t=n.registry[e.key];if(t&&JSON.stringify(t)===JSON.stringify(e.block))return n;const s={...n.registry,[e.key]:e.block},i=n.selectedKey===e.key?e.block:n.selected,r=(t==null?void 0:t.status)==="generating"&&e.block.status==="ready",o=e.autoOpenOnMount&&!t&&e.block.status==="ready"&&!Object.values(n.autoOpened).some(Boolean);return(r||o)&&!n.autoOpened[e.key]&&!n.manuallyClosed[e.key]?{...n,registry:s,open:!0,selectedKey:e.key,selected:e.block,selectedVersionId:e.block.version_id??null,tab:"preview",sourceFile:null,requestNonce:n.requestNonce+1,autoOpened:{...n.autoOpened,[e.key]:!0}}:{...n,registry:s,selected:i}}return e.type==="unregister"?n:e.type==="open"?{...n,open:!0,selectedKey:e.key,selected:e.block,selectedVersionId:e.block.version_id??null,tab:"preview",sourceFile:null,requestNonce:n.requestNonce+1,manuallyClosed:{...n.manuallyClosed,[e.key]:!1}}:e.type==="close"?{...n,open:!1,manuallyClosed:n.selectedKey?{...n.manuallyClosed,[n.selectedKey]:!0}:n.manuallyClosed}:e.type==="tab"?{...n,tab:e.tab}:e.type==="source"?{...n,sourceFile:e.path}:e.type==="version"?{...n,selectedVersionId:e.versionId,tab:"preview",sourceFile:null}:{...n,panelPercent:e.percent}}function Q_(n){return n.publication_id||n.public_capability||n.version_id||`${n.scope}:${n.identifier}:${n.version??"pending"}`}const vL=ee.createContext(null),dse=({children:n,workspaceKey:e,autoOpenOnMount:t=!1,onAskAiFix:s})=>{const[i,r]=ee.useReducer(nne,void 0,yL),o=ee.useRef(null),a=ee.useRef(e);ee.useEffect(()=>{a.current!==e&&(a.current=e,o.current=null,r({type:"reset"}))},[e]);const l=ee.useCallback(()=>{r({type:"close"}),window.setTimeout(()=>{var b;(b=o.current)!=null&&b.isConnected&&o.current.focus()},0)},[]),c=ee.useCallback(b=>r({type:"register",key:Q_(b),block:b,autoOpenOnMount:t}),[t]),h=ee.useCallback(b=>r({type:"unregister",key:b}),[]),u=ee.useCallback((b,x)=>{const A=document.activeElement;o.current=x??(A instanceof HTMLElement&&A!==document.body?A:null),r({type:"open",key:Q_(b),block:b})},[]),d=ee.useCallback(b=>r({type:"tab",tab:b}),[]),p=ee.useCallback(b=>r({type:"source",path:b}),[]),m=ee.useCallback(b=>r({type:"version",versionId:b}),[]),y=ee.useCallback(b=>r({type:"width",percent:b}),[]),v=ee.useCallback(b=>s==null?void 0:s(b),[s]),g=ee.useCallback(()=>r({type:"reset"}),[]),_=ee.useMemo(()=>({state:i,autoOpenOnMount:t,register:c,unregister:h,open:u,close:l,setTab:d,setSourceFile:p,setVersion:m,setPanelPercent:y,askAiToFix:v,reset:g}),[v,t,l,u,c,g,y,p,d,m,i,h]);return S.jsx(vL.Provider,{value:_,children:n})};function hm(){const n=ee.useContext(vL);if(!n)throw new Error("Poster artifacts require an ArtifactPanelProvider");return n}function sne(n,e,t){return rn(`/api/v1/chat/artifacts/${encodeURIComponent(n)}/versions/${encodeURIComponent(e)}/source/${t.split("/").map(encodeURIComponent).join("/")}`)}function ine(n,e,t){return rn(`/api/v1/chat/artifacts/${encodeURIComponent(n)}/versions/${encodeURIComponent(e)}/figures/${t.split("/").map(encodeURIComponent).join("/")}`)}function rne(n){return rn(`/api/v1/chat/artifacts/${encodeURIComponent(n)}/export/pdf`)}function BC(n,e){return rn(`/api/v1/chat/artifacts/${encodeURIComponent(n)}/versions/${encodeURIComponent(e)}/export/source.zip`)}function ig(n){return`pwc:latex-paper-draft:${n}`}function one(n,e){const t=Object.keys(n).sort(),s=Object.keys(e).sort();return t.length===s.length&&t.every((i,r)=>i===s[r]&&n[i]===e[i])}function UC(n){return!n.includes("\\")&&/^(?!\/)(?!.*(?:^|\/)\.\.?\/)[^\0]{1,300}\.(?:tex|bib)$/iu.test(n)}function ane(n){var s,i;const e=((s=n.provenance)==null?void 0:s.action)??(n.actor_type==="restore"?"restore":n.actor_type==="ai"?"ai_draft":"human_save"),t={human_save:"Human save",ai_draft:"AI draft",ai_repair:"AI repair",restore:"Restore"}[e];return(i=n.provenance)!=null&&i.model_identity?`${t} · ${n.provenance.model_identity}`:t}const lne=({block:n,forceDialog:e=!1})=>{var ks,cs,wn,Kt,Zn,an,Es,qu,Io;const t=hm(),s=ZC(),i=t.close,[r,o]=ee.useState(()=>{var V;return typeof window<"u"&&((V=window.matchMedia)==null?void 0:V.call(window,"(max-width: 760px)").matches)}),[a,l]=ee.useState({}),[c,h]=ee.useState({}),[u,d]=ee.useState(null),[p,m]=ee.useState(!1),[y,v]=ee.useState(!1),[g,_]=ee.useState(null),[b,x]=ee.useState(!1),[A,T]=ee.useState(null),C=ee.useRef(null),I=ee.useRef(null),D=ee.useRef(!1),H=e||r,j=u!==null&&!one(a,c);ee.useEffect(()=>{var Ce,rt;const V=(Ce=window.matchMedia)==null?void 0:Ce.call(window,"(max-width: 760px)");if(!V)return;const ye=()=>o(V.matches);return ye(),(rt=V.addEventListener)==null||rt.call(V,"change",ye),()=>{var qt;return(qt=V.removeEventListener)==null?void 0:qt.call(V,"change",ye)}},[]),ee.useEffect(()=>{var Ce,rt;if(!H)return;(rt=(Ce=I.current)==null?void 0:Ce.querySelector("[data-artifact-close]"))==null||rt.focus(),window.history.pushState({...window.history.state,pwcArtifactPanel:!0},""),D.current=!0;const V=()=>{if(j&&!window.confirm("Leave this view? Unsaved paper edits remain in this browser.")){window.history.pushState({...window.history.state,pwcArtifactPanel:!0},""),D.current=!0;return}D.current=!1,i()},ye=qt=>{qt.key==="Escape"&&(qt.preventDefault(),!(j&&!window.confirm("Leave this view? Unsaved paper edits remain in this browser."))&&(i(),D.current&&(D.current=!1,window.history.back())))};return window.addEventListener("popstate",V),document.addEventListener("keydown",ye),()=>{window.removeEventListener("popstate",V),document.removeEventListener("keydown",ye)}},[i,H,j]),ee.useEffect(()=>{if(!H)return;const V=ye=>{if(ye.key!=="Tab"||!I.current)return;const Ce=[...I.current.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), [contenteditable="true"], [tabindex]:not([tabindex="-1"])')];if(!Ce.length)return;const rt=Ce[0],qt=Ce.at(-1);ye.shiftKey&&document.activeElement===rt?(ye.preventDefault(),qt.focus()):!ye.shiftKey&&document.activeElement===qt&&(ye.preventDefault(),rt.focus())};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[H]),ee.useEffect(()=>{const V=ye=>{j&&(ye.preventDefault(),ye.returnValue="")};return window.addEventListener("beforeunload",V),()=>window.removeEventListener("beforeunload",V)},[j]),ee.useEffect(()=>{const V=ye=>{j&&!window.confirm("Leave this view? Unsaved paper edits remain in this browser.")&&ye.preventDefault()};return window.addEventListener("pwc:artifact-navigation",V),()=>window.removeEventListener("pwc:artifact-navigation",V)},[j]);const U=wo({queryKey:["chat-latex-paper",n.artifact_id],queryFn:async()=>{const V=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}`),{credentials:"include",cache:"no-store"});if(!V.ok)throw new Error("Could not load paper details");return V.json()},enabled:!!n.artifact_id,staleTime:5e3}),B=U.data,L=B==null?void 0:B.source_head,X=B==null?void 0:B.preview_head,se=wo({queryKey:["chat-latex-paper-history",n.artifact_id,A],queryFn:async()=>{const V=new URLSearchParams({limit:"20"});A&&V.set("cursor",A);const ye=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/versions?${V}`),{credentials:"include",cache:"no-store"});if(!ye.ok)throw new Error("Could not load paper history");return ye.json()},enabled:b&&!!n.artifact_id,staleTime:Number.POSITIVE_INFINITY}),J=wo({queryKey:["chat-latex-paper-manifest",n.artifact_id,L==null?void 0:L.version_id],queryFn:async()=>{const V=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/versions/${encodeURIComponent(L.version_id)}/manifest`),{credentials:"include",cache:"no-store"});if(!V.ok)throw new Error("Could not load paper files");return V.json()},enabled:t.state.tab==="files"&&!!(L!=null&&L.version_id),staleTime:Number.POSITIVE_INFINITY}),Y=((ks=J.data)==null?void 0:ks.files.filter(V=>V.media_type==="text/x-tex"||V.media_type==="application/x-bibtex"))??[],ge=((cs=J.data)==null?void 0:cs.files.filter(V=>V.media_type==="image/png"||V.media_type==="image/jpeg"||V.media_type==="application/pdf"))??[],z=wo({queryKey:["chat-latex-paper-source-files",n.artifact_id,L==null?void 0:L.version_id],queryFn:async()=>Object.fromEntries(await Promise.all(Y.map(async V=>{const ye=await fetch(sne(n.artifact_id,L.version_id,V.path),{credentials:"include",cache:"no-store"});if(!ye.ok)throw new Error("Could not load paper source");return[V.path,await ye.text()]}))),enabled:t.state.tab==="files"&&!!(L!=null&&L.version_id&&Y.length),staleTime:Number.POSITIVE_INFINITY});ee.useEffect(()=>{m(!1)},[L==null?void 0:L.version_id]),ee.useEffect(()=>{var qt;if(!(L!=null&&L.version_id)||!z.data||C.current===L.version_id)return;const V=z.data;let ye=V,Ce=!1,rt=L.version_id;try{const zr=window.localStorage.getItem(ig(n.artifact_id)),Cs=zr?JSON.parse(zr):null;Cs!=null&&Cs.files&&typeof Cs.files=="object"&&(ye=Cs.files,Ce=Cs.parentVersionId!==L.version_id,rt=Cs.parentVersionId)}catch{}C.current=L.version_id,l(ye),h(V),d(rt),v(Ce),m(!0),Ce&&_("This local draft is based on an older paper version. Copy or discard it before saving the latest version."),(!t.state.sourceFile||!ye[t.state.sourceFile])&&t.setSourceFile(((qt=J.data)==null?void 0:qt.root_document)??null)},[n.artifact_id,(wn=J.data)==null?void 0:wn.root_document,t,L==null?void 0:L.version_id,z.data]),ee.useEffect(()=>{if(!u||!n.artifact_id)return;const V=ig(n.artifact_id);if(!j){window.localStorage.removeItem(V);return}window.localStorage.setItem(V,JSON.stringify({parentVersionId:u,files:a}))},[n.artifact_id,j,u,a]);const E=ym({mutationFn:async()=>{var Ce;if(!(L!=null&&L.version_id))throw new Error("Paper source is not ready to save");const V=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/save-compile`),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({expected_parent_version_id:L.version_id,files:Object.entries(a).map(([rt,qt])=>({path:rt,content:qt}))})}),ye=await V.json().catch(()=>null);if(!V.ok)throw new Error(((Ce=ye==null?void 0:ye.detail)==null?void 0:Ce.message)??"Could not save paper");return ye},onSuccess:V=>{var ye,Ce;s.setQueryData(["chat-latex-paper",n.artifact_id],V),s.invalidateQueries({queryKey:["chat-latex-paper-manifest",n.artifact_id]}),s.invalidateQueries({queryKey:["chat-latex-paper-source-files",n.artifact_id]}),C.current=((ye=V.source_head)==null?void 0:ye.version_id)??null,h(a),d(((Ce=V.source_head)==null?void 0:Ce.version_id)??null),window.localStorage.removeItem(ig(n.artifact_id)),_(null),v(!1),t.setTab("preview")},onError:V=>_(V instanceof Error?V.message:"Could not save paper")}),O=ym({mutationFn:async V=>{var rt;if(!(L!=null&&L.version_id))throw new Error("Paper source is not ready to restore");const ye=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/versions/restore`),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({source_version_id:V,expected_parent_version_id:L.version_id})}),Ce=await ye.json().catch(()=>null);if(!ye.ok)throw new Error(((rt=Ce==null?void 0:Ce.detail)==null?void 0:rt.message)??"Could not restore paper version");return Ce},onSuccess:V=>{s.setQueryData(["chat-latex-paper",n.artifact_id],V),s.invalidateQueries({queryKey:["chat-latex-paper-history",n.artifact_id]}),s.invalidateQueries({queryKey:["chat-latex-paper-manifest",n.artifact_id]}),s.invalidateQueries({queryKey:["chat-latex-paper-source-files",n.artifact_id]}),C.current=null,m(!1),T(null),_(null),t.setTab("preview")},onError:V=>_(V instanceof Error?V.message:"Could not restore paper version")}),R=ym({mutationFn:async V=>{var qt;if(!(L!=null&&L.version_id))throw new Error("Paper source is not ready to upload a figure");if(j)throw new Error("Save or discard text edits before uploading a figure");const ye=new FormData;ye.set("expected_parent_version_id",L.version_id),ye.set("path",`figures/${V.name}`),ye.set("figure",V);const Ce=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/figures`),{method:"POST",credentials:"include",body:ye}),rt=await Ce.json().catch(()=>null);if(!Ce.ok)throw new Error(((qt=rt==null?void 0:rt.detail)==null?void 0:qt.message)??"Could not upload figure");return rt},onSuccess:V=>{s.setQueryData(["chat-latex-paper",n.artifact_id],V),s.invalidateQueries({queryKey:["chat-latex-paper-manifest",n.artifact_id]}),s.invalidateQueries({queryKey:["chat-latex-paper-source-files",n.artifact_id]}),_(null)},onError:V=>_(V instanceof Error?V.message:"Could not upload figure")}),k=ym({mutationFn:async()=>{const V=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/refresh-compile`),{method:"POST",credentials:"include"});if(!V.ok)throw new Error("Could not refresh paper compilation");return V.json()},onSuccess:V=>s.setQueryData(["chat-latex-paper",n.artifact_id],V)}).mutate,N=L==null?void 0:L.version_id,G=L==null?void 0:L.compile_status;ee.useEffect(()=>{if(!N||!n.artifact_id||!["queued","compiling"].includes(G??""))return;const V=window.setTimeout(()=>k(),2e3);return()=>window.clearTimeout(V)},[n.artifact_id,k,G,N]);const Z=t.state.sourceFile??((Kt=J.data)==null?void 0:Kt.root_document)??null,ae=(B==null?void 0:B.editing_enabled)===!0&&!!(L!=null&&L.version_id)&&p&&!y&&!E.isPending,ie=new Map(((Zn=se.data)==null?void 0:Zn.items.map(V=>[V.version_id,V.version]))??[]),Ae=X?rn(`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/versions/${encodeURIComponent(X.version_id)}/preview`):null,ct=!!(L&&X&&L.version_id!==X.version_id),Ie=()=>!j||window.confirm("Leave this view? Unsaved paper edits remain in this browser."),Fe=V=>V!==t.state.tab&&!Ie()?!1:(t.setTab(V),!0),Je=V=>{var Ce,rt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(V.key))return;V.preventDefault();const ye=V.key==="ArrowLeft"||V.key==="Home"?"preview":"files";Fe(ye)&&((rt=(Ce=V.currentTarget.parentElement)==null?void 0:Ce.querySelector(`#paper-${ye}-tab`))==null||rt.focus())},it=V=>{V!==Z&&j&&!window.confirm("Switch files? Unsaved edits stay in this browser.")||t.setSourceFile(V)},bn=()=>{const V=window.prompt("New TeX or BibTeX file name","section.tex");if(V){if(!UC(V)||a[V]){_("Choose a new safe .tex or .bib filename.");return}if(Object.keys(a).length>=100){_("A paper can contain at most 100 files.");return}l({...a,[V]:""}),_(null),t.setSourceFile(V)}},ut=()=>{var Ce;if(!Z||Z===((Ce=J.data)==null?void 0:Ce.root_document))return;const V=window.prompt("Rename file",Z);if(!V||V===Z)return;if(!UC(V)||a[V]){_("Choose a new safe .tex or .bib filename.");return}const ye={...a,[V]:a[Z]};delete ye[Z],l(ye),t.setSourceFile(V)},Ss=()=>{var ye,Ce;if(!Z||Z===((ye=J.data)==null?void 0:ye.root_document)||!window.confirm(`Delete ${Z}?`))return;const V={...a};delete V[Z],l(V),t.setSourceFile(((Ce=J.data)==null?void 0:Ce.root_document)??null)},xs=()=>{!y||!window.confirm("Discard this stale local draft?")||(window.localStorage.removeItem(ig(n.artifact_id)),l(c),d((L==null?void 0:L.version_id)??null),v(!1),_(null))},Pn=()=>{Ie()&&(i(),H&&D.current&&(D.current=!1,window.history.back()))},ls=()=>{if(!L||L.compile_status!=="failed"||L.repair_exhausted)return;const V=(L.compile_diagnostics??[]).slice(0,20).map(ye=>`${ye.file??"project"}${ye.line?`:${ye.line}`:""}: ${ye.message}`).join(` `);t.askAiToFix(`Repair the failed paper source version ${L.version_id}. Use pwc-paper to inspect and repair it; make no more than three attempts. Compiler diagnostics: -${V||"No compiler diagnostic was available."}`)},As=V=>{!V||!Fe("files")||t.setSourceFile(V)};return S.jsxs("section",{ref:I,className:`chat-artifact-panel${H?" is-dialog":" is-docked"}`,role:H?"dialog":"complementary","aria-modal":H?!0:void 0,"aria-labelledby":"latex-paper-title","data-testid":"latex-paper-panel",children:[S.jsxs("header",{children:[S.jsxs("div",{children:[S.jsx("span",{children:"Private paper"}),S.jsx("h2",{id:"latex-paper-title",children:n.title}),S.jsxs("p",{className:"chat-paper-status",role:"status","aria-live":"polite",children:[L?`Source v${L.version} · ${L.compile_status}`:"Preparing paper source",ct?" · Preview out of date":""]}),S.jsx("p",{className:"chat-paper-privacy-note",children:"This paper is private to this chat. Source, figures, and PDFs are stored privately; AI-authored text needs your review."})]}),S.jsxs("div",{className:"chat-artifact-header-actions",children:[S.jsx("button",{type:"button","aria-expanded":b,"aria-controls":"paper-version-history",onClick:()=>{T(null),x(!b)},children:"Version history"}),S.jsx("button",{type:"button","data-artifact-close":!0,"aria-label":H?"Back to conversation":"Close paper",onClick:Pn,children:S.jsx(c0,{})})]})]}),S.jsxs("nav",{"aria-label":"Paper views",role:"tablist",children:[S.jsx("button",{type:"button",id:"paper-preview-tab",role:"tab","aria-selected":t.state.tab==="preview","aria-controls":"paper-preview-panel",tabIndex:t.state.tab==="preview"?0:-1,className:t.state.tab==="preview"?"active":"",onClick:()=>Fe("preview"),onKeyDown:Je,children:"Preview"}),S.jsx("button",{type:"button",id:"paper-files-tab",role:"tab","aria-selected":t.state.tab==="files","aria-controls":"paper-files-panel",tabIndex:t.state.tab==="files"?0:-1,className:t.state.tab==="files"?"active":"",onClick:()=>Fe("files"),onKeyDown:Je,children:"Files"})]}),S.jsxs("div",{id:t.state.tab==="preview"?"paper-preview-panel":"paper-files-panel",role:"tabpanel","aria-labelledby":t.state.tab==="preview"?"paper-preview-tab":"paper-files-tab",className:"chat-artifact-panel-body",children:[t.state.tab==="preview"?U.isError?S.jsxs("div",{role:"alert",children:["Could not load paper details. ",S.jsx("button",{type:"button",onClick:()=>void U.refetch(),children:"Retry paper details"})]}):Ae?S.jsx(HY,{url:Ae,downloadUrl:rne(n.artifact_id),paperKey:`${n.artifact_id}:${X==null?void 0:X.version_id}`,paperTitle:n.title,paperHref:"/chat",chrome:"canvas"},X==null?void 0:X.version_id):L?L.compile_status==="failed"?S.jsx("p",{role:"alert",children:"No compiled preview is available for this failed source version. Review the diagnostics or fix the paper in Files."}):["queued","compiling"].includes(L.compile_status)?S.jsx("p",{role:"status",children:"Preview is compiling. The stored source is available in Files."}):S.jsx("p",{role:"alert",children:"No compiled preview is available for this source version."}):S.jsx("p",{role:"status",children:"Paper source and compiled preview are not available yet."}):S.jsxs("div",{className:"chat-artifact-source-workspace",children:[S.jsxs("nav",{"aria-label":"Paper source files",children:[Y.map(V=>S.jsx("button",{type:"button","aria-pressed":Z===V.path,onClick:()=>it(V.path),children:V.path},V.path)),ae&&S.jsxs("button",{type:"button",className:"latex-file-action","aria-label":"Add TeX file",onClick:bn,children:[S.jsx(lD,{})," Add file"]}),ae&&S.jsxs("label",{className:"latex-file-action",children:["Upload figure",S.jsx("input",{"aria-label":"Upload figure",type:"file",accept:"image/png,image/jpeg,application/pdf,.png,.jpg,.jpeg,.pdf",disabled:R.isPending,onChange:V=>{var Ce;const ye=(Ce=V.currentTarget.files)==null?void 0:Ce[0];V.currentTarget.value="",ye&&R.mutate(ye)}})]}),ge.map(V=>L&&S.jsx("a",{href:ine(n.artifact_id,L.version_id,V.path),download:!0,children:V.path},V.path))]}),S.jsxs("div",{className:"latex-editor-column",children:[Z&&a[Z]!==void 0?S.jsx(ene,{path:Z,value:a[Z],readOnly:!ae,onChange:V=>l({...a,[Z]:V})}):S.jsx("p",{children:z.isError?"Source could not be loaded.":"Loading source…"}),ae&&Z&&Z!==((an=J.data)==null?void 0:an.root_document)&&S.jsxs("div",{className:"latex-file-buttons",children:[S.jsxs("button",{type:"button",onClick:ut,children:[S.jsx(r$,{})," Rename"]}),S.jsxs("button",{type:"button",onClick:Ss,children:[S.jsx(GL,{})," Delete"]})]})]})]}),b&&S.jsxs("section",{id:"paper-version-history",className:"chat-artifact-history","aria-label":"Paper version history",children:[S.jsx("h3",{children:"Version history"}),se.isLoading&&S.jsx("p",{children:"Loading history…"}),se.isError&&S.jsx("p",{role:"alert",children:"Paper history could not be loaded."}),(Es=se.data)==null?void 0:Es.items.map(V=>{var ye,Ce,rt,qt;return S.jsxs("article",{children:[S.jsxs("strong",{children:["v",V.version," · ",V.compile_status]}),S.jsx("span",{children:ane(V)}),V.created_at&&S.jsx("time",{dateTime:V.created_at,children:V.created_at}),V.parent_version_id&&S.jsxs("span",{children:["Parent ",ie.has(V.parent_version_id)?`v${ie.get(V.parent_version_id)}`:V.parent_version_id]}),(ye=V.provenance)!=null&&ye.changed_files.length?S.jsxs("span",{children:["Changed: ",V.provenance.changed_files.join(", ")]}):null,((Ce=V.provenance)==null?void 0:Ce.restored_from_version_id)&&S.jsxs("span",{children:["Restored from ",V.provenance.restored_from_version_id]}),((rt=V.provenance)==null?void 0:rt.change_summary)&&S.jsx("p",{children:V.provenance.change_summary}),(qt=V.provenance)==null?void 0:qt.reference_changes.map(zr=>S.jsx("p",{children:zr},zr)),S.jsx("a",{href:BC(n.artifact_id,V.version_id),download:!0,children:"Source ZIP"}),(B==null?void 0:B.editing_enabled)&&(L==null?void 0:L.version_id)&&V.version_id!==L.version_id&&S.jsxs("button",{type:"button",disabled:O.isPending||j,onClick:()=>O.mutate(V.version_id),children:["Restore version ",V.version]})]},V.version_id)}),((qu=se.data)==null?void 0:qu.next_cursor)&&S.jsx("button",{type:"button",onClick:()=>T(se.data.next_cursor??null),children:"Load older versions"})]})]}),S.jsxs("footer",{children:[S.jsxs("div",{className:"chat-artifact-metadata","aria-live":"polite",children:[ct&&S.jsx("strong",{children:"Out of date"}),(Io=L==null?void 0:L.compile_diagnostics)==null?void 0:Io.map((V,ye)=>S.jsxs("button",{type:"button",onClick:()=>As(V.file),className:"latex-compile-diagnostic",children:[V.file?`${V.file}${V.line?`:${V.line}`:""}: `:"",V.message]},`${V.file??"global"}:${V.line??""}:${ye}`)),g&&S.jsx("span",{role:"alert",children:g}),y&&S.jsx("button",{type:"button",onClick:xs,children:"Discard stale local draft"})]}),S.jsxs("div",{className:"chat-artifact-actions",children:[(L==null?void 0:L.compile_status)==="failed"&&!L.repair_exhausted&&S.jsx("button",{type:"button",onClick:ls,children:"Ask AI to fix"}),(L==null?void 0:L.compile_status)==="failed"&&L.repair_exhausted&&S.jsx("span",{role:"status",children:"AI repair attempts exhausted"}),t.state.tab==="files"&&ae&&S.jsxs("button",{type:"button",disabled:!j,onClick:()=>E.mutate(),children:[S.jsx(uD,{}),E.isPending?"Saving…":"Save & Compile"]}),L&&S.jsxs("a",{href:BC(n.artifact_id,L.version_id),download:!0,children:[S.jsx(nS,{})," Source ZIP"]})]})]})]})},cne="https://github.com/Chenruishuo/posterly/tree/b9f42e5578a49a27525a68f85376bb3bb25af86f";function hne(){if(typeof window>"u")return null;const n=window.location.pathname.match(/^\/share\/([^/]+)/u);return n?decodeURIComponent(n[1]):null}function bL(n){if(n.scope==="public"){const s=hne();if(!s||!n.public_capability)return null;const i=`/api/v1/chat/shares/${encodeURIComponent(s)}/artifacts/${encodeURIComponent(n.public_capability)}`;return{preview:rn(`${i}/preview`),png:rn(`${i}/download/png`),pdf:rn(`${i}/download/pdf`),manifest:null,source:null,gate:null,download:null}}if(!n.artifact_id||!n.version_id)return null;const e=`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/versions/${encodeURIComponent(n.version_id)}`,t=(s,i)=>rn(`${e}/${s}/${i.split("/").map(encodeURIComponent).join("/")}`);return{preview:rn(`${e}/preview`),png:t("download","poster.png"),pdf:null,manifest:rn(`${e}/manifest`),source:s=>t("source",s),gate:s=>t("source",s),download:s=>t("download",s)}}const wL=n=>({passed:"Passed",warnings:"Passed with warnings",failed:"Draft—checks failed"})[n??"passed"];function une(){const[n,e]=ee.useState(()=>{var t;return typeof window<"u"&&((t=window.matchMedia)==null?void 0:t.call(window,"(max-width: 760px)").matches)});return ee.useEffect(()=>{var i,r;const t=(i=window.matchMedia)==null?void 0:i.call(window,"(max-width: 760px)");if(!t)return;const s=()=>e(t.matches);return s(),(r=t.addEventListener)==null||r.call(t,"change",s),()=>{var o;return(o=t.removeEventListener)==null?void 0:o.call(t,"change",s)}},[]),n}const dne=({forceDialog:n=!1,readerFallback:e=!1})=>{var A,T,C,I;const t=hm(),s=t.close,{state:i}=t,r=i.selected,o=une(),a=n||o,l=ee.useRef(null),c=ee.useRef(!1),h=wo({queryKey:["chat-artifact-versions",r==null?void 0:r.artifact_id],queryFn:async()=>{const D=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(r.artifact_id)}`),{credentials:"include",cache:"no-store"});if(!D.ok)throw new Error("Could not load poster versions");return(await D.json()).versions},enabled:i.open&&(r==null?void 0:r.scope)==="owner"&&!!r.artifact_id,staleTime:Number.POSITIVE_INFINITY}),u=(A=h.data)==null?void 0:A.find(D=>D.version_id===i.selectedVersionId),d=r&&u?{...r,version_id:u.version_id,version:u.version,gate_status:u.gate_status,total_bytes:u.total_bytes}:r,p=d?bL(d):null,y=wo({queryKey:["chat-artifact-manifest",d==null?void 0:d.version_id],queryFn:async()=>{const D=await fetch(p.manifest,{credentials:"include",cache:"no-store"});if(!D.ok)throw new Error("Could not load poster details");return D.json()},enabled:i.open&&(d==null?void 0:d.scope)==="owner"&&!!(p!=null&&p.manifest),staleTime:Number.POSITIVE_INFINITY}).data,v=i.sourceFile??(y==null?void 0:y.entrypoint)??null,g=wo({queryKey:["chat-artifact-source",d==null?void 0:d.version_id,v],queryFn:async()=>{const D=await fetch(p.source(v),{credentials:"include",cache:"no-store"});if(!D.ok)throw new Error("Source could not be loaded");return D.text()},enabled:i.open&&i.tab==="source"&&(d==null?void 0:d.scope)==="owner"&&!!(v&&(p!=null&&p.source)),staleTime:Number.POSITIVE_INFINITY});if(ee.useEffect(()=>{var H,j;if(!i.open||!a)return;(j=(H=l.current)==null?void 0:H.querySelector("[data-artifact-close]"))==null||j.focus(),window.history.pushState({...window.history.state,pwcArtifactPanel:!0},""),c.current=!0;const D=()=>{c.current=!1,s()};return window.addEventListener("popstate",D),()=>window.removeEventListener("popstate",D)},[s,a,i.open]),ee.useEffect(()=>{if(!i.open||!a)return;const D=H=>{if(H.key==="Escape"){H.preventDefault(),s(),c.current&&(c.current=!1,window.history.back());return}if(H.key!=="Tab"||!l.current)return;const j=[...l.current.querySelectorAll('button:not([disabled]), a[href], select:not([disabled]), [tabindex]:not([tabindex="-1"])')];if(!j.length)return;const U=j[0],B=j.at(-1);H.shiftKey&&document.activeElement===U?(H.preventDefault(),B.focus()):!H.shiftKey&&document.activeElement===B&&(H.preventDefault(),U.focus())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[s,a,i.open]),!i.open||!d||!p)return null;const _=()=>{s(),a&&c.current&&(c.current=!1,window.history.back())},b=(T=y==null?void 0:y.downloads[0])==null?void 0:T.path,x=d.scope==="public"?p.pdf:b&&p.download?p.download(b):null;return S.jsxs("section",{ref:l,className:`chat-artifact-panel${a?" is-dialog":" is-docked"}${e?" is-reader-fallback":""}`,role:a?"dialog":"complementary","aria-modal":a?!0:void 0,"aria-label":d.title,"data-testid":"artifact-panel",children:[S.jsxs("header",{children:[S.jsxs("div",{children:[S.jsx("span",{children:"Posterly artifact"}),S.jsx("h2",{children:d.title})]}),(((C=h.data)==null?void 0:C.length)??0)>1&&S.jsxs("label",{className:"chat-artifact-version",children:["Version",S.jsx("select",{"aria-label":"Poster version",value:d.version_id,onChange:D=>t.setVersion(D.target.value),children:[...h.data??[]].reverse().map(D=>S.jsxs("option",{value:D.version_id,children:["v",D.version]},D.version_id))})]}),S.jsx("button",{type:"button","data-artifact-close":!0,"aria-label":a?"Back to conversation":"Close poster",onClick:_,children:S.jsx(c0,{})})]}),S.jsxs("nav",{"aria-label":"Poster views",children:[S.jsx("button",{type:"button","aria-pressed":i.tab==="preview",className:i.tab==="preview"?"active":"",onClick:()=>t.setTab("preview"),children:"Preview"}),d.scope==="owner"&&S.jsx("button",{type:"button","aria-pressed":i.tab==="source",className:i.tab==="source"?"active":"",onClick:()=>t.setTab("source"),children:"Source"})]}),S.jsx("div",{className:"chat-artifact-panel-body",children:i.tab==="preview"?S.jsx("img",{src:p.preview,alt:`Full preview of ${d.title}`}):S.jsxs("div",{className:"chat-artifact-source-workspace",children:[(((I=y==null?void 0:y.source_files)==null?void 0:I.length)??0)>1&&S.jsx("nav",{"aria-label":"Poster source files",children:y.source_files.map(D=>S.jsx("button",{type:"button","aria-pressed":v===D,onClick:()=>t.setSourceFile(D),children:D},D))}),S.jsx("pre",{children:S.jsx("code",{children:g.isError?"Source could not be loaded.":g.data??"Loading source…"})})]})}),S.jsxs("footer",{children:[S.jsxs("div",{className:"chat-artifact-metadata",children:[S.jsx("strong",{children:wL(d.gate_status)}),y&&S.jsxs("span",{children:[y.canvas.width," × ",y.canvas.height," ",y.canvas.unit," · ",y.canvas.orientation," · ",y.direction]}),y==null?void 0:y.gate_summary.map(D=>S.jsx("span",{children:D},D))]}),S.jsxs("div",{className:"chat-artifact-actions",children:[S.jsxs("a",{href:p.png,download:!0,children:[S.jsx(bA,{})," PNG"]}),d.gate_status!=="failed"&&x&&S.jsxs("a",{href:x,download:!0,children:[S.jsx(bA,{})," PDF"]}),d.scope==="owner"&&y&&p.source&&S.jsxs("a",{href:p.source(y.entrypoint),download:!0,children:[S.jsx(nS,{})," HTML"]}),d.scope==="owner"&&y&&p.gate&&S.jsx("a",{href:p.gate(y.gate_report),download:!0,children:"Gate report"}),S.jsxs("a",{href:cne,target:"_blank",rel:"noreferrer",children:[S.jsx(n$,{})," Posterly source · AGPL-3.0"]})]})]})]})},qC=n=>{var t;const{state:e}=hm();return((t=e.selected)==null?void 0:t.artifact_kind)==="latex_paper"?S.jsx(lne,{block:e.selected,...n}):S.jsx(dne,{...n})},fne=({block:n})=>{const e=hm(),t=e.register,s=e.unregister,i=Q_(n);if(ee.useEffect(()=>{t(n)},[n,t]),ee.useEffect(()=>()=>s(i),[i,s]),n.status==="generating")return S.jsxs("div",{className:"chat-artifact-card chat-artifact-generating",role:"status",children:[S.jsx("span",{className:"chat-artifact-pulse","aria-hidden":"true"}),S.jsxs("span",{children:[S.jsx("strong",{children:n.title}),S.jsx("small",{children:"Publishing Posterly preview…"})]})]});if(n.status==="error")return S.jsxs("div",{className:"chat-artifact-card chat-artifact-error",role:"alert",children:[S.jsx(nS,{"aria-hidden":"true"}),S.jsxs("span",{children:[S.jsx("strong",{children:n.title}),S.jsx("small",{children:n.error_message??"Poster publication failed."})]})]});const r=bL(n);if(!r)return null;const o=e.state.open&&e.state.selectedKey===i;return S.jsxs("button",{type:"button",className:`chat-artifact-card${o?" is-selected":""}`,"aria-pressed":o,onClick:a=>e.open(n,a.currentTarget),children:[S.jsx("img",{src:r.preview,alt:`Preview of ${n.title}`}),S.jsxs("span",{className:"chat-artifact-card-copy",children:[S.jsxs("span",{className:"chat-artifact-kicker",children:[S.jsx(cD,{"aria-hidden":"true"})," Posterly · v",n.version]}),S.jsx("strong",{children:n.title}),S.jsx("small",{className:`chat-artifact-gate chat-artifact-gate-${n.gate_status}`,children:wL(n.gate_status)})]})]})};function pne(n){if(!n.authors.length)return"";const e=n.authors.slice(0,3).map(t=>t.name).join(", ");return n.authors.length>3?`${e}, et al.`:e}function mne(n){var t;if(n.conference)return n.conference;const e=(t=n.published)==null?void 0:t.slice(0,4);if(n.arxiv_id)return e?`arXiv ${e}`:"arXiv";if(n.source_url)try{return new URL(n.source_url).hostname.replace(/^www\./,"")}catch{}return e??"external"}function gne(n,e=240){const t=n.content.trim();return t.length<=e?t:`${t.slice(0,e).trimEnd()}…`}const yne="https://huggingface.co/pro",vne="https://huggingface.co/docs/inference-providers/pricing",bne="https://paperswithcode.co/chat",_L=()=>S.jsx("span",{className:"chat-caret"}),wne=n=>{var t;if(!n.streaming)return!1;const e=(t=n.blocks)==null?void 0:t.at(-1);return e?e.kind==="reasoning"?!e.active:e.kind==="tool"?e.status!=="running":!1:!0},_ne=n=>{var p,m;const e=n.currentTarget,t=e.ownerDocument,s=(p=t.caretPositionFromPoint)==null?void 0:p.call(t,n.clientX,n.clientY),i=s?null:(m=t.caretRangeFromPoint)==null?void 0:m.call(t,n.clientX,n.clientY),r=(s==null?void 0:s.offsetNode)??(i==null?void 0:i.startContainer),o=(s==null?void 0:s.offset)??(i==null?void 0:i.startOffset);if(!(r instanceof Text)||o===void 0||!e.contains(r))return;const a=r.data,l=/[\p{L}\p{M}\p{N}_'-]/u;let c=Math.min(o,a.length),h=c;for(;c>0&&l.test(a[c-1]);)c-=1;for(;h"]+/gi,VC=/[.,;:!?'"\]}>*_]+$/,xne=n=>{let e=n.replace(VC,"");for(;e.endsWith(")")&&e.split("(").length{const t=[];let s=0;for(const i of n.matchAll(Sne)){const r=xne(i[0]);r.endsWith("://")||(t.push(n.slice(s,i.index)),t.push(S.jsx("a",{className:"chat-user-link",href:r,target:"_blank",rel:"noopener noreferrer",children:r},`${e}-${i.index}`)),s=i.index+r.length)}return t.push(n.slice(s)),t},Ane=({text:n,mentions:e})=>{const t=[];let s=0;for(const i of[...e].sort((r,o)=>r.start-o.start)){const r=n.slice(i.start,i.end);i.startn.length||r!==i.title&&r!==`@${i.title}`||(t.push(...WC(n.slice(s,i.start),`text-${s}`)),t.push(S.jsxs("span",{className:"chat-inline-paper-mention",children:[S.jsx(t$,{size:13,"aria-hidden":"true"}),S.jsx(u0,{routeId:i.route_id,className:"chat-inline-paper-link",children:r.startsWith("@")?r.slice(1):r})]},i.key)),s=i.end)}return t.push(...WC(n.slice(s),`text-${s}`)),S.jsx(S.Fragment,{children:t})},kne=({block:n,papers:e,citations:t,webCitations:s,onToggle:i})=>n.active?S.jsxs("div",{className:"chat-reason-live",children:[S.jsxs("div",{className:"chat-reason-live-head",children:[S.jsx(tS,{})," ",S.jsx("span",{children:"Thinking…"})]}),S.jsxs("div",{className:"chat-reason-live-body chat-answer chat-reason-markdown",children:[S.jsx(sb,{text:n.text,streaming:!0,papers:e,citations:t,webCitations:s}),S.jsx(_L,{})]})]}):S.jsxs("div",{className:"chat-reason-done",children:[S.jsxs("button",{type:"button",className:"chat-reason-done-head",onClick:i,"aria-expanded":n.open,children:[S.jsx(HL,{}),S.jsx("span",{children:"Thought for a few seconds"}),S.jsx(QC,{open:n.open})]}),n.open&&S.jsx("div",{className:"chat-reason-done-body chat-answer chat-reason-markdown",children:S.jsx(sb,{text:n.text,papers:e,citations:t,webCitations:s})})]}),Ene=({block:n,papers:e,onToggle:t})=>{var d,p,m,y;const s=n.status==="running",i=s&&n.argumentState==="streaming",r=n.schema_version===2||!!n.content,o=n.status==="error"||n.status==="denied",a=typeof n.args.query=="string"?n.args.query:"",l=typeof n.args.command=="string"?n.args.command:typeof n.args.file_path=="string"?n.args.file_path:a,c=n.name.startsWith("pwc_")?Object.entries(n.args).filter(([,v])=>v!=null&&v!=="").map(([v,g])=>`${v}=${typeof g=="string"?g:JSON.stringify(g)}`).join(" · "):r?l:`("${a}")`,h=((d=n.content)==null?void 0:d.map(v=>v.text).join(""))??"",u=i?"streaming arguments…":s?"running…":r?`${n.status} · ${n.took_ms??0} ms`:`${n.hits} results · ${n.took_ms} ms`;return S.jsxs("div",{className:`chat-tool${s?" chat-tool-running":""}${o?" chat-tool-failed":""}`,children:[S.jsxs("button",{type:"button",className:"chat-tool-head",onClick:t,"aria-expanded":n.open,children:[S.jsxs("span",{className:"chat-tool-head-left",children:[s?S.jsx(tS,{}):S.jsx(BL,{}),S.jsx("code",{className:"chat-tool-name",children:n.name}),S.jsx("span",{className:"chat-tool-query",title:c,children:c})]}),S.jsxs("span",{className:"chat-tool-head-right",children:[S.jsx("span",{className:"chat-tool-status",children:u}),S.jsx(QC,{open:n.open})]})]}),n.open&&S.jsxs("div",{className:"chat-tool-body",children:[S.jsxs("div",{className:"chat-tool-args",children:[S.jsxs("span",{className:"chat-tool-label",children:["arguments",n.arguments_redacted?" · redacted":""]}),S.jsx("pre",{children:n.argumentState==="streaming"&&!n.arguments_redacted&&n.argumentText||JSON.stringify(n.args,null,2)})]}),!s&&r?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"chat-tool-output-head",children:[S.jsx("span",{className:"chat-tool-label",children:"result"}),S.jsx("button",{type:"button",className:"chat-tool-copy",onClick:()=>void navigator.clipboard.writeText(h),children:"Copy"})]}),S.jsx("pre",{className:"chat-tool-output",children:S.jsx("code",{children:h})}),((p=n.metadata)==null?void 0:p.output_truncated)&&S.jsx("div",{className:"chat-tool-truncated",children:"Output was truncated."})]}):s?null:S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"chat-tool-label chat-tool-results-label",children:["returned ",((m=n.results)==null?void 0:m.length)??0," papers"]}),S.jsx("ol",{className:"chat-tool-results",children:(y=n.results)==null?void 0:y.map(v=>S.jsxs("li",{className:"chat-hit",children:[S.jsx("div",{className:"chat-hit-top",children:S.jsx(c$,{routeId:v.route_id,paper:e[v.route_id],className:"chat-hit-title",children:v.title})}),S.jsx("div",{className:"chat-hit-meta",children:[pne(v.metadata),mne(v.metadata)].filter(Boolean).join(" · ")}),S.jsxs("div",{className:"chat-hit-snippet",children:[gne(v),v.content_truncated&&S.jsx("span",{className:"chat-hit-truncated",children:" (truncated)"})]})]},v.route_id))})]})]})]})},Cne=({block:n,papers:e,citations:t,webCitations:s,streaming:i})=>S.jsxs("div",{className:"chat-answer",children:[S.jsx(sb,{text:n.text,streaming:i,papers:e,citations:t,webCitations:s}),i&&!!n.text.trim()&&S.jsx(_L,{})]}),$ne=({block:n})=>S.jsx(H6,{block:n}),SL=n=>{const e=ee.useRef(null),t=ee.useCallback(()=>{const s=e.current;if(!s)return;s.style.height="auto";const i=Math.max(120,window.innerHeight*.4);s.style.height=`${Math.min(s.scrollHeight,i)}px`,s.style.overflowY=s.scrollHeight>i?"auto":"hidden"},[]);return ee.useLayoutEffect(()=>{var s,i;(s=e.current)==null||s.focus(),(i=e.current)==null||i.setSelectionRange(n.length,n.length),t()},[t,n.length]),{textareaRef:e,resize:t}},Tne=({id:n,text:e,paperSelection:t,editNotice:s,onCancel:i,onResend:r,onResendDraft:o})=>{const[a,l]=ee.useState(e),[c,h]=ee.useState(t),[u,d]=ee.useState(!1),{textareaRef:p,resize:m}=SL(e);ee.useLayoutEffect(m,[m,a]);const y=!!a.trim()&&a.length<=8e3,v=()=>{if(!y||u)return;d(!0),((o==null?void 0:o({text:a,paperMentions:[],...c?{paperSelection:c}:{}}))??(r==null?void 0:r(a))??!1)||d(!1)};return S.jsx("div",{className:"chat-msg chat-msg-user chat-msg-user-editing","data-message-id":n,children:S.jsxs("div",{className:"chat-inline-editor",children:[c&&S.jsx(d0,{selection:c,editable:!0,onRemove:()=>h(void 0)}),S.jsx("textarea",{ref:p,className:"chat-inline-editor-textarea","aria-label":"Edit message",value:a,maxLength:8e3,onChange:g=>l(g.target.value),onKeyDown:g=>{g.key==="Escape"?(g.preventDefault(),i==null||i()):g.key==="Enter"&&!g.shiftKey&&!g.nativeEvent.isComposing&&(g.preventDefault(),v())}}),s&&S.jsx("div",{className:"chat-inline-editor-notice",children:s}),S.jsxs("div",{className:"chat-inline-editor-actions",children:[S.jsx("button",{type:"button",onClick:i,children:"Cancel"}),S.jsx("button",{type:"button",className:"chat-inline-editor-send",disabled:!y||u,onClick:v,children:"Send"})]})]})})},Pne=({id:n,text:e,paperMentions:t,paperSelection:s,enabled:i,editNotice:r,onCancel:o,onResend:a,onResendDraft:l})=>{const[c,h]=ee.useState({text:e,paperMentions:t,...s?{paperSelection:s}:{}}),[u,d]=ee.useState(!1),[p,m]=ee.useState(0),{textareaRef:y,resize:v}=SL(e),g=XC({draft:c,onChange:h,enabled:i,textareaRef:y});ee.useLayoutEffect(v,[v,c.text]);const _=!!c.text.trim()&&c.text.length<=8e3&&(i||c.paperMentions.length===0),b=()=>{if(!_||u)return;d(!0),((l==null?void 0:l(c))??(a==null?void 0:a(c.text))??!1)||d(!1)};return S.jsx("div",{className:"chat-msg chat-msg-user chat-msg-user-editing","data-message-id":n,children:S.jsxs("div",{className:"chat-inline-editor",children:[c.paperSelection&&S.jsx(d0,{selection:c.paperSelection,editable:!0,onRemove:()=>h({text:c.text,paperMentions:c.paperMentions})}),S.jsxs("div",{className:"chat-inline-editor-textarea-wrap",children:[S.jsx(YC,{text:c.text,mentions:c.paperMentions,scrollTop:p,variant:"editor"}),S.jsx("textarea",{ref:y,className:"chat-inline-editor-textarea","aria-label":"Edit message",value:c.text,maxLength:8e3,role:"combobox","aria-autocomplete":"list","aria-expanded":g.open,"aria-controls":g.open?g.pickerId:void 0,"aria-activedescendant":g.open&&g.results.length?`${g.optionIdPrefix}-${g.activeIndex}`:void 0,onChange:x=>g.updateText(x.target.value,x.target.selectionStart),onSelect:x=>g.refresh(x.currentTarget.selectionStart),onScroll:x=>m(x.currentTarget.scrollTop),onKeyDown:x=>{g.keyDown(x)||(x.key==="Escape"?(x.preventDefault(),o==null||o()):x.key==="Enter"&&!x.shiftKey&&!x.nativeEvent.isComposing&&(x.preventDefault(),b()))}}),S.jsx(JC,{open:g.open,query:g.query,results:g.results,activeIndex:g.activeIndex,loading:g.loading,error:g.error,onSelect:g.select,id:g.pickerId,optionIdPrefix:g.optionIdPrefix})]}),!i&&c.paperMentions.length>0&&S.jsx("div",{className:"chat-inline-editor-notice",role:"status",children:"Paper mentions are currently disabled. Remove them before sending."}),r&&S.jsx("div",{className:"chat-inline-editor-notice",children:r}),S.jsxs("div",{className:"chat-inline-editor-actions",children:[S.jsx("button",{type:"button",onClick:o,children:"Cancel"}),S.jsx("button",{type:"button",className:"chat-inline-editor-send",disabled:!_||u,onClick:b,children:"Send"})]})]})})},pse=({id:n,text:e,paperMentions:t=[],paperSelection:s,paperMentionsEnabled:i=!1,editingAllowed:r=!1,editing:o=!1,editNotice:a,onEdit:l,onCancel:c,onResend:h,onResendDraft:u})=>{const[d,p]=ee.useState(!1),m=ee.useRef(null);ee.useEffect(()=>()=>{m.current!==null&&window.clearTimeout(m.current)},[]);const y=async()=>{var v;if((v=navigator.clipboard)!=null&&v.writeText)try{await navigator.clipboard.writeText(e),p(!0),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>p(!1),1500)}catch{}};return o?!i&&t.length===0?S.jsx(Tne,{id:n,text:e,paperSelection:s,editNotice:a,onCancel:c,onResend:h,onResendDraft:u}):S.jsx(Pne,{id:n,text:e,paperMentions:t,paperSelection:s,enabled:i,editNotice:a,onCancel:c,onResend:h,onResendDraft:u}):S.jsx("div",{className:"chat-msg chat-msg-user","data-message-id":n,children:S.jsxs("div",{className:"chat-user-message-wrap",children:[s&&S.jsx(d0,{selection:s}),S.jsx("div",{className:"chat-bubble",onDoubleClick:_ne,children:S.jsx(Ane,{text:e,mentions:t})}),S.jsxs("div",{className:"chat-user-actions",children:[S.jsx("button",{type:"button",className:"chat-user-action","aria-label":d?"Message copied":"Copy message",title:d?"Copied":"Copy",onClick:()=>void y(),children:d?S.jsx(IL,{"aria-hidden":"true"}):S.jsx(eD,{"aria-hidden":"true"})}),r&&S.jsx("button",{type:"button",className:"chat-user-action","aria-label":"Edit message",title:"Edit",onClick:l,children:S.jsx(r$,{"aria-hidden":"true"})})]})]})})},mse=({msg:n,papers:e,onToggleBlock:t,onRetryCompaction:s,onRetryWithLuna:i,onArchiveOldChats:r,onArchiveOldestChats:o,archivePending:a=null,hfBilling:l=null,openRouterFallbackEnabled:c=!1,feedbackEnabled:h=!1})=>{var D,H,j,U;const[u,d]=ee.useState(null),[p,m]=ee.useState(!1),[y,v]=ee.useState(!1),[g,_]=ee.useState(!1),[b,x]=ee.useState(""),A=ee.useRef(null),T=`chat-feedback-panel-${n.id}`,C=h&&!n.streaming&&!n.error&&!!((D=n.blocks)!=null&&D.some(B=>B.kind==="answer"&&B.text.trim()));ee.useEffect(()=>{var B;g&&((B=A.current)==null||B.focus())},[g]);const I=async(B,L)=>{if(!p){m(!0),v(!1);try{L===void 0?await vA.reportFeedback(n.id,B):await vA.reportFeedback(n.id,B,L),d(B),_(!1),x("")}catch{v(!0)}finally{m(!1)}}};return S.jsx("div",{className:"chat-msg chat-msg-assistant",children:S.jsxs("div",{className:"chat-msg-blocks",children:[(H=n.blocks)==null?void 0:H.map((B,L)=>{var ge;const X=`${n.id}-${L}`,se="citations"in B&&B.citations!==void 0?B.citations:n.citations??[],J=Object.fromEntries(se.filter(z=>(z.kind==="catalog_paper"||z.kind==="paper"||!z.kind&&z.route_id)&&z.route_id).map(z=>[z.route_id,z])),Y=Object.fromEntries(se.filter(z=>(z.kind==="external_source"||z.kind==="web")&&z.url).map(z=>[z.url,z]));return B.kind==="reasoning"?S.jsx(kne,{block:B,papers:e,citations:J,webCitations:Y,onToggle:()=>t(n.id,L)},X):B.kind==="tool"?S.jsx(Ene,{block:B,papers:e,onToggle:()=>t(n.id,L)},X):B.kind==="app"?S.jsx($ne,{block:B},B.instance_id||X):B.kind==="artifact"?S.jsx(fne,{block:B},B.publication_id||B.version_id||X):S.jsx(Cne,{block:B,papers:e,citations:J,webCitations:Y,streaming:!!(n.streaming&&L===(((ge=n.blocks)==null?void 0:ge.length)??0)-1)},X)}),n.streaming&&n.compacting&&S.jsx(pD,{}),!n.compacting&&wne(n)&&S.jsx("div",{className:"chat-waiting",role:"status","aria-live":"polite",children:S.jsx("span",{className:"chat-thinking",children:(((j=n.blocks)==null?void 0:j.length)??0)===0?n.status??"Thinking…":"Thinking…"})}),n.error&&S.jsxs("div",{className:"chat-error",children:[((U=n.blocks)==null?void 0:U.some(B=>B.kind==="answer"&&B.text.trim()))&&S.jsx("strong",{children:"Incomplete—response interrupted. "}),["context_too_large","provider_error","persistence_error"].includes(n.errorCode??"")&&s&&S.jsx("button",{type:"button",onClick:s,children:"Retry"}),S.jsx("span",{children:n.errorCode==="chat_disabled_interrupted"?"Chat was disabled while this response was running. The partial response is saved. Please try again later.":n.errorCode==="chat_session_quota_exceeded"?n.error:`The assistant hit an error: ${n.error}`}),["hf_inference_billing_required","hf_inference_credential_expired"].includes(n.errorCode??"")&&S.jsx("a",{href:"/settings",children:"Re-sign in with Hugging Face"}),n.errorCode==="hf_inference_billing_exhausted"&&S.jsxs(S.Fragment,{children:[i&&S.jsx("button",{type:"button",onClick:i,children:"Retry with GPT-6 Luna"}),(l==null?void 0:l.account_type)==="Free"&&!l.bill_to?S.jsx("a",{href:yne,target:"_blank",rel:"noreferrer",children:"Upgrade to Hugging Face PRO — $9/month for 20× more included credits"}):S.jsx("a",{href:(l==null?void 0:l.usage_url)??"/settings",target:l?"_blank":void 0,rel:l?"noreferrer":void 0,children:"Review Hugging Face usage and billing"}),S.jsx("a",{href:vne,target:"_blank",rel:"noreferrer",children:"Inference Providers pricing and billing details"})]}),n.errorCode==="hf_sponsored_unavailable"&&i&&S.jsx("button",{type:"button",onClick:i,children:"Retry with GPT-6 Luna"}),n.errorCode==="openrouter_monthly_budget_exhausted"&&S.jsxs(S.Fragment,{children:[c?S.jsx("span",{children:"This response started on the shared allowance. Your connected OpenRouter key will be used when you explicitly retry."}):S.jsx("a",{href:"/settings#openrouter-byok",children:"Connect your own OpenRouter key"}),S.jsx("span",{children:"Or select a Hugging Face-backed model and explicitly retry."})]}),n.errorCode==="openrouter_staging_funding_disabled"&&S.jsx("a",{href:bne,children:"Continue on paperswithcode.co"}),n.errorCode==="openrouter_unavailable"&&S.jsxs(S.Fragment,{children:[S.jsx("a",{href:"/settings#openrouter-byok",children:"Bring your own key in Settings"}),S.jsx("a",{href:"https://github.com/huggingface/paperswithcode-feedback",target:"_blank",rel:"noreferrer",children:"File an issue"})]}),n.errorCode==="openrouter_byok_billing_error"&&S.jsx("a",{href:"https://openrouter.ai/settings/credits",target:"_blank",rel:"noreferrer",children:"Review OpenRouter billing"}),["openrouter_byok_credential_invalid","openrouter_byok_rate_limit"].includes(n.errorCode??"")&&S.jsx("a",{href:"/settings#openrouter-byok",children:"Review OpenRouter settings"}),n.errorCode==="chat_session_quota_exceeded"&&(r||o)&&S.jsxs("span",{className:"chat-error-actions",children:[r&&S.jsx("button",{type:"button",disabled:a!==null,onClick:r,children:a==="old"?"Archiving…":"Archive chats older than 30 days"}),o&&S.jsx("button",{type:"button",disabled:a!==null,onClick:o,children:a==="oldest"?"Archiving…":"Archive oldest 50 chats"})]})]}),!n.streaming&&n.finishReason&&!["success","scope_blocked"].includes(n.finishReason)&&S.jsx("div",{className:"chat-finish-note",children:["tool_limit","max_turns"].includes(n.finishReason)?"The assistant stopped at the execution limit.":`The assistant stopped early (${n.finishReason.replace(/_/g," ")}).`}),C&&S.jsxs("div",{className:"chat-feedback","aria-label":"Rate this response",children:[S.jsx("span",{className:"chat-feedback-label",children:u===null?"Was this helpful?":"Thanks for your feedback"}),S.jsx("button",{type:"button",className:`chat-feedback-action${u===!0?" chat-feedback-action-selected":""}`,"aria-label":"Helpful response","aria-pressed":u===!0,disabled:p,onClick:()=>{_(!1),I(!0)},children:S.jsx(tD,{"aria-hidden":"true"})}),S.jsx("button",{type:"button",className:`chat-feedback-action${u===!1?" chat-feedback-action-selected":""}`,"aria-label":"Unhelpful response","aria-pressed":u===!1,"aria-expanded":g,"aria-controls":T,disabled:p,onClick:()=>{v(!1),_(!0)},children:S.jsx(dD,{"aria-hidden":"true"})}),y&&S.jsx("span",{className:"chat-feedback-error",role:"status",children:"Couldn’t send feedback."})]}),C&&g&&S.jsxs("div",{className:"chat-feedback-panel",id:T,role:"group","aria-labelledby":`${T}-title`,children:[S.jsx("div",{className:"chat-feedback-panel-title",id:`${T}-title`,children:"Additional feedback"}),S.jsx("label",{className:"chat-feedback-panel-label",htmlFor:`${T}-comment`,children:"Tell us what went wrong (optional)"}),S.jsx("textarea",{ref:A,id:`${T}-comment`,className:"chat-feedback-comment",value:b,maxLength:500,rows:4,disabled:p,onChange:B=>x(B.target.value),onKeyDown:B=>{B.key==="Escape"&&(B.preventDefault(),_(!1))}}),S.jsxs("div",{className:"chat-feedback-panel-actions",children:[S.jsx("button",{type:"button",className:"chat-feedback-skip",disabled:p,onClick:()=>void I(!1),children:"Skip"}),S.jsx("button",{type:"button",className:"chat-feedback-submit",disabled:p,onClick:()=>void I(!1,b.trim()||void 0),children:p?"Submitting…":"Submit"})]})]})]})})},Rne={chat:{breakpoint:760,left:360,right:360},shared:{breakpoint:760,left:360,right:360},reader:{breakpoint:1260,left:840,right:420}};function Ga(n,e,t,s){if(!n)return Math.max(25,Math.min(75,e));const i=Math.max(25,s/n*100),r=Math.min(75,(n-t)/n*100);return Math.max(i,Math.min(r,e))}const gse=({children:n,variant:e})=>{var _;const t=hm(),s=Rne[e],i=ee.useRef(null),r=ee.useRef(null),o=ee.useRef(null),a=ee.useRef(null),[l,c]=ee.useState(0),h=ee.useRef(!1),u=ee.useRef(t.state.panelPercent);ee.useLayoutEffect(()=>{const b=i.current;if(!b)return;const x=()=>c(b.clientWidth||window.innerWidth);if(x(),typeof ResizeObserver>"u")return;const A=new ResizeObserver(x);return A.observe(b),()=>A.disconnect()},[]);const d=t.state.open&&l>=s.breakpoint,p=Ga(l,t.state.panelPercent,s.left,s.right),m=((_=t.state.selected)==null?void 0:_.artifact_kind)==="latex_paper"?"paper":"poster",y=b=>{var A;const x=Ga(l,b,s.left,s.right);u.current=x,r.current&&(r.current.style.width=`${100-x}%`),o.current&&(o.current.style.width=`${x}%`),(A=a.current)==null||A.setAttribute("aria-valuenow",String(Math.round(x)))},v=b=>{var A;const x=(A=i.current)==null?void 0:A.getBoundingClientRect();x!=null&&x.width&&y((x.right-b)/x.width*100)},g=()=>{h.current&&(h.current=!1,t.setPanelPercent(u.current))};return S.jsxs("div",{ref:i,className:`chat-artifact-workspace chat-artifact-workspace-${e}${d?" has-docked-artifact":""}`,"data-artifact-layout":d?"split":t.state.open?"dialog":"closed",children:[S.jsx("div",{ref:r,className:"chat-artifact-workspace-content",style:d?{width:`${100-p}%`}:void 0,children:n}),d&&S.jsxs(S.Fragment,{children:[S.jsx("div",{ref:a,className:"chat-artifact-resize-handle",role:"separator","aria-label":`Resize conversation and ${m} panels`,"aria-orientation":"vertical","aria-valuemin":Math.ceil(Ga(l,0,s.left,s.right)),"aria-valuemax":Math.floor(Ga(l,100,s.left,s.right)),"aria-valuenow":Math.round(p),tabIndex:0,onPointerDown:b=>{h.current=!0,b.currentTarget.setPointerCapture(b.pointerId),v(b.clientX)},onPointerMove:b=>{h.current&&v(b.clientX)},onPointerUp:g,onPointerCancel:g,onLostPointerCapture:g,onDoubleClick:()=>t.setPanelPercent(55),onKeyDown:b=>{(b.key==="ArrowLeft"||b.key==="ArrowRight")&&(b.preventDefault(),t.setPanelPercent(Ga(l,p+(b.key==="ArrowLeft"?2:-2),s.left,s.right))),b.key==="Home"&&t.setPanelPercent(Ga(l,25,s.left,s.right)),b.key==="End"&&t.setPanelPercent(Ga(l,75,s.left,s.right))}}),S.jsx("div",{ref:o,className:"chat-artifact-workspace-pane",style:{width:`${p}%`},children:S.jsx(qC,{})})]}),t.state.open&&!d&&S.jsx(qC,{forceDialog:!0,readerFallback:e==="reader"})]})};export{fse as A,tse as C,HY as P,VX as R,pse as U,gse as a,mse as b,hm as c,nse as d,PD as e,dse as f,Q_ as g,BX as u}; +${V||"No compiler diagnostic was available."}`)},As=V=>{!V||!Fe("files")||t.setSourceFile(V)};return S.jsxs("section",{ref:I,className:`chat-artifact-panel${H?" is-dialog":" is-docked"}`,role:H?"dialog":"complementary","aria-modal":H?!0:void 0,"aria-labelledby":"latex-paper-title","data-testid":"latex-paper-panel",children:[S.jsxs("header",{children:[S.jsxs("div",{children:[S.jsx("span",{children:"Private paper"}),S.jsx("h2",{id:"latex-paper-title",children:n.title}),S.jsxs("p",{className:"chat-paper-status",role:"status","aria-live":"polite",children:[L?`Source v${L.version} · ${L.compile_status}`:"Preparing paper source",ct?" · Preview out of date":""]}),S.jsx("p",{className:"chat-paper-privacy-note",children:"This paper is private to this chat. Source, figures, and PDFs are stored privately; AI-authored text needs your review."})]}),S.jsxs("div",{className:"chat-artifact-header-actions",children:[S.jsx("button",{type:"button","aria-expanded":b,"aria-controls":"paper-version-history",onClick:()=>{T(null),x(!b)},children:"Version history"}),S.jsx("button",{type:"button","data-artifact-close":!0,"aria-label":H?"Back to conversation":"Close paper",onClick:Pn,children:S.jsx(c0,{})})]})]}),S.jsxs("nav",{"aria-label":"Paper views",role:"tablist",children:[S.jsx("button",{type:"button",id:"paper-preview-tab",role:"tab","aria-selected":t.state.tab==="preview","aria-controls":"paper-preview-panel",tabIndex:t.state.tab==="preview"?0:-1,className:t.state.tab==="preview"?"active":"",onClick:()=>Fe("preview"),onKeyDown:Je,children:"Preview"}),S.jsx("button",{type:"button",id:"paper-files-tab",role:"tab","aria-selected":t.state.tab==="files","aria-controls":"paper-files-panel",tabIndex:t.state.tab==="files"?0:-1,className:t.state.tab==="files"?"active":"",onClick:()=>Fe("files"),onKeyDown:Je,children:"Files"})]}),S.jsxs("div",{id:t.state.tab==="preview"?"paper-preview-panel":"paper-files-panel",role:"tabpanel","aria-labelledby":t.state.tab==="preview"?"paper-preview-tab":"paper-files-tab",className:"chat-artifact-panel-body",children:[t.state.tab==="preview"?U.isError?S.jsxs("div",{role:"alert",children:["Could not load paper details. ",S.jsx("button",{type:"button",onClick:()=>void U.refetch(),children:"Retry paper details"})]}):Ae?S.jsx(HY,{url:Ae,downloadUrl:rne(n.artifact_id),paperKey:`${n.artifact_id}:${X==null?void 0:X.version_id}`,paperTitle:n.title,paperHref:"/chat",chrome:"canvas"},X==null?void 0:X.version_id):L?L.compile_status==="failed"?S.jsx("p",{role:"alert",children:"No compiled preview is available for this failed source version. Review the diagnostics or fix the paper in Files."}):["queued","compiling"].includes(L.compile_status)?S.jsx("p",{role:"status",children:"Preview is compiling. The stored source is available in Files."}):S.jsx("p",{role:"alert",children:"No compiled preview is available for this source version."}):S.jsx("p",{role:"status",children:"Paper source and compiled preview are not available yet."}):S.jsxs("div",{className:"chat-artifact-source-workspace",children:[S.jsxs("nav",{"aria-label":"Paper source files",children:[Y.map(V=>S.jsx("button",{type:"button","aria-pressed":Z===V.path,onClick:()=>it(V.path),children:V.path},V.path)),ae&&S.jsxs("button",{type:"button",className:"latex-file-action","aria-label":"Add TeX file",onClick:bn,children:[S.jsx(lD,{})," Add file"]}),ae&&S.jsxs("label",{className:"latex-file-action",children:["Upload figure",S.jsx("input",{"aria-label":"Upload figure",type:"file",accept:"image/png,image/jpeg,application/pdf,.png,.jpg,.jpeg,.pdf",disabled:R.isPending,onChange:V=>{var Ce;const ye=(Ce=V.currentTarget.files)==null?void 0:Ce[0];V.currentTarget.value="",ye&&R.mutate(ye)}})]}),ge.map(V=>L&&S.jsx("a",{href:ine(n.artifact_id,L.version_id,V.path),download:!0,children:V.path},V.path))]}),S.jsxs("div",{className:"latex-editor-column",children:[Z&&a[Z]!==void 0?S.jsx(ene,{path:Z,value:a[Z],readOnly:!ae,onChange:V=>l({...a,[Z]:V})}):S.jsx("p",{children:z.isError?"Source could not be loaded.":"Loading source…"}),ae&&Z&&Z!==((an=J.data)==null?void 0:an.root_document)&&S.jsxs("div",{className:"latex-file-buttons",children:[S.jsxs("button",{type:"button",onClick:ut,children:[S.jsx(r$,{})," Rename"]}),S.jsxs("button",{type:"button",onClick:Ss,children:[S.jsx(GL,{})," Delete"]})]})]})]}),b&&S.jsxs("section",{id:"paper-version-history",className:"chat-artifact-history","aria-label":"Paper version history",children:[S.jsx("h3",{children:"Version history"}),se.isLoading&&S.jsx("p",{children:"Loading history…"}),se.isError&&S.jsx("p",{role:"alert",children:"Paper history could not be loaded."}),(Es=se.data)==null?void 0:Es.items.map(V=>{var ye,Ce,rt,qt;return S.jsxs("article",{children:[S.jsxs("strong",{children:["v",V.version," · ",V.compile_status]}),S.jsx("span",{children:ane(V)}),V.created_at&&S.jsx("time",{dateTime:V.created_at,children:V.created_at}),V.parent_version_id&&S.jsxs("span",{children:["Parent ",ie.has(V.parent_version_id)?`v${ie.get(V.parent_version_id)}`:V.parent_version_id]}),(ye=V.provenance)!=null&&ye.changed_files.length?S.jsxs("span",{children:["Changed: ",V.provenance.changed_files.join(", ")]}):null,((Ce=V.provenance)==null?void 0:Ce.restored_from_version_id)&&S.jsxs("span",{children:["Restored from ",V.provenance.restored_from_version_id]}),((rt=V.provenance)==null?void 0:rt.change_summary)&&S.jsx("p",{children:V.provenance.change_summary}),(qt=V.provenance)==null?void 0:qt.reference_changes.map(zr=>S.jsx("p",{children:zr},zr)),S.jsx("a",{href:BC(n.artifact_id,V.version_id),download:!0,children:"Source ZIP"}),(B==null?void 0:B.editing_enabled)&&(L==null?void 0:L.version_id)&&V.version_id!==L.version_id&&S.jsxs("button",{type:"button",disabled:O.isPending||j,onClick:()=>O.mutate(V.version_id),children:["Restore version ",V.version]})]},V.version_id)}),((qu=se.data)==null?void 0:qu.next_cursor)&&S.jsx("button",{type:"button",onClick:()=>T(se.data.next_cursor??null),children:"Load older versions"})]})]}),S.jsxs("footer",{children:[S.jsxs("div",{className:"chat-artifact-metadata","aria-live":"polite",children:[ct&&S.jsx("strong",{children:"Out of date"}),(Io=L==null?void 0:L.compile_diagnostics)==null?void 0:Io.map((V,ye)=>S.jsxs("button",{type:"button",onClick:()=>As(V.file),className:"latex-compile-diagnostic",children:[V.file?`${V.file}${V.line?`:${V.line}`:""}: `:"",V.message]},`${V.file??"global"}:${V.line??""}:${ye}`)),g&&S.jsx("span",{role:"alert",children:g}),y&&S.jsx("button",{type:"button",onClick:xs,children:"Discard stale local draft"})]}),S.jsxs("div",{className:"chat-artifact-actions",children:[(L==null?void 0:L.compile_status)==="failed"&&!L.repair_exhausted&&S.jsx("button",{type:"button",onClick:ls,children:"Ask AI to fix"}),(L==null?void 0:L.compile_status)==="failed"&&L.repair_exhausted&&S.jsx("span",{role:"status",children:"AI repair attempts exhausted"}),t.state.tab==="files"&&ae&&S.jsxs("button",{type:"button",disabled:!j,onClick:()=>E.mutate(),children:[S.jsx(uD,{}),E.isPending?"Saving…":"Save & Compile"]}),L&&S.jsxs("a",{href:BC(n.artifact_id,L.version_id),download:!0,children:[S.jsx(nS,{})," Source ZIP"]})]})]})]})},cne="https://github.com/Chenruishuo/posterly/tree/b9f42e5578a49a27525a68f85376bb3bb25af86f";function hne(){if(typeof window>"u")return null;const n=window.location.pathname.match(/^\/share\/([^/]+)/u);return n?decodeURIComponent(n[1]):null}function bL(n){if(n.scope==="public"){const s=hne();if(!s||!n.public_capability)return null;const i=`/api/v1/chat/shares/${encodeURIComponent(s)}/artifacts/${encodeURIComponent(n.public_capability)}`;return{preview:rn(`${i}/preview`),png:rn(`${i}/download/png`),pdf:rn(`${i}/download/pdf`),manifest:null,source:null,gate:null,download:null}}if(!n.artifact_id||!n.version_id)return null;const e=`/api/v1/chat/artifacts/${encodeURIComponent(n.artifact_id)}/versions/${encodeURIComponent(n.version_id)}`,t=(s,i)=>rn(`${e}/${s}/${i.split("/").map(encodeURIComponent).join("/")}`);return{preview:rn(`${e}/preview`),png:t("download","poster.png"),pdf:null,manifest:rn(`${e}/manifest`),source:s=>t("source",s),gate:s=>t("source",s),download:s=>t("download",s)}}const wL=n=>({passed:"Passed",warnings:"Passed with warnings",failed:"Draft—checks failed"})[n??"passed"];function une(){const[n,e]=ee.useState(()=>{var t;return typeof window<"u"&&((t=window.matchMedia)==null?void 0:t.call(window,"(max-width: 760px)").matches)});return ee.useEffect(()=>{var i,r;const t=(i=window.matchMedia)==null?void 0:i.call(window,"(max-width: 760px)");if(!t)return;const s=()=>e(t.matches);return s(),(r=t.addEventListener)==null||r.call(t,"change",s),()=>{var o;return(o=t.removeEventListener)==null?void 0:o.call(t,"change",s)}},[]),n}const dne=({forceDialog:n=!1,readerFallback:e=!1})=>{var A,T,C,I;const t=hm(),s=t.close,{state:i}=t,r=i.selected,o=une(),a=n||o,l=ee.useRef(null),c=ee.useRef(!1),h=wo({queryKey:["chat-artifact-versions",r==null?void 0:r.artifact_id],queryFn:async()=>{const D=await fetch(rn(`/api/v1/chat/artifacts/${encodeURIComponent(r.artifact_id)}`),{credentials:"include",cache:"no-store"});if(!D.ok)throw new Error("Could not load poster versions");return(await D.json()).versions},enabled:i.open&&(r==null?void 0:r.scope)==="owner"&&!!r.artifact_id,staleTime:Number.POSITIVE_INFINITY}),u=(A=h.data)==null?void 0:A.find(D=>D.version_id===i.selectedVersionId),d=r&&u?{...r,version_id:u.version_id,version:u.version,gate_status:u.gate_status,total_bytes:u.total_bytes}:r,p=d?bL(d):null,y=wo({queryKey:["chat-artifact-manifest",d==null?void 0:d.version_id],queryFn:async()=>{const D=await fetch(p.manifest,{credentials:"include",cache:"no-store"});if(!D.ok)throw new Error("Could not load poster details");return D.json()},enabled:i.open&&(d==null?void 0:d.scope)==="owner"&&!!(p!=null&&p.manifest),staleTime:Number.POSITIVE_INFINITY}).data,v=i.sourceFile??(y==null?void 0:y.entrypoint)??null,g=wo({queryKey:["chat-artifact-source",d==null?void 0:d.version_id,v],queryFn:async()=>{const D=await fetch(p.source(v),{credentials:"include",cache:"no-store"});if(!D.ok)throw new Error("Source could not be loaded");return D.text()},enabled:i.open&&i.tab==="source"&&(d==null?void 0:d.scope)==="owner"&&!!(v&&(p!=null&&p.source)),staleTime:Number.POSITIVE_INFINITY});if(ee.useEffect(()=>{var H,j;if(!i.open||!a)return;(j=(H=l.current)==null?void 0:H.querySelector("[data-artifact-close]"))==null||j.focus(),window.history.pushState({...window.history.state,pwcArtifactPanel:!0},""),c.current=!0;const D=()=>{c.current=!1,s()};return window.addEventListener("popstate",D),()=>window.removeEventListener("popstate",D)},[s,a,i.open]),ee.useEffect(()=>{if(!i.open||!a)return;const D=H=>{if(H.key==="Escape"){H.preventDefault(),s(),c.current&&(c.current=!1,window.history.back());return}if(H.key!=="Tab"||!l.current)return;const j=[...l.current.querySelectorAll('button:not([disabled]), a[href], select:not([disabled]), [tabindex]:not([tabindex="-1"])')];if(!j.length)return;const U=j[0],B=j.at(-1);H.shiftKey&&document.activeElement===U?(H.preventDefault(),B.focus()):!H.shiftKey&&document.activeElement===B&&(H.preventDefault(),U.focus())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[s,a,i.open]),!i.open||!d||!p)return null;const _=()=>{s(),a&&c.current&&(c.current=!1,window.history.back())},b=(T=y==null?void 0:y.downloads[0])==null?void 0:T.path,x=d.scope==="public"?p.pdf:b&&p.download?p.download(b):null;return S.jsxs("section",{ref:l,className:`chat-artifact-panel${a?" is-dialog":" is-docked"}${e?" is-reader-fallback":""}`,role:a?"dialog":"complementary","aria-modal":a?!0:void 0,"aria-label":d.title,"data-testid":"artifact-panel",children:[S.jsxs("header",{children:[S.jsxs("div",{children:[S.jsx("span",{children:"Posterly artifact"}),S.jsx("h2",{children:d.title})]}),(((C=h.data)==null?void 0:C.length)??0)>1&&S.jsxs("label",{className:"chat-artifact-version",children:["Version",S.jsx("select",{"aria-label":"Poster version",value:d.version_id,onChange:D=>t.setVersion(D.target.value),children:[...h.data??[]].reverse().map(D=>S.jsxs("option",{value:D.version_id,children:["v",D.version]},D.version_id))})]}),S.jsx("button",{type:"button","data-artifact-close":!0,"aria-label":a?"Back to conversation":"Close poster",onClick:_,children:S.jsx(c0,{})})]}),S.jsxs("nav",{"aria-label":"Poster views",children:[S.jsx("button",{type:"button","aria-pressed":i.tab==="preview",className:i.tab==="preview"?"active":"",onClick:()=>t.setTab("preview"),children:"Preview"}),d.scope==="owner"&&S.jsx("button",{type:"button","aria-pressed":i.tab==="source",className:i.tab==="source"?"active":"",onClick:()=>t.setTab("source"),children:"Source"})]}),S.jsx("div",{className:"chat-artifact-panel-body",children:i.tab==="preview"?S.jsx("img",{src:p.preview,alt:`Full preview of ${d.title}`}):S.jsxs("div",{className:"chat-artifact-source-workspace",children:[(((I=y==null?void 0:y.source_files)==null?void 0:I.length)??0)>1&&S.jsx("nav",{"aria-label":"Poster source files",children:y.source_files.map(D=>S.jsx("button",{type:"button","aria-pressed":v===D,onClick:()=>t.setSourceFile(D),children:D},D))}),S.jsx("pre",{children:S.jsx("code",{children:g.isError?"Source could not be loaded.":g.data??"Loading source…"})})]})}),S.jsxs("footer",{children:[S.jsxs("div",{className:"chat-artifact-metadata",children:[S.jsx("strong",{children:wL(d.gate_status)}),y&&S.jsxs("span",{children:[y.canvas.width," × ",y.canvas.height," ",y.canvas.unit," · ",y.canvas.orientation," · ",y.direction]}),y==null?void 0:y.gate_summary.map(D=>S.jsx("span",{children:D},D))]}),S.jsxs("div",{className:"chat-artifact-actions",children:[S.jsxs("a",{href:p.png,download:!0,children:[S.jsx(bA,{})," PNG"]}),d.gate_status!=="failed"&&x&&S.jsxs("a",{href:x,download:!0,children:[S.jsx(bA,{})," PDF"]}),d.scope==="owner"&&y&&p.source&&S.jsxs("a",{href:p.source(y.entrypoint),download:!0,children:[S.jsx(nS,{})," HTML"]}),d.scope==="owner"&&y&&p.gate&&S.jsx("a",{href:p.gate(y.gate_report),download:!0,children:"Gate report"}),S.jsxs("a",{href:cne,target:"_blank",rel:"noreferrer",children:[S.jsx(n$,{})," Posterly source · AGPL-3.0"]})]})]})]})},qC=n=>{var t;const{state:e}=hm();return((t=e.selected)==null?void 0:t.artifact_kind)==="latex_paper"?S.jsx(lne,{block:e.selected,...n}):S.jsx(dne,{...n})},fne=({block:n})=>{const e=hm(),t=e.register,s=e.unregister,i=Q_(n);if(ee.useEffect(()=>{t(n)},[n,t]),ee.useEffect(()=>()=>s(i),[i,s]),n.status==="generating")return S.jsxs("div",{className:"chat-artifact-card chat-artifact-generating",role:"status",children:[S.jsx("span",{className:"chat-artifact-pulse","aria-hidden":"true"}),S.jsxs("span",{children:[S.jsx("strong",{children:n.title}),S.jsx("small",{children:"Publishing Posterly preview…"})]})]});if(n.status==="error")return S.jsxs("div",{className:"chat-artifact-card chat-artifact-error",role:"alert",children:[S.jsx(nS,{"aria-hidden":"true"}),S.jsxs("span",{children:[S.jsx("strong",{children:n.title}),S.jsx("small",{children:n.error_message??"Poster publication failed."})]})]});const r=bL(n);if(!r)return null;const o=e.state.open&&e.state.selectedKey===i;return S.jsxs("button",{type:"button",className:`chat-artifact-card${o?" is-selected":""}`,"aria-pressed":o,onClick:a=>e.open(n,a.currentTarget),children:[S.jsx("img",{src:r.preview,alt:`Preview of ${n.title}`}),S.jsxs("span",{className:"chat-artifact-card-copy",children:[S.jsxs("span",{className:"chat-artifact-kicker",children:[S.jsx(cD,{"aria-hidden":"true"})," Posterly · v",n.version]}),S.jsx("strong",{children:n.title}),S.jsx("small",{className:`chat-artifact-gate chat-artifact-gate-${n.gate_status}`,children:wL(n.gate_status)})]})]})};function pne(n){if(!n.authors.length)return"";const e=n.authors.slice(0,3).map(t=>t.name).join(", ");return n.authors.length>3?`${e}, et al.`:e}function mne(n){var t;if(n.conference)return n.conference;const e=(t=n.published)==null?void 0:t.slice(0,4);if(n.arxiv_id)return e?`arXiv ${e}`:"arXiv";if(n.source_url)try{return new URL(n.source_url).hostname.replace(/^www\./,"")}catch{}return e??"external"}function gne(n,e=240){const t=n.content.trim();return t.length<=e?t:`${t.slice(0,e).trimEnd()}…`}const yne="https://huggingface.co/pro",vne="https://huggingface.co/docs/inference-providers/pricing",bne="https://paperswithcode.co/chat",_L=()=>S.jsx("span",{className:"chat-caret"}),wne=n=>{var t;if(!n.streaming)return!1;const e=(t=n.blocks)==null?void 0:t.at(-1);return e?e.kind==="reasoning"?!e.active:e.kind==="tool"?e.status!=="running":!1:!0},_ne=n=>{var p,m;const e=n.currentTarget,t=e.ownerDocument,s=(p=t.caretPositionFromPoint)==null?void 0:p.call(t,n.clientX,n.clientY),i=s?null:(m=t.caretRangeFromPoint)==null?void 0:m.call(t,n.clientX,n.clientY),r=(s==null?void 0:s.offsetNode)??(i==null?void 0:i.startContainer),o=(s==null?void 0:s.offset)??(i==null?void 0:i.startOffset);if(!(r instanceof Text)||o===void 0||!e.contains(r))return;const a=r.data,l=/[\p{L}\p{M}\p{N}_'-]/u;let c=Math.min(o,a.length),h=c;for(;c>0&&l.test(a[c-1]);)c-=1;for(;h"]+/gi,VC=/[.,;:!?'"\]}>*_]+$/,xne=n=>{let e=n.replace(VC,"");for(;e.endsWith(")")&&e.split("(").length{const t=[];let s=0;for(const i of n.matchAll(Sne)){const r=xne(i[0]);r.endsWith("://")||(t.push(n.slice(s,i.index)),t.push(S.jsx("a",{className:"chat-user-link",href:r,target:"_blank",rel:"noopener noreferrer",children:r},`${e}-${i.index}`)),s=i.index+r.length)}return t.push(n.slice(s)),t},Ane=({text:n,mentions:e})=>{const t=[];let s=0;for(const i of[...e].sort((r,o)=>r.start-o.start)){const r=n.slice(i.start,i.end);i.startn.length||r!==i.title&&r!==`@${i.title}`||(t.push(...WC(n.slice(s,i.start),`text-${s}`)),t.push(S.jsxs("span",{className:"chat-inline-paper-mention",children:[S.jsx(t$,{size:13,"aria-hidden":"true"}),S.jsx(u0,{routeId:i.route_id,className:"chat-inline-paper-link",children:r.startsWith("@")?r.slice(1):r})]},i.key)),s=i.end)}return t.push(...WC(n.slice(s),`text-${s}`)),S.jsx(S.Fragment,{children:t})},kne=({block:n,papers:e,citations:t,webCitations:s,onToggle:i})=>n.active?S.jsxs("div",{className:"chat-reason-live",children:[S.jsxs("div",{className:"chat-reason-live-head",children:[S.jsx(tS,{})," ",S.jsx("span",{children:"Thinking…"})]}),S.jsxs("div",{className:"chat-reason-live-body chat-answer chat-reason-markdown",children:[S.jsx(sb,{text:n.text,streaming:!0,papers:e,citations:t,webCitations:s}),S.jsx(_L,{})]})]}):S.jsxs("div",{className:"chat-reason-done",children:[S.jsxs("button",{type:"button",className:"chat-reason-done-head",onClick:i,"aria-expanded":n.open,children:[S.jsx(HL,{}),S.jsx("span",{children:"Thought for a few seconds"}),S.jsx(QC,{open:n.open})]}),n.open&&S.jsx("div",{className:"chat-reason-done-body chat-answer chat-reason-markdown",children:S.jsx(sb,{text:n.text,papers:e,citations:t,webCitations:s})})]}),Ene=({block:n,papers:e,onToggle:t})=>{var d,p,m,y;const s=n.status==="running",i=s&&n.argumentState==="streaming",r=n.schema_version===2||!!n.content,o=n.status==="error"||n.status==="denied",a=typeof n.args.query=="string"?n.args.query:"",l=typeof n.args.command=="string"?n.args.command:typeof n.args.file_path=="string"?n.args.file_path:a,c=n.name.startsWith("pwc_")?Object.entries(n.args).filter(([,v])=>v!=null&&v!=="").map(([v,g])=>`${v}=${typeof g=="string"?g:JSON.stringify(g)}`).join(" · "):r?l:`("${a}")`,h=((d=n.content)==null?void 0:d.map(v=>v.text).join(""))??"",u=i?"streaming arguments…":s?"running…":r?`${n.status} · ${n.took_ms??0} ms`:`${n.hits} results · ${n.took_ms} ms`;return S.jsxs("div",{className:`chat-tool${s?" chat-tool-running":""}${o?" chat-tool-failed":""}`,children:[S.jsxs("button",{type:"button",className:"chat-tool-head",onClick:t,"aria-expanded":n.open,children:[S.jsxs("span",{className:"chat-tool-head-left",children:[s?S.jsx(tS,{}):S.jsx(BL,{}),S.jsx("code",{className:"chat-tool-name",children:n.name}),S.jsx("span",{className:"chat-tool-query",title:c,children:c})]}),S.jsxs("span",{className:"chat-tool-head-right",children:[S.jsx("span",{className:"chat-tool-status",children:u}),S.jsx(QC,{open:n.open})]})]}),n.open&&S.jsxs("div",{className:"chat-tool-body",children:[S.jsxs("div",{className:"chat-tool-args",children:[S.jsxs("span",{className:"chat-tool-label",children:["arguments",n.arguments_redacted?" · redacted":""]}),S.jsx("pre",{children:n.argumentState==="streaming"&&!n.arguments_redacted&&n.argumentText||JSON.stringify(n.args,null,2)})]}),!s&&r?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"chat-tool-output-head",children:[S.jsx("span",{className:"chat-tool-label",children:"result"}),S.jsx("button",{type:"button",className:"chat-tool-copy",onClick:()=>void navigator.clipboard.writeText(h),children:"Copy"})]}),S.jsx("pre",{className:"chat-tool-output",children:S.jsx("code",{children:h})}),((p=n.metadata)==null?void 0:p.output_truncated)&&S.jsx("div",{className:"chat-tool-truncated",children:"Output was truncated."})]}):s?null:S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"chat-tool-label chat-tool-results-label",children:["returned ",((m=n.results)==null?void 0:m.length)??0," papers"]}),S.jsx("ol",{className:"chat-tool-results",children:(y=n.results)==null?void 0:y.map(v=>S.jsxs("li",{className:"chat-hit",children:[S.jsx("div",{className:"chat-hit-top",children:S.jsx(c$,{routeId:v.route_id,paper:e[v.route_id],className:"chat-hit-title",children:v.title})}),S.jsx("div",{className:"chat-hit-meta",children:[pne(v.metadata),mne(v.metadata)].filter(Boolean).join(" · ")}),S.jsxs("div",{className:"chat-hit-snippet",children:[gne(v),v.content_truncated&&S.jsx("span",{className:"chat-hit-truncated",children:" (truncated)"})]})]},v.route_id))})]})]})]})},Cne=({block:n,papers:e,citations:t,webCitations:s,streaming:i})=>S.jsxs("div",{className:"chat-answer",children:[S.jsx(sb,{text:n.text,streaming:i,papers:e,citations:t,webCitations:s}),i&&!!n.text.trim()&&S.jsx(_L,{})]}),$ne=({block:n})=>S.jsx(H6,{block:n}),SL=n=>{const e=ee.useRef(null),t=ee.useCallback(()=>{const s=e.current;if(!s)return;s.style.height="auto";const i=Math.max(120,window.innerHeight*.4);s.style.height=`${Math.min(s.scrollHeight,i)}px`,s.style.overflowY=s.scrollHeight>i?"auto":"hidden"},[]);return ee.useLayoutEffect(()=>{var s,i;(s=e.current)==null||s.focus(),(i=e.current)==null||i.setSelectionRange(n.length,n.length),t()},[t,n.length]),{textareaRef:e,resize:t}},Tne=({id:n,text:e,paperSelection:t,editNotice:s,onCancel:i,onResend:r,onResendDraft:o})=>{const[a,l]=ee.useState(e),[c,h]=ee.useState(t),[u,d]=ee.useState(!1),{textareaRef:p,resize:m}=SL(e);ee.useLayoutEffect(m,[m,a]);const y=!!a.trim()&&a.length<=8e3,v=()=>{if(!y||u)return;d(!0),((o==null?void 0:o({text:a,paperMentions:[],...c?{paperSelection:c}:{}}))??(r==null?void 0:r(a))??!1)||d(!1)};return S.jsx("div",{className:"chat-msg chat-msg-user chat-msg-user-editing","data-message-id":n,children:S.jsxs("div",{className:"chat-inline-editor",children:[c&&S.jsx(d0,{selection:c,editable:!0,onRemove:()=>h(void 0)}),S.jsx("textarea",{ref:p,className:"chat-inline-editor-textarea","aria-label":"Edit message",value:a,maxLength:8e3,onChange:g=>l(g.target.value),onKeyDown:g=>{g.key==="Escape"?(g.preventDefault(),i==null||i()):g.key==="Enter"&&!g.shiftKey&&!g.nativeEvent.isComposing&&(g.preventDefault(),v())}}),s&&S.jsx("div",{className:"chat-inline-editor-notice",children:s}),S.jsxs("div",{className:"chat-inline-editor-actions",children:[S.jsx("button",{type:"button",onClick:i,children:"Cancel"}),S.jsx("button",{type:"button",className:"chat-inline-editor-send",disabled:!y||u,onClick:v,children:"Send"})]})]})})},Pne=({id:n,text:e,paperMentions:t,paperSelection:s,enabled:i,editNotice:r,onCancel:o,onResend:a,onResendDraft:l})=>{const[c,h]=ee.useState({text:e,paperMentions:t,...s?{paperSelection:s}:{}}),[u,d]=ee.useState(!1),[p,m]=ee.useState(0),{textareaRef:y,resize:v}=SL(e),g=XC({draft:c,onChange:h,enabled:i,textareaRef:y});ee.useLayoutEffect(v,[v,c.text]);const _=!!c.text.trim()&&c.text.length<=8e3&&(i||c.paperMentions.length===0),b=()=>{if(!_||u)return;d(!0),((l==null?void 0:l(c))??(a==null?void 0:a(c.text))??!1)||d(!1)};return S.jsx("div",{className:"chat-msg chat-msg-user chat-msg-user-editing","data-message-id":n,children:S.jsxs("div",{className:"chat-inline-editor",children:[c.paperSelection&&S.jsx(d0,{selection:c.paperSelection,editable:!0,onRemove:()=>h({text:c.text,paperMentions:c.paperMentions})}),S.jsxs("div",{className:"chat-inline-editor-textarea-wrap",children:[S.jsx(YC,{text:c.text,mentions:c.paperMentions,scrollTop:p,variant:"editor"}),S.jsx("textarea",{ref:y,className:"chat-inline-editor-textarea","aria-label":"Edit message",value:c.text,maxLength:8e3,role:"combobox","aria-autocomplete":"list","aria-expanded":g.open,"aria-controls":g.open?g.pickerId:void 0,"aria-activedescendant":g.open&&g.results.length?`${g.optionIdPrefix}-${g.activeIndex}`:void 0,onChange:x=>g.updateText(x.target.value,x.target.selectionStart),onSelect:x=>g.refresh(x.currentTarget.selectionStart),onScroll:x=>m(x.currentTarget.scrollTop),onKeyDown:x=>{g.keyDown(x)||(x.key==="Escape"?(x.preventDefault(),o==null||o()):x.key==="Enter"&&!x.shiftKey&&!x.nativeEvent.isComposing&&(x.preventDefault(),b()))}}),S.jsx(JC,{open:g.open,query:g.query,results:g.results,activeIndex:g.activeIndex,loading:g.loading,error:g.error,onSelect:g.select,id:g.pickerId,optionIdPrefix:g.optionIdPrefix})]}),!i&&c.paperMentions.length>0&&S.jsx("div",{className:"chat-inline-editor-notice",role:"status",children:"Paper mentions are currently disabled. Remove them before sending."}),r&&S.jsx("div",{className:"chat-inline-editor-notice",children:r}),S.jsxs("div",{className:"chat-inline-editor-actions",children:[S.jsx("button",{type:"button",onClick:o,children:"Cancel"}),S.jsx("button",{type:"button",className:"chat-inline-editor-send",disabled:!_||u,onClick:b,children:"Send"})]})]})})},fse=({id:n,text:e,paperMentions:t=[],paperSelection:s,paperMentionsEnabled:i=!1,editingAllowed:r=!1,editing:o=!1,editNotice:a,onEdit:l,onCancel:c,onResend:h,onResendDraft:u})=>{const[d,p]=ee.useState(!1),m=ee.useRef(null);ee.useEffect(()=>()=>{m.current!==null&&window.clearTimeout(m.current)},[]);const y=async()=>{var v;if((v=navigator.clipboard)!=null&&v.writeText)try{await navigator.clipboard.writeText(e),p(!0),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>p(!1),1500)}catch{}};return o?!i&&t.length===0?S.jsx(Tne,{id:n,text:e,paperSelection:s,editNotice:a,onCancel:c,onResend:h,onResendDraft:u}):S.jsx(Pne,{id:n,text:e,paperMentions:t,paperSelection:s,enabled:i,editNotice:a,onCancel:c,onResend:h,onResendDraft:u}):S.jsx("div",{className:"chat-msg chat-msg-user","data-message-id":n,children:S.jsxs("div",{className:"chat-user-message-wrap",children:[s&&S.jsx(d0,{selection:s}),S.jsx("div",{className:"chat-bubble",onDoubleClick:_ne,children:S.jsx(Ane,{text:e,mentions:t})}),S.jsxs("div",{className:"chat-user-actions",children:[S.jsx("button",{type:"button",className:"chat-user-action","aria-label":d?"Message copied":"Copy message",title:d?"Copied":"Copy",onClick:()=>void y(),children:d?S.jsx(IL,{"aria-hidden":"true"}):S.jsx(eD,{"aria-hidden":"true"})}),r&&S.jsx("button",{type:"button",className:"chat-user-action","aria-label":"Edit message",title:"Edit",onClick:l,children:S.jsx(r$,{"aria-hidden":"true"})})]})]})})},pse=({msg:n,papers:e,onToggleBlock:t,onRetryCompaction:s,onRetryWithLuna:i,onArchiveOldChats:r,onArchiveOldestChats:o,archivePending:a=null,hfBilling:l=null,openRouterFallbackEnabled:c=!1,feedbackEnabled:h=!1})=>{var D,H,j,U;const[u,d]=ee.useState(null),[p,m]=ee.useState(!1),[y,v]=ee.useState(!1),[g,_]=ee.useState(!1),[b,x]=ee.useState(""),A=ee.useRef(null),T=`chat-feedback-panel-${n.id}`,C=h&&!n.streaming&&!n.error&&!!((D=n.blocks)!=null&&D.some(B=>B.kind==="answer"&&B.text.trim()));ee.useEffect(()=>{var B;g&&((B=A.current)==null||B.focus())},[g]);const I=async(B,L)=>{if(!p){m(!0),v(!1);try{L===void 0?await vA.reportFeedback(n.id,B):await vA.reportFeedback(n.id,B,L),d(B),_(!1),x("")}catch{v(!0)}finally{m(!1)}}};return S.jsx("div",{className:"chat-msg chat-msg-assistant",children:S.jsxs("div",{className:"chat-msg-blocks",children:[(H=n.blocks)==null?void 0:H.map((B,L)=>{var ge;const X=`${n.id}-${L}`,se="citations"in B&&B.citations!==void 0?B.citations:n.citations??[],J=Object.fromEntries(se.filter(z=>(z.kind==="catalog_paper"||z.kind==="paper"||!z.kind&&z.route_id)&&z.route_id).map(z=>[z.route_id,z])),Y=Object.fromEntries(se.filter(z=>(z.kind==="external_source"||z.kind==="web")&&z.url).map(z=>[z.url,z]));return B.kind==="reasoning"?S.jsx(kne,{block:B,papers:e,citations:J,webCitations:Y,onToggle:()=>t(n.id,L)},X):B.kind==="tool"?S.jsx(Ene,{block:B,papers:e,onToggle:()=>t(n.id,L)},X):B.kind==="app"?S.jsx($ne,{block:B},B.instance_id||X):B.kind==="artifact"?S.jsx(fne,{block:B},B.publication_id||B.version_id||X):S.jsx(Cne,{block:B,papers:e,citations:J,webCitations:Y,streaming:!!(n.streaming&&L===(((ge=n.blocks)==null?void 0:ge.length)??0)-1)},X)}),n.streaming&&n.compacting&&S.jsx(pD,{}),!n.compacting&&wne(n)&&S.jsx("div",{className:"chat-waiting",role:"status","aria-live":"polite",children:S.jsx("span",{className:"chat-thinking",children:(((j=n.blocks)==null?void 0:j.length)??0)===0?n.status??"Thinking…":"Thinking…"})}),n.error&&S.jsxs("div",{className:"chat-error",children:[((U=n.blocks)==null?void 0:U.some(B=>B.kind==="answer"&&B.text.trim()))&&S.jsx("strong",{children:"Incomplete—response interrupted. "}),["context_too_large","provider_error","persistence_error"].includes(n.errorCode??"")&&s&&S.jsx("button",{type:"button",onClick:s,children:"Retry"}),S.jsx("span",{children:n.errorCode==="chat_disabled_interrupted"?"Chat was disabled while this response was running. The partial response is saved. Please try again later.":n.errorCode==="chat_session_quota_exceeded"?n.error:`The assistant hit an error: ${n.error}`}),["hf_inference_billing_required","hf_inference_credential_expired"].includes(n.errorCode??"")&&S.jsx("a",{href:"/settings",children:"Re-sign in with Hugging Face"}),n.errorCode==="hf_inference_billing_exhausted"&&S.jsxs(S.Fragment,{children:[i&&S.jsx("button",{type:"button",onClick:i,children:"Retry with GPT-6 Luna"}),(l==null?void 0:l.account_type)==="Free"&&!l.bill_to?S.jsx("a",{href:yne,target:"_blank",rel:"noreferrer",children:"Upgrade to Hugging Face PRO — $9/month for 20× more included credits"}):S.jsx("a",{href:(l==null?void 0:l.usage_url)??"/settings",target:l?"_blank":void 0,rel:l?"noreferrer":void 0,children:"Review Hugging Face usage and billing"}),S.jsx("a",{href:vne,target:"_blank",rel:"noreferrer",children:"Inference Providers pricing and billing details"})]}),n.errorCode==="hf_sponsored_unavailable"&&i&&S.jsx("button",{type:"button",onClick:i,children:"Retry with GPT-6 Luna"}),n.errorCode==="openrouter_monthly_budget_exhausted"&&S.jsxs(S.Fragment,{children:[c?S.jsx("span",{children:"This response started on the shared allowance. Your connected OpenRouter key will be used when you explicitly retry."}):S.jsx("a",{href:"/settings#openrouter-byok",children:"Connect your own OpenRouter key"}),S.jsx("span",{children:"Or select a Hugging Face-backed model and explicitly retry."})]}),n.errorCode==="openrouter_staging_funding_disabled"&&S.jsx("a",{href:bne,children:"Continue on paperswithcode.co"}),n.errorCode==="openrouter_unavailable"&&S.jsxs(S.Fragment,{children:[S.jsx("a",{href:"/settings#openrouter-byok",children:"Bring your own key in Settings"}),S.jsx("a",{href:"https://github.com/huggingface/paperswithcode-feedback",target:"_blank",rel:"noreferrer",children:"File an issue"})]}),n.errorCode==="openrouter_byok_billing_error"&&S.jsx("a",{href:"https://openrouter.ai/settings/credits",target:"_blank",rel:"noreferrer",children:"Review OpenRouter billing"}),["openrouter_byok_credential_invalid","openrouter_byok_rate_limit"].includes(n.errorCode??"")&&S.jsx("a",{href:"/settings#openrouter-byok",children:"Review OpenRouter settings"}),n.errorCode==="chat_session_quota_exceeded"&&(r||o)&&S.jsxs("span",{className:"chat-error-actions",children:[r&&S.jsx("button",{type:"button",disabled:a!==null,onClick:r,children:a==="old"?"Archiving…":"Archive chats older than 30 days"}),o&&S.jsx("button",{type:"button",disabled:a!==null,onClick:o,children:a==="oldest"?"Archiving…":"Archive oldest 50 chats"})]})]}),!n.streaming&&n.finishReason&&!["success","scope_blocked"].includes(n.finishReason)&&S.jsx("div",{className:"chat-finish-note",children:["tool_limit","max_turns"].includes(n.finishReason)?"The assistant stopped at the execution limit.":`The assistant stopped early (${n.finishReason.replace(/_/g," ")}).`}),C&&S.jsxs("div",{className:"chat-feedback","aria-label":"Rate this response",children:[S.jsx("span",{className:"chat-feedback-label",children:u===null?"Was this helpful?":"Thanks for your feedback"}),S.jsx("button",{type:"button",className:`chat-feedback-action${u===!0?" chat-feedback-action-selected":""}`,"aria-label":"Helpful response","aria-pressed":u===!0,disabled:p,onClick:()=>{_(!1),I(!0)},children:S.jsx(tD,{"aria-hidden":"true"})}),S.jsx("button",{type:"button",className:`chat-feedback-action${u===!1?" chat-feedback-action-selected":""}`,"aria-label":"Unhelpful response","aria-pressed":u===!1,"aria-expanded":g,"aria-controls":T,disabled:p,onClick:()=>{v(!1),_(!0)},children:S.jsx(dD,{"aria-hidden":"true"})}),y&&S.jsx("span",{className:"chat-feedback-error",role:"status",children:"Couldn’t send feedback."})]}),C&&g&&S.jsxs("div",{className:"chat-feedback-panel",id:T,role:"group","aria-labelledby":`${T}-title`,children:[S.jsx("div",{className:"chat-feedback-panel-title",id:`${T}-title`,children:"Additional feedback"}),S.jsx("label",{className:"chat-feedback-panel-label",htmlFor:`${T}-comment`,children:"Tell us what went wrong (optional)"}),S.jsx("textarea",{ref:A,id:`${T}-comment`,className:"chat-feedback-comment",value:b,maxLength:500,rows:4,disabled:p,onChange:B=>x(B.target.value),onKeyDown:B=>{B.key==="Escape"&&(B.preventDefault(),_(!1))}}),S.jsxs("div",{className:"chat-feedback-panel-actions",children:[S.jsx("button",{type:"button",className:"chat-feedback-skip",disabled:p,onClick:()=>void I(!1),children:"Skip"}),S.jsx("button",{type:"button",className:"chat-feedback-submit",disabled:p,onClick:()=>void I(!1,b.trim()||void 0),children:p?"Submitting…":"Submit"})]})]})]})})},Rne={chat:{breakpoint:760,left:360,right:360},shared:{breakpoint:760,left:360,right:360},reader:{breakpoint:1260,left:840,right:420}};function Ga(n,e,t,s){if(!n)return Math.max(25,Math.min(75,e));const i=Math.max(25,s/n*100),r=Math.min(75,(n-t)/n*100);return Math.max(i,Math.min(r,e))}const mse=({children:n,variant:e})=>{var _;const t=hm(),s=Rne[e],i=ee.useRef(null),r=ee.useRef(null),o=ee.useRef(null),a=ee.useRef(null),[l,c]=ee.useState(0),h=ee.useRef(!1),u=ee.useRef(t.state.panelPercent);ee.useLayoutEffect(()=>{const b=i.current;if(!b)return;const x=()=>c(b.clientWidth||window.innerWidth);if(x(),typeof ResizeObserver>"u")return;const A=new ResizeObserver(x);return A.observe(b),()=>A.disconnect()},[]);const d=t.state.open&&l>=s.breakpoint,p=Ga(l,t.state.panelPercent,s.left,s.right),m=((_=t.state.selected)==null?void 0:_.artifact_kind)==="latex_paper"?"paper":"poster",y=b=>{var A;const x=Ga(l,b,s.left,s.right);u.current=x,r.current&&(r.current.style.width=`${100-x}%`),o.current&&(o.current.style.width=`${x}%`),(A=a.current)==null||A.setAttribute("aria-valuenow",String(Math.round(x)))},v=b=>{var A;const x=(A=i.current)==null?void 0:A.getBoundingClientRect();x!=null&&x.width&&y((x.right-b)/x.width*100)},g=()=>{h.current&&(h.current=!1,t.setPanelPercent(u.current))};return S.jsxs("div",{ref:i,className:`chat-artifact-workspace chat-artifact-workspace-${e}${d?" has-docked-artifact":""}`,"data-artifact-layout":d?"split":t.state.open?"dialog":"closed",children:[S.jsx("div",{ref:r,className:"chat-artifact-workspace-content",style:d?{width:`${100-p}%`}:void 0,children:n}),d&&S.jsxs(S.Fragment,{children:[S.jsx("div",{ref:a,className:"chat-artifact-resize-handle",role:"separator","aria-label":`Resize conversation and ${m} panels`,"aria-orientation":"vertical","aria-valuemin":Math.ceil(Ga(l,0,s.left,s.right)),"aria-valuemax":Math.floor(Ga(l,100,s.left,s.right)),"aria-valuenow":Math.round(p),tabIndex:0,onPointerDown:b=>{h.current=!0,b.currentTarget.setPointerCapture(b.pointerId),v(b.clientX)},onPointerMove:b=>{h.current&&v(b.clientX)},onPointerUp:g,onPointerCancel:g,onLostPointerCapture:g,onDoubleClick:()=>t.setPanelPercent(55),onKeyDown:b=>{(b.key==="ArrowLeft"||b.key==="ArrowRight")&&(b.preventDefault(),t.setPanelPercent(Ga(l,p+(b.key==="ArrowLeft"?2:-2),s.left,s.right))),b.key==="Home"&&t.setPanelPercent(Ga(l,25,s.left,s.right)),b.key==="End"&&t.setPanelPercent(Ga(l,75,s.left,s.right))}}),S.jsx("div",{ref:o,className:"chat-artifact-workspace-pane",style:{width:`${p}%`},children:S.jsx(qC,{})})]}),t.state.open&&!d&&S.jsx(qC,{forceDialog:!0,readerFallback:e==="reader"})]})};export{dse as A,ese as C,HY as P,VX as R,fse as U,mse as a,pse as b,hm as c,tse as d,PD as e,use as f,Q_ as g,BX as u}; diff --git a/assets/AstraForRoboticsView-BZJ-P8S9.js b/assets/AstraForRoboticsView-BZJ-P8S9.js new file mode 100644 index 0000000000000000000000000000000000000000..42dce87f0ee9777d1cd233fd142284582bbcb347 --- /dev/null +++ b/assets/AstraForRoboticsView-BZJ-P8S9.js @@ -0,0 +1 @@ +import{p,d as u,j as a,L as o}from"./index-DyXq7-Tg.js";import{u as g,b as x,a as b}from"./PaperFeed-EBt97iOL.js";import{A as f,a as j}from"./alert-gbJBhAVE.js";import{u as y}from"./usePapers-B0s20UcU.js";import{p as v}from"./papers-Dh3ljlL0.js";import{u as k,f as w}from"./useDocumentTitle-DcxM2Zv_.js";import{t as A}from"./transform-D46m70Qr.js";import"./PaperCard-57p1OSGy.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./SotaBadges-vbLLOUtT.js";import"./colors-BkWRhvFI.js";import"./Icon-T4LYkEQj.js";import"./LatexTitle-Bkyz3jCs.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-CTBEUp7Y.js";import"./skeleton-C3IIzpSL.js";import"./useIntersectionObserver-D6_Iig9a.js";import"./useInfiniteQuery-BYh2zN-T.js";import"./curation-YeS7FBYf.js";const n="robotics",i="gpt-6-astra",_="https://x.com/YuXiang_IRVL/status/2100395131924840570",P=[{handle:"Frame_Robotics",author:"Frame Robotics",summary:"Real-arm control that fixes grip angle and carry height on the next try after a miss.",url:"https://x.com/Frame_Robotics/status/2099900836273090614"},{handle:"qineng_wang",author:"Qineng Wang",summary:"Dual-ALOHA spatial-constraint puzzles: unlocking interlocked parts and threading a rope through three rings.",url:"https://x.com/qineng_wang/status/2099893504658866561"},{handle:"__Rhodium__",author:"Lucas",summary:"In-context learning of the controls and the workspace, reaching the task goal in three tries.",url:"https://x.com/__Rhodium__/status/2099521054678925534"},{handle:"SuveenE",author:"Suveen Ellawela",summary:"Picking up a pipette and fitting a 5 mm tip on a MolmoAct2 real-world eval, using the free hand for a better view.",url:"https://x.com/SuveenE/status/2099448450341605672"},{handle:"cdngdev",author:"thijs",summary:"A robot arm with a paintbrush painting the Golden Gate Bridge, improving across attempts from camera feedback.",url:"https://x.com/cdngdev/status/2097339677128982873"},{handle:"IsaacSin12",author:"Isaac Sin",summary:"Zero-shot sorting of irregularly shaped blocks into cups by color.",url:"https://x.com/IsaacSin12/status/2096715382166098302"},{handle:"chooi_jeq",author:"Jay Chooi",summary:"Robocurve's robot-control comparison: 95% task completion versus 40% for Fable 5.1 at lower cost.",url:"https://x.com/chooi_jeq/status/2096064315115839904"}],R=[{handle:"Lingjun_Mao",author:"Lingjun Mao",summary:"Adapting to a new embodiment to put a cake into an air fryer through CuRobo motion-planning tool APIs.",url:"https://x.com/Lingjun_Mao/status/2100294902672462176"},{handle:"walterzhu8",author:"Wentao Zhu",summary:"A day-and-a-half autonomous run that builds and trains pen spinning on a Sharpa hand in Isaac Lab.",url:"https://x.com/walterzhu8/status/2100212420840989112"},{handle:"mishig25",author:"Mishig",summary:"Painting the Eiffel Tower in MuJoCo with an SO-101 and a brush, with the full experiment shared on Hugging Face.",url:"https://x.com/mishig25/status/2099611674793668676"},{handle:"RunpeiDong",author:"Runpei Dong",summary:"Getting a humanoid into a Tesla in MuJoCo: learning from feedback, then reusing that experience with egocentric perception.",url:"https://x.com/RunpeiDong/status/2099604536327614717"},{handle:"frankzydou",author:"Zhiyang (Frank) Dou",summary:"A LeRobot SO-101 real-world pickup from a third-person RGB camera, where the arm has to bend back to reach the pen.",url:"https://x.com/frankzydou/status/2099338127915512297"},{handle:"Parvkpr",author:"Parv Kapoor",summary:"Real-to-sim: building an interactive simulation environment from a single image or video.",url:"https://x.com/Parvkpr/status/2098847963867238597"},{handle:"z_code68632",author:"code_z",summary:"One demo per task: unscrewing a bottle cap, inserting a plug, clearing obstacles, and imitating a dance on a real robot.",url:"https://x.com/z_code68632/status/2098397364725895387"}],h=({posts:s,label:e})=>a.jsxs("div",{className:"astra-posts",children:[a.jsx("div",{className:"astra-posts-label",children:e}),a.jsx("ul",{children:s.map(t=>a.jsxs("li",{children:[a.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",children:["@",t.handle]}),a.jsxs("span",{className:"astra-post-author",children:[" ",t.author]}),a.jsxs("span",{className:"astra-post-summary",children:[" — ",t.summary]})]},t.url))})]}),B=()=>{var l,c;const s=g(),e=y([...p.feeds.infinite,{task:n,method:i,...s.filters}],r=>v.list({...s.filters,task:n,method:i,page:r,page_size:12}));k(w("GPT-6 Astra for Robotics"));const t=u.useMemo(()=>{var r;return(((r=e.data)==null?void 0:r.pages)??[]).flatMap(d=>d.results.map(A))},[e.data]),m=((c=(l=e.data)==null?void 0:l.pages[0])==null?void 0:c.count)??0;return a.jsxs("div",{className:"page",children:[a.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[a.jsx(o,{to:"/",children:"Home"}),a.jsx("span",{children:" / "}),a.jsx("span",{children:"GPT-6 Astra for Robotics"})]}),a.jsx("header",{className:"feed-header",children:a.jsxs("div",{children:[a.jsx("div",{className:"astra-eyebrow",children:"Collection"}),a.jsxs("h1",{className:"feed-title",children:["GPT-6 Astra ",a.jsx("em",{children:"for Robotics"})]}),a.jsx("div",{className:"feed-subtitle",children:"Papers, technical reports, and evaluations that put OpenAI’s frontier model in control of real and simulated robots."}),a.jsxs("p",{className:"astra-lede",children:["The GPT-6 Astra launch never mentioned robots, yet within days the model was driving arms, hands, and humanoids. As"," ",a.jsx("a",{href:_,target:"_blank",rel:"noreferrer",children:"Yu Xiang"})," ","framed it, the work splits into two families: Astra acting as the robot policy itself, and Astra acting as an agent that orchestrates everything else."]})]})}),a.jsxs("section",{className:"astra-approaches","aria-label":"How GPT-6 Astra is used for robots",children:[a.jsxs("article",{className:"astra-approach",children:[a.jsx("div",{className:"astra-approach-num",children:"01 / Robot policy"}),a.jsx("h2",{children:"Astra as the policy, like a VLA"}),a.jsx("p",{children:"The model looks at camera frames and robot state and directly emits actions: end-effector poses, joint targets, or gripper commands, closing the control loop step by step with no task-specific training."}),a.jsx(h,{posts:P,label:"Seen on X"})]}),a.jsxs("article",{className:"astra-approach",children:[a.jsx("div",{className:"astra-approach-num",children:"02 / Agent"}),a.jsx("h2",{children:"Astra as the agent"}),a.jsx("p",{children:"The model reasons about the scene, writes and runs code, calls planners and tools, or delegates low-level motion to pretrained policies such as VLAs, and keeps the robot on task over long horizons."}),a.jsx(h,{posts:R,label:"Seen on X"})]})]}),a.jsxs("p",{className:"astra-note",children:["Listing is automatic: any paper tagged with both the"," ",a.jsx(o,{to:`/tasks/${n}`,children:"Robotics"})," task and the"," ",a.jsx(o,{to:`/methods/${i}`,children:"GPT-6 Astra"})," method appears here. Missing a report or preprint?"," ",a.jsx(o,{to:"/submit",children:"Submit it"}),"."]}),a.jsxs("div",{className:"task-section-head",style:{marginTop:36},children:[a.jsx("div",{className:"task-section-eyebrow",children:"Top trending · sort below"}),a.jsxs("div",{className:"task-section-title",children:["Papers ",a.jsxs("span",{className:"meta",children:["[",m.toLocaleString(),"]"]})]})]}),a.jsx(x,{feed:s,showDateFilter:!1}),e.error?a.jsx(f,{variant:"destructive",children:a.jsx(j,{children:"Failed to load the collection. Please try again."})}):a.jsx(b,{query:e,cards:t,empty:"No papers match this selection yet."})]})};export{B as default}; diff --git a/assets/AstraForRoboticsView-pQ4cp5_V.js b/assets/AstraForRoboticsView-pQ4cp5_V.js deleted file mode 100644 index e43cf048a9c8c4af47d1324ac0eae2ed004ccfbb..0000000000000000000000000000000000000000 --- a/assets/AstraForRoboticsView-pQ4cp5_V.js +++ /dev/null @@ -1 +0,0 @@ -import{r as h,j as a,L as o}from"./index-CbgxfyGU.js";import{u,b as g,a as x}from"./PaperFeed-DMvUfA47.js";import{A as f,a as b}from"./alert-CFDDvdIM.js";import{u as j}from"./usePapers-CJaWLZ3y.js";import{p as y,a as v}from"./paperQueryKeys-B8u1BWlI.js";import{f as k,D as w}from"./latexPlainText-DI8YEXVe.js";import{t as A}from"./transform-0Udg2p6b.js";import"./PaperCard-tdTC_dRN.js";import"./AuthorAvatar-CUJMmp_z.js";import"./SotaBadges-C-sTR-EF.js";import"./colors-BkWRhvFI.js";import"./Icon-D-kA0Owz.js";import"./LatexTitle-Z-HGmZ-H.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-DKJYnYjk.js";import"./skeleton-HwvdxvSN.js";import"./useIntersectionObserver-CID9Kkak.js";import"./useQuery-Bx9s5-D2.js";import"./useInfiniteQuery-BAc_4HO5.js";import"./curation-C7Gmmp4z.js";const n="robotics",i="gpt-6-astra",_="https://x.com/YuXiang_IRVL/status/2100395131924840570",P=[{handle:"Frame_Robotics",author:"Frame Robotics",summary:"Real-arm control that fixes grip angle and carry height on the next try after a miss.",url:"https://x.com/Frame_Robotics/status/2099900836273090614"},{handle:"qineng_wang",author:"Qineng Wang",summary:"Dual-ALOHA spatial-constraint puzzles: unlocking interlocked parts and threading a rope through three rings.",url:"https://x.com/qineng_wang/status/2099893504658866561"},{handle:"__Rhodium__",author:"Lucas",summary:"In-context learning of the controls and the workspace, reaching the task goal in three tries.",url:"https://x.com/__Rhodium__/status/2099521054678925534"},{handle:"SuveenE",author:"Suveen Ellawela",summary:"Picking up a pipette and fitting a 5 mm tip on a MolmoAct2 real-world eval, using the free hand for a better view.",url:"https://x.com/SuveenE/status/2099448450341605672"},{handle:"cdngdev",author:"thijs",summary:"A robot arm with a paintbrush painting the Golden Gate Bridge, improving across attempts from camera feedback.",url:"https://x.com/cdngdev/status/2097339677128982873"},{handle:"IsaacSin12",author:"Isaac Sin",summary:"Zero-shot sorting of irregularly shaped blocks into cups by color.",url:"https://x.com/IsaacSin12/status/2096715382166098302"},{handle:"chooi_jeq",author:"Jay Chooi",summary:"Robocurve's robot-control comparison: 95% task completion versus 40% for Fable 5.1 at lower cost.",url:"https://x.com/chooi_jeq/status/2096064315115839904"}],R=[{handle:"Lingjun_Mao",author:"Lingjun Mao",summary:"Adapting to a new embodiment to put a cake into an air fryer through CuRobo motion-planning tool APIs.",url:"https://x.com/Lingjun_Mao/status/2100294902672462176"},{handle:"walterzhu8",author:"Wentao Zhu",summary:"A day-and-a-half autonomous run that builds and trains pen spinning on a Sharpa hand in Isaac Lab.",url:"https://x.com/walterzhu8/status/2100212420840989112"},{handle:"mishig25",author:"Mishig",summary:"Painting the Eiffel Tower in MuJoCo with an SO-101 and a brush, with the full experiment shared on Hugging Face.",url:"https://x.com/mishig25/status/2099611674793668676"},{handle:"RunpeiDong",author:"Runpei Dong",summary:"Getting a humanoid into a Tesla in MuJoCo: learning from feedback, then reusing that experience with egocentric perception.",url:"https://x.com/RunpeiDong/status/2099604536327614717"},{handle:"frankzydou",author:"Zhiyang (Frank) Dou",summary:"A LeRobot SO-101 real-world pickup from a third-person RGB camera, where the arm has to bend back to reach the pen.",url:"https://x.com/frankzydou/status/2099338127915512297"},{handle:"Parvkpr",author:"Parv Kapoor",summary:"Real-to-sim: building an interactive simulation environment from a single image or video.",url:"https://x.com/Parvkpr/status/2098847963867238597"},{handle:"z_code68632",author:"code_z",summary:"One demo per task: unscrewing a bottle cap, inserting a plug, clearing obstacles, and imitating a dance on a real robot.",url:"https://x.com/z_code68632/status/2098397364725895387"}],m=({posts:s,label:e})=>a.jsxs("div",{className:"astra-posts",children:[a.jsx("div",{className:"astra-posts-label",children:e}),a.jsx("ul",{children:s.map(t=>a.jsxs("li",{children:[a.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",children:["@",t.handle]}),a.jsxs("span",{className:"astra-post-author",children:[" ",t.author]}),a.jsxs("span",{className:"astra-post-summary",children:[" — ",t.summary]})]},t.url))})]}),J=()=>{var l,c;const s=u(),e=j([...y.feeds.infinite,{task:n,method:i,...s.filters}],r=>v.list({...s.filters,task:n,method:i,page:r,page_size:12}));h.useEffect(()=>(document.title=k("GPT-6 Astra for Robotics"),()=>{document.title=w}),[]);const t=h.useMemo(()=>{var r;return(((r=e.data)==null?void 0:r.pages)??[]).flatMap(p=>p.results.map(A))},[e.data]),d=((c=(l=e.data)==null?void 0:l.pages[0])==null?void 0:c.count)??0;return a.jsxs("div",{className:"page",children:[a.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[a.jsx(o,{to:"/",children:"Home"}),a.jsx("span",{children:" / "}),a.jsx("span",{children:"GPT-6 Astra for Robotics"})]}),a.jsx("header",{className:"feed-header",children:a.jsxs("div",{children:[a.jsx("div",{className:"astra-eyebrow",children:"Collection"}),a.jsxs("h1",{className:"feed-title",children:["GPT-6 Astra ",a.jsx("em",{children:"for Robotics"})]}),a.jsx("div",{className:"feed-subtitle",children:"Papers, technical reports, and evaluations that put OpenAI’s frontier model in control of real and simulated robots."}),a.jsxs("p",{className:"astra-lede",children:["The GPT-6 Astra launch never mentioned robots, yet within days the model was driving arms, hands, and humanoids. As"," ",a.jsx("a",{href:_,target:"_blank",rel:"noreferrer",children:"Yu Xiang"})," ","framed it, the work splits into two families: Astra acting as the robot policy itself, and Astra acting as an agent that orchestrates everything else."]})]})}),a.jsxs("section",{className:"astra-approaches","aria-label":"How GPT-6 Astra is used for robots",children:[a.jsxs("article",{className:"astra-approach",children:[a.jsx("div",{className:"astra-approach-num",children:"01 / Robot policy"}),a.jsx("h2",{children:"Astra as the policy, like a VLA"}),a.jsx("p",{children:"The model looks at camera frames and robot state and directly emits actions: end-effector poses, joint targets, or gripper commands, closing the control loop step by step with no task-specific training."}),a.jsx(m,{posts:P,label:"Seen on X"})]}),a.jsxs("article",{className:"astra-approach",children:[a.jsx("div",{className:"astra-approach-num",children:"02 / Agent"}),a.jsx("h2",{children:"Astra as the agent"}),a.jsx("p",{children:"The model reasons about the scene, writes and runs code, calls planners and tools, or delegates low-level motion to pretrained policies such as VLAs, and keeps the robot on task over long horizons."}),a.jsx(m,{posts:R,label:"Seen on X"})]})]}),a.jsxs("p",{className:"astra-note",children:["Listing is automatic: any paper tagged with both the"," ",a.jsx(o,{to:`/tasks/${n}`,children:"Robotics"})," task and the"," ",a.jsx(o,{to:`/methods/${i}`,children:"GPT-6 Astra"})," method appears here. Missing a report or preprint?"," ",a.jsx(o,{to:"/submit",children:"Submit it"}),"."]}),a.jsxs("div",{className:"task-section-head",style:{marginTop:36},children:[a.jsx("div",{className:"task-section-eyebrow",children:"Top trending · sort below"}),a.jsxs("div",{className:"task-section-title",children:["Papers ",a.jsxs("span",{className:"meta",children:["[",d.toLocaleString(),"]"]})]})]}),a.jsx(g,{feed:s,showDateFilter:!1}),e.error?a.jsx(f,{variant:"destructive",children:a.jsx(b,{children:"Failed to load the collection. Please try again."})}):a.jsx(x,{query:e,cards:t,empty:"No papers match this selection yet."})]})};export{J as default}; diff --git a/assets/AuthorAvatar-B-9xS2Wo.js b/assets/AuthorAvatar-B-9xS2Wo.js new file mode 100644 index 0000000000000000000000000000000000000000..61351f27f8ead52f6845eb5f6fc15b35eb423f00 --- /dev/null +++ b/assets/AuthorAvatar-B-9xS2Wo.js @@ -0,0 +1 @@ +import{d as c,j as r}from"./index-DyXq7-Tg.js";const p=a=>a!=null&&a.startsWith("https://")&&!a.startsWith("https://huggingface.co/avatars/")?a:null,g=({url:a,className:o,href:t,label:n})=>{const[i,l]=c.useState(!1),s=i?null:p(a);if(!s)return null;const e=r.jsx("img",{className:`author-avatar-base ${o}`,src:s,alt:"",loading:"lazy",onError:()=>l(!0)});return t?r.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer","aria-label":n,children:e}):e};export{g as A}; diff --git a/assets/AuthorAvatar-CUJMmp_z.js b/assets/AuthorAvatar-CUJMmp_z.js deleted file mode 100644 index a71255e1cdf6aea201a6f74be436ede4272d4d36..0000000000000000000000000000000000000000 --- a/assets/AuthorAvatar-CUJMmp_z.js +++ /dev/null @@ -1 +0,0 @@ -import{r as c,j as e}from"./index-CbgxfyGU.js";const p=a=>a!=null&&a.startsWith("https://")&&!a.startsWith("https://huggingface.co/avatars/")?a:null,h=({url:a,className:o,href:t,label:n})=>{const[i,l]=c.useState(!1),s=i?null:p(a);if(!s)return null;const r=e.jsx("img",{className:`author-avatar-base ${o}`,src:s,alt:"",loading:"lazy",onError:()=>l(!0)});return t?e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer","aria-label":n,children:r}):r};export{h as A}; diff --git a/assets/AuthorDetailView-BpcSKHs1.js b/assets/AuthorDetailView-BpcSKHs1.js deleted file mode 100644 index 60e8604602f037c36bee2f91d9e19c8fa7a25a9a..0000000000000000000000000000000000000000 --- a/assets/AuthorDetailView-BpcSKHs1.js +++ /dev/null @@ -1 +0,0 @@ -import{u as b,j as a,r as N,ai as v,L as F}from"./index-CbgxfyGU.js";import{u as y}from"./useQuery-Bx9s5-D2.js";import{A}from"./AuthorAvatar-CUJMmp_z.js";import{u as k,b as P,a as $}from"./PaperFeed-DMvUfA47.js";import{R as S}from"./ResearchFollowButton-D2BXlDtQ.js";import{A as L,a as R}from"./alert-CFDDvdIM.js";import{S as w}from"./skeleton-HwvdxvSN.js";import{u as z}from"./usePapers-CJaWLZ3y.js";import{p as C,a as m}from"./paperQueryKeys-B8u1BWlI.js";import{i as H}from"./apiErrors-BZ5h1Kmb.js";import{t as q}from"./transform-0Udg2p6b.js";import f from"./NotFound-DtzwOULp.js";import"./PaperCard-tdTC_dRN.js";import"./SotaBadges-C-sTR-EF.js";import"./colors-BkWRhvFI.js";import"./Icon-D-kA0Owz.js";import"./LatexTitle-Z-HGmZ-H.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-DKJYnYjk.js";import"./useIntersectionObserver-CID9Kkak.js";import"./useMutation-P_trTy9i.js";import"./research-DgpyzSy_.js";import"./plus-UK0TEjgd.js";import"./useInfiniteQuery-BAc_4HO5.js";import"./curation-C7Gmmp4z.js";const Q=({authorId:r})=>{var n,i,l,p,c,d,h,u;const o=k(),{searchParams:g}=o,e=y({queryKey:["author",r],queryFn:()=>m.getAuthor(r)}),s=z([...C.feeds.infinite,{author:r,...o.filters}],t=>m.list({...o.filters,author:r,page:t,page_size:12})),x=N.useMemo(()=>{var t;return(((t=s.data)==null?void 0:t.pages)??[]).flatMap(_=>_.results.map(q))},[s.data]),j=((i=(n=s.data)==null?void 0:n.pages[0])==null?void 0:i.count)??0;if(H(e.error))return a.jsx(f,{});if((l=e.data)!=null&&l.organization_slug){const t=g.toString();return a.jsx(v,{to:`/orgs/${e.data.organization_slug}${t?`?${t}`:""}`,replace:!0})}return a.jsxs("div",{className:"page",children:[a.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[a.jsx(F,{to:"/",children:"Home"}),a.jsx("span",{children:" / "}),a.jsx("span",{children:"Authors"}),a.jsx("span",{children:" / "}),a.jsx("span",{children:((p=e.data)==null?void 0:p.full_name)??r})]}),a.jsxs("header",{className:"author-hero",children:[a.jsx("div",{className:"organizations-eyebrow",children:"AUTHOR"}),a.jsxs("div",{className:"author-hero-title",children:[(c=e.data)!=null&&c.photo?a.jsxs("figure",{className:"author-photo",children:[a.jsx("img",{className:"author-avatar-base author-avatar",src:e.data.photo.url,alt:""}),a.jsxs("figcaption",{children:["Photo:"," ",a.jsx("a",{href:e.data.photo.source_url,target:"_blank",rel:"noopener noreferrer",children:e.data.photo.credit}),", ",e.data.photo.license_url?a.jsx("a",{href:e.data.photo.license_url,target:"_blank",rel:"noopener noreferrer",children:e.data.photo.license}):e.data.photo.license]})]}):((d=e.data)==null?void 0:d.hf_username)&&a.jsx(A,{className:"author-avatar",url:e.data.hf_avatar_url,href:`https://huggingface.co/${e.data.hf_username}`,label:`@${e.data.hf_username} on Hugging Face`}),a.jsx("h1",{className:"feed-title",children:((h=e.data)==null?void 0:h.full_name)??a.jsx(w,{className:"h-12 w-64 inline-block"})})]}),e.data&&a.jsxs("div",{className:"feed-subtitle",children:[e.data.paper_count.toLocaleString()," ",e.data.paper_count===1?"paper":"papers",e.data.hf_username&&a.jsxs(a.Fragment,{children:[" · ",a.jsxs("a",{href:`https://huggingface.co/${e.data.hf_username}`,target:"_blank",rel:"noopener noreferrer",children:["@",e.data.hf_username," on Hugging Face ↗"]})]}),e.data.google_scholar_id&&a.jsxs(a.Fragment,{children:[" · ",a.jsx("a",{href:`https://scholar.google.com/citations?user=${encodeURIComponent(e.data.google_scholar_id)}`,target:"_blank",rel:"noopener noreferrer",children:"Google Scholar ↗"})]})]}),e.data&&a.jsx(S,{kind:"author",entityId:e.data.id})]}),a.jsx(P,{feed:o,style:{alignItems:"center",gap:16},children:a.jsxs("div",{className:"results-count",children:[j.toLocaleString()," papers"]})}),s.error?a.jsx(L,{variant:"destructive",children:a.jsxs(R,{children:["Failed to load papers."," ",a.jsx("button",{type:"button",onClick:()=>void s.refetch(),children:"Try again"})]})}):a.jsx($,{query:s,cards:x,empty:((u=e.data)==null?void 0:u.paper_count)===0?"No public papers are available.":"No papers found for this selection."})]})},pa=()=>{const{authorId:r}=b();return r?a.jsx(Q,{authorId:r},r):a.jsx(f,{})};export{pa as default}; diff --git a/assets/AuthorDetailView-BykOxZh0.js b/assets/AuthorDetailView-BykOxZh0.js new file mode 100644 index 0000000000000000000000000000000000000000..75d91e698108e6c9ae4dfc01797b6acd6974941c --- /dev/null +++ b/assets/AuthorDetailView-BykOxZh0.js @@ -0,0 +1 @@ +import{u as b,j as a,b as N,p as v,d as F,ao as y,L as A}from"./index-DyXq7-Tg.js";import{A as k}from"./AuthorAvatar-B-9xS2Wo.js";import{u as P,b as $,a as S}from"./PaperFeed-EBt97iOL.js";import{R as L}from"./ResearchFollowButton-Dv316ClR.js";import{A as R,a as w}from"./alert-gbJBhAVE.js";import{S as z}from"./skeleton-C3IIzpSL.js";import{u as C}from"./usePapers-B0s20UcU.js";import{p as m}from"./papers-Dh3ljlL0.js";import{i as H}from"./apiErrors-BSvbQBb0.js";import{t as q}from"./transform-D46m70Qr.js";import f from"./NotFound-DV_nwcxG.js";import"./PaperCard-57p1OSGy.js";import"./SotaBadges-vbLLOUtT.js";import"./colors-BkWRhvFI.js";import"./Icon-T4LYkEQj.js";import"./LatexTitle-Bkyz3jCs.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-CTBEUp7Y.js";import"./useIntersectionObserver-D6_Iig9a.js";import"./researchTopic-DbX0eko-.js";import"./useMutation-UWxBeqtn.js";import"./plus-Yh42pKZz.js";import"./useInfiniteQuery-BYh2zN-T.js";import"./curation-YeS7FBYf.js";const Q=({authorId:r})=>{var n,i,l,p,c,d,h,u;const o=P(),{searchParams:g}=o,e=N({queryKey:["author",r],queryFn:()=>m.getAuthor(r)}),s=C([...v.feeds.infinite,{author:r,...o.filters}],t=>m.list({...o.filters,author:r,page:t,page_size:12})),x=F.useMemo(()=>{var t;return(((t=s.data)==null?void 0:t.pages)??[]).flatMap(_=>_.results.map(q))},[s.data]),j=((i=(n=s.data)==null?void 0:n.pages[0])==null?void 0:i.count)??0;if(H(e.error))return a.jsx(f,{});if((l=e.data)!=null&&l.organization_slug){const t=g.toString();return a.jsx(y,{to:`/orgs/${e.data.organization_slug}${t?`?${t}`:""}`,replace:!0})}return a.jsxs("div",{className:"page",children:[a.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[a.jsx(A,{to:"/",children:"Home"}),a.jsx("span",{children:" / "}),a.jsx("span",{children:"Authors"}),a.jsx("span",{children:" / "}),a.jsx("span",{children:((p=e.data)==null?void 0:p.full_name)??r})]}),a.jsxs("header",{className:"author-hero",children:[a.jsx("div",{className:"organizations-eyebrow",children:"AUTHOR"}),a.jsxs("div",{className:"author-hero-title",children:[(c=e.data)!=null&&c.photo?a.jsxs("figure",{className:"author-photo",children:[a.jsx("img",{className:"author-avatar-base author-avatar",src:e.data.photo.url,alt:""}),a.jsxs("figcaption",{children:["Photo:"," ",a.jsx("a",{href:e.data.photo.source_url,target:"_blank",rel:"noopener noreferrer",children:e.data.photo.credit}),", ",e.data.photo.license_url?a.jsx("a",{href:e.data.photo.license_url,target:"_blank",rel:"noopener noreferrer",children:e.data.photo.license}):e.data.photo.license]})]}):((d=e.data)==null?void 0:d.hf_username)&&a.jsx(k,{className:"author-avatar",url:e.data.hf_avatar_url,href:`https://huggingface.co/${e.data.hf_username}`,label:`@${e.data.hf_username} on Hugging Face`}),a.jsx("h1",{className:"feed-title",children:((h=e.data)==null?void 0:h.full_name)??a.jsx(z,{className:"h-12 w-64 inline-block"})})]}),e.data&&a.jsxs("div",{className:"feed-subtitle",children:[e.data.paper_count.toLocaleString()," ",e.data.paper_count===1?"paper":"papers",e.data.hf_username&&a.jsxs(a.Fragment,{children:[" · ",a.jsxs("a",{href:`https://huggingface.co/${e.data.hf_username}`,target:"_blank",rel:"noopener noreferrer",children:["@",e.data.hf_username," on Hugging Face ↗"]})]}),e.data.google_scholar_id&&a.jsxs(a.Fragment,{children:[" · ",a.jsx("a",{href:`https://scholar.google.com/citations?user=${encodeURIComponent(e.data.google_scholar_id)}`,target:"_blank",rel:"noopener noreferrer",children:"Google Scholar ↗"})]})]}),e.data&&a.jsx(L,{kind:"author",entityId:e.data.id})]}),a.jsx($,{feed:o,style:{alignItems:"center",gap:16},children:a.jsxs("div",{className:"results-count",children:[j.toLocaleString()," papers"]})}),s.error?a.jsx(R,{variant:"destructive",children:a.jsxs(w,{children:["Failed to load papers."," ",a.jsx("button",{type:"button",onClick:()=>void s.refetch(),children:"Try again"})]})}):a.jsx(S,{query:s,cards:x,empty:((u=e.data)==null?void 0:u.paper_count)===0?"No public papers are available.":"No papers found for this selection."})]})},la=()=>{const{authorId:r}=b();return r?a.jsx(Q,{authorId:r},r):a.jsx(f,{})};export{la as default}; diff --git a/assets/AuthorizePaperEditView-D0e1jji8.js b/assets/AuthorizePaperEditView-D0e1jji8.js deleted file mode 100644 index 28eb749a83409e1b88f67b54f60db082a8153251..0000000000000000000000000000000000000000 --- a/assets/AuthorizePaperEditView-D0e1jji8.js +++ /dev/null @@ -1 +0,0 @@ -import{u,a as d,j as e,L as l,H as p}from"./index-CbgxfyGU.js";import{u as c}from"./useQuery-Bx9s5-D2.js";import{u as h}from"./useMutation-P_trTy9i.js";import{B as m}from"./button-Bv9oZ-QU.js";import{p as n}from"./paperEdits-C5GTaRR8.js";function b(){const{authorizationId:t=""}=u(),{user:s,isLoading:o}=d(),i=c({queryKey:["paper-edit-authorization",t],queryFn:()=>n.authorization(t),retry:!1}),r=h({mutationFn:()=>n.approve(t)}),a=i.data;return e.jsxs("main",{className:"mx-auto max-w-xl space-y-5 px-6 py-12",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Authorize your agent to edit a paper"}),(i.isLoading||o)&&e.jsx("p",{children:"Loading authorization…"}),i.error&&e.jsx("p",{role:"alert",children:i.error.message}),a&&e.jsxs(e.Fragment,{children:[e.jsx(l,{className:"underline",to:`/paper/${a.paper_id}`,children:a.title}),e.jsxs("p",{children:["Check that your CLI shows this code: ",e.jsx("strong",{className:"font-mono",children:a.user_code})]}),e.jsx("p",{children:"Only approve a request you started. Your agent will be able to publish changes to this paper’s links, tags, and evaluation results for one hour, without further approval."}),e.jsx("p",{children:"Edits appear publicly under your Hugging Face username. You can edit up to 20 distinct papers per UTC day. Evaluation deletion and changes to shared benchmark definitions require an administrator."}),r.isSuccess||a.approved?e.jsx("p",{role:"status",children:"Access approved. Return to your CLI to continue."}):s?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Signed in as ",e.jsxs("strong",{children:["@",s.username]})]}),e.jsx(m,{disabled:r.isPending||!s.can_directly_edit_catalog,onClick:()=>r.mutate(),children:r.isPending?"Authorizing…":"Authorize for one hour"}),!s.can_directly_edit_catalog&&e.jsx("p",{children:"Direct editing is unavailable for this session."})]}):e.jsx(p,{returnTo:`/authorize-paper-edit/${t}`,label:"Sign in with Hugging Face"}),r.error&&e.jsx("p",{role:"alert",children:r.error.message})]})]})}export{b as default}; diff --git a/assets/AuthorizePaperEditView-DNfre5z5.js b/assets/AuthorizePaperEditView-DNfre5z5.js new file mode 100644 index 0000000000000000000000000000000000000000..3feca8cc22aea7b75df60208f5014c702f985f3c --- /dev/null +++ b/assets/AuthorizePaperEditView-DNfre5z5.js @@ -0,0 +1 @@ +import{u,a as d,b as l,j as e,L as p,H as c}from"./index-DyXq7-Tg.js";import{u as h}from"./useMutation-UWxBeqtn.js";import{B as g}from"./button-DZeAbOf2.js";import{p as n}from"./paperEdits-CIjFYfYE.js";function f(){const{authorizationId:t=""}=u(),{user:s,isLoading:o}=d(),i=l({queryKey:["paper-edit-authorization",t],queryFn:()=>n.authorization(t),retry:!1}),r=h({mutationFn:()=>n.approve(t)}),a=i.data;return e.jsxs("main",{className:"mx-auto max-w-xl space-y-5 px-6 py-12",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Authorize your agent to edit a paper"}),(i.isLoading||o)&&e.jsx("p",{children:"Loading authorization…"}),i.error&&e.jsx("p",{role:"alert",children:i.error.message}),a&&e.jsxs(e.Fragment,{children:[e.jsx(p,{className:"underline",to:`/paper/${a.paper_id}`,children:a.title}),e.jsxs("p",{children:["Check that your CLI shows this code: ",e.jsx("strong",{className:"font-mono",children:a.user_code})]}),e.jsx("p",{children:"Only approve a request you started. Your agent will be able to publish changes to this paper’s links, tags, and evaluation results for one hour, without further approval."}),e.jsx("p",{children:"Edits appear publicly under your Hugging Face username. You can edit up to 20 distinct papers per UTC day. Evaluation deletion and changes to shared benchmark definitions require an administrator."}),r.isSuccess||a.approved?e.jsx("p",{role:"status",children:"Access approved. Return to your CLI to continue."}):s?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Signed in as ",e.jsxs("strong",{children:["@",s.username]})]}),e.jsx(g,{disabled:r.isPending||!s.can_directly_edit_catalog,onClick:()=>r.mutate(),children:r.isPending?"Authorizing…":"Authorize for one hour"}),!s.can_directly_edit_catalog&&e.jsx("p",{children:"Direct editing is unavailable for this session."})]}):e.jsx(c,{returnTo:`/authorize-paper-edit/${t}`,label:"Sign in with Hugging Face"}),r.error&&e.jsx("p",{role:"alert",children:r.error.message})]})]})}export{f as default}; diff --git a/assets/AutonomousOperations-B4vSAvB8.js b/assets/AutonomousOperations-B4vSAvB8.js new file mode 100644 index 0000000000000000000000000000000000000000..90dc8430b7cdf5ea8094fec5af11c3365664f634 --- /dev/null +++ b/assets/AutonomousOperations-B4vSAvB8.js @@ -0,0 +1 @@ +import{i as R,d,b as B,I as C,j as e,L as q}from"./index-DyXq7-Tg.js";import{u as I}from"./useMutation-UWxBeqtn.js";import{C as n,e as i,S as Q,b as l,c as t,t as E,f as m,o as x}from"./CronDashboard-qYV75PLc.js";import{B as H}from"./badge-e6t3GCyf.js";import{B as h}from"./button-DZeAbOf2.js";import{I as u}from"./input-DJqCAbs7.js";import{A as P}from"./activity-S-FQ6Anu.js";import{A as D}from"./arrow-left-PA_b6law.js";const j={submissions:"Submission review",curation:"Scheduled curation",cron_health:"CRON health",chat_reliability:"Chat reliability"},S={healthy:"healthy",degraded:"degraded",repairing:"running","rolled-back":"broken",manual:"degraded"},V=()=>{var A;const M=R(),[p,T]=d.useState(""),[f,_]=d.useState(""),[b,v]=d.useState({}),[g,N]=d.useState(""),c=B({queryKey:C.autonomousOperations,queryFn:()=>x.getAutonomousOperations(),refetchInterval:3e4,retry:!1}),r=I({mutationFn:s=>s(),onSuccess:s=>{M.setQueryData(C.autonomousOperations,s),_(""),v({}),N("")}}),a=c.data,y=r.error instanceof Error?r.error.message:null;if(c.isLoading)return e.jsx("div",{className:"page","aria-busy":"true",children:"Loading autonomous operations…"});if(c.error||!a)return e.jsxs("div",{className:"page",children:[e.jsx("h1",{children:"Autonomous operations unavailable"}),e.jsx("p",{children:c.error instanceof Error?c.error.message:"No status was returned."})]});const O=()=>r.mutate(()=>x.setAutonomousManualMode(!a.manual_mode,a.revision,f)),k=(s,o)=>r.mutate(()=>x.setAutonomousOperator(s,o,a.revision,b[s]??"")),w=()=>{var o;const s=((o=a.baseline)==null?void 0:o.revision)??0;r.mutate(()=>x.qualifyAutonomousChatBaseline(p,s,g))};return e.jsx("div",{className:"cron-dashboard","data-shadcn":!0,children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[e.jsx(P,{className:"h-8 w-8"}),"Autonomous operations"]}),e.jsx("p",{className:"mt-2 cron-muted",children:"Content-free supervision, remote controls, and bounded audit history."})]}),e.jsx(h,{asChild:!0,variant:"outline",children:e.jsxs(q,{to:"/admin-dashboard",children:[e.jsx(D,{className:"h-4 w-4 mr-2"}),"Admin dashboard"]})})]}),a.manual_mode&&e.jsx(n,{className:"cron-status--degraded",role:"status",children:e.jsxs(i,{className:"pt-6 flex gap-3",children:[e.jsx(Q,{className:"h-5 w-5"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Manual mode is enabled."}),e.jsxs("p",{children:[a.monitoring_active?"Monitoring remains active":"Monitoring is not currently verified","; autonomous callbacks, retries, deployments, and data mutations fail closed."]})]})]})}),e.jsxs("div",{className:"grid md:grid-cols-4 gap-4",children:[e.jsxs(n,{className:E(S[a.display_state]),children:[e.jsx(l,{children:e.jsx(t,{className:"text-sm",children:"Overall state"})}),e.jsxs(i,{children:[e.jsx("div",{className:"text-2xl font-bold capitalize",children:a.display_state}),e.jsxs("p",{className:"text-sm",children:["Monitoring ",a.monitoring_active?"active":"inactive"]})]})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(t,{className:"text-sm",children:"Codex cost"})}),e.jsxs(i,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:["$",a.costs.total_usd]}),e.jsxs("p",{className:"text-sm",children:[a.costs.input_tokens+a.costs.output_tokens," tokens"]})]})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(t,{className:"text-sm",children:"Repair lease"})}),e.jsxs(i,{children:[e.jsx("div",{className:"text-lg font-bold",children:a.active_lease?a.active_lease.owner_operator:"Available"}),e.jsx("p",{className:"text-sm",children:a.active_lease?`Expires ${m(a.active_lease.expires_at)}`:"No active source repair"})]})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(t,{className:"text-sm",children:"Global control"})}),e.jsxs(i,{className:"space-y-2",children:[e.jsx(u,{"aria-label":"Manual mode confirmation",value:f,onChange:s=>_(s.target.value),placeholder:"Type SET_MANUAL_MODE"}),e.jsx(h,{disabled:r.isPending||f!=="SET_MANUAL_MODE",onClick:O,children:a.manual_mode?"Leave manual mode":"Enable manual mode"})]})]})]}),e.jsx("div",{className:"grid md:grid-cols-4 gap-4",children:a.operators.map(s=>e.jsxs(n,{className:E(S[s.status]),children:[e.jsx(l,{children:e.jsxs(t,{className:"flex justify-between gap-2",children:[e.jsx("span",{children:j[s.operator]}),e.jsx(H,{children:s.status})]})}),e.jsxs(i,{className:"space-y-3",children:[e.jsxs("p",{children:[s.enabled?"Mutation enabled":"Mutation disabled"," · monitoring ",s.monitoring_active?"active":"unverified"]}),e.jsxs("p",{className:"text-sm",children:["Next scheduled run: ",s.next_scheduled_run?m(s.next_scheduled_run):"not scheduled"]}),e.jsx(u,{"aria-label":`${j[s.operator]} confirmation`,value:b[s.operator]??"",onChange:o=>v(L=>({...L,[s.operator]:o.target.value})),placeholder:"Type SET_OPERATOR_STATE"}),e.jsx(h,{disabled:r.isPending||a.manual_mode&&!s.enabled||b[s.operator]!=="SET_OPERATOR_STATE",onClick:()=>k(s.operator,!s.enabled),children:s.enabled?"Disable":"Enable"})]})]},s.operator))}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(t,{children:"Qualified scalable-chat baseline"})}),e.jsxs(i,{className:"space-y-3",children:[e.jsx("p",{className:"font-mono break-all",children:((A=a.baseline)==null?void 0:A.sha)??"No baseline qualified"}),a.baseline&&e.jsxs("p",{className:"text-sm",children:["Revision ",a.baseline.revision," · ",a.baseline.qualified_by," · ",m(a.baseline.qualified_at)]}),e.jsxs("div",{className:"grid md:grid-cols-[1fr_1fr_auto] gap-2",children:[e.jsx(u,{"aria-label":"Exact baseline SHA",value:p,onChange:s=>T(s.target.value),placeholder:"40-character lowercase commit SHA"}),e.jsx(u,{"aria-label":"Baseline confirmation",value:g,onChange:s=>N(s.target.value),placeholder:"Type QUALIFY_CHAT_BASELINE"}),e.jsx(h,{disabled:r.isPending||!/^[0-9a-f]{40}$/.test(p)||g!=="QUALIFY_CHAT_BASELINE",onClick:w,children:"Qualify exact SHA"})]})]})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(t,{children:"Provider and fallback state"})}),e.jsx(i,{children:a.provider_states.length?e.jsx("ul",{className:"space-y-2",children:a.provider_states.map(s=>e.jsxs("li",{children:[e.jsx("strong",{children:s.environment}),": ",s.active_provider," · ",s.reason_code," · manifest ",s.manifest_revision]},s.environment))}):e.jsx("p",{children:"No provider state recorded."})})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(t,{children:"Recent runs"})}),e.jsx(i,{children:a.recent_runs.length?e.jsx("ul",{className:"space-y-2",children:a.recent_runs.map(s=>e.jsxs("li",{children:[e.jsx("strong",{children:j[s.operator]})," · ",s.status," · ",s.exit_classification," · $",s.cost_usd," · ",m(s.created_at)]},s.run_id))}):e.jsx("p",{children:"No runs recorded."})})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(t,{children:"Recent actions"})}),e.jsx(i,{children:a.recent_actions.length?e.jsx("ul",{className:"space-y-2",children:a.recent_actions.map(s=>e.jsxs("li",{children:[e.jsx("strong",{children:j[s.operator]})," · ",s.capability," · ",s.reason_code," · ",s.resource_kind,"/",s.resource_identifier]},s.action_id))}):e.jsx("p",{children:"No actions recorded."})})]})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(t,{children:"Hard exclusions"})}),e.jsx(i,{children:e.jsx("ul",{className:"list-disc pl-5",children:a.exclusions.map(s=>e.jsx("li",{children:s},s))})})]}),y&&e.jsxs("p",{role:"alert",children:["Control update failed: ",y,". Refresh before retrying."]})]})})};export{V as default}; diff --git a/assets/AutonomousOperations-CzJGtkdV.js b/assets/AutonomousOperations-CzJGtkdV.js deleted file mode 100644 index 2534b55cea77389c3ee80e88cb6906fee9768172..0000000000000000000000000000000000000000 --- a/assets/AutonomousOperations-CzJGtkdV.js +++ /dev/null @@ -1 +0,0 @@ -import{f as R,r as d,j as e,L as B}from"./index-CbgxfyGU.js";import{u as q}from"./useQuery-Bx9s5-D2.js";import{u as H}from"./useMutation-P_trTy9i.js";import{C as n,e as i,S as I,b as l,c as r,t as C,f as m,o as x}from"./CronDashboard-B3Xofwvu.js";import{B as Q}from"./badge-Klg-RRGs.js";import{B as h}from"./button-Bv9oZ-QU.js";import{I as u}from"./input-B6pxtfPe.js";import{A as P}from"./activity-dcKMRXBy.js";import{A as D}from"./arrow-left-Czeu3VzJ.js";const j={submissions:"Submission review",curation:"Scheduled curation",cron_health:"CRON health",chat_reliability:"Chat reliability"},E={healthy:"healthy",degraded:"degraded",repairing:"running","rolled-back":"broken",manual:"degraded"},S=["admin","autonomousOperations"],W=()=>{var A;const M=R(),[p,T]=d.useState(""),[f,_]=d.useState(""),[g,v]=d.useState({}),[b,N]=d.useState(""),c=q({queryKey:S,queryFn:()=>x.getAutonomousOperations(),refetchInterval:3e4,retry:!1}),t=H({mutationFn:s=>s(),onSuccess:s=>{M.setQueryData(S,s),_(""),v({}),N("")}}),a=c.data,y=t.error instanceof Error?t.error.message:null;if(c.isLoading)return e.jsx("div",{className:"page","aria-busy":"true",children:"Loading autonomous operations…"});if(c.error||!a)return e.jsxs("div",{className:"page",children:[e.jsx("h1",{children:"Autonomous operations unavailable"}),e.jsx("p",{children:c.error instanceof Error?c.error.message:"No status was returned."})]});const O=()=>t.mutate(()=>x.setAutonomousManualMode(!a.manual_mode,a.revision,f)),k=(s,o)=>t.mutate(()=>x.setAutonomousOperator(s,o,a.revision,g[s]??"")),w=()=>{var o;const s=((o=a.baseline)==null?void 0:o.revision)??0;t.mutate(()=>x.qualifyAutonomousChatBaseline(p,s,b))};return e.jsx("div",{className:"cron-dashboard","data-shadcn":!0,children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[e.jsx(P,{className:"h-8 w-8"}),"Autonomous operations"]}),e.jsx("p",{className:"mt-2 cron-muted",children:"Content-free supervision, remote controls, and bounded audit history."})]}),e.jsx(h,{asChild:!0,variant:"outline",children:e.jsxs(B,{to:"/admin-dashboard",children:[e.jsx(D,{className:"h-4 w-4 mr-2"}),"Admin dashboard"]})})]}),a.manual_mode&&e.jsx(n,{className:"cron-status--degraded",role:"status",children:e.jsxs(i,{className:"pt-6 flex gap-3",children:[e.jsx(I,{className:"h-5 w-5"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Manual mode is enabled."}),e.jsxs("p",{children:[a.monitoring_active?"Monitoring remains active":"Monitoring is not currently verified","; autonomous callbacks, retries, deployments, and data mutations fail closed."]})]})]})}),e.jsxs("div",{className:"grid md:grid-cols-4 gap-4",children:[e.jsxs(n,{className:C(E[a.display_state]),children:[e.jsx(l,{children:e.jsx(r,{className:"text-sm",children:"Overall state"})}),e.jsxs(i,{children:[e.jsx("div",{className:"text-2xl font-bold capitalize",children:a.display_state}),e.jsxs("p",{className:"text-sm",children:["Monitoring ",a.monitoring_active?"active":"inactive"]})]})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(r,{className:"text-sm",children:"Codex cost"})}),e.jsxs(i,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:["$",a.costs.total_usd]}),e.jsxs("p",{className:"text-sm",children:[a.costs.input_tokens+a.costs.output_tokens," tokens"]})]})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(r,{className:"text-sm",children:"Repair lease"})}),e.jsxs(i,{children:[e.jsx("div",{className:"text-lg font-bold",children:a.active_lease?a.active_lease.owner_operator:"Available"}),e.jsx("p",{className:"text-sm",children:a.active_lease?`Expires ${m(a.active_lease.expires_at)}`:"No active source repair"})]})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(r,{className:"text-sm",children:"Global control"})}),e.jsxs(i,{className:"space-y-2",children:[e.jsx(u,{"aria-label":"Manual mode confirmation",value:f,onChange:s=>_(s.target.value),placeholder:"Type SET_MANUAL_MODE"}),e.jsx(h,{disabled:t.isPending||f!=="SET_MANUAL_MODE",onClick:O,children:a.manual_mode?"Leave manual mode":"Enable manual mode"})]})]})]}),e.jsx("div",{className:"grid md:grid-cols-4 gap-4",children:a.operators.map(s=>e.jsxs(n,{className:C(E[s.status]),children:[e.jsx(l,{children:e.jsxs(r,{className:"flex justify-between gap-2",children:[e.jsx("span",{children:j[s.operator]}),e.jsx(Q,{children:s.status})]})}),e.jsxs(i,{className:"space-y-3",children:[e.jsxs("p",{children:[s.enabled?"Mutation enabled":"Mutation disabled"," · monitoring ",s.monitoring_active?"active":"unverified"]}),e.jsxs("p",{className:"text-sm",children:["Next scheduled run: ",s.next_scheduled_run?m(s.next_scheduled_run):"not scheduled"]}),e.jsx(u,{"aria-label":`${j[s.operator]} confirmation`,value:g[s.operator]??"",onChange:o=>v(L=>({...L,[s.operator]:o.target.value})),placeholder:"Type SET_OPERATOR_STATE"}),e.jsx(h,{disabled:t.isPending||a.manual_mode&&!s.enabled||g[s.operator]!=="SET_OPERATOR_STATE",onClick:()=>k(s.operator,!s.enabled),children:s.enabled?"Disable":"Enable"})]})]},s.operator))}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(r,{children:"Qualified scalable-chat baseline"})}),e.jsxs(i,{className:"space-y-3",children:[e.jsx("p",{className:"font-mono break-all",children:((A=a.baseline)==null?void 0:A.sha)??"No baseline qualified"}),a.baseline&&e.jsxs("p",{className:"text-sm",children:["Revision ",a.baseline.revision," · ",a.baseline.qualified_by," · ",m(a.baseline.qualified_at)]}),e.jsxs("div",{className:"grid md:grid-cols-[1fr_1fr_auto] gap-2",children:[e.jsx(u,{"aria-label":"Exact baseline SHA",value:p,onChange:s=>T(s.target.value),placeholder:"40-character lowercase commit SHA"}),e.jsx(u,{"aria-label":"Baseline confirmation",value:b,onChange:s=>N(s.target.value),placeholder:"Type QUALIFY_CHAT_BASELINE"}),e.jsx(h,{disabled:t.isPending||!/^[0-9a-f]{40}$/.test(p)||b!=="QUALIFY_CHAT_BASELINE",onClick:w,children:"Qualify exact SHA"})]})]})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(r,{children:"Provider and fallback state"})}),e.jsx(i,{children:a.provider_states.length?e.jsx("ul",{className:"space-y-2",children:a.provider_states.map(s=>e.jsxs("li",{children:[e.jsx("strong",{children:s.environment}),": ",s.active_provider," · ",s.reason_code," · manifest ",s.manifest_revision]},s.environment))}):e.jsx("p",{children:"No provider state recorded."})})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(r,{children:"Recent runs"})}),e.jsx(i,{children:a.recent_runs.length?e.jsx("ul",{className:"space-y-2",children:a.recent_runs.map(s=>e.jsxs("li",{children:[e.jsx("strong",{children:j[s.operator]})," · ",s.status," · ",s.exit_classification," · $",s.cost_usd," · ",m(s.created_at)]},s.run_id))}):e.jsx("p",{children:"No runs recorded."})})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(r,{children:"Recent actions"})}),e.jsx(i,{children:a.recent_actions.length?e.jsx("ul",{className:"space-y-2",children:a.recent_actions.map(s=>e.jsxs("li",{children:[e.jsx("strong",{children:j[s.operator]})," · ",s.capability," · ",s.reason_code," · ",s.resource_kind,"/",s.resource_identifier]},s.action_id))}):e.jsx("p",{children:"No actions recorded."})})]})]}),e.jsxs(n,{children:[e.jsx(l,{children:e.jsx(r,{children:"Hard exclusions"})}),e.jsx(i,{children:e.jsx("ul",{className:"list-disc pl-5",children:a.exclusions.map(s=>e.jsx("li",{children:s},s))})})]}),y&&e.jsxs("p",{role:"alert",children:["Control update failed: ",y,". Refresh before retrying."]})]})})};export{W as default}; diff --git a/assets/BenchmarkDetailView-BGwBE1Ld.js b/assets/BenchmarkDetailView-BGwBE1Ld.js deleted file mode 100644 index 9ad977462eccb13d104ec133d1898391c16df783..0000000000000000000000000000000000000000 --- a/assets/BenchmarkDetailView-BGwBE1Ld.js +++ /dev/null @@ -1,2 +0,0 @@ -import{r as L,j as a,E as le,L as ne,c as ot,p as ct,u as dt,e as ut,q as mt}from"./index-CbgxfyGU.js";import{R as ht}from"./ResearchFollowButton-D2BXlDtQ.js";import{u as te}from"./useQuery-Bx9s5-D2.js";import{c as re}from"./catalog-DhK7_9-6.js";import{C as ft,E as pt,e as gt}from"./ExternalSourceEvalBadge-npO6bZ8N.js";import{L as oe}from"./LatexTitle-Z-HGmZ-H.js";import{S as Ke}from"./switch-BSZohE4x.js";import{I as xt}from"./Icon-D-kA0Owz.js";import{S as ce}from"./skeleton-HwvdxvSN.js";import{A as bt,a as yt}from"./alert-CFDDvdIM.js";import{B as wt}from"./BenchmarkTrendSparkline-C135_NtS.js";import{s as vt}from"./safeExternalHref-CkBrsh84.js";import{s as jt}from"./slug-BpH-Nkvz.js";import{i as _t}from"./apiErrors-BZ5h1Kmb.js";import St from"./NotFound-DtzwOULp.js";import"./useMutation-P_trTy9i.js";import"./research-DgpyzSy_.js";import"./plus-UK0TEjgd.js";import"./curation-C7Gmmp4z.js";import"./hover-card-ufez2uMo.js";import"./index-CxPKwmVQ.js";function ie(e){if(e==null)return null;if(typeof e=="number")return Number.isFinite(e)?e:null;const t=e.includes("±")?e.split("±")[0].trim():e.trim(),r=parseFloat(t);return Number.isFinite(r)?r:null}const Ge=[{label:"All",maxParametersExclusive:void 0},{label:"<10M",maxParametersExclusive:1e7},{label:"<100M",maxParametersExclusive:1e8},{label:"<1B",maxParametersExclusive:1e9},{label:"<3B",maxParametersExclusive:3e9},{label:"<6B",maxParametersExclusive:6e9},{label:"<12B",maxParametersExclusive:12e9},{label:"<32B",maxParametersExclusive:32e9},{label:"<128B",maxParametersExclusive:128e9},{label:"<500B",maxParametersExclusive:5e11}];function kt(e){const t=e===null?void 0:Number(e);return Ge.some(r=>r.maxParametersExclusive===t)?t:void 0}function Ct(e){return new Intl.NumberFormat("en",{notation:"compact",maximumSignificantDigits:3}).format(e)}function Et(e){return[e.paper_id,e.task_id,e.dataset_id,e.model_name,e.harness??""].join("|")}function Nt(e){const t=new Map;for(const r of e){const s=Et(r),n=t.get(s);if(!n){t.set(s,{...r,metrics:{...r.metrics||{}},sourceEvaluationIds:[r.id],ranksByMetric:r.best_metric&&r.best_rank!=null?{[r.best_metric]:r.best_rank}:{},parameterCount:r.num_parameters??null,hasParameterConflict:!1});continue}n.metrics={...n.metrics,...r.metrics||{}},n.sourceEvaluationIds.push(r.id),r.best_metric&&r.best_rank!=null&&(n.ranksByMetric[r.best_metric]=r.best_rank),r.num_parameters!=null&&!n.hasParameterConflict&&(n.parameterCount===null?n.parameterCount=r.num_parameters:n.parameterCount!==r.num_parameters&&(n.parameterCount=null,n.hasParameterConflict=!0))}return Array.from(t.values())}function Le(e,t){return t===void 0?e:e.filter(r=>r.parameterCount!==null&&r.parameterCounts+n,0);for(const[s,n]of t)if(n>=2&&n*2>r)return s;return null}function Mt(e,t){const r=e.evaluated_on;return r&&r!==t&&r!==Pt(e.updated_at)?r:e.paper_published_date||""}function Tt(e,t,r){if(e.length===0)return{points:[],sota:0,sotaModel:""};const s=$t(e),n=e.map(u=>{var R;const h=ie((R=u.metrics)==null?void 0:R[t]);return{eval:u,value:h,date:Mt(u,s)}}).filter(u=>u.value!==null&&!!u.date).sort((u,h)=>u.date.localeCompare(h.date)),i=[];let l=null;for(const u of n){const h=l==null?!0:r==="↓"?u.valuel;h&&(l=u.value),i.push({value:u.value,date:u.date,dateLabel:u.date.slice(0,7),modelName:u.eval.model_name||"",paperTitle:u.eval.paper_title||"",paperRouteId:u.eval.paper_arxiv_id||u.eval.paper_id||null,isSota:h})}const d=e.map(u=>{var h;return{eval:u,value:ie((h=u.metrics)==null?void 0:h[t])}}).filter(u=>u.value!==null).sort((u,h)=>r==="↓"?u.value-h.value:h.value-u.value)[0],f=(d==null?void 0:d.value)??0,x=(d==null?void 0:d.eval.model_name)||(d==null?void 0:d.eval.paper_title)||"";return{points:i,sota:f,sotaModel:x}}function Ft(e,t,r){const s=t?(e??[]).filter(l=>l.task_id===t):e??[],n=s.filter(l=>l.is_open===!1),i=n.reduce((l,c)=>l?(c.best_rank??Number.POSITIVE_INFINITY)<(l.best_rank??Number.POSITIVE_INFINITY)?c:l:c,null);return{visible:r?s.filter(l=>l.is_open!==!1):s,hiddenClosed:n,topHiddenClosed:i}}function Qe(e,t,r,s){const n=t.find(i=>i.id===s);if(e.length===0)return null;if(n!=null&&n.task_id&&e.some(i=>i.id===n.task_id))return n.task_id;if(r){const i=e.find(l=>l.slug===r);if(i)return i.id}if(e.length===1)return e[0].id;if(t.length>0){const i=new Map;for(const d of t)i.set(d.task_id,(i.get(d.task_id)||0)+1);let l=null,c=-1;for(const d of e){const f=i.get(d.id)||0;f>c&&(c=f,l=d.id)}if(l)return l}return e[0].id}function Lt(e){var _,X,Y;const{evaluations:t,tasks:r,taskSlug:s,highlightEvalId:n,parameterBound:i,showMoreMetrics:l,fittingMetricCount:c=1}=e,d=Qe(r,t,s,n),f=r.find(o=>o.id===d)||r[0]||null,x=t.find(o=>o.id===n),u=Ft(t,d,e.hideClosed),h=Nt(u.visible),R=Le(h,i),C=e.configuredMetrics.map(o=>o.metric_name),P=Array.from(new Set(h.flatMap(o=>[...o.best_metric?[o.best_metric]:[],...Object.keys(o.metrics||{})]))),S=C.length?C:P,g=new Map;for(const o of h){const m=o.best_metric;!m||ie(o.metrics[m])===null||C.length&&!S.includes(m)||g.set(m,(g.get(m)||0)+1)}const k=((_=[...g].sort((o,m)=>m[1]-o[1])[0])==null?void 0:_[0])||S[0]||"",j=S.find(o=>{var m;return o.toLocaleLowerCase()===((m=e.metric)==null?void 0:m.trim().toLocaleLowerCase())})||(x==null?void 0:x.best_metric)||k,D=((X=e.directions)==null?void 0:X.directions[j])==="lower_is_better"?"↓":"↑",W=j&&S.includes(j)?[j,...S.filter(o=>o!==j)]:S,w=W.length?l?W:W.slice(0,Math.max(1,c)):j?[j]:[],U=R.slice().sort((o,m)=>{const p=ie(o.metrics[j]),y=ie(m.metrics[j]);return p!==null&&y!==null?D==="↓"?p-y:y-p:p!==null?-1:y!==null?1:Ie(o,j)-Ie(m,j)});let I=null,N=0;const Q=U.map((o,m)=>{const p=ie(o.metrics[j]);return p!==null&&p!==I&&(I=p,N=m+1),{evaluation:o,rank:p===null?null:N,isHighlighted:Rt(o,n)}}),{points:z,sota:ee,sotaModel:O}=Tt(R,j,D),M=i===void 0?e.initialSummary:void 0,q=e.ready.evaluations&&e.ready.tasks&&e.ready.directions&&(!d||e.ready.metrics),K={parameter_coverage_known:h.filter(o=>o.parameterCount!==null).length,parameter_coverage_total:h.length};return{currentTaskId:d,primaryTask:f,activeMetric:j,arrow:D,allowedMetrics:S,orderedMetrics:W,visibleMetrics:w,rows:Q,chartPoints:z,highlightedEval:((Y=Q.find(o=>o.isHighlighted))==null?void 0:Y.evaluation)||null,hiddenClosedEvals:u.hiddenClosed,hiddenClosedTopEval:u.topHiddenClosed,parameterBound:i,parameterCoverage:K,hasParameterMetadata:K.parameter_coverage_known>0,parameterFilters:Ge.map(o=>({...o,selected:i===o.maxParametersExclusive,disabled:i!==o.maxParametersExclusive&&Le(h,o.maxParametersExclusive).length===0})),displayedMetric:q?j:M==null?void 0:M.metric,displayedSota:q?ee:M==null?void 0:M.value,displayedSotaModel:q?O:M==null?void 0:M.model_name,isSummaryLoading:!q&&!M,isInitialFilteredViewLoading:i!==void 0&&!q}}function It(e,t,r,s=1,n=0){const i=e-t.fixed-(r?t.harness:0);if(t.metric<=0)return 1;const l=Math.floor(i/t.metric);if(lr+he(t,s),0),harness:he(t,"--bm-harness-width"),metric:he(t,"--bm-metric-width")}}const Bt=20;function Ae(e,t){return e?a.jsx(oe,{title:e}):t||"—"}function Dt({model:e,showHarness:t,setMetric:r,highlightRowRef:s,onFittingMetricCountChange:n}){const{rows:i,visibleMetrics:l,activeMetric:c,arrow:d}=e,[f,x]=L.useState(null);return L.useEffect(()=>{if(!f)return;const u=()=>{f.classList.toggle("has-horizontal-overflow",f.scrollWidth>f.clientWidth);const R=f.firstElementChild;if(!R)return;const C=f.clientWidth,P=At(R);f.classList.toggle("unpins-trailing-columns",CS.clientHeight?0:Bt;n(k=>It(C,P,t,k,g))},h=new ResizeObserver(u);return h.observe(f),f.firstElementChild&&h.observe(f.firstElementChild),u(),()=>h.disconnect()},[f,t,n]),a.jsx("div",{ref:x,className:"bm-table-scroll",role:"region","aria-label":"Leaderboard metrics",tabIndex:0,children:a.jsxs("table",{id:"benchmark-leaderboard",className:"bm-table",style:{"--bm-metric-count":l.length,"--bm-harness-count":t?1:0},children:[a.jsxs("colgroup",{children:[a.jsx("col",{className:"bm-width-rank"}),a.jsx("col",{className:"bm-width-model"}),a.jsx("col",{className:"bm-width-parameters"}),t&&a.jsx("col",{className:"bm-width-harness"}),l.map(u=>a.jsx("col",{className:"bm-width-metric"},u)),a.jsx("col",{}),a.jsx("col",{className:"bm-width-year"})]}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{className:"col-rank",children:"Rank"}),a.jsx("th",{className:"col-model",children:"Model"}),a.jsxs("th",{className:"col-parameters",children:[a.jsx("span",{className:"bm-label-full",children:"Parameters"}),a.jsx("span",{className:"bm-label-short",children:"Params"})]}),t&&a.jsx("th",{className:"col-harness",children:"Harness"}),l.map(u=>{const h=u===c;return a.jsx("th",{className:`col-value ${h?"is-active":""}`,"aria-sort":h?d==="↓"?"ascending":"descending":"none",children:a.jsxs("button",{type:"button",className:"bm-metric-header",onClick:()=>r(u),"aria-pressed":h,title:`Sort by ${u}`,children:[u,h?` ${d}`:""]})},u)}),a.jsx("th",{className:"col-paper",children:"Paper"}),a.jsx("th",{className:"col-year",children:"Year"})]})}),a.jsx("tbody",{children:i.map(({evaluation:u,rank:h,isHighlighted:R})=>{var S;const C=u.paper_arxiv_id||u.paper_id,P=u.paper_title||(u.paper_arxiv_id?`arXiv:${u.paper_arxiv_id}`:null);return a.jsxs("tr",{ref:R?s:void 0,className:R?"is-highlighted":void 0,children:[a.jsx("td",{className:"col-rank",children:h??"—"}),a.jsxs("td",{className:"col-model",children:[R&&a.jsx("span",{className:"bm-row-marker","aria-hidden":"true"}),u.hf_model_url?a.jsx("a",{href:u.hf_model_url,target:"_blank",rel:"noopener noreferrer",className:"bm-model-link",title:`Open ${u.model_name||"model"} on Hugging Face`,children:u.model_name||"—"}):u.model_name||"—",u.is_open===!1&&a.jsx(ft,{}),(u.external??u.is_external)&&a.jsx(pt,{sourceUrl:u.source_url||u.external_source_url||u.result_url})]}),a.jsx("td",{className:"col-parameters",title:u.parameterCount===null?void 0:u.parameterCount.toLocaleString("en-US"),"aria-label":u.parameterCount===null?"Parameters unknown":`${u.parameterCount.toLocaleString("en-US")} parameters`,children:u.parameterCount===null?"—":Ct(u.parameterCount)}),t&&a.jsx("td",{className:"col-harness",children:u.harness||"—"}),l.map(g=>{var j;const k=g===c,B=(j=u.metrics)==null?void 0:j[g];return a.jsx("td",{className:`col-value${k?" is-active":""}${k&&h===1?" is-best":""}`,children:B!=null&&B!==""?le(B):"—"},g)}),a.jsx("td",{className:"col-paper",children:C?a.jsx(ne,{to:`/paper/${C}`,title:u.paper_title||P||void 0,children:Ae(u.paper_title,P)}):Ae(u.paper_title,P)}),a.jsx("td",{className:"col-year",children:((S=u.evaluated_on||u.paper_published_date)==null?void 0:S.slice(0,4))||"—"})]},u.id)})})]})})}function Be(e){const t=e.length===7?`${e}-01`:e,r=new Date(t).getTime();return Number.isFinite(r)?r:0}const fe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function pe(e){const t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()}}function Ht(e,t){if(e===t){const{year:d,month:f}=pe(e);return[{timestamp:new Date(d,f,1).getTime(),key:`${d}-${f}`,label:`${fe[f]} ${d}`}]}const r=pe(e),s=pe(t);if(r.year===s.year){const d=s.month-r.month+1;let f=1;const x=12;d>x&&(f=Math.ceil(d/x));const u=[];for(let h=r.month;h<=s.month;h+=f)u.push({timestamp:new Date(r.year,h,1).getTime(),key:`${r.year}-${h}`,label:d<=3?`${fe[h]} ${r.year}`:fe[h]});return u}const n=s.year-r.year+1;let i=1;const l=12;n>l&&(i=Math.ceil(n/l));const c=[];for(let d=r.year;d<=s.year;d+=i)c.push({timestamp:new Date(d,0,1).getTime(),key:String(d),label:String(d)});return c}const Vt=({points:e,metric:t})=>{const r=ot(),[s,n]=L.useState(null),i=880,l=320,c=60,d=30,f=40,x=50,u=e.map(o=>o.value),h=Math.min(...u),C=Math.max(...u)-h||1,P=i-c-d,S=l-f-x,g=e.map(o=>Be(o.date)),k=Math.min(...g),B=Math.max(...g),j=B-k||1,D=o=>k===B?c+P/2:c+(o-k)/j*P,W=e.map((o,m)=>{const p=D(Be(o.date)),y=(o.value-h)/C,$=f+S*(1-y);return{x:p,y:$,data:o,idx:m}}),w=W.filter(o=>o.data.isSota);let U="";if(w.length>=2){U=`M${w[0].x},${w[0].y}`;for(let o=1;o{const m=o.data.modelName||o.data.paperTitle||"";if(!m)return null;const p=m.length>22?m.slice(0,21)+"…":m,y=p.length*I;let $=o.x-y/2,E=o.x+y/2,v="middle";return $i-d&&(E=i-d,$=E-y,v="end"),{x:v==="start"?c:v==="end"?i-d:o.x,y:o.y-Q,text:p,anchor:v,left:$,right:E}},ee=[],O=w.length>0?z(w[w.length-1]):null;let M=-1/0;for(let o=0;oO.left-N||(M=m.right,ee.push({x:m.x,y:m.y,text:m.text,anchor:m.anchor})))}O&&ee.push({x:O.x,y:O.y,text:O.text,anchor:O.anchor});const q=Ht(k,B),K=5,_=o=>n(m=>m===o?null:m),X=o=>{o&&r(`/paper/${o}`)},Y=(o,m)=>{const y=`${o.data.modelName||o.data.paperTitle||"Unknown model"}: ${le(o.data.value)} on ${o.data.dateLabel}`,$=!!o.data.paperRouteId;return a.jsxs("g",{children:[m,a.jsx("circle",{cx:o.x,cy:o.y,r:"10",fill:"transparent",style:{cursor:$?"pointer":"default",outline:"none"},tabIndex:0,role:$?"link":"img","aria-label":y,onMouseEnter:()=>n(o.idx),onMouseLeave:()=>_(o.idx),onFocus:()=>n(o.idx),onBlur:()=>_(o.idx),onClick:()=>X(o.data.paperRouteId),onKeyDown:E=>{$&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),X(o.data.paperRouteId))},children:a.jsx("title",{children:y})})]},o.idx)};return a.jsxs("svg",{width:"100%",viewBox:`0 0 ${i} ${l}`,style:{display:"block"},children:[a.jsx("text",{x:c-38,y:f+S/2,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"middle",transform:`rotate(-90 ${c-38} ${f+S/2})`,children:t}),Array.from({length:K}).map((o,m)=>{const p=m/(K-1),y=f+S*(1-p),$=h+C*p;return a.jsxs("g",{children:[a.jsx("line",{x1:c,y1:y,x2:i-d,y2:y,stroke:"var(--hairline)",strokeWidth:"1"}),a.jsx("text",{x:c-10,y:y+4,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"end",children:le($)})]},m)}),q.map(o=>{const m=D(o.timestamp);return a.jsx("text",{x:m,y:l-x+18,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:"middle",children:o.label},o.key)}),W.filter(o=>!o.data.isSota).map(o=>{const m=s===o.idx;return Y(o,a.jsx("circle",{cx:o.x,cy:o.y,r:m?3:2,fill:"var(--ink-faint)",opacity:m?1:.45,style:{transition:"r 0.12s ease, opacity 0.12s ease"}}))}),U&&a.jsx("path",{d:U,stroke:"var(--accent)",strokeWidth:"2",fill:"none",strokeLinejoin:"round",strokeLinecap:"round"}),w.map(o=>{const m=s===o.idx;return Y(o,a.jsx("circle",{cx:o.x,cy:o.y,r:m?4.5:3,fill:m?"var(--accent)":"var(--bg-elevated)",stroke:"var(--accent)",strokeWidth:"1.5",style:{transition:"r 0.12s ease, fill 0.12s ease"}}))}),ee.map((o,m)=>a.jsx("text",{x:o.x,y:o.y,fontSize:"9.5",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:o.anchor,pointerEvents:"none",style:{paintOrder:"stroke",stroke:"var(--bg-elevated)",strokeWidth:3,strokeLinejoin:"round"},children:o.text},`label-${m}`)),s!==null&&W[s]&&(()=>{const o=W[s],m=o.data.modelName||o.data.paperTitle||"Unknown model",y=`${m.length>40?m.slice(0,39)+"…":m}: ${le(o.data.value)}`,E=Math.max(120,Math.min(340,y.length*6.6+24)),v=30;let H=o.x-E/2;Hi-d&&(H=i-d-E);const G=o.y-v-14>=f?o.y-v-12:o.y+12;return a.jsxs("g",{pointerEvents:"none",children:[a.jsx("rect",{x:H,y:G,width:E,height:v,rx:"6",ry:"6",fill:"var(--bg-elevated)",stroke:"var(--hairline-strong)",strokeWidth:"1",style:{filter:"drop-shadow(0 2px 6px rgba(0,0,0,0.08))"}}),a.jsx("text",{x:H+12,y:G+19,fontSize:"12",fontFamily:"var(--sans)",fill:"var(--ink)",fontWeight:500,children:y})]})})()]})};function Wt(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),s=r.createElement("base"),n=r.createElement("a");return r.head.appendChild(s),r.body.appendChild(n),t&&(s.href=t),n.href=e,n.href}const Ot=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function Z(e){const t=[];for(let r=0,s=e.length;rV||e.height>V)&&(e.width>V&&e.height>V?e.width>e.height?(e.height*=V/e.width,e.width=V):(e.width*=V/e.height,e.height=V):e.width>V?(e.height*=V/e.width,e.width=V):(e.width*=V/e.height,e.height=V))}function Gt(e,t={}){return e.toBlob?new Promise(r=>{e.toBlob(r,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(r=>{const s=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),n=s.length,i=new Uint8Array(n);for(let l=0;l{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=r,s.crossOrigin="anonymous",s.decoding="async",s.src=e})}async function Qt(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Xt(e,t,r){const s="http://www.w3.org/2000/svg",n=document.createElementNS(s,"svg"),i=document.createElementNS(s,"foreignObject");return n.setAttribute("width",`${t}`),n.setAttribute("height",`${r}`),n.setAttribute("viewBox",`0 0 ${t} ${r}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),n.appendChild(i),i.appendChild(e),Qt(n)}const A=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||A(r,t)};function Yt(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Jt(e,t){return Xe(t).map(r=>{const s=e.getPropertyValue(r),n=e.getPropertyPriority(r);return`${r}: ${s}${n?" !important":""};`}).join(" ")}function Zt(e,t,r,s){const n=`.${e}:${t}`,i=r.cssText?Yt(r):Jt(r,s);return document.createTextNode(`${n}{${i}}`)}function De(e,t,r,s){const n=window.getComputedStyle(e,r),i=n.getPropertyValue("content");if(i===""||i==="none")return;const l=Ot();try{t.className=`${t.className} ${l}`}catch{return}const c=document.createElement("style");c.appendChild(Zt(l,r,n,s)),t.appendChild(c)}function er(e,t,r){De(e,t,":before",r),De(e,t,":after",r)}const He="application/font-woff",Ve="image/jpeg",tr={woff:He,woff2:He,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Ve,jpeg:Ve,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function rr(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function ye(e){const t=rr(e).toLowerCase();return tr[t]||""}function ar(e){return e.split(/,/)[1]}function xe(e){return e.search(/^(data:)/)!==-1}function sr(e,t){return`data:${t};base64,${e}`}async function Je(e,t,r){const s=await fetch(e,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const n=await s.blob();return new Promise((i,l)=>{const c=new FileReader;c.onerror=l,c.onloadend=()=>{try{i(r({res:s,result:c.result}))}catch(d){l(d)}},c.readAsDataURL(n)})}const ge={};function nr(e,t,r){let s=e.replace(/\?.*/,"");return r&&(s=e),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function we(e,t,r){const s=nr(e,t,r.includeQueryParams);if(ge[s]!=null)return ge[s];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let n;try{const i=await Je(e,r.fetchRequestInit,({res:l,result:c})=>(t||(t=l.headers.get("Content-Type")||""),ar(c)));n=sr(i,t)}catch(i){n=r.imagePlaceholder||"";let l=`Failed to fetch resource: ${e}`;i&&(l=typeof i=="string"?i:i.message),l&&console.warn(l)}return ge[s]=n,n}async function ir(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):ue(t)}async function lr(e,t){if(e.currentSrc){const i=document.createElement("canvas"),l=i.getContext("2d");i.width=e.clientWidth,i.height=e.clientHeight,l==null||l.drawImage(e,0,0,i.width,i.height);const c=i.toDataURL();return ue(c)}const r=e.poster,s=ye(r),n=await we(r,s,t);return ue(n)}async function or(e,t){var r;try{if(!((r=e==null?void 0:e.contentDocument)===null||r===void 0)&&r.body)return await me(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function cr(e,t){return A(e,HTMLCanvasElement)?ir(e):A(e,HTMLVideoElement)?lr(e,t):A(e,HTMLIFrameElement)?or(e,t):e.cloneNode(Ze(e))}const dr=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",Ze=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function ur(e,t,r){var s,n;if(Ze(t))return t;let i=[];return dr(e)&&e.assignedNodes?i=Z(e.assignedNodes()):A(e,HTMLIFrameElement)&&(!((s=e.contentDocument)===null||s===void 0)&&s.body)?i=Z(e.contentDocument.body.childNodes):i=Z(((n=e.shadowRoot)!==null&&n!==void 0?n:e).childNodes),i.length===0||A(e,HTMLVideoElement)||await i.reduce((l,c)=>l.then(()=>me(c,r)).then(d=>{d&&t.appendChild(d)}),Promise.resolve()),t}function mr(e,t,r){const s=t.style;if(!s)return;const n=window.getComputedStyle(e);n.cssText?(s.cssText=n.cssText,s.transformOrigin=n.transformOrigin):Xe(r).forEach(i=>{let l=n.getPropertyValue(i);i==="font-size"&&l.endsWith("px")&&(l=`${Math.floor(parseFloat(l.substring(0,l.length-2)))-.1}px`),A(e,HTMLIFrameElement)&&i==="display"&&l==="inline"&&(l="block"),i==="d"&&t.getAttribute("d")&&(l=`path(${t.getAttribute("d")})`),s.setProperty(i,l,n.getPropertyPriority(i))})}function hr(e,t){A(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),A(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function fr(e,t){if(A(e,HTMLSelectElement)){const r=t,s=Array.from(r.children).find(n=>e.value===n.getAttribute("value"));s&&s.setAttribute("selected","")}}function pr(e,t,r){return A(t,Element)&&(mr(e,t,r),er(e,t,r),hr(e,t),fr(e,t)),t}async function gr(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const s={};for(let i=0;icr(s,t)).then(s=>ur(e,s,t)).then(s=>pr(e,s,t)).then(s=>gr(s,t))}const et=/url\((['"]?)([^'"]+?)\1\)/g,xr=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,br=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function yr(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function wr(e){const t=[];return e.replace(et,(r,s,n)=>(t.push(n),r)),t.filter(r=>!xe(r))}async function vr(e,t,r,s,n){try{const i=r?Wt(t,r):t,l=ye(t);let c;return n||(c=await we(i,l,s)),e.replace(yr(t),`$1${c}$3`)}catch{}return e}function jr(e,{preferredFontFormat:t}){return t?e.replace(br,r=>{for(;;){const[s,,n]=xr.exec(r)||[];if(!n)return"";if(n===t)return`src: ${s};`}}):e}function tt(e){return e.search(et)!==-1}async function rt(e,t,r){if(!tt(e))return e;const s=jr(e,r);return wr(s).reduce((i,l)=>i.then(c=>vr(c,l,t,r)),Promise.resolve(s))}async function se(e,t,r){var s;const n=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(n){const i=await rt(n,null,r);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function _r(e,t){await se("background",e,t)||await se("background-image",e,t),await se("mask",e,t)||await se("-webkit-mask",e,t)||await se("mask-image",e,t)||await se("-webkit-mask-image",e,t)}async function Sr(e,t){const r=A(e,HTMLImageElement);if(!(r&&!xe(e.src))&&!(A(e,SVGImageElement)&&!xe(e.href.baseVal)))return;const s=r?e.src:e.href.baseVal,n=await we(s,ye(s),t);await new Promise((i,l)=>{e.onload=i,e.onerror=t.onImageErrorHandler?(...d)=>{try{i(t.onImageErrorHandler(...d))}catch(f){l(f)}}:l;const c=e;c.decode&&(c.decode=i),c.loading==="lazy"&&(c.loading="eager"),r?(e.srcset="",e.src=n):e.href.baseVal=n})}async function kr(e,t){const s=Z(e.childNodes).map(n=>at(n,t));await Promise.all(s).then(()=>e)}async function at(e,t){A(e,Element)&&(await _r(e,t),await Sr(e,t),await kr(e,t))}function Cr(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const s=t.style;return s!=null&&Object.keys(s).forEach(n=>{r[n]=s[n]}),e}const We={};async function Oe(e){let t=We[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},We[e]=t,t}async function qe(e,t){let r=e.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,i=(r.match(/url\([^)]+\)/g)||[]).map(async l=>{let c=l.replace(s,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),Je(c,t.fetchRequestInit,({result:d})=>(r=r.replace(l,`url(${d})`),[l,d]))});return Promise.all(i).then(()=>r)}function Ue(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let s=e.replace(r,"");const n=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const d=n.exec(s);if(d===null)break;t.push(d[0])}s=s.replace(n,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,l="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(l,"gi");for(;;){let d=i.exec(s);if(d===null){if(d=c.exec(s),d===null)break;i.lastIndex=c.lastIndex}else c.lastIndex=i.lastIndex;t.push(d[0])}return t}async function Er(e,t){const r=[],s=[];return e.forEach(n=>{if("cssRules"in n)try{Z(n.cssRules||[]).forEach((i,l)=>{if(i.type===CSSRule.IMPORT_RULE){let c=l+1;const d=i.href,f=Oe(d).then(x=>qe(x,t)).then(x=>Ue(x).forEach(u=>{try{n.insertRule(u,u.startsWith("@import")?c+=1:n.cssRules.length)}catch(h){console.error("Error inserting rule from remote css",{rule:u,error:h})}})).catch(x=>{console.error("Error loading remote css",x.toString())});s.push(f)}})}catch(i){const l=e.find(c=>c.href==null)||document.styleSheets[0];n.href!=null&&s.push(Oe(n.href).then(c=>qe(c,t)).then(c=>Ue(c).forEach(d=>{l.insertRule(d,l.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",i)}}),Promise.all(s).then(()=>(e.forEach(n=>{if("cssRules"in n)try{Z(n.cssRules||[]).forEach(i=>{r.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${n.href}`,i)}}),r))}function Nr(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>tt(t.style.getPropertyValue("src")))}async function Rr(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=Z(e.ownerDocument.styleSheets),s=await Er(r,t);return Nr(s)}function st(e){return e.trim().replace(/["']/g,"")}function Pr(e){const t=new Set;function r(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(i=>{t.add(st(i))}),Array.from(s.children).forEach(i=>{i instanceof HTMLElement&&r(i)})}return r(e),t}async function $r(e,t){const r=await Rr(e,t),s=Pr(e);return(await Promise.all(r.filter(i=>s.has(st(i.style.fontFamily))).map(i=>{const l=i.parentStyleSheet?i.parentStyleSheet.href:null;return rt(i.cssText,l,t)}))).join(` -`)}async function Mr(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await $r(e,t);if(r){const s=document.createElement("style"),n=document.createTextNode(r);s.appendChild(n),e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}}async function Tr(e,t={}){const{width:r,height:s}=Ye(e,t),n=await me(e,t,!0);return await Mr(n,t),await at(n,t),Cr(n,t),await Xt(n,r,s)}async function Fr(e,t={}){const{width:r,height:s}=Ye(e,t),n=await Tr(e,t),i=await ue(n),l=document.createElement("canvas"),c=l.getContext("2d"),d=t.pixelRatio||zt(),f=t.canvasWidth||r,x=t.canvasHeight||s;return l.width=f*d,l.height=x*d,t.skipAutoScale||Kt(l),l.style.width=`${f}`,l.style.height=`${x}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,l.width,l.height)),c.drawImage(i,0,0,l.width,l.height),l}async function Lr(e,t={}){const r=await Fr(e,t);return await Gt(r)}const be="#ffffff";function Ir(){return typeof window>"u"?be:window.getComputedStyle(document.documentElement).getPropertyValue("--bg-elevated").trim()||be}function Ar(e){if(typeof window>"u")return be;const t=window.getComputedStyle(e).backgroundColor;return!t||t==="rgba(0, 0, 0, 0)"||t==="transparent"?Ir():t}async function Br(e){var r,s;if(typeof window>"u"||!((s=(r=window.navigator)==null?void 0:r.clipboard)!=null&&s.write))throw new Error("Clipboard image copy is not supported in this browser.");if(typeof window.ClipboardItem>"u")throw new Error("Clipboard image copy is not supported in this browser.");const t=await Lr(e,{pixelRatio:2,cacheBust:!0,backgroundColor:Ar(e)});if(!t)throw new Error("Failed to render screenshot.");await window.navigator.clipboard.write([new window.ClipboardItem({"image/png":t})])}const nt=({targetRef:e,label:t})=>{const{toast:r}=ct(),[s,n]=L.useState("idle"),i=L.useRef(null);L.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const l=L.useCallback(async()=>{const d=e.current;if(d){n("copying"),d.classList.add("is-capturing"),d.offsetHeight,await new Promise(f=>window.requestAnimationFrame(()=>f()));try{await Br(d),n("copied"),r({title:"Screenshot copied",description:`Image of the ${t} copied to your clipboard.`}),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>n("idle"),1500)}catch(f){n("idle"),r({title:"Copy failed",description:f instanceof Error&&f.message?f.message:"Could not copy the screenshot to your clipboard.",variant:"destructive"})}finally{d.classList.remove("is-capturing")}}},[e,t,r]),c=s==="copied"?"Copied":s==="copying"?"Copying…":"Copy image";return a.jsxs("button",{type:"button",className:"bm-copy-btn",onClick:l,disabled:s==="copying","aria-label":`Copy ${t} screenshot to clipboard`,title:`Copy ${t} screenshot to clipboard`,children:[a.jsx(xt,{name:"copy",size:11}),c]})};function Dr({model:e,datasetName:t,hideClosed:r,setHideClosed:s,setMetric:n}){const i=L.useRef(null),{isInitialFilteredViewLoading:l,chartPoints:c,activeMetric:d,allowedMetrics:f,orderedMetrics:x,parameterBound:u}=e;return l||c.length===0?null:a.jsxs("div",{className:"bm-card",ref:i,children:[a.jsxs("div",{className:"bm-card-screenshot-header","aria-hidden":"true",children:[a.jsxs("div",{className:"bm-card-screenshot-title",children:[a.jsx("span",{className:"bm-card-screenshot-eyebrow",children:"Benchmark"}),a.jsx("span",{className:"bm-card-screenshot-name",children:t})]}),a.jsxs("div",{className:"bm-card-screenshot-brand",children:[a.jsxs("span",{className:"brand",children:[a.jsx("span",{className:"brand-mark"}),a.jsxs("span",{className:"brand-name",children:["Papers ",a.jsx("em",{children:"With Code"})]})]}),a.jsx("span",{className:"bm-card-screenshot-url",children:"paperswithcode.co"})]})]}),a.jsxs("div",{className:"bm-card-head",children:[a.jsx("div",{className:"bm-card-title",children:"SOTA progression"}),a.jsxs("div",{className:"bm-card-actions",children:[f.length>1&&a.jsxs("label",{className:"bm-view-select",children:[a.jsx("span",{className:"bm-view-select-label",children:"View"}),a.jsx("select",{value:d,onChange:h=>n(h.target.value),children:x.map(h=>a.jsx("option",{value:h,children:h},h))})]}),a.jsxs("label",{className:"bm-closed-toggle",title:"Show or hide evaluations of closed-source models",children:[a.jsx(Ke,{className:"bm-closed-toggle-switch",checked:!r,onCheckedChange:h=>{s(!h)},"aria-label":"Show closed-source models"}),a.jsx("span",{className:"bm-closed-toggle-label",children:"Closed-source"})]}),a.jsx(nt,{targetRef:i,label:"SOTA chart"})]})]}),a.jsx("div",{className:"bm-chart-wrap",children:a.jsx(Vt,{points:c,metric:d})}),a.jsxs("div",{className:"bm-chart-foot",children:[a.jsx("span",{className:"legend-dot"}),u===void 0?"All models":"Filtered models"," over time · highlighted dots track the running best · hover for the model · click to open the paper"]})]})}function Hr(e){if(!e)return null;const t=e.trim(),r=t.match(/^https?:\/\/(?:www\.)?arxiv\.org\/(?:abs|pdf)\/([^/?#]+)/i);if(r!=null&&r[1])return r[1].replace(/\.pdf$/i,"");const s=t.match(/^(?:https?:\/\/(?:www\.)?paperswithcode\.co)?\/paper\/([^/?#]+)/i);return(s==null?void 0:s[1])??null}function ze(e,t){return e?a.jsx(oe,{title:e}):t||"—"}const oa=()=>{var ve,je,_e,Se,ke,Ce,Ee,Ne,Re,Pe,$e;const{datasetSlug:e}=dt(),[t,r]=ut(),s=t.get("task")||void 0,n=t.get("eval")||void 0,i=kt(t.get("max_parameters_exclusive")),{preferences:l,setHideClosedSourceEvals:c}=mt(),d=L.useRef(null),f=L.useRef(!1),x=L.useRef(null),[u,h]=L.useState(null),R=`${e}:${s||""}`,C=u===R,[P,S]=L.useState(1),g=te({queryKey:["dataset",e,"with-paper",s,l.hide_closed_source_evals?"open":"all"],queryFn:()=>re.getDatasetBySlug(e,{include_paper:!0,task:s,is_open:l.hide_closed_source_evals?!0:void 0}),enabled:!!e,staleTime:10*60*1e3}),k=te({queryKey:["dataset-evals",(ve=g.data)==null?void 0:ve.id],queryFn:()=>gt.byDataset(g.data.id),enabled:!!((je=g.data)!=null&&je.id),staleTime:5*60*1e3}),B=te({queryKey:["dataset-tasks",(_e=g.data)==null?void 0:_e.id],queryFn:()=>re.datasetTasks(g.data.id),enabled:!!((Se=g.data)!=null&&Se.id),staleTime:10*60*1e3}),j=te({queryKey:["metric-directions"],queryFn:()=>re.metricDirections(),staleTime:60*60*1e3}),D=Qe(B.data||[],k.data||[],s,n),W=te({queryKey:["task-benchmark-trends",D,l.hide_closed_source_evals?!0:void 0],queryFn:()=>re.trendingBenchmarks(D,{limit:100,min_recent_papers:0,is_open:l.hide_closed_source_evals?!0:void 0}),enabled:!!D&&!!((ke=g.data)!=null&&ke.id),staleTime:10*60*1e3}),w=L.useMemo(()=>{var b;return(((b=W.data)==null?void 0:b.results)||[]).find(T=>{var F;return T.id===((F=g.data)==null?void 0:F.id)})||null},[W.data,(Ce=g.data)==null?void 0:Ce.id]),U=te({queryKey:["leaderboard-metrics",(Ee=g.data)==null?void 0:Ee.id,D],queryFn:()=>re.leaderboardMetrics(g.data.id,D),enabled:!!((Ne=g.data)!=null&&Ne.id)&&!!D,staleTime:10*60*1e3}),I=Lt({evaluations:k.data||[],tasks:B.data||[],configuredMetrics:U.data||[],directions:j.data,initialSummary:(Re=g.data)==null?void 0:Re.leaderboard_summary,taskSlug:s,highlightEvalId:n,metric:t.get("metric")||void 0,hideClosed:l.hide_closed_source_evals,parameterBound:i,showMoreMetrics:C,fittingMetricCount:P,ready:{evaluations:k.isSuccess,tasks:B.isSuccess,directions:j.isSuccess,metrics:U.isSuccess}}),{primaryTask:N,hiddenClosedEvals:Q,hiddenClosedTopEval:z,isSummaryLoading:ee,displayedMetric:O,displayedSota:M,displayedSotaModel:q,isInitialFilteredViewLoading:K,highlightedEval:_,hasParameterMetadata:X,parameterCoverage:Y,orderedMetrics:o}=I;L.useEffect(()=>{if(f.current||!n||!k.data||k.data.length===0)return;const b=d.current;b&&(f.current=!0,b.scrollIntoView({behavior:"smooth",block:"start"}))},[n,k.data]);const m=te({queryKey:["area",N==null?void 0:N.area_id],queryFn:()=>re.getArea(N.area_id),enabled:!!(N!=null&&N.area_id),staleTime:10*60*1e3});if(g.isLoading)return a.jsxs("div",{className:"page",children:[a.jsx(ce,{className:"h-12 w-1/2 mb-6"}),a.jsx(ce,{className:"h-64 w-full"})]});if(_t(g.error))return a.jsx(St,{});if(g.error||!g.data)return a.jsx("div",{className:"page",children:a.jsx(bt,{variant:"destructive",children:a.jsx(yt,{children:"Benchmark not found."})})});const p=g.data,y=!!p.supports_harness,$=b=>{r(T=>{const F=new URLSearchParams(T);return b===void 0?F.delete("max_parameters_exclusive"):F.set("max_parameters_exclusive",String(b)),F})},E=b=>{r(T=>{const F=new URLSearchParams(T);return F.set("metric",b),F})},v=p.introducing_paper??void 0,H=(v==null?void 0:v.arxiv_id)||(v==null?void 0:v.id)||Hr(p.paper_url),J=(v==null?void 0:v.title)||p.introducing_paper_title||null,G=((Pe=v==null?void 0:v.published)==null?void 0:Pe.slice(0,4))||p.introduced_year||null,it=!!H||!!p.paper_url||!!J,lt=v!=null&&v.arxiv_id||($e=p.paper_url)!=null&&$e.match(/^https?:\/\/(?:www\.)?arxiv\.org\//i)?`arXiv:${H}`:`Paper ${H}`;return a.jsx("div",{className:"page",children:a.jsxs("div",{className:"bm-page",children:[a.jsxs("div",{className:"breadcrumb",children:[a.jsx(ne,{to:"/tasks",children:"Tasks"}),m.data&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sep",children:"/"}),a.jsx(ne,{to:`/tasks#area-${jt(m.data.name)}`,children:m.data.name})]}),N&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sep",children:"/"}),a.jsx(ne,{to:`/tasks/${N.slug||N.id}`,children:N.name})]}),a.jsx("span",{className:"sep",children:"/"}),a.jsx("span",{style:{color:"var(--accent-text)"},children:p.name})]}),a.jsxs("div",{className:"bm-title-row",children:[a.jsx("h1",{className:"bm-title",children:p.name}),w&&a.jsxs("div",{className:"bm-title-trend","aria-label":`${p.name} reporting trend`,children:[a.jsx(wt,{history:w.history,benchmarkName:w.name}),a.jsxs("span",{className:"bm-title-trend-summary",children:[a.jsx("strong",{children:w.recent_paper_count})," ",w.recent_paper_count===1?"paper":"papers",w.rate_change==null?w.recent_paper_count>0&&a.jsx("span",{className:"benchmark-trend-change is-new",children:"new"}):a.jsxs("span",{className:`benchmark-trend-change ${w.rate_change>=1?"is-up":"is-down"}`,children:[w.rate_change>=1?"↑":"↓"," ",w.rate_change.toFixed(1),"×"]})]})]})]}),a.jsx(ht,{kind:"benchmark",entityId:p.id}),a.jsxs("div",{className:"bm-subtitle",children:[ee?a.jsx(ce,{className:"h-5 w-64 bm-summary-skeleton","aria-label":"Loading benchmark summary"}):a.jsxs("span",{children:[O&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"metric-tag",children:O}),a.jsx("span",{style:{color:"var(--hairline-strong)",margin:"0 8px"},children:"·"})]}),q?a.jsxs("span",{children:["Best: ",a.jsx("span",{className:"best-name",children:le(M)})," by ",a.jsx("span",{className:"best-name",style:{fontStyle:"normal"},children:q})]}):a.jsxs("span",{children:[I.rows.length," evaluations"]})]}),p.hf_url&&a.jsxs("a",{className:"bm-action-btn",href:p.hf_url,target:"_blank",rel:"noopener noreferrer",children:[a.jsx("span",{"aria-hidden":"true",children:"🤗"})," View on Hugging Face"]})]}),p.description&&a.jsx("p",{className:"bm-description",children:p.description}),l.hide_closed_source_evals&&Q.length>0&&a.jsxs("div",{className:"bm-hidden-closed-notice",children:[a.jsxs("span",{children:[Q.length," closed-source ",Q.length===1?"row is":"rows are"," hidden",z!=null&&z.model_name?a.jsxs(a.Fragment,{children:[", including ",a.jsx("strong",{children:z.model_name})]}):null,"."]}),a.jsx("button",{type:"button",className:"bm-hidden-closed-action",onClick:()=>{c(!1)},children:"Show closed-source"})]}),it&&a.jsxs("div",{className:"method-source",style:{marginTop:0,marginBottom:18},children:[a.jsx("span",{className:"method-source-label",children:"Source"}),H?a.jsxs(ne,{to:`/paper/${H}`,target:"_blank",rel:"noopener noreferrer",className:"method-source-link",children:[a.jsx("span",{className:"method-source-title",children:J?a.jsx(oe,{title:J}):lt}),G&&a.jsx("span",{className:"method-source-meta",children:G})]}):p.paper_url?a.jsxs("a",{href:vt(p.paper_url)??void 0,target:"_blank",rel:"noopener noreferrer",className:"method-source-link",children:[a.jsx("span",{className:"method-source-title",children:J?a.jsx(oe,{title:J}):p.paper_url}),G&&a.jsx("span",{className:"method-source-meta",children:G})]}):a.jsxs("div",{className:"method-source-link is-static",children:[a.jsx("span",{className:"method-source-title",children:J?a.jsx(oe,{title:J}):null}),G&&a.jsx("span",{className:"method-source-meta",children:G})]})]}),a.jsx(Dr,{model:I,datasetName:p.name,hideClosed:l.hide_closed_source_evals,setHideClosed:c,setMetric:E}),_&&(()=>{var Te,Fe;const b=_.paper_arxiv_id||_.paper_id,T=_.paper_title||(_.paper_arxiv_id?`arXiv:${_.paper_arxiv_id}`:null),F=_.best_metric&&((Te=_.metrics)==null?void 0:Te[_.best_metric])!==void 0?_.best_metric:I.activeMetric,Me=(Fe=_.metrics)==null?void 0:Fe[F];return a.jsxs("div",{className:"bm-highlight-banner",role:"status",children:[a.jsx("span",{className:"bm-highlight-dot","aria-hidden":"true"}),a.jsxs("div",{className:"bm-highlight-text",children:[a.jsx("span",{className:"bm-highlight-label",children:"Comparing result"}),a.jsxs("span",{className:"bm-highlight-paper",children:[_.model_name||T||"—",_.harness?` · ${_.harness}`:""]}),a.jsxs("span",{className:"bm-highlight-meta",children:[Me!==void 0&&F?a.jsxs(a.Fragment,{children:[F,": ",le(Me),T?" · ":""]}):null,b?a.jsx(ne,{to:`/paper/${b}`,children:ze(_.paper_title,T)}):ze(_.paper_title,T)]})]})]})})(),a.jsxs("div",{className:"bm-card",ref:x,children:[a.jsxs("div",{className:"bm-card-screenshot-header","aria-hidden":"true",children:[a.jsxs("div",{className:"bm-card-screenshot-title",children:[a.jsx("span",{className:"bm-card-screenshot-eyebrow",children:"Benchmark"}),a.jsx("span",{className:"bm-card-screenshot-name",children:p.name})]}),a.jsxs("div",{className:"bm-card-screenshot-brand",children:[a.jsxs("span",{className:"brand",children:[a.jsx("span",{className:"brand-mark"}),a.jsxs("span",{className:"brand-name",children:["Papers ",a.jsx("em",{children:"With Code"})]})]}),a.jsx("span",{className:"bm-card-screenshot-url",children:"paperswithcode.co"})]})]}),a.jsxs("div",{className:"bm-card-head",children:[a.jsx("div",{className:"bm-card-title",children:"Leaderboard"}),a.jsxs("div",{className:"bm-card-actions",children:[I.allowedMetrics.length>1&&a.jsxs("label",{className:"bm-view-select",children:[a.jsx("span",{className:"bm-view-select-label",children:"View"}),a.jsx("select",{value:I.activeMetric,onChange:b=>E(b.target.value),children:o.map(b=>a.jsx("option",{value:b,children:b},b))})]}),a.jsxs("label",{className:"bm-closed-toggle",title:"Show or hide evaluations of closed-source models",children:[a.jsx(Ke,{className:"bm-closed-toggle-switch",checked:!l.hide_closed_source_evals,onCheckedChange:b=>{c(!b)},"aria-label":"Show closed-source models"}),a.jsx("span",{className:"bm-closed-toggle-label",children:"Closed-source"})]}),!K&&!X&&k.isSuccess?a.jsx("span",{className:"bm-parameter-unavailable",children:"Parameter metadata unavailable"}):null,a.jsx(nt,{targetRef:x,label:"leaderboard"})]})]}),!K&&X&&a.jsxs("div",{className:"bm-parameter-filter-bar",children:[a.jsx("span",{className:"bm-parameter-filter-label",children:"Parameters Size"}),a.jsx("div",{className:"bm-parameter-filter-options",role:"group","aria-label":"Filter leaderboard by parameter size",children:I.parameterFilters.map(b=>{const{selected:T,disabled:F}=b;return a.jsx("button",{type:"button",className:`bm-parameter-filter-option${T?" is-active":""}`,"aria-pressed":T,disabled:F,onClick:()=>$(b.maxParametersExclusive),children:b.label},b.label)})}),a.jsxs("span",{className:"bm-parameter-coverage",children:["Parameters known for ",Y.parameter_coverage_known," of ",Y.parameter_coverage_total," entries"]})]}),k.isLoading||K?a.jsx("div",{style:{padding:16},children:Array.from({length:5}).map((b,T)=>a.jsx(ce,{className:"h-10 w-full mb-2"},T))}):I.rows.length===0?i?a.jsxs("div",{className:"no-results",children:["No known parameter counts match this filter. "," ",a.jsx("button",{type:"button",className:"bm-empty-filter-action",onClick:()=>$(void 0),children:"Show all"})]}):a.jsx("div",{className:"no-results",children:"No evaluations submitted yet."}):a.jsxs(a.Fragment,{children:[o.length>P&&a.jsxs("div",{className:"bm-metric-columns-control",children:[a.jsx("button",{type:"button",className:"bm-metric-columns-toggle","aria-expanded":C,"aria-controls":"benchmark-leaderboard",onClick:()=>h(C?null:R),children:C?"Show fewer metrics":`Show more metrics (${o.length-P})`}),C&&a.jsx("span",{children:"Scroll metrics horizontally; model and paper details stay visible."})]}),a.jsx(Dt,{model:I,showHarness:y,setMetric:E,highlightRowRef:d,onFittingMetricCountChange:S})]})]})]})})};export{oa as default}; diff --git a/assets/BenchmarkDetailView-BObHaEFx.js b/assets/BenchmarkDetailView-BObHaEFx.js new file mode 100644 index 0000000000000000000000000000000000000000..2ae51375bd351cd1518d6bbcc6b797b2745fccb1 --- /dev/null +++ b/assets/BenchmarkDetailView-BObHaEFx.js @@ -0,0 +1,2 @@ +import{d as L,j as a,K as le,L as ne,e as dt,x as ut,u as mt,g as ht,b as te,o as de,t as ft,T as oe}from"./index-DyXq7-Tg.js";import{R as pt}from"./ResearchFollowButton-Dv316ClR.js";import{c as re}from"./catalog-CRar2olQ.js";import{C as gt,E as xt,e as bt}from"./ExternalSourceEvalBadge-K3r45EmO.js";import{u as yt}from"./preferences-COzeOLyS.js";import{L as ce}from"./LatexTitle-Bkyz3jCs.js";import{S as Ge}from"./switch-nfvTohnt.js";import{I as wt}from"./Icon-T4LYkEQj.js";import{S as ue}from"./skeleton-C3IIzpSL.js";import{A as vt,a as jt}from"./alert-gbJBhAVE.js";import{B as _t}from"./BenchmarkTrendSparkline-DhXxdQ2D.js";import{s as St}from"./safeExternalHref-CkBrsh84.js";import{s as kt}from"./slug-BpH-Nkvz.js";import{i as Ct}from"./apiErrors-BSvbQBb0.js";import Et from"./NotFound-DV_nwcxG.js";import"./researchTopic-DbX0eko-.js";import"./useMutation-UWxBeqtn.js";import"./plus-Yh42pKZz.js";import"./curation-YeS7FBYf.js";import"./hover-card-B45EJIn_.js";import"./account-cbblajck.js";import"./index-C041TDos.js";function ie(e){if(e==null)return null;if(typeof e=="number")return Number.isFinite(e)?e:null;const t=e.includes("±")?e.split("±")[0].trim():e.trim(),r=parseFloat(t);return Number.isFinite(r)?r:null}const Xe=[{label:"All",maxParametersExclusive:void 0},{label:"<10M",maxParametersExclusive:1e7},{label:"<100M",maxParametersExclusive:1e8},{label:"<1B",maxParametersExclusive:1e9},{label:"<3B",maxParametersExclusive:3e9},{label:"<6B",maxParametersExclusive:6e9},{label:"<12B",maxParametersExclusive:12e9},{label:"<32B",maxParametersExclusive:32e9},{label:"<128B",maxParametersExclusive:128e9},{label:"<500B",maxParametersExclusive:5e11}];function Nt(e){const t=e===null?void 0:Number(e);return Xe.some(r=>r.maxParametersExclusive===t)?t:void 0}function Rt(e){return new Intl.NumberFormat("en",{notation:"compact",maximumSignificantDigits:3}).format(e)}function Pt(e){return[e.paper_id,e.task_id,e.dataset_id,e.model_name,e.harness??""].join("|")}function Tt(e){const t=new Map;for(const r of e){const s=Pt(r),n=t.get(s);if(!n){t.set(s,{...r,metrics:{...r.metrics||{}},sourceEvaluationIds:[r.id],ranksByMetric:r.best_metric&&r.best_rank!=null?{[r.best_metric]:r.best_rank}:{},parameterCount:r.num_parameters??null,hasParameterConflict:!1});continue}n.metrics={...n.metrics,...r.metrics||{}},n.sourceEvaluationIds.push(r.id),r.best_metric&&r.best_rank!=null&&(n.ranksByMetric[r.best_metric]=r.best_rank),r.num_parameters!=null&&!n.hasParameterConflict&&(n.parameterCount===null?n.parameterCount=r.num_parameters:n.parameterCount!==r.num_parameters&&(n.parameterCount=null,n.hasParameterConflict=!0))}return Array.from(t.values())}function Ae(e,t){return t===void 0?e:e.filter(r=>r.parameterCount!==null&&r.parameterCounts+n,0);for(const[s,n]of t)if(n>=2&&n*2>r)return s;return null}function Lt(e,t){const r=e.evaluated_on;return r&&r!==t&&r!==Mt(e.updated_at)?r:e.paper_published_date||""}function It(e,t,r){if(e.length===0)return{points:[],sota:0,sotaModel:""};const s=Ft(e),n=e.map(u=>{var R;const h=ie((R=u.metrics)==null?void 0:R[t]);return{eval:u,value:h,date:Lt(u,s)}}).filter(u=>u.value!==null&&!!u.date).sort((u,h)=>u.date.localeCompare(h.date)),i=[];let l=null;for(const u of n){const h=l==null?!0:r==="↓"?u.valuel;h&&(l=u.value),i.push({value:u.value,date:u.date,dateLabel:u.date.slice(0,7),modelName:u.eval.model_name||"",paperTitle:u.eval.paper_title||"",paperRouteId:u.eval.paper_arxiv_id||u.eval.paper_id||null,isSota:h})}const d=e.map(u=>{var h;return{eval:u,value:ie((h=u.metrics)==null?void 0:h[t])}}).filter(u=>u.value!==null).sort((u,h)=>r==="↓"?u.value-h.value:h.value-u.value)[0],f=(d==null?void 0:d.value)??0,x=(d==null?void 0:d.eval.model_name)||(d==null?void 0:d.eval.paper_title)||"";return{points:i,sota:f,sotaModel:x}}function At(e,t,r){const s=t?(e??[]).filter(l=>l.task_id===t):e??[],n=s.filter(l=>l.is_open===!1),i=n.reduce((l,c)=>l?(c.best_rank??Number.POSITIVE_INFINITY)<(l.best_rank??Number.POSITIVE_INFINITY)?c:l:c,null);return{visible:r?s.filter(l=>l.is_open!==!1):s,hiddenClosed:n,topHiddenClosed:i}}function Ye(e,t,r,s){const n=t.find(i=>i.id===s);if(e.length===0)return null;if(n!=null&&n.task_id&&e.some(i=>i.id===n.task_id))return n.task_id;if(r){const i=e.find(l=>l.slug===r);if(i)return i.id}if(e.length===1)return e[0].id;if(t.length>0){const i=new Map;for(const d of t)i.set(d.task_id,(i.get(d.task_id)||0)+1);let l=null,c=-1;for(const d of e){const f=i.get(d.id)||0;f>c&&(c=f,l=d.id)}if(l)return l}return e[0].id}function Bt(e){var _,X,Y;const{evaluations:t,tasks:r,taskSlug:s,highlightEvalId:n,parameterBound:i,showMoreMetrics:l,fittingMetricCount:c=1}=e,d=Ye(r,t,s,n),f=r.find(o=>o.id===d)||r[0]||null,x=t.find(o=>o.id===n),u=At(t,d,e.hideClosed),h=Tt(u.visible),R=Ae(h,i),C=e.configuredMetrics.map(o=>o.metric_name),P=Array.from(new Set(h.flatMap(o=>[...o.best_metric?[o.best_metric]:[],...Object.keys(o.metrics||{})]))),S=C.length?C:P,g=new Map;for(const o of h){const m=o.best_metric;!m||ie(o.metrics[m])===null||C.length&&!S.includes(m)||g.set(m,(g.get(m)||0)+1)}const k=((_=[...g].sort((o,m)=>m[1]-o[1])[0])==null?void 0:_[0])||S[0]||"",j=S.find(o=>{var m;return o.toLocaleLowerCase()===((m=e.metric)==null?void 0:m.trim().toLocaleLowerCase())})||(x==null?void 0:x.best_metric)||k,D=((X=e.directions)==null?void 0:X.directions[j])==="lower_is_better"?"↓":"↑",W=j&&S.includes(j)?[j,...S.filter(o=>o!==j)]:S,w=W.length?l?W:W.slice(0,Math.max(1,c)):j?[j]:[],q=R.slice().sort((o,m)=>{const p=ie(o.metrics[j]),y=ie(m.metrics[j]);return p!==null&&y!==null?D==="↓"?p-y:y-p:p!==null?-1:y!==null?1:Be(o,j)-Be(m,j)});let I=null,N=0;const G=q.map((o,m)=>{const p=ie(o.metrics[j]);return p!==null&&p!==I&&(I=p,N=m+1),{evaluation:o,rank:p===null?null:N,isHighlighted:$t(o,n)}}),{points:z,sota:ee,sotaModel:O}=It(R,j,D),$=i===void 0?e.initialSummary:void 0,U=e.ready.evaluations&&e.ready.tasks&&e.ready.directions&&(!d||e.ready.metrics),K={parameter_coverage_known:h.filter(o=>o.parameterCount!==null).length,parameter_coverage_total:h.length};return{currentTaskId:d,primaryTask:f,activeMetric:j,arrow:D,allowedMetrics:S,orderedMetrics:W,visibleMetrics:w,rows:G,chartPoints:z,highlightedEval:((Y=G.find(o=>o.isHighlighted))==null?void 0:Y.evaluation)||null,hiddenClosedEvals:u.hiddenClosed,hiddenClosedTopEval:u.topHiddenClosed,parameterBound:i,parameterCoverage:K,hasParameterMetadata:K.parameter_coverage_known>0,parameterFilters:Xe.map(o=>({...o,selected:i===o.maxParametersExclusive,disabled:i!==o.maxParametersExclusive&&Ae(h,o.maxParametersExclusive).length===0})),displayedMetric:U?j:$==null?void 0:$.metric,displayedSota:U?ee:$==null?void 0:$.value,displayedSotaModel:U?O:$==null?void 0:$.model_name,isSummaryLoading:!U&&!$,isInitialFilteredViewLoading:i!==void 0&&!U}}function Dt(e,t,r,s=1,n=0){const i=e-t.fixed-(r?t.harness:0);if(t.metric<=0)return 1;const l=Math.floor(i/t.metric);if(lr+pe(t,s),0),harness:pe(t,"--bm-harness-width"),metric:pe(t,"--bm-metric-width")}}const Vt=20;function De(e,t){return e?a.jsx(ce,{title:e}):t||"—"}function Wt({model:e,showHarness:t,setMetric:r,highlightRowRef:s,onFittingMetricCountChange:n}){const{rows:i,visibleMetrics:l,activeMetric:c,arrow:d}=e,[f,x]=L.useState(null);return L.useEffect(()=>{if(!f)return;const u=()=>{f.classList.toggle("has-horizontal-overflow",f.scrollWidth>f.clientWidth);const R=f.firstElementChild;if(!R)return;const C=f.clientWidth,P=Ht(R);f.classList.toggle("unpins-trailing-columns",CS.clientHeight?0:Vt;n(k=>Dt(C,P,t,k,g))},h=new ResizeObserver(u);return h.observe(f),f.firstElementChild&&h.observe(f.firstElementChild),u(),()=>h.disconnect()},[f,t,n]),a.jsx("div",{ref:x,className:"bm-table-scroll",role:"region","aria-label":"Leaderboard metrics",tabIndex:0,children:a.jsxs("table",{id:"benchmark-leaderboard",className:"bm-table",style:{"--bm-metric-count":l.length,"--bm-harness-count":t?1:0},children:[a.jsxs("colgroup",{children:[a.jsx("col",{className:"bm-width-rank"}),a.jsx("col",{className:"bm-width-model"}),a.jsx("col",{className:"bm-width-parameters"}),t&&a.jsx("col",{className:"bm-width-harness"}),l.map(u=>a.jsx("col",{className:"bm-width-metric"},u)),a.jsx("col",{}),a.jsx("col",{className:"bm-width-year"})]}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{className:"col-rank",children:"Rank"}),a.jsx("th",{className:"col-model",children:"Model"}),a.jsxs("th",{className:"col-parameters",children:[a.jsx("span",{className:"bm-label-full",children:"Parameters"}),a.jsx("span",{className:"bm-label-short",children:"Params"})]}),t&&a.jsx("th",{className:"col-harness",children:"Harness"}),l.map(u=>{const h=u===c;return a.jsx("th",{className:`col-value ${h?"is-active":""}`,"aria-sort":h?d==="↓"?"ascending":"descending":"none",children:a.jsxs("button",{type:"button",className:"bm-metric-header",onClick:()=>r(u),"aria-pressed":h,title:`Sort by ${u}`,children:[u,h?` ${d}`:""]})},u)}),a.jsx("th",{className:"col-paper",children:"Paper"}),a.jsx("th",{className:"col-year",children:"Year"})]})}),a.jsx("tbody",{children:i.map(({evaluation:u,rank:h,isHighlighted:R})=>{var S;const C=u.paper_arxiv_id||u.paper_id,P=u.paper_title||(u.paper_arxiv_id?`arXiv:${u.paper_arxiv_id}`:null);return a.jsxs("tr",{ref:R?s:void 0,className:R?"is-highlighted":void 0,children:[a.jsx("td",{className:"col-rank",children:h??"—"}),a.jsxs("td",{className:"col-model",children:[R&&a.jsx("span",{className:"bm-row-marker","aria-hidden":"true"}),u.hf_model_url?a.jsx("a",{href:u.hf_model_url,target:"_blank",rel:"noopener noreferrer",className:"bm-model-link",title:`Open ${u.model_name||"model"} on Hugging Face`,children:u.model_name||"—"}):u.model_name||"—",u.is_open===!1&&a.jsx(gt,{}),(u.external??u.is_external)&&a.jsx(xt,{sourceUrl:u.source_url||u.external_source_url||u.result_url})]}),a.jsx("td",{className:"col-parameters",title:u.parameterCount===null?void 0:u.parameterCount.toLocaleString("en-US"),"aria-label":u.parameterCount===null?"Parameters unknown":`${u.parameterCount.toLocaleString("en-US")} parameters`,children:u.parameterCount===null?"—":Rt(u.parameterCount)}),t&&a.jsx("td",{className:"col-harness",children:u.harness||"—"}),l.map(g=>{var j;const k=g===c,B=(j=u.metrics)==null?void 0:j[g];return a.jsx("td",{className:`col-value${k?" is-active":""}${k&&h===1?" is-best":""}`,children:B!=null&&B!==""?le(B):"—"},g)}),a.jsx("td",{className:"col-paper",children:C?a.jsx(ne,{to:`/paper/${C}`,title:u.paper_title||P||void 0,children:De(u.paper_title,P)}):De(u.paper_title,P)}),a.jsx("td",{className:"col-year",children:((S=u.evaluated_on||u.paper_published_date)==null?void 0:S.slice(0,4))||"—"})]},u.id)})})]})})}function He(e){const t=e.length===7?`${e}-01`:e,r=new Date(t).getTime();return Number.isFinite(r)?r:0}const ge=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function xe(e){const t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()}}function Ot(e,t){if(e===t){const{year:d,month:f}=xe(e);return[{timestamp:new Date(d,f,1).getTime(),key:`${d}-${f}`,label:`${ge[f]} ${d}`}]}const r=xe(e),s=xe(t);if(r.year===s.year){const d=s.month-r.month+1;let f=1;const x=12;d>x&&(f=Math.ceil(d/x));const u=[];for(let h=r.month;h<=s.month;h+=f)u.push({timestamp:new Date(r.year,h,1).getTime(),key:`${r.year}-${h}`,label:d<=3?`${ge[h]} ${r.year}`:ge[h]});return u}const n=s.year-r.year+1;let i=1;const l=12;n>l&&(i=Math.ceil(n/l));const c=[];for(let d=r.year;d<=s.year;d+=i)c.push({timestamp:new Date(d,0,1).getTime(),key:String(d),label:String(d)});return c}const Ut=({points:e,metric:t})=>{const r=dt(),[s,n]=L.useState(null),i=880,l=320,c=60,d=30,f=40,x=50,u=e.map(o=>o.value),h=Math.min(...u),C=Math.max(...u)-h||1,P=i-c-d,S=l-f-x,g=e.map(o=>He(o.date)),k=Math.min(...g),B=Math.max(...g),j=B-k||1,D=o=>k===B?c+P/2:c+(o-k)/j*P,W=e.map((o,m)=>{const p=D(He(o.date)),y=(o.value-h)/C,T=f+S*(1-y);return{x:p,y:T,data:o,idx:m}}),w=W.filter(o=>o.data.isSota);let q="";if(w.length>=2){q=`M${w[0].x},${w[0].y}`;for(let o=1;o{const m=o.data.modelName||o.data.paperTitle||"";if(!m)return null;const p=m.length>22?m.slice(0,21)+"…":m,y=p.length*I;let T=o.x-y/2,E=o.x+y/2,v="middle";return Ti-d&&(E=i-d,T=E-y,v="end"),{x:v==="start"?c:v==="end"?i-d:o.x,y:o.y-G,text:p,anchor:v,left:T,right:E}},ee=[],O=w.length>0?z(w[w.length-1]):null;let $=-1/0;for(let o=0;oO.left-N||($=m.right,ee.push({x:m.x,y:m.y,text:m.text,anchor:m.anchor})))}O&&ee.push({x:O.x,y:O.y,text:O.text,anchor:O.anchor});const U=Ot(k,B),K=5,_=o=>n(m=>m===o?null:m),X=o=>{o&&r(`/paper/${o}`)},Y=(o,m)=>{const y=`${o.data.modelName||o.data.paperTitle||"Unknown model"}: ${le(o.data.value)} on ${o.data.dateLabel}`,T=!!o.data.paperRouteId;return a.jsxs("g",{children:[m,a.jsx("circle",{cx:o.x,cy:o.y,r:"10",fill:"transparent",style:{cursor:T?"pointer":"default",outline:"none"},tabIndex:0,role:T?"link":"img","aria-label":y,onMouseEnter:()=>n(o.idx),onMouseLeave:()=>_(o.idx),onFocus:()=>n(o.idx),onBlur:()=>_(o.idx),onClick:()=>X(o.data.paperRouteId),onKeyDown:E=>{T&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),X(o.data.paperRouteId))},children:a.jsx("title",{children:y})})]},o.idx)};return a.jsxs("svg",{width:"100%",viewBox:`0 0 ${i} ${l}`,style:{display:"block"},children:[a.jsx("text",{x:c-38,y:f+S/2,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"middle",transform:`rotate(-90 ${c-38} ${f+S/2})`,children:t}),Array.from({length:K}).map((o,m)=>{const p=m/(K-1),y=f+S*(1-p),T=h+C*p;return a.jsxs("g",{children:[a.jsx("line",{x1:c,y1:y,x2:i-d,y2:y,stroke:"var(--hairline)",strokeWidth:"1"}),a.jsx("text",{x:c-10,y:y+4,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-faint)",textAnchor:"end",children:le(T)})]},m)}),U.map(o=>{const m=D(o.timestamp);return a.jsx("text",{x:m,y:l-x+18,fontSize:"11",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:"middle",children:o.label},o.key)}),W.filter(o=>!o.data.isSota).map(o=>{const m=s===o.idx;return Y(o,a.jsx("circle",{cx:o.x,cy:o.y,r:m?3:2,fill:"var(--ink-faint)",opacity:m?1:.45,style:{transition:"r 0.12s ease, opacity 0.12s ease"}}))}),q&&a.jsx("path",{d:q,stroke:"var(--accent)",strokeWidth:"2",fill:"none",strokeLinejoin:"round",strokeLinecap:"round"}),w.map(o=>{const m=s===o.idx;return Y(o,a.jsx("circle",{cx:o.x,cy:o.y,r:m?4.5:3,fill:m?"var(--accent)":"var(--bg-elevated)",stroke:"var(--accent)",strokeWidth:"1.5",style:{transition:"r 0.12s ease, fill 0.12s ease"}}))}),ee.map((o,m)=>a.jsx("text",{x:o.x,y:o.y,fontSize:"9.5",fontFamily:"var(--mono)",fill:"var(--ink-soft)",textAnchor:o.anchor,pointerEvents:"none",style:{paintOrder:"stroke",stroke:"var(--bg-elevated)",strokeWidth:3,strokeLinejoin:"round"},children:o.text},`label-${m}`)),s!==null&&W[s]&&(()=>{const o=W[s],m=o.data.modelName||o.data.paperTitle||"Unknown model",y=`${m.length>40?m.slice(0,39)+"…":m}: ${le(o.data.value)}`,E=Math.max(120,Math.min(340,y.length*6.6+24)),v=30;let H=o.x-E/2;Hi-d&&(H=i-d-E);const Q=o.y-v-14>=f?o.y-v-12:o.y+12;return a.jsxs("g",{pointerEvents:"none",children:[a.jsx("rect",{x:H,y:Q,width:E,height:v,rx:"6",ry:"6",fill:"var(--bg-elevated)",stroke:"var(--hairline-strong)",strokeWidth:"1",style:{filter:"drop-shadow(0 2px 6px rgba(0,0,0,0.08))"}}),a.jsx("text",{x:H+12,y:Q+19,fontSize:"12",fontFamily:"var(--sans)",fill:"var(--ink)",fontWeight:500,children:y})]})})()]})};function qt(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),s=r.createElement("base"),n=r.createElement("a");return r.head.appendChild(s),r.body.appendChild(n),t&&(s.href=t),n.href=e,n.href}const zt=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function Z(e){const t=[];for(let r=0,s=e.length;rV||e.height>V)&&(e.width>V&&e.height>V?e.width>e.height?(e.height*=V/e.width,e.width=V):(e.width*=V/e.height,e.height=V):e.width>V?(e.height*=V/e.width,e.width=V):(e.width*=V/e.height,e.height=V))}function Yt(e,t={}){return e.toBlob?new Promise(r=>{e.toBlob(r,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(r=>{const s=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),n=s.length,i=new Uint8Array(n);for(let l=0;l{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=r,s.crossOrigin="anonymous",s.decoding="async",s.src=e})}async function Jt(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Zt(e,t,r){const s="http://www.w3.org/2000/svg",n=document.createElementNS(s,"svg"),i=document.createElementNS(s,"foreignObject");return n.setAttribute("width",`${t}`),n.setAttribute("height",`${r}`),n.setAttribute("viewBox",`0 0 ${t} ${r}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),n.appendChild(i),i.appendChild(e),Jt(n)}const A=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||A(r,t)};function er(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function tr(e,t){return Je(t).map(r=>{const s=e.getPropertyValue(r),n=e.getPropertyPriority(r);return`${r}: ${s}${n?" !important":""};`}).join(" ")}function rr(e,t,r,s){const n=`.${e}:${t}`,i=r.cssText?er(r):tr(r,s);return document.createTextNode(`${n}{${i}}`)}function Ve(e,t,r,s){const n=window.getComputedStyle(e,r),i=n.getPropertyValue("content");if(i===""||i==="none")return;const l=zt();try{t.className=`${t.className} ${l}`}catch{return}const c=document.createElement("style");c.appendChild(rr(l,r,n,s)),t.appendChild(c)}function ar(e,t,r){Ve(e,t,":before",r),Ve(e,t,":after",r)}const We="application/font-woff",Oe="image/jpeg",sr={woff:We,woff2:We,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Oe,jpeg:Oe,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function nr(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function ve(e){const t=nr(e).toLowerCase();return sr[t]||""}function ir(e){return e.split(/,/)[1]}function ye(e){return e.search(/^(data:)/)!==-1}function lr(e,t){return`data:${t};base64,${e}`}async function et(e,t,r){const s=await fetch(e,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const n=await s.blob();return new Promise((i,l)=>{const c=new FileReader;c.onerror=l,c.onloadend=()=>{try{i(r({res:s,result:c.result}))}catch(d){l(d)}},c.readAsDataURL(n)})}const be={};function or(e,t,r){let s=e.replace(/\?.*/,"");return r&&(s=e),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function je(e,t,r){const s=or(e,t,r.includeQueryParams);if(be[s]!=null)return be[s];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let n;try{const i=await et(e,r.fetchRequestInit,({res:l,result:c})=>(t||(t=l.headers.get("Content-Type")||""),ir(c)));n=lr(i,t)}catch(i){n=r.imagePlaceholder||"";let l=`Failed to fetch resource: ${e}`;i&&(l=typeof i=="string"?i:i.message),l&&console.warn(l)}return be[s]=n,n}async function cr(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):he(t)}async function dr(e,t){if(e.currentSrc){const i=document.createElement("canvas"),l=i.getContext("2d");i.width=e.clientWidth,i.height=e.clientHeight,l==null||l.drawImage(e,0,0,i.width,i.height);const c=i.toDataURL();return he(c)}const r=e.poster,s=ve(r),n=await je(r,s,t);return he(n)}async function ur(e,t){var r;try{if(!((r=e==null?void 0:e.contentDocument)===null||r===void 0)&&r.body)return await fe(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function mr(e,t){return A(e,HTMLCanvasElement)?cr(e):A(e,HTMLVideoElement)?dr(e,t):A(e,HTMLIFrameElement)?ur(e,t):e.cloneNode(tt(e))}const hr=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",tt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function fr(e,t,r){var s,n;if(tt(t))return t;let i=[];return hr(e)&&e.assignedNodes?i=Z(e.assignedNodes()):A(e,HTMLIFrameElement)&&(!((s=e.contentDocument)===null||s===void 0)&&s.body)?i=Z(e.contentDocument.body.childNodes):i=Z(((n=e.shadowRoot)!==null&&n!==void 0?n:e).childNodes),i.length===0||A(e,HTMLVideoElement)||await i.reduce((l,c)=>l.then(()=>fe(c,r)).then(d=>{d&&t.appendChild(d)}),Promise.resolve()),t}function pr(e,t,r){const s=t.style;if(!s)return;const n=window.getComputedStyle(e);n.cssText?(s.cssText=n.cssText,s.transformOrigin=n.transformOrigin):Je(r).forEach(i=>{let l=n.getPropertyValue(i);i==="font-size"&&l.endsWith("px")&&(l=`${Math.floor(parseFloat(l.substring(0,l.length-2)))-.1}px`),A(e,HTMLIFrameElement)&&i==="display"&&l==="inline"&&(l="block"),i==="d"&&t.getAttribute("d")&&(l=`path(${t.getAttribute("d")})`),s.setProperty(i,l,n.getPropertyPriority(i))})}function gr(e,t){A(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),A(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function xr(e,t){if(A(e,HTMLSelectElement)){const r=t,s=Array.from(r.children).find(n=>e.value===n.getAttribute("value"));s&&s.setAttribute("selected","")}}function br(e,t,r){return A(t,Element)&&(pr(e,t,r),ar(e,t,r),gr(e,t),xr(e,t)),t}async function yr(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const s={};for(let i=0;imr(s,t)).then(s=>fr(e,s,t)).then(s=>br(e,s,t)).then(s=>yr(s,t))}const rt=/url\((['"]?)([^'"]+?)\1\)/g,wr=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,vr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function jr(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function _r(e){const t=[];return e.replace(rt,(r,s,n)=>(t.push(n),r)),t.filter(r=>!ye(r))}async function Sr(e,t,r,s,n){try{const i=r?qt(t,r):t,l=ve(t);let c;return n||(c=await je(i,l,s)),e.replace(jr(t),`$1${c}$3`)}catch{}return e}function kr(e,{preferredFontFormat:t}){return t?e.replace(vr,r=>{for(;;){const[s,,n]=wr.exec(r)||[];if(!n)return"";if(n===t)return`src: ${s};`}}):e}function at(e){return e.search(rt)!==-1}async function st(e,t,r){if(!at(e))return e;const s=kr(e,r);return _r(s).reduce((i,l)=>i.then(c=>Sr(c,l,t,r)),Promise.resolve(s))}async function se(e,t,r){var s;const n=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(n){const i=await st(n,null,r);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function Cr(e,t){await se("background",e,t)||await se("background-image",e,t),await se("mask",e,t)||await se("-webkit-mask",e,t)||await se("mask-image",e,t)||await se("-webkit-mask-image",e,t)}async function Er(e,t){const r=A(e,HTMLImageElement);if(!(r&&!ye(e.src))&&!(A(e,SVGImageElement)&&!ye(e.href.baseVal)))return;const s=r?e.src:e.href.baseVal,n=await je(s,ve(s),t);await new Promise((i,l)=>{e.onload=i,e.onerror=t.onImageErrorHandler?(...d)=>{try{i(t.onImageErrorHandler(...d))}catch(f){l(f)}}:l;const c=e;c.decode&&(c.decode=i),c.loading==="lazy"&&(c.loading="eager"),r?(e.srcset="",e.src=n):e.href.baseVal=n})}async function Nr(e,t){const s=Z(e.childNodes).map(n=>nt(n,t));await Promise.all(s).then(()=>e)}async function nt(e,t){A(e,Element)&&(await Cr(e,t),await Er(e,t),await Nr(e,t))}function Rr(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const s=t.style;return s!=null&&Object.keys(s).forEach(n=>{r[n]=s[n]}),e}const Ue={};async function qe(e){let t=Ue[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},Ue[e]=t,t}async function ze(e,t){let r=e.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,i=(r.match(/url\([^)]+\)/g)||[]).map(async l=>{let c=l.replace(s,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),et(c,t.fetchRequestInit,({result:d})=>(r=r.replace(l,`url(${d})`),[l,d]))});return Promise.all(i).then(()=>r)}function Ke(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let s=e.replace(r,"");const n=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const d=n.exec(s);if(d===null)break;t.push(d[0])}s=s.replace(n,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,l="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(l,"gi");for(;;){let d=i.exec(s);if(d===null){if(d=c.exec(s),d===null)break;i.lastIndex=c.lastIndex}else c.lastIndex=i.lastIndex;t.push(d[0])}return t}async function Pr(e,t){const r=[],s=[];return e.forEach(n=>{if("cssRules"in n)try{Z(n.cssRules||[]).forEach((i,l)=>{if(i.type===CSSRule.IMPORT_RULE){let c=l+1;const d=i.href,f=qe(d).then(x=>ze(x,t)).then(x=>Ke(x).forEach(u=>{try{n.insertRule(u,u.startsWith("@import")?c+=1:n.cssRules.length)}catch(h){console.error("Error inserting rule from remote css",{rule:u,error:h})}})).catch(x=>{console.error("Error loading remote css",x.toString())});s.push(f)}})}catch(i){const l=e.find(c=>c.href==null)||document.styleSheets[0];n.href!=null&&s.push(qe(n.href).then(c=>ze(c,t)).then(c=>Ke(c).forEach(d=>{l.insertRule(d,l.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",i)}}),Promise.all(s).then(()=>(e.forEach(n=>{if("cssRules"in n)try{Z(n.cssRules||[]).forEach(i=>{r.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${n.href}`,i)}}),r))}function Tr(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>at(t.style.getPropertyValue("src")))}async function $r(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=Z(e.ownerDocument.styleSheets),s=await Pr(r,t);return Tr(s)}function it(e){return e.trim().replace(/["']/g,"")}function Mr(e){const t=new Set;function r(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(i=>{t.add(it(i))}),Array.from(s.children).forEach(i=>{i instanceof HTMLElement&&r(i)})}return r(e),t}async function Fr(e,t){const r=await $r(e,t),s=Mr(e);return(await Promise.all(r.filter(i=>s.has(it(i.style.fontFamily))).map(i=>{const l=i.parentStyleSheet?i.parentStyleSheet.href:null;return st(i.cssText,l,t)}))).join(` +`)}async function Lr(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Fr(e,t);if(r){const s=document.createElement("style"),n=document.createTextNode(r);s.appendChild(n),e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}}async function Ir(e,t={}){const{width:r,height:s}=Ze(e,t),n=await fe(e,t,!0);return await Lr(n,t),await nt(n,t),Rr(n,t),await Zt(n,r,s)}async function Ar(e,t={}){const{width:r,height:s}=Ze(e,t),n=await Ir(e,t),i=await he(n),l=document.createElement("canvas"),c=l.getContext("2d"),d=t.pixelRatio||Gt(),f=t.canvasWidth||r,x=t.canvasHeight||s;return l.width=f*d,l.height=x*d,t.skipAutoScale||Xt(l),l.style.width=`${f}`,l.style.height=`${x}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,l.width,l.height)),c.drawImage(i,0,0,l.width,l.height),l}async function Br(e,t={}){const r=await Ar(e,t);return await Yt(r)}const we="#ffffff";function Dr(){return typeof window>"u"?we:window.getComputedStyle(document.documentElement).getPropertyValue("--bg-elevated").trim()||we}function Hr(e){if(typeof window>"u")return we;const t=window.getComputedStyle(e).backgroundColor;return!t||t==="rgba(0, 0, 0, 0)"||t==="transparent"?Dr():t}async function Vr(e){var r,s;if(typeof window>"u"||!((s=(r=window.navigator)==null?void 0:r.clipboard)!=null&&s.write))throw new Error("Clipboard image copy is not supported in this browser.");if(typeof window.ClipboardItem>"u")throw new Error("Clipboard image copy is not supported in this browser.");const t=await Br(e,{pixelRatio:2,cacheBust:!0,backgroundColor:Hr(e)});if(!t)throw new Error("Failed to render screenshot.");await window.navigator.clipboard.write([new window.ClipboardItem({"image/png":t})])}const lt=({targetRef:e,label:t})=>{const{toast:r}=ut(),[s,n]=L.useState("idle"),i=L.useRef(null);L.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const l=L.useCallback(async()=>{const d=e.current;if(d){n("copying"),d.classList.add("is-capturing"),d.offsetHeight,await new Promise(f=>window.requestAnimationFrame(()=>f()));try{await Vr(d),n("copied"),r({title:"Screenshot copied",description:`Image of the ${t} copied to your clipboard.`}),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>n("idle"),1500)}catch(f){n("idle"),r({title:"Copy failed",description:f instanceof Error&&f.message?f.message:"Could not copy the screenshot to your clipboard.",variant:"destructive"})}finally{d.classList.remove("is-capturing")}}},[e,t,r]),c=s==="copied"?"Copied":s==="copying"?"Copying…":"Copy image";return a.jsxs("button",{type:"button",className:"bm-copy-btn",onClick:l,disabled:s==="copying","aria-label":`Copy ${t} screenshot to clipboard`,title:`Copy ${t} screenshot to clipboard`,children:[a.jsx(wt,{name:"copy",size:11}),c]})};function Wr({model:e,datasetName:t,hideClosed:r,setHideClosed:s,setMetric:n}){const i=L.useRef(null),{isInitialFilteredViewLoading:l,chartPoints:c,activeMetric:d,allowedMetrics:f,orderedMetrics:x,parameterBound:u}=e;return l||c.length===0?null:a.jsxs("div",{className:"bm-card",ref:i,children:[a.jsxs("div",{className:"bm-card-screenshot-header","aria-hidden":"true",children:[a.jsxs("div",{className:"bm-card-screenshot-title",children:[a.jsx("span",{className:"bm-card-screenshot-eyebrow",children:"Benchmark"}),a.jsx("span",{className:"bm-card-screenshot-name",children:t})]}),a.jsxs("div",{className:"bm-card-screenshot-brand",children:[a.jsxs("span",{className:"brand",children:[a.jsx("span",{className:"brand-mark"}),a.jsxs("span",{className:"brand-name",children:["Papers ",a.jsx("em",{children:"With Code"})]})]}),a.jsx("span",{className:"bm-card-screenshot-url",children:"paperswithcode.co"})]})]}),a.jsxs("div",{className:"bm-card-head",children:[a.jsx("div",{className:"bm-card-title",children:"SOTA progression"}),a.jsxs("div",{className:"bm-card-actions",children:[f.length>1&&a.jsxs("label",{className:"bm-view-select",children:[a.jsx("span",{className:"bm-view-select-label",children:"View"}),a.jsx("select",{value:d,onChange:h=>n(h.target.value),children:x.map(h=>a.jsx("option",{value:h,children:h},h))})]}),a.jsxs("label",{className:"bm-closed-toggle",title:"Show or hide evaluations of closed-source models",children:[a.jsx(Ge,{className:"bm-closed-toggle-switch",checked:!r,onCheckedChange:h=>{s(!h)},"aria-label":"Show closed-source models"}),a.jsx("span",{className:"bm-closed-toggle-label",children:"Closed-source"})]}),a.jsx(lt,{targetRef:i,label:"SOTA chart"})]})]}),a.jsx("div",{className:"bm-chart-wrap",children:a.jsx(Ut,{points:c,metric:d})}),a.jsxs("div",{className:"bm-chart-foot",children:[a.jsx("span",{className:"legend-dot"}),u===void 0?"All models":"Filtered models"," over time · highlighted dots track the running best · hover for the model · click to open the paper"]})]})}function Or(e){if(!e)return null;const t=e.trim(),r=t.match(/^https?:\/\/(?:www\.)?arxiv\.org\/(?:abs|pdf)\/([^/?#]+)/i);if(r!=null&&r[1])return r[1].replace(/\.pdf$/i,"");const s=t.match(/^(?:https?:\/\/(?:www\.)?paperswithcode\.co)?\/paper\/([^/?#]+)/i);return(s==null?void 0:s[1])??null}function Qe(e,t){return e?a.jsx(ce,{title:e}):t||"—"}const ma=()=>{var _e,Se,ke,Ce,Ee,Ne,Re,Pe,Te,$e,Me;const{datasetSlug:e}=mt(),[t,r]=ht(),s=t.get("task")||void 0,n=t.get("eval")||void 0,i=Nt(t.get("max_parameters_exclusive")),{preferences:l,setHideClosedSourceEvals:c}=yt(),d=L.useRef(null),f=L.useRef(!1),x=L.useRef(null),[u,h]=L.useState(null),R=`${e}:${s||""}`,C=u===R,[P,S]=L.useState(1),g=te({queryKey:[...de.dataset(e),"with-paper",s,l.hide_closed_source_evals?"open":"all"],queryFn:()=>re.getDatasetBySlug(e,{include_paper:!0,task:s,is_open:l.hide_closed_source_evals?!0:void 0}),enabled:!!e,staleTime:oe}),k=te({queryKey:ft.byDataset((_e=g.data)==null?void 0:_e.id),queryFn:()=>bt.byDataset(g.data.id),enabled:!!((Se=g.data)!=null&&Se.id),staleTime:5*60*1e3}),B=te({queryKey:[...de.datasetTasks,(ke=g.data)==null?void 0:ke.id],queryFn:()=>re.datasetTasks(g.data.id),enabled:!!((Ce=g.data)!=null&&Ce.id),staleTime:oe}),j=te({queryKey:["metric-directions"],queryFn:()=>re.metricDirections(),staleTime:60*60*1e3}),D=Ye(B.data||[],k.data||[],s,n),W=te({queryKey:[...de.taskBenchmarkTrends,D,l.hide_closed_source_evals?!0:void 0],queryFn:()=>re.trendingBenchmarks(D,{limit:100,min_recent_papers:0,is_open:l.hide_closed_source_evals?!0:void 0}),enabled:!!D&&!!((Ee=g.data)!=null&&Ee.id),staleTime:oe}),w=L.useMemo(()=>{var b;return(((b=W.data)==null?void 0:b.results)||[]).find(M=>{var F;return M.id===((F=g.data)==null?void 0:F.id)})||null},[W.data,(Ne=g.data)==null?void 0:Ne.id]),q=te({queryKey:["leaderboard-metrics",(Re=g.data)==null?void 0:Re.id,D],queryFn:()=>re.leaderboardMetrics(g.data.id,D),enabled:!!((Pe=g.data)!=null&&Pe.id)&&!!D,staleTime:oe}),I=Bt({evaluations:k.data||[],tasks:B.data||[],configuredMetrics:q.data||[],directions:j.data,initialSummary:(Te=g.data)==null?void 0:Te.leaderboard_summary,taskSlug:s,highlightEvalId:n,metric:t.get("metric")||void 0,hideClosed:l.hide_closed_source_evals,parameterBound:i,showMoreMetrics:C,fittingMetricCount:P,ready:{evaluations:k.isSuccess,tasks:B.isSuccess,directions:j.isSuccess,metrics:q.isSuccess}}),{primaryTask:N,hiddenClosedEvals:G,hiddenClosedTopEval:z,isSummaryLoading:ee,displayedMetric:O,displayedSota:$,displayedSotaModel:U,isInitialFilteredViewLoading:K,highlightedEval:_,hasParameterMetadata:X,parameterCoverage:Y,orderedMetrics:o}=I;L.useEffect(()=>{if(f.current||!n||!k.data||k.data.length===0)return;const b=d.current;b&&(f.current=!0,b.scrollIntoView({behavior:"smooth",block:"start"}))},[n,k.data]);const m=te({queryKey:de.area(N==null?void 0:N.area_id),queryFn:()=>re.getArea(N.area_id),enabled:!!(N!=null&&N.area_id),staleTime:oe});if(g.isLoading)return a.jsxs("div",{className:"page",children:[a.jsx(ue,{className:"h-12 w-1/2 mb-6"}),a.jsx(ue,{className:"h-64 w-full"})]});if(Ct(g.error))return a.jsx(Et,{});if(g.error||!g.data)return a.jsx("div",{className:"page",children:a.jsx(vt,{variant:"destructive",children:a.jsx(jt,{children:"Benchmark not found."})})});const p=g.data,y=!!p.supports_harness,T=b=>{r(M=>{const F=new URLSearchParams(M);return b===void 0?F.delete("max_parameters_exclusive"):F.set("max_parameters_exclusive",String(b)),F})},E=b=>{r(M=>{const F=new URLSearchParams(M);return F.set("metric",b),F})},v=p.introducing_paper??void 0,H=(v==null?void 0:v.arxiv_id)||(v==null?void 0:v.id)||Or(p.paper_url),J=(v==null?void 0:v.title)||p.introducing_paper_title||null,Q=(($e=v==null?void 0:v.published)==null?void 0:$e.slice(0,4))||p.introduced_year||null,ot=!!H||!!p.paper_url||!!J,ct=v!=null&&v.arxiv_id||(Me=p.paper_url)!=null&&Me.match(/^https?:\/\/(?:www\.)?arxiv\.org\//i)?`arXiv:${H}`:`Paper ${H}`;return a.jsx("div",{className:"page",children:a.jsxs("div",{className:"bm-page",children:[a.jsxs("div",{className:"breadcrumb",children:[a.jsx(ne,{to:"/tasks",children:"Tasks"}),m.data&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sep",children:"/"}),a.jsx(ne,{to:`/tasks#area-${kt(m.data.name)}`,children:m.data.name})]}),N&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"sep",children:"/"}),a.jsx(ne,{to:`/tasks/${N.slug||N.id}`,children:N.name})]}),a.jsx("span",{className:"sep",children:"/"}),a.jsx("span",{style:{color:"var(--accent-text)"},children:p.name})]}),a.jsxs("div",{className:"bm-title-row",children:[a.jsx("h1",{className:"bm-title",children:p.name}),w&&a.jsxs("div",{className:"bm-title-trend","aria-label":`${p.name} reporting trend`,children:[a.jsx(_t,{history:w.history,benchmarkName:w.name}),a.jsxs("span",{className:"bm-title-trend-summary",children:[a.jsx("strong",{children:w.recent_paper_count})," ",w.recent_paper_count===1?"paper":"papers",w.rate_change==null?w.recent_paper_count>0&&a.jsx("span",{className:"benchmark-trend-change is-new",children:"new"}):a.jsxs("span",{className:`benchmark-trend-change ${w.rate_change>=1?"is-up":"is-down"}`,children:[w.rate_change>=1?"↑":"↓"," ",w.rate_change.toFixed(1),"×"]})]})]})]}),a.jsx(pt,{kind:"benchmark",entityId:p.id}),a.jsxs("div",{className:"bm-subtitle",children:[ee?a.jsx(ue,{className:"h-5 w-64 bm-summary-skeleton","aria-label":"Loading benchmark summary"}):a.jsxs("span",{children:[O&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"metric-tag",children:O}),a.jsx("span",{style:{color:"var(--hairline-strong)",margin:"0 8px"},children:"·"})]}),U?a.jsxs("span",{children:["Best: ",a.jsx("span",{className:"best-name",children:le($)})," by ",a.jsx("span",{className:"best-name",style:{fontStyle:"normal"},children:U})]}):a.jsxs("span",{children:[I.rows.length," evaluations"]})]}),p.hf_url&&a.jsxs("a",{className:"bm-action-btn",href:p.hf_url,target:"_blank",rel:"noopener noreferrer",children:[a.jsx("span",{"aria-hidden":"true",children:"🤗"})," View on Hugging Face"]})]}),p.description&&a.jsx("p",{className:"bm-description",children:p.description}),l.hide_closed_source_evals&&G.length>0&&a.jsxs("div",{className:"bm-hidden-closed-notice",children:[a.jsxs("span",{children:[G.length," closed-source ",G.length===1?"row is":"rows are"," hidden",z!=null&&z.model_name?a.jsxs(a.Fragment,{children:[", including ",a.jsx("strong",{children:z.model_name})]}):null,"."]}),a.jsx("button",{type:"button",className:"bm-hidden-closed-action",onClick:()=>{c(!1)},children:"Show closed-source"})]}),ot&&a.jsxs("div",{className:"method-source",style:{marginTop:0,marginBottom:18},children:[a.jsx("span",{className:"method-source-label",children:"Source"}),H?a.jsxs(ne,{to:`/paper/${H}`,target:"_blank",rel:"noopener noreferrer",className:"method-source-link",children:[a.jsx("span",{className:"method-source-title",children:J?a.jsx(ce,{title:J}):ct}),Q&&a.jsx("span",{className:"method-source-meta",children:Q})]}):p.paper_url?a.jsxs("a",{href:St(p.paper_url)??void 0,target:"_blank",rel:"noopener noreferrer",className:"method-source-link",children:[a.jsx("span",{className:"method-source-title",children:J?a.jsx(ce,{title:J}):p.paper_url}),Q&&a.jsx("span",{className:"method-source-meta",children:Q})]}):a.jsxs("div",{className:"method-source-link is-static",children:[a.jsx("span",{className:"method-source-title",children:J?a.jsx(ce,{title:J}):null}),Q&&a.jsx("span",{className:"method-source-meta",children:Q})]})]}),a.jsx(Wr,{model:I,datasetName:p.name,hideClosed:l.hide_closed_source_evals,setHideClosed:c,setMetric:E}),_&&(()=>{var Le,Ie;const b=_.paper_arxiv_id||_.paper_id,M=_.paper_title||(_.paper_arxiv_id?`arXiv:${_.paper_arxiv_id}`:null),F=_.best_metric&&((Le=_.metrics)==null?void 0:Le[_.best_metric])!==void 0?_.best_metric:I.activeMetric,Fe=(Ie=_.metrics)==null?void 0:Ie[F];return a.jsxs("div",{className:"bm-highlight-banner",role:"status",children:[a.jsx("span",{className:"bm-highlight-dot","aria-hidden":"true"}),a.jsxs("div",{className:"bm-highlight-text",children:[a.jsx("span",{className:"bm-highlight-label",children:"Comparing result"}),a.jsxs("span",{className:"bm-highlight-paper",children:[_.model_name||M||"—",_.harness?` · ${_.harness}`:""]}),a.jsxs("span",{className:"bm-highlight-meta",children:[Fe!==void 0&&F?a.jsxs(a.Fragment,{children:[F,": ",le(Fe),M?" · ":""]}):null,b?a.jsx(ne,{to:`/paper/${b}`,children:Qe(_.paper_title,M)}):Qe(_.paper_title,M)]})]})]})})(),a.jsxs("div",{className:"bm-card",ref:x,children:[a.jsxs("div",{className:"bm-card-screenshot-header","aria-hidden":"true",children:[a.jsxs("div",{className:"bm-card-screenshot-title",children:[a.jsx("span",{className:"bm-card-screenshot-eyebrow",children:"Benchmark"}),a.jsx("span",{className:"bm-card-screenshot-name",children:p.name})]}),a.jsxs("div",{className:"bm-card-screenshot-brand",children:[a.jsxs("span",{className:"brand",children:[a.jsx("span",{className:"brand-mark"}),a.jsxs("span",{className:"brand-name",children:["Papers ",a.jsx("em",{children:"With Code"})]})]}),a.jsx("span",{className:"bm-card-screenshot-url",children:"paperswithcode.co"})]})]}),a.jsxs("div",{className:"bm-card-head",children:[a.jsx("div",{className:"bm-card-title",children:"Leaderboard"}),a.jsxs("div",{className:"bm-card-actions",children:[I.allowedMetrics.length>1&&a.jsxs("label",{className:"bm-view-select",children:[a.jsx("span",{className:"bm-view-select-label",children:"View"}),a.jsx("select",{value:I.activeMetric,onChange:b=>E(b.target.value),children:o.map(b=>a.jsx("option",{value:b,children:b},b))})]}),a.jsxs("label",{className:"bm-closed-toggle",title:"Show or hide evaluations of closed-source models",children:[a.jsx(Ge,{className:"bm-closed-toggle-switch",checked:!l.hide_closed_source_evals,onCheckedChange:b=>{c(!b)},"aria-label":"Show closed-source models"}),a.jsx("span",{className:"bm-closed-toggle-label",children:"Closed-source"})]}),!K&&!X&&k.isSuccess?a.jsx("span",{className:"bm-parameter-unavailable",children:"Parameter metadata unavailable"}):null,a.jsx(lt,{targetRef:x,label:"leaderboard"})]})]}),!K&&X&&a.jsxs("div",{className:"bm-parameter-filter-bar",children:[a.jsx("span",{className:"bm-parameter-filter-label",children:"Parameters Size"}),a.jsx("div",{className:"bm-parameter-filter-options",role:"group","aria-label":"Filter leaderboard by parameter size",children:I.parameterFilters.map(b=>{const{selected:M,disabled:F}=b;return a.jsx("button",{type:"button",className:`bm-parameter-filter-option${M?" is-active":""}`,"aria-pressed":M,disabled:F,onClick:()=>T(b.maxParametersExclusive),children:b.label},b.label)})}),a.jsxs("span",{className:"bm-parameter-coverage",children:["Parameters known for ",Y.parameter_coverage_known," of ",Y.parameter_coverage_total," entries"]})]}),k.isLoading||K?a.jsx("div",{style:{padding:16},children:Array.from({length:5}).map((b,M)=>a.jsx(ue,{className:"h-10 w-full mb-2"},M))}):I.rows.length===0?i?a.jsxs("div",{className:"no-results",children:["No known parameter counts match this filter. "," ",a.jsx("button",{type:"button",className:"bm-empty-filter-action",onClick:()=>T(void 0),children:"Show all"})]}):a.jsx("div",{className:"no-results",children:"No evaluations submitted yet."}):a.jsxs(a.Fragment,{children:[o.length>P&&a.jsxs("div",{className:"bm-metric-columns-control",children:[a.jsx("button",{type:"button",className:"bm-metric-columns-toggle","aria-expanded":C,"aria-controls":"benchmark-leaderboard",onClick:()=>h(C?null:R),children:C?"Show fewer metrics":`Show more metrics (${o.length-P})`}),C&&a.jsx("span",{children:"Scroll metrics horizontally; model and paper details stay visible."})]}),a.jsx(Wt,{model:I,showHarness:y,setMetric:E,highlightRowRef:d,onFittingMetricCountChange:S})]})]})]})})};export{ma as default}; diff --git a/assets/BenchmarkTrendSparkline-C135_NtS.js b/assets/BenchmarkTrendSparkline-DhXxdQ2D.js similarity index 97% rename from assets/BenchmarkTrendSparkline-C135_NtS.js rename to assets/BenchmarkTrendSparkline-DhXxdQ2D.js index 45cea8dfa4df404fa18a5d06097346abb83f380b..92e67f48e8c023694cb37e0830e0ce7eb4560581 100644 --- a/assets/BenchmarkTrendSparkline-C135_NtS.js +++ b/assets/BenchmarkTrendSparkline-DhXxdQ2D.js @@ -1 +1 @@ -import{r as C,j as t}from"./index-CbgxfyGU.js";const g=112,p=42,o=5,m=5,b=new Intl.DateTimeFormat("en",{month:"short",timeZone:"UTC"}),y=(e,d)=>{const r=new Date(`${e}T00:00:00Z`),n=new Date(`${d}T00:00:00Z`);return r.getUTCMonth()===n.getUTCMonth()?`${b.format(r)} ${r.getUTCDate()}–${n.getUTCDate()}`:`${b.format(r)} ${r.getUTCDate()}–${b.format(n)} ${n.getUTCDate()}`},I=({history:e,benchmarkName:d,interactive:r=!1})=>{const[n,x]=C.useState(null),h=e.map(s=>s.paper_count),M=Math.max(1,...h),f=g-o*2,T=p-m*2,v=h.length>1?f/(h.length-1):0,a=h.map((s,c)=>({x:o+v*c,y:m+T-s/M*T})),$=a.map(({x:s,y:c})=>`${s},${c}`).join(" "),_=a.length?`${o},${p-m} ${$} ${a[a.length-1].x},${p-m}`:"",D=h.reduce((s,c)=>s+c,0),u=49,N=14,i=n==null?null:a[n],j=i?Math.min(g-o-u,Math.max(o,i.x-u/2)):0,k=i?i.y>p/2?i.y-N-3:i.y+3:0;return t.jsxs("svg",{className:`benchmark-trend-sparkline${r?" is-interactive":""}`,viewBox:`0 0 ${g} ${p}`,role:r?"group":"img","aria-label":`${d}: ${D} reporting papers across the displayed trend history`,children:[t.jsxs("title",{children:[d,": ",D," reporting papers across the displayed trend history"]}),t.jsx("line",{className:"benchmark-trend-axis",x1:o,y1:p-m,x2:g-o,y2:p-m}),t.jsx("line",{className:"benchmark-trend-axis",x1:o,y1:m,x2:o,y2:p-m}),_&&t.jsx("polygon",{className:"benchmark-trend-area",points:_}),$&&t.jsx("polyline",{className:"benchmark-trend-line",points:$}),r?a.map(({x:s,y:c},l)=>t.jsxs("g",{className:"benchmark-trend-point",tabIndex:0,role:"img","aria-label":`${y(e[l].start_date,e[l].end_date)}: ${e[l].paper_count} ${e[l].paper_count===1?"paper":"papers"}`,onMouseEnter:()=>x(l),onMouseLeave:()=>x(null),onFocus:()=>x(l),onBlur:()=>x(null),children:[t.jsx("circle",{className:"benchmark-trend-point-hit",cx:s,cy:c,r:"5"}),t.jsx("circle",{className:"benchmark-trend-point-mark",cx:s,cy:c,r:"1.8"})]},`${e[l].start_date}-${e[l].end_date}`)):a.length>0&&t.jsx("circle",{className:"benchmark-trend-dot",cx:a[a.length-1].x,cy:a[a.length-1].y,r:"2.6"}),i&&n!=null&&t.jsxs("g",{className:"benchmark-trend-tooltip",pointerEvents:"none",children:[t.jsx("rect",{x:j,y:k,width:u,height:N,rx:"2"}),t.jsx("text",{x:j+3,y:k+5.4,children:y(e[n].start_date,e[n].end_date)}),t.jsxs("text",{className:"benchmark-trend-tooltip-value",x:j+3,y:k+11,children:[e[n].paper_count," ",e[n].paper_count===1?"paper":"papers"]})]})]})};export{I as B}; +import{d as C,j as t}from"./index-DyXq7-Tg.js";const g=112,p=42,o=5,m=5,b=new Intl.DateTimeFormat("en",{month:"short",timeZone:"UTC"}),y=(e,d)=>{const r=new Date(`${e}T00:00:00Z`),n=new Date(`${d}T00:00:00Z`);return r.getUTCMonth()===n.getUTCMonth()?`${b.format(r)} ${r.getUTCDate()}–${n.getUTCDate()}`:`${b.format(r)} ${r.getUTCDate()}–${b.format(n)} ${n.getUTCDate()}`},I=({history:e,benchmarkName:d,interactive:r=!1})=>{const[n,x]=C.useState(null),h=e.map(s=>s.paper_count),M=Math.max(1,...h),f=g-o*2,T=p-m*2,v=h.length>1?f/(h.length-1):0,a=h.map((s,c)=>({x:o+v*c,y:m+T-s/M*T})),$=a.map(({x:s,y:c})=>`${s},${c}`).join(" "),_=a.length?`${o},${p-m} ${$} ${a[a.length-1].x},${p-m}`:"",D=h.reduce((s,c)=>s+c,0),u=49,N=14,i=n==null?null:a[n],j=i?Math.min(g-o-u,Math.max(o,i.x-u/2)):0,k=i?i.y>p/2?i.y-N-3:i.y+3:0;return t.jsxs("svg",{className:`benchmark-trend-sparkline${r?" is-interactive":""}`,viewBox:`0 0 ${g} ${p}`,role:r?"group":"img","aria-label":`${d}: ${D} reporting papers across the displayed trend history`,children:[t.jsxs("title",{children:[d,": ",D," reporting papers across the displayed trend history"]}),t.jsx("line",{className:"benchmark-trend-axis",x1:o,y1:p-m,x2:g-o,y2:p-m}),t.jsx("line",{className:"benchmark-trend-axis",x1:o,y1:m,x2:o,y2:p-m}),_&&t.jsx("polygon",{className:"benchmark-trend-area",points:_}),$&&t.jsx("polyline",{className:"benchmark-trend-line",points:$}),r?a.map(({x:s,y:c},l)=>t.jsxs("g",{className:"benchmark-trend-point",tabIndex:0,role:"img","aria-label":`${y(e[l].start_date,e[l].end_date)}: ${e[l].paper_count} ${e[l].paper_count===1?"paper":"papers"}`,onMouseEnter:()=>x(l),onMouseLeave:()=>x(null),onFocus:()=>x(l),onBlur:()=>x(null),children:[t.jsx("circle",{className:"benchmark-trend-point-hit",cx:s,cy:c,r:"5"}),t.jsx("circle",{className:"benchmark-trend-point-mark",cx:s,cy:c,r:"1.8"})]},`${e[l].start_date}-${e[l].end_date}`)):a.length>0&&t.jsx("circle",{className:"benchmark-trend-dot",cx:a[a.length-1].x,cy:a[a.length-1].y,r:"2.6"}),i&&n!=null&&t.jsxs("g",{className:"benchmark-trend-tooltip",pointerEvents:"none",children:[t.jsx("rect",{x:j,y:k,width:u,height:N,rx:"2"}),t.jsx("text",{x:j+3,y:k+5.4,children:y(e[n].start_date,e[n].end_date)}),t.jsxs("text",{className:"benchmark-trend-tooltip-value",x:j+3,y:k+11,children:[e[n].paper_count," ",e[n].paper_count===1?"paper":"papers"]})]})]})};export{I as B}; diff --git a/assets/CatalogEntityPreviewLink-Cvehtzvn.js b/assets/CatalogEntityPreviewLink-BktpwL3_.js similarity index 77% rename from assets/CatalogEntityPreviewLink-Cvehtzvn.js rename to assets/CatalogEntityPreviewLink-BktpwL3_.js index ef2103253e54272309b1a52573af49e794c58d8c..71f499bcb63467a6bee3a4c26763458ce3ab18d7 100644 --- a/assets/CatalogEntityPreviewLink-Cvehtzvn.js +++ b/assets/CatalogEntityPreviewLink-BktpwL3_.js @@ -1,6 +1,6 @@ -import{n as m,a0 as h,M as d,j as s,L as g,Z as f}from"./index-CbgxfyGU.js";import{u as k}from"./useQuery-Bx9s5-D2.js";import{H as w,a as y,b as v}from"./hover-card-ufez2uMo.js";import{c as l}from"./catalog-DhK7_9-6.js";/** +import{s as m,a6 as h,V as d,b as g,j as s,L as f,a3 as k}from"./index-DyXq7-Tg.js";import{H as w,a as y,b as v}from"./hover-card-B45EJIn_.js";import{c as l}from"./catalog-CRar2olQ.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const T=m("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),x=new Set(["github.com","www.github.com"]);function M(r){let t;try{t=new URL(r)}catch{return null}if(t.protocol!=="https:"||!x.has(t.hostname))return null;const n=t.pathname.split("/").filter(Boolean);if(n.length!==2)return null;let e,a;try{e=decodeURIComponent(n[0]),a=decodeURIComponent(n[1]).replace(/\.git$/,"")}catch{return null}if(!/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$/.test(e)||!/^[a-zA-Z0-9._-]{1,100}$/.test(a))return null;const o=`${e}/${a}`,i=[e,a].map(encodeURIComponent).join("/");return{owner:e,repository:a,repoId:o,url:`https://github.com/${i}`}}async function A(r,t){const n=[r.owner,r.repository].map(encodeURIComponent).join("/"),e=await fetch(h(`/api/v1/github/repositories/${n}/preview`),{signal:t});if(!e.ok)throw new Error(`GitHub repository lookup failed: ${e.status}`);const a=await e.json();return{description:typeof a.description=="string"?a.description:null,stars:typeof a.stars=="number"?a.stars:0,forks:typeof a.forks=="number"?a.forks:0,language:typeof a.language=="string"?a.language:null,archived:a.archived===!0,avatarUrl:typeof a.avatar_url=="string"?a.avatar_url:""}}function p(r){const t=r.trim();if(!t)return null;let n=t;!n.startsWith("http://")&&!n.startsWith("https://")&&(n=`https://${n}`);try{const e=new URL(n);if(e.hostname.toLowerCase()!=="github.com")return null;const a=e.pathname.split("/").filter(Boolean);if(a.length<2)return null;const o=a[0].toLowerCase();let i=a[1].toLowerCase();return i.endsWith(".git")&&(i=i.slice(0,-4)),`https://github.com/${o}/${i}`}catch{return null}}function z(r,t){const n=p(r),e=p(t);return n&&e?n===e:r.trim()===t.trim()}const C=/^(task|method|benchmark):([A-Za-z0-9][A-Za-z0-9._-]{0,199})$/;function B(r){const t=C.exec(r);return t?{kind:t[1],slug:t[2]}:null}const P=r=>/^(task|method|benchmark):/.test(r),_={task:"/tasks/",method:"/methods/",benchmark:"/benchmark/",framework:"/papers?framework="},U={task:"Task",method:"Method",benchmark:"Benchmark",framework:"Framework"},b={task:["paper","papers"],method:["paper","papers"],benchmark:["entry","entries"],framework:["paper","papers"]};async function j({kind:r,slug:t}){if(r==="task"){const e=await l.getTask(t);return{name:e.name,description:e.description??null,imageUrl:e.image_url??null,count:e.paper_count??null,detail:null}}if(r==="method"){const e=await l.getMethod(t);return{name:e.full_name||e.name,description:e.description??null,imageUrl:e.image_url??null,count:e.paper_count??null,detail:e.introduced_year?`Introduced ${e.introduced_year}`:null}}if(r==="framework"){const a=(await l.frameworkCatalog()).domains.flatMap(o=>o.categories).flatMap(o=>o.frameworks).find(o=>o.slug===t);if(!a)throw new Error(`Unknown framework ${t}`);return{name:a.name,description:a.description,imageUrl:null,count:a.paper_count,detail:a.organization_name??null}}const n=await l.getDatasetBySlug(t);return{name:n.full_name||n.name,description:n.description??null,imageUrl:null,count:n.paper_count??null,detail:n.introduced_year?`Introduced ${n.introduced_year}`:null}}function $(r){return r.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`#>]+/g,"").replace(/\s+/g," ").trim()}const I=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,N=({kind:r,preview:t})=>{const[n,e]=d.useState(!1),a=f(t.imageUrl),o=[t.count!=null?`${t.count.toLocaleString()} ${b[r][t.count===1?0:1]}`:null,t.detail].filter(Boolean);return s.jsxs("div",{className:"catalog-preview-card",children:[a&&!n&&s.jsx("img",{className:"catalog-preview-image","data-testid":"catalog-preview-image",src:a,alt:"",loading:"lazy",decoding:"async",onError:()=>e(!0)}),s.jsxs("div",{className:"catalog-preview-meta",children:[s.jsx("span",{className:"catalog-preview-kind",children:U[r]}),s.jsx("strong",{children:t.name}),t.description&&s.jsx("p",{children:$(t.description)}),o.length>0&&s.jsx("span",{className:"catalog-preview-stats",children:o.join(" · ")})]})]})},S=({entity:r,children:t,className:n="chat-paper-link",newTab:e=!0,initialPreview:a})=>{const[o,i]=d.useState(!1),c=k({queryKey:["chat-catalog-preview",r.kind,r.slug],queryFn:()=>j(r),initialData:a,enabled:o&&!a,staleTime:10*60*1e3,gcTime:30*60*1e3,retry:!1});return s.jsxs(w,{open:o,onOpenChange:u=>{(!u||!I())&&i(u)},openDelay:150,closeDelay:100,children:[s.jsx(y,{asChild:!0,children:s.jsx(g,{className:n,to:`${_[r.kind]}${encodeURIComponent(r.slug)}`,target:e?"_blank":void 0,rel:e?"noopener noreferrer":void 0,onClick:()=>i(!1),children:t})}),s.jsx(v,{className:"catalog-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:c.data?s.jsx(N,{kind:r.kind,preview:c.data}):c.isError?s.jsx("div",{className:"paper-preview-status",children:"Preview unavailable"}):s.jsx("div",{className:"paper-preview-status","aria-live":"polite",children:"Loading preview…"})})]})};export{S as C,T,M as a,A as f,z as g,P as i,p as n,B as p}; + */const L=m("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),x=new Set(["github.com","www.github.com"]);function T(r){let t;try{t=new URL(r)}catch{return null}if(t.protocol!=="https:"||!x.has(t.hostname))return null;const n=t.pathname.split("/").filter(Boolean);if(n.length!==2)return null;let e,a;try{e=decodeURIComponent(n[0]),a=decodeURIComponent(n[1]).replace(/\.git$/,"")}catch{return null}if(!/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$/.test(e)||!/^[a-zA-Z0-9._-]{1,100}$/.test(a))return null;const o=`${e}/${a}`,i=[e,a].map(encodeURIComponent).join("/");return{owner:e,repository:a,repoId:o,url:`https://github.com/${i}`}}async function M(r,t){const n=[r.owner,r.repository].map(encodeURIComponent).join("/"),e=await fetch(h(`/api/v1/github/repositories/${n}/preview`),{signal:t});if(!e.ok)throw new Error(`GitHub repository lookup failed: ${e.status}`);const a=await e.json();return{description:typeof a.description=="string"?a.description:null,stars:typeof a.stars=="number"?a.stars:0,forks:typeof a.forks=="number"?a.forks:0,language:typeof a.language=="string"?a.language:null,archived:a.archived===!0,avatarUrl:typeof a.avatar_url=="string"?a.avatar_url:""}}function p(r){const t=r.trim();if(!t)return null;let n=t;!n.startsWith("http://")&&!n.startsWith("https://")&&(n=`https://${n}`);try{const e=new URL(n);if(e.hostname.toLowerCase()!=="github.com")return null;const a=e.pathname.split("/").filter(Boolean);if(a.length<2)return null;const o=a[0].toLowerCase();let i=a[1].toLowerCase();return i.endsWith(".git")&&(i=i.slice(0,-4)),`https://github.com/${o}/${i}`}catch{return null}}function A(r,t){const n=p(r),e=p(t);return n&&e?n===e:r.trim()===t.trim()}const C=/^(task|method|benchmark):([A-Za-z0-9][A-Za-z0-9._-]{0,199})$/;function z(r){const t=C.exec(r);return t?{kind:t[1],slug:t[2]}:null}const B=r=>/^(task|method|benchmark):/.test(r),_={task:"/tasks/",method:"/methods/",benchmark:"/benchmark/",framework:"/papers?framework="},b={task:"Task",method:"Method",benchmark:"Benchmark",framework:"Framework"},U={task:["paper","papers"],method:["paper","papers"],benchmark:["entry","entries"],framework:["paper","papers"]};async function j({kind:r,slug:t}){if(r==="task"){const e=await l.getTask(t);return{name:e.name,description:e.description??null,imageUrl:e.image_url??null,count:e.paper_count??null,detail:null}}if(r==="method"){const e=await l.getMethod(t);return{name:e.full_name||e.name,description:e.description??null,imageUrl:e.image_url??null,count:e.paper_count??null,detail:e.introduced_year?`Introduced ${e.introduced_year}`:null}}if(r==="framework"){const a=(await l.frameworkCatalog()).domains.flatMap(o=>o.categories).flatMap(o=>o.frameworks).find(o=>o.slug===t);if(!a)throw new Error(`Unknown framework ${t}`);return{name:a.name,description:a.description,imageUrl:null,count:a.paper_count,detail:a.organization_name??null}}const n=await l.getDatasetBySlug(t);return{name:n.full_name||n.name,description:n.description??null,imageUrl:null,count:n.paper_count??null,detail:n.introduced_year?`Introduced ${n.introduced_year}`:null}}function $(r){return r.replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`#>]+/g,"").replace(/\s+/g," ").trim()}const I=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,N=({kind:r,preview:t})=>{const[n,e]=d.useState(!1),a=k(t.imageUrl),o=[t.count!=null?`${t.count.toLocaleString()} ${U[r][t.count===1?0:1]}`:null,t.detail].filter(Boolean);return s.jsxs("div",{className:"catalog-preview-card",children:[a&&!n&&s.jsx("img",{className:"catalog-preview-image","data-testid":"catalog-preview-image",src:a,alt:"",loading:"lazy",decoding:"async",onError:()=>e(!0)}),s.jsxs("div",{className:"catalog-preview-meta",children:[s.jsx("span",{className:"catalog-preview-kind",children:b[r]}),s.jsx("strong",{children:t.name}),t.description&&s.jsx("p",{children:$(t.description)}),o.length>0&&s.jsx("span",{className:"catalog-preview-stats",children:o.join(" · ")})]})]})},P=({entity:r,children:t,className:n="chat-paper-link",newTab:e=!0,initialPreview:a})=>{const[o,i]=d.useState(!1),c=g({queryKey:["chat-catalog-preview",r.kind,r.slug],queryFn:()=>j(r),initialData:a,enabled:o&&!a,staleTime:10*60*1e3,gcTime:30*60*1e3,retry:!1});return s.jsxs(w,{open:o,onOpenChange:u=>{(!u||!I())&&i(u)},openDelay:150,closeDelay:100,children:[s.jsx(y,{asChild:!0,children:s.jsx(f,{className:n,to:`${_[r.kind]}${encodeURIComponent(r.slug)}`,target:e?"_blank":void 0,rel:e?"noopener noreferrer":void 0,onClick:()=>i(!1),children:t})}),s.jsx(v,{className:"catalog-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:c.data?s.jsx(N,{kind:r.kind,preview:c.data}):c.isError?s.jsx("div",{className:"paper-preview-status",children:"Preview unavailable"}):s.jsx("div",{className:"paper-preview-status","aria-live":"polite",children:"Loading preview…"})})]})};export{P as C,L as T,T as a,M as f,A as g,B as i,p as n,z as p}; diff --git a/assets/ChatView-DlSbJMKT.js b/assets/ChatView-D06zYumh.js similarity index 97% rename from assets/ChatView-DlSbJMKT.js rename to assets/ChatView-D06zYumh.js index 84ac564bedd2170111c4c14bf9cb56170283e8fe..19ee594c860fbef64aa951e98e81200e750efd25 100644 --- a/assets/ChatView-DlSbJMKT.js +++ b/assets/ChatView-D06zYumh.js @@ -1,6 +1,6 @@ -var ir=Object.defineProperty;var or=(e,r,t)=>r in e?ir(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var ee=(e,r,t)=>or(e,typeof r!="symbol"?r+"":r,t);import{n as cr,r as d,j as n,X as Pt,p as Ht,M as rt,a as Ut,u as lr,c as ur,e as dr,f as pr,_ as fr,K as hr,L as Ct,S as mr,U as gr,V as yr,W as At,m as _r}from"./index-CbgxfyGU.js";import{u as Pe}from"./useQuery-Bx9s5-D2.js";import{C as br,U as jt,b as wr,f as De,c as xr,g as vr,A as Sr,a as Er}from"./ArtifactWorkspace-Cwix1Wp6.js";import{f as Ue,h as Rr,j as Kt,k as Ir,T as kr,e as Wt,l as Cr,m as Ar,n as jr,r as Tr,o as Tt,s as Yt,t as nt,v as He,w as Le,x as Mr,y as Mt,z as Nr,B as Dr,E as ut,F as $t,G as Lr,H as Fr,I as Or,J as qr,D as st,K as Br,L as Pr,M as Je,N as Qe,O as Hr,Q as ze,R as Ge,U as Ur,V as Kr,S as Wr,W as Yr,X as Nt,Y as $r}from"./chatSessions-DwLUbLRo.js";import{M as Vr}from"./McpShowcase-CMLfdJM2.js";import{S as Qr}from"./share-2-hXe4dX_y.js";import{c as Xe}from"./chat-DzTo2WUO.js";import{u as zr,O as Gr}from"./openrouter-DiuY1sPP.js";import{q as Vt}from"./queryOptions-C9woPjwX.js";/* empty css */import"./hover-card-ufez2uMo.js";import"./CatalogEntityPreviewLink-Cvehtzvn.js";import"./catalog-DhK7_9-6.js";import"./github-BYklgHDz.js";import"./file-text-BK_7Q2rV.js";import"./PaperPreviewLink-DZDNIh1g.js";import"./index-ZkEATkOr.js";import"./index-BH3yOoza.js";import"./katex-DkKDou_j.js";import"./paperQueryKeys-B8u1BWlI.js";import"./curation-C7Gmmp4z.js";import"./useMutation-P_trTy9i.js";import"./copy-bzw7JVus.js";import"./thumbs-up-CDCzGuPd.js";import"./arrow-left-Czeu3VzJ.js";import"./external-link-DZIH4GGr.js";import"./plus-UK0TEjgd.js";import"./search-CLtAJGOp.js";import"./chevron-up-Cpt5JLeI.js";import"./AuthorAvatar-CUJMmp_z.js";import"./AgentLogos-BBl9UNVD.js";/** +var ir=Object.defineProperty;var or=(e,r,t)=>r in e?ir(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var ee=(e,r,t)=>or(e,typeof r!="symbol"?r+"":r,t);import{s as cr,d,j as n,X as Pt,x as Ht,V as rt,b as Pe,a as Ut,u as lr,e as ur,g as dr,i as pr,a4 as fr,U as hr,L as Ct,_ as mr,$ as gr,a0 as yr,a1 as At,q as _r}from"./index-DyXq7-Tg.js";import{C as br,U as jt,b as wr,f as De,c as xr,g as vr,A as Sr,a as Er}from"./ArtifactWorkspace-Ya79_F5k.js";import{f as Ue,h as Rr,j as Kt,k as Ir,T as kr,e as Wt,l as Cr,m as Ar,n as jr,r as Tr,o as Tt,s as Yt,t as nt,v as He,w as Le,x as Mr,y as Mt,z as Nr,B as Dr,E as ut,F as $t,G as Lr,H as Fr,I as Or,J as qr,D as st,K as Br,L as Pr,M as Je,N as Qe,O as Hr,Q as ze,R as Ge,U as Ur,V as Kr,S as Wr,W as Yr,X as Nt,Y as $r}from"./chatSessions-Ck_dyM0d.js";import{M as Vr}from"./McpShowcase-CLO4HLon.js";import{S as Qr}from"./share-2-fiavn5SS.js";import{c as Xe}from"./chat-Ix1IrIwq.js";import{u as zr,O as Gr}from"./openrouter-o51Eagw8.js";import{q as Vt}from"./queryOptions-C9woPjwX.js";/* empty css */import"./hover-card-B45EJIn_.js";import"./CatalogEntityPreviewLink-BktpwL3_.js";import"./catalog-CRar2olQ.js";import"./github-RNrgGHRT.js";import"./file-text-dvKtHbmD.js";import"./PaperPreviewLink-CpCZSa8K.js";import"./index-mCi_y_l3.js";import"./index-2CvJmBVB.js";import"./katex-DkKDou_j.js";import"./papers-Dh3ljlL0.js";import"./curation-YeS7FBYf.js";import"./useMutation-UWxBeqtn.js";import"./copy-CxR0OKx2.js";import"./thumbs-up-CPLlGli7.js";import"./arrow-left-PA_b6law.js";import"./external-link-orY1Xz1I.js";import"./plus-Yh42pKZz.js";import"./search-8ssWDP68.js";import"./chevron-up-DYSYRyvz.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./AgentLogos-j-Qekw7T.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Jr=cr("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);function Xr(e){const[r,t]=d.useState("calc(100dvh - 60px)");return d.useLayoutEffect(()=>{if(!e)return;const s=document.querySelector(".app-header"),u=window.visualViewport,o=()=>{const a=(u==null?void 0:u.height)??window.innerHeight;t(`${Math.max(0,a-((s==null?void 0:s.offsetHeight)??0))}px`)};o();const p=new ResizeObserver(o);return s&&p.observe(s),u==null||u.addEventListener("resize",o),window.addEventListener("resize",o),()=>{p.disconnect(),u==null||u.removeEventListener("resize",o),window.removeEventListener("resize",o)}},[e]),e?r:"100%"}const Zr="https://huggingface.co/settings/inference-providers",Dt="pwc.chat.billing-notice-dismissed.v1";function es({provider:e}){const[r,t]=d.useState(()=>localStorage.getItem(Dt)==="1");return!Ue()||r||e!=="huggingface"?null:n.jsxs("div",{className:"chat-billing-notice",role:"note",children:[n.jsx("span",{children:"Hugging Face models use the inference permission granted when you start chatting. Included monthly credits are used first, then extra usage requires purchased credits. You can choose organization billing in Settings."}),n.jsxs("div",{className:"chat-billing-notice-actions",children:[n.jsx("a",{href:"/settings",children:"Review billing"}),n.jsx("a",{href:Zr,target:"_blank",rel:"noreferrer",children:"Review usage"}),n.jsx("button",{type:"button",className:"chat-billing-notice-dismiss","aria-label":"Dismiss billing notice",title:"Dismiss",onClick:()=>{localStorage.setItem(Dt,"1"),t(!0)},children:n.jsx(Pt,{size:15,"aria-hidden":"true"})})]})]})}function Lt({variant:e,composerProps:r,provider:t,sponsored:s=!1,paused:u,error:o,suggestions:p=[]}){var h;const a=n.jsxs(n.Fragment,{children:[!s&&n.jsx(es,{provider:t}),u&&n.jsx("div",{id:"chat-paused-description",className:"chat-paused-banner",role:"status",children:"Chat is temporarily disabled. You can keep browsing and editing your conversations. New research runs will return when chat is restored."}),o&&n.jsx("div",{className:"chat-composer-error",role:"alert",children:o}),n.jsx(br,{...r,...e==="empty"?{autoFocus:!0}:{placeholder:(h=r.draft)!=null&&h.text?"Edit and send again…":"Ask a follow-up…"}}),e==="empty"&&n.jsx("div",{className:"chat-examples",children:p.map(L=>n.jsx("button",{type:"button",className:"chat-example",disabled:u,onClick:()=>{var v;return r.onSend({text:L,paperMentions:[],...(v=r.draft)!=null&&v.paperSelection?{paperSelection:r.draft.paperSelection}:{}})},children:L},L))})]});return e==="empty"?a:n.jsx("div",{className:"chat-composer-wrap",children:n.jsxs("div",{className:"chat-composer-inner",children:[a,n.jsx("div",{className:"chat-composer-foot",children:Ue()?n.jsxs(n.Fragment,{children:[t==="huggingface"&&n.jsxs("span",{className:"chat-provider-attribution",children:["Powered by 🤗 ",n.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"}),"."]}),t==="openrouter"&&n.jsxs("span",{className:"chat-provider-attribution",children:["Powered by ",n.jsx("a",{href:"https://openrouter.ai",target:"_blank",rel:"noreferrer",children:"OpenRouter"}),"."]}),t==="openai"&&n.jsx("span",{className:"chat-provider-attribution",children:"Powered by OpenAI."}),n.jsx("span",{children:"The AI assistant can make mistakes. Double-check responses."})]}):n.jsx(n.Fragment,{children:"Assistant preview — responses are simulated."})})]})})}function ts({messages:e,papers:r,busy:t,queuedDraft:s,paperMentionsEnabled:u,archivePending:o,openRouterFallbackEnabled:p,onToggleBlock:a,onEditAndResend:h,onRetryFromProgress:L,onRetryWithLuna:v,onArchiveOld:S,onArchiveOldest:A}){var m,I;const[B,O]=d.useState(null),k=d.useRef(null),j=d.useRef(null),W=d.useRef("bottom"),U=d.useRef(0),se=d.useRef(0),[Q,w]=d.useState(!1),T=d.useRef(null),C=d.useCallback(i=>{W.current=i},[]),_=d.useCallback(()=>{const i=k.current;i&&w(i.scrollHeight-i.scrollTop-i.clientHeight>1)},[]),V=e.filter(i=>i.role==="user"),$=V.length,F=d.useRef($),ne=d.useRef(!1),ue=(m=V[0])==null?void 0:m.id,z=(I=V.at(-1))==null?void 0:I.id;d.useEffect(()=>{t&&O(null)},[t]),d.useLayoutEffect(()=>{const i=k.current;if(i){if($>F.current||t&&!ne.current){const M=Array.from(i.querySelectorAll("[data-message-id]")).at(-1);if(M){const P=i.getBoundingClientRect().top;U.current=i.scrollTop+M.getBoundingClientRect().top-P-24,C("question")}}if(F.current=$,ne.current=t,j.current!==null){i.scrollTop=j.current,j.current=null;return}W.current==="bottom"&&(i.scrollTop=i.scrollHeight),W.current==="question"&&(i.scrollTop=U.current,se.current=i.scrollTop)}},[e,$,t,C]),d.useLayoutEffect(_),d.useEffect(()=>{const i=k.current;if(!i)return;const M=new ResizeObserver(_);return M.observe(i),i.firstElementChild&&M.observe(i.firstElementChild),()=>M.disconnect()},[_]);const J=(i,M)=>{var P;j.current=((P=k.current)==null?void 0:P.scrollTop)??null,a(i,M)};return n.jsxs("div",{className:"chat-conversation-viewport",children:[n.jsx("div",{className:"chat-conversation",ref:k,tabIndex:0,role:"region","aria-label":"Conversation",onWheel:i=>{(i.deltaY<0||W.current==="question")&&C("free")},onTouchStart:i=>{var M;T.current=((M=i.touches[0])==null?void 0:M.clientY)??null},onTouchMove:i=>{var P;const M=(P=i.touches[0])==null?void 0:P.clientY;M!==void 0&&T.current!==null&&(M>T.current||W.current==="question")&&C("free"),T.current=M??null},onKeyDown:i=>{i.target===i.currentTarget&&((["ArrowUp","PageUp","Home"].includes(i.key)||i.key===" "&&i.shiftKey)&&C("free"),["ArrowDown","PageDown","End"," "].includes(i.key)&&W.current==="question"&&C("free"))},onScroll:i=>{const{scrollHeight:M,scrollTop:P,clientHeight:ae}=i.currentTarget,ie=M-P-ae<=1;W.current==="bottom"&&!ie&&C("free");const fe=P-se.current;W.current==="question"&&(fe>1||fe<-1&&!ie)&&C("free"),_()},children:n.jsxs("div",{className:"chat-conversation-inner",children:[e.length===0&&(s==null?void 0:s.text)&&n.jsx(jt,{id:"queued-launch-preview",text:s.text,paperMentions:s.paperMentions,paperSelection:s.paperSelection,isInitial:!0}),e.map(i=>{var M,P,ae,ie;return i.role==="user"?n.jsx(jt,{id:i.id,text:i.text??"",paperMentions:i.paperMentions??[],paperSelection:i.paperSelection,paperMentionsEnabled:u,isInitial:i.id===ue,editingAllowed:!t&&!!i.revision,editing:B===i.id,editNotice:i.id===ue?"Sending will replace this conversation.":i.id===z?"Sending will replace the response.":"Sending will replace the response and all messages after it.",onEdit:()=>O(i.id),onCancel:()=>O(null),onResendDraft:fe=>{const ge=h(i.id,fe);return ge&&O(null),ge}},i.id):n.jsx(wr,{msg:i,papers:r,onToggleBlock:J,onRetryCompaction:!t&&i.id===((M=e.at(-1))==null?void 0:M.id)&&((P=V.at(-1))!=null&&P.revision)?L:void 0,onRetryWithLuna:!t&&i.id===((ae=e.at(-1))==null?void 0:ae.id)&&((ie=V.at(-1))!=null&&ie.revision)?v:void 0,onArchiveOldChats:S,onArchiveOldestChats:A,archivePending:o,hfBilling:null,openRouterFallbackEnabled:p,feedbackEnabled:!0},i.id)})]})}),Q&&n.jsx("button",{type:"button",className:"chat-jump-latest",onClick:()=>{C("bottom");const i=k.current;i&&(i.focus({preventScroll:!0}),i.scrollTop=i.scrollHeight,_())},children:"Jump to latest"})]})}function rs({retryAt:e,onRetry:r,onCancel:t}){const[s,u]=d.useState(()=>Math.max(0,Math.ceil((e-Date.now())/1e3))),o=d.useRef(null);return d.useEffect(()=>{var L;const p=document.activeElement instanceof HTMLElement?document.activeElement:null;(L=o.current)==null||L.focus();const a=()=>u(Math.max(0,Math.ceil((e-Date.now())/1e3)));a();const h=window.setInterval(a,250);return()=>{window.clearInterval(h),p==null||p.focus()}},[e]),n.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:n.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-capacity-dialog-title","aria-describedby":"chat-capacity-dialog-description",onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),t())},children:[n.jsx("h2",{id:"chat-capacity-dialog-title",children:"All research slots are currently in use"}),n.jsx("p",{id:"chat-capacity-dialog-description",children:"Your message was not sent or billed. Try again in a few seconds."}),n.jsx("p",{className:"chat-capacity-countdown","aria-live":"polite",children:s>0?`Try again available in ${s} second${s===1?"":"s"}.`:"You can try again now."}),n.jsxs("div",{className:"chat-capacity-dialog-actions",children:[n.jsx("button",{type:"button",className:"chat-capacity-cancel",ref:o,onClick:t,children:"Cancel"}),n.jsx("button",{type:"button",className:"chat-capacity-retry",disabled:s>0,onClick:r,children:"Try again"})]})]})})}function ss({onClose:e}){const r=d.useRef(null);return d.useEffect(()=>{var s;const t=document.activeElement instanceof HTMLElement?document.activeElement:null;return(s=r.current)==null||s.focus(),()=>t==null?void 0:t.focus()},[]),n.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:n.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-disabled-title","aria-describedby":"chat-disabled-description",onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),e())},children:[n.jsx("h2",{id:"chat-disabled-title",children:"Chat is temporarily disabled"}),n.jsx("p",{id:"chat-disabled-description",children:"We've temporarily paused new research runs. Your message wasn't sent, and your draft is still here. Please try again later."}),n.jsx("div",{className:"chat-capacity-dialog-actions",children:n.jsx("button",{ref:r,type:"button",className:"chat-capacity-cancel",onClick:e,children:"Keep editing"})})]})})}function ns({url:e,onClose:r}){return e?n.jsx("div",{className:"chat-share-dialog-backdrop",role:"presentation",onMouseDown:r,children:n.jsxs("div",{className:"chat-share-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-share-dialog-title",onMouseDown:t=>t.stopPropagation(),children:[n.jsx("h2",{id:"chat-share-dialog-title",children:"Public link created"}),n.jsx("p",{children:"Anyone with this link can see this conversation. It could not be copied automatically, so copy it manually:"}),n.jsx("input",{readOnly:!0,value:e,"aria-label":"Public conversation link",autoFocus:!0,onFocus:t=>t.currentTarget.select()}),n.jsx("button",{type:"button",onClick:r,children:"Close"})]})}):null}const at="pwc:chat:sidebar-width",it=280,ot=200,ct=480,as=12,lt=e=>Math.max(ot,Math.min(ct,e)),is=()=>{if(typeof window>"u")return it;const e=Number(localStorage.getItem(at));return Number.isFinite(e)&&e>0?lt(e):it};function os({sessions:e,activeSessionId:r,loading:t,error:s,open:u,onClose:o,onNew:p,onNavigate:a,onRename:h,onDelete:L}){const[v,S]=d.useState(is),A=d.useRef(null),B=d.useRef(v),[O,k]=d.useState(null),[j,W]=d.useState(""),[U,se]=d.useState(null),[Q,w]=d.useState(!1),T=[...e].sort((m,I)=>Date.parse(I.updated_at)-Date.parse(m.updated_at)),C=T.filter((m,I)=>I{if(!U)return;const m=()=>se(null),I=i=>{i.key==="Escape"&&m()};return window.addEventListener("click",m),window.addEventListener("keydown",I),()=>{window.removeEventListener("click",m),window.removeEventListener("keydown",I)}},[U]);const $=m=>{k(m.id),W(m.title)},F=async m=>{const I=j.trim();I&&await h(m,I)&&k(null)},ne=(m,I,i)=>se({id:m,x:I,y:i}),ue=m=>{if(!A.current)return;const I=lt(A.current.width+m-A.current.x);B.current=I,S(I)},z=()=>{A.current&&(A.current=null,localStorage.setItem(at,String(B.current)))},J=m=>{const I=lt(m);B.current=I,S(I),localStorage.setItem(at,String(I))};return n.jsxs(n.Fragment,{children:[u&&n.jsx("div",{className:"chat-sidebar-backdrop","aria-hidden":"true",onClick:o}),n.jsxs("aside",{className:`chat-sidebar${u?"":" chat-sidebar-closed"}`,style:{"--chat-sidebar-width":`${v}px`},children:[n.jsxs("div",{className:"chat-sidebar-top",children:[n.jsxs("button",{type:"button",className:"chat-new-chat",onClick:()=>{De()&&p()},children:[n.jsx(Rr,{})," New chat"]}),n.jsx("button",{type:"button",className:"icon-btn",onClick:o,title:"Collapse sidebar",children:n.jsx(Kt,{})})]}),n.jsxs("nav",{className:"chat-sessions","aria-label":"Chat history",children:[t&&n.jsx("div",{className:"chat-sessions-empty",children:"Loading chats…"}),!t&&s&&n.jsx("div",{className:"chat-sessions-empty",children:s}),!t&&!s&&e.length===0&&n.jsx("div",{className:"chat-sessions-empty",children:"Conversations you start will show up here."}),Ir(_).map(m=>n.jsxs("div",{className:"chat-session-group",children:[n.jsx("div",{className:"chat-session-group-label",children:m.label}),m.items.map(I=>n.jsxs("div",{className:`chat-session${I.id===r?" chat-session-active":""}`,role:"button",tabIndex:0,onClick:()=>{De()&&a(I.id)},onKeyDown:i=>{if(i.key==="Enter"&&De()&&a(I.id),i.key==="F2"&&$(I),i.key==="ContextMenu"||i.shiftKey&&i.key==="F10"){i.preventDefault();const M=i.currentTarget.getBoundingClientRect();ne(I.id,M.right-150,M.bottom)}},onContextMenu:i=>{i.preventDefault(),ne(I.id,i.clientX,i.clientY)},children:[O===I.id?n.jsx("input",{className:"chat-session-title-input",value:j,autoFocus:!0,maxLength:80,onClick:i=>i.stopPropagation(),onChange:i=>W(i.target.value),onBlur:()=>void F(I.id),onKeyDown:i=>{i.stopPropagation(),i.key==="Enter"&&F(I.id),i.key==="Escape"&&k(null)}}):n.jsx("span",{className:"chat-session-title",children:I.title}),n.jsx("button",{type:"button",className:"chat-session-menu","aria-label":"Chat actions","aria-haspopup":"menu",title:"Chat actions",onClick:i=>{i.stopPropagation();const M=i.currentTarget.getBoundingClientRect();ne(I.id,M.right-150,M.bottom)},children:"⋯"}),n.jsx("button",{type:"button",className:"chat-session-delete","aria-label":"Delete conversation",onClick:i=>{i.stopPropagation(),De()&&L(I.id)},children:n.jsx(kr,{})})]},I.id))]},m.label)),V>0&&n.jsx("button",{type:"button",className:"chat-sessions-toggle","aria-expanded":Q,onClick:()=>w(m=>!m),children:Q?"Show less":`Show ${V} older ${V===1?"chat":"chats"}`})]}),n.jsx(Vr,{className:"chat-sidebar-tools",canNavigate:De}),n.jsx("div",{className:"chat-sidebar-resize-handle",role:"separator","aria-label":"Resize chat history","aria-orientation":"vertical","aria-valuemin":ot,"aria-valuemax":ct,"aria-valuenow":v,title:"Drag to resize; double-click to reset",tabIndex:0,onPointerDown:m=>{m.button===0&&(A.current={x:m.clientX,width:v},B.current=v,m.currentTarget.setPointerCapture(m.pointerId))},onPointerMove:m=>ue(m.clientX),onPointerUp:z,onPointerCancel:z,onLostPointerCapture:z,onDoubleClick:()=>J(it),onKeyDown:m=>{(m.key==="ArrowLeft"||m.key==="ArrowRight")&&(m.preventDefault(),J(v+(m.key==="ArrowRight"?10:-10))),(m.key==="Home"||m.key==="End")&&(m.preventDefault(),J(m.key==="Home"?ot:ct))}}),U&&n.jsx("div",{className:"chat-session-context-menu",role:"menu",style:{left:U.x,top:U.y},onClick:m=>m.stopPropagation(),children:n.jsx("button",{type:"button",role:"menuitem",autoFocus:!0,onClick:()=>{const m=e.find(I=>I.id===U.id);m&&$(m),se(null)},children:"Rename chat"})})]})]})}function cs({sessionId:e,busy:r,loading:t,hasPaperSelection:s=!1,onError:u}){const{toast:o}=Ht(),[p,a]=d.useState(!1),[h,L]=d.useState(""),v=async()=>{var S;if(!(r||p)&&!(s&&!window.confirm("This public link will include the selected paper passage. Anyone with the link can read that passage. Continue?"))){a(!0);try{const A=await Cr(e),B=new URL(A.public_path,window.location.origin).toString();try{if(!((S=navigator.clipboard)!=null&&S.writeText))throw new Error("Clipboard unavailable");await navigator.clipboard.writeText(B),o({className:"chat-share-toast",duration:5e3,title:"Public link copied to your clipboard",description:"Anyone with this link can see this conversation."})}catch{L(B)}}catch(A){const B=A instanceof Error?A.message:"Could not share this conversation";u(B),o({variant:"destructive",title:"Share failed",description:B})}finally{a(!1)}}};return n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",className:"chat-share-button",onClick:()=>void v(),disabled:r||p||t,"aria-label":"Share conversation",children:[p?n.jsx(Wt,{}):n.jsx(Qr,{"aria-hidden":"true"}),n.jsx("span",{children:"Share"})]}),n.jsx(ns,{url:h,onClose:()=>L("")})]})}const ls=({descriptor:e})=>{const r=xr(),{open:t,register:s,unregister:u}=r,o=rt.useRef(null),p=e.source_head??e.preview_head,a=rt.useMemo(()=>p?{kind:"artifact",schema_version:1,scope:"owner",artifact_id:e.artifact_id,version_id:p.version_id,identifier:"latex-paper",version:p.version,artifact_kind:"latex_paper",title:e.title,status:"ready",preview_mime:"application/pdf",source_language:"latex",total_bytes:0}:null,[e.artifact_id,e.title,p]),h=a?vr(a):null;return rt.useEffect(()=>{if(!(!a||!h))return s(a),o.current!==h&&(o.current=h,t(a)),()=>u(h)},[a,h,t,s,u]),null};function us({messages:e,refreshSessions:r,resetChat:t,restoreDraft:s}){const{toast:u}=Ht(),[o,p]=d.useState(null),a=()=>{const v=[...e].reverse().find(S=>S.role==="user");t(),s({text:(v==null?void 0:v.text)??"",paperMentions:(v==null?void 0:v.paperMentions)??[],...v!=null&&v.paperSelection?{paperSelection:v.paperSelection}:{}})};return{pending:o,archiveOld:async()=>{if(o===null){p("old");try{const v=await jr();if(await r(),v.archived_count===0){u({title:"No chats were archived",description:"There are no inactive chats older than 30 days."});return}a(),u({title:`${v.archived_count} ${v.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(v){u({variant:"destructive",title:"Could not archive old chats",description:v instanceof Error?v.message:"Try again."})}finally{p(null)}}},archiveOldest:async()=>{if(o===null){p("oldest");try{const v=await Ar();await r(),a(),u({title:`${v.archived_count} ${v.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(v){u({variant:"destructive",title:"Could not archive chats",description:v instanceof Error?v.message:"Try again."})}finally{p(null)}}}}}class ds{constructor(r,t=Tr){ee(this,"requestId");ee(this,"firstVisibleAt");ee(this,"streamStartReported",!1);ee(this,"firstVisibleReported",!1);ee(this,"terminalReported",!1);ee(this,"semanticReported",new Set);this.submittedAt=r,this.report=t}recordStreamStart(r,t){this.requestId=r,this.streamStartReported||(this.streamStartReported=!0,this.send({submission_to_stream_start_ms:Math.max(0,t-this.submittedAt)})),this.reportFirstVisible()}recordFirstVisible(r){this.firstVisibleAt===void 0&&(this.firstVisibleAt=r,this.reportFirstVisible())}recordSemantic(r,t){if(this.semanticReported.has(r))return;this.semanticReported.add(r);const s=Math.max(0,t-this.submittedAt);this.send(r==="reasoning"?{submission_to_first_reasoning_delta_ms:s}:r==="tool"?{submission_to_first_tool_call_ms:s}:{submission_to_first_answer_delta_ms:s})}recordTerminal(r){this.terminalReported||(this.terminalReported=!0,this.send({terminal_classification:r}))}reportFirstVisible(){!this.requestId||this.firstVisibleAt===void 0||this.firstVisibleReported||(this.firstVisibleReported=!0,this.send({submission_to_first_visible_delta_ms:Math.max(0,this.firstVisibleAt-this.submittedAt)}))}send(r){this.requestId&&this.report(this.requestId,r)}}const Qt="Preparing research workspace…",zt={preparing_workspace:"Preparing secure workspace…",starting_agent:"Starting research agent…",connecting_model:"Connecting to model…"},Gt=()=>({messages:[],sessionId:null,title:"",phase:"idle"});function Ft(e,r){for(let t=e.length-1;t>=0;t-=1)if(r(e[t]))return t;return-1}function Re(e){if(e.status!==Qt&&!Object.values(zt).includes(e.status))return e;const{status:r,...t}=e;return t}function te(e,r){if(!e.length)return e;const t=e.slice();return t[t.length-1]=r(t[t.length-1]),t}function Ae(e,r,t){return te(e,s=>{const u=Re(s),o=u.blocks??[];return{...u,blocks:o.map((p,a)=>r(p,a,o)?t(p):p)}})}function ps(e,r){switch(r.type){case"stream_start":return r.session_id?{...e,sessionId:r.session_id}:e;case"sandbox_start":case"sandbox_ready":case"workspace_ready":return e;case"lifecycle":return{...e,messages:te(e.messages,t=>{var s;return t.role==="assistant"&&t.streaming&&(((s=t.blocks)==null?void 0:s.length)??0)===0?{...t,status:zt[r.phase]}:t})};case"session_title_start":return{...e,title:""};case"session_title_delta":return{...e,title:`${e.title}${r.text}`.replace(/\s+/g," ").slice(0,80)};case"session_title_done":return{...e,title:r.title};case"compaction_status":return{...e,messages:te(e.messages,t=>({...t,compacting:!!(t.streaming&&r.state==="started")}))};case"reasoning_start":return{...e,messages:te(e.messages,t=>{const s=Re(t);return{...s,blocks:[...(s.blocks??[]).map(u=>u.kind==="reasoning"&&u.active?{...u,active:!1,open:!1}:u),{kind:"reasoning",text:"",active:!0,open:!0}]}})};case"reasoning_delta":return{...e,messages:Ae(e.messages,(t,s,u)=>t.kind==="reasoning"&&Ft(u,o=>o.kind==="reasoning")===s,t=>t.kind==="reasoning"?{...t,text:t.text+r.text}:t)};case"reasoning_end":return{...e,messages:te(e.messages,t=>{const s=t.blocks??[],u=Ft(s,a=>a.kind==="reasoning"&&a.active);if(u<0)return t;const o=s[u];if(o.kind!=="reasoning")return t;const p=s[u-1];return(p==null?void 0:p.kind)==="reasoning"&&p.text===o.text?{...t,blocks:s.filter((a,h)=>h!==u)}:{...t,blocks:s.map((a,h)=>h===u?{...o,active:!1,open:!1}:a)}})};case"tool_call":return{...e,messages:te(e.messages,t=>{const s=Re(t);return{...s,blocks:[...s.blocks??[],{kind:"tool",id:r.id,name:r.name,args:r.args,status:"running",open:!1}]}})};case"tool_call_start":return{...e,messages:te(e.messages,t=>{const s=Re(t);return{...s,blocks:[...s.blocks??[],{kind:"tool",schema_version:2,id:r.id,name:r.name,args:{},argumentText:"",argumentState:"streaming",arguments_redacted:r.redacted,status:"running",open:!1}]}})};case"tool_call_arguments_delta":return{...e,messages:Ae(e.messages,t=>t.kind==="tool"&&t.id===r.id,t=>t.kind==="tool"?{...t,args:r.partial_args,argumentText:r.snapshot?r.delta:`${t.argumentText??""}${r.delta}`,arguments_redacted:t.arguments_redacted||r.redacted}:t)};case"tool_call_arguments_done":return{...e,messages:Ae(e.messages,t=>t.kind==="tool"&&t.id===r.id,t=>t.kind==="tool"?{...t,args:r.args,argumentText:JSON.stringify(r.args),argumentState:"done",arguments_redacted:t.arguments_redacted||r.redacted}:t)};case"app_start":return{...e,messages:te(e.messages,t=>{const s=Re(t);return{...s,blocks:[...s.blocks??[],{kind:"app",schema_version:1,instance_id:r.instance_id,provider:r.provider,server:r.server,tool:r.tool,resource_uri:r.resource_uri,status:"loading",input:r.input,result:{content:[],structuredContent:{},isError:!1},csp:{},permissions:{clipboardWrite:!0},height:525}]}})};case"app_result":return{...e,messages:Ae(e.messages,t=>t.kind==="app"&&t.instance_id===r.id,t=>t.kind==="app"?{...t,status:r.status,result:r.result}:t)};case"tool_result":return{...e,messages:Ae(e.messages,t=>t.kind==="tool"&&t.id===r.id,t=>t.kind!=="tool"?t:r.status?{...t,schema_version:2,status:r.status,took_ms:r.took_ms,content:r.content,metadata:r.metadata,open:r.status!=="success"}:{...t,status:"done",hits:r.hits,took_ms:r.took_ms,results:r.results})};case"artifact_start":return{...e,messages:te(e.messages,t=>{const s=Re(t);return{...s,blocks:[...s.blocks??[],{kind:"artifact",schema_version:1,scope:"owner",publication_id:r.publication_id,identifier:r.identifier,artifact_kind:"posterly",title:r.title,status:"generating",phase:"publishing_poster"}]}})};case"artifact_ready":return{...e,messages:Ae(e.messages,t=>t.kind==="artifact"&&t.publication_id===r.publication_id,t=>t.kind==="artifact"?{...t,artifact_id:r.artifact_id,version_id:r.version_id,identifier:r.identifier,version:r.version,title:r.title,status:"ready",preview_mime:r.preview_mime,source_language:r.source_language,gate_status:r.gate_status,total_bytes:r.total_bytes,phase:void 0}:t)};case"artifact_error":return{...e,messages:Ae(e.messages,t=>t.kind==="artifact"&&t.publication_id===r.publication_id,t=>t.kind==="artifact"?{...t,status:"error",phase:void 0,error_code:r.code,error_message:r.message}:t)};case"answer_delta":return{...e,messages:te(e.messages,t=>{const s=Re(t),u=s.blocks??[],o=u.at(-1);return(o==null?void 0:o.kind)==="answer"&&!o.done?{...s,blocks:[...u.slice(0,-1),{...o,text:o.text+r.text}]}:{...s,blocks:[...u,{kind:"answer",text:r.text,done:!1}]}})};case"done":return{...e,phase:"complete",messages:te(e.messages,t=>({...t,streaming:!1,compacting:!1,followups:r.followups,finishReason:r.finish_reason,citations:r.citations,blocks:(t.blocks??[]).map(s=>s.kind==="answer"?{...s,done:!0}:s.kind==="reasoning"&&s.active?{...s,active:!1,open:!1}:s)}))};case"error":return{...e,phase:"failed",messages:te(e.messages,t=>({...t,streaming:!1,compacting:!1,error:r.message,errorCode:r.code,blocks:(t.blocks??[]).map(s=>s.kind==="reasoning"&&s.active?{...s,active:!1,open:!1}:s.kind==="tool"&&s.status==="running"?{...s,status:"error",open:!0}:s)}))};default:return e}}function fs(e){return te(e,r=>{if(r.role!=="assistant")return r;const t=(r.blocks??[]).flatMap(s=>s.kind==="tool"&&s.status==="running"?[{...s,status:"error",open:!0}]:s.kind==="reasoning"&&s.active?s.text?[{...s,active:!1,open:!1}]:[]:s.kind==="answer"?[{...s,done:!0}]:[s]);return{...r,blocks:t,streaming:!1,compacting:!1,finishReason:"stopped"}})}function hs(e,r){switch(r.type){case"start":return{messages:r.messages,sessionId:r.sessionId,title:"",phase:"streaming"};case"event":return ps(e,r.event);case"load":return{messages:r.messages,sessionId:r.sessionId,title:e.title,phase:"idle"};case"workspace_status":return{...e,messages:te(e.messages,t=>{var s;return t.role==="assistant"&&t.streaming&&(((s=t.blocks)==null?void 0:s.length)??0)===0&&!t.error?{...t,status:Qt}:t})};case"clear_workspace_status":return{...e,messages:te(e.messages,Re)};case"settle":return{...e,phase:"idle",messages:te(e.messages,t=>t.streaming?{...t,streaming:!1,compacting:!1}:t)};case"stop":return{...e,messages:fs(e.messages),phase:"stopped"};case"toggle_block":return{...e,messages:Jt(e.messages,r.messageId,r.blockIndex)};case"reset":return Gt()}}function Jt(e,r,t){return e.map(s=>{var u;return s.id!==r?s:{...s,blocks:(u=s.blocks)==null?void 0:u.map((o,p)=>p===t&&(o.kind==="reasoning"||o.kind==="tool")?{...o,open:!o.open}:o)}})}const Ee={minDelayMs:5,maxDelayMs:80,minRateCharsPerMs:.3,maxBufferedMs:400,arrivalRateTauMs:1e3,arrivalRateHeadroom:1.1,maxPendingChars:64},ms={now:()=>performance.now(),sleep:(e,r)=>new Promise(t=>{if(r!=null&&r.aborted||e<=0){t();return}const s=window.setTimeout(u,e);function u(){r==null||r.removeEventListener("abort",u),window.clearTimeout(s),t()}r==null||r.addEventListener("abort",u,{once:!0})})};function gs(e){return!["stream_start","sandbox_start","sandbox_ready","workspace_ready","session_title_start","session_title_delta","session_title_done"].includes(e.type)}function ys(e,r=!1,t=Ee.maxPendingChars){var u;if(!e)return{pieces:[],pending:""};if(r)return{pieces:[e],pending:""};const s=Intl.Segmenter;if(s){const p=[...new s(void 0,{granularity:"word"}).segment(e)].filter(h=>h.isWordLike);let a=0;if(p.length>1&&(a=p.at(-1).index),p.length&&/\s$/u.test(e)&&(a=e.length),a>0){const h=e.slice(0,a),L=[],S=[...new s(void 0,{granularity:"word"}).segment(h)].filter(A=>A.isWordLike);for(let A=0;AB&&L.push(h.slice(B,O))}return S.length||L.push(h),{pieces:L,pending:e.slice(a)}}}else{const o=[...e.matchAll(/\s+/gu)];if(o.length){const p=[];let a=0;for(const h of o){const L=h.index+h[0].length;p.push(e.slice(a,L)),a=L}return{pieces:p,pending:e.slice(a)}}}return e.length>=t?{pieces:[e.slice(0,t)],pending:e.slice(t)}:{pieces:[],pending:e}}function _s(e,r={}){const t={minDelayMs:r.minDelayMs??Ee.minDelayMs,maxDelayMs:r.maxDelayMs??Ee.maxDelayMs,minRateCharsPerMs:r.minRateCharsPerMs??Ee.minRateCharsPerMs,maxBufferedMs:r.maxBufferedMs??Ee.maxBufferedMs,arrivalRateTauMs:r.arrivalRateTauMs??Ee.arrivalRateTauMs,arrivalRateHeadroom:r.arrivalRateHeadroom??Ee.arrivalRateHeadroom,maxPendingChars:r.maxPendingChars??Ee.maxPendingChars},s=r.clock??ms,u=[];let o="",p=null,a=0,h=!0,L=!1,v=null,S=0,A=s.now(),B=!1;const O=()=>{v==null||v(),v=null},k=(w,T)=>{const C=w.type==="reasoning_delta"||w.type==="answer_delta"?w.text.length:0;u.push({kind:"event",event:w,arrivedAt:T,chars:C}),O()},j=w=>{if(!p||!o)return;const T=ys(o,w,t.maxPendingChars);for(const C of T.pieces)C&&k({type:p,text:C},a),a=s.now();o=T.pending,o||(p=null)},W=w=>{if(!h)return;const T=s.now();if(w.type==="reasoning_delta"||w.type==="answer_delta"){const C=w.type;if(!w.text)return;if(!B){B=!0,S+=w.text.length,A=T;const V=Array.from(w.text)[0];k({type:C,text:V},T);const $=w.text.slice(V.length);if($)for(p=C,o=$,a=T,j(!1);o.length>=t.maxPendingChars;)j(!1);return}p&&p!==C&&j(!0),p||(p=C,a=T),o+=w.text;const _=Math.max(0,T-A);for(S*=Math.exp(-_/t.arrivalRateTauMs),S+=w.text.length,A=T,j(!1);o.length>=t.maxPendingChars;)j(!1);return}gs(w)&&j(!0),k(w,T)},U=(async()=>{var w;try{for await(const T of e)W(T);h&&j(!0)}catch(T){h&&!((w=r.signal)!=null&&w.aborted)&&(j(!0),u.push({kind:"error",error:T,arrivedAt:s.now(),chars:0}))}finally{L=!0,O()}})(),se=()=>u.length||L?Promise.resolve():new Promise(w=>{v=w});return{events:async function*(){var T,C,_,V;let w=Number.NEGATIVE_INFINITY;try{for(;;){if(await se(),!u.length){if(L||!h)return;continue}const $=u[0];if($.kind==="error")throw u.shift(),$.error;if($.chars&&!((T=r.isHidden)!=null&&T.call(r))){const F=s.now(),ne=u.reduce((ae,ie)=>ae+ie.chars,0),ue=((C=u.find(ae=>ae.chars))==null?void 0:C.arrivedAt)??F,z=Math.max(0,t.maxBufferedMs-(F-ue)),J=S*Math.exp(-Math.max(0,F-A)/t.arrivalRateTauMs)/t.arrivalRateTauMs,m=z>0?ne/z:Number.POSITIVE_INFINITY,I=Math.max(t.minRateCharsPerMs,J*t.arrivalRateHeadroom,m),i=Math.min(t.maxDelayMs,Math.max(t.minDelayMs,$.chars/I)),M=Math.max(0,$.arrivedAt+t.maxBufferedMs-F),P=Math.max($.arrivedAt,w+Math.min(i,M));if(await s.sleep(Math.max(0,P-s.now()),r.signal),!h||(_=r.signal)!=null&&_.aborted)return}u.shift(),w=s.now(),yield $.event}}finally{h&&(h=!1,O(),await((V=e.return)==null?void 0:V.call(e,void 0))),await U}}(),takeAcceptedForStop(){var T;if(!h)return[];h=!1,p&&o&&(k({type:p,text:o},a),o="",p=null);const w=u.flatMap(C=>C.kind==="event"&&C.event.type!=="done"&&C.event.type!=="error"?[C.event]:[]);return u.length=0,O(),(T=e.return)==null||T.call(e,void 0),w}}}const Ot=[250,500,1e3],bs=(e,r)=>new Promise(t=>{const s=()=>{window.clearTimeout(u),r.removeEventListener("abort",s),t()},u=window.setTimeout(s,e);r.addEventListener("abort",s,{once:!0})});async function*ws(e,r){let t=e,s=0;for(;;){let u=!1;try{for await(const o of t)(o.type==="done"||o.type==="error")&&(u=!0),yield o;if(u||r.signal.aborted)return;throw new Tt}catch(o){r.onDisconnect();const p=r.getSessionId();if(r.signal.aborted||u||!(o instanceof Tt)||!p||s>=Ot.length)throw o;if(await bs(Ot[s],r.signal),r.signal.aborted)return;s+=1,t=Yt(p,{signal:r.signal,afterSequence:r.getAfterSequence(),onSequence:r.onSequence})}}}const qt=new Set(["openrouter_monthly_budget_exhausted","openrouter_unavailable","openrouter_byok_credential_invalid","openrouter_byok_billing_error","openrouter_byok_rate_limit","hf_inference_billing_exhausted"]),xs=new Set(["paper_context_unavailable","paper_mention_unavailable","paper_mentions_disabled","paper_selection_disabled","paper_selection_requires_reader","paper_selection_paper_mismatch","paper_selection_version_mismatch","paper_selection_page_invalid","paper_selection_too_large","chat_storage_quota_exceeded"]);class vs{constructor(){ee(this,"configuration");ee(this,"lifecycle",Gt());ee(this,"_busy",!1);ee(this,"_pendingCapacity",null);ee(this,"_sawStreamStart",!1);ee(this,"_providerExecuted",!1);ee(this,"_providerStatusChanged",!1);ee(this,"terminal","pending");ee(this,"rejection",null)}get busy(){return this._busy}get pendingCapacity(){return this._pendingCapacity}get sawStreamStart(){return this._sawStreamStart}get sawTerminalEvent(){return this.terminal==="complete"||this.terminal==="error"}get streamFailed(){return this.terminal==="error"||this.terminal==="transport_error"}get admissionRejected(){return this.rejection!==null}get shouldRefreshProvider(){return this._sawStreamStart&&this._providerExecuted||this._providerStatusChanged}finish(){this._busy=!1}queueCapacity(r){this._pendingCapacity=r}cancelCapacity(){this._pendingCapacity=null}projectSession(r){return this._busy&&r===this.sessionId?this.messages:null}get state(){return this.lifecycle}get messages(){return this.lifecycle.messages}get sessionId(){return this.lifecycle.sessionId}transition(r){return this.lifecycle=hs(this.lifecycle,r),this.lifecycle}start(r,t,s){this.configuration=s,this._busy=!0,this._sawStreamStart=this._providerExecuted=this._providerStatusChanged=!1,this.terminal="pending",this.rejection=null,this.transition({type:"start",messages:r,sessionId:t})}restore(r,t=this.sessionId){return this.transition({type:"load",messages:r,sessionId:t})}observe(r){return r.type==="stream_start"&&(this._sawStreamStart=!0,this._providerExecuted=r.provider_execution!==!1),(r.type==="done"||r.type==="error")&&(this.terminal=r.type==="done"?"complete":"error"),r.type==="error"&&qt.has(r.code??"")?(this._providerStatusChanged=!0,!0):!1}reject(r,t){const s=r instanceof nt?r.code:void 0,u=t&&s==="chat_not_busy"?"completed":s==="chat_temporarily_disabled"?"disabled":s==="chat_capacity"?"capacity":xs.has(s??"")?"draft":qt.has(s??"")?"provider":"network";return this.terminal=u==="completed"?"already_complete":"transport_error",this.rejection=u==="disabled"||u==="capacity"||u==="draft"?u:null,this._providerStatusChanged||(this._providerStatusChanged=u==="provider"),u}reset(){this._busy=!1,this._pendingCapacity=null,this.transition({type:"reset"})}}const Ss=750;function Es(e,r){for(let t=e.length-1;t>=0;t-=1)if(r(e[t]))return t;return-1}function Se(e){const r=d.useRef(e);return d.useLayoutEffect(()=>{r.current=e}),d.useCallback((...t)=>r.current(...t),[])}function Rs(e){const[r,t]=d.useState([]),[s,u]=d.useState(!1),[o,p]=d.useState(""),[a]=d.useState(()=>new vs),h=d.useRef(null),L=d.useRef(null),v=d.useRef(null),S=d.useRef(null),A=d.useRef(!1),B=d.useRef(null),O=d.useRef(null),k=d.useRef("cleared"),j=d.useRef(null),[W,U]=d.useState(null),[se,Q]=d.useState(null),w=d.useRef([]),T=d.useRef(null),C=d.useRef(!1),_=d.useRef(e),V=d.useRef(He()),$=d.useRef(0),F=d.useRef(0),ne=d.useRef(e.sessionId);if(ne.current!==e.sessionId){ne.current=e.sessionId;const c=a.projectSession(e.sessionId);c&&t(c),a.sessionId!==e.sessionId&&(F.current+=1,j.current=null)}_.current=e,w.current=r,d.useEffect(()=>()=>{var c;O.current!==null&&window.clearTimeout(O.current),(c=h.current)==null||c.abort(),L.current=null,v.current!==null&&cancelAnimationFrame(v.current),S.current!==null&&window.clearTimeout(S.current),a.cancelCapacity()},[a]),d.useEffect(()=>{a.busy||a.restore(a.messages,e.sessionId)},[e.sessionId,a]),d.useEffect(()=>{const c=a.projectSession(e.sessionId);C.current=c!==null,c&&(t(c),w.current=c)},[e.sessionId,a]);const ue=d.useMemo(()=>{const c={};for(const f of r)for(const E of f.blocks??[])if(E.kind==="tool")for(const b of E.results??[])c[b.route_id]=b;return c},[r]),z=()=>`m${++$.current}_${Date.now().toString(36)}`,J=(c,f=!0)=>{const E=a.state,b=a.transition(c),g=c.type==="event"&&c.event.type==="stream_start"?c.event.session_id:null;return g?_.current.onSessionId(g,E.sessionId,a.configuration):b.sessionId&&b.sessionId!==E.sessionId&&_.current.onSessionId(b.sessionId,E.sessionId,a.configuration),b.title!==E.title&&_.current.onTitle(b.title,b.sessionId),f&&(w.current=b.messages,t(b.messages)),b},m=()=>T.current===F.current||C.current,I=()=>{v.current!==null&&(cancelAnimationFrame(v.current),v.current=null),S.current!==null&&(window.clearTimeout(S.current),S.current=null)},i=()=>{I(),document.visibilityState!=="hidden"&&C.current&&(A.current=!1,w.current=a.messages,t(a.messages))},M=()=>{if(!C.current||document.visibilityState==="hidden"||v.current!==null||S.current!==null)return;const c=()=>{v.current=null,S.current=null,i()};typeof requestAnimationFrame=="function"?v.current=requestAnimationFrame(c):S.current=window.setTimeout(c,0)};d.useEffect(()=>{const c=()=>{document.visibilityState==="visible"&&A.current&&M()};return document.addEventListener("visibilitychange",c),()=>document.removeEventListener("visibilitychange",c)});const P=c=>{if(h.current!==c||(O.current!==null&&(window.clearTimeout(O.current),O.current=null),k.current==="cleared"))return;const f=k.current==="shown";k.current="cleared",f&&J({type:"clear_workspace_status"},m())},ae=(c,f)=>{O.current!==null&&window.clearTimeout(O.current),k.current="armed",O.current=window.setTimeout(()=>{O.current=null,!(k.current!=="armed"||h.current!==c||c.signal.aborted||F.current!==f)&&(k.current="shown",J({type:"workspace_status"},m()))},Ss)},ie=(c,f)=>{const E=j.current;!E||E.controller!==c||E.tracker.recordStreamStart(f,performance.now())},fe=(c,f)=>{const E=j.current;!E||E.controller!==c||E.tracker.recordTerminal(f)};d.useLayoutEffect(()=>{const c=j.current;if(!c)return;const f=r.at(-1);if((f==null?void 0:f.role)!=="assistant"||!(f.blocks??[]).some(g=>g.kind==="tool"||g.kind==="reasoning"&&!!g.text.trim()||g.kind==="answer"&&!!g.text.trim()))return;const b=performance.now();c.tracker.recordFirstVisible(b);for(const g of f.blocks??[])g.kind==="reasoning"&&g.text.trim()?c.tracker.recordSemantic("reasoning",b):g.kind==="tool"?c.tracker.recordSemantic("tool",b):g.kind==="answer"&&g.text.trim()&&c.tracker.recordSemantic("answer",b)},[r]);const ge=(c,f=!0)=>{J({type:"event",event:c},f)},Ke=async(c,f)=>{var g;const E=await(_.current.loadSession??ut)(c);let b=$t(E);return((g=B.current)==null?void 0:g.sessionId)===c&&(b=B.current.messages,B.current=null),F.current!==f&&!(T.current===f&&C.current&&_.current.sessionId===c)?null:(t(b),w.current=b,a.restore(b,c),b)},Ie=(c,f,E,b,g,H,K)=>{const y=++F.current;T.current=y,C.current=!0;const N=new AbortController;h.current=N;const he=c.text;return V.current=c,p(""),t(E),a.start(E,f.session_id,K??{model:_.current.initialModel,webSearchEnabled:!!f.web_search_enabled,reasoningEffort:f.reasoning_effort??Le}),u(!0),j.current=H?null:{controller:N,tracker:new ds(performance.now())},k.current="cleared",(async()=>{var X,G,_e,re,ve,qe;let oe=0;const ce=Y=>{Y>oe&&(oe=Y)};try{const Y=H?Yt(H,{signal:N.signal,onSequence:ce}):Nr(f,{signal:N.signal,onSequence:ce}),q=ws(Y,{signal:N.signal,getSessionId:()=>a.sessionId,onDisconnect:()=>{!N.signal.aborted&&h.current===N&&ge({type:"compaction_status",state:"finished"},m())},getAfterSequence:()=>oe,onSequence:ce}),Z=!H&&Ue()&&Dr(),pe=Z?_s(q,{signal:N.signal,isHidden:()=>document.visibilityState==="hidden"}):null;pe&&(L.current={controller:N,stream:pe});for await(const D of(pe==null?void 0:pe.events)??q){if(N.signal.aborted||h.current!==N)break;D.type==="paper_artifact"&&((G=(X=_.current).onPaperArtifact)==null||G.call(X,D,a.sessionId)),D.type==="stream_start"&&ie(N,D.request_id),D.type==="sandbox_start"&&ae(N,y),(D.type==="sandbox_ready"||D.type==="workspace_ready"||D.type==="lifecycle")&&P(N),(D.type==="reasoning_start"||D.type==="reasoning_delta"||D.type==="tool_call"||D.type==="tool_call_start"||D.type==="tool_call_arguments_delta"||D.type==="tool_call_arguments_done"||D.type==="app_start"||D.type==="app_result"||D.type==="artifact_start"||D.type==="artifact_ready"||D.type==="artifact_error"||D.type==="answer_delta"||D.type==="done"||D.type==="error")&&P(N),a.observe(D)&&m()&&_.current.onInterrupted(c),(D.type==="done"||D.type==="error")&&fe(N,D.type==="error"?"error":"complete");const ke=m(),$e=ke&&!(Z&&document.visibilityState==="hidden"),Ze=D.type==="reasoning_delta"||D.type==="answer_delta"||D.type==="tool_call_arguments_delta",Be=!["stream_start","sandbox_start","sandbox_ready","workspace_ready","session_title_start","session_title_delta","session_title_done","reasoning_delta","answer_delta","tool_call_arguments_delta"].includes(D.type);Z&&Be&&i(),Z&&Ze?(ge(D,!1),A.current||(A.current=ke),M()):(ge(D,$e),Z&&ke&&!$e&&(A.current=!0))}}catch(Y){if(!N.signal.aborted&&h.current===N){const q=a.reject(Y,!!H),Z=q==="completed";if(P(N),!Z)if(q==="disabled")Q({question:he,draft:c}),a.restore(b),F.current===y&&(t(b),w.current=b,p(""));else if(q==="capacity"){const pe=Y instanceof nt?Y.retryAfterSeconds??5:5,D={question:he,draft:c,request:f,optimistic:E,original:b,edit:g,retryAfterSeconds:pe,retryAt:Date.now()+pe*1e3};a.queueCapacity(D),U({question:he,draft:c,retryAt:D.retryAt,retryAfterSeconds:pe}),a.restore(b),F.current===y&&(t(b),w.current=b,p(""))}else fe(N,"network_error"),q==="draft"&&(m()&&_.current.onInterrupted(c),a.restore(b),F.current===y&&(t(b),w.current=b,p(Y instanceof Error?Y.message:"The assistant stream failed."))),q==="provider"&&m()&&_.current.onInterrupted(c);!Z&&!a.admissionRejected&&F.current===y&&ge({type:"error",message:Y instanceof Error?Y.message:"The assistant stream failed.",code:Y instanceof nt?Y.code:void 0})}}finally{if(h.current===N){if(((_e=L.current)==null?void 0:_e.controller)===N&&(i(),L.current=null),P(N),!a.sawTerminalEvent&&!N.signal.aborted&&fe(N,"network_error"),a.finish(),u(!1),a.admissionRejected)_.current.onSettled(f.session_id);else if(!N.signal.aborted){a.shouldRefreshProvider&&((ve=(re=_.current).onProviderTerminal)==null||ve.call(re));const Y=a.sessionId;if(g&&!a.sawStreamStart)a.restore(g.snapshot),F.current===y&&(t(g.snapshot),w.current=g.snapshot,p("Couldn’t resend this message. Your original conversation was restored."));else if(Y){F.current===y&&g&&(a.streamFailed||!a.sawTerminalEvent)&&(a.restore(g.snapshot),t(g.snapshot),w.current=g.snapshot);try{const q=await Ke(Y,y);q&&g&&q.some(Z=>Z.id===g.targetId)&&p("Couldn’t resend this message. Your original conversation was restored.")}catch{F.current===y&&J({type:"settle"})}}else F.current===y&&J({type:"settle"});(!h.current||h.current===N)&&_.current.onSettled(Y)}((qe=j.current)==null?void 0:qe.controller)===N&&(j.current=null)}}})(),!0},je=Se(c=>{var ce,X;const f=typeof c=="string"?He(c.trim()):c,E=f.text;if(!E||E.length>8e3||a.busy||a.pendingCapacity)return!1;const b=w.current,g=[...b].reverse().find(G=>G.role==="user"),H=g!=null&&g.status&&g.status!=="complete"&&g.revision?{replace_message_id:g.id,prior_revision:g.revision}:null,K={id:z(),role:"user",text:E,paperMentions:f.paperMentions,paperSelection:f.paperSelection},y={id:z(),role:"assistant",streaming:!0,blocks:[]},N=H&&g?Es(b,G=>G.id===g.id):-1,he=N<0?[...b,K,y]:[...b.slice(0,N),K,y],oe=(X=(ce=_.current).viewerContext)==null?void 0:X.call(ce);return Ie(f,{message:E,paper_mentions:f.paperMentions.map(({route_id:G,title:_e,start:re,end:ve})=>({route_id:G,title:_e,start:re,end:ve})),session_id:_.current.sessionId,client_message_id:crypto.randomUUID(),web_search_enabled:!!_.current.webSearchEnabled,reasoning_effort:_.current.reasoningEffort??Le,..._.current.primaryPaperRouteId?{primary_paper_route_id:_.current.primaryPaperRouteId}:{},...oe?{viewer_context:oe}:{},...f.paperSelection?{paper_selection:Mt(f.paperSelection)}:{},...!_.current.sessionId&&_.current.initialModel?{initial_model:_.current.initialModel}:{},...H??{}},he,b)}),xe=Se((c,f)=>{var ce,X;const E=typeof f=="string"?He(f.trim()):f,b=E.text;if(!b||b.length>8e3||a.busy||a.pendingCapacity)return!1;const g=w.current.slice(),H=g.findIndex(G=>G.id===c&&G.role==="user");if(H<0)return!1;const K=g[H];if(!_.current.sessionId||!K.revision)return!1;const y={id:K.id,role:"user",text:b,paperMentions:E.paperMentions,paperSelection:E.paperSelection,revision:K.revision+1,status:"generating"},N={id:z(),role:"assistant",streaming:!0,blocks:[]},he=[...g.slice(0,H),y,N],oe=(X=(ce=_.current).viewerContext)==null?void 0:X.call(ce);return Ie(E,{message:b,paper_mentions:E.paperMentions.map(({route_id:G,title:_e,start:re,end:ve})=>({route_id:G,title:_e,start:re,end:ve})),session_id:_.current.sessionId,client_message_id:crypto.randomUUID(),web_search_enabled:!!_.current.webSearchEnabled,reasoning_effort:_.current.reasoningEffort??Le,..._.current.primaryPaperRouteId?{primary_paper_route_id:_.current.primaryPaperRouteId}:{},...oe?{viewer_context:oe}:{},...E.paperSelection?{paper_selection:Mt(E.paperSelection)}:{},replace_message_id:K.id,prior_revision:K.revision},he,g,{targetId:K.id,snapshot:g})}),de=Se(()=>{const c=w.current.slice(),f=[...c].reverse().find(g=>g.role==="user");if(!_.current.sessionId||!(f!=null&&f.revision)||a.busy||a.pendingCapacity)return!1;const E=He(f.text??"Continue the interrupted response from saved progress."),b=[...c,{id:z(),role:"user",text:E.text,paperMentions:[]},{id:z(),role:"assistant",streaming:!0,blocks:[]}];return Ie(E,{message:E.text,session_id:_.current.sessionId,client_message_id:crypto.randomUUID(),retry_message_id:f.id,..._.current.primaryPaperRouteId?{primary_paper_route_id:_.current.primaryPaperRouteId}:{},web_search_enabled:!!_.current.webSearchEnabled,reasoning_effort:_.current.reasoningEffort??Le},b,c)}),Te=Se(()=>{const c=[...w.current].reverse().find(f=>f.role==="user");return c!=null&&c.text?xe(c.id,{text:c.text,paperMentions:c.paperMentions??[],...c.paperSelection?{paperSelection:c.paperSelection}:{}}):!1}),We=d.useCallback(()=>{a.cancelCapacity(),U(null)},[a]),ye=Se(()=>{const c=a.pendingCapacity;return!c||Date.now(){var K,y;if(!h.current)return;const c=h.current;P(c),fe(c,"stopped"),c.abort();const f=((K=L.current)==null?void 0:K.controller)===c?L.current.stream.takeAcceptedForStop():[];L.current=null;for(const N of f)ge(N,!1);i(),h.current=null,((y=j.current)==null?void 0:y.controller)===c&&(j.current=null),a.finish(),u(!1);const E=m(),b=J({type:"stop"},!1).messages;E&&(w.current=b,t(b),_.current.onInterrupted(V.current));const g=a.sessionId;g&&(B.current={sessionId:g,messages:b}),g&&Mr(g).catch(()=>{});const H=++F.current;window.setTimeout(()=>{g&&E&&F.current===H?Ke(g,H).catch(()=>{}).finally(()=>{h.current||_.current.onSettled(g)}):h.current||_.current.onSettled(g)},450)}),Ne=Se((c,f)=>{const E=C.current?a.transition({type:"toggle_block",messageId:c,blockIndex:f}).messages:Jt(w.current,c,f);w.current=E,t(E)}),Ye=d.useCallback(()=>{var c;F.current+=1,O.current!==null&&(window.clearTimeout(O.current),O.current=null),k.current="cleared",(c=h.current)==null||c.abort(),h.current=null,L.current=null,I(),A.current=!1,B.current=null,j.current=null,U(null),a.reset(),T.current=null,C.current=!1,t([]),u(!1),p("")},[a]),Oe=Se((c,f,E=!1,b)=>{var g;if(F.current+=1,O.current!==null&&(window.clearTimeout(O.current),O.current=null),k.current="cleared",I(),A.current=!1,j.current=null,a.cancelCapacity(),U(null),a.busy&&f!==void 0&&f===a.sessionId){C.current=!0,t(a.messages),w.current=a.messages,p("");return}if(C.current=!1,a.busy||((g=h.current)==null||g.abort(),h.current=null,T.current=null,C.current=!1),E&&f&&!a.busy){const H=[...c].reverse().find(K=>K.role==="user");if(H){const K={text:H.text??"",paperMentions:H.paperMentions??[],...H.paperSelection?{paperSelection:H.paperSelection}:{}},y=[...c,{id:`${H.id}-active`,role:"assistant",streaming:!0,blocks:[]}];Ie(K,{message:K.text,session_id:f,client_message_id:"reconnect",web_search_enabled:!!_.current.webSearchEnabled,reasoning_effort:_.current.reasoningEffort??Le},y,c,void 0,f,b);return}}t(c),w.current=c,a.busy||a.restore(c,f??_.current.sessionId),a.busy||u(!1),p("")});return{messages:r,busy:s,activeSessionId:s?a.sessionId:null,activeTitle:a.state.title,activeConfiguration:a.configuration,selectedBusy:s&&a.sessionId===e.sessionId,papers:ue,sessionError:o,capacityRequest:W,disabledRequest:se,send:je,editAndResend:xe,retryFromProgress:de,retryLatest:Te,retryCapacity:ye,cancelCapacity:We,dismissDisabled:()=>Q(null),stop:Me,toggleBlock:Ne,reset:Ye,load:Oe}}const Xt=["chat","openai","usage"],Is=90,Zt="pwc:chat:openai-credits-notice:dismissed";function ks(e=!0){return Pe({queryKey:Xt,queryFn:()=>Xe.getOpenAIUsage(),enabled:e,staleTime:3e4,retry:!1,refetchOnWindowFocus:!0})}function Cs(e,r,t){if(!e||r!=="openai"||e.used_percent["chatSessions",e],detail:(e,r)=>["chatSession",e,r]},Ts=e=>Vt({queryKey:Fe.list(e),queryFn:Lr,staleTime:0,refetchOnWindowFocus:!1,retry:!1}),Bt=(e,r)=>Vt({queryKey:Fe.detail(e,r),queryFn:()=>{if(!r)throw new Error("A saved conversation is required");return ut(r)},staleTime:0,refetchOnWindowFocus:!1,retry:!1}),me=He,Ms=["Summarize the main contributions","Explain in simple terms","Identify the main limitations"],Ns=()=>{const e=sessionStorage.getItem(Je);if(!e)return null;try{return Yr(JSON.parse(e),e)}catch{}return me(e)},Ds=({enabled:e,workspaceKey:r,children:t,onAskAiFix:s})=>e?n.jsx(Sr,{workspaceKey:r,onAskAiFix:s,children:t}):n.jsx(n.Fragment,{children:t}),Ls=({enabled:e,children:r})=>e?n.jsx(Er,{variant:"chat",children:r}):n.jsx(n.Fragment,{children:r}),Fs=({mode:e="general",routeSessionId:r,primaryPaper:t,currentPage:s,paperSelection:u,onPaperSelectionChange:o,onSessionId:p,onReaderSubmit:a,onReaderNewChat:h,onReaderClose:L})=>{var ht,mt,gt,yt,_t,bt,wt,xt,vt,St,Et,Rt,It,kt;const{sessionId:v}=lr(),S=r??(e==="general"?v:void 0),A=ur(),[B,O]=dr(),{user:k,isLoading:j}=Ut(),W=pr(),U=(k==null?void 0:k.hf_subject)??null,se=_r(),Q=Pe({queryKey:["chatAvailability"],queryFn:()=>Xe.getAvailability(),refetchInterval:3e4,retry:!1,enabled:Ue()&&!!k}),w=((ht=Q.data)==null?void 0:ht.status)==="paused"||e==="paper"&&((mt=Q.data)==null?void 0:mt.paper_reader_chat_enabled)===!1,T=Pe({...Ts(U),enabled:!!k&&!j}),C=T.data??[],[_,V]=d.useState(null),[$,F]=d.useState(""),ne=l=>{W.setQueryData(Fe.list(U),x=>l(x??[]))},ue=(l,x)=>{ne(R=>R.map(le=>le.id===l?{...le,...x}:le)),W.setQueryData(Fe.detail(U,l),R=>R&&{...R,...x})},z=d.useRef(Fr()),J=d.useRef(B.get("model")||((gt=z.current)==null?void 0:gt.model)),[m,I]=d.useState(se?Or:qr),[i,M]=d.useState(J.current||st),P=Br(m,i),ae=Pr(m,i),ie=P==="huggingface"&&!ae,fe=zr(!!(k&&P==="openrouter")),ge=ks(Ue()&&!!k&&P==="openai"),[Ke,Ie]=d.useState(()=>As()),je=Cs(ge.data,P,Ke),[xe,de]=d.useState(()=>me()),Te=Le,We=!!((yt=Q.data)!=null&&yt.web_search_available),[ye,Me]=d.useState(()=>{var x,R;const l=(x=B.get("q"))==null?void 0:x.trim();return l?me(l):((R=z.current)==null?void 0:R.draft)??me()}),Ne=d.useRef(!1),Ye=d.useRef(!1),Oe=d.useRef(!1),[c,f]=d.useState(()=>typeof window>"u"||window.innerWidth>900),E=d.useRef(new Set),b=d.useRef(S);b.current=S;const[g,H]=d.useState(void 0),K=d.useCallback(async()=>{await W.invalidateQueries({queryKey:Fe.list(U)})},[W,U]),y=Rs({sessionId:S??null,initialModel:i,webSearchEnabled:We,reasoningEffort:Te,primaryPaperRouteId:e==="paper"?t==null?void 0:t.routeId:void 0,viewerContext:e==="paper"&&s?()=>({page:Math.max(1,Math.min(1e4,s()))}):void 0,loadSession:async l=>{const x=await W.fetchQuery(Bt(U,l));return V(R=>(R==null?void 0:R.sessionId)===l?null:R),x},onSessionId:(l,x,R)=>{W.cancelQueries({queryKey:Fe.list(U)});const le=new Date().toISOString();ne(we=>we.some(Ce=>Ce.id===l)?we.map(Ce=>Ce.id===l?{...Ce,is_busy:!0}:Ce):[{id:l,title:"New chat",selected_model:(R==null?void 0:R.model)??i,created_at:le,updated_at:le,message_count:1,is_busy:!0,web_search_enabled:(R==null?void 0:R.webSearchEnabled)??We,reasoning_effort:(R==null?void 0:R.reasoningEffort)??Te},...we]),(b.current??null)===x&&l!==x&&(e==="paper"?p==null||p(l):A(`/chat/${l}`,{replace:!0}))},onTitle:(l,x)=>{x&&!E.current.has(x)&&ue(x,{title:l})},onSettled:l=>{l&&ue(l,{is_busy:!1}),W.invalidateQueries({queryKey:Xt}),K()},onProviderTerminal:()=>{W.invalidateQueries({queryKey:Gr})},onPaperArtifact:(l,x)=>{x&&V({sessionId:x,descriptor:l.descriptor})},onInterrupted:l=>{de(l),o==null||o(l.paperSelection)}}),N=y.send;d.useEffect(()=>{y.capacityRequest&&(de(y.capacityRequest.draft),o==null||o(y.capacityRequest.draft.paperSelection))},[y.capacityRequest,o]);const he=d.useCallback(l=>{sessionStorage.setItem(Je,JSON.stringify(l)),sessionStorage.setItem(Qe,i),sessionStorage.setItem(Hr,Te),sessionStorage.setItem(ze,"1"),sessionStorage.setItem(Ge,"1");const x=e==="paper"&&t?`/pdf/${t.routeId}`:b.current?`/chat/${b.current}`:"/chat";window.location.href=fr(x,ie)},[e,t,Te,i,ie]),oe=d.useCallback((l,x)=>{sessionStorage.setItem(Je,JSON.stringify(l)),sessionStorage.setItem(Qe,i),sessionStorage.removeItem(ze),sessionStorage.removeItem(Ge),Me(me()),de(l),o==null||o(l.paperSelection),F(x)},[o,i]),ce=d.useCallback(async l=>{const x=o?u?{...l,paperSelection:u}:{text:l.text,paperMentions:l.paperMentions}:l;if(!k){he(x);return}if(ie&&!Ye.current){if(Oe.current)return;Oe.current=!0;try{if(!(await Xe.getInferenceBilling()).connected){if(sessionStorage.getItem(Ge)==="1"){oe(x,"Hugging Face inference authorization was not completed. Your prompt is ready to retry.");return}he(x);return}Ye.current=!0}catch(R){oe(x,R instanceof Error?R.message:"Could not check Hugging Face authorization.");return}finally{Oe.current=!1}}if(sessionStorage.removeItem(ze),!N(x)){oe(x,"Your prompt was not sent. It is ready to retry.");return}sessionStorage.removeItem(Je),sessionStorage.removeItem(Qe),sessionStorage.removeItem(Ge),Ur(),z.current=null,de(me()),o==null||o(void 0),e==="paper"&&(a==null||a())},[he,e,o,a,u,oe,N,k,ie]);d.useEffect(()=>{if(j||!k)return;const l=sessionStorage.getItem(Qe);l&&M(l),Kr().then(le=>{if(I(le.items),!b.current){const we=J.current||l;M(we&&le.items.some(Ce=>Ce.id===we)?we:le.default_model)}});const x=Ns(),R=sessionStorage.getItem(ze)==="1";x&&(o==null||o(x.paperSelection),R?Me(x):de(x))},[j,o,K,k]);const X=y.selectedBusy,{load:G,activeConfiguration:_e}=y,re=Pe({...Bt(U,S??null),enabled:!!(S&&k&&!j&&!X),refetchOnMount:"always"}),ve=!j&&(!k||re.error instanceof hr&&re.error.status===404),qe=Pe({queryKey:["chatSessionPublicShare",S],queryFn:()=>Xe.getSessionPublicShare(S??""),enabled:e==="general"&&!!S&&ve,retry:!1}),Y=(_t=qe.data)==null?void 0:_t.public_path;d.useEffect(()=>{Y&&A(Y,{replace:!0})},[A,Y]);const q=re.data,Z=X||g===(S??null),pe=_&&_.sessionId===S?_.descriptor:q==null?void 0:q.latex_paper,D=(wt=(bt=[...(q==null?void 0:q.messages)??[]].reverse().find(l=>l.role==="user"&&l.viewer_context))==null?void 0:bt.viewer_context)==null?void 0:wt.page;d.useLayoutEffect(()=>{const l=S??null;if(g!==l){if(X){H(l);const x=_e;x&&x.model&&M(x.model);return}if(!l){G([],null),H(null);return}!q||re.isFetching||(H(l),G($t(q),l,q.is_busy,{model:q.selected_model,webSearchEnabled:q.web_search_enabled,reasoningEffort:q.reasoning_effort??"high"}),F(""),M(q.selected_model))}},[S,X,q,G,_e,re.isFetching,g]),d.useEffect(()=>{var le;if(j)return;const l=(le=B.get("q"))==null?void 0:le.trim();if(!l)return;Ne.current=!1;const x=B.get("model");x&&M(x),Me(me(l));const R=new URLSearchParams(B);R.delete("q"),R.delete("model"),O(R,{replace:!0})},[j,B,O]),d.useEffect(()=>{if(j||y.busy||!ye.text||Ne.current||k&&Q.isFetching||S&&!Z)return;const l=window.setTimeout(()=>{if(Ne.current)return;Ne.current=!0,ce(ye).finally(()=>Me(me()))},0);return()=>window.clearTimeout(l)},[j,Q.isFetching,y.busy,ye,S,Z,ce,k]),d.useEffect(()=>{const l=()=>{!k||y.busy||K()};return window.addEventListener("focus",l),()=>window.removeEventListener("focus",l)},[y.busy,K,k]);const ke=()=>{window.innerWidth<=900&&f(!1),G([],null),H(null),de(me()),o==null||o(void 0),e==="paper"?h==null||h():A("/chat")},$e=async(l,x)=>{try{const R=await Nt(l,{title:x});return E.current.add(l),ue(l,R),!0}catch(R){return F(R instanceof Error?R.message:"Rename failed"),!1}},Ze=async l=>{const x=y.busy&&l===y.activeSessionId;if(window.confirm(x?"Stop and delete this chat? This cannot be undone.":"Delete this chat? This cannot be undone.")){x&&y.stop();try{if(x){const R=Date.now()+3e3;for(;(await ut(l)).is_busy;){if(Date.now()>=R)throw new Error("Generation is still stopping. The chat was not deleted.");await new Promise(we=>window.setTimeout(we,150))}}await $r(l),l===S&&ke(),await K()}catch(R){F(R instanceof Error?R.message:"Delete failed")}}},Be=us({messages:y.messages,refreshSessions:K,resetChat:y.reset,restoreDraft:de}),er=async l=>{const x=i;if(M(l),!S)return!0;try{const R=await Nt(S,{selected_model:l});return ue(S,{selected_model:R.selected_model}),F(""),!0}catch(R){return M(x),F(R instanceof Error?R.message:"Model change failed"),!1}},tr=m.some(l=>l.id===st),rr=async()=>{await er(st)&&y.retryLatest()},sr=Xr(e==="general"),dt=C.map(l=>l.id===y.activeSessionId&&y.busy?{...l,is_busy:!0,title:E.current.has(l.id)?l.title:y.activeTitle||l.title}:l),be=dt.find(l=>l.id===S),et=(be==null?void 0:be.primary_paper)??(q==null?void 0:q.primary_paper),tt=y.messages.length===0,Ve=!!(S&&(j||k&&!Z&&!re.isError||qe.isFetching||Y)),pt=!Z&&!Ve&&((xt=re.error)==null?void 0:xt.message),nr=!!((vt=fe.data)!=null&&vt.fallback_enabled),ar=o?u?{...xe,paperSelection:u}:{text:xe.text,paperMentions:xe.paperMentions}:xe,ft={onSend:ce,busy:X,onStop:y.stop,draft:ar,onDraftChange:l=>{o?(de({text:l.text,paperMentions:l.paperMentions}),l.paperSelection!==u&&o(l.paperSelection)):de(l)},disabled:w||j||y.busy&&!X,describedBy:w?"chat-paused-description":void 0,paperMentionsEnabled:!!((St=Q.data)!=null&&St.paper_mentions_enabled),paperSelectionEnabled:((Et=Q.data)==null?void 0:Et.paper_reader_selection_enabled)===!0,paperArtifactsEnabled:e==="general"&&((Rt=Q.data)==null?void 0:Rt.paper_artifacts_enabled)===!0};return n.jsx(Ds,{enabled:e==="general",workspaceKey:S??"new-chat",onAskAiFix:l=>{ce(me(l))},children:n.jsxs("div",{className:`chat-page${e==="paper"?" chat-page--reader":""}`,style:{height:sr},children:[e==="general"&&n.jsx(os,{sessions:dt,activeSessionId:S,loading:T.isLoading,error:$||((It=T.error)==null?void 0:It.message)||"",open:c,onClose:()=>f(!1),onNew:ke,onNavigate:l=>{window.innerWidth<=900&&f(!1),A(`/chat/${l}`)},onRename:$e,onDelete:l=>void Ze(l)}),n.jsx(Ls,{enabled:e==="general",children:n.jsxs("section",{className:"chat-main","data-testid":"active-chat-pane",children:[n.jsxs("div",{className:"chat-topbar",children:[e==="general"&&!c&&n.jsx("button",{type:"button",className:"icon-btn",onClick:()=>f(!0),title:"Open sidebar",children:n.jsx(Kt,{})}),n.jsx("span",{className:"chat-topbar-title",children:Ve?(be==null?void 0:be.title)||"":(be==null?void 0:be.title)||(q==null?void 0:q.title)||(tt?"":"New chat")}),se&&n.jsx("span",{className:"chat-staging-badge",children:"Staging"}),e==="general"&&S&&et&&n.jsx(Ct,{className:"chat-reader-action",to:`/pdf/${et.route_id}`,onClick:l=>{if(!De()){l.preventDefault();return}const x=et.route_id;sessionStorage.setItem(`pwc:reader:session:${x}`,S),D&&sessionStorage.setItem(`pwc:reader:page:${x}`,String(D))},children:"Open reader"}),S&&Z&&!tt&&n.jsx(cs,{sessionId:S,busy:X,loading:Ve,hasPaperSelection:y.messages.some(l=>!!l.paperSelection),onError:F}),e==="paper"&&n.jsxs(mr,{children:[n.jsx(gr,{asChild:!0,children:n.jsx("button",{type:"button",className:"icon-btn chat-reader-icon-btn","aria-label":"Chat options",title:"Chat options",children:n.jsx(Jr,{"aria-hidden":"true"})})}),n.jsxs(yr,{align:"end",children:[n.jsx(At,{onSelect:ke,children:"New chat"}),n.jsx(At,{asChild:!0,children:n.jsx(Ct,{to:"/chat",children:"All chats"})})]})]}),e==="paper"&&L&&n.jsx("button",{type:"button",className:"icon-btn chat-reader-icon-btn",onClick:L,"aria-label":"Close chat",title:"Close chat",children:n.jsx(Pt,{"aria-hidden":"true"})})]}),je&&n.jsxs("div",{className:"chat-credits-notice",role:"status",children:[n.jsx("span",{children:je.message}),n.jsx("button",{type:"button",className:"chat-credits-notice-close","aria-label":"Dismiss credits notice",onClick:()=>{js(je.resetsAt),Ie(je.resetsAt)},children:"×"})]}),e==="general"&&pe&&n.jsx(ls,{descriptor:pe}),Ve&&!ye.text?n.jsxs("div",{className:"chat-session-loading",role:"status","aria-live":"polite",children:[n.jsx(Wt,{}),n.jsx("span",{children:"Loading conversation…"})]}):pt?n.jsxs("div",{className:"chat-session-load-error",role:"alert",children:[n.jsx("p",{children:pt}),n.jsx("button",{type:"button",onClick:()=>{re.refetch()},children:"Try again"})]}):tt&&!ye.text?n.jsx("div",{className:"chat-empty",children:n.jsxs("div",{className:"chat-empty-inner",children:[n.jsx("div",{className:"chat-empty-eyebrow",children:e==="paper"?"Paper chat":"Research chat"}),n.jsx("h1",{className:"chat-empty-title",children:e==="paper"?"Ask about this paper":n.jsxs(n.Fragment,{children:["Ask ",n.jsx("em",{children:"Papers With Code"})]})}),n.jsx("p",{className:"chat-empty-sub",children:e==="paper"?"Questions are grounded in the open paper. Add up to three other papers with @.":"Answers are grounded in a live hybrid search over papers, tasks, and benchmarks — with citations you can follow."}),se&&n.jsx("p",{className:"chat-staging-access-note",children:"This is a limited staging preview. Only approved Hugging Face users can start chats."}),n.jsx(Lt,{variant:"empty",composerProps:ft,provider:P,sponsored:ae,paused:w,error:y.sessionError,suggestions:e==="paper"?Ms:Wr})]})}):n.jsxs(n.Fragment,{children:[n.jsx(ts,{messages:y.messages,papers:y.papers,busy:X,queuedDraft:ye.text?ye:void 0,paperMentionsEnabled:!!((kt=Q.data)!=null&&kt.paper_mentions_enabled),archivePending:Be.pending,openRouterFallbackEnabled:nr,onToggleBlock:y.toggleBlock,onEditAndResend:y.editAndResend,onRetryFromProgress:y.retryFromProgress,onRetryWithLuna:tr?()=>void rr():void 0,onArchiveOld:()=>void Be.archiveOld(),onArchiveOldest:()=>void Be.archiveOldest()}),n.jsx(Lt,{variant:"followup",composerProps:ft,provider:P,sponsored:ae,paused:w,error:y.sessionError})]})]})}),y.capacityRequest&&n.jsx(rs,{retryAt:y.capacityRequest.retryAt,onCancel:y.cancelCapacity,onRetry:()=>{y.retryCapacity()&&(de(me()),o==null||o(void 0))}}),y.disabledRequest&&n.jsx(ss,{onClose:()=>{var x;const l=((x=y.disabledRequest)==null?void 0:x.draft)??xe;de(l),o==null||o(l.paperSelection),y.dismissDisabled(),Q.refetch()}})]})})},Os=e=>{const{user:r}=Ut();return n.jsx(Fs,{...e},(r==null?void 0:r.hf_subject)??"guest")},yn=()=>n.jsx(Os,{});export{Os as ChatExperience,yn as default}; + */const Jr=cr("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);function Xr(e){const[r,t]=d.useState("calc(100dvh - 60px)");return d.useLayoutEffect(()=>{if(!e)return;const s=document.querySelector(".app-header"),u=window.visualViewport,o=()=>{const a=(u==null?void 0:u.height)??window.innerHeight;t(`${Math.max(0,a-((s==null?void 0:s.offsetHeight)??0))}px`)};o();const p=new ResizeObserver(o);return s&&p.observe(s),u==null||u.addEventListener("resize",o),window.addEventListener("resize",o),()=>{p.disconnect(),u==null||u.removeEventListener("resize",o),window.removeEventListener("resize",o)}},[e]),e?r:"100%"}const Zr="https://huggingface.co/settings/inference-providers",Dt="pwc.chat.billing-notice-dismissed.v1";function es({provider:e}){const[r,t]=d.useState(()=>localStorage.getItem(Dt)==="1");return!Ue()||r||e!=="huggingface"?null:n.jsxs("div",{className:"chat-billing-notice",role:"note",children:[n.jsx("span",{children:"Hugging Face models use the inference permission granted when you start chatting. Included monthly credits are used first, then extra usage requires purchased credits. You can choose organization billing in Settings."}),n.jsxs("div",{className:"chat-billing-notice-actions",children:[n.jsx("a",{href:"/settings",children:"Review billing"}),n.jsx("a",{href:Zr,target:"_blank",rel:"noreferrer",children:"Review usage"}),n.jsx("button",{type:"button",className:"chat-billing-notice-dismiss","aria-label":"Dismiss billing notice",title:"Dismiss",onClick:()=>{localStorage.setItem(Dt,"1"),t(!0)},children:n.jsx(Pt,{size:15,"aria-hidden":"true"})})]})]})}function Lt({variant:e,composerProps:r,provider:t,sponsored:s=!1,paused:u,error:o,suggestions:p=[]}){var h;const a=n.jsxs(n.Fragment,{children:[!s&&n.jsx(es,{provider:t}),u&&n.jsx("div",{id:"chat-paused-description",className:"chat-paused-banner",role:"status",children:"Chat is temporarily disabled. You can keep browsing and editing your conversations. New research runs will return when chat is restored."}),o&&n.jsx("div",{className:"chat-composer-error",role:"alert",children:o}),n.jsx(br,{...r,...e==="empty"?{autoFocus:!0}:{placeholder:(h=r.draft)!=null&&h.text?"Edit and send again…":"Ask a follow-up…"}}),e==="empty"&&n.jsx("div",{className:"chat-examples",children:p.map(L=>n.jsx("button",{type:"button",className:"chat-example",disabled:u,onClick:()=>{var v;return r.onSend({text:L,paperMentions:[],...(v=r.draft)!=null&&v.paperSelection?{paperSelection:r.draft.paperSelection}:{}})},children:L},L))})]});return e==="empty"?a:n.jsx("div",{className:"chat-composer-wrap",children:n.jsxs("div",{className:"chat-composer-inner",children:[a,n.jsx("div",{className:"chat-composer-foot",children:Ue()?n.jsxs(n.Fragment,{children:[t==="huggingface"&&n.jsxs("span",{className:"chat-provider-attribution",children:["Powered by 🤗 ",n.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"}),"."]}),t==="openrouter"&&n.jsxs("span",{className:"chat-provider-attribution",children:["Powered by ",n.jsx("a",{href:"https://openrouter.ai",target:"_blank",rel:"noreferrer",children:"OpenRouter"}),"."]}),t==="openai"&&n.jsx("span",{className:"chat-provider-attribution",children:"Powered by OpenAI."}),n.jsx("span",{children:"The AI assistant can make mistakes. Double-check responses."})]}):n.jsx(n.Fragment,{children:"Assistant preview — responses are simulated."})})]})})}function ts({messages:e,papers:r,busy:t,queuedDraft:s,paperMentionsEnabled:u,archivePending:o,openRouterFallbackEnabled:p,onToggleBlock:a,onEditAndResend:h,onRetryFromProgress:L,onRetryWithLuna:v,onArchiveOld:S,onArchiveOldest:A}){var m,I;const[B,O]=d.useState(null),k=d.useRef(null),j=d.useRef(null),W=d.useRef("bottom"),U=d.useRef(0),se=d.useRef(0),[Q,w]=d.useState(!1),T=d.useRef(null),C=d.useCallback(i=>{W.current=i},[]),_=d.useCallback(()=>{const i=k.current;i&&w(i.scrollHeight-i.scrollTop-i.clientHeight>1)},[]),V=e.filter(i=>i.role==="user"),$=V.length,F=d.useRef($),ne=d.useRef(!1),ue=(m=V[0])==null?void 0:m.id,z=(I=V.at(-1))==null?void 0:I.id;d.useEffect(()=>{t&&O(null)},[t]),d.useLayoutEffect(()=>{const i=k.current;if(i){if($>F.current||t&&!ne.current){const M=Array.from(i.querySelectorAll("[data-message-id]")).at(-1);if(M){const P=i.getBoundingClientRect().top;U.current=i.scrollTop+M.getBoundingClientRect().top-P-24,C("question")}}if(F.current=$,ne.current=t,j.current!==null){i.scrollTop=j.current,j.current=null;return}W.current==="bottom"&&(i.scrollTop=i.scrollHeight),W.current==="question"&&(i.scrollTop=U.current,se.current=i.scrollTop)}},[e,$,t,C]),d.useLayoutEffect(_),d.useEffect(()=>{const i=k.current;if(!i)return;const M=new ResizeObserver(_);return M.observe(i),i.firstElementChild&&M.observe(i.firstElementChild),()=>M.disconnect()},[_]);const J=(i,M)=>{var P;j.current=((P=k.current)==null?void 0:P.scrollTop)??null,a(i,M)};return n.jsxs("div",{className:"chat-conversation-viewport",children:[n.jsx("div",{className:"chat-conversation",ref:k,tabIndex:0,role:"region","aria-label":"Conversation",onWheel:i=>{(i.deltaY<0||W.current==="question")&&C("free")},onTouchStart:i=>{var M;T.current=((M=i.touches[0])==null?void 0:M.clientY)??null},onTouchMove:i=>{var P;const M=(P=i.touches[0])==null?void 0:P.clientY;M!==void 0&&T.current!==null&&(M>T.current||W.current==="question")&&C("free"),T.current=M??null},onKeyDown:i=>{i.target===i.currentTarget&&((["ArrowUp","PageUp","Home"].includes(i.key)||i.key===" "&&i.shiftKey)&&C("free"),["ArrowDown","PageDown","End"," "].includes(i.key)&&W.current==="question"&&C("free"))},onScroll:i=>{const{scrollHeight:M,scrollTop:P,clientHeight:ae}=i.currentTarget,ie=M-P-ae<=1;W.current==="bottom"&&!ie&&C("free");const fe=P-se.current;W.current==="question"&&(fe>1||fe<-1&&!ie)&&C("free"),_()},children:n.jsxs("div",{className:"chat-conversation-inner",children:[e.length===0&&(s==null?void 0:s.text)&&n.jsx(jt,{id:"queued-launch-preview",text:s.text,paperMentions:s.paperMentions,paperSelection:s.paperSelection,isInitial:!0}),e.map(i=>{var M,P,ae,ie;return i.role==="user"?n.jsx(jt,{id:i.id,text:i.text??"",paperMentions:i.paperMentions??[],paperSelection:i.paperSelection,paperMentionsEnabled:u,isInitial:i.id===ue,editingAllowed:!t&&!!i.revision,editing:B===i.id,editNotice:i.id===ue?"Sending will replace this conversation.":i.id===z?"Sending will replace the response.":"Sending will replace the response and all messages after it.",onEdit:()=>O(i.id),onCancel:()=>O(null),onResendDraft:fe=>{const ge=h(i.id,fe);return ge&&O(null),ge}},i.id):n.jsx(wr,{msg:i,papers:r,onToggleBlock:J,onRetryCompaction:!t&&i.id===((M=e.at(-1))==null?void 0:M.id)&&((P=V.at(-1))!=null&&P.revision)?L:void 0,onRetryWithLuna:!t&&i.id===((ae=e.at(-1))==null?void 0:ae.id)&&((ie=V.at(-1))!=null&&ie.revision)?v:void 0,onArchiveOldChats:S,onArchiveOldestChats:A,archivePending:o,hfBilling:null,openRouterFallbackEnabled:p,feedbackEnabled:!0},i.id)})]})}),Q&&n.jsx("button",{type:"button",className:"chat-jump-latest",onClick:()=>{C("bottom");const i=k.current;i&&(i.focus({preventScroll:!0}),i.scrollTop=i.scrollHeight,_())},children:"Jump to latest"})]})}function rs({retryAt:e,onRetry:r,onCancel:t}){const[s,u]=d.useState(()=>Math.max(0,Math.ceil((e-Date.now())/1e3))),o=d.useRef(null);return d.useEffect(()=>{var L;const p=document.activeElement instanceof HTMLElement?document.activeElement:null;(L=o.current)==null||L.focus();const a=()=>u(Math.max(0,Math.ceil((e-Date.now())/1e3)));a();const h=window.setInterval(a,250);return()=>{window.clearInterval(h),p==null||p.focus()}},[e]),n.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:n.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-capacity-dialog-title","aria-describedby":"chat-capacity-dialog-description",onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),t())},children:[n.jsx("h2",{id:"chat-capacity-dialog-title",children:"All research slots are currently in use"}),n.jsx("p",{id:"chat-capacity-dialog-description",children:"Your message was not sent or billed. Try again in a few seconds."}),n.jsx("p",{className:"chat-capacity-countdown","aria-live":"polite",children:s>0?`Try again available in ${s} second${s===1?"":"s"}.`:"You can try again now."}),n.jsxs("div",{className:"chat-capacity-dialog-actions",children:[n.jsx("button",{type:"button",className:"chat-capacity-cancel",ref:o,onClick:t,children:"Cancel"}),n.jsx("button",{type:"button",className:"chat-capacity-retry",disabled:s>0,onClick:r,children:"Try again"})]})]})})}function ss({onClose:e}){const r=d.useRef(null);return d.useEffect(()=>{var s;const t=document.activeElement instanceof HTMLElement?document.activeElement:null;return(s=r.current)==null||s.focus(),()=>t==null?void 0:t.focus()},[]),n.jsx("div",{className:"chat-capacity-dialog-backdrop",role:"presentation",children:n.jsxs("div",{className:"chat-capacity-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-disabled-title","aria-describedby":"chat-disabled-description",onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),e())},children:[n.jsx("h2",{id:"chat-disabled-title",children:"Chat is temporarily disabled"}),n.jsx("p",{id:"chat-disabled-description",children:"We've temporarily paused new research runs. Your message wasn't sent, and your draft is still here. Please try again later."}),n.jsx("div",{className:"chat-capacity-dialog-actions",children:n.jsx("button",{ref:r,type:"button",className:"chat-capacity-cancel",onClick:e,children:"Keep editing"})})]})})}function ns({url:e,onClose:r}){return e?n.jsx("div",{className:"chat-share-dialog-backdrop",role:"presentation",onMouseDown:r,children:n.jsxs("div",{className:"chat-share-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"chat-share-dialog-title",onMouseDown:t=>t.stopPropagation(),children:[n.jsx("h2",{id:"chat-share-dialog-title",children:"Public link created"}),n.jsx("p",{children:"Anyone with this link can see this conversation. It could not be copied automatically, so copy it manually:"}),n.jsx("input",{readOnly:!0,value:e,"aria-label":"Public conversation link",autoFocus:!0,onFocus:t=>t.currentTarget.select()}),n.jsx("button",{type:"button",onClick:r,children:"Close"})]})}):null}const at="pwc:chat:sidebar-width",it=280,ot=200,ct=480,as=12,lt=e=>Math.max(ot,Math.min(ct,e)),is=()=>{if(typeof window>"u")return it;const e=Number(localStorage.getItem(at));return Number.isFinite(e)&&e>0?lt(e):it};function os({sessions:e,activeSessionId:r,loading:t,error:s,open:u,onClose:o,onNew:p,onNavigate:a,onRename:h,onDelete:L}){const[v,S]=d.useState(is),A=d.useRef(null),B=d.useRef(v),[O,k]=d.useState(null),[j,W]=d.useState(""),[U,se]=d.useState(null),[Q,w]=d.useState(!1),T=[...e].sort((m,I)=>Date.parse(I.updated_at)-Date.parse(m.updated_at)),C=T.filter((m,I)=>I{if(!U)return;const m=()=>se(null),I=i=>{i.key==="Escape"&&m()};return window.addEventListener("click",m),window.addEventListener("keydown",I),()=>{window.removeEventListener("click",m),window.removeEventListener("keydown",I)}},[U]);const $=m=>{k(m.id),W(m.title)},F=async m=>{const I=j.trim();I&&await h(m,I)&&k(null)},ne=(m,I,i)=>se({id:m,x:I,y:i}),ue=m=>{if(!A.current)return;const I=lt(A.current.width+m-A.current.x);B.current=I,S(I)},z=()=>{A.current&&(A.current=null,localStorage.setItem(at,String(B.current)))},J=m=>{const I=lt(m);B.current=I,S(I),localStorage.setItem(at,String(I))};return n.jsxs(n.Fragment,{children:[u&&n.jsx("div",{className:"chat-sidebar-backdrop","aria-hidden":"true",onClick:o}),n.jsxs("aside",{className:`chat-sidebar${u?"":" chat-sidebar-closed"}`,style:{"--chat-sidebar-width":`${v}px`},children:[n.jsxs("div",{className:"chat-sidebar-top",children:[n.jsxs("button",{type:"button",className:"chat-new-chat",onClick:()=>{De()&&p()},children:[n.jsx(Rr,{})," New chat"]}),n.jsx("button",{type:"button",className:"icon-btn",onClick:o,title:"Collapse sidebar",children:n.jsx(Kt,{})})]}),n.jsxs("nav",{className:"chat-sessions","aria-label":"Chat history",children:[t&&n.jsx("div",{className:"chat-sessions-empty",children:"Loading chats…"}),!t&&s&&n.jsx("div",{className:"chat-sessions-empty",children:s}),!t&&!s&&e.length===0&&n.jsx("div",{className:"chat-sessions-empty",children:"Conversations you start will show up here."}),Ir(_).map(m=>n.jsxs("div",{className:"chat-session-group",children:[n.jsx("div",{className:"chat-session-group-label",children:m.label}),m.items.map(I=>n.jsxs("div",{className:`chat-session${I.id===r?" chat-session-active":""}`,role:"button",tabIndex:0,onClick:()=>{De()&&a(I.id)},onKeyDown:i=>{if(i.key==="Enter"&&De()&&a(I.id),i.key==="F2"&&$(I),i.key==="ContextMenu"||i.shiftKey&&i.key==="F10"){i.preventDefault();const M=i.currentTarget.getBoundingClientRect();ne(I.id,M.right-150,M.bottom)}},onContextMenu:i=>{i.preventDefault(),ne(I.id,i.clientX,i.clientY)},children:[O===I.id?n.jsx("input",{className:"chat-session-title-input",value:j,autoFocus:!0,maxLength:80,onClick:i=>i.stopPropagation(),onChange:i=>W(i.target.value),onBlur:()=>void F(I.id),onKeyDown:i=>{i.stopPropagation(),i.key==="Enter"&&F(I.id),i.key==="Escape"&&k(null)}}):n.jsx("span",{className:"chat-session-title",children:I.title}),n.jsx("button",{type:"button",className:"chat-session-menu","aria-label":"Chat actions","aria-haspopup":"menu",title:"Chat actions",onClick:i=>{i.stopPropagation();const M=i.currentTarget.getBoundingClientRect();ne(I.id,M.right-150,M.bottom)},children:"⋯"}),n.jsx("button",{type:"button",className:"chat-session-delete","aria-label":"Delete conversation",onClick:i=>{i.stopPropagation(),De()&&L(I.id)},children:n.jsx(kr,{})})]},I.id))]},m.label)),V>0&&n.jsx("button",{type:"button",className:"chat-sessions-toggle","aria-expanded":Q,onClick:()=>w(m=>!m),children:Q?"Show less":`Show ${V} older ${V===1?"chat":"chats"}`})]}),n.jsx(Vr,{className:"chat-sidebar-tools",canNavigate:De}),n.jsx("div",{className:"chat-sidebar-resize-handle",role:"separator","aria-label":"Resize chat history","aria-orientation":"vertical","aria-valuemin":ot,"aria-valuemax":ct,"aria-valuenow":v,title:"Drag to resize; double-click to reset",tabIndex:0,onPointerDown:m=>{m.button===0&&(A.current={x:m.clientX,width:v},B.current=v,m.currentTarget.setPointerCapture(m.pointerId))},onPointerMove:m=>ue(m.clientX),onPointerUp:z,onPointerCancel:z,onLostPointerCapture:z,onDoubleClick:()=>J(it),onKeyDown:m=>{(m.key==="ArrowLeft"||m.key==="ArrowRight")&&(m.preventDefault(),J(v+(m.key==="ArrowRight"?10:-10))),(m.key==="Home"||m.key==="End")&&(m.preventDefault(),J(m.key==="Home"?ot:ct))}}),U&&n.jsx("div",{className:"chat-session-context-menu",role:"menu",style:{left:U.x,top:U.y},onClick:m=>m.stopPropagation(),children:n.jsx("button",{type:"button",role:"menuitem",autoFocus:!0,onClick:()=>{const m=e.find(I=>I.id===U.id);m&&$(m),se(null)},children:"Rename chat"})})]})]})}function cs({sessionId:e,busy:r,loading:t,hasPaperSelection:s=!1,onError:u}){const{toast:o}=Ht(),[p,a]=d.useState(!1),[h,L]=d.useState(""),v=async()=>{var S;if(!(r||p)&&!(s&&!window.confirm("This public link will include the selected paper passage. Anyone with the link can read that passage. Continue?"))){a(!0);try{const A=await Cr(e),B=new URL(A.public_path,window.location.origin).toString();try{if(!((S=navigator.clipboard)!=null&&S.writeText))throw new Error("Clipboard unavailable");await navigator.clipboard.writeText(B),o({className:"chat-share-toast",duration:5e3,title:"Public link copied to your clipboard",description:"Anyone with this link can see this conversation."})}catch{L(B)}}catch(A){const B=A instanceof Error?A.message:"Could not share this conversation";u(B),o({variant:"destructive",title:"Share failed",description:B})}finally{a(!1)}}};return n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",className:"chat-share-button",onClick:()=>void v(),disabled:r||p||t,"aria-label":"Share conversation",children:[p?n.jsx(Wt,{}):n.jsx(Qr,{"aria-hidden":"true"}),n.jsx("span",{children:"Share"})]}),n.jsx(ns,{url:h,onClose:()=>L("")})]})}const ls=({descriptor:e})=>{const r=xr(),{open:t,register:s,unregister:u}=r,o=rt.useRef(null),p=e.source_head??e.preview_head,a=rt.useMemo(()=>p?{kind:"artifact",schema_version:1,scope:"owner",artifact_id:e.artifact_id,version_id:p.version_id,identifier:"latex-paper",version:p.version,artifact_kind:"latex_paper",title:e.title,status:"ready",preview_mime:"application/pdf",source_language:"latex",total_bytes:0}:null,[e.artifact_id,e.title,p]),h=a?vr(a):null;return rt.useEffect(()=>{if(!(!a||!h))return s(a),o.current!==h&&(o.current=h,t(a)),()=>u(h)},[a,h,t,s,u]),null};function us({messages:e,refreshSessions:r,resetChat:t,restoreDraft:s}){const{toast:u}=Ht(),[o,p]=d.useState(null),a=()=>{const v=[...e].reverse().find(S=>S.role==="user");t(),s({text:(v==null?void 0:v.text)??"",paperMentions:(v==null?void 0:v.paperMentions)??[],...v!=null&&v.paperSelection?{paperSelection:v.paperSelection}:{}})};return{pending:o,archiveOld:async()=>{if(o===null){p("old");try{const v=await jr();if(await r(),v.archived_count===0){u({title:"No chats were archived",description:"There are no inactive chats older than 30 days."});return}a(),u({title:`${v.archived_count} ${v.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(v){u({variant:"destructive",title:"Could not archive old chats",description:v instanceof Error?v.message:"Try again."})}finally{p(null)}}},archiveOldest:async()=>{if(o===null){p("oldest");try{const v=await Ar();await r(),a(),u({title:`${v.archived_count} ${v.archived_count===1?"chat":"chats"} archived`,description:"Your question is ready to send again."})}catch(v){u({variant:"destructive",title:"Could not archive chats",description:v instanceof Error?v.message:"Try again."})}finally{p(null)}}}}}class ds{constructor(r,t=Tr){ee(this,"requestId");ee(this,"firstVisibleAt");ee(this,"streamStartReported",!1);ee(this,"firstVisibleReported",!1);ee(this,"terminalReported",!1);ee(this,"semanticReported",new Set);this.submittedAt=r,this.report=t}recordStreamStart(r,t){this.requestId=r,this.streamStartReported||(this.streamStartReported=!0,this.send({submission_to_stream_start_ms:Math.max(0,t-this.submittedAt)})),this.reportFirstVisible()}recordFirstVisible(r){this.firstVisibleAt===void 0&&(this.firstVisibleAt=r,this.reportFirstVisible())}recordSemantic(r,t){if(this.semanticReported.has(r))return;this.semanticReported.add(r);const s=Math.max(0,t-this.submittedAt);this.send(r==="reasoning"?{submission_to_first_reasoning_delta_ms:s}:r==="tool"?{submission_to_first_tool_call_ms:s}:{submission_to_first_answer_delta_ms:s})}recordTerminal(r){this.terminalReported||(this.terminalReported=!0,this.send({terminal_classification:r}))}reportFirstVisible(){!this.requestId||this.firstVisibleAt===void 0||this.firstVisibleReported||(this.firstVisibleReported=!0,this.send({submission_to_first_visible_delta_ms:Math.max(0,this.firstVisibleAt-this.submittedAt)}))}send(r){this.requestId&&this.report(this.requestId,r)}}const Qt="Preparing research workspace…",zt={preparing_workspace:"Preparing secure workspace…",starting_agent:"Starting research agent…",connecting_model:"Connecting to model…"},Gt=()=>({messages:[],sessionId:null,title:"",phase:"idle"});function Ft(e,r){for(let t=e.length-1;t>=0;t-=1)if(r(e[t]))return t;return-1}function Re(e){if(e.status!==Qt&&!Object.values(zt).includes(e.status))return e;const{status:r,...t}=e;return t}function te(e,r){if(!e.length)return e;const t=e.slice();return t[t.length-1]=r(t[t.length-1]),t}function Ae(e,r,t){return te(e,s=>{const u=Re(s),o=u.blocks??[];return{...u,blocks:o.map((p,a)=>r(p,a,o)?t(p):p)}})}function ps(e,r){switch(r.type){case"stream_start":return r.session_id?{...e,sessionId:r.session_id}:e;case"sandbox_start":case"sandbox_ready":case"workspace_ready":return e;case"lifecycle":return{...e,messages:te(e.messages,t=>{var s;return t.role==="assistant"&&t.streaming&&(((s=t.blocks)==null?void 0:s.length)??0)===0?{...t,status:zt[r.phase]}:t})};case"session_title_start":return{...e,title:""};case"session_title_delta":return{...e,title:`${e.title}${r.text}`.replace(/\s+/g," ").slice(0,80)};case"session_title_done":return{...e,title:r.title};case"compaction_status":return{...e,messages:te(e.messages,t=>({...t,compacting:!!(t.streaming&&r.state==="started")}))};case"reasoning_start":return{...e,messages:te(e.messages,t=>{const s=Re(t);return{...s,blocks:[...(s.blocks??[]).map(u=>u.kind==="reasoning"&&u.active?{...u,active:!1,open:!1}:u),{kind:"reasoning",text:"",active:!0,open:!0}]}})};case"reasoning_delta":return{...e,messages:Ae(e.messages,(t,s,u)=>t.kind==="reasoning"&&Ft(u,o=>o.kind==="reasoning")===s,t=>t.kind==="reasoning"?{...t,text:t.text+r.text}:t)};case"reasoning_end":return{...e,messages:te(e.messages,t=>{const s=t.blocks??[],u=Ft(s,a=>a.kind==="reasoning"&&a.active);if(u<0)return t;const o=s[u];if(o.kind!=="reasoning")return t;const p=s[u-1];return(p==null?void 0:p.kind)==="reasoning"&&p.text===o.text?{...t,blocks:s.filter((a,h)=>h!==u)}:{...t,blocks:s.map((a,h)=>h===u?{...o,active:!1,open:!1}:a)}})};case"tool_call":return{...e,messages:te(e.messages,t=>{const s=Re(t);return{...s,blocks:[...s.blocks??[],{kind:"tool",id:r.id,name:r.name,args:r.args,status:"running",open:!1}]}})};case"tool_call_start":return{...e,messages:te(e.messages,t=>{const s=Re(t);return{...s,blocks:[...s.blocks??[],{kind:"tool",schema_version:2,id:r.id,name:r.name,args:{},argumentText:"",argumentState:"streaming",arguments_redacted:r.redacted,status:"running",open:!1}]}})};case"tool_call_arguments_delta":return{...e,messages:Ae(e.messages,t=>t.kind==="tool"&&t.id===r.id,t=>t.kind==="tool"?{...t,args:r.partial_args,argumentText:r.snapshot?r.delta:`${t.argumentText??""}${r.delta}`,arguments_redacted:t.arguments_redacted||r.redacted}:t)};case"tool_call_arguments_done":return{...e,messages:Ae(e.messages,t=>t.kind==="tool"&&t.id===r.id,t=>t.kind==="tool"?{...t,args:r.args,argumentText:JSON.stringify(r.args),argumentState:"done",arguments_redacted:t.arguments_redacted||r.redacted}:t)};case"app_start":return{...e,messages:te(e.messages,t=>{const s=Re(t);return{...s,blocks:[...s.blocks??[],{kind:"app",schema_version:1,instance_id:r.instance_id,provider:r.provider,server:r.server,tool:r.tool,resource_uri:r.resource_uri,status:"loading",input:r.input,result:{content:[],structuredContent:{},isError:!1},csp:{},permissions:{clipboardWrite:!0},height:525}]}})};case"app_result":return{...e,messages:Ae(e.messages,t=>t.kind==="app"&&t.instance_id===r.id,t=>t.kind==="app"?{...t,status:r.status,result:r.result}:t)};case"tool_result":return{...e,messages:Ae(e.messages,t=>t.kind==="tool"&&t.id===r.id,t=>t.kind!=="tool"?t:r.status?{...t,schema_version:2,status:r.status,took_ms:r.took_ms,content:r.content,metadata:r.metadata,open:r.status!=="success"}:{...t,status:"done",hits:r.hits,took_ms:r.took_ms,results:r.results})};case"artifact_start":return{...e,messages:te(e.messages,t=>{const s=Re(t);return{...s,blocks:[...s.blocks??[],{kind:"artifact",schema_version:1,scope:"owner",publication_id:r.publication_id,identifier:r.identifier,artifact_kind:"posterly",title:r.title,status:"generating",phase:"publishing_poster"}]}})};case"artifact_ready":return{...e,messages:Ae(e.messages,t=>t.kind==="artifact"&&t.publication_id===r.publication_id,t=>t.kind==="artifact"?{...t,artifact_id:r.artifact_id,version_id:r.version_id,identifier:r.identifier,version:r.version,title:r.title,status:"ready",preview_mime:r.preview_mime,source_language:r.source_language,gate_status:r.gate_status,total_bytes:r.total_bytes,phase:void 0}:t)};case"artifact_error":return{...e,messages:Ae(e.messages,t=>t.kind==="artifact"&&t.publication_id===r.publication_id,t=>t.kind==="artifact"?{...t,status:"error",phase:void 0,error_code:r.code,error_message:r.message}:t)};case"answer_delta":return{...e,messages:te(e.messages,t=>{const s=Re(t),u=s.blocks??[],o=u.at(-1);return(o==null?void 0:o.kind)==="answer"&&!o.done?{...s,blocks:[...u.slice(0,-1),{...o,text:o.text+r.text}]}:{...s,blocks:[...u,{kind:"answer",text:r.text,done:!1}]}})};case"done":return{...e,phase:"complete",messages:te(e.messages,t=>({...t,streaming:!1,compacting:!1,followups:r.followups,finishReason:r.finish_reason,citations:r.citations,blocks:(t.blocks??[]).map(s=>s.kind==="answer"?{...s,done:!0}:s.kind==="reasoning"&&s.active?{...s,active:!1,open:!1}:s)}))};case"error":return{...e,phase:"failed",messages:te(e.messages,t=>({...t,streaming:!1,compacting:!1,error:r.message,errorCode:r.code,blocks:(t.blocks??[]).map(s=>s.kind==="reasoning"&&s.active?{...s,active:!1,open:!1}:s.kind==="tool"&&s.status==="running"?{...s,status:"error",open:!0}:s)}))};default:return e}}function fs(e){return te(e,r=>{if(r.role!=="assistant")return r;const t=(r.blocks??[]).flatMap(s=>s.kind==="tool"&&s.status==="running"?[{...s,status:"error",open:!0}]:s.kind==="reasoning"&&s.active?s.text?[{...s,active:!1,open:!1}]:[]:s.kind==="answer"?[{...s,done:!0}]:[s]);return{...r,blocks:t,streaming:!1,compacting:!1,finishReason:"stopped"}})}function hs(e,r){switch(r.type){case"start":return{messages:r.messages,sessionId:r.sessionId,title:"",phase:"streaming"};case"event":return ps(e,r.event);case"load":return{messages:r.messages,sessionId:r.sessionId,title:e.title,phase:"idle"};case"workspace_status":return{...e,messages:te(e.messages,t=>{var s;return t.role==="assistant"&&t.streaming&&(((s=t.blocks)==null?void 0:s.length)??0)===0&&!t.error?{...t,status:Qt}:t})};case"clear_workspace_status":return{...e,messages:te(e.messages,Re)};case"settle":return{...e,phase:"idle",messages:te(e.messages,t=>t.streaming?{...t,streaming:!1,compacting:!1}:t)};case"stop":return{...e,messages:fs(e.messages),phase:"stopped"};case"toggle_block":return{...e,messages:Jt(e.messages,r.messageId,r.blockIndex)};case"reset":return Gt()}}function Jt(e,r,t){return e.map(s=>{var u;return s.id!==r?s:{...s,blocks:(u=s.blocks)==null?void 0:u.map((o,p)=>p===t&&(o.kind==="reasoning"||o.kind==="tool")?{...o,open:!o.open}:o)}})}const Ee={minDelayMs:5,maxDelayMs:80,minRateCharsPerMs:.3,maxBufferedMs:400,arrivalRateTauMs:1e3,arrivalRateHeadroom:1.1,maxPendingChars:64},ms={now:()=>performance.now(),sleep:(e,r)=>new Promise(t=>{if(r!=null&&r.aborted||e<=0){t();return}const s=window.setTimeout(u,e);function u(){r==null||r.removeEventListener("abort",u),window.clearTimeout(s),t()}r==null||r.addEventListener("abort",u,{once:!0})})};function gs(e){return!["stream_start","sandbox_start","sandbox_ready","workspace_ready","session_title_start","session_title_delta","session_title_done"].includes(e.type)}function ys(e,r=!1,t=Ee.maxPendingChars){var u;if(!e)return{pieces:[],pending:""};if(r)return{pieces:[e],pending:""};const s=Intl.Segmenter;if(s){const p=[...new s(void 0,{granularity:"word"}).segment(e)].filter(h=>h.isWordLike);let a=0;if(p.length>1&&(a=p.at(-1).index),p.length&&/\s$/u.test(e)&&(a=e.length),a>0){const h=e.slice(0,a),L=[],S=[...new s(void 0,{granularity:"word"}).segment(h)].filter(A=>A.isWordLike);for(let A=0;AB&&L.push(h.slice(B,O))}return S.length||L.push(h),{pieces:L,pending:e.slice(a)}}}else{const o=[...e.matchAll(/\s+/gu)];if(o.length){const p=[];let a=0;for(const h of o){const L=h.index+h[0].length;p.push(e.slice(a,L)),a=L}return{pieces:p,pending:e.slice(a)}}}return e.length>=t?{pieces:[e.slice(0,t)],pending:e.slice(t)}:{pieces:[],pending:e}}function _s(e,r={}){const t={minDelayMs:r.minDelayMs??Ee.minDelayMs,maxDelayMs:r.maxDelayMs??Ee.maxDelayMs,minRateCharsPerMs:r.minRateCharsPerMs??Ee.minRateCharsPerMs,maxBufferedMs:r.maxBufferedMs??Ee.maxBufferedMs,arrivalRateTauMs:r.arrivalRateTauMs??Ee.arrivalRateTauMs,arrivalRateHeadroom:r.arrivalRateHeadroom??Ee.arrivalRateHeadroom,maxPendingChars:r.maxPendingChars??Ee.maxPendingChars},s=r.clock??ms,u=[];let o="",p=null,a=0,h=!0,L=!1,v=null,S=0,A=s.now(),B=!1;const O=()=>{v==null||v(),v=null},k=(w,T)=>{const C=w.type==="reasoning_delta"||w.type==="answer_delta"?w.text.length:0;u.push({kind:"event",event:w,arrivedAt:T,chars:C}),O()},j=w=>{if(!p||!o)return;const T=ys(o,w,t.maxPendingChars);for(const C of T.pieces)C&&k({type:p,text:C},a),a=s.now();o=T.pending,o||(p=null)},W=w=>{if(!h)return;const T=s.now();if(w.type==="reasoning_delta"||w.type==="answer_delta"){const C=w.type;if(!w.text)return;if(!B){B=!0,S+=w.text.length,A=T;const V=Array.from(w.text)[0];k({type:C,text:V},T);const $=w.text.slice(V.length);if($)for(p=C,o=$,a=T,j(!1);o.length>=t.maxPendingChars;)j(!1);return}p&&p!==C&&j(!0),p||(p=C,a=T),o+=w.text;const _=Math.max(0,T-A);for(S*=Math.exp(-_/t.arrivalRateTauMs),S+=w.text.length,A=T,j(!1);o.length>=t.maxPendingChars;)j(!1);return}gs(w)&&j(!0),k(w,T)},U=(async()=>{var w;try{for await(const T of e)W(T);h&&j(!0)}catch(T){h&&!((w=r.signal)!=null&&w.aborted)&&(j(!0),u.push({kind:"error",error:T,arrivedAt:s.now(),chars:0}))}finally{L=!0,O()}})(),se=()=>u.length||L?Promise.resolve():new Promise(w=>{v=w});return{events:async function*(){var T,C,_,V;let w=Number.NEGATIVE_INFINITY;try{for(;;){if(await se(),!u.length){if(L||!h)return;continue}const $=u[0];if($.kind==="error")throw u.shift(),$.error;if($.chars&&!((T=r.isHidden)!=null&&T.call(r))){const F=s.now(),ne=u.reduce((ae,ie)=>ae+ie.chars,0),ue=((C=u.find(ae=>ae.chars))==null?void 0:C.arrivedAt)??F,z=Math.max(0,t.maxBufferedMs-(F-ue)),J=S*Math.exp(-Math.max(0,F-A)/t.arrivalRateTauMs)/t.arrivalRateTauMs,m=z>0?ne/z:Number.POSITIVE_INFINITY,I=Math.max(t.minRateCharsPerMs,J*t.arrivalRateHeadroom,m),i=Math.min(t.maxDelayMs,Math.max(t.minDelayMs,$.chars/I)),M=Math.max(0,$.arrivedAt+t.maxBufferedMs-F),P=Math.max($.arrivedAt,w+Math.min(i,M));if(await s.sleep(Math.max(0,P-s.now()),r.signal),!h||(_=r.signal)!=null&&_.aborted)return}u.shift(),w=s.now(),yield $.event}}finally{h&&(h=!1,O(),await((V=e.return)==null?void 0:V.call(e,void 0))),await U}}(),takeAcceptedForStop(){var T;if(!h)return[];h=!1,p&&o&&(k({type:p,text:o},a),o="",p=null);const w=u.flatMap(C=>C.kind==="event"&&C.event.type!=="done"&&C.event.type!=="error"?[C.event]:[]);return u.length=0,O(),(T=e.return)==null||T.call(e,void 0),w}}}const Ot=[250,500,1e3],bs=(e,r)=>new Promise(t=>{const s=()=>{window.clearTimeout(u),r.removeEventListener("abort",s),t()},u=window.setTimeout(s,e);r.addEventListener("abort",s,{once:!0})});async function*ws(e,r){let t=e,s=0;for(;;){let u=!1;try{for await(const o of t)(o.type==="done"||o.type==="error")&&(u=!0),yield o;if(u||r.signal.aborted)return;throw new Tt}catch(o){r.onDisconnect();const p=r.getSessionId();if(r.signal.aborted||u||!(o instanceof Tt)||!p||s>=Ot.length)throw o;if(await bs(Ot[s],r.signal),r.signal.aborted)return;s+=1,t=Yt(p,{signal:r.signal,afterSequence:r.getAfterSequence(),onSequence:r.onSequence})}}}const qt=new Set(["openrouter_monthly_budget_exhausted","openrouter_unavailable","openrouter_byok_credential_invalid","openrouter_byok_billing_error","openrouter_byok_rate_limit","hf_inference_billing_exhausted"]),xs=new Set(["paper_context_unavailable","paper_mention_unavailable","paper_mentions_disabled","paper_selection_disabled","paper_selection_requires_reader","paper_selection_paper_mismatch","paper_selection_version_mismatch","paper_selection_page_invalid","paper_selection_too_large","chat_storage_quota_exceeded"]);class vs{constructor(){ee(this,"configuration");ee(this,"lifecycle",Gt());ee(this,"_busy",!1);ee(this,"_pendingCapacity",null);ee(this,"_sawStreamStart",!1);ee(this,"_providerExecuted",!1);ee(this,"_providerStatusChanged",!1);ee(this,"terminal","pending");ee(this,"rejection",null)}get busy(){return this._busy}get pendingCapacity(){return this._pendingCapacity}get sawStreamStart(){return this._sawStreamStart}get sawTerminalEvent(){return this.terminal==="complete"||this.terminal==="error"}get streamFailed(){return this.terminal==="error"||this.terminal==="transport_error"}get admissionRejected(){return this.rejection!==null}get shouldRefreshProvider(){return this._sawStreamStart&&this._providerExecuted||this._providerStatusChanged}finish(){this._busy=!1}queueCapacity(r){this._pendingCapacity=r}cancelCapacity(){this._pendingCapacity=null}projectSession(r){return this._busy&&r===this.sessionId?this.messages:null}get state(){return this.lifecycle}get messages(){return this.lifecycle.messages}get sessionId(){return this.lifecycle.sessionId}transition(r){return this.lifecycle=hs(this.lifecycle,r),this.lifecycle}start(r,t,s){this.configuration=s,this._busy=!0,this._sawStreamStart=this._providerExecuted=this._providerStatusChanged=!1,this.terminal="pending",this.rejection=null,this.transition({type:"start",messages:r,sessionId:t})}restore(r,t=this.sessionId){return this.transition({type:"load",messages:r,sessionId:t})}observe(r){return r.type==="stream_start"&&(this._sawStreamStart=!0,this._providerExecuted=r.provider_execution!==!1),(r.type==="done"||r.type==="error")&&(this.terminal=r.type==="done"?"complete":"error"),r.type==="error"&&qt.has(r.code??"")?(this._providerStatusChanged=!0,!0):!1}reject(r,t){const s=r instanceof nt?r.code:void 0,u=t&&s==="chat_not_busy"?"completed":s==="chat_temporarily_disabled"?"disabled":s==="chat_capacity"?"capacity":xs.has(s??"")?"draft":qt.has(s??"")?"provider":"network";return this.terminal=u==="completed"?"already_complete":"transport_error",this.rejection=u==="disabled"||u==="capacity"||u==="draft"?u:null,this._providerStatusChanged||(this._providerStatusChanged=u==="provider"),u}reset(){this._busy=!1,this._pendingCapacity=null,this.transition({type:"reset"})}}const Ss=750;function Es(e,r){for(let t=e.length-1;t>=0;t-=1)if(r(e[t]))return t;return-1}function Se(e){const r=d.useRef(e);return d.useLayoutEffect(()=>{r.current=e}),d.useCallback((...t)=>r.current(...t),[])}function Rs(e){const[r,t]=d.useState([]),[s,u]=d.useState(!1),[o,p]=d.useState(""),[a]=d.useState(()=>new vs),h=d.useRef(null),L=d.useRef(null),v=d.useRef(null),S=d.useRef(null),A=d.useRef(!1),B=d.useRef(null),O=d.useRef(null),k=d.useRef("cleared"),j=d.useRef(null),[W,U]=d.useState(null),[se,Q]=d.useState(null),w=d.useRef([]),T=d.useRef(null),C=d.useRef(!1),_=d.useRef(e),V=d.useRef(He()),$=d.useRef(0),F=d.useRef(0),ne=d.useRef(e.sessionId);if(ne.current!==e.sessionId){ne.current=e.sessionId;const c=a.projectSession(e.sessionId);c&&t(c),a.sessionId!==e.sessionId&&(F.current+=1,j.current=null)}_.current=e,w.current=r,d.useEffect(()=>()=>{var c;O.current!==null&&window.clearTimeout(O.current),(c=h.current)==null||c.abort(),L.current=null,v.current!==null&&cancelAnimationFrame(v.current),S.current!==null&&window.clearTimeout(S.current),a.cancelCapacity()},[a]),d.useEffect(()=>{a.busy||a.restore(a.messages,e.sessionId)},[e.sessionId,a]),d.useEffect(()=>{const c=a.projectSession(e.sessionId);C.current=c!==null,c&&(t(c),w.current=c)},[e.sessionId,a]);const ue=d.useMemo(()=>{const c={};for(const f of r)for(const E of f.blocks??[])if(E.kind==="tool")for(const b of E.results??[])c[b.route_id]=b;return c},[r]),z=()=>`m${++$.current}_${Date.now().toString(36)}`,J=(c,f=!0)=>{const E=a.state,b=a.transition(c),g=c.type==="event"&&c.event.type==="stream_start"?c.event.session_id:null;return g?_.current.onSessionId(g,E.sessionId,a.configuration):b.sessionId&&b.sessionId!==E.sessionId&&_.current.onSessionId(b.sessionId,E.sessionId,a.configuration),b.title!==E.title&&_.current.onTitle(b.title,b.sessionId),f&&(w.current=b.messages,t(b.messages)),b},m=()=>T.current===F.current||C.current,I=()=>{v.current!==null&&(cancelAnimationFrame(v.current),v.current=null),S.current!==null&&(window.clearTimeout(S.current),S.current=null)},i=()=>{I(),document.visibilityState!=="hidden"&&C.current&&(A.current=!1,w.current=a.messages,t(a.messages))},M=()=>{if(!C.current||document.visibilityState==="hidden"||v.current!==null||S.current!==null)return;const c=()=>{v.current=null,S.current=null,i()};typeof requestAnimationFrame=="function"?v.current=requestAnimationFrame(c):S.current=window.setTimeout(c,0)};d.useEffect(()=>{const c=()=>{document.visibilityState==="visible"&&A.current&&M()};return document.addEventListener("visibilitychange",c),()=>document.removeEventListener("visibilitychange",c)});const P=c=>{if(h.current!==c||(O.current!==null&&(window.clearTimeout(O.current),O.current=null),k.current==="cleared"))return;const f=k.current==="shown";k.current="cleared",f&&J({type:"clear_workspace_status"},m())},ae=(c,f)=>{O.current!==null&&window.clearTimeout(O.current),k.current="armed",O.current=window.setTimeout(()=>{O.current=null,!(k.current!=="armed"||h.current!==c||c.signal.aborted||F.current!==f)&&(k.current="shown",J({type:"workspace_status"},m()))},Ss)},ie=(c,f)=>{const E=j.current;!E||E.controller!==c||E.tracker.recordStreamStart(f,performance.now())},fe=(c,f)=>{const E=j.current;!E||E.controller!==c||E.tracker.recordTerminal(f)};d.useLayoutEffect(()=>{const c=j.current;if(!c)return;const f=r.at(-1);if((f==null?void 0:f.role)!=="assistant"||!(f.blocks??[]).some(g=>g.kind==="tool"||g.kind==="reasoning"&&!!g.text.trim()||g.kind==="answer"&&!!g.text.trim()))return;const b=performance.now();c.tracker.recordFirstVisible(b);for(const g of f.blocks??[])g.kind==="reasoning"&&g.text.trim()?c.tracker.recordSemantic("reasoning",b):g.kind==="tool"?c.tracker.recordSemantic("tool",b):g.kind==="answer"&&g.text.trim()&&c.tracker.recordSemantic("answer",b)},[r]);const ge=(c,f=!0)=>{J({type:"event",event:c},f)},Ke=async(c,f)=>{var g;const E=await(_.current.loadSession??ut)(c);let b=$t(E);return((g=B.current)==null?void 0:g.sessionId)===c&&(b=B.current.messages,B.current=null),F.current!==f&&!(T.current===f&&C.current&&_.current.sessionId===c)?null:(t(b),w.current=b,a.restore(b,c),b)},Ie=(c,f,E,b,g,H,K)=>{const y=++F.current;T.current=y,C.current=!0;const N=new AbortController;h.current=N;const he=c.text;return V.current=c,p(""),t(E),a.start(E,f.session_id,K??{model:_.current.initialModel,webSearchEnabled:!!f.web_search_enabled,reasoningEffort:f.reasoning_effort??Le}),u(!0),j.current=H?null:{controller:N,tracker:new ds(performance.now())},k.current="cleared",(async()=>{var X,G,_e,re,ve,qe;let oe=0;const ce=Y=>{Y>oe&&(oe=Y)};try{const Y=H?Yt(H,{signal:N.signal,onSequence:ce}):Nr(f,{signal:N.signal,onSequence:ce}),q=ws(Y,{signal:N.signal,getSessionId:()=>a.sessionId,onDisconnect:()=>{!N.signal.aborted&&h.current===N&&ge({type:"compaction_status",state:"finished"},m())},getAfterSequence:()=>oe,onSequence:ce}),Z=!H&&Ue()&&Dr(),pe=Z?_s(q,{signal:N.signal,isHidden:()=>document.visibilityState==="hidden"}):null;pe&&(L.current={controller:N,stream:pe});for await(const D of(pe==null?void 0:pe.events)??q){if(N.signal.aborted||h.current!==N)break;D.type==="paper_artifact"&&((G=(X=_.current).onPaperArtifact)==null||G.call(X,D,a.sessionId)),D.type==="stream_start"&&ie(N,D.request_id),D.type==="sandbox_start"&&ae(N,y),(D.type==="sandbox_ready"||D.type==="workspace_ready"||D.type==="lifecycle")&&P(N),(D.type==="reasoning_start"||D.type==="reasoning_delta"||D.type==="tool_call"||D.type==="tool_call_start"||D.type==="tool_call_arguments_delta"||D.type==="tool_call_arguments_done"||D.type==="app_start"||D.type==="app_result"||D.type==="artifact_start"||D.type==="artifact_ready"||D.type==="artifact_error"||D.type==="answer_delta"||D.type==="done"||D.type==="error")&&P(N),a.observe(D)&&m()&&_.current.onInterrupted(c),(D.type==="done"||D.type==="error")&&fe(N,D.type==="error"?"error":"complete");const ke=m(),$e=ke&&!(Z&&document.visibilityState==="hidden"),Ze=D.type==="reasoning_delta"||D.type==="answer_delta"||D.type==="tool_call_arguments_delta",Be=!["stream_start","sandbox_start","sandbox_ready","workspace_ready","session_title_start","session_title_delta","session_title_done","reasoning_delta","answer_delta","tool_call_arguments_delta"].includes(D.type);Z&&Be&&i(),Z&&Ze?(ge(D,!1),A.current||(A.current=ke),M()):(ge(D,$e),Z&&ke&&!$e&&(A.current=!0))}}catch(Y){if(!N.signal.aborted&&h.current===N){const q=a.reject(Y,!!H),Z=q==="completed";if(P(N),!Z)if(q==="disabled")Q({question:he,draft:c}),a.restore(b),F.current===y&&(t(b),w.current=b,p(""));else if(q==="capacity"){const pe=Y instanceof nt?Y.retryAfterSeconds??5:5,D={question:he,draft:c,request:f,optimistic:E,original:b,edit:g,retryAfterSeconds:pe,retryAt:Date.now()+pe*1e3};a.queueCapacity(D),U({question:he,draft:c,retryAt:D.retryAt,retryAfterSeconds:pe}),a.restore(b),F.current===y&&(t(b),w.current=b,p(""))}else fe(N,"network_error"),q==="draft"&&(m()&&_.current.onInterrupted(c),a.restore(b),F.current===y&&(t(b),w.current=b,p(Y instanceof Error?Y.message:"The assistant stream failed."))),q==="provider"&&m()&&_.current.onInterrupted(c);!Z&&!a.admissionRejected&&F.current===y&&ge({type:"error",message:Y instanceof Error?Y.message:"The assistant stream failed.",code:Y instanceof nt?Y.code:void 0})}}finally{if(h.current===N){if(((_e=L.current)==null?void 0:_e.controller)===N&&(i(),L.current=null),P(N),!a.sawTerminalEvent&&!N.signal.aborted&&fe(N,"network_error"),a.finish(),u(!1),a.admissionRejected)_.current.onSettled(f.session_id);else if(!N.signal.aborted){a.shouldRefreshProvider&&((ve=(re=_.current).onProviderTerminal)==null||ve.call(re));const Y=a.sessionId;if(g&&!a.sawStreamStart)a.restore(g.snapshot),F.current===y&&(t(g.snapshot),w.current=g.snapshot,p("Couldn’t resend this message. Your original conversation was restored."));else if(Y){F.current===y&&g&&(a.streamFailed||!a.sawTerminalEvent)&&(a.restore(g.snapshot),t(g.snapshot),w.current=g.snapshot);try{const q=await Ke(Y,y);q&&g&&q.some(Z=>Z.id===g.targetId)&&p("Couldn’t resend this message. Your original conversation was restored.")}catch{F.current===y&&J({type:"settle"})}}else F.current===y&&J({type:"settle"});(!h.current||h.current===N)&&_.current.onSettled(Y)}((qe=j.current)==null?void 0:qe.controller)===N&&(j.current=null)}}})(),!0},je=Se(c=>{var ce,X;const f=typeof c=="string"?He(c.trim()):c,E=f.text;if(!E||E.length>8e3||a.busy||a.pendingCapacity)return!1;const b=w.current,g=[...b].reverse().find(G=>G.role==="user"),H=g!=null&&g.status&&g.status!=="complete"&&g.revision?{replace_message_id:g.id,prior_revision:g.revision}:null,K={id:z(),role:"user",text:E,paperMentions:f.paperMentions,paperSelection:f.paperSelection},y={id:z(),role:"assistant",streaming:!0,blocks:[]},N=H&&g?Es(b,G=>G.id===g.id):-1,he=N<0?[...b,K,y]:[...b.slice(0,N),K,y],oe=(X=(ce=_.current).viewerContext)==null?void 0:X.call(ce);return Ie(f,{message:E,paper_mentions:f.paperMentions.map(({route_id:G,title:_e,start:re,end:ve})=>({route_id:G,title:_e,start:re,end:ve})),session_id:_.current.sessionId,client_message_id:crypto.randomUUID(),web_search_enabled:!!_.current.webSearchEnabled,reasoning_effort:_.current.reasoningEffort??Le,..._.current.primaryPaperRouteId?{primary_paper_route_id:_.current.primaryPaperRouteId}:{},...oe?{viewer_context:oe}:{},...f.paperSelection?{paper_selection:Mt(f.paperSelection)}:{},...!_.current.sessionId&&_.current.initialModel?{initial_model:_.current.initialModel}:{},...H??{}},he,b)}),xe=Se((c,f)=>{var ce,X;const E=typeof f=="string"?He(f.trim()):f,b=E.text;if(!b||b.length>8e3||a.busy||a.pendingCapacity)return!1;const g=w.current.slice(),H=g.findIndex(G=>G.id===c&&G.role==="user");if(H<0)return!1;const K=g[H];if(!_.current.sessionId||!K.revision)return!1;const y={id:K.id,role:"user",text:b,paperMentions:E.paperMentions,paperSelection:E.paperSelection,revision:K.revision+1,status:"generating"},N={id:z(),role:"assistant",streaming:!0,blocks:[]},he=[...g.slice(0,H),y,N],oe=(X=(ce=_.current).viewerContext)==null?void 0:X.call(ce);return Ie(E,{message:b,paper_mentions:E.paperMentions.map(({route_id:G,title:_e,start:re,end:ve})=>({route_id:G,title:_e,start:re,end:ve})),session_id:_.current.sessionId,client_message_id:crypto.randomUUID(),web_search_enabled:!!_.current.webSearchEnabled,reasoning_effort:_.current.reasoningEffort??Le,..._.current.primaryPaperRouteId?{primary_paper_route_id:_.current.primaryPaperRouteId}:{},...oe?{viewer_context:oe}:{},...E.paperSelection?{paper_selection:Mt(E.paperSelection)}:{},replace_message_id:K.id,prior_revision:K.revision},he,g,{targetId:K.id,snapshot:g})}),de=Se(()=>{const c=w.current.slice(),f=[...c].reverse().find(g=>g.role==="user");if(!_.current.sessionId||!(f!=null&&f.revision)||a.busy||a.pendingCapacity)return!1;const E=He(f.text??"Continue the interrupted response from saved progress."),b=[...c,{id:z(),role:"user",text:E.text,paperMentions:[]},{id:z(),role:"assistant",streaming:!0,blocks:[]}];return Ie(E,{message:E.text,session_id:_.current.sessionId,client_message_id:crypto.randomUUID(),retry_message_id:f.id,..._.current.primaryPaperRouteId?{primary_paper_route_id:_.current.primaryPaperRouteId}:{},web_search_enabled:!!_.current.webSearchEnabled,reasoning_effort:_.current.reasoningEffort??Le},b,c)}),Te=Se(()=>{const c=[...w.current].reverse().find(f=>f.role==="user");return c!=null&&c.text?xe(c.id,{text:c.text,paperMentions:c.paperMentions??[],...c.paperSelection?{paperSelection:c.paperSelection}:{}}):!1}),We=d.useCallback(()=>{a.cancelCapacity(),U(null)},[a]),ye=Se(()=>{const c=a.pendingCapacity;return!c||Date.now(){var K,y;if(!h.current)return;const c=h.current;P(c),fe(c,"stopped"),c.abort();const f=((K=L.current)==null?void 0:K.controller)===c?L.current.stream.takeAcceptedForStop():[];L.current=null;for(const N of f)ge(N,!1);i(),h.current=null,((y=j.current)==null?void 0:y.controller)===c&&(j.current=null),a.finish(),u(!1);const E=m(),b=J({type:"stop"},!1).messages;E&&(w.current=b,t(b),_.current.onInterrupted(V.current));const g=a.sessionId;g&&(B.current={sessionId:g,messages:b}),g&&Mr(g).catch(()=>{});const H=++F.current;window.setTimeout(()=>{g&&E&&F.current===H?Ke(g,H).catch(()=>{}).finally(()=>{h.current||_.current.onSettled(g)}):h.current||_.current.onSettled(g)},450)}),Ne=Se((c,f)=>{const E=C.current?a.transition({type:"toggle_block",messageId:c,blockIndex:f}).messages:Jt(w.current,c,f);w.current=E,t(E)}),Ye=d.useCallback(()=>{var c;F.current+=1,O.current!==null&&(window.clearTimeout(O.current),O.current=null),k.current="cleared",(c=h.current)==null||c.abort(),h.current=null,L.current=null,I(),A.current=!1,B.current=null,j.current=null,U(null),a.reset(),T.current=null,C.current=!1,t([]),u(!1),p("")},[a]),Oe=Se((c,f,E=!1,b)=>{var g;if(F.current+=1,O.current!==null&&(window.clearTimeout(O.current),O.current=null),k.current="cleared",I(),A.current=!1,j.current=null,a.cancelCapacity(),U(null),a.busy&&f!==void 0&&f===a.sessionId){C.current=!0,t(a.messages),w.current=a.messages,p("");return}if(C.current=!1,a.busy||((g=h.current)==null||g.abort(),h.current=null,T.current=null,C.current=!1),E&&f&&!a.busy){const H=[...c].reverse().find(K=>K.role==="user");if(H){const K={text:H.text??"",paperMentions:H.paperMentions??[],...H.paperSelection?{paperSelection:H.paperSelection}:{}},y=[...c,{id:`${H.id}-active`,role:"assistant",streaming:!0,blocks:[]}];Ie(K,{message:K.text,session_id:f,client_message_id:"reconnect",web_search_enabled:!!_.current.webSearchEnabled,reasoning_effort:_.current.reasoningEffort??Le},y,c,void 0,f,b);return}}t(c),w.current=c,a.busy||a.restore(c,f??_.current.sessionId),a.busy||u(!1),p("")});return{messages:r,busy:s,activeSessionId:s?a.sessionId:null,activeTitle:a.state.title,activeConfiguration:a.configuration,selectedBusy:s&&a.sessionId===e.sessionId,papers:ue,sessionError:o,capacityRequest:W,disabledRequest:se,send:je,editAndResend:xe,retryFromProgress:de,retryLatest:Te,retryCapacity:ye,cancelCapacity:We,dismissDisabled:()=>Q(null),stop:Me,toggleBlock:Ne,reset:Ye,load:Oe}}const Xt=["chat","openai","usage"],Is=90,Zt="pwc:chat:openai-credits-notice:dismissed";function ks(e=!0){return Pe({queryKey:Xt,queryFn:()=>Xe.getOpenAIUsage(),enabled:e,staleTime:3e4,retry:!1,refetchOnWindowFocus:!0})}function Cs(e,r,t){if(!e||r!=="openai"||e.used_percent["chatSessions",e],detail:(e,r)=>["chatSession",e,r]},Ts=e=>Vt({queryKey:Fe.list(e),queryFn:Lr,staleTime:0,refetchOnWindowFocus:!1,retry:!1}),Bt=(e,r)=>Vt({queryKey:Fe.detail(e,r),queryFn:()=>{if(!r)throw new Error("A saved conversation is required");return ut(r)},staleTime:0,refetchOnWindowFocus:!1,retry:!1}),me=He,Ms=["Summarize the main contributions","Explain in simple terms","Identify the main limitations"],Ns=()=>{const e=sessionStorage.getItem(Je);if(!e)return null;try{return Yr(JSON.parse(e),e)}catch{}return me(e)},Ds=({enabled:e,workspaceKey:r,children:t,onAskAiFix:s})=>e?n.jsx(Sr,{workspaceKey:r,onAskAiFix:s,children:t}):n.jsx(n.Fragment,{children:t}),Ls=({enabled:e,children:r})=>e?n.jsx(Er,{variant:"chat",children:r}):n.jsx(n.Fragment,{children:r}),Fs=({mode:e="general",routeSessionId:r,primaryPaper:t,currentPage:s,paperSelection:u,onPaperSelectionChange:o,onSessionId:p,onReaderSubmit:a,onReaderNewChat:h,onReaderClose:L})=>{var ht,mt,gt,yt,_t,bt,wt,xt,vt,St,Et,Rt,It,kt;const{sessionId:v}=lr(),S=r??(e==="general"?v:void 0),A=ur(),[B,O]=dr(),{user:k,isLoading:j}=Ut(),W=pr(),U=(k==null?void 0:k.hf_subject)??null,se=_r(),Q=Pe({queryKey:["chatAvailability"],queryFn:()=>Xe.getAvailability(),refetchInterval:3e4,retry:!1,enabled:Ue()&&!!k}),w=((ht=Q.data)==null?void 0:ht.status)==="paused"||e==="paper"&&((mt=Q.data)==null?void 0:mt.paper_reader_chat_enabled)===!1,T=Pe({...Ts(U),enabled:!!k&&!j}),C=T.data??[],[_,V]=d.useState(null),[$,F]=d.useState(""),ne=l=>{W.setQueryData(Fe.list(U),x=>l(x??[]))},ue=(l,x)=>{ne(R=>R.map(le=>le.id===l?{...le,...x}:le)),W.setQueryData(Fe.detail(U,l),R=>R&&{...R,...x})},z=d.useRef(Fr()),J=d.useRef(B.get("model")||((gt=z.current)==null?void 0:gt.model)),[m,I]=d.useState(se?Or:qr),[i,M]=d.useState(J.current||st),P=Br(m,i),ae=Pr(m,i),ie=P==="huggingface"&&!ae,fe=zr(!!(k&&P==="openrouter")),ge=ks(Ue()&&!!k&&P==="openai"),[Ke,Ie]=d.useState(()=>As()),je=Cs(ge.data,P,Ke),[xe,de]=d.useState(()=>me()),Te=Le,We=!!((yt=Q.data)!=null&&yt.web_search_available),[ye,Me]=d.useState(()=>{var x,R;const l=(x=B.get("q"))==null?void 0:x.trim();return l?me(l):((R=z.current)==null?void 0:R.draft)??me()}),Ne=d.useRef(!1),Ye=d.useRef(!1),Oe=d.useRef(!1),[c,f]=d.useState(()=>typeof window>"u"||window.innerWidth>900),E=d.useRef(new Set),b=d.useRef(S);b.current=S;const[g,H]=d.useState(void 0),K=d.useCallback(async()=>{await W.invalidateQueries({queryKey:Fe.list(U)})},[W,U]),y=Rs({sessionId:S??null,initialModel:i,webSearchEnabled:We,reasoningEffort:Te,primaryPaperRouteId:e==="paper"?t==null?void 0:t.routeId:void 0,viewerContext:e==="paper"&&s?()=>({page:Math.max(1,Math.min(1e4,s()))}):void 0,loadSession:async l=>{const x=await W.fetchQuery(Bt(U,l));return V(R=>(R==null?void 0:R.sessionId)===l?null:R),x},onSessionId:(l,x,R)=>{W.cancelQueries({queryKey:Fe.list(U)});const le=new Date().toISOString();ne(we=>we.some(Ce=>Ce.id===l)?we.map(Ce=>Ce.id===l?{...Ce,is_busy:!0}:Ce):[{id:l,title:"New chat",selected_model:(R==null?void 0:R.model)??i,created_at:le,updated_at:le,message_count:1,is_busy:!0,web_search_enabled:(R==null?void 0:R.webSearchEnabled)??We,reasoning_effort:(R==null?void 0:R.reasoningEffort)??Te},...we]),(b.current??null)===x&&l!==x&&(e==="paper"?p==null||p(l):A(`/chat/${l}`,{replace:!0}))},onTitle:(l,x)=>{x&&!E.current.has(x)&&ue(x,{title:l})},onSettled:l=>{l&&ue(l,{is_busy:!1}),W.invalidateQueries({queryKey:Xt}),K()},onProviderTerminal:()=>{W.invalidateQueries({queryKey:Gr})},onPaperArtifact:(l,x)=>{x&&V({sessionId:x,descriptor:l.descriptor})},onInterrupted:l=>{de(l),o==null||o(l.paperSelection)}}),N=y.send;d.useEffect(()=>{y.capacityRequest&&(de(y.capacityRequest.draft),o==null||o(y.capacityRequest.draft.paperSelection))},[y.capacityRequest,o]);const he=d.useCallback(l=>{sessionStorage.setItem(Je,JSON.stringify(l)),sessionStorage.setItem(Qe,i),sessionStorage.setItem(Hr,Te),sessionStorage.setItem(ze,"1"),sessionStorage.setItem(Ge,"1");const x=e==="paper"&&t?`/pdf/${t.routeId}`:b.current?`/chat/${b.current}`:"/chat";window.location.href=fr(x,ie)},[e,t,Te,i,ie]),oe=d.useCallback((l,x)=>{sessionStorage.setItem(Je,JSON.stringify(l)),sessionStorage.setItem(Qe,i),sessionStorage.removeItem(ze),sessionStorage.removeItem(Ge),Me(me()),de(l),o==null||o(l.paperSelection),F(x)},[o,i]),ce=d.useCallback(async l=>{const x=o?u?{...l,paperSelection:u}:{text:l.text,paperMentions:l.paperMentions}:l;if(!k){he(x);return}if(ie&&!Ye.current){if(Oe.current)return;Oe.current=!0;try{if(!(await Xe.getInferenceBilling()).connected){if(sessionStorage.getItem(Ge)==="1"){oe(x,"Hugging Face inference authorization was not completed. Your prompt is ready to retry.");return}he(x);return}Ye.current=!0}catch(R){oe(x,R instanceof Error?R.message:"Could not check Hugging Face authorization.");return}finally{Oe.current=!1}}if(sessionStorage.removeItem(ze),!N(x)){oe(x,"Your prompt was not sent. It is ready to retry.");return}sessionStorage.removeItem(Je),sessionStorage.removeItem(Qe),sessionStorage.removeItem(Ge),Ur(),z.current=null,de(me()),o==null||o(void 0),e==="paper"&&(a==null||a())},[he,e,o,a,u,oe,N,k,ie]);d.useEffect(()=>{if(j||!k)return;const l=sessionStorage.getItem(Qe);l&&M(l),Kr().then(le=>{if(I(le.items),!b.current){const we=J.current||l;M(we&&le.items.some(Ce=>Ce.id===we)?we:le.default_model)}});const x=Ns(),R=sessionStorage.getItem(ze)==="1";x&&(o==null||o(x.paperSelection),R?Me(x):de(x))},[j,o,K,k]);const X=y.selectedBusy,{load:G,activeConfiguration:_e}=y,re=Pe({...Bt(U,S??null),enabled:!!(S&&k&&!j&&!X),refetchOnMount:"always"}),ve=!j&&(!k||re.error instanceof hr&&re.error.status===404),qe=Pe({queryKey:["chatSessionPublicShare",S],queryFn:()=>Xe.getSessionPublicShare(S??""),enabled:e==="general"&&!!S&&ve,retry:!1}),Y=(_t=qe.data)==null?void 0:_t.public_path;d.useEffect(()=>{Y&&A(Y,{replace:!0})},[A,Y]);const q=re.data,Z=X||g===(S??null),pe=_&&_.sessionId===S?_.descriptor:q==null?void 0:q.latex_paper,D=(wt=(bt=[...(q==null?void 0:q.messages)??[]].reverse().find(l=>l.role==="user"&&l.viewer_context))==null?void 0:bt.viewer_context)==null?void 0:wt.page;d.useLayoutEffect(()=>{const l=S??null;if(g!==l){if(X){H(l);const x=_e;x&&x.model&&M(x.model);return}if(!l){G([],null),H(null);return}!q||re.isFetching||(H(l),G($t(q),l,q.is_busy,{model:q.selected_model,webSearchEnabled:q.web_search_enabled,reasoningEffort:q.reasoning_effort??"high"}),F(""),M(q.selected_model))}},[S,X,q,G,_e,re.isFetching,g]),d.useEffect(()=>{var le;if(j)return;const l=(le=B.get("q"))==null?void 0:le.trim();if(!l)return;Ne.current=!1;const x=B.get("model");x&&M(x),Me(me(l));const R=new URLSearchParams(B);R.delete("q"),R.delete("model"),O(R,{replace:!0})},[j,B,O]),d.useEffect(()=>{if(j||y.busy||!ye.text||Ne.current||k&&Q.isFetching||S&&!Z)return;const l=window.setTimeout(()=>{if(Ne.current)return;Ne.current=!0,ce(ye).finally(()=>Me(me()))},0);return()=>window.clearTimeout(l)},[j,Q.isFetching,y.busy,ye,S,Z,ce,k]),d.useEffect(()=>{const l=()=>{!k||y.busy||K()};return window.addEventListener("focus",l),()=>window.removeEventListener("focus",l)},[y.busy,K,k]);const ke=()=>{window.innerWidth<=900&&f(!1),G([],null),H(null),de(me()),o==null||o(void 0),e==="paper"?h==null||h():A("/chat")},$e=async(l,x)=>{try{const R=await Nt(l,{title:x});return E.current.add(l),ue(l,R),!0}catch(R){return F(R instanceof Error?R.message:"Rename failed"),!1}},Ze=async l=>{const x=y.busy&&l===y.activeSessionId;if(window.confirm(x?"Stop and delete this chat? This cannot be undone.":"Delete this chat? This cannot be undone.")){x&&y.stop();try{if(x){const R=Date.now()+3e3;for(;(await ut(l)).is_busy;){if(Date.now()>=R)throw new Error("Generation is still stopping. The chat was not deleted.");await new Promise(we=>window.setTimeout(we,150))}}await $r(l),l===S&&ke(),await K()}catch(R){F(R instanceof Error?R.message:"Delete failed")}}},Be=us({messages:y.messages,refreshSessions:K,resetChat:y.reset,restoreDraft:de}),er=async l=>{const x=i;if(M(l),!S)return!0;try{const R=await Nt(S,{selected_model:l});return ue(S,{selected_model:R.selected_model}),F(""),!0}catch(R){return M(x),F(R instanceof Error?R.message:"Model change failed"),!1}},tr=m.some(l=>l.id===st),rr=async()=>{await er(st)&&y.retryLatest()},sr=Xr(e==="general"),dt=C.map(l=>l.id===y.activeSessionId&&y.busy?{...l,is_busy:!0,title:E.current.has(l.id)?l.title:y.activeTitle||l.title}:l),be=dt.find(l=>l.id===S),et=(be==null?void 0:be.primary_paper)??(q==null?void 0:q.primary_paper),tt=y.messages.length===0,Ve=!!(S&&(j||k&&!Z&&!re.isError||qe.isFetching||Y)),pt=!Z&&!Ve&&((xt=re.error)==null?void 0:xt.message),nr=!!((vt=fe.data)!=null&&vt.fallback_enabled),ar=o?u?{...xe,paperSelection:u}:{text:xe.text,paperMentions:xe.paperMentions}:xe,ft={onSend:ce,busy:X,onStop:y.stop,draft:ar,onDraftChange:l=>{o?(de({text:l.text,paperMentions:l.paperMentions}),l.paperSelection!==u&&o(l.paperSelection)):de(l)},disabled:w||j||y.busy&&!X,describedBy:w?"chat-paused-description":void 0,paperMentionsEnabled:!!((St=Q.data)!=null&&St.paper_mentions_enabled),paperSelectionEnabled:((Et=Q.data)==null?void 0:Et.paper_reader_selection_enabled)===!0,paperArtifactsEnabled:e==="general"&&((Rt=Q.data)==null?void 0:Rt.paper_artifacts_enabled)===!0};return n.jsx(Ds,{enabled:e==="general",workspaceKey:S??"new-chat",onAskAiFix:l=>{ce(me(l))},children:n.jsxs("div",{className:`chat-page${e==="paper"?" chat-page--reader":""}`,style:{height:sr},children:[e==="general"&&n.jsx(os,{sessions:dt,activeSessionId:S,loading:T.isLoading,error:$||((It=T.error)==null?void 0:It.message)||"",open:c,onClose:()=>f(!1),onNew:ke,onNavigate:l=>{window.innerWidth<=900&&f(!1),A(`/chat/${l}`)},onRename:$e,onDelete:l=>void Ze(l)}),n.jsx(Ls,{enabled:e==="general",children:n.jsxs("section",{className:"chat-main","data-testid":"active-chat-pane",children:[n.jsxs("div",{className:"chat-topbar",children:[e==="general"&&!c&&n.jsx("button",{type:"button",className:"icon-btn",onClick:()=>f(!0),title:"Open sidebar",children:n.jsx(Kt,{})}),n.jsx("span",{className:"chat-topbar-title",children:Ve?(be==null?void 0:be.title)||"":(be==null?void 0:be.title)||(q==null?void 0:q.title)||(tt?"":"New chat")}),se&&n.jsx("span",{className:"chat-staging-badge",children:"Staging"}),e==="general"&&S&&et&&n.jsx(Ct,{className:"chat-reader-action",to:`/pdf/${et.route_id}`,onClick:l=>{if(!De()){l.preventDefault();return}const x=et.route_id;sessionStorage.setItem(`pwc:reader:session:${x}`,S),D&&sessionStorage.setItem(`pwc:reader:page:${x}`,String(D))},children:"Open reader"}),S&&Z&&!tt&&n.jsx(cs,{sessionId:S,busy:X,loading:Ve,hasPaperSelection:y.messages.some(l=>!!l.paperSelection),onError:F}),e==="paper"&&n.jsxs(mr,{children:[n.jsx(gr,{asChild:!0,children:n.jsx("button",{type:"button",className:"icon-btn chat-reader-icon-btn","aria-label":"Chat options",title:"Chat options",children:n.jsx(Jr,{"aria-hidden":"true"})})}),n.jsxs(yr,{align:"end",children:[n.jsx(At,{onSelect:ke,children:"New chat"}),n.jsx(At,{asChild:!0,children:n.jsx(Ct,{to:"/chat",children:"All chats"})})]})]}),e==="paper"&&L&&n.jsx("button",{type:"button",className:"icon-btn chat-reader-icon-btn",onClick:L,"aria-label":"Close chat",title:"Close chat",children:n.jsx(Pt,{"aria-hidden":"true"})})]}),je&&n.jsxs("div",{className:"chat-credits-notice",role:"status",children:[n.jsx("span",{children:je.message}),n.jsx("button",{type:"button",className:"chat-credits-notice-close","aria-label":"Dismiss credits notice",onClick:()=>{js(je.resetsAt),Ie(je.resetsAt)},children:"×"})]}),e==="general"&&pe&&n.jsx(ls,{descriptor:pe}),Ve&&!ye.text?n.jsxs("div",{className:"chat-session-loading",role:"status","aria-live":"polite",children:[n.jsx(Wt,{}),n.jsx("span",{children:"Loading conversation…"})]}):pt?n.jsxs("div",{className:"chat-session-load-error",role:"alert",children:[n.jsx("p",{children:pt}),n.jsx("button",{type:"button",onClick:()=>{re.refetch()},children:"Try again"})]}):tt&&!ye.text?n.jsx("div",{className:"chat-empty",children:n.jsxs("div",{className:"chat-empty-inner",children:[n.jsx("div",{className:"chat-empty-eyebrow",children:e==="paper"?"Paper chat":"Research chat"}),n.jsx("h1",{className:"chat-empty-title",children:e==="paper"?"Ask about this paper":n.jsxs(n.Fragment,{children:["Ask ",n.jsx("em",{children:"Papers With Code"})]})}),n.jsx("p",{className:"chat-empty-sub",children:e==="paper"?"Questions are grounded in the open paper. Add up to three other papers with @.":"Answers are grounded in a live hybrid search over papers, tasks, and benchmarks — with citations you can follow."}),se&&n.jsx("p",{className:"chat-staging-access-note",children:"This is a limited staging preview. Only approved Hugging Face users can start chats."}),n.jsx(Lt,{variant:"empty",composerProps:ft,provider:P,sponsored:ae,paused:w,error:y.sessionError,suggestions:e==="paper"?Ms:Wr})]})}):n.jsxs(n.Fragment,{children:[n.jsx(ts,{messages:y.messages,papers:y.papers,busy:X,queuedDraft:ye.text?ye:void 0,paperMentionsEnabled:!!((kt=Q.data)!=null&&kt.paper_mentions_enabled),archivePending:Be.pending,openRouterFallbackEnabled:nr,onToggleBlock:y.toggleBlock,onEditAndResend:y.editAndResend,onRetryFromProgress:y.retryFromProgress,onRetryWithLuna:tr?()=>void rr():void 0,onArchiveOld:()=>void Be.archiveOld(),onArchiveOldest:()=>void Be.archiveOldest()}),n.jsx(Lt,{variant:"followup",composerProps:ft,provider:P,sponsored:ae,paused:w,error:y.sessionError})]})]})}),y.capacityRequest&&n.jsx(rs,{retryAt:y.capacityRequest.retryAt,onCancel:y.cancelCapacity,onRetry:()=>{y.retryCapacity()&&(de(me()),o==null||o(void 0))}}),y.disabledRequest&&n.jsx(ss,{onClose:()=>{var x;const l=((x=y.disabledRequest)==null?void 0:x.draft)??xe;de(l),o==null||o(l.paperSelection),y.dismissDisabled(),Q.refetch()}})]})})},Os=e=>{const{user:r}=Ut();return n.jsx(Fs,{...e},(r==null?void 0:r.hf_subject)??"guest")},gn=()=>n.jsx(Os,{});export{Os as ChatExperience,gn as default}; diff --git a/assets/ConferenceDetailView-DgDeLFoO.js b/assets/ConferenceDetailView-DgDeLFoO.js new file mode 100644 index 0000000000000000000000000000000000000000..2182fe822d80e8ad9956bea90c44baea72691bdb --- /dev/null +++ b/assets/ConferenceDetailView-DgDeLFoO.js @@ -0,0 +1 @@ +import{u as y,b as k,d as _,j as e,L as h,T as S}from"./index-DyXq7-Tg.js";import{a as f,A as b,b as E}from"./AreaSection-BxnKzNK0.js";import{M as j}from"./MarkdownText-CUzPoC9Y.js";import{c as A}from"./catalog-CRar2olQ.js";import{i as C}from"./apiErrors-BSvbQBb0.js";import{s as F}from"./areas-Dvi8w2dp.js";import{c as T,h as L}from"./colors-BkWRhvFI.js";import{C as $}from"./conferenceListings-BnmhBx-_.js";import{f as w}from"./deadlines-BH32v7D1.js";import{d as D}from"./transform-D46m70Qr.js";import{S as P}from"./skeleton-C3IIzpSL.js";import{A as M,a as R}from"./alert-gbJBhAVE.js";import{s as B}from"./safeExternalHref-CkBrsh84.js";import I from"./NotFound-DV_nwcxG.js";/* empty css */import"./PaperPreviewLink-CpCZSa8K.js";import"./index-mCi_y_l3.js";import"./index-2CvJmBVB.js";import"./katex-DkKDou_j.js";import"./hover-card-B45EJIn_.js";import"./papers-Dh3ljlL0.js";import"./curation-YeS7FBYf.js";import"./useMutation-UWxBeqtn.js";const ce=()=>{var g,x;const{confSlug:o}=y(),t=k({queryKey:["conference-areas-with-tasks",o],queryFn:()=>A.conferenceAreasWithTasks(o),enabled:!!o,staleTime:S}),m=_.useMemo(()=>{var a;return F(((a=t.data)==null?void 0:a.results)??[])},[t.data]),s=(g=t.data)==null?void 0:g.conference,d=((x=t.data)==null?void 0:x.total_paper_count)??0,N=$.filter(a=>{var r;return(((r=t.data)==null?void 0:r[a.countKey])??0)>0});if(C(t.error))return e.jsx(I,{});if(t.error)return e.jsx("div",{className:"page",children:e.jsx(M,{variant:"destructive",children:e.jsx(R,{children:"Failed to load conference. Please try again."})})});const p=s?w(s.start_date,s.end_date):null,u=s?[s.venue,s.location].filter(Boolean).join(", "):null,n=s==null?void 0:s.name;return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:s!=null&&s.image_url?"task-hero-grid":void 0,children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:"CONFERENCE"}),e.jsx("h1",{className:"feed-title",children:n??e.jsx(P,{className:"h-10 w-64 inline-block"})}),e.jsxs("div",{className:"feed-subtitle",style:{display:"flex",flexDirection:"column",gap:4},children:[p&&e.jsx("span",{children:p}),u&&e.jsx("span",{children:u}),(s==null?void 0:s.url)&&e.jsx("a",{href:B(s.url)??void 0,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-text)"},children:s.url.replace(/^https?:\/\//,"")}),(s==null?void 0:s.hf_url)&&e.jsxs("a",{className:"bm-action-btn",href:s.hf_url,target:"_blank",rel:"noopener noreferrer",style:{alignSelf:"flex-start",marginTop:4},children:[e.jsx("span",{"aria-hidden":"true",children:"🤗"})," View on Hugging Face"]})]}),(s==null?void 0:s.description)&&e.jsx(j,{className:"method-description",text:s.description})]}),(s==null?void 0:s.image_url)&&e.jsxs("figure",{className:"task-figure-card",children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:s.image_url,alt:n?`${n} visual`:"Conference visual",onError:a=>{var r,c;(c=(r=a.currentTarget.parentElement)==null?void 0:r.parentElement)==null||c.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",n??"Conference",s.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(j,{className:"task-image-credit",text:s.image_credit})]})]})]})]}),!t.isLoading&&d>0&&e.jsx(f,{title:"Browse papers",description:"All accepted papers, plus oral, spotlight, outstanding, and best paper finalists.",meta:`${d.toLocaleString()} papers`,style:{marginTop:48},children:N.map(a=>{var r;return e.jsxs(h,{to:`/conferences/${o}/${a.slug}`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:a.dotColor}}),a.label]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[(((r=t.data)==null?void 0:r[a.countKey])??0).toLocaleString()," papers"]})})]},a.slug)})}),t.isLoading?e.jsx(b,{tiles:6,tileClassName:"h-24"}):m.map(a=>{const r=a.tasks;if(r.length===0)return null;const c=r.reduce((i,l)=>i+(l.paper_count||0),0);return e.jsx(f,{title:a.name,description:a.description,meta:`${r.length} ${r.length===1?"task":"tasks"} · ${c.toLocaleString()} papers`,children:r.map(i=>{const l=i.slug||"",v=T(L(l));return e.jsxs(h,{to:`/conferences/${o}/${l}`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:v.dot}}),D(i.name,l)]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[(i.paper_count??0).toLocaleString()," papers"]})})]},i.id)})},a.id)}),e.jsx(E,{areas:m})]})};export{ce as default}; diff --git a/assets/ConferenceDetailView-i-HB-ysc.js b/assets/ConferenceDetailView-i-HB-ysc.js deleted file mode 100644 index fabd70380fa4a6e12007883e6328d17024637d5a..0000000000000000000000000000000000000000 --- a/assets/ConferenceDetailView-i-HB-ysc.js +++ /dev/null @@ -1 +0,0 @@ -import{u as y,r as k,j as e,L as h}from"./index-CbgxfyGU.js";import{u as _}from"./useQuery-Bx9s5-D2.js";import{a as f,A as S,b}from"./AreaSection-NWvfO4Sb.js";import{M as j}from"./MarkdownText-Bj-G_S-B.js";import{c as A}from"./catalog-DhK7_9-6.js";import{i as C}from"./apiErrors-BZ5h1Kmb.js";import{s as E}from"./areas-Dvi8w2dp.js";import{c as F,h as L}from"./colors-BkWRhvFI.js";import{C as $}from"./conferenceListings-BnmhBx-_.js";import{f as T}from"./deadlines-BH32v7D1.js";import{d as w}from"./transform-0Udg2p6b.js";import{S as D}from"./skeleton-HwvdxvSN.js";import{A as P,a as R}from"./alert-CFDDvdIM.js";import{s as B}from"./safeExternalHref-CkBrsh84.js";import K from"./NotFound-DtzwOULp.js";/* empty css */import"./PaperPreviewLink-DZDNIh1g.js";import"./index-ZkEATkOr.js";import"./index-BH3yOoza.js";import"./katex-DkKDou_j.js";import"./hover-card-ufez2uMo.js";import"./paperQueryKeys-B8u1BWlI.js";import"./curation-C7Gmmp4z.js";import"./useMutation-P_trTy9i.js";const ce=()=>{var g,x;const{confSlug:o}=y(),t=_({queryKey:["conference-areas-with-tasks",o],queryFn:()=>A.conferenceAreasWithTasks(o),enabled:!!o,staleTime:10*60*1e3}),m=k.useMemo(()=>{var a;return E(((a=t.data)==null?void 0:a.results)??[])},[t.data]),s=(g=t.data)==null?void 0:g.conference,d=((x=t.data)==null?void 0:x.total_paper_count)??0,N=$.filter(a=>{var r;return(((r=t.data)==null?void 0:r[a.countKey])??0)>0});if(C(t.error))return e.jsx(K,{});if(t.error)return e.jsx("div",{className:"page",children:e.jsx(P,{variant:"destructive",children:e.jsx(R,{children:"Failed to load conference. Please try again."})})});const p=s?T(s.start_date,s.end_date):null,u=s?[s.venue,s.location].filter(Boolean).join(", "):null,n=s==null?void 0:s.name;return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:s!=null&&s.image_url?"task-hero-grid":void 0,children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:"CONFERENCE"}),e.jsx("h1",{className:"feed-title",children:n??e.jsx(D,{className:"h-10 w-64 inline-block"})}),e.jsxs("div",{className:"feed-subtitle",style:{display:"flex",flexDirection:"column",gap:4},children:[p&&e.jsx("span",{children:p}),u&&e.jsx("span",{children:u}),(s==null?void 0:s.url)&&e.jsx("a",{href:B(s.url)??void 0,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-text)"},children:s.url.replace(/^https?:\/\//,"")}),(s==null?void 0:s.hf_url)&&e.jsxs("a",{className:"bm-action-btn",href:s.hf_url,target:"_blank",rel:"noopener noreferrer",style:{alignSelf:"flex-start",marginTop:4},children:[e.jsx("span",{"aria-hidden":"true",children:"🤗"})," View on Hugging Face"]})]}),(s==null?void 0:s.description)&&e.jsx(j,{className:"method-description",text:s.description})]}),(s==null?void 0:s.image_url)&&e.jsxs("figure",{className:"task-figure-card",children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:s.image_url,alt:n?`${n} visual`:"Conference visual",onError:a=>{var r,c;(c=(r=a.currentTarget.parentElement)==null?void 0:r.parentElement)==null||c.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",n??"Conference",s.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(j,{className:"task-image-credit",text:s.image_credit})]})]})]})]}),!t.isLoading&&d>0&&e.jsx(f,{title:"Browse papers",description:"All accepted papers, plus oral, spotlight, outstanding, and best paper finalists.",meta:`${d.toLocaleString()} papers`,style:{marginTop:48},children:N.map(a=>{var r;return e.jsxs(h,{to:`/conferences/${o}/${a.slug}`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:a.dotColor}}),a.label]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[(((r=t.data)==null?void 0:r[a.countKey])??0).toLocaleString()," papers"]})})]},a.slug)})}),t.isLoading?e.jsx(S,{tiles:6,tileClassName:"h-24"}):m.map(a=>{const r=a.tasks;if(r.length===0)return null;const c=r.reduce((i,l)=>i+(l.paper_count||0),0);return e.jsx(f,{title:a.name,description:a.description,meta:`${r.length} ${r.length===1?"task":"tasks"} · ${c.toLocaleString()} papers`,children:r.map(i=>{const l=i.slug||"",v=F(L(l));return e.jsxs(h,{to:`/conferences/${o}/${l}`,className:"tag-cell",children:[e.jsxs("div",{className:"name",children:[e.jsx("span",{className:"dot",style:{background:v.dot}}),w(i.name,l)]}),e.jsx("div",{className:"meta",children:e.jsxs("span",{children:[(i.paper_count??0).toLocaleString()," papers"]})})]},i.id)})},a.id)}),e.jsx(b,{areas:m})]})};export{ce as default}; diff --git a/assets/ConferenceTaskView-BZBMXZD8.js b/assets/ConferenceTaskView-BZBMXZD8.js deleted file mode 100644 index 20ca92e588d01ea059ece60559d12cdda3dec3a1..0000000000000000000000000000000000000000 --- a/assets/ConferenceTaskView-BZBMXZD8.js +++ /dev/null @@ -1 +0,0 @@ -import{u as S,r as F,j as e,L as x}from"./index-CbgxfyGU.js";import{u as _}from"./useQuery-Bx9s5-D2.js";import{u as T,b as R,a as L}from"./PaperFeed-DMvUfA47.js";import{M as g}from"./MarkdownText-Bj-G_S-B.js";import{c as A}from"./catalog-DhK7_9-6.js";import{p as M,a as q}from"./paperQueryKeys-B8u1BWlI.js";import{i as E}from"./apiErrors-BZ5h1Kmb.js";import{C as B}from"./conferenceListings-BnmhBx-_.js";import{t as O,d as Q}from"./transform-0Udg2p6b.js";import{u as z}from"./usePapers-CJaWLZ3y.js";import{A as H,a as I}from"./alert-CFDDvdIM.js";import K from"./NotFound-DtzwOULp.js";import"./PaperCard-tdTC_dRN.js";import"./AuthorAvatar-CUJMmp_z.js";import"./SotaBadges-C-sTR-EF.js";import"./colors-BkWRhvFI.js";import"./Icon-D-kA0Owz.js";import"./LatexTitle-Z-HGmZ-H.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-DKJYnYjk.js";import"./skeleton-HwvdxvSN.js";import"./useIntersectionObserver-CID9Kkak.js";/* empty css */import"./PaperPreviewLink-DZDNIh1g.js";import"./index-ZkEATkOr.js";import"./index-BH3yOoza.js";import"./katex-DkKDou_j.js";import"./hover-card-ufez2uMo.js";import"./useMutation-P_trTy9i.js";import"./curation-C7Gmmp4z.js";import"./useInfiniteQuery-BAc_4HO5.js";const $={"iclr-2026/outstanding":"ICLR 2026 recognized two Outstanding Papers and one Honorable Mention. [Read the announcement](https://blog.iclr.cc/2026/04/23/announcing-the-iclr-2026-outstanding-papers/).","icml-2026/outstanding":"ICML 2026 recognized two Outstanding Papers and five Honorable Mentions. [Read the announcement](https://blog.icml.cc/2026/07/05/announcing-the-icml-2026-awards/).","cvpr-2026/best-paper-finalists":"CVPR 2026 recognized fifteen Best Paper Award finalists, including the winners. [Read the announcement](https://x.com/CVPR/status/2062912519522717978)."},ye=()=>{var b,v,y,P,k,w;const{confSlug:t,taskSlug:n}=S(),p=T(),a=B.find(s=>s.slug===n),u=!!(a!=null&&a.award),i=_({queryKey:["conference",t],queryFn:()=>A.getConference(t),enabled:!!t,staleTime:10*60*1e3}),c=_({queryKey:["task",n],queryFn:()=>A.getTask(n),enabled:!!n&&!a,staleTime:10*60*1e3}),l=z([...M.feeds.conference,t,n,p.filters],s=>q.forConference(t,{...p.filters,task:a?void 0:n,presentation:a==null?void 0:a.presentation,page:s,page_size:12}),{enabled:!!t}),f=F.useMemo(()=>{var s;return((s=l.data)==null?void 0:s.pages.flatMap(o=>o.results))??[]},[l.data]),h=F.useMemo(()=>f.map(O),[f]),d=(a==null?void 0:a.label)??Q(((b=c.data)==null?void 0:b.name)||n||"",((v=c.data)==null?void 0:v.slug)||n),j=$[`${t}/${n}`],N=((P=(y=l.data)==null?void 0:y.pages[0])==null?void 0:P.count)??((k=i.data)==null?void 0:k.paper_count)??0,r=c.data;return E(i.error)||E(c.error)?e.jsx(K,{}):i.error||c.error||l.error?e.jsx("div",{className:"page",children:e.jsx(H,{variant:"destructive",children:e.jsx(I,{children:"Failed to load conference papers. Please try again."})})}):e.jsxs("div",{className:"page",children:[e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(x,{to:"/",children:"Home"}),e.jsx("span",{children:" / "}),e.jsx(x,{to:"/conferences",children:"Conferences"}),e.jsx("span",{children:" / "}),e.jsx(x,{to:`/conferences/${t}`,children:((w=i.data)==null?void 0:w.name)??t}),e.jsx("span",{children:" / "}),e.jsx("span",{children:d})]}),e.jsxs("div",{className:!a&&(r!=null&&r.image_url)?"task-hero-grid":void 0,style:{marginTop:16,marginBottom:28},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:a?"BROWSE PAPERS":"TASK"}),e.jsx("h1",{className:"domain-mega-title",children:d}),j&&e.jsx(g,{className:"task-explainer",text:j}),!a&&(r==null?void 0:r.description)&&e.jsx(g,{className:"task-explainer",text:r.description}),i.data&&e.jsxs("div",{className:"task-quickstats",style:{marginTop:12},children:[e.jsxs("span",{children:[e.jsx("span",{className:"num",children:N.toLocaleString()}),"PAPERS"]}),e.jsx("span",{children:i.data.name})]})]}),!a&&(r==null?void 0:r.image_url)&&e.jsxs("figure",{className:"task-figure-card",children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:r.image_url,alt:`${d} schematic`,onError:s=>{var o,m;(m=(o=s.currentTarget.parentElement)==null?void 0:o.parentElement)==null||m.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",d,r.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(g,{className:"task-image-credit",text:r.image_credit})]})]})]})]}),e.jsxs("div",{className:"task-section-head",children:[e.jsx("div",{className:"task-section-eyebrow",children:u?"Award papers":"Conference papers · sort below"}),e.jsxs("div",{className:"task-section-title",children:["Papers ",e.jsxs("span",{className:"meta",children:["[",N.toLocaleString(),"]"]})]})]}),e.jsx(R,{feed:p,sorts:u?null:void 0,children:!u&&e.jsxs("div",{className:"results-count",children:[h.length," loaded in ",e.jsx("span",{children:d})]})}),e.jsx(L,{query:l,cards:h,empty:"No papers found for this selection.",cardHeader:s=>{var C;const o=(C=f[s])==null?void 0:C.conference_award,m=o==="outstanding"?"Outstanding Paper":o==="honorable_mention"?"Honorable Mention":o==="best_paper_finalist"&&(a==null?void 0:a.presentation)!=="best_paper_finalist"?"Best Paper Finalist":null;return m&&e.jsx("div",{className:"conference-award-label",children:m})}})]})};export{ye as default}; diff --git a/assets/ConferenceTaskView-BvWfAecx.js b/assets/ConferenceTaskView-BvWfAecx.js new file mode 100644 index 0000000000000000000000000000000000000000..31943bdf5902cc9f9b1678e40d2678c788f60800 --- /dev/null +++ b/assets/ConferenceTaskView-BvWfAecx.js @@ -0,0 +1 @@ +import{u as S,b as _,p as R,d as C,j as e,L as x,o as M,T as E}from"./index-DyXq7-Tg.js";import{u as L,b as Q,a as q}from"./PaperFeed-EBt97iOL.js";import{M as g}from"./MarkdownText-CUzPoC9Y.js";import{c as F}from"./catalog-CRar2olQ.js";import{p as B}from"./papers-Dh3ljlL0.js";import{i as A}from"./apiErrors-BSvbQBb0.js";import{C as O}from"./conferenceListings-BnmhBx-_.js";import{t as z,d as H}from"./transform-D46m70Qr.js";import{u as I}from"./usePapers-B0s20UcU.js";import{A as K,a as $}from"./alert-gbJBhAVE.js";import V from"./NotFound-DV_nwcxG.js";import"./PaperCard-57p1OSGy.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./SotaBadges-vbLLOUtT.js";import"./colors-BkWRhvFI.js";import"./Icon-T4LYkEQj.js";import"./LatexTitle-Bkyz3jCs.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-CTBEUp7Y.js";import"./skeleton-C3IIzpSL.js";import"./useIntersectionObserver-D6_Iig9a.js";/* empty css */import"./PaperPreviewLink-CpCZSa8K.js";import"./index-mCi_y_l3.js";import"./index-2CvJmBVB.js";import"./katex-DkKDou_j.js";import"./hover-card-B45EJIn_.js";import"./useMutation-UWxBeqtn.js";import"./curation-YeS7FBYf.js";import"./useInfiniteQuery-BYh2zN-T.js";const D={"iclr-2026/outstanding":"ICLR 2026 recognized two Outstanding Papers and one Honorable Mention. [Read the announcement](https://blog.iclr.cc/2026/04/23/announcing-the-iclr-2026-outstanding-papers/).","icml-2026/outstanding":"ICML 2026 recognized two Outstanding Papers and five Honorable Mentions. [Read the announcement](https://blog.icml.cc/2026/07/05/announcing-the-icml-2026-awards/).","cvpr-2026/best-paper-finalists":"CVPR 2026 recognized fifteen Best Paper Award finalists, including the winners. [Read the announcement](https://x.com/CVPR/status/2062912519522717978)."},Pe=()=>{var b,y,v,P,k,w;const{confSlug:t,taskSlug:n}=S(),p=L(),a=O.find(r=>r.slug===n),u=!!(a!=null&&a.award),i=_({queryKey:["conference",t],queryFn:()=>F.getConference(t),enabled:!!t,staleTime:E}),c=_({queryKey:M.task(n),queryFn:()=>F.getTask(n),enabled:!!n&&!a,staleTime:E}),l=I([...R.feeds.conference,t,n,p.filters],r=>B.forConference(t,{...p.filters,task:a?void 0:n,presentation:a==null?void 0:a.presentation,page:r,page_size:12}),{enabled:!!t}),f=C.useMemo(()=>{var r;return((r=l.data)==null?void 0:r.pages.flatMap(o=>o.results))??[]},[l.data]),h=C.useMemo(()=>f.map(z),[f]),d=(a==null?void 0:a.label)??H(((b=c.data)==null?void 0:b.name)||n||"",((y=c.data)==null?void 0:y.slug)||n),j=D[`${t}/${n}`],N=((P=(v=l.data)==null?void 0:v.pages[0])==null?void 0:P.count)??((k=i.data)==null?void 0:k.paper_count)??0,s=c.data;return A(i.error)||A(c.error)?e.jsx(V,{}):i.error||c.error||l.error?e.jsx("div",{className:"page",children:e.jsx(K,{variant:"destructive",children:e.jsx($,{children:"Failed to load conference papers. Please try again."})})}):e.jsxs("div",{className:"page",children:[e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(x,{to:"/",children:"Home"}),e.jsx("span",{children:" / "}),e.jsx(x,{to:"/conferences",children:"Conferences"}),e.jsx("span",{children:" / "}),e.jsx(x,{to:`/conferences/${t}`,children:((w=i.data)==null?void 0:w.name)??t}),e.jsx("span",{children:" / "}),e.jsx("span",{children:d})]}),e.jsxs("div",{className:!a&&(s!=null&&s.image_url)?"task-hero-grid":void 0,style:{marginTop:16,marginBottom:28},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:a?"BROWSE PAPERS":"TASK"}),e.jsx("h1",{className:"domain-mega-title",children:d}),j&&e.jsx(g,{className:"task-explainer",text:j}),!a&&(s==null?void 0:s.description)&&e.jsx(g,{className:"task-explainer",text:s.description}),i.data&&e.jsxs("div",{className:"task-quickstats",style:{marginTop:12},children:[e.jsxs("span",{children:[e.jsx("span",{className:"num",children:N.toLocaleString()}),"PAPERS"]}),e.jsx("span",{children:i.data.name})]})]}),!a&&(s==null?void 0:s.image_url)&&e.jsxs("figure",{className:"task-figure-card",children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:s.image_url,alt:`${d} schematic`,onError:r=>{var o,m;(m=(o=r.currentTarget.parentElement)==null?void 0:o.parentElement)==null||m.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",d,s.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(g,{className:"task-image-credit",text:s.image_credit})]})]})]})]}),e.jsxs("div",{className:"task-section-head",children:[e.jsx("div",{className:"task-section-eyebrow",children:u?"Award papers":"Conference papers · sort below"}),e.jsxs("div",{className:"task-section-title",children:["Papers ",e.jsxs("span",{className:"meta",children:["[",N.toLocaleString(),"]"]})]})]}),e.jsx(Q,{feed:p,sorts:u?null:void 0,children:!u&&e.jsxs("div",{className:"results-count",children:[h.length," loaded in ",e.jsx("span",{children:d})]})}),e.jsx(q,{query:l,cards:h,empty:"No papers found for this selection.",cardHeader:r=>{var T;const o=(T=f[r])==null?void 0:T.conference_award,m=o==="outstanding"?"Outstanding Paper":o==="honorable_mention"?"Honorable Mention":o==="best_paper_finalist"&&(a==null?void 0:a.presentation)!=="best_paper_finalist"?"Best Paper Finalist":null;return m&&e.jsx("div",{className:"conference-award-label",children:m})}})]})};export{Pe as default}; diff --git a/assets/ConferencesIndexView-Cw6IrAk5.js b/assets/ConferencesIndexView-Cw6IrAk5.js deleted file mode 100644 index 971bf643e6e5104ac35603940c30fb9b75c3db76..0000000000000000000000000000000000000000 --- a/assets/ConferencesIndexView-Cw6IrAk5.js +++ /dev/null @@ -1 +0,0 @@ -import{r as d,j as e,L as c}from"./index-CbgxfyGU.js";import{u as m}from"./useQuery-Bx9s5-D2.js";import{c as p}from"./catalog-DhK7_9-6.js";import{f as u}from"./deadlines-BH32v7D1.js";import{A as f,a as h}from"./alert-CFDDvdIM.js";import{A as x,a as g}from"./AreaSection-NWvfO4Sb.js";import{T as j}from"./TaxonomySuggestionTile-DIw_GKfA.js";import"./skeleton-HwvdxvSN.js";import"./SignInToEditDialog-CNIcNqbK.js";import"./button-Bv9oZ-QU.js";import"./input-B6pxtfPe.js";import"./textarea-Bf06GTSH.js";import"./searchable-select-DNdBIahG.js";import"./popover-DKJYnYjk.js";import"./dialog-Cfp_d3CC.js";import"./search-CLtAJGOp.js";import"./loader-circle-CWMja8Zn.js";import"./useMutation-P_trTy9i.js";import"./submissions-aWj7YtuZ.js";import"./plus-UK0TEjgd.js";const v=r=>{var t;if(r.year!=null)return r.year;if(r.start_date)return Number(r.start_date.slice(0,4));const a=(t=r.slug.match(/-(\d{4})$/))==null?void 0:t[1];return a?Number(a):0},N=(r,a)=>{if(r.start_date&&a.start_date){const t=r.start_date.localeCompare(a.start_date);if(t!==0)return t}else{if(r.start_date)return-1;if(a.start_date)return 1}return r.name.localeCompare(a.name)},R=()=>{const r=m({queryKey:["conferences"],queryFn:()=>p.conferences(),staleTime:6e5}),a=d.useMemo(()=>{var i;if(!((i=r.data)!=null&&i.results))return null;const t={};return r.data.results.forEach(n=>{const s=v(n);(t[s]||(t[s]=[])).push(n)}),Object.values(t).forEach(n=>n.sort(N)),Object.keys(t).map(Number).sort((n,s)=>s-n).map(n=>({year:n,conferences:t[n]}))},[r.data]);return r.error?e.jsx("div",{className:"page",children:e.jsx(f,{variant:"destructive",children:e.jsx(h,{children:"Failed to load conferences. Please try again."})})}):e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["All ",e.jsx("em",{children:"Conferences"})]}),e.jsx("div",{className:"feed-subtitle",children:"Browse accepted papers from major AI conferences, grouped by research area and task."}),e.jsxs("div",{className:"conference-deadlines-link",children:["Find deadlines for upcoming conferences"," ",e.jsx(c,{to:"/ai-deadlines",className:"underline underline-offset-2 hover:text-foreground",children:"here"}),". Conference information is based on"," ",e.jsx("a",{href:"https://huggingface.co/ai-conferences",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Hugging Face AI Conferences"}),"."]})]})}),r.isLoading?e.jsx(x,{sections:2,tiles:3,tileClassName:"h-32"}):a==null?void 0:a.map(({year:t,conferences:i})=>{const n=i.reduce((s,o)=>s+(o.paper_count??0),0);return e.jsxs(g,{title:t>0?String(t):"Unknown year",meta:`${i.length} ${i.length===1?"conference":"conferences"} · ${n.toLocaleString()} papers`,children:[i.map(s=>{const o=u(s.start_date,s.end_date),l=[s.venue,s.location].filter(Boolean).join(", ");return e.jsxs(c,{to:`/conferences/${s.slug}`,className:"tag-cell",children:[e.jsx("div",{className:"name",children:s.name}),e.jsxs("div",{className:"meta",style:{display:"flex",flexDirection:"column",gap:4},children:[o&&e.jsx("span",{children:o}),l&&e.jsx("span",{children:l}),e.jsxs("span",{children:[(s.paper_count??0).toLocaleString()," papers"]})]})]},s.id)}),e.jsx(j,{kind:"conference"})]},t)})]})};export{R as default}; diff --git a/assets/ConferencesIndexView-DJVYKUiz.js b/assets/ConferencesIndexView-DJVYKUiz.js new file mode 100644 index 0000000000000000000000000000000000000000..d3f1e532add052124a29b6ecee7453609474b119 --- /dev/null +++ b/assets/ConferencesIndexView-DJVYKUiz.js @@ -0,0 +1 @@ +import{b as d,d as m,j as e,L as c,T as p}from"./index-DyXq7-Tg.js";import{c as u}from"./catalog-CRar2olQ.js";import{f}from"./deadlines-BH32v7D1.js";import{A as h,a as x}from"./alert-gbJBhAVE.js";import{A as g,a as j}from"./AreaSection-BxnKzNK0.js";import{T as N}from"./TaxonomySuggestionTile-jIiLMp4q.js";import"./skeleton-C3IIzpSL.js";import"./SignInToEditDialog-B-oWVno5.js";import"./button-DZeAbOf2.js";import"./input-DJqCAbs7.js";import"./textarea-DPixlM5U.js";import"./searchable-select-DiDLwvbI.js";import"./popover-CTBEUp7Y.js";import"./dialog-CfM0Uql2.js";import"./search-8ssWDP68.js";import"./loader-circle-C75KLEgx.js";import"./useMutation-UWxBeqtn.js";import"./submissions-Cz_J-Ha2.js";import"./plus-Yh42pKZz.js";const v=r=>{var t;if(r.year!=null)return r.year;if(r.start_date)return Number(r.start_date.slice(0,4));const a=(t=r.slug.match(/-(\d{4})$/))==null?void 0:t[1];return a?Number(a):0},_=(r,a)=>{if(r.start_date&&a.start_date){const t=r.start_date.localeCompare(a.start_date);if(t!==0)return t}else{if(r.start_date)return-1;if(a.start_date)return 1}return r.name.localeCompare(a.name)},Q=()=>{const r=d({queryKey:["conferences"],queryFn:()=>u.conferences(),staleTime:p}),a=m.useMemo(()=>{var i;if(!((i=r.data)!=null&&i.results))return null;const t={};return r.data.results.forEach(n=>{const s=v(n);(t[s]||(t[s]=[])).push(n)}),Object.values(t).forEach(n=>n.sort(_)),Object.keys(t).map(Number).sort((n,s)=>s-n).map(n=>({year:n,conferences:t[n]}))},[r.data]);return r.error?e.jsx("div",{className:"page",children:e.jsx(h,{variant:"destructive",children:e.jsx(x,{children:"Failed to load conferences. Please try again."})})}):e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["All ",e.jsx("em",{children:"Conferences"})]}),e.jsx("div",{className:"feed-subtitle",children:"Browse accepted papers from major AI conferences, grouped by research area and task."}),e.jsxs("div",{className:"conference-deadlines-link",children:["Find deadlines for upcoming conferences"," ",e.jsx(c,{to:"/ai-deadlines",className:"underline underline-offset-2 hover:text-foreground",children:"here"}),". Conference information is based on"," ",e.jsx("a",{href:"https://huggingface.co/ai-conferences",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Hugging Face AI Conferences"}),"."]})]})}),r.isLoading?e.jsx(g,{sections:2,tiles:3,tileClassName:"h-32"}):a==null?void 0:a.map(({year:t,conferences:i})=>{const n=i.reduce((s,o)=>s+(o.paper_count??0),0);return e.jsxs(j,{title:t>0?String(t):"Unknown year",meta:`${i.length} ${i.length===1?"conference":"conferences"} · ${n.toLocaleString()} papers`,children:[i.map(s=>{const o=f(s.start_date,s.end_date),l=[s.venue,s.location].filter(Boolean).join(", ");return e.jsxs(c,{to:`/conferences/${s.slug}`,className:"tag-cell",children:[e.jsx("div",{className:"name",children:s.name}),e.jsxs("div",{className:"meta",style:{display:"flex",flexDirection:"column",gap:4},children:[o&&e.jsx("span",{children:o}),l&&e.jsx("span",{children:l}),e.jsxs("span",{children:[(s.paper_count??0).toLocaleString()," papers"]})]})]},s.id)}),e.jsx(N,{kind:"conference"})]},t)})]})};export{Q as default}; diff --git a/assets/CronDashboard-CC1lPV3k.js b/assets/CronDashboard-CC1lPV3k.js deleted file mode 100644 index 53d58ee9b0bdff4ecf74ccc20cfe193cced6bc93..0000000000000000000000000000000000000000 --- a/assets/CronDashboard-CC1lPV3k.js +++ /dev/null @@ -1,36 +0,0 @@ -import{n as D,r as x,F as is,w as cs,j as e,v as ie,a9 as ls,R as ds,I as os,y as oe,P as ms,A as us,G as Re,B as $,f as xe,K as Te,L as pe,a as hs,m as xs}from"./index-CbgxfyGU.js";import{u as z}from"./useQuery-Bx9s5-D2.js";import{u as L}from"./useMutation-P_trTy9i.js";import{t as ge,f as v,a as S,S as Ae,o as ue,C as g,b as f,c as N,d as P,e as j,g as C}from"./CronDashboard-B3Xofwvu.js";import{B as I}from"./badge-Klg-RRGs.js";import{B as y}from"./button-Bv9oZ-QU.js";import{C as ps,a as gs}from"./chevron-up-Cpt5JLeI.js";import{D as fe}from"./database-CTvEb5JG.js";import{T as js}from"./trending-up-B3K5RlyX.js";import{A as ne}from"./activity-dcKMRXBy.js";import{F as Ne}from"./file-text-BK_7Q2rV.js";import{T as Ee,I as vs}from"./triangle-alert-U7T_j3JE.js";import{E as X}from"./external-link-DZIH4GGr.js";import{C as Y,R as be}from"./refresh-cw-Cps6nypW.js";import{L as R}from"./loader-circle-CWMja8Zn.js";import{C as je}from"./circle-check-Bci9ZTu9.js";import{c as E,A as _s}from"./codex-Bl7j51l-.js";import{u as fs}from"./useInfiniteQuery-BAc_4HO5.js";import{p as Me}from"./paperEdits-C5GTaRR8.js";import{c as me}from"./catalog-DhK7_9-6.js";import{c as ye}from"./chat-DzTo2WUO.js";/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const we=D("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ns=D("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bs=D("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ys=D("CircleSlash2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ws=D("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qe=D("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ks=D("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);var ce="Tabs",[Cs]=us(ce,[Re]),Ie=Re(),[Ss,ve]=Cs(ce),De=x.forwardRef((s,r)=>{const{__scopeTabs:n,value:l,onValueChange:i,defaultValue:o,orientation:m="horizontal",dir:_,activationMode:p="automatic",...h}=s,c=is(_),[t,b]=cs({prop:l,onChange:i,defaultProp:o??"",caller:ce});return e.jsx(Ss,{scope:n,baseId:ls(),value:t,onValueChange:b,orientation:m,dir:c,activationMode:p,children:e.jsx(ie.div,{dir:c,"data-orientation":m,...h,ref:r})})});De.displayName=ce;var Oe="TabsList",Je=x.forwardRef((s,r)=>{const{__scopeTabs:n,loop:l=!0,...i}=s,o=ve(Oe,n),m=Ie(n);return e.jsx(ds,{asChild:!0,...m,orientation:o.orientation,dir:o.dir,loop:l,children:e.jsx(ie.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:r})})});Je.displayName=Oe;var Be="TabsTrigger",Ue=x.forwardRef((s,r)=>{const{__scopeTabs:n,value:l,disabled:i=!1,...o}=s,m=ve(Be,n),_=Ie(n),p=Ke(m.baseId,l),h=ze(m.baseId,l),c=l===m.value;return e.jsx(os,{asChild:!0,..._,focusable:!i,active:c,children:e.jsx(ie.button,{type:"button",role:"tab","aria-selected":c,"aria-controls":h,"data-state":c?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:p,...o,ref:r,onMouseDown:oe(s.onMouseDown,t=>{!i&&t.button===0&&t.ctrlKey===!1?m.onValueChange(l):t.preventDefault()}),onKeyDown:oe(s.onKeyDown,t=>{[" ","Enter"].includes(t.key)&&m.onValueChange(l)}),onFocus:oe(s.onFocus,()=>{const t=m.activationMode!=="manual";!c&&!i&&t&&m.onValueChange(l)})})})});Ue.displayName=Be;var He="TabsContent",We=x.forwardRef((s,r)=>{const{__scopeTabs:n,value:l,forceMount:i,children:o,...m}=s,_=ve(He,n),p=Ke(_.baseId,l),h=ze(_.baseId,l),c=l===_.value,t=x.useRef(c);return x.useEffect(()=>{const b=requestAnimationFrame(()=>t.current=!1);return()=>cancelAnimationFrame(b)},[]),e.jsx(ms,{present:i||c,children:({present:b})=>e.jsx(ie.div,{"data-state":c?"active":"inactive","data-orientation":_.orientation,role:"tabpanel","aria-labelledby":p,hidden:!b,id:h,tabIndex:0,...m,ref:r,style:{...s.style,animationDuration:t.current?"0s":void 0},children:b&&o})})});We.displayName=He;function Ke(s,r){return`${s}-trigger-${r}`}function ze(s,r){return`${s}-content-${r}`}var $s=De,Ge=Je,Qe=Ue,Ve=We;const Ls=$s,Xe=x.forwardRef(({className:s,...r},n)=>e.jsx(Ge,{ref:n,className:$("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...r}));Xe.displayName=Ge.displayName;const U=x.forwardRef(({className:s,...r},n)=>e.jsx(Qe,{ref:n,className:$("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",s),...r}));U.displayName=Qe.displayName;const H=x.forwardRef(({className:s,...r},n)=>e.jsx(Ve,{ref:n,className:$("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...r}));H.displayName=Ve.displayName;function F({tone:s,className:r,...n}){return e.jsx(I,{variant:"outline",className:$(ge(s),r),...n})}function te(s){return s==null?"N/A":s<60?`${s.toFixed(1)}s`:s<3600?`${(s/60).toFixed(1)}m`:`${(s/3600).toFixed(1)}h`}function Ye(s){return s.available?s.status==="completed"?s.conclusion??"completed":s.status??"unknown":"Unavailable"}function V(s){return s.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function ke({title:s,budget:r,profile:n}){const l=r.cost_policy==="unmetered_hf"||r.budget_enforced===!1,i=Math.min(100,r.current_exposure_usd/r.ceiling_usd*100),o=l?"Unmetered HF":r.affordable_jobs===0&&r.desired_jobs>0?"No shard fits":r.affordable_jobs0?"Now":"No scheduled admission"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Unknown terminal reserve"}),e.jsxs("div",{children:[S(r.unknown_terminal_reservation_usd??0)," · ",(r.unknown_terminal_reservation_count??0).toLocaleString()," jobs"]})]})]}),n&&e.jsxs("div",{className:"text-xs cron-muted",children:["Profile ",e.jsx("strong",{children:n.profile_id})," · max ",n.max_papers.toLocaleString()," papers · hard ",te(n.hard_timeout_seconds)," · soft ",te(n.soft_deadline_seconds)]}),e.jsx("p",{className:"text-xs cron-muted",children:l?"HF owns this workload, so monetary admission is disabled; concurrency and timeout limits still apply. Runtime cost remains an operational estimate.":"Projected exposure is an admission-control estimate, not a provider invoice. Each launch reserves the full timeout until actual runtime is known."})]})}const Ps={healthy:je,degraded:Ee,broken:Y,running:R,stuck:Y,unknown:Ns};function Fs({status:s,isRunning:r}){const n=r?"running":s,l=Ps[n];return e.jsx(l,{className:`cron-status-icon ${ge(n)}${n==="running"?" animate-spin":""}`})}function Ce({label:s,axis:r}){return e.jsxs(F,{tone:r.status,title:r.reason,children:[s,": ",r.status]})}function Se({icon:s,title:r,metrics:n}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(s,{className:"h-4 w-4"}),e.jsx("h4",{children:r})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Object.entries(n).map(([l,i])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:V(l)}),e.jsx("div",{className:"text-lg font-semibold",children:typeof i=="number"?i.toLocaleString():i})]},l))})]})}function Rs({workflow:s}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(ne,{className:"h-4 w-4"}),e.jsx("h4",{children:"GitHub Actions"})]}),e.jsxs("div",{className:"cron-metric-card space-y-2 text-sm",children:[[["Workflow",s.workflow_file],["Run",s.run_id??"N/A"],["Status",Ye(s)],...s.updated_at?[["Updated",v(s.updated_at)]]:[]].map(([r,n])=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"cron-label",children:r}),e.jsx("span",{className:r==="Workflow"?"font-mono text-xs":void 0,children:n})]},r)),s.failed_jobs&&s.failed_jobs.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Failed jobs"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:s.failed_jobs.map(r=>e.jsx(F,{tone:"broken",children:r},r))})]}),s.job_conclusions&&Object.keys(s.job_conclusions).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Job conclusions"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:Object.entries(s.job_conclusions).map(([r,n])=>e.jsxs(I,{variant:"outline",children:[r,": ",n??"running"]},r))})]}),(s.error||s.view_error)&&e.jsx("div",{className:"cron-message cron-message--error",children:s.error??s.view_error})]})]})}const Ts={COMPLETED:"healthy",ERROR:"broken",CANCELED:"broken",RUNNING:"running"},$e={success:"healthy",partial:"degraded",interrupted:"degraded",infrastructure_failure:"broken",worker_failure:"broken",active:"running"};function As({job:s}){const r=s.progress,n=(r==null?void 0:r.omitted_images)??0,l=r!=null&&r.total_papers?Math.min(100,r.processed_papers/r.total_papers*100):0;return e.jsxs("div",{className:"cron-metric-card space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-semibold",children:[s.mode??"unknown"," · shard ",s.shard_id??"N/A"," · attempt ",s.provider_attempt??1]}),e.jsx("div",{className:"font-mono text-xs cron-muted truncate",children:s.id})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{tone:Ts[s.stage]??"unknown",children:s.stage.toLowerCase()}),s.effective_outcome&&e.jsxs(F,{tone:$e[s.effective_outcome]??"unknown",children:["output: ",s.effective_outcome.replace(/_/g," ")]}),s.failure_cause&&e.jsxs(F,{tone:$e[s.effective_outcome??""]??"unknown",children:["cause: ",s.failure_cause.replace(/_/g," ")]}),s.url&&e.jsx("a",{href:s.url,target:"_blank",rel:"noreferrer","aria-label":`Open Hugging Face Job ${s.id}`,className:"cron-info-text",children:e.jsx(X,{className:"h-4 w-4"})})]})]}),r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between gap-3 text-xs cron-muted mb-1",children:[e.jsxs("span",{children:[r.processed_papers.toLocaleString()," / ",r.total_papers.toLocaleString()," papers"]}),e.jsxs("span",{children:[l.toFixed(0),"%"]})]}),e.jsx("div",{className:"cron-progress-track",children:e.jsx("div",{className:"cron-progress-value",style:{width:`${l}%`}})})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-sm",children:[e.jsxs("span",{children:[e.jsx("strong",{children:r.succeeded_papers.toLocaleString()})," succeeded"]}),e.jsxs("span",{children:[e.jsx("strong",{children:r.failed_papers.toLocaleString()})," failed"]}),e.jsxs("span",{children:[e.jsx("strong",{children:r.already_existed_papers.toLocaleString()})," skipped"]}),e.jsxs("span",{children:[e.jsx("strong",{children:r.extracted_images.toLocaleString()})," images"]})]}),n>0&&e.jsxs("div",{className:"text-xs cron-muted",children:[e.jsx("strong",{children:n.toLocaleString()})," unresolved image references omitted after final retry"]}),r.updated_at&&e.jsxs("div",{className:"text-xs cron-muted",children:["Progress updated ",v(r.updated_at)]}),(r.fatal_error||r.error_samples.length>0)&&e.jsxs("div",{className:"cron-message cron-message--error space-y-1",children:[r.fatal_error&&e.jsx("div",{children:r.fatal_error}),r.error_samples.map(i=>e.jsxs("div",{children:[e.jsx("span",{className:"font-mono",children:i.arxiv_id}),": ",i.error]},`${i.arxiv_id}:${i.error}`))]})]}):e.jsx("div",{className:"text-sm cron-muted",children:"Waiting for the shard progress checkpoint."}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs cron-muted",children:[s.hardware&&e.jsx("span",{children:s.hardware}),s.created_at&&e.jsxs("span",{children:["Created ",v(s.created_at)]}),s.duration_seconds!=null&&e.jsxs("span",{children:["Duration ",te(s.duration_seconds)]})]}),s.stage_message&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.stage_message})]})}function Es({monitor:s,loading:r,error:n}){var l,i;return e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(vs,{className:"h-4 w-4"}),e.jsx("h4",{children:"Hugging Face OCR shards"})]}),r&&e.jsxs("div",{className:"cron-metric-card flex items-center gap-2 text-sm cron-muted",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"})," Loading remote Jobs…"]}),!!n&&e.jsx("div",{className:"cron-message cron-message--error",children:"Could not load Hugging Face Jobs."}),s&&!s.available&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.error??"Hugging Face monitoring is unavailable."}),(s==null?void 0:s.available)&&e.jsxs(e.Fragment,{children:[s.budgets.live&&s.budgets.backfill&&e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3 mb-3",children:[e.jsx(ke,{title:"Live paper Markdown GPU policy",budget:s.budgets.live,profile:(l=s.selected_profiles)==null?void 0:l.live}),e.jsx(ke,{title:"Full backfill GPU policy",budget:s.budgets.backfill,profile:(i=s.selected_profiles)==null?void 0:i.backfill})]}),e.jsxs("div",{className:`cron-message mb-3 ${(s.summary.unresolved_mount_failures??0)>0?"cron-message--error":""}`,children:[e.jsx("strong",{children:"Logical shard health:"})," ",(s.summary.logical_shards??0).toLocaleString()," logical shards / ",(s.summary.provider_attempts??0).toLocaleString()," provider attempts · ",(s.summary.recovered_mount_failures??0).toLocaleString()," recovered mount failures · ",(s.summary.unresolved_mount_failures??0).toLocaleString()," unresolved"]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-3",children:Object.entries(s.summary).map(([o,m])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:V(o)}),e.jsx("div",{className:"text-lg font-semibold",children:m.toLocaleString()})]},o))}),e.jsx("p",{className:"text-xs cron-muted mb-3",children:"Efficiency and backlog-clearance costs are admission-control estimates, not provider invoices."}),s.coverage&&Object.keys(s.coverage).length>0&&e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3 mb-3",children:Object.values(s.coverage).map(o=>e.jsxs("div",{className:"cron-metric-card space-y-2 text-sm",children:[e.jsx("div",{className:"font-semibold",children:o.scope==="full"?"Full catalog coverage":"Recent 14-day coverage"}),e.jsxs("div",{className:"text-lg font-semibold",children:[o.coverage_percentage.toFixed(2),"%"]}),e.jsxs("div",{children:[o.canonical_markdown_count.toLocaleString()," canonical / ",o.eligible_papers.toLocaleString()," eligible · ",o.missing_count.toLocaleString()," missing"]}),e.jsxs("div",{className:"cron-muted",children:["Copied from upstream this reconciliation: ",o.copied_from_upstream_count.toLocaleString()]}),e.jsxs("div",{className:"cron-muted",children:["7-day Δ eligible ",o.eligible_delta_7d??"collecting"," · canonical ",o.canonical_delta_7d??"collecting"," · missing ",o.missing_delta_7d??"collecting"]})]},o.scope))}),s.jobs.length===0?e.jsx("div",{className:"cron-metric-card text-sm cron-muted",children:"No OCR shards have been launched yet."}):e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:s.jobs.map(o=>e.jsx(As,{job:o},o.id))})]})]})}function Ms({job:s,expanded:r,onToggle:n,autoRefresh:l=!1}){var c;const i=!!(s.work_metrics&&Object.keys(s.work_metrics).length),o=!!(s.db_metrics&&Object.keys(s.db_metrics).length),m=s.job_name==="paper_markdown_backfill",_=z({queryKey:["admin","paperMarkdownJobs"],queryFn:()=>ue.getPaperMarkdownJobs(),enabled:m,refetchInterval:l?3e4:!1,retry:!1}),p=m?(c=_.data)==null?void 0:c.budgets.live:void 0,h=(p==null?void 0:p.cost_policy)==="unmetered_hf"||(p==null?void 0:p.budget_enforced)===!1;return e.jsxs("div",{className:"cron-job-card",children:[e.jsx("button",{type:"button",className:"cron-job-summary",onClick:n,"aria-expanded":r,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx(Fs,{status:s.status,isRunning:s.is_running}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("h3",{className:"font-semibold",children:s.display_name}),s.critical&&e.jsx(I,{variant:"outline",className:"text-[10px] uppercase tracking-wide",children:"Critical"}),s.lock_stale&&e.jsx(F,{tone:"broken",children:"Held lock"}),e.jsx(Ce,{label:"Execution",axis:s.execution_health}),e.jsx(Ce,{label:"Output",axis:s.output_health}),r?e.jsx(ps,{className:"h-4 w-4 cron-muted"}):e.jsx(gs,{className:"h-4 w-4 cron-muted"})]}),e.jsx("p",{className:"text-sm cron-muted mb-2",children:s.status_reason}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2 text-sm cron-muted",children:[e.jsxs("span",{className:"cron-fact",children:[e.jsx(qe,{}),"Log: ",v(s.last_run)]}),e.jsxs("span",{className:"cron-fact",children:[e.jsx(fe,{}),"DB: ",v(s.last_db_write)]}),s.recent_write_count!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(js,{}),"Recent writes: ",s.recent_write_count.toLocaleString()]}),s.duration!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(ne,{}),"Duration: ",te(s.duration)]}),s.schedule&&e.jsxs("span",{className:"cron-fact md:col-span-2",children:[e.jsx(we,{}),e.jsx("span",{className:"font-mono text-xs",children:s.schedule})]}),s.log_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(Ne,{}),"Log status: ",s.log_status]}),s.workflow_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(ne,{}),"Actions: ",Ye(s.workflow_status)]})]}),s.work_summary&&e.jsx("div",{className:"cron-message",children:s.work_summary}),s.error&&e.jsxs("div",{className:"cron-message cron-message--error",children:[e.jsx("strong",{children:"Error: "}),s.error]}),s.diagnostics&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.diagnostics}),p&&e.jsxs("div",{className:`cron-message ${p.can_launch_planned?"":"cron-message--error"}`,children:[e.jsx("strong",{children:"Live GPU policy:"})," ",h?"unmetered on HF":`${S(p.current_exposure_usd)} current / ${S(p.ceiling_usd)} cap`," · ",p.affordable_jobs," of ",p.desired_jobs," planned",h?"":` · projects ${S(p.projected_usd)} · rolling 30 days`]})]})]}),e.jsx(F,{tone:s.status,children:s.status})]})}),r&&e.jsx("div",{className:"cron-job-details",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(we,{className:"h-4 w-4"}),e.jsx("h4",{children:"Scheduler evidence"})]}),e.jsx("div",{className:"cron-metric-card space-y-2 text-sm",children:[["Scheduler",s.execution_health.scheduler??"unknown"],["Last expected",v(s.execution_health.last_expected_at??null)],["Last started",v(s.execution_health.last_started_at??null)],["Last completed",v(s.execution_health.last_completed_at??null)],["Next expected",v(s.execution_health.next_expected_at??null)]].map(([t,b])=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"cron-label",children:t}),e.jsx("span",{children:b})]},t))})]}),s.work_metrics&&i&&e.jsx(Se,{icon:Ne,title:"Log Metrics",metrics:s.work_metrics}),s.db_metrics&&o&&e.jsx(Se,{icon:fe,title:"Database Metrics",metrics:s.db_metrics}),s.workflow_status&&e.jsx(Rs,{workflow:s.workflow_status}),m&&e.jsx(Es,{monitor:_.data,loading:_.isLoading,error:_.error}),s.diagnostic_groups&&Object.values(s.diagnostic_groups).some(t=>t.length>0)&&e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(Ee,{className:"h-4 w-4"}),e.jsx("h4",{children:"Diagnostics by cause"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.entries(s.diagnostic_groups).filter(([,t])=>t.length>0).map(([t,b])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label mb-1",children:V(t)}),e.jsx("ul",{className:"list-disc pl-4 text-sm space-y-1",children:b.map(k=>e.jsx("li",{children:k},k))})]},t))})]}),s.health_findings&&s.health_findings.some(t=>t.state!=="healthy")&&e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(Ae,{className:"h-4 w-4"}),e.jsx("h4",{children:"Deterministic contract findings"})]}),e.jsxs("div",{className:"cron-metric-card space-y-3 text-sm",children:[s.health_findings.filter(t=>t.state!=="healthy").map(t=>e.jsxs("div",{children:[e.jsx(F,{tone:t.state,children:t.state})," ",e.jsx("strong",{children:V(t.contract)}),": ",t.summary,Object.entries(t.evidence).length>0&&e.jsx("div",{className:"mt-1 text-xs cron-muted",children:Object.entries(t.evidence).map(([b,k])=>e.jsxs("span",{className:"mr-3",children:[V(b),": ",String(k)]},b))})]},`${t.plane}-${t.contract}`)),e.jsxs("div",{className:"flex gap-4",children:[s.operator_url&&e.jsxs("a",{className:"cron-info-text inline-flex items-center gap-1",href:s.operator_url,children:["Open operator ",e.jsx(X,{className:"h-3.5 w-3.5"})]}),s.run_url&&e.jsxs("a",{className:"cron-info-text inline-flex items-center gap-1",href:s.run_url,target:"_blank",rel:"noreferrer",children:["Open run ",e.jsx(X,{className:"h-3.5 w-3.5"})]})]})]})]})]})})]})}const Ze=x.forwardRef(({className:s,...r},n)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:n,className:$("w-full caption-bottom text-sm",s),...r})}));Ze.displayName="Table";const es=x.forwardRef(({className:s,...r},n)=>e.jsx("thead",{ref:n,className:$("[&_tr]:border-b",s),...r}));es.displayName="TableHeader";const ss=x.forwardRef(({className:s,...r},n)=>e.jsx("tbody",{ref:n,className:$("[&_tr:last-child]:border-0",s),...r}));ss.displayName="TableBody";const qs=x.forwardRef(({className:s,...r},n)=>e.jsx("tfoot",{ref:n,className:$("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...r}));qs.displayName="TableFooter";const he=x.forwardRef(({className:s,...r},n)=>e.jsx("tr",{ref:n,className:$("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",s),...r}));he.displayName="TableRow";const W=x.forwardRef(({className:s,...r},n)=>e.jsx("th",{ref:n,className:$("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...r}));W.displayName="TableHead";const K=x.forwardRef(({className:s,...r},n)=>e.jsx("td",{ref:n,className:$("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...r}));K.displayName="TableCell";const Is=x.forwardRef(({className:s,...r},n)=>e.jsx("caption",{ref:n,className:$("mt-4 text-sm text-muted-foreground",s),...r}));Is.displayName="TableCaption";const as={queued:"unknown",dispatching:"running",running:"running",completed:"healthy",failed:"broken",canceled:"unknown",awaiting_markdown:"unknown"},rs={queued:"queued",dispatching:"dispatching",running:"running",completed:"completed",failed:"failed",canceled:"canceled",awaiting_markdown:"waiting for Markdown"},Le={"add-evals":"Add evals","enrich-paper":"Enrich paper","resolve-model-paper":"Resolve model release","review-benchmark-gaps":"Review benchmark gaps","add-benchmark":"Add benchmark"},Ds={queued:ws,dispatching:R,running:bs,completed:je,failed:Y,canceled:ys,awaiting_markdown:ks};function Os({status:s}){const r=Ds[s];return e.jsxs(F,{tone:as[s],children:[e.jsx(r,{className:`mr-1 h-3.5 w-3.5 ${s==="dispatching"?"animate-spin":""}`}),rs[s]]})}function Js(s){return s.status==="awaiting_markdown"?_s:s.error?s.error:s.report?s.report:s.status==="completed"&&s.applied_at?"Changes applied to the paper.":s.status==="completed"?"Completed without a recorded mutation.":null}function Pe({mutationResult:s}){const r=s==null?void 0:s.skipped_configured_leaderboards;return!Array.isArray(r)||r.length===0?null:e.jsxs("div",{className:"mt-2 rounded border border-amber-500 bg-amber-50 p-2 text-xs text-amber-900",children:[e.jsxs("div",{className:"font-medium",children:["Skipped configured leaderboards (",r.length,")"]}),e.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-4",children:r.map((n,l)=>e.jsxs("li",{children:[n.benchmark," · ",n.disposition," · task ",n.task_id," / dataset ",n.dataset_id,n.metric?` / ${n.metric}`:"",n.value!=null?` = ${n.value}`:"",n.detail?` — ${n.detail}`:""]},l))})]})}function Bs({autoRefresh:s}){var q;const r=xe(),[n,l]=x.useState(""),[i,o]=x.useState(""),[m,_]=x.useState(""),[p,h]=x.useState(""),[c,t]=x.useState(""),[b,k]=x.useState({}),O={trigger:n,status:i,policy_version:m,cohort_date:p,review_status:c},{data:u,isLoading:G,isFetching:Z,error:J}=z({queryKey:["admin","codexPaperJobs",O],queryFn:()=>E.listJobs(100,O),refetchInterval:s?1e4:!1,retry:!1}),T=()=>r.invalidateQueries({queryKey:["admin","codexPaperJobs"]}),ee=L({mutationFn:a=>E.retryJob(a),onSuccess:T}),le=L({mutationFn:a=>E.cancelJob(a),onSuccess:T}),de=L({mutationFn:a=>E.retryTrace(a),onSuccess:T}),Q=L({mutationFn:a=>E.setScheduler(a),onSuccess:T}),M=L({mutationFn:({id:a,dataset:d,task:w,metric:ae})=>E.promoteBenchmarkCandidate(a,{dataset_id:Number(d),task_id:Number(w),best_metric:ae.trim()}),onSuccess:T}),A=L({mutationFn:a=>E.rollbackBenchmarkCandidate(a),onSuccess:T}),se=J instanceof Te&&J.status===404;return e.jsxs(g,{className:"mb-8",children:[e.jsx(f,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(N,{className:"text-xl",children:"Codex paper jobs"}),e.jsx(P,{children:"Durable queue, two-stage daily workflows, traces, and benchmark-gap follow-up"})]}),Z&&!G&&e.jsxs("span",{className:"flex items-center gap-2 text-xs cron-muted",children:[e.jsx(R,{className:"h-3.5 w-3.5 animate-spin"})," Syncing with Hugging Face"]})]})}),e.jsxs(j,{children:[G&&e.jsxs("div",{className:"flex items-center justify-center py-10 cron-muted",children:[e.jsx(R,{className:"mr-2 h-5 w-5 animate-spin"})," Loading paper jobs…"]}),J&&!se&&e.jsx("div",{className:"cron-message cron-message--error mb-4",children:J.message}),se&&e.jsx("p",{className:"py-4 text-sm cron-muted",children:"Codex paper jobs are not enabled in this environment."}),u&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`cron-message mb-5 ${u.scheduler.paused_at?"cron-message--error":""}`,children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("strong",{children:["Scheduled dispatch: ",u.scheduler.paused_at?"paused":u.scheduler.dispatch_enabled?"enabled":"disabled"]}),u.scheduler.pause_reason&&e.jsx("div",{className:"mt-1 text-xs",children:u.scheduler.pause_reason}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Canary ",u.scheduler.canary_released?"released":"active"," · Queue age ",u.scheduler.queue_age_level]}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Scheduled usage today ",u.scheduler.usage.current_day_tokens.toLocaleString()," tokens · ",u.scheduler.usage.mode==="enforced"?`pause threshold ${((q=u.scheduler.usage.pause_threshold_tokens)==null?void 0:q.toLocaleString())??"not established"}`:"first-week alert-only baseline"," · trailing median ",u.scheduler.usage.trailing_seven_day_median_tokens.toLocaleString()]})]}),e.jsx(y,{size:"sm",variant:u.scheduler.paused_at||!u.scheduler.dispatch_enabled?"default":"outline",disabled:Q.isPending,onClick:()=>Q.mutate(u.scheduler.paused_at||!u.scheduler.dispatch_enabled?"resume":"pause"),children:u.scheduler.paused_at?"Acknowledge & resume":u.scheduler.dispatch_enabled?"Pause scheduled dispatch":"Enable scheduled dispatch"})]})}),e.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-8",children:[["queued","awaiting_markdown","dispatching","running","completed","failed","canceled"].map(a=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label capitalize",children:rs[a]}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:u.summary[a]})]},a)),e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:"Total"}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:u.summary.total})]})]}),e.jsxs("div",{className:"mb-5 grid gap-3 sm:grid-cols-5",children:[e.jsxs("select",{"aria-label":"Trigger",className:"rounded border px-2 py-1 text-sm",value:n,onChange:a=>l(a.target.value),children:[e.jsx("option",{value:"",children:"All triggers"}),e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"hf-daily-cron",children:"HF daily cron"}),e.jsx("option",{value:"hf-trending-cron",children:"HF trending cron"}),e.jsx("option",{value:"benchmark-gap-cron",children:"Benchmark gap cron"}),e.jsx("option",{value:"model-release-radar",children:"Release radar"})]}),e.jsxs("select",{"aria-label":"Status",className:"rounded border px-2 py-1 text-sm",value:i,onChange:a=>o(a.target.value),children:[e.jsx("option",{value:"",children:"All statuses"}),Object.keys(as).map(a=>e.jsx("option",{children:a},a))]}),e.jsx("input",{"aria-label":"Policy version",className:"rounded border px-2 py-1 text-sm",placeholder:"Policy version",value:m,onChange:a=>_(a.target.value)}),e.jsx("input",{"aria-label":"Cohort date",type:"date",className:"rounded border px-2 py-1 text-sm",value:p,onChange:a=>h(a.target.value)}),e.jsxs("select",{"aria-label":"Review status",className:"rounded border px-2 py-1 text-sm",value:c,onChange:a=>t(a.target.value),children:[e.jsx("option",{value:"",children:"All review states"}),e.jsx("option",{value:"unreviewed",children:"Unreviewed"}),e.jsx("option",{value:"approved",children:"Approved"}),e.jsx("option",{value:"corrected",children:"Corrected"})]})]}),u.jobs.length===0?e.jsx("p",{className:"py-8 text-center text-sm cron-muted",children:"No paper curation jobs have been submitted yet."}):e.jsxs(Ze,{children:[e.jsx(es,{children:e.jsxs(he,{children:[e.jsx(W,{children:"Status"}),e.jsx(W,{children:"Paper"}),e.jsx(W,{children:"Action"}),e.jsx(W,{children:"Requested"}),e.jsx(W,{children:"Execution"})]})}),e.jsx(ss,{children:u.jobs.map(a=>{const d=Js(a);return e.jsxs(he,{children:[e.jsx(K,{className:"align-top",children:e.jsx(Os,{status:a.status})}),e.jsx(K,{className:"min-w-[260px] align-top",children:a.paper_route?e.jsxs(e.Fragment,{children:[e.jsx(pe,{to:`/paper/${encodeURIComponent(a.paper_route)}`,className:"font-medium hover:underline",children:a.paper_title}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Paper #",a.paper_id]})]}):a.kind==="review-benchmark-gaps"?e.jsx("span",{className:"font-medium",children:"Benchmark-gap backlog"}):a.kind==="add-benchmark"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"Benchmark candidate"}),e.jsx("div",{className:"mt-1 text-xs cron-muted",children:a.benchmark_candidate_id})]}):a.release_signal_id?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"Release radar signal"}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Signal ",a.release_signal_id]})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"Trending model discovery"}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Candidate ",a.candidate_id]})]})}),e.jsxs(K,{className:"whitespace-nowrap align-top",children:[Le[a.kind],a.applied_at&&e.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs cron-status--healthy",children:[e.jsx(je,{className:"h-3.5 w-3.5"})," Applied"]})]}),e.jsxs(K,{className:"whitespace-nowrap align-top",children:[e.jsx("div",{children:v(a.created_at)}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["@",a.requested_by]})]}),e.jsxs(K,{className:"max-w-[360px] align-top",children:[a.hf_job_url?e.jsxs("a",{href:a.hf_job_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 hover:underline",children:["Hugging Face Job ",e.jsx(X,{className:"h-3.5 w-3.5"})]}):e.jsx("span",{className:"cron-muted",children:"Waiting to dispatch"}),d&&e.jsx("p",{className:`mt-2 line-clamp-3 text-xs ${a.error&&a.status!=="awaiting_markdown"?"text-red-700":"cron-muted"}`,title:d,children:d}),e.jsx(Pe,{mutationResult:a.mutation_result}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[["failed","canceled"].includes(a.status)&&e.jsx(y,{size:"sm",variant:"outline",onClick:()=>ee.mutate(a.id),children:"Retry"}),["queued","awaiting_markdown","dispatching","running"].includes(a.status)&&e.jsx(y,{size:"sm",variant:"outline",onClick:()=>le.mutate(a.id),children:"Cancel"}),a.trace_status==="finalize_failed"&&e.jsx(y,{size:"sm",variant:"outline",onClick:()=>de.mutate(a.id),children:"Retry trace"})]})]})]},a.id)})})]}),u.workflows.length>0&&e.jsxs("div",{className:"mt-8 space-y-3",children:[e.jsx("h3",{className:"text-base font-semibold",children:"Scheduled paper workflows"}),u.workflows.map(a=>e.jsxs("details",{className:"rounded-md border p-3",children:[e.jsxs("summary",{className:"cursor-pointer text-sm font-medium",children:["Paper #",a.paper_id," · ",a.cohort_date," · ",a.status," · ",a.policy_version]}),e.jsxs("div",{className:"mt-3 space-y-3 text-xs",children:[a.error&&e.jsx("div",{className:"text-red-700",children:a.error}),a.stages.map(d=>{var w;return e.jsxs("div",{className:"rounded border p-3",children:[e.jsxs("div",{className:"font-medium",children:[Le[d.kind]," · ",d.status," · trace ",d.trace_status," · review ",d.audit_status]}),e.jsxs("div",{className:"mt-1 cron-muted",children:["model ",d.model??"—"," · reasoning ",d.reasoning_effort??"—"," · tokens ",(d.input_tokens??0)+(d.output_tokens??0)," · duration ",d.duration_ms??0," ms · attempts ",d.attempt_count]}),d.error&&e.jsx("div",{className:"mt-2 text-red-700",children:d.error}),d.report&&e.jsx("div",{className:"mt-2 whitespace-pre-wrap rounded border p-2",children:d.report}),d.url_candidates&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{children:"URL candidates and provenance"}),e.jsx("pre",{className:"mt-2 max-h-52 overflow-auto whitespace-pre-wrap",children:JSON.stringify(d.url_candidates,null,2)})]}),d.validation_summary&&e.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap",children:JSON.stringify(d.validation_summary,null,2)}),Array.isArray((w=d.validation_summary)==null?void 0:w.manual_or_legacy_evaluation_rows_affected)&&d.validation_summary.manual_or_legacy_evaluation_rows_affected.length>0&&e.jsxs("div",{className:"mt-2 rounded border border-amber-500 bg-amber-50 p-2 font-medium text-amber-900",children:["Manual or legacy evaluation rows changed: ",d.validation_summary.manual_or_legacy_evaluation_rows_affected.join(", "),". Review the evidence and before/after diff."]}),d.proposal&&e.jsx("pre",{className:"mt-2 max-h-52 overflow-auto whitespace-pre-wrap",children:JSON.stringify(d.proposal,null,2)}),e.jsx(Pe,{mutationResult:d.mutation_result}),d.mutation_result&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{children:"Accepted callback result and before/after state"}),e.jsx("pre",{className:"mt-2 max-h-64 overflow-auto whitespace-pre-wrap",children:JSON.stringify(d.mutation_result,null,2)})]}),d.trace_status==="complete"&&e.jsxs("a",{className:"mt-2 inline-flex items-center gap-1 hover:underline",href:E.traceUrl(d.id),target:"_blank",rel:"noreferrer",children:["Authenticated trace manifest ",e.jsx(X,{className:"h-3.5 w-3.5"})]})]},d.id)})]})]},a.id))]}),u.benchmark_candidates.length>0&&e.jsxs("div",{className:"mt-8 space-y-3",children:[e.jsx("h3",{className:"text-base font-semibold",children:"Benchmark-gap backlog"}),u.benchmark_candidates.map(a=>{var ae,_e;const d=b[a.id]??{dataset:"",task:((ae=a.task_ids[0])==null?void 0:ae.toString())??"",metric:""},w=Number(d.dataset)>0&&Number(d.task)>0&&d.metric.trim().length>0;return e.jsxs("div",{className:"rounded-md border p-3 text-xs",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"font-medium",children:[a.canonical_name," · ",a.gap_type," · ",a.status]}),e.jsxs("div",{className:"cron-muted",children:[a.distinct_paper_count," paper",a.distinct_paper_count===1?"":"s"," · ",a.confidence??"unknown"," confidence"]})]}),a.canonical_url&&e.jsx("a",{className:"mt-1 block hover:underline",href:a.canonical_url,target:"_blank",rel:"noreferrer",children:a.canonical_url}),e.jsxs("div",{className:"mt-1 cron-muted",children:["Task evidence: ",a.task_ids.join(", ")||"none"," · Papers: ",a.evidence_paper_ids.join(", ")]}),a.review_reason&&e.jsxs("div",{className:"mt-1",children:["Review",a.reviewed_at?` ${v(a.reviewed_at)}`:"",": ",a.review_reason,a.deferred_until&&` · deferred until ${v(a.deferred_until)}`]}),a.resolution&&e.jsxs("div",{className:"mt-1 cron-muted",children:["Dataset #",a.resolution.dataset_id," · task #",a.resolution.task_id," · ",a.resolution.primary_metric,a.resolution.rolled_back_at&&` · rolled back ${v(a.resolution.rolled_back_at)}`]}),a.status==="promoted"&&((_e=a.resolution)==null?void 0:_e.created)&&!a.resolution.rolled_back_at&&e.jsx(y,{className:"mt-2",size:"sm",variant:"outline",disabled:A.isPending,onClick:()=>A.mutate(a.id),children:"Roll back automatic benchmark"}),!["promoted","merged"].includes(a.status)&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[["dataset","task","metric"].map(B=>e.jsx("input",{"aria-label":`${a.canonical_name} ${B}`,className:"w-36 rounded border px-2 py-1",placeholder:B==="metric"?"Exact metric":`${B} ID`,value:d[B],onChange:ns=>k(ts=>({...ts,[a.id]:{...d,[B]:ns.target.value}}))},B)),e.jsx(y,{size:"sm",variant:"outline",disabled:!w||M.isPending,onClick:()=>M.mutate({id:a.id,...d}),children:"Promote & requeue evidence papers"})]})]},a.id)}),M.error&&e.jsx("div",{className:"cron-message cron-message--error",children:M.error.message}),A.error&&e.jsx("div",{className:"cron-message cron-message--error",children:A.error.message})]}),e.jsxs("p",{className:"mt-4 text-xs cron-muted",children:["Showing the 100 most recent jobs · Queue totals include full history · Updated ",v(u.timestamp)]})]})]})]})}function Us(){const[s,r]=x.useState(()=>new Date().toISOString().slice(0,10)),[n,l]=x.useState(1),i=z({queryKey:["paper-edit-digest",s,n],queryFn:()=>Me.digest(s,n),enabled:!!s});return e.jsxs("section",{className:"space-y-3 rounded border p-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Daily paper edits"}),e.jsxs("label",{className:"flex items-center gap-2",children:["UTC date ",e.jsx("input",{type:"date",value:s,onChange:o=>{r(o.target.value),l(1)}})]}),i.isLoading&&e.jsx("p",{children:"Loading daily summary…"}),i.error&&e.jsx("p",{role:"alert",children:i.error.message}),i.data&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:[i.data.edits," published changes · ",i.data.papers," papers · ",i.data.contributors," contributors"]}),e.jsx("ul",{className:"space-y-1",children:i.data.rows.map((o,m)=>e.jsxs("li",{children:[e.jsxs(pe,{className:"underline",to:`/paper/${o.paper_id}`,children:["Paper ",o.paper_id]})," · @",o.actor_username??"admin"," · ",o.edits," changes"]},m))}),e.jsxs("div",{className:"flex gap-2",children:[n>1&&e.jsx(y,{variant:"outline",onClick:()=>l(n-1),children:"Previous"}),i.data.has_more&&e.jsx(y,{variant:"outline",onClick:()=>l(n+1),children:"Next"})]})]})]})}const Hs=()=>{var m,_,p,h;const s=xe(),r=fs({queryKey:["catalog-audit"],queryFn:({pageParam:c})=>me.audit(c),initialPageParam:void 0,getNextPageParam:c=>c.next_cursor??void 0}),n=((m=r.data)==null?void 0:m.pages.flatMap(c=>c.events))??[],l=L({mutationFn:()=>me.acknowledgeAudit(),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})}),i=L({mutationFn:c=>me.rollbackEvent(c),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})}),o=L({mutationFn:({subject:c,suspended:t})=>Me.suspend(c,t),onSuccess:()=>s.invalidateQueries({queryKey:["catalog-audit"]})});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Us,{}),(i.error||o.error)&&e.jsx("p",{role:"alert",children:(_=i.error||o.error)==null?void 0:_.message}),e.jsxs(g,{children:[e.jsxs(f,{className:"flex-row items-center justify-between",children:[e.jsx(N,{children:"Catalog mutation audit"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[((h=(p=r.data)==null?void 0:p.pages[0])==null?void 0:h.unread_contributor_count)??0," unread contributor changes"]}),e.jsx(y,{variant:"outline",size:"sm",onClick:()=>l.mutate(),disabled:l.isPending,children:"Mark read"})]})]}),e.jsxs(j,{className:"space-y-3",children:[r.isLoading&&e.jsx("p",{children:"Loading audit history…"}),r.error&&e.jsx("p",{className:"text-destructive",children:"Audit history unavailable."}),n.map(c=>e.jsxs("article",{className:`rounded-md border p-3 ${c.operation==="delete"||c.rollback_eligible===!1?"border-red-500 bg-red-50/50":""}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("strong",{children:[c.operation," ",c.entity_type," ",c.entity_id]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",c.actor_username??c.actor_role," ·"," ",new Date(c.created_at).toLocaleString()]})]}),e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Inspect snapshots"}),e.jsx("pre",{className:"mt-2 max-h-80 overflow-auto rounded bg-muted p-3",children:JSON.stringify({before:c.before,after:c.after},null,2)})]}),c.actor_role==="contributor"&&c.actor_hf_subject&&e.jsx(y,{className:"mt-3 mr-2",variant:"outline",size:"sm",disabled:o.isPending,onClick:()=>o.mutate({subject:c.actor_hf_subject,suspended:!c.editing_suspended}),children:c.editing_suspended?"Restore editing access":"Suspend editing access"}),!c.rollback_of_event_id&&e.jsx(y,{className:"mt-3",variant:"outline",size:"sm",onClick:()=>i.mutate(c.id),disabled:i.isPending||c.rollback_eligible===!1,children:c.rollback_eligible===!1?"Rollback conflict":"Roll back if unchanged"})]},c.id)),r.hasNextPage&&e.jsx(y,{variant:"outline",onClick:()=>r.fetchNextPage(),disabled:r.isFetchingNextPage,children:r.isFetchingNextPage?"Loading…":"Load older events"})]})]})]})},Fe={hourly:"running",daily:"healthy",weekly:"degraded",systemd:"running"},re=["admin","cronStatus"],Ws=({data:s,loading:r,error:n})=>{const[l,i]=x.useState("staging-current"),o={"staging-current":"Starter staging · $75 warning / $100 trip / no Environment cap","staging-production-era":"Staging with production · $15 / $20 / $25",production:"Production · $175 / $200 / $225"};if(r)return e.jsxs("div",{className:"flex items-center py-12",children:[e.jsx(R,{className:"h-6 w-6 animate-spin mr-3"}),"Loading chat compute…"]});if(n||!s)return e.jsx(g,{className:"cron-status--broken",children:e.jsx(j,{className:"pt-6",children:"Chat compute accounting is unavailable."})});const m=Math.min(100,s.effective_microusd/s.application_cap_microusd*100),_=s.circuit_state==="tripped"?"Chat disabled":s.circuit_state==="warning"?"Operator warning":"Enabled",p=s.reconciliation_state==="fresh"?"Fresh":s.reconciliation_state==="stale"?"Stale":"Unavailable";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid md:grid-cols-4 gap-4",children:[e.jsxs(g,{className:s.circuit_state==="tripped"?"cron-status--broken":s.circuit_state==="warning"?"cron-status--degraded":"",children:[e.jsx(f,{children:e.jsx(N,{className:"text-sm",children:"Circuit"})}),e.jsxs(j,{children:[e.jsx("div",{className:"text-2xl font-bold",children:_}),e.jsx("p",{className:"text-xs cron-muted",children:s.trip_reason??"Policy armed"})]})]}),e.jsxs(g,{children:[e.jsx(f,{children:e.jsx(N,{className:"text-sm",children:"Month to date"})}),e.jsxs(j,{children:[e.jsx("div",{className:"text-2xl font-bold",children:C(s.effective_microusd)}),e.jsx("div",{role:"progressbar","aria-label":"Application cap used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(m),className:"h-2 rounded bg-muted mt-3",children:e.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${m}%`}})})]})]}),e.jsxs(g,{children:[e.jsx(f,{children:e.jsx(N,{className:"text-sm",children:"Application headroom"})}),e.jsxs(j,{children:[e.jsx("div",{className:"text-2xl font-bold",children:C(s.remaining_microusd)}),e.jsxs("p",{className:"text-xs cron-muted",children:["Cap ",C(s.application_cap_microusd)]})]})]}),e.jsxs(g,{children:[e.jsx(f,{children:e.jsx(N,{className:"text-sm",children:"Live compute"})}),e.jsxs(j,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.live_count}),e.jsxs("p",{className:"text-xs cron-muted",children:[s.termination_uncertain_count," termination uncertain"]})]})]})]}),e.jsxs(g,{children:[e.jsxs(f,{children:[e.jsx(N,{children:"Accounting and policy"}),e.jsxs(P,{children:[s.environment," · cycle ",s.billing_cycle]})]}),e.jsxs(j,{className:"grid md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Environment record"}),e.jsx("br",{}),s.environment," · ",s.provider_mode==="starter_workspace"?"Starter Workspace":"Team isolated"]}),e.jsxs("label",{children:[e.jsx("strong",{children:"Policy profile"}),e.jsxs("select",{"aria-label":"Chat compute policy profile",value:l,onChange:h=>i(h.target.value),className:"block mt-1",children:[e.jsx("option",{value:"staging-current",children:"Staging now"}),e.jsx("option",{value:"staging-production-era",children:"Staging with production"}),e.jsx("option",{value:"production",children:"Production"})]}),e.jsxs("span",{className:"text-xs cron-muted",children:[o[l]," · Workspace $250"]})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Conservative estimate"}),e.jsx("br",{}),C(s.estimated_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider-reported floor"}),e.jsx("br",{}),C(s.provider_floor_microusd)," · ",e.jsx(I,{children:p})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider backstops"}),e.jsx("br",{}),s.environment_cap_microusd===null?"Starter: no Environment cap":`Environment ${C(s.environment_cap_microusd)}`," · Workspace ",C(s.workspace_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Active thresholds"}),e.jsx("br",{}),"Warning ",C(s.warning_microusd)," · trip ",C(s.application_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Policy allocation"}),e.jsx("br",{}),"Starter staging $75/$100 with no Environment cap · future Team staging $15/$20/$25 · production $175/$200/$225 · workspace $250"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Cycle end"}),e.jsx("br",{}),v(s.cycle_end_at)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Last metered"}),e.jsx("br",{}),s.last_metered_at?v(s.last_metered_at):"Unavailable"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider reconciliation"}),e.jsx("br",{}),s.last_reconciled_at?v(s.last_reconciled_at):"Unavailable",s.last_reconciliation_attempt_at?` · attempted ${v(s.last_reconciliation_attempt_at)}`:"",s.next_reconciliation_at?` · next ${v(s.next_reconciliation_at)}`:""]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Burn projection"}),e.jsx("br",{}),s.burn_rate_microusd_per_hour===null?"Not enough data":`${C(s.burn_rate_microusd_per_hour)}/hour${s.projected_cap_hit_at?` · cap ${v(s.projected_cap_hit_at)}`:""}`]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Prior cycle"}),e.jsx("br",{}),s.prior_cycle?`${s.prior_cycle.billing_cycle} · ${C(s.prior_cycle.effective_microusd)}`:"Not enough data"]})]})]}),e.jsxs(g,{children:[e.jsx(f,{children:e.jsx(N,{children:"Live lifecycle"})}),e.jsx(j,{className:"text-sm",children:Object.entries(s.live_states).map(([h,c])=>e.jsxs("span",{className:"mr-4",children:[h,": ",c]},h))})]}),e.jsxs(g,{children:[e.jsx(f,{children:e.jsx(N,{children:"Daily spend"})}),e.jsx(j,{children:s.daily_spend.length?e.jsx("ul",{className:"space-y-1 text-sm",children:s.daily_spend.map(h=>e.jsxs("li",{children:[h.date,": blank ",C(h.blank_pool_microusd)," · assigned ",C(h.assigned_microusd)]},h.date))}):e.jsx("p",{className:"cron-muted",children:"No compute recorded in this cycle."})})]}),e.jsxs(g,{children:[e.jsxs(f,{children:[e.jsx(N,{children:"Recent circuit events"}),e.jsx(P,{children:"Runbook: docs/chat-sandbox-spend-runbook.md"})]}),e.jsx(j,{children:s.events.length?e.jsx("ul",{className:"space-y-2 text-sm",children:s.events.map(h=>e.jsxs("li",{children:[e.jsx(I,{children:h.severity})," ",h.type," · ",v(h.created_at)]},h.id))}):e.jsx("p",{className:"cron-muted",children:"No events in this cycle."})})]})]})},Ks=({data:s,loading:r,error:n})=>{if(r)return e.jsxs("div",{className:"flex items-center py-8",children:[e.jsx(R,{className:"h-5 w-5 animate-spin mr-3"}),"Loading web-search budget…"]});if(n||!s)return e.jsx(g,{className:"cron-status--broken",children:e.jsx(j,{className:"pt-6",children:"Web-search budget accounting is unavailable."})});const l=Math.min(100,s.call_count/s.hard_limit_calls*100);return e.jsxs(g,{className:s.circuit_state==="tripped"?"cron-status--broken":s.circuit_state==="warning"||s.circuit_state==="cooldown"?"cron-status--degraded":"",children:[e.jsxs(f,{children:[e.jsx(N,{children:"Web search"}),e.jsxs(P,{children:[s.environment," · UTC cycle ",s.billing_cycle," · provider details are admin-only"]})]}),e.jsxs(j,{className:"space-y-4",children:[e.jsxs("div",{className:"grid md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Circuit"}),e.jsx("br",{}),s.circuit_state,s.trip_reason?` · ${s.trip_reason}`:""]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Calls"}),e.jsx("br",{}),s.call_count," / ",s.hard_limit_calls," · ",s.success_count," successful"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Remaining"}),e.jsx("br",{}),s.remaining_calls]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Warning"}),e.jsx("br",{}),s.warning_calls," calls"]})]}),e.jsx("div",{role:"progressbar","aria-label":"Web-search monthly budget used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(l),className:"h-2 rounded bg-muted",children:e.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${l}%`}})}),e.jsxs("p",{className:"text-xs cron-muted",children:["Cycle ends ",v(s.cycle_end_at)," · provider-reported cost $",(s.provider_cost_microusd/1e6).toFixed(4),s.last_latency_ms!==null?` · last ${s.last_latency_ms} ms / ${s.last_result_count??0} results`:"",s.cooldown_until?` · cooldown until ${v(s.cooldown_until)}`:"",s.last_provider_error_class?` · last provider error ${s.last_provider_error_class}`:""]}),s.events.length>0&&e.jsx("ul",{className:"space-y-1 text-sm",children:s.events.map(i=>e.jsxs("li",{children:[i.type," · ",v(i.created_at),i.error_class?` · ${i.error_class}`:""]},i.id))})]})]})},zs=({data:s})=>s!=null&&s.snapshot_stale?e.jsx(g,{className:"mb-6 cron-status--degraded",role:"status",children:e.jsx(j,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"}),e.jsxs("span",{children:["Refreshing status… Current snapshot is ",Math.ceil(s.snapshot_age_seconds)," seconds old."]})]})})}):null,Gs=(s,r)=>s!=null&&s.snapshot_stale||s!=null&&s.refreshing?5e3:r?3e4:!1,ga=()=>{const s=xs(),r=xe(),[n,l]=x.useState(!0),[i,o]=x.useState(""),[m,_]=x.useState(""),[p,h]=x.useState(new Set),{user:c}=hs(),{data:t,isLoading:b,error:k}=z({queryKey:re,queryFn:()=>ue.getCronStatus(),refetchInterval:a=>Gs(a.state.data,n),retry:!1}),O=z({queryKey:["admin","chatSandboxSpend",m],queryFn:()=>ye.getSandboxSpend(m||void 0),refetchInterval:n?3e4:!1,retry:!1}),u=z({queryKey:["admin","chatWebSearchBudget"],queryFn:()=>ye.getWebSearchBudget(),enabled:s,refetchInterval:n?3e4:!1,retry:!1}),G=L({mutationFn:()=>Promise.all([r.cancelQueries({queryKey:re}).then(()=>r.fetchQuery({queryKey:re,queryFn:()=>ue.getCronStatus(!0),retry:!1})),r.refetchQueries({queryKey:["admin"],type:"active",predicate:a=>a.queryKey[1]!==re[1]})])}),Z=k instanceof Te&&k.status===401?"Unauthorized. Sign in with an allowlisted Hugging Face admin account.":k instanceof Error?k.message:void 0,J=a=>{h(d=>{const w=new Set(d);return w.has(a)?w.delete(a):w.add(a),w})},T=(t==null?void 0:t.jobs.filter(a=>a.dashboard_group==="leaderboard_sync"))??[],ee=(t==null?void 0:t.jobs.filter(a=>a.category!=="manual"&&a.dashboard_group!=="leaderboard_sync"))??[],le=ee.filter(a=>a.critical),de=ee.filter(a=>!a.critical),Q=(t==null?void 0:t.manual_operations)??[],M=!!(b||G.isPending||t!=null&&t.refreshing),A=de.reduce((a,d)=>(a[d.category]||(a[d.category]=[]),a[d.category].push(d),a),{}),se=Object.keys(A).sort((a,d)=>{const w=["systemd","hourly","daily","weekly","backfill"];return w.indexOf(a)-w.indexOf(d)}),q=a=>e.jsx(Ms,{job:a,expanded:p.has(a.job_name),onToggle:()=>J(a.job_name),autoRefresh:n},a.job_name);return e.jsx("div",{className:"cron-dashboard","data-shadcn":!0,children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[e.jsx(ne,{className:"h-8 w-8 cron-info-text"}),"Admin Dashboard"]}),e.jsx("p",{className:"mt-2 cron-muted",children:"Paper curation queue and operational health for scheduled jobs"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(y,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(pe,{to:"/autonomous-operations",children:"Autonomous operations"})}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>l(!n),className:n?"cron-status--running":"",children:[e.jsx(be,{className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"Auto-refresh ",n?"ON":"OFF"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>G.mutate(),disabled:M,children:[e.jsx(be,{className:`h-4 w-4 mr-2 ${M?"animate-spin":""}`}),"Refresh"]})]})]})}),e.jsx(g,{className:"mb-6",children:e.jsx(j,{className:"pt-6",children:e.jsxs("p",{className:"text-sm cron-muted",children:["Signed in as ",e.jsxs("span",{className:"font-semibold",children:["@",c==null?void 0:c.username]}),". Health checks prefer database freshness over log completion so silent no-work failures surface as degraded or broken. Expanded jobs include deterministic scheduler, log, lock, durable-data, throughput, backlog, and semantic contract evidence with direct operator and run links."]})})}),e.jsx(zs,{data:t}),e.jsxs(Ls,{defaultValue:"critical-jobs",children:[e.jsxs(Xe,{className:"grid h-auto w-full grid-cols-2 sm:w-auto sm:grid-cols-5",children:[e.jsx(U,{value:"critical-jobs",children:"Critical Jobs"}),e.jsx(U,{value:"leaderboard-syncs",children:"Leaderboard Syncs"}),e.jsx(U,{value:"codex-paper-jobs",children:"Codex Paper Jobs"}),e.jsx(U,{value:"catalog-audit",children:"Catalog Audit"}),e.jsx(U,{value:"chat-compute",children:"Chat Compute"})]}),e.jsxs(H,{value:"critical-jobs",className:"mt-6",children:[b&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(R,{className:"h-8 w-8 animate-spin cron-info-text"}),e.jsx("span",{className:"ml-3 cron-muted",children:"Loading CRON jobs status..."})]}),k&&e.jsx(g,{className:"cron-status--broken",children:e.jsx(j,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:"h-5 w-5"}),e.jsx("p",{children:Z??"Failed to load CRON jobs status. Please try again."})]})})}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6",children:["healthy","degraded","broken","running","stuck","unknown"].map(a=>e.jsxs(g,{children:[e.jsx(f,{className:"pb-2",children:e.jsx(N,{className:"text-sm font-medium cron-muted capitalize",children:a})}),e.jsx(j,{children:e.jsx("div",{className:"text-2xl font-bold",children:t.summary[a]})})]},a))}),t.summary.critical_issues.length>0&&e.jsxs(g,{className:"mb-6 cron-status--broken",children:[e.jsx(f,{children:e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"h-5 w-5"}),"Critical job issues"]})}),e.jsx(j,{children:e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm",children:t.summary.critical_issues.map(a=>e.jsx("li",{children:a},a))})})]}),e.jsxs(g,{className:"mb-8",children:[e.jsx(f,{children:e.jsx(N,{className:"text-base",children:"What to check next"})}),e.jsxs(j,{children:[e.jsx("p",{className:"text-sm cron-muted",children:t.summary.what_to_check_next}),e.jsxs("p",{className:"mt-2 text-xs cron-muted flex items-center gap-2",children:[e.jsx(qe,{className:"h-4 w-4"}),"Last updated: ",v(t.timestamp)," · Health score:"," ",t.summary.health_score.toFixed(0),"%"]})]})]}),e.jsxs(g,{className:`mb-8 ${t.summary.coverage.coverage_gaps?"cron-status--broken":""}`,children:[e.jsxs(f,{children:[e.jsx(N,{className:"text-base",children:"Coverage"}),e.jsx(P,{children:"Registry and deployed scheduler inventory"})]}),e.jsxs(j,{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Registered"}),e.jsx("div",{className:"text-2xl font-bold",children:t.summary.coverage.registered_scheduled_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Discovered"}),e.jsx("div",{className:"text-2xl font-bold",children:t.summary.coverage.discovered_scheduled_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Monitored"}),e.jsx("div",{className:"text-2xl font-bold",children:t.summary.coverage.monitored_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Gaps"}),e.jsx("div",{className:"text-2xl font-bold",children:t.summary.coverage.coverage_gaps})]})]})]}),e.jsxs(g,{className:"mb-8",children:[e.jsxs(f,{children:[e.jsx(N,{className:"text-xl",children:"Critical jobs"}),e.jsx(P,{children:"Writers whose stale output breaks the live site"})]}),e.jsx(j,{className:"space-y-4",children:le.map(q)})]}),e.jsx("div",{className:"space-y-6",children:se.map(a=>e.jsxs(g,{children:[e.jsx(f,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(N,{className:"text-xl capitalize flex items-center gap-2",children:[e.jsx(I,{className:ge(Fe[a]??Fe.hourly),children:a}),e.jsx("span",{children:"Supporting jobs"})]}),e.jsxs(P,{children:[A[a].length," job",A[a].length!==1?"s":""]})]})}),e.jsx(j,{className:"space-y-4",children:A[a].map(q)})]},a))}),Q.length>0&&e.jsxs(g,{className:"mt-6",children:[e.jsxs(f,{children:[e.jsx(N,{className:"text-xl",children:"Manual operations"}),e.jsx(P,{children:"Visible invocation history; excluded from scheduled health and coverage"})]}),e.jsx(j,{className:"space-y-4",children:Q.map(q)})]})]})]}),e.jsxs(H,{value:"leaderboard-syncs",className:"mt-6",children:[b&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(R,{className:"h-8 w-8 animate-spin cron-info-text"}),e.jsx("span",{className:"ml-3 cron-muted",children:"Loading leaderboard sync status..."})]}),k&&e.jsx(g,{className:"cron-status--broken",children:e.jsx(j,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:"h-5 w-5"}),e.jsx("p",{children:Z??"Failed to load leaderboard sync status. Please try again."})]})})}),t&&e.jsxs(g,{children:[e.jsx(f,{children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(N,{className:"text-xl",children:"Leaderboard syncs"}),e.jsx(P,{children:"Recurring imports from externally maintained benchmark leaderboards"})]}),e.jsxs(I,{children:[T.length," jobs"]})]})}),e.jsx(j,{className:"space-y-4",children:T.map(q)})]})]}),e.jsx(H,{value:"codex-paper-jobs",className:"mt-6",children:e.jsx(Bs,{autoRefresh:n})}),e.jsx(H,{value:"catalog-audit",className:"mt-6",children:e.jsx(Hs,{})}),e.jsxs(H,{value:"chat-compute",className:"mt-6",children:[e.jsxs(g,{className:"mb-6",children:[e.jsxs(f,{children:[e.jsx(N,{children:"Environment record"}),e.jsx(P,{children:"Leave blank for live staging, or enter the isolated environment printed by the spend qualification command."})]}),e.jsxs(j,{className:"flex gap-2",children:[e.jsx("input",{"aria-label":"Chat compute environment record",value:i,onChange:a=>o(a.target.value),placeholder:"staging-q-example",className:"flex-1 rounded border px-3 py-2"}),e.jsx(y,{onClick:()=>_(i.trim()),children:"Load"})]})]}),e.jsx(Ws,{data:O.data,loading:O.isLoading,error:O.error}),s&&e.jsx("div",{className:"mt-6",children:e.jsx(Ks,{data:u.data,loading:u.isLoading,error:u.error})})]})]})]})})};export{Ws as ChatComputePanel,zs as CronSnapshotNotice,Gs as cronStatusRefetchInterval,ga as default}; diff --git a/assets/CronDashboard-kqcQ1rzf.js b/assets/CronDashboard-kqcQ1rzf.js new file mode 100644 index 0000000000000000000000000000000000000000..c13b8917252f3deb2a7d4c4b601dd2d38ccf8a0c --- /dev/null +++ b/assets/CronDashboard-kqcQ1rzf.js @@ -0,0 +1,36 @@ +import{s as O,d as h,M as is,A as cs,j as e,z as ie,af as ls,R as ds,N as os,D as oe,P as ms,F as us,O as Ae,G as L,b as G,I as $,i as xe,U as Re,L as pe,a as hs,q as xs}from"./index-DyXq7-Tg.js";import{u as P}from"./useMutation-UWxBeqtn.js";import{t as ge,f as v,a as S,S as Te,o as ue,C as g,b as N,c as b,d as F,e as j,g as C}from"./CronDashboard-qYV75PLc.js";import{B as I}from"./badge-e6t3GCyf.js";import{B as y}from"./button-DZeAbOf2.js";import{C as ps,a as gs}from"./chevron-up-DYSYRyvz.js";import{D as fe}from"./database-DflzbaZ5.js";import{T as js}from"./trending-up-OM6wBVvQ.js";import{A as ne}from"./activity-S-FQ6Anu.js";import{F as Ne}from"./file-text-dvKtHbmD.js";import{T as Ee,I as vs}from"./triangle-alert-uZ3fXFkp.js";import{E as Y}from"./external-link-orY1Xz1I.js";import{C as Z,R as be}from"./refresh-cw-DYXzpRir.js";import{L as R}from"./loader-circle-C75KLEgx.js";import{C as je}from"./circle-check-GGlu5UCV.js";import{c as M,A as _s}from"./codex-DFj4KHqP.js";import{u as fs}from"./useInfiniteQuery-BYh2zN-T.js";import{p as Me}from"./paperEdits-CIjFYfYE.js";import{c as me}from"./catalog-CRar2olQ.js";import{c as ye}from"./chat-Ix1IrIwq.js";/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const we=O("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ns=O("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bs=O("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ys=O("CircleSlash2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ws=O("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qe=O("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ks=O("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);var ce="Tabs",[Cs]=us(ce,[Ae]),De=Ae(),[Ss,ve]=Cs(ce),Ie=h.forwardRef((s,r)=>{const{__scopeTabs:t,value:c,onValueChange:i,defaultValue:d,orientation:o="horizontal",dir:_,activationMode:x="automatic",...u}=s,p=is(_),[n,f]=cs({prop:c,onChange:i,defaultProp:d??"",caller:ce});return e.jsx(Ss,{scope:t,baseId:ls(),value:n,onValueChange:f,orientation:o,dir:p,activationMode:x,children:e.jsx(ie.div,{dir:p,"data-orientation":o,...u,ref:r})})});Ie.displayName=ce;var Oe="TabsList",Je=h.forwardRef((s,r)=>{const{__scopeTabs:t,loop:c=!0,...i}=s,d=ve(Oe,t),o=De(t);return e.jsx(ds,{asChild:!0,...o,orientation:d.orientation,dir:d.dir,loop:c,children:e.jsx(ie.div,{role:"tablist","aria-orientation":d.orientation,...i,ref:r})})});Je.displayName=Oe;var Be="TabsTrigger",Ue=h.forwardRef((s,r)=>{const{__scopeTabs:t,value:c,disabled:i=!1,...d}=s,o=ve(Be,t),_=De(t),x=ze(o.baseId,c),u=Ke(o.baseId,c),p=c===o.value;return e.jsx(os,{asChild:!0,..._,focusable:!i,active:p,children:e.jsx(ie.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":u,"data-state":p?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:x,...d,ref:r,onMouseDown:oe(s.onMouseDown,n=>{!i&&n.button===0&&n.ctrlKey===!1?o.onValueChange(c):n.preventDefault()}),onKeyDown:oe(s.onKeyDown,n=>{[" ","Enter"].includes(n.key)&&o.onValueChange(c)}),onFocus:oe(s.onFocus,()=>{const n=o.activationMode!=="manual";!p&&!i&&n&&o.onValueChange(c)})})})});Ue.displayName=Be;var He="TabsContent",We=h.forwardRef((s,r)=>{const{__scopeTabs:t,value:c,forceMount:i,children:d,...o}=s,_=ve(He,t),x=ze(_.baseId,c),u=Ke(_.baseId,c),p=c===_.value,n=h.useRef(p);return h.useEffect(()=>{const f=requestAnimationFrame(()=>n.current=!1);return()=>cancelAnimationFrame(f)},[]),e.jsx(ms,{present:i||p,children:({present:f})=>e.jsx(ie.div,{"data-state":p?"active":"inactive","data-orientation":_.orientation,role:"tabpanel","aria-labelledby":x,hidden:!f,id:u,tabIndex:0,...o,ref:r,style:{...s.style,animationDuration:n.current?"0s":void 0},children:f&&d})})});We.displayName=He;function ze(s,r){return`${s}-trigger-${r}`}function Ke(s,r){return`${s}-content-${r}`}var $s=Ie,Ge=Je,Qe=Ue,Ve=We;const Ls=$s,Xe=h.forwardRef(({className:s,...r},t)=>e.jsx(Ge,{ref:t,className:L("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...r}));Xe.displayName=Ge.displayName;const H=h.forwardRef(({className:s,...r},t)=>e.jsx(Qe,{ref:t,className:L("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",s),...r}));H.displayName=Qe.displayName;const W=h.forwardRef(({className:s,...r},t)=>e.jsx(Ve,{ref:t,className:L("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...r}));W.displayName=Ve.displayName;function A({tone:s,className:r,...t}){return e.jsx(I,{variant:"outline",className:L(ge(s),r),...t})}function te(s){return s==null?"N/A":s<60?`${s.toFixed(1)}s`:s<3600?`${(s/60).toFixed(1)}m`:`${(s/3600).toFixed(1)}h`}function Ye(s){return s.available?s.status==="completed"?s.conclusion??"completed":s.status??"unknown":"Unavailable"}function X(s){return s.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function ke({title:s,budget:r,profile:t}){const c=r.cost_policy==="unmetered_hf"||r.budget_enforced===!1,i=Math.min(100,r.current_exposure_usd/r.ceiling_usd*100),d=c?"Unmetered HF":r.affordable_jobs===0&&r.desired_jobs>0?"No shard fits":r.affordable_jobs0?"Now":"No scheduled admission"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Unknown terminal reserve"}),e.jsxs("div",{children:[S(r.unknown_terminal_reservation_usd??0)," · ",(r.unknown_terminal_reservation_count??0).toLocaleString()," jobs"]})]})]}),t&&e.jsxs("div",{className:"text-xs cron-muted",children:["Profile ",e.jsx("strong",{children:t.profile_id})," · max ",t.max_papers.toLocaleString()," papers · hard ",te(t.hard_timeout_seconds)," · soft ",te(t.soft_deadline_seconds)]}),e.jsx("p",{className:"text-xs cron-muted",children:c?"HF owns this workload, so monetary admission is disabled; concurrency and timeout limits still apply. Runtime cost remains an operational estimate.":"Projected exposure is an admission-control estimate, not a provider invoice. Each launch reserves the full timeout until actual runtime is known."})]})}const Ps={healthy:je,degraded:Ee,broken:Z,running:R,stuck:Z,unknown:Ns};function Fs({status:s,isRunning:r}){const t=r?"running":s,c=Ps[t];return e.jsx(c,{className:`cron-status-icon ${ge(t)}${t==="running"?" animate-spin":""}`})}function Ce({label:s,axis:r}){return e.jsxs(A,{tone:r.status,title:r.reason,children:[s,": ",r.status]})}function Se({icon:s,title:r,metrics:t}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(s,{className:"h-4 w-4"}),e.jsx("h4",{children:r})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Object.entries(t).map(([c,i])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:X(c)}),e.jsx("div",{className:"text-lg font-semibold",children:typeof i=="number"?i.toLocaleString():i})]},c))})]})}function As({workflow:s}){return e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(ne,{className:"h-4 w-4"}),e.jsx("h4",{children:"GitHub Actions"})]}),e.jsxs("div",{className:"cron-metric-card space-y-2 text-sm",children:[[["Workflow",s.workflow_file],["Run",s.run_id??"N/A"],["Status",Ye(s)],...s.updated_at?[["Updated",v(s.updated_at)]]:[]].map(([r,t])=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"cron-label",children:r}),e.jsx("span",{className:r==="Workflow"?"font-mono text-xs":void 0,children:t})]},r)),s.failed_jobs&&s.failed_jobs.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Failed jobs"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:s.failed_jobs.map(r=>e.jsx(A,{tone:"broken",children:r},r))})]}),s.job_conclusions&&Object.keys(s.job_conclusions).length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cron-label mb-1",children:"Job conclusions"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:Object.entries(s.job_conclusions).map(([r,t])=>e.jsxs(I,{variant:"outline",children:[r,": ",t??"running"]},r))})]}),(s.error||s.view_error)&&e.jsx("div",{className:"cron-message cron-message--error",children:s.error??s.view_error})]})]})}const Rs={COMPLETED:"healthy",ERROR:"broken",CANCELED:"broken",RUNNING:"running"},$e={success:"healthy",partial:"degraded",interrupted:"degraded",infrastructure_failure:"broken",worker_failure:"broken",active:"running"};function Ts({job:s}){const r=s.progress,t=(r==null?void 0:r.omitted_images)??0,c=r!=null&&r.total_papers?Math.min(100,r.processed_papers/r.total_papers*100):0;return e.jsxs("div",{className:"cron-metric-card space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-semibold",children:[s.mode??"unknown"," · shard ",s.shard_id??"N/A"," · attempt ",s.provider_attempt??1]}),e.jsx("div",{className:"font-mono text-xs cron-muted truncate",children:s.id})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{tone:Rs[s.stage]??"unknown",children:s.stage.toLowerCase()}),s.effective_outcome&&e.jsxs(A,{tone:$e[s.effective_outcome]??"unknown",children:["output: ",s.effective_outcome.replace(/_/g," ")]}),s.failure_cause&&e.jsxs(A,{tone:$e[s.effective_outcome??""]??"unknown",children:["cause: ",s.failure_cause.replace(/_/g," ")]}),s.url&&e.jsx("a",{href:s.url,target:"_blank",rel:"noreferrer","aria-label":`Open Hugging Face Job ${s.id}`,className:"cron-info-text",children:e.jsx(Y,{className:"h-4 w-4"})})]})]}),r?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between gap-3 text-xs cron-muted mb-1",children:[e.jsxs("span",{children:[r.processed_papers.toLocaleString()," / ",r.total_papers.toLocaleString()," papers"]}),e.jsxs("span",{children:[c.toFixed(0),"%"]})]}),e.jsx("div",{className:"cron-progress-track",children:e.jsx("div",{className:"cron-progress-value",style:{width:`${c}%`}})})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-sm",children:[e.jsxs("span",{children:[e.jsx("strong",{children:r.succeeded_papers.toLocaleString()})," succeeded"]}),e.jsxs("span",{children:[e.jsx("strong",{children:r.failed_papers.toLocaleString()})," failed"]}),e.jsxs("span",{children:[e.jsx("strong",{children:r.already_existed_papers.toLocaleString()})," skipped"]}),e.jsxs("span",{children:[e.jsx("strong",{children:r.extracted_images.toLocaleString()})," images"]})]}),t>0&&e.jsxs("div",{className:"text-xs cron-muted",children:[e.jsx("strong",{children:t.toLocaleString()})," unresolved image references omitted after final retry"]}),r.updated_at&&e.jsxs("div",{className:"text-xs cron-muted",children:["Progress updated ",v(r.updated_at)]}),(r.fatal_error||r.error_samples.length>0)&&e.jsxs("div",{className:"cron-message cron-message--error space-y-1",children:[r.fatal_error&&e.jsx("div",{children:r.fatal_error}),r.error_samples.map(i=>e.jsxs("div",{children:[e.jsx("span",{className:"font-mono",children:i.arxiv_id}),": ",i.error]},`${i.arxiv_id}:${i.error}`))]})]}):e.jsx("div",{className:"text-sm cron-muted",children:"Waiting for the shard progress checkpoint."}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs cron-muted",children:[s.hardware&&e.jsx("span",{children:s.hardware}),s.created_at&&e.jsxs("span",{children:["Created ",v(s.created_at)]}),s.duration_seconds!=null&&e.jsxs("span",{children:["Duration ",te(s.duration_seconds)]})]}),s.stage_message&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.stage_message})]})}function Es({monitor:s,loading:r,error:t}){var c,i;return e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(vs,{className:"h-4 w-4"}),e.jsx("h4",{children:"Hugging Face OCR shards"})]}),r&&e.jsxs("div",{className:"cron-metric-card flex items-center gap-2 text-sm cron-muted",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"})," Loading remote Jobs…"]}),!!t&&e.jsx("div",{className:"cron-message cron-message--error",children:"Could not load Hugging Face Jobs."}),s&&!s.available&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.error??"Hugging Face monitoring is unavailable."}),(s==null?void 0:s.available)&&e.jsxs(e.Fragment,{children:[s.budgets.live&&s.budgets.backfill&&e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3 mb-3",children:[e.jsx(ke,{title:"Live paper Markdown GPU policy",budget:s.budgets.live,profile:(c=s.selected_profiles)==null?void 0:c.live}),e.jsx(ke,{title:"Full backfill GPU policy",budget:s.budgets.backfill,profile:(i=s.selected_profiles)==null?void 0:i.backfill})]}),e.jsxs("div",{className:`cron-message mb-3 ${(s.summary.unresolved_mount_failures??0)>0?"cron-message--error":""}`,children:[e.jsx("strong",{children:"Logical shard health:"})," ",(s.summary.logical_shards??0).toLocaleString()," logical shards / ",(s.summary.provider_attempts??0).toLocaleString()," provider attempts · ",(s.summary.recovered_mount_failures??0).toLocaleString()," recovered mount failures · ",(s.summary.unresolved_mount_failures??0).toLocaleString()," unresolved"]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-3",children:Object.entries(s.summary).map(([d,o])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:X(d)}),e.jsx("div",{className:"text-lg font-semibold",children:o.toLocaleString()})]},d))}),e.jsx("p",{className:"text-xs cron-muted mb-3",children:"Efficiency and backlog-clearance costs are admission-control estimates, not provider invoices."}),s.coverage&&Object.keys(s.coverage).length>0&&e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3 mb-3",children:Object.values(s.coverage).map(d=>e.jsxs("div",{className:"cron-metric-card space-y-2 text-sm",children:[e.jsx("div",{className:"font-semibold",children:d.scope==="full"?"Full catalog coverage":"Recent 14-day coverage"}),e.jsxs("div",{className:"text-lg font-semibold",children:[d.coverage_percentage.toFixed(2),"%"]}),e.jsxs("div",{children:[d.canonical_markdown_count.toLocaleString()," canonical / ",d.eligible_papers.toLocaleString()," eligible · ",d.missing_count.toLocaleString()," missing"]}),e.jsxs("div",{className:"cron-muted",children:["Copied from upstream this reconciliation: ",d.copied_from_upstream_count.toLocaleString()]}),e.jsxs("div",{className:"cron-muted",children:["7-day Δ eligible ",d.eligible_delta_7d??"collecting"," · canonical ",d.canonical_delta_7d??"collecting"," · missing ",d.missing_delta_7d??"collecting"]})]},d.scope))}),s.jobs.length===0?e.jsx("div",{className:"cron-metric-card text-sm cron-muted",children:"No OCR shards have been launched yet."}):e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:s.jobs.map(d=>e.jsx(Ts,{job:d},d.id))})]})]})}function Ms({job:s,expanded:r,onToggle:t,autoRefresh:c=!1}){var p;const i=!!(s.work_metrics&&Object.keys(s.work_metrics).length),d=!!(s.db_metrics&&Object.keys(s.db_metrics).length),o=s.job_name==="paper_markdown_backfill",_=G({queryKey:$.paperMarkdownJobs,queryFn:()=>ue.getPaperMarkdownJobs(),enabled:o,refetchInterval:c?3e4:!1,retry:!1}),x=o?(p=_.data)==null?void 0:p.budgets.live:void 0,u=(x==null?void 0:x.cost_policy)==="unmetered_hf"||(x==null?void 0:x.budget_enforced)===!1;return e.jsxs("div",{className:"cron-job-card",children:[e.jsx("button",{type:"button",className:"cron-job-summary",onClick:t,"aria-expanded":r,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx(Fs,{status:s.status,isRunning:s.is_running}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsx("h3",{className:"font-semibold",children:s.display_name}),s.critical&&e.jsx(I,{variant:"outline",className:"text-[10px] uppercase tracking-wide",children:"Critical"}),s.lock_stale&&e.jsx(A,{tone:"broken",children:"Held lock"}),e.jsx(Ce,{label:"Execution",axis:s.execution_health}),e.jsx(Ce,{label:"Output",axis:s.output_health}),r?e.jsx(ps,{className:"h-4 w-4 cron-muted"}):e.jsx(gs,{className:"h-4 w-4 cron-muted"})]}),e.jsx("p",{className:"text-sm cron-muted mb-2",children:s.status_reason}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2 text-sm cron-muted",children:[e.jsxs("span",{className:"cron-fact",children:[e.jsx(qe,{}),"Log: ",v(s.last_run)]}),e.jsxs("span",{className:"cron-fact",children:[e.jsx(fe,{}),"DB: ",v(s.last_db_write)]}),s.recent_write_count!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(js,{}),"Recent writes: ",s.recent_write_count.toLocaleString()]}),s.duration!=null&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(ne,{}),"Duration: ",te(s.duration)]}),s.schedule&&e.jsxs("span",{className:"cron-fact md:col-span-2",children:[e.jsx(we,{}),e.jsx("span",{className:"font-mono text-xs",children:s.schedule})]}),s.log_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(Ne,{}),"Log status: ",s.log_status]}),s.workflow_status&&e.jsxs("span",{className:"cron-fact",children:[e.jsx(ne,{}),"Actions: ",Ye(s.workflow_status)]})]}),s.work_summary&&e.jsx("div",{className:"cron-message",children:s.work_summary}),s.error&&e.jsxs("div",{className:"cron-message cron-message--error",children:[e.jsx("strong",{children:"Error: "}),s.error]}),s.diagnostics&&e.jsx("div",{className:"cron-message cron-message--warning",children:s.diagnostics}),x&&e.jsxs("div",{className:`cron-message ${x.can_launch_planned?"":"cron-message--error"}`,children:[e.jsx("strong",{children:"Live GPU policy:"})," ",u?"unmetered on HF":`${S(x.current_exposure_usd)} current / ${S(x.ceiling_usd)} cap`," · ",x.affordable_jobs," of ",x.desired_jobs," planned",u?"":` · projects ${S(x.projected_usd)} · rolling 30 days`]})]})]}),e.jsx(A,{tone:s.status,children:s.status})]})}),r&&e.jsx("div",{className:"cron-job-details",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(we,{className:"h-4 w-4"}),e.jsx("h4",{children:"Scheduler evidence"})]}),e.jsx("div",{className:"cron-metric-card space-y-2 text-sm",children:[["Scheduler",s.execution_health.scheduler??"unknown"],["Last expected",v(s.execution_health.last_expected_at??null)],["Last started",v(s.execution_health.last_started_at??null)],["Last completed",v(s.execution_health.last_completed_at??null)],["Next expected",v(s.execution_health.next_expected_at??null)]].map(([n,f])=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"cron-label",children:n}),e.jsx("span",{children:f})]},n))})]}),s.work_metrics&&i&&e.jsx(Se,{icon:Ne,title:"Log Metrics",metrics:s.work_metrics}),s.db_metrics&&d&&e.jsx(Se,{icon:fe,title:"Database Metrics",metrics:s.db_metrics}),s.workflow_status&&e.jsx(As,{workflow:s.workflow_status}),o&&e.jsx(Es,{monitor:_.data,loading:_.isLoading,error:_.error}),s.diagnostic_groups&&Object.values(s.diagnostic_groups).some(n=>n.length>0)&&e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(Ee,{className:"h-4 w-4"}),e.jsx("h4",{children:"Diagnostics by cause"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:Object.entries(s.diagnostic_groups).filter(([,n])=>n.length>0).map(([n,f])=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label mb-1",children:X(n)}),e.jsx("ul",{className:"list-disc pl-4 text-sm space-y-1",children:f.map(k=>e.jsx("li",{children:k},k))})]},n))})]}),s.health_findings&&s.health_findings.some(n=>n.state!=="healthy")&&e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("div",{className:"cron-section-heading",children:[e.jsx(Te,{className:"h-4 w-4"}),e.jsx("h4",{children:"Deterministic contract findings"})]}),e.jsxs("div",{className:"cron-metric-card space-y-3 text-sm",children:[s.health_findings.filter(n=>n.state!=="healthy").map(n=>e.jsxs("div",{children:[e.jsx(A,{tone:n.state,children:n.state})," ",e.jsx("strong",{children:X(n.contract)}),": ",n.summary,Object.entries(n.evidence).length>0&&e.jsx("div",{className:"mt-1 text-xs cron-muted",children:Object.entries(n.evidence).map(([f,k])=>e.jsxs("span",{className:"mr-3",children:[X(f),": ",String(k)]},f))})]},`${n.plane}-${n.contract}`)),e.jsxs("div",{className:"flex gap-4",children:[s.operator_url&&e.jsxs("a",{className:"cron-info-text inline-flex items-center gap-1",href:s.operator_url,children:["Open operator ",e.jsx(Y,{className:"h-3.5 w-3.5"})]}),s.run_url&&e.jsxs("a",{className:"cron-info-text inline-flex items-center gap-1",href:s.run_url,target:"_blank",rel:"noreferrer",children:["Open run ",e.jsx(Y,{className:"h-3.5 w-3.5"})]})]})]})]})]})})]})}const Ze=h.forwardRef(({className:s,...r},t)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:t,className:L("w-full caption-bottom text-sm",s),...r})}));Ze.displayName="Table";const es=h.forwardRef(({className:s,...r},t)=>e.jsx("thead",{ref:t,className:L("[&_tr]:border-b",s),...r}));es.displayName="TableHeader";const ss=h.forwardRef(({className:s,...r},t)=>e.jsx("tbody",{ref:t,className:L("[&_tr:last-child]:border-0",s),...r}));ss.displayName="TableBody";const qs=h.forwardRef(({className:s,...r},t)=>e.jsx("tfoot",{ref:t,className:L("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...r}));qs.displayName="TableFooter";const he=h.forwardRef(({className:s,...r},t)=>e.jsx("tr",{ref:t,className:L("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",s),...r}));he.displayName="TableRow";const z=h.forwardRef(({className:s,...r},t)=>e.jsx("th",{ref:t,className:L("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...r}));z.displayName="TableHead";const K=h.forwardRef(({className:s,...r},t)=>e.jsx("td",{ref:t,className:L("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...r}));K.displayName="TableCell";const Ds=h.forwardRef(({className:s,...r},t)=>e.jsx("caption",{ref:t,className:L("mt-4 text-sm text-muted-foreground",s),...r}));Ds.displayName="TableCaption";const as={queued:"unknown",dispatching:"running",running:"running",completed:"healthy",failed:"broken",canceled:"unknown",awaiting_markdown:"unknown"},rs={queued:"queued",dispatching:"dispatching",running:"running",completed:"completed",failed:"failed",canceled:"canceled",awaiting_markdown:"waiting for Markdown"},Le={"add-evals":"Add evals","enrich-paper":"Enrich paper","resolve-model-paper":"Resolve model release","review-benchmark-gaps":"Review benchmark gaps","add-benchmark":"Add benchmark"},Is={queued:ws,dispatching:R,running:bs,completed:je,failed:Z,canceled:ys,awaiting_markdown:ks};function Os({status:s}){const r=Is[s];return e.jsxs(A,{tone:as[s],children:[e.jsx(r,{className:`mr-1 h-3.5 w-3.5 ${s==="dispatching"?"animate-spin":""}`}),rs[s]]})}function Js(s){return s.status==="awaiting_markdown"?_s:s.error?s.error:s.report?s.report:s.status==="completed"&&s.applied_at?"Changes applied to the paper.":s.status==="completed"?"Completed without a recorded mutation.":null}function Pe({mutationResult:s}){const r=s==null?void 0:s.skipped_configured_leaderboards;return!Array.isArray(r)||r.length===0?null:e.jsxs("div",{className:"mt-2 rounded border border-amber-500 bg-amber-50 p-2 text-xs text-amber-900",children:[e.jsxs("div",{className:"font-medium",children:["Skipped configured leaderboards (",r.length,")"]}),e.jsx("ul",{className:"mt-1 list-disc space-y-1 pl-4",children:r.map((t,c)=>e.jsxs("li",{children:[t.benchmark," · ",t.disposition," · task ",t.task_id," / dataset ",t.dataset_id,t.metric?` / ${t.metric}`:"",t.value!=null?` = ${t.value}`:"",t.detail?` — ${t.detail}`:""]},c))})]})}function Bs({autoRefresh:s}){var D;const r=xe(),[t,c]=h.useState(""),[i,d]=h.useState(""),[o,_]=h.useState(""),[x,u]=h.useState(""),[p,n]=h.useState(""),[f,k]=h.useState({}),J={trigger:t,status:i,policy_version:o,cohort_date:x,review_status:p},{data:m,isLoading:Q,isFetching:ee,error:B}=G({queryKey:[...$.codexPaperJobs,J],queryFn:()=>M.listJobs(100,J),refetchInterval:s?1e4:!1,retry:!1}),T=()=>r.invalidateQueries({queryKey:$.codexPaperJobs}),se=P({mutationFn:a=>M.retryJob(a),onSuccess:T}),le=P({mutationFn:a=>M.cancelJob(a),onSuccess:T}),de=P({mutationFn:a=>M.retryTrace(a),onSuccess:T}),V=P({mutationFn:a=>M.setScheduler(a),onSuccess:T}),q=P({mutationFn:({id:a,dataset:l,task:w,metric:re})=>M.promoteBenchmarkCandidate(a,{dataset_id:Number(l),task_id:Number(w),best_metric:re.trim()}),onSuccess:T}),E=P({mutationFn:a=>M.rollbackBenchmarkCandidate(a),onSuccess:T}),ae=B instanceof Re&&B.status===404;return e.jsxs(g,{className:"mb-8",children:[e.jsx(N,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(b,{className:"text-xl",children:"Codex paper jobs"}),e.jsx(F,{children:"Durable queue, two-stage daily workflows, traces, and benchmark-gap follow-up"})]}),ee&&!Q&&e.jsxs("span",{className:"flex items-center gap-2 text-xs cron-muted",children:[e.jsx(R,{className:"h-3.5 w-3.5 animate-spin"})," Syncing with Hugging Face"]})]})}),e.jsxs(j,{children:[Q&&e.jsxs("div",{className:"flex items-center justify-center py-10 cron-muted",children:[e.jsx(R,{className:"mr-2 h-5 w-5 animate-spin"})," Loading paper jobs…"]}),B&&!ae&&e.jsx("div",{className:"cron-message cron-message--error mb-4",children:B.message}),ae&&e.jsx("p",{className:"py-4 text-sm cron-muted",children:"Codex paper jobs are not enabled in this environment."}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`cron-message mb-5 ${m.scheduler.paused_at?"cron-message--error":""}`,children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("strong",{children:["Scheduled dispatch: ",m.scheduler.paused_at?"paused":m.scheduler.dispatch_enabled?"enabled":"disabled"]}),m.scheduler.pause_reason&&e.jsx("div",{className:"mt-1 text-xs",children:m.scheduler.pause_reason}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Canary ",m.scheduler.canary_released?"released":"active"," · Queue age ",m.scheduler.queue_age_level]}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Scheduled usage today ",m.scheduler.usage.current_day_tokens.toLocaleString()," tokens · ",m.scheduler.usage.mode==="enforced"?`pause threshold ${((D=m.scheduler.usage.pause_threshold_tokens)==null?void 0:D.toLocaleString())??"not established"}`:"first-week alert-only baseline"," · trailing median ",m.scheduler.usage.trailing_seven_day_median_tokens.toLocaleString()]})]}),e.jsx(y,{size:"sm",variant:m.scheduler.paused_at||!m.scheduler.dispatch_enabled?"default":"outline",disabled:V.isPending,onClick:()=>V.mutate(m.scheduler.paused_at||!m.scheduler.dispatch_enabled?"resume":"pause"),children:m.scheduler.paused_at?"Acknowledge & resume":m.scheduler.dispatch_enabled?"Pause scheduled dispatch":"Enable scheduled dispatch"})]})}),e.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-8",children:[["queued","awaiting_markdown","dispatching","running","completed","failed","canceled"].map(a=>e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label capitalize",children:rs[a]}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:m.summary[a]})]},a)),e.jsxs("div",{className:"cron-metric-card",children:[e.jsx("div",{className:"cron-label",children:"Total"}),e.jsx("div",{className:"mt-1 text-xl font-semibold",children:m.summary.total})]})]}),e.jsxs("div",{className:"mb-5 grid gap-3 sm:grid-cols-5",children:[e.jsxs("select",{"aria-label":"Trigger",className:"rounded border px-2 py-1 text-sm",value:t,onChange:a=>c(a.target.value),children:[e.jsx("option",{value:"",children:"All triggers"}),e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"hf-daily-cron",children:"HF daily cron"}),e.jsx("option",{value:"hf-trending-cron",children:"HF trending cron"}),e.jsx("option",{value:"benchmark-gap-cron",children:"Benchmark gap cron"}),e.jsx("option",{value:"model-release-radar",children:"Release radar"})]}),e.jsxs("select",{"aria-label":"Status",className:"rounded border px-2 py-1 text-sm",value:i,onChange:a=>d(a.target.value),children:[e.jsx("option",{value:"",children:"All statuses"}),Object.keys(as).map(a=>e.jsx("option",{children:a},a))]}),e.jsx("input",{"aria-label":"Policy version",className:"rounded border px-2 py-1 text-sm",placeholder:"Policy version",value:o,onChange:a=>_(a.target.value)}),e.jsx("input",{"aria-label":"Cohort date",type:"date",className:"rounded border px-2 py-1 text-sm",value:x,onChange:a=>u(a.target.value)}),e.jsxs("select",{"aria-label":"Review status",className:"rounded border px-2 py-1 text-sm",value:p,onChange:a=>n(a.target.value),children:[e.jsx("option",{value:"",children:"All review states"}),e.jsx("option",{value:"unreviewed",children:"Unreviewed"}),e.jsx("option",{value:"approved",children:"Approved"}),e.jsx("option",{value:"corrected",children:"Corrected"})]})]}),m.jobs.length===0?e.jsx("p",{className:"py-8 text-center text-sm cron-muted",children:"No paper curation jobs have been submitted yet."}):e.jsxs(Ze,{children:[e.jsx(es,{children:e.jsxs(he,{children:[e.jsx(z,{children:"Status"}),e.jsx(z,{children:"Paper"}),e.jsx(z,{children:"Action"}),e.jsx(z,{children:"Requested"}),e.jsx(z,{children:"Execution"})]})}),e.jsx(ss,{children:m.jobs.map(a=>{const l=Js(a);return e.jsxs(he,{children:[e.jsx(K,{className:"align-top",children:e.jsx(Os,{status:a.status})}),e.jsx(K,{className:"min-w-[260px] align-top",children:a.paper_route?e.jsxs(e.Fragment,{children:[e.jsx(pe,{to:`/paper/${encodeURIComponent(a.paper_route)}`,className:"font-medium hover:underline",children:a.paper_title}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Paper #",a.paper_id]})]}):a.kind==="review-benchmark-gaps"?e.jsx("span",{className:"font-medium",children:"Benchmark-gap backlog"}):a.kind==="add-benchmark"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"Benchmark candidate"}),e.jsx("div",{className:"mt-1 text-xs cron-muted",children:a.benchmark_candidate_id})]}):a.release_signal_id?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"Release radar signal"}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Signal ",a.release_signal_id]})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"Trending model discovery"}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["Candidate ",a.candidate_id]})]})}),e.jsxs(K,{className:"whitespace-nowrap align-top",children:[Le[a.kind],a.applied_at&&e.jsxs("div",{className:"mt-1 flex items-center gap-1 text-xs cron-status--healthy",children:[e.jsx(je,{className:"h-3.5 w-3.5"})," Applied"]})]}),e.jsxs(K,{className:"whitespace-nowrap align-top",children:[e.jsx("div",{children:v(a.created_at)}),e.jsxs("div",{className:"mt-1 text-xs cron-muted",children:["@",a.requested_by]})]}),e.jsxs(K,{className:"max-w-[360px] align-top",children:[a.hf_job_url?e.jsxs("a",{href:a.hf_job_url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 hover:underline",children:["Hugging Face Job ",e.jsx(Y,{className:"h-3.5 w-3.5"})]}):e.jsx("span",{className:"cron-muted",children:"Waiting to dispatch"}),l&&e.jsx("p",{className:`mt-2 line-clamp-3 text-xs ${a.error&&a.status!=="awaiting_markdown"?"text-red-700":"cron-muted"}`,title:l,children:l}),e.jsx(Pe,{mutationResult:a.mutation_result}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[["failed","canceled"].includes(a.status)&&e.jsx(y,{size:"sm",variant:"outline",onClick:()=>se.mutate(a.id),children:"Retry"}),["queued","awaiting_markdown","dispatching","running"].includes(a.status)&&e.jsx(y,{size:"sm",variant:"outline",onClick:()=>le.mutate(a.id),children:"Cancel"}),a.trace_status==="finalize_failed"&&e.jsx(y,{size:"sm",variant:"outline",onClick:()=>de.mutate(a.id),children:"Retry trace"})]})]})]},a.id)})})]}),m.workflows.length>0&&e.jsxs("div",{className:"mt-8 space-y-3",children:[e.jsx("h3",{className:"text-base font-semibold",children:"Scheduled paper workflows"}),m.workflows.map(a=>e.jsxs("details",{className:"rounded-md border p-3",children:[e.jsxs("summary",{className:"cursor-pointer text-sm font-medium",children:["Paper #",a.paper_id," · ",a.cohort_date," · ",a.status," · ",a.policy_version]}),e.jsxs("div",{className:"mt-3 space-y-3 text-xs",children:[a.error&&e.jsx("div",{className:"text-red-700",children:a.error}),a.stages.map(l=>{var w;return e.jsxs("div",{className:"rounded border p-3",children:[e.jsxs("div",{className:"font-medium",children:[Le[l.kind]," · ",l.status," · trace ",l.trace_status," · review ",l.audit_status]}),e.jsxs("div",{className:"mt-1 cron-muted",children:["model ",l.model??"—"," · reasoning ",l.reasoning_effort??"—"," · tokens ",(l.input_tokens??0)+(l.output_tokens??0)," · duration ",l.duration_ms??0," ms · attempts ",l.attempt_count]}),l.error&&e.jsx("div",{className:"mt-2 text-red-700",children:l.error}),l.report&&e.jsx("div",{className:"mt-2 whitespace-pre-wrap rounded border p-2",children:l.report}),l.url_candidates&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{children:"URL candidates and provenance"}),e.jsx("pre",{className:"mt-2 max-h-52 overflow-auto whitespace-pre-wrap",children:JSON.stringify(l.url_candidates,null,2)})]}),l.validation_summary&&e.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap",children:JSON.stringify(l.validation_summary,null,2)}),Array.isArray((w=l.validation_summary)==null?void 0:w.manual_or_legacy_evaluation_rows_affected)&&l.validation_summary.manual_or_legacy_evaluation_rows_affected.length>0&&e.jsxs("div",{className:"mt-2 rounded border border-amber-500 bg-amber-50 p-2 font-medium text-amber-900",children:["Manual or legacy evaluation rows changed: ",l.validation_summary.manual_or_legacy_evaluation_rows_affected.join(", "),". Review the evidence and before/after diff."]}),l.proposal&&e.jsx("pre",{className:"mt-2 max-h-52 overflow-auto whitespace-pre-wrap",children:JSON.stringify(l.proposal,null,2)}),e.jsx(Pe,{mutationResult:l.mutation_result}),l.mutation_result&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{children:"Accepted callback result and before/after state"}),e.jsx("pre",{className:"mt-2 max-h-64 overflow-auto whitespace-pre-wrap",children:JSON.stringify(l.mutation_result,null,2)})]}),l.trace_status==="complete"&&e.jsxs("a",{className:"mt-2 inline-flex items-center gap-1 hover:underline",href:M.traceUrl(l.id),target:"_blank",rel:"noreferrer",children:["Authenticated trace manifest ",e.jsx(Y,{className:"h-3.5 w-3.5"})]})]},l.id)})]})]},a.id))]}),m.benchmark_candidates.length>0&&e.jsxs("div",{className:"mt-8 space-y-3",children:[e.jsx("h3",{className:"text-base font-semibold",children:"Benchmark-gap backlog"}),m.benchmark_candidates.map(a=>{var re,_e;const l=f[a.id]??{dataset:"",task:((re=a.task_ids[0])==null?void 0:re.toString())??"",metric:""},w=Number(l.dataset)>0&&Number(l.task)>0&&l.metric.trim().length>0;return e.jsxs("div",{className:"rounded-md border p-3 text-xs",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"font-medium",children:[a.canonical_name," · ",a.gap_type," · ",a.status]}),e.jsxs("div",{className:"cron-muted",children:[a.distinct_paper_count," paper",a.distinct_paper_count===1?"":"s"," · ",a.confidence??"unknown"," confidence"]})]}),a.canonical_url&&e.jsx("a",{className:"mt-1 block hover:underline",href:a.canonical_url,target:"_blank",rel:"noreferrer",children:a.canonical_url}),e.jsxs("div",{className:"mt-1 cron-muted",children:["Task evidence: ",a.task_ids.join(", ")||"none"," · Papers: ",a.evidence_paper_ids.join(", ")]}),a.review_reason&&e.jsxs("div",{className:"mt-1",children:["Review",a.reviewed_at?` ${v(a.reviewed_at)}`:"",": ",a.review_reason,a.deferred_until&&` · deferred until ${v(a.deferred_until)}`]}),a.resolution&&e.jsxs("div",{className:"mt-1 cron-muted",children:["Dataset #",a.resolution.dataset_id," · task #",a.resolution.task_id," · ",a.resolution.primary_metric,a.resolution.rolled_back_at&&` · rolled back ${v(a.resolution.rolled_back_at)}`]}),a.status==="promoted"&&((_e=a.resolution)==null?void 0:_e.created)&&!a.resolution.rolled_back_at&&e.jsx(y,{className:"mt-2",size:"sm",variant:"outline",disabled:E.isPending,onClick:()=>E.mutate(a.id),children:"Roll back automatic benchmark"}),!["promoted","merged"].includes(a.status)&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[["dataset","task","metric"].map(U=>e.jsx("input",{"aria-label":`${a.canonical_name} ${U}`,className:"w-36 rounded border px-2 py-1",placeholder:U==="metric"?"Exact metric":`${U} ID`,value:l[U],onChange:ns=>k(ts=>({...ts,[a.id]:{...l,[U]:ns.target.value}}))},U)),e.jsx(y,{size:"sm",variant:"outline",disabled:!w||q.isPending,onClick:()=>q.mutate({id:a.id,...l}),children:"Promote & requeue evidence papers"})]})]},a.id)}),q.error&&e.jsx("div",{className:"cron-message cron-message--error",children:q.error.message}),E.error&&e.jsx("div",{className:"cron-message cron-message--error",children:E.error.message})]}),e.jsxs("p",{className:"mt-4 text-xs cron-muted",children:["Showing the 100 most recent jobs · Queue totals include full history · Updated ",v(m.timestamp)]})]})]})]})}function Us(){const[s,r]=h.useState(()=>new Date().toISOString().slice(0,10)),[t,c]=h.useState(1),i=G({queryKey:["paper-edit-digest",s,t],queryFn:()=>Me.digest(s,t),enabled:!!s});return e.jsxs("section",{className:"space-y-3 rounded border p-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Daily paper edits"}),e.jsxs("label",{className:"flex items-center gap-2",children:["UTC date ",e.jsx("input",{type:"date",value:s,onChange:d=>{r(d.target.value),c(1)}})]}),i.isLoading&&e.jsx("p",{children:"Loading daily summary…"}),i.error&&e.jsx("p",{role:"alert",children:i.error.message}),i.data&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:[i.data.edits," published changes · ",i.data.papers," papers · ",i.data.contributors," contributors"]}),e.jsx("ul",{className:"space-y-1",children:i.data.rows.map((d,o)=>e.jsxs("li",{children:[e.jsxs(pe,{className:"underline",to:`/paper/${d.paper_id}`,children:["Paper ",d.paper_id]})," · @",d.actor_username??"admin"," · ",d.edits," changes"]},o))}),e.jsxs("div",{className:"flex gap-2",children:[t>1&&e.jsx(y,{variant:"outline",onClick:()=>c(t-1),children:"Previous"}),i.data.has_more&&e.jsx(y,{variant:"outline",onClick:()=>c(t+1),children:"Next"})]})]})]})}const Hs=()=>{var _,x,u,p;const s=xe(),r=fs({queryKey:$.catalogAudit,queryFn:({pageParam:n})=>me.audit(n),initialPageParam:void 0,getNextPageParam:n=>n.next_cursor??void 0}),t=((_=r.data)==null?void 0:_.pages.flatMap(n=>n.events))??[],c=()=>s.invalidateQueries({queryKey:$.catalogAudit}),i=P({mutationFn:()=>me.acknowledgeAudit(),onSuccess:c}),d=P({mutationFn:n=>me.rollbackEvent(n),onSuccess:c}),o=P({mutationFn:({subject:n,suspended:f})=>Me.suspend(n,f),onSuccess:c});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Us,{}),(d.error||o.error)&&e.jsx("p",{role:"alert",children:(x=d.error||o.error)==null?void 0:x.message}),e.jsxs(g,{children:[e.jsxs(N,{className:"flex-row items-center justify-between",children:[e.jsx(b,{children:"Catalog mutation audit"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[((p=(u=r.data)==null?void 0:u.pages[0])==null?void 0:p.unread_contributor_count)??0," unread contributor changes"]}),e.jsx(y,{variant:"outline",size:"sm",onClick:()=>i.mutate(),disabled:i.isPending,children:"Mark read"})]})]}),e.jsxs(j,{className:"space-y-3",children:[r.isLoading&&e.jsx("p",{children:"Loading audit history…"}),r.error&&e.jsx("p",{className:"text-destructive",children:"Audit history unavailable."}),t.map(n=>e.jsxs("article",{className:`rounded-md border p-3 ${n.operation==="delete"||n.rollback_eligible===!1?"border-red-500 bg-red-50/50":""}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("strong",{children:[n.operation," ",n.entity_type," ",n.entity_id]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",n.actor_username??n.actor_role," ·"," ",new Date(n.created_at).toLocaleString()]})]}),e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Inspect snapshots"}),e.jsx("pre",{className:"mt-2 max-h-80 overflow-auto rounded bg-muted p-3",children:JSON.stringify({before:n.before,after:n.after},null,2)})]}),n.actor_role==="contributor"&&n.actor_hf_subject&&e.jsx(y,{className:"mt-3 mr-2",variant:"outline",size:"sm",disabled:o.isPending,onClick:()=>o.mutate({subject:n.actor_hf_subject,suspended:!n.editing_suspended}),children:n.editing_suspended?"Restore editing access":"Suspend editing access"}),!n.rollback_of_event_id&&e.jsx(y,{className:"mt-3",variant:"outline",size:"sm",onClick:()=>d.mutate(n.id),disabled:d.isPending||n.rollback_eligible===!1,children:n.rollback_eligible===!1?"Rollback conflict":"Roll back if unchanged"})]},n.id)),r.hasNextPage&&e.jsx(y,{variant:"outline",onClick:()=>r.fetchNextPage(),disabled:r.isFetchingNextPage,children:r.isFetchingNextPage?"Loading…":"Load older events"})]})]})]})},Fe={hourly:"running",daily:"healthy",weekly:"degraded",systemd:"running"},Ws=({data:s,loading:r,error:t})=>{const[c,i]=h.useState("staging-current"),d={"staging-current":"Starter staging · $75 warning / $100 trip / no Environment cap","staging-production-era":"Staging with production · $15 / $20 / $25",production:"Production · $175 / $200 / $225"};if(r)return e.jsxs("div",{className:"flex items-center py-12",children:[e.jsx(R,{className:"h-6 w-6 animate-spin mr-3"}),"Loading chat compute…"]});if(t||!s)return e.jsx(g,{className:"cron-status--broken",children:e.jsx(j,{className:"pt-6",children:"Chat compute accounting is unavailable."})});const o=Math.min(100,s.effective_microusd/s.application_cap_microusd*100),_=s.circuit_state==="tripped"?"Chat disabled":s.circuit_state==="warning"?"Operator warning":"Enabled",x=s.reconciliation_state==="fresh"?"Fresh":s.reconciliation_state==="stale"?"Stale":"Unavailable";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid md:grid-cols-4 gap-4",children:[e.jsxs(g,{className:s.circuit_state==="tripped"?"cron-status--broken":s.circuit_state==="warning"?"cron-status--degraded":"",children:[e.jsx(N,{children:e.jsx(b,{className:"text-sm",children:"Circuit"})}),e.jsxs(j,{children:[e.jsx("div",{className:"text-2xl font-bold",children:_}),e.jsx("p",{className:"text-xs cron-muted",children:s.trip_reason??"Policy armed"})]})]}),e.jsxs(g,{children:[e.jsx(N,{children:e.jsx(b,{className:"text-sm",children:"Month to date"})}),e.jsxs(j,{children:[e.jsx("div",{className:"text-2xl font-bold",children:C(s.effective_microusd)}),e.jsx("div",{role:"progressbar","aria-label":"Application cap used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o),className:"h-2 rounded bg-muted mt-3",children:e.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${o}%`}})})]})]}),e.jsxs(g,{children:[e.jsx(N,{children:e.jsx(b,{className:"text-sm",children:"Application headroom"})}),e.jsxs(j,{children:[e.jsx("div",{className:"text-2xl font-bold",children:C(s.remaining_microusd)}),e.jsxs("p",{className:"text-xs cron-muted",children:["Cap ",C(s.application_cap_microusd)]})]})]}),e.jsxs(g,{children:[e.jsx(N,{children:e.jsx(b,{className:"text-sm",children:"Live compute"})}),e.jsxs(j,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.live_count}),e.jsxs("p",{className:"text-xs cron-muted",children:[s.termination_uncertain_count," termination uncertain"]})]})]})]}),e.jsxs(g,{children:[e.jsxs(N,{children:[e.jsx(b,{children:"Accounting and policy"}),e.jsxs(F,{children:[s.environment," · cycle ",s.billing_cycle]})]}),e.jsxs(j,{className:"grid md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Environment record"}),e.jsx("br",{}),s.environment," · ",s.provider_mode==="starter_workspace"?"Starter Workspace":"Team isolated"]}),e.jsxs("label",{children:[e.jsx("strong",{children:"Policy profile"}),e.jsxs("select",{"aria-label":"Chat compute policy profile",value:c,onChange:u=>i(u.target.value),className:"block mt-1",children:[e.jsx("option",{value:"staging-current",children:"Staging now"}),e.jsx("option",{value:"staging-production-era",children:"Staging with production"}),e.jsx("option",{value:"production",children:"Production"})]}),e.jsxs("span",{className:"text-xs cron-muted",children:[d[c]," · Workspace $250"]})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Conservative estimate"}),e.jsx("br",{}),C(s.estimated_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider-reported floor"}),e.jsx("br",{}),C(s.provider_floor_microusd)," · ",e.jsx(I,{children:x})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider backstops"}),e.jsx("br",{}),s.environment_cap_microusd===null?"Starter: no Environment cap":`Environment ${C(s.environment_cap_microusd)}`," · Workspace ",C(s.workspace_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Active thresholds"}),e.jsx("br",{}),"Warning ",C(s.warning_microusd)," · trip ",C(s.application_cap_microusd)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Policy allocation"}),e.jsx("br",{}),"Starter staging $75/$100 with no Environment cap · future Team staging $15/$20/$25 · production $175/$200/$225 · workspace $250"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Cycle end"}),e.jsx("br",{}),v(s.cycle_end_at)]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Last metered"}),e.jsx("br",{}),s.last_metered_at?v(s.last_metered_at):"Unavailable"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Provider reconciliation"}),e.jsx("br",{}),s.last_reconciled_at?v(s.last_reconciled_at):"Unavailable",s.last_reconciliation_attempt_at?` · attempted ${v(s.last_reconciliation_attempt_at)}`:"",s.next_reconciliation_at?` · next ${v(s.next_reconciliation_at)}`:""]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Burn projection"}),e.jsx("br",{}),s.burn_rate_microusd_per_hour===null?"Not enough data":`${C(s.burn_rate_microusd_per_hour)}/hour${s.projected_cap_hit_at?` · cap ${v(s.projected_cap_hit_at)}`:""}`]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Prior cycle"}),e.jsx("br",{}),s.prior_cycle?`${s.prior_cycle.billing_cycle} · ${C(s.prior_cycle.effective_microusd)}`:"Not enough data"]})]})]}),e.jsxs(g,{children:[e.jsx(N,{children:e.jsx(b,{children:"Live lifecycle"})}),e.jsx(j,{className:"text-sm",children:Object.entries(s.live_states).map(([u,p])=>e.jsxs("span",{className:"mr-4",children:[u,": ",p]},u))})]}),e.jsxs(g,{children:[e.jsx(N,{children:e.jsx(b,{children:"Daily spend"})}),e.jsx(j,{children:s.daily_spend.length?e.jsx("ul",{className:"space-y-1 text-sm",children:s.daily_spend.map(u=>e.jsxs("li",{children:[u.date,": blank ",C(u.blank_pool_microusd)," · assigned ",C(u.assigned_microusd)]},u.date))}):e.jsx("p",{className:"cron-muted",children:"No compute recorded in this cycle."})})]}),e.jsxs(g,{children:[e.jsxs(N,{children:[e.jsx(b,{children:"Recent circuit events"}),e.jsx(F,{children:"Runbook: docs/chat-sandbox-spend-runbook.md"})]}),e.jsx(j,{children:s.events.length?e.jsx("ul",{className:"space-y-2 text-sm",children:s.events.map(u=>e.jsxs("li",{children:[e.jsx(I,{children:u.severity})," ",u.type," · ",v(u.created_at)]},u.id))}):e.jsx("p",{className:"cron-muted",children:"No events in this cycle."})})]})]})},zs=({data:s,loading:r,error:t})=>{if(r)return e.jsxs("div",{className:"flex items-center py-8",children:[e.jsx(R,{className:"h-5 w-5 animate-spin mr-3"}),"Loading web-search budget…"]});if(t||!s)return e.jsx(g,{className:"cron-status--broken",children:e.jsx(j,{className:"pt-6",children:"Web-search budget accounting is unavailable."})});const c=Math.min(100,s.call_count/s.hard_limit_calls*100);return e.jsxs(g,{className:s.circuit_state==="tripped"?"cron-status--broken":s.circuit_state==="warning"||s.circuit_state==="cooldown"?"cron-status--degraded":"",children:[e.jsxs(N,{children:[e.jsx(b,{children:"Web search"}),e.jsxs(F,{children:[s.environment," · UTC cycle ",s.billing_cycle," · provider details are admin-only"]})]}),e.jsxs(j,{className:"space-y-4",children:[e.jsxs("div",{className:"grid md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Circuit"}),e.jsx("br",{}),s.circuit_state,s.trip_reason?` · ${s.trip_reason}`:""]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Calls"}),e.jsx("br",{}),s.call_count," / ",s.hard_limit_calls," · ",s.success_count," successful"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Remaining"}),e.jsx("br",{}),s.remaining_calls]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Warning"}),e.jsx("br",{}),s.warning_calls," calls"]})]}),e.jsx("div",{role:"progressbar","aria-label":"Web-search monthly budget used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(c),className:"h-2 rounded bg-muted",children:e.jsx("div",{className:"h-2 rounded bg-primary",style:{width:`${c}%`}})}),e.jsxs("p",{className:"text-xs cron-muted",children:["Cycle ends ",v(s.cycle_end_at)," · provider-reported cost $",(s.provider_cost_microusd/1e6).toFixed(4),s.last_latency_ms!==null?` · last ${s.last_latency_ms} ms / ${s.last_result_count??0} results`:"",s.cooldown_until?` · cooldown until ${v(s.cooldown_until)}`:"",s.last_provider_error_class?` · last provider error ${s.last_provider_error_class}`:""]}),s.events.length>0&&e.jsx("ul",{className:"space-y-1 text-sm",children:s.events.map(i=>e.jsxs("li",{children:[i.type," · ",v(i.created_at),i.error_class?` · ${i.error_class}`:""]},i.id))})]})]})},Ks=({data:s})=>s!=null&&s.snapshot_stale?e.jsx(g,{className:"mb-6 cron-status--degraded",role:"status",children:e.jsx(j,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"}),e.jsxs("span",{children:["Refreshing status… Current snapshot is ",Math.ceil(s.snapshot_age_seconds)," seconds old."]})]})})}):null,Gs=(s,r)=>s!=null&&s.snapshot_stale||s!=null&&s.refreshing?5e3:r?3e4:!1,pa=()=>{const s=xs(),r=xe(),[t,c]=h.useState(!0),[i,d]=h.useState(""),[o,_]=h.useState(""),[x,u]=h.useState(new Set),{user:p}=hs(),{data:n,isLoading:f,error:k}=G({queryKey:$.cronStatus,queryFn:()=>ue.getCronStatus(),refetchInterval:a=>Gs(a.state.data,t),retry:!1}),J=G({queryKey:$.chatSandboxSpend(o),queryFn:()=>ye.getSandboxSpend(o||void 0),refetchInterval:t?3e4:!1,retry:!1}),m=G({queryKey:$.chatWebSearchBudget,queryFn:()=>ye.getWebSearchBudget(),enabled:s,refetchInterval:t?3e4:!1,retry:!1}),Q=P({mutationFn:()=>Promise.all([r.cancelQueries({queryKey:$.cronStatus}).then(()=>r.fetchQuery({queryKey:$.cronStatus,queryFn:()=>ue.getCronStatus(!0),retry:!1})),r.refetchQueries({queryKey:$.all,type:"active",predicate:a=>a.queryKey[1]!==$.cronStatus[1]})])}),ee=k instanceof Re&&k.status===401?"Unauthorized. Sign in with an allowlisted Hugging Face admin account.":k instanceof Error?k.message:void 0,B=a=>{u(l=>{const w=new Set(l);return w.has(a)?w.delete(a):w.add(a),w})},T=(n==null?void 0:n.jobs.filter(a=>a.dashboard_group==="leaderboard_sync"))??[],se=(n==null?void 0:n.jobs.filter(a=>a.category!=="manual"&&a.dashboard_group!=="leaderboard_sync"))??[],le=se.filter(a=>a.critical),de=se.filter(a=>!a.critical),V=(n==null?void 0:n.manual_operations)??[],q=!!(f||Q.isPending||n!=null&&n.refreshing),E=de.reduce((a,l)=>(a[l.category]||(a[l.category]=[]),a[l.category].push(l),a),{}),ae=Object.keys(E).sort((a,l)=>{const w=["systemd","hourly","daily","weekly","backfill"];return w.indexOf(a)-w.indexOf(l)}),D=a=>e.jsx(Ms,{job:a,expanded:x.has(a.job_name),onToggle:()=>B(a.job_name),autoRefresh:t},a.job_name);return e.jsx("div",{className:"cron-dashboard","data-shadcn":!0,children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[e.jsx(ne,{className:"h-8 w-8 cron-info-text"}),"Admin Dashboard"]}),e.jsx("p",{className:"mt-2 cron-muted",children:"Paper curation queue and operational health for scheduled jobs"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(y,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(pe,{to:"/autonomous-operations",children:"Autonomous operations"})}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>c(!t),className:t?"cron-status--running":"",children:[e.jsx(be,{className:`h-4 w-4 mr-2 ${t?"animate-spin":""}`}),"Auto-refresh ",t?"ON":"OFF"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>Q.mutate(),disabled:q,children:[e.jsx(be,{className:`h-4 w-4 mr-2 ${q?"animate-spin":""}`}),"Refresh"]})]})]})}),e.jsx(g,{className:"mb-6",children:e.jsx(j,{className:"pt-6",children:e.jsxs("p",{className:"text-sm cron-muted",children:["Signed in as ",e.jsxs("span",{className:"font-semibold",children:["@",p==null?void 0:p.username]}),". Health checks prefer database freshness over log completion so silent no-work failures surface as degraded or broken. Expanded jobs include deterministic scheduler, log, lock, durable-data, throughput, backlog, and semantic contract evidence with direct operator and run links."]})})}),e.jsx(Ks,{data:n}),e.jsxs(Ls,{defaultValue:"critical-jobs",children:[e.jsxs(Xe,{className:"grid h-auto w-full grid-cols-2 sm:w-auto sm:grid-cols-5",children:[e.jsx(H,{value:"critical-jobs",children:"Critical Jobs"}),e.jsx(H,{value:"leaderboard-syncs",children:"Leaderboard Syncs"}),e.jsx(H,{value:"codex-paper-jobs",children:"Codex Paper Jobs"}),e.jsx(H,{value:"catalog-audit",children:"Catalog Audit"}),e.jsx(H,{value:"chat-compute",children:"Chat Compute"})]}),e.jsxs(W,{value:"critical-jobs",className:"mt-6",children:[f&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(R,{className:"h-8 w-8 animate-spin cron-info-text"}),e.jsx("span",{className:"ml-3 cron-muted",children:"Loading CRON jobs status..."})]}),k&&e.jsx(g,{className:"cron-status--broken",children:e.jsx(j,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Z,{className:"h-5 w-5"}),e.jsx("p",{children:ee??"Failed to load CRON jobs status. Please try again."})]})})}),n&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6",children:["healthy","degraded","broken","running","stuck","unknown"].map(a=>e.jsxs(g,{children:[e.jsx(N,{className:"pb-2",children:e.jsx(b,{className:"text-sm font-medium cron-muted capitalize",children:a})}),e.jsx(j,{children:e.jsx("div",{className:"text-2xl font-bold",children:n.summary[a]})})]},a))}),n.summary.critical_issues.length>0&&e.jsxs(g,{className:"mb-6 cron-status--broken",children:[e.jsx(N,{children:e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(Te,{className:"h-5 w-5"}),"Critical job issues"]})}),e.jsx(j,{children:e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm",children:n.summary.critical_issues.map(a=>e.jsx("li",{children:a},a))})})]}),e.jsxs(g,{className:"mb-8",children:[e.jsx(N,{children:e.jsx(b,{className:"text-base",children:"What to check next"})}),e.jsxs(j,{children:[e.jsx("p",{className:"text-sm cron-muted",children:n.summary.what_to_check_next}),e.jsxs("p",{className:"mt-2 text-xs cron-muted flex items-center gap-2",children:[e.jsx(qe,{className:"h-4 w-4"}),"Last updated: ",v(n.timestamp)," · Health score:"," ",n.summary.health_score.toFixed(0),"%"]})]})]}),e.jsxs(g,{className:`mb-8 ${n.summary.coverage.coverage_gaps?"cron-status--broken":""}`,children:[e.jsxs(N,{children:[e.jsx(b,{className:"text-base",children:"Coverage"}),e.jsx(F,{children:"Registry and deployed scheduler inventory"})]}),e.jsxs(j,{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Registered"}),e.jsx("div",{className:"text-2xl font-bold",children:n.summary.coverage.registered_scheduled_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Discovered"}),e.jsx("div",{className:"text-2xl font-bold",children:n.summary.coverage.discovered_scheduled_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Monitored"}),e.jsx("div",{className:"text-2xl font-bold",children:n.summary.coverage.monitored_duties})]}),e.jsxs("div",{children:[e.jsx("span",{className:"cron-label",children:"Gaps"}),e.jsx("div",{className:"text-2xl font-bold",children:n.summary.coverage.coverage_gaps})]})]})]}),e.jsxs(g,{className:"mb-8",children:[e.jsxs(N,{children:[e.jsx(b,{className:"text-xl",children:"Critical jobs"}),e.jsx(F,{children:"Writers whose stale output breaks the live site"})]}),e.jsx(j,{className:"space-y-4",children:le.map(D)})]}),e.jsx("div",{className:"space-y-6",children:ae.map(a=>e.jsxs(g,{children:[e.jsx(N,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(b,{className:"text-xl capitalize flex items-center gap-2",children:[e.jsx(I,{className:ge(Fe[a]??Fe.hourly),children:a}),e.jsx("span",{children:"Supporting jobs"})]}),e.jsxs(F,{children:[E[a].length," job",E[a].length!==1?"s":""]})]})}),e.jsx(j,{className:"space-y-4",children:E[a].map(D)})]},a))}),V.length>0&&e.jsxs(g,{className:"mt-6",children:[e.jsxs(N,{children:[e.jsx(b,{className:"text-xl",children:"Manual operations"}),e.jsx(F,{children:"Visible invocation history; excluded from scheduled health and coverage"})]}),e.jsx(j,{className:"space-y-4",children:V.map(D)})]})]})]}),e.jsxs(W,{value:"leaderboard-syncs",className:"mt-6",children:[f&&e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(R,{className:"h-8 w-8 animate-spin cron-info-text"}),e.jsx("span",{className:"ml-3 cron-muted",children:"Loading leaderboard sync status..."})]}),k&&e.jsx(g,{className:"cron-status--broken",children:e.jsx(j,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Z,{className:"h-5 w-5"}),e.jsx("p",{children:ee??"Failed to load leaderboard sync status. Please try again."})]})})}),n&&e.jsxs(g,{children:[e.jsx(N,{children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(b,{className:"text-xl",children:"Leaderboard syncs"}),e.jsx(F,{children:"Recurring imports from externally maintained benchmark leaderboards"})]}),e.jsxs(I,{children:[T.length," jobs"]})]})}),e.jsx(j,{className:"space-y-4",children:T.map(D)})]})]}),e.jsx(W,{value:"codex-paper-jobs",className:"mt-6",children:e.jsx(Bs,{autoRefresh:t})}),e.jsx(W,{value:"catalog-audit",className:"mt-6",children:e.jsx(Hs,{})}),e.jsxs(W,{value:"chat-compute",className:"mt-6",children:[e.jsxs(g,{className:"mb-6",children:[e.jsxs(N,{children:[e.jsx(b,{children:"Environment record"}),e.jsx(F,{children:"Leave blank for live staging, or enter the isolated environment printed by the spend qualification command."})]}),e.jsxs(j,{className:"flex gap-2",children:[e.jsx("input",{"aria-label":"Chat compute environment record",value:i,onChange:a=>d(a.target.value),placeholder:"staging-q-example",className:"flex-1 rounded border px-3 py-2"}),e.jsx(y,{onClick:()=>_(i.trim()),children:"Load"})]})]}),e.jsx(Ws,{data:J.data,loading:J.isLoading,error:J.error}),s&&e.jsx("div",{className:"mt-6",children:e.jsx(zs,{data:m.data,loading:m.isLoading,error:m.error})})]})]})]})})};export{Ws as ChatComputePanel,Ks as CronSnapshotNotice,Gs as cronStatusRefetchInterval,pa as default}; diff --git a/assets/CronDashboard-B3Xofwvu.js b/assets/CronDashboard-qYV75PLc.js similarity index 74% rename from assets/CronDashboard-B3Xofwvu.js rename to assets/CronDashboard-qYV75PLc.js index 16b19497670c57706b9e026e9ae43beaa5adfcf9..e0f6c9d268dae7a7d6cf7b6df61eb6d9535f71ea 100644 --- a/assets/CronDashboard-B3Xofwvu.js +++ b/assets/CronDashboard-qYV75PLc.js @@ -1,6 +1,6 @@ -import{n as c,r,j as a,B as n,a6 as u}from"./index-CbgxfyGU.js";/** +import{s as c,d as a,j as r,G as n,ac as u}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const N=c("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),f=r.forwardRef(({className:o,...e},t)=>a.jsx("div",{ref:t,className:n("rounded-lg border bg-card text-card-foreground shadow-sm",o),...e}));f.displayName="Card";const m=r.forwardRef(({className:o,...e},t)=>a.jsx("div",{ref:t,className:n("flex flex-col space-y-1.5 p-6",o),...e}));m.displayName="CardHeader";const p=r.forwardRef(({className:o,...e},t)=>a.jsx("h3",{ref:t,className:n("text-2xl font-semibold leading-none tracking-tight",o),...e}));p.displayName="CardTitle";const l=r.forwardRef(({className:o,...e},t)=>a.jsx("p",{ref:t,className:n("text-sm text-muted-foreground",o),...e}));l.displayName="CardDescription";const h=r.forwardRef(({className:o,...e},t)=>a.jsx("div",{ref:t,className:n("p-6 pt-0",o),...e}));h.displayName="CardContent";const C=r.forwardRef(({className:o,...e},t)=>a.jsx("div",{ref:t,className:n("flex items-center p-6 pt-0",o),...e}));C.displayName="CardFooter";const b=o=>`cron-status--${o}`,x=o=>`$${o.toFixed(2)}`,w=o=>x(o/1e6);function M(o){if(!o)return"Never";const e=new Date(o);if(Number.isNaN(e.getTime()))return o;const t=Date.now()-e.getTime(),s=Math.floor(t/6e4),i=Math.floor(t/36e5),d=Math.floor(t/864e5);return s<1?"Just now":s<60?`${s}m ago`:i<24?`${i}h ago`:d<7?`${d}d ago`:e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}class g{constructor(e){this.request=e}getCronStatus(e=!1){const t=e?"?force_refresh=true":"";return this.request(`/cron/status${t}`,{cache:"no-store"})}getPaperMarkdownJobs(){return this.request("/cron/paper-markdown-jobs",{cache:"no-store"})}getAutonomousOperations(){return this.request("/admin/autonomous-operations",{cache:"no-store"})}setAutonomousManualMode(e,t,s){return this.request("/admin/autonomous-operations/manual-mode",{method:"PATCH",body:JSON.stringify({enabled:e,expected_revision:t,confirmation:s})})}setAutonomousOperator(e,t,s,i){return this.request(`/admin/autonomous-operations/operators/${e}`,{method:"PATCH",body:JSON.stringify({enabled:t,expected_revision:s,confirmation:i})})}qualifyAutonomousChatBaseline(e,t,s){return this.request("/admin/autonomous-operations/chat-baseline",{method:"POST",body:JSON.stringify({sha:e,expected_revision:t,confirmation:s})})}}const q=new g(u);export{f as C,N as S,x as a,m as b,p as c,l as d,h as e,M as f,w as g,q as o,b as t}; + */const N=c("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),f=a.forwardRef(({className:o,...e},t)=>r.jsx("div",{ref:t,className:n("rounded-lg border bg-card text-card-foreground shadow-sm",o),...e}));f.displayName="Card";const m=a.forwardRef(({className:o,...e},t)=>r.jsx("div",{ref:t,className:n("flex flex-col space-y-1.5 p-6",o),...e}));m.displayName="CardHeader";const p=a.forwardRef(({className:o,...e},t)=>r.jsx("h3",{ref:t,className:n("text-2xl font-semibold leading-none tracking-tight",o),...e}));p.displayName="CardTitle";const l=a.forwardRef(({className:o,...e},t)=>r.jsx("p",{ref:t,className:n("text-sm text-muted-foreground",o),...e}));l.displayName="CardDescription";const h=a.forwardRef(({className:o,...e},t)=>r.jsx("div",{ref:t,className:n("p-6 pt-0",o),...e}));h.displayName="CardContent";const C=a.forwardRef(({className:o,...e},t)=>r.jsx("div",{ref:t,className:n("flex items-center p-6 pt-0",o),...e}));C.displayName="CardFooter";const b=o=>`cron-status--${o}`,x=o=>`$${o.toFixed(2)}`,w=o=>x(o/1e6);function M(o){if(!o)return"Never";const e=new Date(o);if(Number.isNaN(e.getTime()))return o;const t=Date.now()-e.getTime(),s=Math.floor(t/6e4),i=Math.floor(t/36e5),d=Math.floor(t/864e5);return s<1?"Just now":s<60?`${s}m ago`:i<24?`${i}h ago`:d<7?`${d}d ago`:e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}class g{constructor(e){this.request=e}getCronStatus(e=!1){const t=e?"?force_refresh=true":"";return this.request(`/cron/status${t}`,{cache:"no-store"})}getPaperMarkdownJobs(){return this.request("/cron/paper-markdown-jobs",{cache:"no-store"})}getAutonomousOperations(){return this.request("/admin/autonomous-operations",{cache:"no-store"})}setAutonomousManualMode(e,t,s){return this.request("/admin/autonomous-operations/manual-mode",{method:"PATCH",body:JSON.stringify({enabled:e,expected_revision:t,confirmation:s})})}setAutonomousOperator(e,t,s,i){return this.request(`/admin/autonomous-operations/operators/${e}`,{method:"PATCH",body:JSON.stringify({enabled:t,expected_revision:s,confirmation:i})})}qualifyAutonomousChatBaseline(e,t,s){return this.request("/admin/autonomous-operations/chat-baseline",{method:"POST",body:JSON.stringify({sha:e,expected_revision:t,confirmation:s})})}}const q=new g(u);export{f as C,N as S,x as a,m as b,p as c,l as d,h as e,M as f,w as g,q as o,b as t}; diff --git a/assets/ExternalSourceEvalBadge-npO6bZ8N.js b/assets/ExternalSourceEvalBadge-K3r45EmO.js similarity index 94% rename from assets/ExternalSourceEvalBadge-npO6bZ8N.js rename to assets/ExternalSourceEvalBadge-K3r45EmO.js index efffe319411c80208a7d56027279e25fc5d4b0f2..c88a555b62e6e4ed2fe2d8cf1acf9c8b34c74e5d 100644 --- a/assets/ExternalSourceEvalBadge-npO6bZ8N.js +++ b/assets/ExternalSourceEvalBadge-K3r45EmO.js @@ -1 +1 @@ -import{p as o}from"./curation-C7Gmmp4z.js";import{a6 as g,j as a,L as l}from"./index-CbgxfyGU.js";import{H as u,a as c,b as d}from"./hover-card-ufez2uMo.js";import{s as m}from"./safeExternalHref-CkBrsh84.js";class b{constructor(e){this.request=e}list(e={}){const t=new URLSearchParams(Object.entries(e).filter(r=>r[1]!==void 0).map(([r,n])=>[r,String(n)])).toString();return this.request(`/evaluations/${t?`?${t}`:""}`,{cache:"no-store"})}get(e){return this.request(`/evaluations/${e}`)}async byPaper(e){return this.allPages({paper_id:Number(e),ordering:"-benchmark_popularity"})}async byDataset(e,t){return this.allPages({dataset_id:Number(e),best_metric:t,ordering:"best_rank"})}async byLeaderboard(e,t,r={}){return this.allPages({dataset_id:Number(e),task_id:Number(t),ordering:"best_rank",...r})}create(e){return this.request("/evaluations/",{method:"POST",body:JSON.stringify(e)})}update(e,t){return this.request(`/evaluations/${e}`,{method:"PUT",body:JSON.stringify(t)})}delete(e){return this.request(`/evaluations/${e}`,{method:"DELETE"})}primeCurationState(e,t=!1){return o.primeEvaluations(e,t)}batch(e,t){return o.mutateEvaluations(e,t,"/evaluations/batch",{method:"POST",body:JSON.stringify({paper_id:e,operations:t})})}async allPages(e){const r=await this.list({...e,page_size:100});if(!r.next_page)return r.results;const n=Math.ceil(r.count/100),p=await Promise.all(Array.from({length:n-1},(i,h)=>this.list({...e,page:h+2,page_size:100})));return[r,...p].flatMap(i=>i.results)}}const w=new b(g),j=()=>a.jsxs(u,{openDelay:120,closeDelay:120,children:[a.jsx(c,{asChild:!0,children:a.jsx("button",{type:"button",className:"bm-closed-source-tag","aria-label":"Closed-source model",children:"closed"})}),a.jsxs(d,{side:"top",align:"start",className:"w-auto max-w-[260px] p-3 text-sm leading-snug",children:["This is an evaluation of a closed-source model. You can disable viewing these in your"," ",a.jsx(l,{to:"/settings",className:"closed-eval-tooltip-link",children:"settings"}),"."]})]});function x(s){if(!s)return"Evaluation sourced outside this paper";const e=s.toLowerCase();if(e.includes("open-asr-leaderboard"))return"Open ASR Leaderboard";if(e.includes("arcprize.org"))return"ARC Prize Leaderboard";if(e.includes("frontierswe.com"))return"FrontierSWE";if(e.includes("deepswe.datacurve.ai"))return"DeepSWE";try{const t=new URL(s,"https://paperswithcode.co");return t.pathname.startsWith("/paper/")?"Source paper":t.hostname.replace(/^www\./,"")}catch{return s}}const E=({sourceUrl:s})=>{const e=m(s),t=typeof s=="string"&&s.startsWith("/paper/")?s:null,r=x(s);return a.jsxs(u,{openDelay:120,closeDelay:120,children:[a.jsx(c,{asChild:!0,children:a.jsx("button",{type:"button",className:"bm-external-source-tag","aria-label":`Externally sourced evaluation: ${r}`,children:"External"})}),a.jsxs(d,{side:"top",align:"start",className:"w-auto max-w-[280px] p-3 text-sm leading-snug",children:["This score was sourced outside this paper.",t?a.jsxs(a.Fragment,{children:[" ",a.jsx(l,{to:t,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:r}),"."]}):e?a.jsxs(a.Fragment,{children:[" ",a.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:r}),"."]}):a.jsxs(a.Fragment,{children:[" ",r,"."]})]})]})};export{j as C,E,w as e}; +import{p as o}from"./curation-YeS7FBYf.js";import{ac as g,j as a,L as l}from"./index-DyXq7-Tg.js";import{H as u,a as c,b as d}from"./hover-card-B45EJIn_.js";import{s as m}from"./safeExternalHref-CkBrsh84.js";class b{constructor(e){this.request=e}list(e={}){const t=new URLSearchParams(Object.entries(e).filter(r=>r[1]!==void 0).map(([r,n])=>[r,String(n)])).toString();return this.request(`/evaluations/${t?`?${t}`:""}`,{cache:"no-store"})}get(e){return this.request(`/evaluations/${e}`)}async byPaper(e){return this.allPages({paper_id:Number(e),ordering:"-benchmark_popularity"})}async byDataset(e,t){return this.allPages({dataset_id:Number(e),best_metric:t,ordering:"best_rank"})}async byLeaderboard(e,t,r={}){return this.allPages({dataset_id:Number(e),task_id:Number(t),ordering:"best_rank",...r})}create(e){return this.request("/evaluations/",{method:"POST",body:JSON.stringify(e)})}update(e,t){return this.request(`/evaluations/${e}`,{method:"PUT",body:JSON.stringify(t)})}delete(e){return this.request(`/evaluations/${e}`,{method:"DELETE"})}primeCurationState(e,t=!1){return o.primeEvaluations(e,t)}batch(e,t){return o.mutateEvaluations(e,t,"/evaluations/batch",{method:"POST",body:JSON.stringify({paper_id:e,operations:t})})}async allPages(e){const r=await this.list({...e,page_size:100});if(!r.next_page)return r.results;const n=Math.ceil(r.count/100),p=await Promise.all(Array.from({length:n-1},(i,h)=>this.list({...e,page:h+2,page_size:100})));return[r,...p].flatMap(i=>i.results)}}const w=new b(g),j=()=>a.jsxs(u,{openDelay:120,closeDelay:120,children:[a.jsx(c,{asChild:!0,children:a.jsx("button",{type:"button",className:"bm-closed-source-tag","aria-label":"Closed-source model",children:"closed"})}),a.jsxs(d,{side:"top",align:"start",className:"w-auto max-w-[260px] p-3 text-sm leading-snug",children:["This is an evaluation of a closed-source model. You can disable viewing these in your"," ",a.jsx(l,{to:"/settings",className:"closed-eval-tooltip-link",children:"settings"}),"."]})]});function x(s){if(!s)return"Evaluation sourced outside this paper";const e=s.toLowerCase();if(e.includes("open-asr-leaderboard"))return"Open ASR Leaderboard";if(e.includes("arcprize.org"))return"ARC Prize Leaderboard";if(e.includes("frontierswe.com"))return"FrontierSWE";if(e.includes("deepswe.datacurve.ai"))return"DeepSWE";try{const t=new URL(s,"https://paperswithcode.co");return t.pathname.startsWith("/paper/")?"Source paper":t.hostname.replace(/^www\./,"")}catch{return s}}const E=({sourceUrl:s})=>{const e=m(s),t=typeof s=="string"&&s.startsWith("/paper/")?s:null,r=x(s);return a.jsxs(u,{openDelay:120,closeDelay:120,children:[a.jsx(c,{asChild:!0,children:a.jsx("button",{type:"button",className:"bm-external-source-tag","aria-label":`Externally sourced evaluation: ${r}`,children:"External"})}),a.jsxs(d,{side:"top",align:"start",className:"w-auto max-w-[280px] p-3 text-sm leading-snug",children:["This score was sourced outside this paper.",t?a.jsxs(a.Fragment,{children:[" ",a.jsx(l,{to:t,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:r}),"."]}):e?a.jsxs(a.Fragment,{children:[" ",a.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"external-eval-tooltip-link",children:r}),"."]}):a.jsxs(a.Fragment,{children:[" ",r,"."]})]})]})};export{j as C,E,w as e}; diff --git a/assets/FeedView-BR2dQQ-K.js b/assets/FeedView-BR2dQQ-K.js deleted file mode 100644 index 701a3955cfa934f16c365679e7a2edf3fda02d98..0000000000000000000000000000000000000000 --- a/assets/FeedView-BR2dQQ-K.js +++ /dev/null @@ -1 +0,0 @@ -import{j as e,L as E,a as Se,b as Te,r as h,h as _e,C as Pe,c as be,d as Ce,e as Fe,f as Ee,i as Le,g as ne,k as ye,l as Ae}from"./index-CbgxfyGU.js";import{S as De}from"./sparkles-BqBXJPmy.js";import{u as R}from"./useQuery-Bx9s5-D2.js";import{D as Re,a as qe,b as Me}from"./dialog-Cfp_d3CC.js";import{c as ee}from"./catalog-DhK7_9-6.js";import{T as pe,r as B}from"./research-DgpyzSy_.js";import{d as ie,t as Ie}from"./transform-0Udg2p6b.js";import{u as je,a as ve,s as Oe,b as He,r as he,c as me,d as $e}from"./researchTopic-CteUev4M.js";import{P as ze}from"./plus-UK0TEjgd.js";import{A as Ke}from"./arrow-right-DotD9yNb.js";import{r as Be,P as Ue,w as Ge,a as Qe}from"./PaperFeed-DMvUfA47.js";import{M as We}from"./McpShowcase-CMLfdJM2.js";import{u as Xe,a as Ye,P as Ze,i as Ve,A as Je,b as es,S as $,c as ss,D as se,q as ts,d as as}from"./chatSessions-DwLUbLRo.js";import{c as os}from"./chat-DzTo2WUO.js";import{u as ns}from"./usePapers-CJaWLZ3y.js";import{p as J,a as ge}from"./paperQueryKeys-B8u1BWlI.js";import{S as te}from"./skeleton-HwvdxvSN.js";import{A as ae,a as oe}from"./alert-CFDDvdIM.js";import"./useMutation-P_trTy9i.js";import"./PaperCard-tdTC_dRN.js";import"./AuthorAvatar-CUJMmp_z.js";import"./SotaBadges-C-sTR-EF.js";import"./colors-BkWRhvFI.js";import"./Icon-D-kA0Owz.js";import"./LatexTitle-Z-HGmZ-H.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-DKJYnYjk.js";import"./useIntersectionObserver-CID9Kkak.js";import"./AgentLogos-BBl9UNVD.js";import"./useInfiniteQuery-BAc_4HO5.js";import"./curation-C7Gmmp4z.js";function is({onBuild:r}){return e.jsxs("section",{className:"following-intro","aria-labelledby":"following-intro-title",children:[e.jsx("h2",{id:"following-intro-title",children:"Build your personal research feed"}),e.jsx("p",{className:"following-intro-lead",children:"Describe a topic in your own words, or follow the tasks, benchmarks, authors, and organizations you care about, and this page collects their latest papers and results in one place."}),r&&e.jsxs("button",{type:"button",className:"research-topic-save following-intro-topic",onClick:r,children:[e.jsx(De,{"aria-hidden":"true"}),"Build your feed"]}),e.jsxs("p",{className:"following-intro-note",children:["Matching papers also arrive as a weekly email, which you can turn off in"," ",e.jsx(E,{to:"/settings",children:"Settings"}),"."]})]})}const fe=16;function rs({open:r,onOpenChange:a}){return e.jsx(Re,{open:r,onOpenChange:a,children:e.jsx(qe,{className:"topic-dialog","aria-describedby":void 0,children:e.jsx(ls,{onDone:()=>a(!1)})})})}function ls({onDone:r}){var W,X,Y,Z,H,z,U;const{user:a}=Se(),m=Te(),l=R({queryKey:["research-topic",a==null?void 0:a.hf_subject],queryFn:B.topic,enabled:!!a}),s=R({queryKey:["research-follows",a==null?void 0:a.hf_subject],queryFn:B.follows,enabled:!!a}),w=R({queryKey:["trending-tasks-follow"],queryFn:()=>ee.trendingTasks({limit:fe,level:0}),staleTime:10*60*1e3}),y=R({queryKey:["trending-methods-follow"],queryFn:()=>ee.trendingMethods({limit:fe}),staleTime:10*60*1e3}),c=R({queryKey:["research-follow-suggestions"],queryFn:B.followSuggestions,staleTime:10*60*1e3}),j=(i=[])=>i.map(p=>({id:String(p.entity_id),name:p.name,image:p.image_url})),[k,L]=h.useState(null),[_,v]=h.useState([]),P=je(),M=ve(),b=((W=l.data)==null?void 0:W.text)??"",n=k??b,d=n.trim().replace(/\s+/g," "),C=((X=l.data)==null?void 0:X.status)==="failed"&&d===b,A=d.length>=3&&(d!==b||C),D=P.isPending||M.isPending,o=(i,p)=>{var N;return((N=s.data)==null?void 0:N.some(S=>S.kind===i&&String(S.entity_id)===p))??!1},g=(i,p)=>{var N;return((N=_.find(S=>S.kind===i&&S.id===p))==null?void 0:N.follow)??o(i,p)},f=_.filter(i=>i.follow!==o(i.kind,i.id)),F=!D&&(A||f.length>0),q=(i,p,N)=>v(S=>[...S.filter(G=>G.kind!==i||G.id!==p),{kind:i,id:p,name:N,follow:!g(i,p)}]),I=()=>{if(!F)return;if(!a){A&&Oe(d),f.length&&He(f),window.location.href=_e(`${m.pathname}${m.search}`);return}const i=[...f.length?[M.mutateAsync(f)]:[],...A?[P.mutateAsync(d)]:[]];Promise.allSettled(i).then(p=>{p.every(N=>N.status==="fulfilled")&&r()})},O=(i,p,N,S)=>{const V=[...(s.data??[]).filter(x=>x.kind===p).map(x=>({id:String(x.entity_id),name:x.name,slug:x.url.split("/").pop(),image:x.image_url})),...N.filter(x=>!o(p,x.id)).map(x=>({...x,suggested:!0}))];return V.length>0&&e.jsxs("div",{className:"topic-dialog-group",children:[e.jsx("h3",{children:i}),e.jsxs(cs,{children:[V.map(x=>{const Q=g(p,x.id),K=p==="task"?ie(x.name,x.slug??void 0):x.name;return e.jsxs("button",{type:"button",className:"topic-dialog-chip","aria-pressed":Q,disabled:D,"data-suggested":"suggested"in x||void 0,onClick:()=>q(p,x.id,K),children:[Q?e.jsx(Pe,{"aria-hidden":"true"}):e.jsx(ze,{"aria-hidden":"true"}),(p==="author"||p==="organization")&&e.jsx(ds,{kind:p,name:K,src:x.image}),K]},x.id)}),S&&e.jsxs(E,{to:S.to,className:"topic-dialog-browse",children:[S.label,e.jsx(Ke,{"aria-hidden":"true"})]})]})]})};return e.jsxs("form",{className:"topic-dialog-form",onSubmit:i=>{i.preventDefault(),I()},children:[e.jsx(Me,{className:"topic-dialog-title",children:b||(Y=s.data)!=null&&Y.length?"Edit your research feed":"Build your research feed"}),e.jsxs("div",{className:"topic-dialog-group",children:[e.jsx("h3",{children:e.jsx("label",{htmlFor:"topic-dialog-input",children:"Describe a topic in your own words"})}),e.jsx("p",{className:"topic-dialog-hint",children:"A model reads every new paper and adds the ones that match to your Following feed."}),e.jsx("textarea",{id:"topic-dialog-input",className:"research-topic-input",rows:4,maxLength:pe,"aria-label":"Research topic",placeholder:"e.g. diffusion policies for robot manipulation, or speculative decoding for LLM inference",value:n,onChange:i=>L(i.target.value),onKeyDown:i=>{i.key==="Enter"&&!i.shiftKey&&!i.nativeEvent.isComposing&&(i.preventDefault(),I())}}),e.jsxs("span",{className:"research-topic-count",children:[n.length,"/",pe]})]}),O("Trending tasks","task",((Z=w.data)==null?void 0:Z.results)??[],{to:"/tasks",label:"Browse tasks"}),O("Trending methods","method",((H=y.data)==null?void 0:H.results)??[],{to:"/methods",label:"Browse methods"}),O("Benchmarks","benchmark",[],{to:"/tasks",label:"Browse benchmarks"}),O("Popular authors","author",j((z=c.data)==null?void 0:z.authors)),O("Popular organizations","organization",j((U=c.data)==null?void 0:U.organizations),{to:"/organizations",label:"Browse organizations"}),(P.error||M.error)&&e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not save your feed. Please try again."}),e.jsxs("div",{className:"topic-dialog-actions",children:[b&&e.jsx("button",{type:"button",className:"research-follow-action topic-dialog-remove",disabled:D,onClick:()=>P.mutate(null,{onSuccess:r}),children:"Remove topic"}),e.jsx("button",{type:"button",className:"research-follow-action",disabled:D,onClick:r,children:"Cancel"}),e.jsx("button",{type:"submit",className:"research-topic-save",disabled:!F,children:f.some(i=>i.follow===!1)?"Save":f.length?"Follow":C?"Retry":b?"Update topic":"Follow"})]})]})}function cs({children:r}){const a=h.useRef(null);return h.useLayoutEffect(()=>{const m=a.current;if(!m)return;const l=()=>{const s=[...m.children],w=s.filter(c=>c.dataset.suggested);w.forEach(c=>{c.hidden=!1});const y=()=>new Set(s.filter(c=>!c.hidden).map(c=>c.offsetTop)).size;for(let c=w.length-1;c>=0&&y()>2;c--)w[c].hidden=!0};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}),e.jsx("div",{ref:a,className:"topic-dialog-chips",children:r})}function ds({kind:r,name:a,src:m}){const[l,s]=h.useState(!1);if(m&&!l)return e.jsx("img",{className:`topic-dialog-chip-image is-${r}`,src:m,alt:"",loading:"lazy",onError:()=>s(!0)});if(r!=="author")return null;const w=a.split(/\s+/).filter(Boolean).map(y=>y[0]).slice(0,2).join("").toUpperCase();return e.jsx("span",{className:"topic-dialog-chip-image is-author is-initials","aria-hidden":"true",children:w})}const xe=45,us=1800,ps=25,hs=350,ms=r=>{const[a,m]=h.useState($[0].slice(0,1)),[l,s]=h.useState(0);return h.useEffect(()=>{var L,_;if(!r)return;if((_=(L=window.matchMedia)==null?void 0:L.call(window,"(prefers-reduced-motion: reduce)"))!=null&&_.matches){m($[0]),s(0);return}let w=0,y=1,c=!1,j;m($[0].slice(0,y)),s(0);const k=()=>{const v=$[w];if(!c){if(y+=1,m(v.slice(0,y)),y===v.length){c=!0,j=window.setTimeout(k,us);return}j=window.setTimeout(k,xe);return}if(y-=1,m(v.slice(0,y)),y===0){c=!1,w=(w+1)%$.length,s(w),j=window.setTimeout(k,hs);return}j=window.setTimeout(k,ps)};return j=window.setTimeout(k,xe),()=>window.clearTimeout(j)},[r]),{placeholder:a,prompt:$[l]}},gs=()=>{var D;const r=be(),a=ye(),[m,l]=h.useState({text:"",paperMentions:[]}),s=m.text,[w,y]=h.useState(0),[c,j]=h.useState(!1),[k,L]=h.useState(null),{placeholder:_,prompt:v}=ms(!s),P=h.useRef(null),M=R({queryKey:["chatAvailability"],queryFn:()=>os.getAvailability(),retry:!1,enabled:ne()}),b=ne()&&((D=M.data)==null?void 0:D.paper_mentions_enabled)!==!1,n=Xe({draft:m,onChange:l,enabled:b,textareaRef:P}),d=Ye(m,n.open),C=s?d.completion:v;h.useLayoutEffect(()=>{const o=P.current;if(!o)return;const g=()=>{if(o.style.height="auto",s){o.style.height=`${Math.min(ss(o),160)}px`;return}const f=o.placeholder,F=$.reduce((q,I)=>(o.placeholder=I,Math.max(q,o.scrollHeight)),0);o.placeholder=f,o.style.height=`${Math.min(F,160)}px`};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[s,C]);const A=async(o=m)=>{const g=o.text.trim();if(!(!g||c)){if(a){const f=new URLSearchParams({q:g,model:se}),F=`${Ae}?${f}`,q=window.open(F,"_blank");if(!q){L(F);return}q.opener=null,L(null),l({text:"",paperMentions:[]});return}j(!0),ts(o,se);try{const f=await as(se);r(`/chat/${f.id}`)}catch{r("/chat")}}};return e.jsxs(e.Fragment,{children:[!a&&e.jsx("div",{className:"ask-home-new",children:"Hint: type @ to bring papers into context, or press Tab to use a suggestion"}),e.jsxs("div",{className:"ask-home",children:[e.jsxs("div",{className:"ask-home-row",children:[e.jsxs("div",{className:"ask-home-textarea-wrap",children:[e.jsx(Ze,{text:m.text,mentions:m.paperMentions,scrollTop:w,variant:"home",completion:s?C:""}),e.jsx("textarea",{ref:P,rows:1,value:s,placeholder:_,"aria-label":"Ask the assistant",disabled:c,onChange:o=>{n.updateText(o.target.value,o.target.selectionStart),d.trackCaret(o.target)},onSelect:o=>{n.refresh(o.currentTarget.selectionStart),d.trackCaret(o.currentTarget)},onClick:o=>{n.refresh(o.currentTarget.selectionStart),d.trackCaret(o.currentTarget)},onScroll:o=>y(o.currentTarget.scrollTop),onBlur:o=>{var g,f;(f=(g=o.relatedTarget)==null?void 0:g.closest)!=null&&f.call(g,".chat-paper-picker")||window.setTimeout(n.close,0)},onKeyDown:o=>{if(!n.keyDown(o)){if(Ve(o)&&C){o.preventDefault();const g=s+C;n.updateText(g,g.length),window.requestAnimationFrame(()=>{var f;return(f=P.current)==null?void 0:f.setSelectionRange(g.length,g.length)});return}o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),A())}},role:b?"combobox":void 0,"aria-expanded":b?n.open:void 0,"aria-controls":n.open?n.pickerId:void 0,"aria-activedescendant":n.open&&n.results.length?`${n.optionIdPrefix}-${n.activeIndex}`:void 0,"aria-autocomplete":b?"list":void 0,"aria-describedby":n.message?"ask-home-paper-mention-message":void 0})]}),e.jsx("button",{type:"button",className:`chat-send${s.trim()?" chat-send-on":""}`,onClick:()=>void A(),disabled:!s.trim()||c,"aria-label":"Ask the assistant",children:e.jsx(Je,{})})]}),k&&e.jsx("div",{className:"chat-paper-mention-message",role:"alert",children:e.jsx("a",{href:k,target:"_blank",rel:"noreferrer",children:"Open this question on paperswithcode.co"})}),n.message&&e.jsx("div",{id:"ask-home-paper-mention-message",className:"chat-paper-mention-message",role:"alert",children:n.message}),e.jsx(es,{open:n.open,query:n.query,results:n.results,activeIndex:n.activeIndex,loading:n.loading,error:n.error,onSelect:n.select,id:n.pickerId,optionIdPrefix:n.optionIdPrefix})]})]})},Ne={task:"Tasks",method:"Methods",benchmark:"Benchmarks",author:"Authors",organization:"Orgs"},fs=Object.keys(Ne),xs=30,we=40,ws=async r=>{const a=await r;return{results:a.results.map(m=>({paper:m})),next_page:a.next_page}},bs=({mode:r})=>{var Q,K,re,le,ce,de,ue;const a=r==="following",m=be(),l=Ce(),s=l==null?void 0:l.user,[w,y]=Fe(),c=Be(w,void 0,a?"month":"week"),j=t=>{const u=new URLSearchParams(w);u.delete("order_by"),u.delete("only");const T=u.toString();m(T?`${t}?${T}`:t)},k=t=>{const u=new URLSearchParams(w);t?u.set("only","topic"):u.delete("only");const T=u.toString();return T?`/following?${T}`:"/following"},L=R({queryKey:["top-tasks-sidebar"],queryFn:()=>ee.topTasks(8),staleTime:10*60*1e3}),_=R({queryKey:["trending-tasks-sidebar"],queryFn:()=>ee.trendingTasks({limit:8,level:0}),staleTime:10*60*1e3}),v=a&&w.get("only")==="topic",P={start_date:c.startDate,end_date:c.endDate},M={...c,topicOnly:v},b=ns(a?[...J.feeds.following,s==null?void 0:s.hf_subject,M]:[...r==="x"?J.feeds.xTrending:J.feeds.trending,P],async t=>{if(a){const T=await B.following(t,M),ke=T.length===we?t+we:null;return{results:T,next_page:ke}}const u={...P,page:t,page_size:xs,include_resources:!0};return ws(r==="x"?ge.xTrending(u):ge.list({...u,order_by:"trending",order_dir:"desc",latest_only:!0}))},{enabled:!a||!!s,initialPage:a?0:1}),n=R({queryKey:["research-follows",s==null?void 0:s.hf_subject],queryFn:B.follows,enabled:a&&!!s}),d=R({queryKey:["research-topic",s==null?void 0:s.hf_subject],queryFn:B.topic,enabled:a&&!!s,refetchInterval:t=>t.state.data&&["pending","running"].includes(t.state.data.status)?1e4:!1}),C=!!d.data&&["pending","running"].includes(d.data.status),A=d.data?d.data.label??d.data.text:"",[D,o]=h.useState(!1),g=Ee(),f=h.useRef(!1);h.useEffect(()=>{f.current&&!C&&g.invalidateQueries({queryKey:[...J.feeds.following,s==null?void 0:s.hf_subject]}),f.current=C},[C,g,s==null?void 0:s.hf_subject]);const F=a&&!!s&&((Q=n.data)==null?void 0:Q.length)===0&&d.isSuccess&&!d.data,q=a&&!(l!=null&&l.isLoading)&&!s||F,I=!!s||!Le(),[O,W]=h.useState(!1),[X]=h.useState(()=>!!he()||me().length>0),[Y,Z]=h.useState(!1);!O&&(d.data||(K=n.data)!=null&&K.length)&&W(!0),q&&!Y&&(Z(!0),I&&!O&&!X&&o(!0));const H=je(),{mutate:z}=H,U=h.useRef(!1);h.useEffect(()=>{var u;const t=he();!s||!d.isSuccess||!t||U.current||(U.current=!0,t===((u=d.data)==null?void 0:u.text)?$e():z(t))},[s,d.isSuccess,d.data,z]);const i=ve(),{mutate:p}=i,N=h.useRef(!1);h.useEffect(()=>{const t=me();!s||!t.length||N.current||(N.current=!0,p(t))},[s,p]);const S=h.useMemo(()=>fs.map(t=>{var u;return{kind:t,follows:a?((u=n.data)==null?void 0:u.filter(T=>T.kind===t))??[]:[]}}).filter(t=>t.follows.length>0),[a,n.data]),G=a&&(!!(l!=null&&l.isLoading)||!!s&&!F),V=h.useMemo(()=>{var t;return((t=b.data)==null?void 0:t.pages.flatMap(u=>u.results.map(T=>({...Ie(T.paper),followReasons:T.reasons}))))??[]},[b.data]),x=b.error;return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Trending ",e.jsx("em",{children:"Research"})]}),e.jsx("div",{className:"feed-subtitle",children:r==="x"?"Papers people share most on X, picked daily":"Curated daily from arXiv and Hugging Face"})]})}),e.jsxs("div",{className:"layout-with-sidebar",children:[e.jsxs("aside",{className:"sidebar feed-sidebar",children:[G?e.jsxs("div",{className:"sidebar-section sidebar-section-follows",children:[e.jsx("div",{className:"sidebar-label",children:"You follow"}),((l==null?void 0:l.isLoading)||n.isLoading)&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:4}).map((t,u)=>e.jsx(te,{className:"h-5 w-full"},u))}),n.isError&&e.jsx("div",{style:{fontSize:12,color:"var(--ink-faint)"},children:"Couldn't load your follows."}),e.jsxs("div",{className:"sidebar-links",children:[d.data&&e.jsxs("div",{className:`sidebar-follow-topic ${v?"active":""}`,children:[e.jsxs(E,{to:k(!v),className:"sidebar-link sidebar-follow-link",title:v?"Show papers from everything you follow":`Show only papers about “${d.data.text}”`,"aria-current":v?"true":void 0,children:[e.jsx("span",{className:"sidebar-follow-kind",children:"Topic"}),e.jsx("span",{className:"sidebar-follow-name",children:A})]}),e.jsx("button",{type:"button",className:"sidebar-follow-edit","aria-label":"Edit topic","aria-expanded":D,onClick:()=>o(!0),children:"edit"})]}),S.map(t=>e.jsxs("div",{className:"sidebar-follow-group",children:[e.jsx("span",{className:"sidebar-follow-kind",children:Ne[t.kind]}),t.follows.map(u=>e.jsx(E,{to:u.url,className:"sidebar-link sidebar-follow-link",children:e.jsx("span",{className:"sidebar-follow-name",children:u.name})},u.entity_id))]},t.kind))]}),e.jsx(E,{to:"/settings",className:"sidebar-follow-manage",children:"Manage in Settings"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sidebar-section sidebar-section-top-domains",children:[e.jsx("div",{className:"sidebar-label",children:"Top Domains"}),L.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((t,u)=>e.jsx(te,{className:"h-5 w-full"},u))}),e.jsxs("div",{className:"sidebar-links",children:[(re=L.data)==null?void 0:re.map(t=>e.jsxs(E,{to:`/tasks/${t.slug}`,className:"sidebar-link",children:[ie(t.name,t.slug),t.paper_count!=null&&e.jsx("span",{className:"count",children:t.paper_count})]},t.id)),e.jsx(E,{to:"/tasks",className:"sidebar-link sidebar-link-more",children:"all domains →"})]})]}),e.jsxs("div",{className:"sidebar-section sidebar-section-trending-domains",children:[e.jsx("div",{className:"sidebar-label",children:"Trending Domains"}),_.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((t,u)=>e.jsx(te,{className:"h-5 w-full"},u))}),((ce=(le=_.data)==null?void 0:le.results)==null?void 0:ce.length)===0&&!_.isLoading&&e.jsx("div",{style:{fontSize:12,color:"var(--ink-faint)"},children:"No domains gaining momentum right now."}),e.jsx("div",{className:"sidebar-links",children:(ue=(de=_.data)==null?void 0:de.results)==null?void 0:ue.map(t=>e.jsxs(E,{to:`/tasks/${t.slug}`,className:"sidebar-link",children:[ie(t.name,t.slug),e.jsxs("span",{className:"count",children:[t.share_lift.toFixed(1),"x"]})]},t.id))})]})]}),e.jsx(We,{})]}),e.jsxs("div",{className:"feed-main",children:[(ne()||ye())&&e.jsx("div",{className:"feed-chat",children:e.jsx(gs,{})}),e.jsxs("div",{className:"feed-content",children:[e.jsxs("div",{className:"sort-bar home-feed-sort-bar",children:[e.jsx("div",{className:"paper-feed-toolbar-controls",children:e.jsxs("div",{className:"sort-options",children:[e.jsx("button",{className:`sort-btn ${r==="trending"?"active":""}`,onClick:()=>j("/"),children:"trending"}),e.jsx("button",{className:`sort-btn ${r==="x"?"active":""}`,onClick:()=>j("/x-trending"),children:"trending (X)"}),e.jsx("button",{className:`sort-btn ${a?"active":""}`,onClick:()=>j("/following"),children:"following"})]})}),e.jsx(Ue,{startDate:c.startDate,endDate:c.endDate,onChange:t=>y(Ge(w,t))})]}),x&&e.jsx(ae,{variant:"destructive",className:"mb-4",children:e.jsxs(oe,{children:["Failed to load papers. ",e.jsx("button",{type:"button",onClick:()=>void b.refetch(),children:"Try again"})]})}),H.isError&&H.variables&&e.jsx(ae,{variant:"destructive",className:"mb-4",children:e.jsxs(oe,{children:["Could not follow “",H.variables,"”. ",e.jsx("button",{type:"button",onClick:()=>z(H.variables),children:"Try again"})]})}),i.isError&&i.variables&&e.jsx(ae,{variant:"destructive",className:"mb-4",children:e.jsxs(oe,{children:["Could not follow ",i.variables.map(t=>t.name).join(", "),". ",e.jsx("button",{type:"button",onClick:()=>p(i.variables),children:"Try again"})]})}),a&&!!s&&d.isSuccess&&!n.isPending&&!F&&(d.data?C?e.jsxs("div",{className:"following-topic-note",role:"status",children:["Showing the closest papers about “",A,"” now. A model is reading papers to refine these matches, which takes a few minutes."]}):null:e.jsxs("div",{className:"following-topic-note",role:"status",children:["Describe a topic in your own words, and a model adds matching new papers to this feed."," ",e.jsx("button",{type:"button",className:"link-button",onClick:()=>o(!0),children:"Follow a topic"})]})),a&&I&&e.jsx(rs,{open:D,onOpenChange:o}),v&&d.data&&e.jsxs("div",{className:"following-topic-note following-topic-filter",role:"status",children:["Showing only papers about “",A,"”."," ",e.jsx(E,{to:k(!1),children:"Show everything you follow"})]}),q?e.jsx(is,{onBuild:I?()=>o(!0):void 0}):e.jsx(Qe,{query:b,isLoading:b.isLoading||a&&!!(l!=null&&l.isLoading),cards:V,skeleton:"card",rootMargin:"400px",empty:x?null:v?e.jsxs(e.Fragment,{children:["No papers about your topic match these filters. Widen the date range or ",e.jsx("button",{type:"button",className:"link-button",onClick:()=>o(!0),children:"edit your topic"}),"."]}):a?e.jsxs(e.Fragment,{children:["No papers from your topic or follows match these filters. Widen the date range, or follow more from ",e.jsx(E,{to:"/tasks",children:"tasks"}),", ",e.jsx(E,{to:"/methods",children:"methods"}),", benchmark, author, or organization pages."]}):r==="x"?"No papers shared on X in this window.":"No papers in this window."})]})]})]})]})},Zs=({xTrending:r=!1})=>e.jsx(bs,{mode:r?"x":"trending"});export{gs as AskAssistant,bs as HomeFeed,Zs as default}; diff --git a/assets/FeedView-tA68x8iy.js b/assets/FeedView-tA68x8iy.js new file mode 100644 index 0000000000000000000000000000000000000000..b57c9d4adb93e5102efc28d199769e6943d178d2 --- /dev/null +++ b/assets/FeedView-tA68x8iy.js @@ -0,0 +1 @@ +import{j as e,L as F,a as _e,c as Ce,b as H,r as ne,d as h,h as Ee,C as Fe,T as Q,e as je,f as Le,g as Ae,p as se,i as De,k as Re,l as re,m as ve,n as Me,o as qe}from"./index-DyXq7-Tg.js";import{S as Ie}from"./sparkles-CcIiUzzc.js";import{D as Oe,a as He,b as $e}from"./dialog-CfM0Uql2.js";import{c as J}from"./catalog-CRar2olQ.js";import{u as Ne,a as Se,b as ke,T as me,s as ze,c as Ke,r as ee,d as ge,e as fe,f as Be}from"./researchTopic-DbX0eko-.js";import{d as le,t as Ue}from"./transform-D46m70Qr.js";import{P as Ge}from"./plus-Yh42pKZz.js";import{A as Qe}from"./arrow-right-BzPanrWZ.js";import{r as We,P as Xe,w as Ye,a as Ze}from"./PaperFeed-EBt97iOL.js";import{M as Ve}from"./McpShowcase-CLO4HLon.js";import{u as Je,a as es,P as ss,i as ts,A as as,b as os,S as $,c as is,D as te,q as ns,d as rs}from"./chatSessions-Ck_dyM0d.js";import{c as ls}from"./chat-Ix1IrIwq.js";import{u as cs}from"./usePapers-B0s20UcU.js";import{p as xe}from"./papers-Dh3ljlL0.js";import{S as ae}from"./skeleton-C3IIzpSL.js";import{A as oe,a as ie}from"./alert-gbJBhAVE.js";import"./useMutation-UWxBeqtn.js";import"./PaperCard-57p1OSGy.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./SotaBadges-vbLLOUtT.js";import"./colors-BkWRhvFI.js";import"./Icon-T4LYkEQj.js";import"./LatexTitle-Bkyz3jCs.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-CTBEUp7Y.js";import"./useIntersectionObserver-D6_Iig9a.js";import"./AgentLogos-j-Qekw7T.js";import"./useInfiniteQuery-BYh2zN-T.js";import"./curation-YeS7FBYf.js";function ds({onBuild:r}){return e.jsxs("section",{className:"following-intro","aria-labelledby":"following-intro-title",children:[e.jsx("h2",{id:"following-intro-title",children:"Build your personal research feed"}),e.jsx("p",{className:"following-intro-lead",children:"Describe a topic in your own words, or follow the tasks, benchmarks, authors, and organizations you care about, and this page collects their latest papers and results in one place."}),r&&e.jsxs("button",{type:"button",className:"research-topic-save following-intro-topic",onClick:r,children:[e.jsx(Ie,{"aria-hidden":"true"}),"Build your feed"]}),e.jsxs("p",{className:"following-intro-note",children:["Matching papers also arrive as a weekly email, which you can turn off in"," ",e.jsx(F,{to:"/settings",children:"Settings"}),"."]})]})}const we=16;function us({open:r,onOpenChange:o}){return e.jsx(Oe,{open:r,onOpenChange:o,children:e.jsx(He,{className:"topic-dialog","aria-describedby":void 0,children:e.jsx(ps,{onDone:()=>o(!1)})})})}function ps({onDone:r}){var W,X,Y,Z,O,z,B;const{user:o}=_e(),m=Ce(),l=H({queryKey:ne.topic(o==null?void 0:o.hf_subject),queryFn:ee.topic,enabled:!!o}),t=Ne(),w=H({queryKey:["trending-tasks-follow"],queryFn:()=>J.trendingTasks({limit:we,level:0}),staleTime:Q}),y=H({queryKey:["trending-methods-follow"],queryFn:()=>J.trendingMethods({limit:we}),staleTime:Q}),c=H({queryKey:["research-follow-suggestions"],queryFn:ee.followSuggestions,staleTime:Q}),j=(n=[])=>n.map(p=>({id:String(p.entity_id),name:p.name,image:p.image_url})),[S,L]=h.useState(null),[P,v]=h.useState([]),_=Se(),M=ke(),b=((W=l.data)==null?void 0:W.text)??"",i=S??b,d=i.trim().replace(/\s+/g," "),C=((X=l.data)==null?void 0:X.status)==="failed"&&d===b,A=d.length>=3&&(d!==b||C),D=_.isPending||M.isPending,a=(n,p)=>{var N;return((N=t.data)==null?void 0:N.some(k=>k.kind===n&&String(k.entity_id)===p))??!1},g=(n,p)=>{var N;return((N=P.find(k=>k.kind===n&&k.id===p))==null?void 0:N.follow)??a(n,p)},f=P.filter(n=>n.follow!==a(n.kind,n.id)),E=!D&&(A||f.length>0),R=(n,p,N)=>v(k=>[...k.filter(U=>U.kind!==n||U.id!==p),{kind:n,id:p,name:N,follow:!g(n,p)}]),q=()=>{if(!E)return;if(!o){A&&ze(d),f.length&&Ke(f),window.location.href=Ee(`${m.pathname}${m.search}`);return}const n=[...f.length?[M.mutateAsync(f)]:[],...A?[_.mutateAsync(d)]:[]];Promise.allSettled(n).then(p=>{p.every(N=>N.status==="fulfilled")&&r()})},I=(n,p,N,k)=>{const V=[...(t.data??[]).filter(x=>x.kind===p).map(x=>({id:String(x.entity_id),name:x.name,slug:x.url.split("/").pop(),image:x.image_url})),...N.filter(x=>!a(p,x.id)).map(x=>({...x,suggested:!0}))];return V.length>0&&e.jsxs("div",{className:"topic-dialog-group",children:[e.jsx("h3",{children:n}),e.jsxs(hs,{children:[V.map(x=>{const G=g(p,x.id),K=p==="task"?le(x.name,x.slug??void 0):x.name;return e.jsxs("button",{type:"button",className:"topic-dialog-chip","aria-pressed":G,disabled:D,"data-suggested":"suggested"in x||void 0,onClick:()=>R(p,x.id,K),children:[G?e.jsx(Fe,{"aria-hidden":"true"}):e.jsx(Ge,{"aria-hidden":"true"}),(p==="author"||p==="organization")&&e.jsx(ms,{kind:p,name:K,src:x.image}),K]},x.id)}),k&&e.jsxs(F,{to:k.to,className:"topic-dialog-browse",children:[k.label,e.jsx(Qe,{"aria-hidden":"true"})]})]})]})};return e.jsxs("form",{className:"topic-dialog-form",onSubmit:n=>{n.preventDefault(),q()},children:[e.jsx($e,{className:"topic-dialog-title",children:b||(Y=t.data)!=null&&Y.length?"Edit your research feed":"Build your research feed"}),e.jsxs("div",{className:"topic-dialog-group",children:[e.jsx("h3",{children:e.jsx("label",{htmlFor:"topic-dialog-input",children:"Describe a topic in your own words"})}),e.jsx("p",{className:"topic-dialog-hint",children:"A model reads every new paper and adds the ones that match to your Following feed."}),e.jsx("textarea",{id:"topic-dialog-input",className:"research-topic-input",rows:4,maxLength:me,"aria-label":"Research topic",placeholder:"e.g. diffusion policies for robot manipulation, or speculative decoding for LLM inference",value:i,onChange:n=>L(n.target.value),onKeyDown:n=>{n.key==="Enter"&&!n.shiftKey&&!n.nativeEvent.isComposing&&(n.preventDefault(),q())}}),e.jsxs("span",{className:"research-topic-count",children:[i.length,"/",me]})]}),I("Trending tasks","task",((Z=w.data)==null?void 0:Z.results)??[],{to:"/tasks",label:"Browse tasks"}),I("Trending methods","method",((O=y.data)==null?void 0:O.results)??[],{to:"/methods",label:"Browse methods"}),I("Benchmarks","benchmark",[],{to:"/tasks",label:"Browse benchmarks"}),I("Popular authors","author",j((z=c.data)==null?void 0:z.authors)),I("Popular organizations","organization",j((B=c.data)==null?void 0:B.organizations),{to:"/organizations",label:"Browse organizations"}),(_.error||M.error)&&e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not save your feed. Please try again."}),e.jsxs("div",{className:"topic-dialog-actions",children:[b&&e.jsx("button",{type:"button",className:"research-follow-action topic-dialog-remove",disabled:D,onClick:()=>_.mutate(null,{onSuccess:r}),children:"Remove topic"}),e.jsx("button",{type:"button",className:"research-follow-action",disabled:D,onClick:r,children:"Cancel"}),e.jsx("button",{type:"submit",className:"research-topic-save",disabled:!E,children:f.some(n=>n.follow===!1)?"Save":f.length?"Follow":C?"Retry":b?"Update topic":"Follow"})]})]})}function hs({children:r}){const o=h.useRef(null);return h.useLayoutEffect(()=>{const m=o.current;if(!m)return;const l=()=>{const t=[...m.children],w=t.filter(c=>c.dataset.suggested);w.forEach(c=>{c.hidden=!1});const y=()=>new Set(t.filter(c=>!c.hidden).map(c=>c.offsetTop)).size;for(let c=w.length-1;c>=0&&y()>2;c--)w[c].hidden=!0};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)}),e.jsx("div",{ref:o,className:"topic-dialog-chips",children:r})}function ms({kind:r,name:o,src:m}){const[l,t]=h.useState(!1);if(m&&!l)return e.jsx("img",{className:`topic-dialog-chip-image is-${r}`,src:m,alt:"",loading:"lazy",onError:()=>t(!0)});if(r!=="author")return null;const w=o.split(/\s+/).filter(Boolean).map(y=>y[0]).slice(0,2).join("").toUpperCase();return e.jsx("span",{className:"topic-dialog-chip-image is-author is-initials","aria-hidden":"true",children:w})}const be=45,gs=1800,fs=25,xs=350,ws=r=>{const[o,m]=h.useState($[0].slice(0,1)),[l,t]=h.useState(0);return h.useEffect(()=>{var L,P;if(!r)return;if((P=(L=window.matchMedia)==null?void 0:L.call(window,"(prefers-reduced-motion: reduce)"))!=null&&P.matches){m($[0]),t(0);return}let w=0,y=1,c=!1,j;m($[0].slice(0,y)),t(0);const S=()=>{const v=$[w];if(!c){if(y+=1,m(v.slice(0,y)),y===v.length){c=!0,j=window.setTimeout(S,gs);return}j=window.setTimeout(S,be);return}if(y-=1,m(v.slice(0,y)),y===0){c=!1,w=(w+1)%$.length,t(w),j=window.setTimeout(S,xs);return}j=window.setTimeout(S,fs)};return j=window.setTimeout(S,be),()=>window.clearTimeout(j)},[r]),{placeholder:o,prompt:$[l]}},bs=()=>{var D;const r=je(),o=ve(),[m,l]=h.useState({text:"",paperMentions:[]}),t=m.text,[w,y]=h.useState(0),[c,j]=h.useState(!1),[S,L]=h.useState(null),{placeholder:P,prompt:v}=ws(!t),_=h.useRef(null),M=H({queryKey:["chatAvailability"],queryFn:()=>ls.getAvailability(),retry:!1,enabled:re()}),b=re()&&((D=M.data)==null?void 0:D.paper_mentions_enabled)!==!1,i=Je({draft:m,onChange:l,enabled:b,textareaRef:_}),d=es(m,i.open),C=t?d.completion:v;h.useLayoutEffect(()=>{const a=_.current;if(!a)return;const g=()=>{if(a.style.height="auto",t){a.style.height=`${Math.min(is(a),160)}px`;return}const f=a.placeholder,E=$.reduce((R,q)=>(a.placeholder=q,Math.max(R,a.scrollHeight)),0);a.placeholder=f,a.style.height=`${Math.min(E,160)}px`};return g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[t,C]);const A=async(a=m)=>{const g=a.text.trim();if(!(!g||c)){if(o){const f=new URLSearchParams({q:g,model:te}),E=`${Me}?${f}`,R=window.open(E,"_blank");if(!R){L(E);return}R.opener=null,L(null),l({text:"",paperMentions:[]});return}j(!0),ns(a,te);try{const f=await rs(te);r(`/chat/${f.id}`)}catch{r("/chat")}}};return e.jsxs(e.Fragment,{children:[!o&&e.jsx("div",{className:"ask-home-new",children:"Hint: type @ to bring papers into context, or press Tab to use a suggestion"}),e.jsxs("div",{className:"ask-home",children:[e.jsxs("div",{className:"ask-home-row",children:[e.jsxs("div",{className:"ask-home-textarea-wrap",children:[e.jsx(ss,{text:m.text,mentions:m.paperMentions,scrollTop:w,variant:"home",completion:t?C:""}),e.jsx("textarea",{ref:_,rows:1,value:t,placeholder:P,"aria-label":"Ask the assistant",disabled:c,onChange:a=>{i.updateText(a.target.value,a.target.selectionStart),d.trackCaret(a.target)},onSelect:a=>{i.refresh(a.currentTarget.selectionStart),d.trackCaret(a.currentTarget)},onClick:a=>{i.refresh(a.currentTarget.selectionStart),d.trackCaret(a.currentTarget)},onScroll:a=>y(a.currentTarget.scrollTop),onBlur:a=>{var g,f;(f=(g=a.relatedTarget)==null?void 0:g.closest)!=null&&f.call(g,".chat-paper-picker")||window.setTimeout(i.close,0)},onKeyDown:a=>{if(!i.keyDown(a)){if(ts(a)&&C){a.preventDefault();const g=t+C;i.updateText(g,g.length),window.requestAnimationFrame(()=>{var f;return(f=_.current)==null?void 0:f.setSelectionRange(g.length,g.length)});return}a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),A())}},role:b?"combobox":void 0,"aria-expanded":b?i.open:void 0,"aria-controls":i.open?i.pickerId:void 0,"aria-activedescendant":i.open&&i.results.length?`${i.optionIdPrefix}-${i.activeIndex}`:void 0,"aria-autocomplete":b?"list":void 0,"aria-describedby":i.message?"ask-home-paper-mention-message":void 0})]}),e.jsx("button",{type:"button",className:`chat-send${t.trim()?" chat-send-on":""}`,onClick:()=>void A(),disabled:!t.trim()||c,"aria-label":"Ask the assistant",children:e.jsx(as,{})})]}),S&&e.jsx("div",{className:"chat-paper-mention-message",role:"alert",children:e.jsx("a",{href:S,target:"_blank",rel:"noreferrer",children:"Open this question on paperswithcode.co"})}),i.message&&e.jsx("div",{id:"ask-home-paper-mention-message",className:"chat-paper-mention-message",role:"alert",children:i.message}),e.jsx(os,{open:i.open,query:i.query,results:i.results,activeIndex:i.activeIndex,loading:i.loading,error:i.error,onSelect:i.select,id:i.pickerId,optionIdPrefix:i.optionIdPrefix})]})]})},Te={task:"Tasks",method:"Methods",benchmark:"Benchmarks",author:"Authors",organization:"Orgs"},ys=Object.keys(Te),js=30,ye=40,vs=async r=>{const o=await r;return{results:o.results.map(m=>({paper:m})),next_page:o.next_page}},Ns=({mode:r})=>{var G,K,ce,de,ue,pe,he;const o=r==="following",m=je(),l=Le(),t=l==null?void 0:l.user,[w,y]=Ae(),c=We(w,void 0,o?"month":"week"),j=s=>{const u=new URLSearchParams(w);u.delete("order_by"),u.delete("only");const T=u.toString();m(T?`${s}?${T}`:s)},S=s=>{const u=new URLSearchParams(w);s?u.set("only","topic"):u.delete("only");const T=u.toString();return T?`/following?${T}`:"/following"},L=H({queryKey:qe.topTasksSidebar,queryFn:()=>J.topTasks(8),staleTime:Q}),P=H({queryKey:["trending-tasks-sidebar"],queryFn:()=>J.trendingTasks({limit:8,level:0}),staleTime:Q}),v=o&&w.get("only")==="topic",_={start_date:c.startDate,end_date:c.endDate},M={...c,topicOnly:v},b=cs(o?[...se.feeds.following,t==null?void 0:t.hf_subject,M]:[...r==="x"?se.feeds.xTrending:se.feeds.trending,_],async s=>{if(o){const T=await ee.following(s,M),Pe=T.length===ye?s+ye:null;return{results:T,next_page:Pe}}const u={..._,page:s,page_size:js,include_resources:!0};return vs(r==="x"?xe.xTrending(u):xe.list({...u,order_by:"trending",order_dir:"desc",latest_only:!0}))},{enabled:!o||!!t,initialPage:o?0:1}),i=Ne(o),d=H({queryKey:ne.topic(t==null?void 0:t.hf_subject),queryFn:ee.topic,enabled:o&&!!t,refetchInterval:s=>s.state.data&&["pending","running"].includes(s.state.data.status)?1e4:!1}),C=!!d.data&&["pending","running"].includes(d.data.status),A=d.data?d.data.label??d.data.text:"",[D,a]=h.useState(!1),g=De(),f=h.useRef(!1);h.useEffect(()=>{f.current&&!C&&g.invalidateQueries({queryKey:ne.feed(t==null?void 0:t.hf_subject)}),f.current=C},[C,g,t==null?void 0:t.hf_subject]);const E=o&&!!t&&((G=i.data)==null?void 0:G.length)===0&&d.isSuccess&&!d.data,R=o&&!(l!=null&&l.isLoading)&&!t||E,q=!!t||!Re(),[I,W]=h.useState(!1),[X]=h.useState(()=>!!ge()||fe().length>0),[Y,Z]=h.useState(!1);!I&&(d.data||(K=i.data)!=null&&K.length)&&W(!0),R&&!Y&&(Z(!0),q&&!I&&!X&&a(!0));const O=Se(),{mutate:z}=O,B=h.useRef(!1);h.useEffect(()=>{var u;const s=ge();!t||!d.isSuccess||!s||B.current||(B.current=!0,s===((u=d.data)==null?void 0:u.text)?Be():z(s))},[t,d.isSuccess,d.data,z]);const n=ke(),{mutate:p}=n,N=h.useRef(!1);h.useEffect(()=>{const s=fe();!t||!s.length||N.current||(N.current=!0,p(s))},[t,p]);const k=h.useMemo(()=>ys.map(s=>{var u;return{kind:s,follows:o?((u=i.data)==null?void 0:u.filter(T=>T.kind===s))??[]:[]}}).filter(s=>s.follows.length>0),[o,i.data]),U=o&&(!!(l!=null&&l.isLoading)||!!t&&!E),V=h.useMemo(()=>{var s;return((s=b.data)==null?void 0:s.pages.flatMap(u=>u.results.map(T=>({...Ue(T.paper),followReasons:T.reasons}))))??[]},[b.data]),x=b.error;return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Trending ",e.jsx("em",{children:"Research"})]}),e.jsx("div",{className:"feed-subtitle",children:r==="x"?"Papers people share most on X, picked daily":"Curated daily from arXiv and Hugging Face"})]})}),e.jsxs("div",{className:"layout-with-sidebar",children:[e.jsxs("aside",{className:"sidebar feed-sidebar",children:[U?e.jsxs("div",{className:"sidebar-section sidebar-section-follows",children:[e.jsx("div",{className:"sidebar-label",children:"You follow"}),((l==null?void 0:l.isLoading)||i.isLoading)&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:4}).map((s,u)=>e.jsx(ae,{className:"h-5 w-full"},u))}),i.isError&&e.jsx("div",{style:{fontSize:12,color:"var(--ink-faint)"},children:"Couldn't load your follows."}),e.jsxs("div",{className:"sidebar-links",children:[d.data&&e.jsxs("div",{className:`sidebar-follow-topic ${v?"active":""}`,children:[e.jsxs(F,{to:S(!v),className:"sidebar-link sidebar-follow-link",title:v?"Show papers from everything you follow":`Show only papers about “${d.data.text}”`,"aria-current":v?"true":void 0,children:[e.jsx("span",{className:"sidebar-follow-kind",children:"Topic"}),e.jsx("span",{className:"sidebar-follow-name",children:A})]}),e.jsx("button",{type:"button",className:"sidebar-follow-edit","aria-label":"Edit topic","aria-expanded":D,onClick:()=>a(!0),children:"edit"})]}),k.map(s=>e.jsxs("div",{className:"sidebar-follow-group",children:[e.jsx("span",{className:"sidebar-follow-kind",children:Te[s.kind]}),s.follows.map(u=>e.jsx(F,{to:u.url,className:"sidebar-link sidebar-follow-link",children:e.jsx("span",{className:"sidebar-follow-name",children:u.name})},u.entity_id))]},s.kind))]}),e.jsx(F,{to:"/settings",className:"sidebar-follow-manage",children:"Manage in Settings"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sidebar-section sidebar-section-top-domains",children:[e.jsx("div",{className:"sidebar-label",children:"Top Domains"}),L.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,u)=>e.jsx(ae,{className:"h-5 w-full"},u))}),e.jsxs("div",{className:"sidebar-links",children:[(ce=L.data)==null?void 0:ce.map(s=>e.jsxs(F,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[le(s.name,s.slug),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count})]},s.id)),e.jsx(F,{to:"/tasks",className:"sidebar-link sidebar-link-more",children:"all domains →"})]})]}),e.jsxs("div",{className:"sidebar-section sidebar-section-trending-domains",children:[e.jsx("div",{className:"sidebar-label",children:"Trending Domains"}),P.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((s,u)=>e.jsx(ae,{className:"h-5 w-full"},u))}),((ue=(de=P.data)==null?void 0:de.results)==null?void 0:ue.length)===0&&!P.isLoading&&e.jsx("div",{style:{fontSize:12,color:"var(--ink-faint)"},children:"No domains gaining momentum right now."}),e.jsx("div",{className:"sidebar-links",children:(he=(pe=P.data)==null?void 0:pe.results)==null?void 0:he.map(s=>e.jsxs(F,{to:`/tasks/${s.slug}`,className:"sidebar-link",children:[le(s.name,s.slug),e.jsxs("span",{className:"count",children:[s.share_lift.toFixed(1),"x"]})]},s.id))})]})]}),e.jsx(Ve,{})]}),e.jsxs("div",{className:"feed-main",children:[(re()||ve())&&e.jsx("div",{className:"feed-chat",children:e.jsx(bs,{})}),e.jsxs("div",{className:"feed-content",children:[e.jsxs("div",{className:"sort-bar home-feed-sort-bar",children:[e.jsx("div",{className:"paper-feed-toolbar-controls",children:e.jsxs("div",{className:"sort-options",children:[e.jsx("button",{className:`sort-btn ${r==="trending"?"active":""}`,onClick:()=>j("/"),children:"trending"}),e.jsx("button",{className:`sort-btn ${r==="x"?"active":""}`,onClick:()=>j("/x-trending"),children:"trending (X)"}),e.jsx("button",{className:`sort-btn ${o?"active":""}`,onClick:()=>j("/following"),children:"following"})]})}),e.jsx(Xe,{startDate:c.startDate,endDate:c.endDate,onChange:s=>y(Ye(w,s))})]}),x&&e.jsx(oe,{variant:"destructive",className:"mb-4",children:e.jsxs(ie,{children:["Failed to load papers. ",e.jsx("button",{type:"button",onClick:()=>void b.refetch(),children:"Try again"})]})}),O.isError&&O.variables&&e.jsx(oe,{variant:"destructive",className:"mb-4",children:e.jsxs(ie,{children:["Could not follow “",O.variables,"”. ",e.jsx("button",{type:"button",onClick:()=>z(O.variables),children:"Try again"})]})}),n.isError&&n.variables&&e.jsx(oe,{variant:"destructive",className:"mb-4",children:e.jsxs(ie,{children:["Could not follow ",n.variables.map(s=>s.name).join(", "),". ",e.jsx("button",{type:"button",onClick:()=>p(n.variables),children:"Try again"})]})}),o&&!!t&&d.isSuccess&&!i.isPending&&!E&&(d.data?C?e.jsxs("div",{className:"following-topic-note",role:"status",children:["Showing the closest papers about “",A,"” now. A model is reading papers to refine these matches, which takes a few minutes."]}):null:e.jsxs("div",{className:"following-topic-note",role:"status",children:["Describe a topic in your own words, and a model adds matching new papers to this feed."," ",e.jsx("button",{type:"button",className:"link-button",onClick:()=>a(!0),children:"Follow a topic"})]})),o&&q&&e.jsx(us,{open:D,onOpenChange:a}),v&&d.data&&e.jsxs("div",{className:"following-topic-note following-topic-filter",role:"status",children:["Showing only papers about “",A,"”."," ",e.jsx(F,{to:S(!1),children:"Show everything you follow"})]}),R?e.jsx(ds,{onBuild:q?()=>a(!0):void 0}):e.jsx(Ze,{query:b,isLoading:b.isLoading||o&&!!(l!=null&&l.isLoading),cards:V,skeleton:"card",rootMargin:"400px",empty:x?null:v?e.jsxs(e.Fragment,{children:["No papers about your topic match these filters. Widen the date range or ",e.jsx("button",{type:"button",className:"link-button",onClick:()=>a(!0),children:"edit your topic"}),"."]}):o?e.jsxs(e.Fragment,{children:["No papers from your topic or follows match these filters. Widen the date range, or follow more from ",e.jsx(F,{to:"/tasks",children:"tasks"}),", ",e.jsx(F,{to:"/methods",children:"methods"}),", benchmark, author, or organization pages."]}):r==="x"?"No papers shared on X in this window.":"No papers in this window."})]})]})]})]})},Js=({xTrending:r=!1})=>e.jsx(Ns,{mode:r?"x":"trending"});export{bs as AskAssistant,Ns as HomeFeed,Js as default}; diff --git a/assets/FollowingView-Ctbw54vk.js b/assets/FollowingView-Ctbw54vk.js new file mode 100644 index 0000000000000000000000000000000000000000..4bbdf0ea07da86d8a8380855f8d6df4502ade61c --- /dev/null +++ b/assets/FollowingView-Ctbw54vk.js @@ -0,0 +1 @@ +import{j as o}from"./index-DyXq7-Tg.js";import{HomeFeed as r}from"./FeedView-tA68x8iy.js";import"./sparkles-CcIiUzzc.js";import"./dialog-CfM0Uql2.js";import"./catalog-CRar2olQ.js";import"./researchTopic-DbX0eko-.js";import"./useMutation-UWxBeqtn.js";import"./transform-D46m70Qr.js";import"./plus-Yh42pKZz.js";import"./arrow-right-BzPanrWZ.js";import"./PaperFeed-EBt97iOL.js";import"./PaperCard-57p1OSGy.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./SotaBadges-vbLLOUtT.js";import"./colors-BkWRhvFI.js";import"./Icon-T4LYkEQj.js";import"./LatexTitle-Bkyz3jCs.js";import"./papers-Dh3ljlL0.js";import"./curation-YeS7FBYf.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-CTBEUp7Y.js";import"./skeleton-C3IIzpSL.js";import"./useIntersectionObserver-D6_Iig9a.js";import"./McpShowcase-CLO4HLon.js";import"./AgentLogos-j-Qekw7T.js";import"./chatSessions-Ck_dyM0d.js";import"./chat-Ix1IrIwq.js";import"./usePapers-B0s20UcU.js";import"./useInfiniteQuery-BYh2zN-T.js";import"./alert-gbJBhAVE.js";function B(){return o.jsx(r,{mode:"following"})}export{B as default}; diff --git a/assets/FollowingView-nVVViEvV.js b/assets/FollowingView-nVVViEvV.js deleted file mode 100644 index a99bc7dfd2b9ee90ee4636195d5470f104fa05ee..0000000000000000000000000000000000000000 --- a/assets/FollowingView-nVVViEvV.js +++ /dev/null @@ -1 +0,0 @@ -import{j as o}from"./index-CbgxfyGU.js";import{HomeFeed as r}from"./FeedView-BR2dQQ-K.js";import"./sparkles-BqBXJPmy.js";import"./useQuery-Bx9s5-D2.js";import"./dialog-Cfp_d3CC.js";import"./catalog-DhK7_9-6.js";import"./research-DgpyzSy_.js";import"./transform-0Udg2p6b.js";import"./researchTopic-CteUev4M.js";import"./useMutation-P_trTy9i.js";import"./plus-UK0TEjgd.js";import"./arrow-right-DotD9yNb.js";import"./PaperFeed-DMvUfA47.js";import"./PaperCard-tdTC_dRN.js";import"./AuthorAvatar-CUJMmp_z.js";import"./SotaBadges-C-sTR-EF.js";import"./colors-BkWRhvFI.js";import"./Icon-D-kA0Owz.js";import"./LatexTitle-Z-HGmZ-H.js";import"./paperQueryKeys-B8u1BWlI.js";import"./curation-C7Gmmp4z.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-DKJYnYjk.js";import"./skeleton-HwvdxvSN.js";import"./useIntersectionObserver-CID9Kkak.js";import"./McpShowcase-CMLfdJM2.js";import"./AgentLogos-BBl9UNVD.js";import"./chatSessions-DwLUbLRo.js";import"./chat-DzTo2WUO.js";import"./usePapers-CJaWLZ3y.js";import"./useInfiniteQuery-BAc_4HO5.js";import"./alert-CFDDvdIM.js";function D(){return o.jsx(r,{mode:"following"})}export{D as default}; diff --git a/assets/FrameworksIndexView-CQtYg5mA.js b/assets/FrameworksIndexView-CQtYg5mA.js deleted file mode 100644 index 0da3935b15b1b8f84c09ee5f37b8a7543bcb63ee..0000000000000000000000000000000000000000 --- a/assets/FrameworksIndexView-CQtYg5mA.js +++ /dev/null @@ -1 +0,0 @@ -import{c as d,j as e,L as c,M as m}from"./index-CbgxfyGU.js";import{u as h}from"./useQuery-Bx9s5-D2.js";import{I as p}from"./Icon-D-kA0Owz.js";import{c as u}from"./catalog-DhK7_9-6.js";import{c as g,h as x}from"./colors-BkWRhvFI.js";import{P as f}from"./frameworks-DDA0P4Tf.js";const j={fontFamily:"var(--mono)",fontSize:13,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--ink)",marginBottom:6},k=({platform:s})=>{const n=g(x(s));return e.jsx("span",{className:"framework-platform-chip",style:{background:n.bg,color:n.text},children:f[s]})},_=({framework:s})=>{const n=d(),t=`/papers?framework=${encodeURIComponent(s.slug)}`;return e.jsxs("article",{id:`framework-${s.slug}`,className:"framework-card framework-card-clickable",role:"link",tabIndex:0,"aria-label":`View papers implemented by ${s.name}`,onClick:a=>{a.target.closest("a, button")||n(t)},onKeyDown:a=>{a.target===a.currentTarget&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n(t))},children:[e.jsxs("div",{className:"framework-card-head",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"framework-card-name",children:s.name}),s.organization_name&&e.jsx("div",{className:"framework-card-org",children:s.organization_name})]}),s.platforms&&s.platforms.length>0&&e.jsx("div",{className:"framework-platform-row",children:s.platforms.map(a=>e.jsx(k,{platform:a},a))})]}),e.jsx("p",{className:"framework-card-desc",children:s.description}),s.when_to_use&&e.jsxs("div",{className:"framework-card-when",children:[e.jsx("span",{className:"framework-card-when-label",children:"When to use"}),s.when_to_use]}),(s.github_url||s.docs_url||s.introducing_paper_arxiv_id)&&e.jsxs("div",{className:"framework-card-links",children:[s.introducing_paper_arxiv_id&&e.jsx(c,{to:`/paper/${s.introducing_paper_arxiv_id}`,className:"framework-link",children:"Introducing paper"}),s.github_url&&s.paper_count>0&&e.jsxs(c,{to:t,className:"framework-link",children:["Implements ",s.paper_count," ",s.paper_count===1?"paper":"papers"]}),s.github_url&&s.paper_count===0&&e.jsx("span",{className:"framework-link framework-link-disabled","aria-disabled":"true",children:"Implements 0 papers"}),s.github_url&&e.jsxs("a",{href:s.github_url,target:"_blank",rel:"noopener noreferrer",className:"framework-link",children:[e.jsx(p,{name:"github",size:13}),"GitHub"]}),s.docs_url&&s.docs_url!==s.github_url&&e.jsx("a",{href:s.docs_url,target:"_blank",rel:"noopener noreferrer",className:"framework-link",children:"Docs"})]})]})},F=()=>{var a;const s=h({queryKey:["framework-catalog"],queryFn:()=>u.frameworkCatalog()}),n=((a=s.data)==null?void 0:a.domains)??[],t=n.reduce((i,r)=>i+r.categories.reduce((l,o)=>l+o.frameworks.length,0),0);return m.useEffect(()=>{var r;const i=window.location.hash.slice(1);i&&((r=document.getElementById(i))==null||r.scrollIntoView())},[s.data]),e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["AI ",e.jsx("em",{children:"Frameworks"})]}),e.jsx("div",{className:"feed-subtitle",children:"Curated libraries and tools to run, serve, and train models — pick the right stack for your hardware and workload."})]})}),s.isLoading&&e.jsx("div",{className:"empty",children:"Loading frameworks…"}),s.isError&&e.jsx("div",{className:"empty",children:"Could not load frameworks."}),n.map(i=>e.jsxs("section",{style:{marginBottom:56},children:[e.jsxs("div",{className:"area-section-head",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"area-section-title",children:i.name}),e.jsx("div",{className:"area-section-description",children:i.description})]}),e.jsxs("div",{className:"area-section-meta",children:[i.categories.length," ",i.categories.length===1?"category":"categories"," ·"," ",i.categories.reduce((r,l)=>r+l.frameworks.length,0)," frameworks"]})]}),i.categories.map(r=>e.jsxs("div",{className:"framework-category",children:[e.jsxs("div",{className:"framework-category-head",children:[e.jsxs("div",{children:[e.jsx("h3",{style:j,children:r.name}),r.description&&e.jsx("p",{className:"framework-category-blurb",children:r.description}),r.guide_url&&e.jsxs("a",{href:r.guide_url,target:"_blank",rel:"noopener noreferrer",className:"framework-guide-link",children:[r.guide_label??"Read guide"," →"]})]}),e.jsxs("div",{className:"framework-category-meta",children:[r.frameworks.length," ",r.frameworks.length===1?"framework":"frameworks"]})]}),e.jsx("div",{className:"framework-grid",children:r.frameworks.map(l=>e.jsx(_,{framework:l},l.slug))})]},r.slug))]},i.slug)),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:8},children:[t," frameworks across ",n.length," ",n.length===1?"domain":"domains",". More areas coming soon."]})]})};export{_ as FrameworkCard,F as default}; diff --git a/assets/FrameworksIndexView-CZmHXkeL.js b/assets/FrameworksIndexView-CZmHXkeL.js new file mode 100644 index 0000000000000000000000000000000000000000..f007a71abfef453e99f932bb488f4f9dbbca16e5 --- /dev/null +++ b/assets/FrameworksIndexView-CZmHXkeL.js @@ -0,0 +1 @@ +import{e as d,j as e,L as c,b as m,V as h}from"./index-DyXq7-Tg.js";import{I as p}from"./Icon-T4LYkEQj.js";import{c as u}from"./catalog-CRar2olQ.js";import{c as g,h as x}from"./colors-BkWRhvFI.js";import{P as f}from"./frameworks-DDA0P4Tf.js";const j={fontFamily:"var(--mono)",fontSize:13,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--ink)",marginBottom:6},k=({platform:s})=>{const n=g(x(s));return e.jsx("span",{className:"framework-platform-chip",style:{background:n.bg,color:n.text},children:f[s]})},_=({framework:s})=>{const n=d(),t=`/papers?framework=${encodeURIComponent(s.slug)}`;return e.jsxs("article",{id:`framework-${s.slug}`,className:"framework-card framework-card-clickable",role:"link",tabIndex:0,"aria-label":`View papers implemented by ${s.name}`,onClick:a=>{a.target.closest("a, button")||n(t)},onKeyDown:a=>{a.target===a.currentTarget&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n(t))},children:[e.jsxs("div",{className:"framework-card-head",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"framework-card-name",children:s.name}),s.organization_name&&e.jsx("div",{className:"framework-card-org",children:s.organization_name})]}),s.platforms&&s.platforms.length>0&&e.jsx("div",{className:"framework-platform-row",children:s.platforms.map(a=>e.jsx(k,{platform:a},a))})]}),e.jsx("p",{className:"framework-card-desc",children:s.description}),s.when_to_use&&e.jsxs("div",{className:"framework-card-when",children:[e.jsx("span",{className:"framework-card-when-label",children:"When to use"}),s.when_to_use]}),(s.github_url||s.docs_url||s.introducing_paper_arxiv_id)&&e.jsxs("div",{className:"framework-card-links",children:[s.introducing_paper_arxiv_id&&e.jsx(c,{to:`/paper/${s.introducing_paper_arxiv_id}`,className:"framework-link",children:"Introducing paper"}),s.github_url&&s.paper_count>0&&e.jsxs(c,{to:t,className:"framework-link",children:["Implements ",s.paper_count," ",s.paper_count===1?"paper":"papers"]}),s.github_url&&s.paper_count===0&&e.jsx("span",{className:"framework-link framework-link-disabled","aria-disabled":"true",children:"Implements 0 papers"}),s.github_url&&e.jsxs("a",{href:s.github_url,target:"_blank",rel:"noopener noreferrer",className:"framework-link",children:[e.jsx(p,{name:"github",size:13}),"GitHub"]}),s.docs_url&&s.docs_url!==s.github_url&&e.jsx("a",{href:s.docs_url,target:"_blank",rel:"noopener noreferrer",className:"framework-link",children:"Docs"})]})]})},I=()=>{var a;const s=m({queryKey:["framework-catalog"],queryFn:()=>u.frameworkCatalog()}),n=((a=s.data)==null?void 0:a.domains)??[],t=n.reduce((i,r)=>i+r.categories.reduce((l,o)=>l+o.frameworks.length,0),0);return h.useEffect(()=>{var r;const i=window.location.hash.slice(1);i&&((r=document.getElementById(i))==null||r.scrollIntoView())},[s.data]),e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["AI ",e.jsx("em",{children:"Frameworks"})]}),e.jsx("div",{className:"feed-subtitle",children:"Curated libraries and tools to run, serve, and train models — pick the right stack for your hardware and workload."})]})}),s.isLoading&&e.jsx("div",{className:"empty",children:"Loading frameworks…"}),s.isError&&e.jsx("div",{className:"empty",children:"Could not load frameworks."}),n.map(i=>e.jsxs("section",{style:{marginBottom:56},children:[e.jsxs("div",{className:"area-section-head",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"area-section-title",children:i.name}),e.jsx("div",{className:"area-section-description",children:i.description})]}),e.jsxs("div",{className:"area-section-meta",children:[i.categories.length," ",i.categories.length===1?"category":"categories"," ·"," ",i.categories.reduce((r,l)=>r+l.frameworks.length,0)," frameworks"]})]}),i.categories.map(r=>e.jsxs("div",{className:"framework-category",children:[e.jsxs("div",{className:"framework-category-head",children:[e.jsxs("div",{children:[e.jsx("h3",{style:j,children:r.name}),r.description&&e.jsx("p",{className:"framework-category-blurb",children:r.description}),r.guide_url&&e.jsxs("a",{href:r.guide_url,target:"_blank",rel:"noopener noreferrer",className:"framework-guide-link",children:[r.guide_label??"Read guide"," →"]})]}),e.jsxs("div",{className:"framework-category-meta",children:[r.frameworks.length," ",r.frameworks.length===1?"framework":"frameworks"]})]}),e.jsx("div",{className:"framework-grid",children:r.frameworks.map(l=>e.jsx(_,{framework:l},l.slug))})]},r.slug))]},i.slug)),e.jsxs("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",marginTop:8},children:[t," frameworks across ",n.length," ",n.length===1?"domain":"domains",". More areas coming soon."]})]})};export{_ as FrameworkCard,I as default}; diff --git a/assets/Icon-D-kA0Owz.js b/assets/Icon-T4LYkEQj.js similarity index 97% rename from assets/Icon-D-kA0Owz.js rename to assets/Icon-T4LYkEQj.js index 61ff91d89dc72f52ffedff413ad0cb975ff5033b..1379ddcee5acfde08712ee82a0b37ccfd5ffeb29 100644 --- a/assets/Icon-D-kA0Owz.js +++ b/assets/Icon-T4LYkEQj.js @@ -1 +1 @@ -import{j as o}from"./index-CbgxfyGU.js";const s=({name:t,size:r=14})=>{const e={search:o.jsx("path",{d:"M11 11l3 3M7 12.5a5.5 5.5 0 110-11 5.5 5.5 0 010 11z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),arrowUp:o.jsx("path",{d:"M8 3l5 6H3l5-6z",fill:"currentColor"}),arrowLeft:o.jsx("path",{d:"M9 3l-4 5 4 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),arrowRight:o.jsx("path",{d:"M7 3l4 5-4 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),external:o.jsx("path",{d:"M5 3h-2v8h8v-2M9 3h3v3M7 9l5-5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),github:o.jsx("path",{d:"M8 1a7 7 0 00-2.21 13.64c.35.06.48-.15.48-.34v-1.2c-1.95.42-2.36-.94-2.36-.94-.32-.81-.78-1.03-.78-1.03-.64-.43.05-.43.05-.43.7.05 1.07.72 1.07.72.62 1.07 1.64.76 2.04.58.06-.45.24-.76.44-.94-1.55-.18-3.18-.78-3.18-3.46 0-.76.27-1.39.72-1.88-.07-.18-.31-.89.07-1.86 0 0 .59-.19 1.92.72.56-.15 1.16-.23 1.75-.24.59 0 1.19.08 1.75.24 1.33-.9 1.92-.72 1.92-.72.38.97.14 1.68.07 1.86.45.49.72 1.12.72 1.88 0 2.69-1.64 3.28-3.19 3.45.25.22.48.65.48 1.32v1.95c0 .19.13.41.49.34A7 7 0 008 1z",fill:"currentColor"}),citation:o.jsx("path",{d:"M3 4h3v3H3zM4 7v1.5a1.5 1.5 0 01-1.5 1.5M9 4h3v3H9zM10 7v1.5a1.5 1.5 0 01-1.5 1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),bookmark:o.jsx("path",{d:"M4 2h8v12l-4-3-4 3V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),chart:o.jsx("path",{d:"M2 13h12M3 11l3-4 3 2 4-5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),chat:o.jsx("path",{d:"M3 3h10v7H7l-3 3v-3H3V3z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),pdf:o.jsx("path",{d:"M5 2h5l3 3v9H5V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),copy:o.jsx("path",{d:"M5 5h7v8H5V5zM3 3h7v2M3 3v8h2",stroke:"currentColor",strokeWidth:"1.2",fill:"none",strokeLinejoin:"round"}),sparkle:o.jsx("path",{d:"M8 2l1.2 3.8L13 7l-3.8 1.2L8 12l-1.2-3.8L3 7l3.8-1.2L8 2z",fill:"currentColor"}),user:o.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM2 14c0-3 2.5-5 6-5s6 2 6 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),globe:o.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM1.5 8h13M8 1.5c1.7 1.9 2.6 4.2 2.6 6.5s-.9 4.6-2.6 6.5M8 1.5C6.3 3.4 5.4 5.7 5.4 8s.9 4.6 2.6 6.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none",strokeLinecap:"round"}),menu:o.jsx("path",{d:"M2 4h12M2 8h12M2 12h12",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),close:o.jsx("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),pencil:o.jsx("path",{d:"M10.5 2.5l3 3L6 13H3v-3l7.5-7.5zM9 4l3 3",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})};return o.jsx("svg",{className:r===11?"icon-sm":"icon",viewBox:"0 0 16 16",width:r,height:r,children:e[t]})};export{s as I}; +import{j as o}from"./index-DyXq7-Tg.js";const s=({name:t,size:r=14})=>{const e={search:o.jsx("path",{d:"M11 11l3 3M7 12.5a5.5 5.5 0 110-11 5.5 5.5 0 010 11z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),arrowUp:o.jsx("path",{d:"M8 3l5 6H3l5-6z",fill:"currentColor"}),arrowLeft:o.jsx("path",{d:"M9 3l-4 5 4 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),arrowRight:o.jsx("path",{d:"M7 3l4 5-4 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),external:o.jsx("path",{d:"M5 3h-2v8h8v-2M9 3h3v3M7 9l5-5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),github:o.jsx("path",{d:"M8 1a7 7 0 00-2.21 13.64c.35.06.48-.15.48-.34v-1.2c-1.95.42-2.36-.94-2.36-.94-.32-.81-.78-1.03-.78-1.03-.64-.43.05-.43.05-.43.7.05 1.07.72 1.07.72.62 1.07 1.64.76 2.04.58.06-.45.24-.76.44-.94-1.55-.18-3.18-.78-3.18-3.46 0-.76.27-1.39.72-1.88-.07-.18-.31-.89.07-1.86 0 0 .59-.19 1.92.72.56-.15 1.16-.23 1.75-.24.59 0 1.19.08 1.75.24 1.33-.9 1.92-.72 1.92-.72.38.97.14 1.68.07 1.86.45.49.72 1.12.72 1.88 0 2.69-1.64 3.28-3.19 3.45.25.22.48.65.48 1.32v1.95c0 .19.13.41.49.34A7 7 0 008 1z",fill:"currentColor"}),citation:o.jsx("path",{d:"M3 4h3v3H3zM4 7v1.5a1.5 1.5 0 01-1.5 1.5M9 4h3v3H9zM10 7v1.5a1.5 1.5 0 01-1.5 1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),bookmark:o.jsx("path",{d:"M4 2h8v12l-4-3-4 3V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),chart:o.jsx("path",{d:"M2 13h12M3 11l3-4 3 2 4-5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}),chat:o.jsx("path",{d:"M3 3h10v7H7l-3 3v-3H3V3z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),pdf:o.jsx("path",{d:"M5 2h5l3 3v9H5V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),copy:o.jsx("path",{d:"M5 5h7v8H5V5zM3 3h7v2M3 3v8h2",stroke:"currentColor",strokeWidth:"1.2",fill:"none",strokeLinejoin:"round"}),sparkle:o.jsx("path",{d:"M8 2l1.2 3.8L13 7l-3.8 1.2L8 12l-1.2-3.8L3 7l3.8-1.2L8 2z",fill:"currentColor"}),user:o.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM2 14c0-3 2.5-5 6-5s6 2 6 5",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),globe:o.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM1.5 8h13M8 1.5c1.7 1.9 2.6 4.2 2.6 6.5s-.9 4.6-2.6 6.5M8 1.5C6.3 3.4 5.4 5.7 5.4 8s.9 4.6 2.6 6.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none",strokeLinecap:"round"}),menu:o.jsx("path",{d:"M2 4h12M2 8h12M2 12h12",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),close:o.jsx("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),pencil:o.jsx("path",{d:"M10.5 2.5l3 3L6 13H3v-3l7.5-7.5zM9 4l3 3",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})};return o.jsx("svg",{className:r===11?"icon-sm":"icon",viewBox:"0 0 16 16",width:r,height:r,children:e[t]})};export{s as I}; diff --git a/assets/LatexTitle-Z-HGmZ-H.js b/assets/LatexTitle-Bkyz3jCs.js similarity index 98% rename from assets/LatexTitle-Z-HGmZ-H.js rename to assets/LatexTitle-Bkyz3jCs.js index ad7abde39989cd7cacfd60fab8aa956cf5ab9e3f..88477725882c04b51cf553c54cf3c51c5b9afa50 100644 --- a/assets/LatexTitle-Z-HGmZ-H.js +++ b/assets/LatexTitle-Bkyz3jCs.js @@ -1,2 +1,2 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/katex-wklAmtGL.css"])))=>i.map(i=>d[i]); -import{j as u,r as A,a1 as L}from"./index-CbgxfyGU.js";let g=null,$=null;function M(){return $??($=Promise.all([L(()=>import("./katex-DkKDou_j.js"),[]),L(()=>Promise.resolve({}),__vite__mapDeps([0]))]).then(([n])=>(g=n.default,g))),$}const O=new Set([",",";",":","!"," ","quad","qquad","enspace","thinspace"]),S={a:"á",e:"é",i:"í",o:"ó",u:"ú",y:"ý",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú",Y:"Ý"},b={a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"},w={a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"},k={a:"ä",e:"ë",i:"ï",o:"ö",u:"ü",y:"ÿ",A:"Ä",E:"Ë",I:"Ï",O:"Ö",U:"Ü",Y:"Ÿ"},N={"'":S,"`":b,"^":w,'"':k,"~":{n:"ñ",N:"Ñ"}},T={ss:"ß",ae:"æ",AE:"Æ",oe:"œ",OE:"Œ",o:"ø",O:"Ø",l:"ł",L:"Ł"};function I(n,i){var e;return((e=N[n])==null?void 0:e[i])??null}function v(n){const i=[];let e=0,t="";const r=()=>{t&&(i.push({type:"text",content:t}),t="")};for(;e=n.length)return{name:"",end:e};if(!/[a-zA-Z]/.test(n[e]))return{name:n[e],end:e+1};const t=e;for(;e=n.length)return null;if(n[i+1]==="{"){const t=d(n,i+1);return t?{end:t.end}:null}return/[A-Za-z0-9+\-=.]/.test(n[i+1])?{end:i+2}:null}function y(n,i){let e=i;if(n[e]==="\\"){const{name:o,end:s}=j(n,e);if(!o)return null;if(e=s,n[e]==="{"){const a=d(n,e);a&&(e=a.end)}}else if(/[A-Za-z0-9]/.test(n[e])){let o=e+1;for(;oe.length-i.length)}function X(n,i,e){const t=z(i);if(!t.length)return[n];const r=t.map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),o=new RegExp(`(${r.join("|")})`,"gi");return n.split(o).filter(Boolean).map((s,a)=>t.some(p=>p.toLocaleLowerCase()===s.toLocaleLowerCase())?u.jsx("mark",{children:s},`${e}-mark-${a}`):s)}function m(n,i,e){const t=[];let r=0,o=0;const s=()=>`${i}-${o++}`,a=(p,f)=>p==="strong"?u.jsx("strong",{children:f},s()):u.jsx("em",{children:f},s());for(;rr&&t.push(...X(n.slice(r,f),e,s())),r=f}return t}function _({latex:n,display:i}){const[e,t]=A.useState(g);A.useEffect(()=>{if(e)return;let o=!0;return M().then(s=>{o&&t(()=>s)}),()=>{o=!1}},[e]);const r=A.useMemo(()=>{if(e)try{return e.renderToString(n.trim(),{displayMode:i,throwOnError:!1})}catch{return null}},[e,n,i]);return r===void 0?u.jsx(u.Fragment,{children:n}):r?u.jsx("span",{className:i?"katex-display":void 0,dangerouslySetInnerHTML:{__html:r}}):u.jsx(u.Fragment,{children:i?`$$${n}$$`:`$${n}$`})}function D(n,i){const e=v(n),t=[];return e.forEach((r,o)=>{const s=`latex-${o}`;if(r.type==="text"){const a=m(r.content,s,i);a.length===1?t.push(a[0]):a.length>1&&t.push(u.jsx(A.Fragment,{children:a},s));return}if(r.type==="display"){t.push(u.jsx(_,{latex:r.content,display:!0},s));return}t.push(u.jsx(_,{latex:r.content,display:!1},s))}),t.length===1?t[0]:u.jsx(u.Fragment,{children:t})}const P=({text:n,className:i="",highlight:e})=>{const t=A.useMemo(()=>D(n,e),[n,e]);return u.jsx("span",{className:i,children:t})},Z=({title:n,className:i="",highlight:e})=>u.jsx(P,{text:n,className:i,highlight:e});export{Z as L,P as a}; +import{j as u,d as A,a7 as L}from"./index-DyXq7-Tg.js";let g=null,$=null;function M(){return $??($=Promise.all([L(()=>import("./katex-DkKDou_j.js"),[]),L(()=>Promise.resolve({}),__vite__mapDeps([0]))]).then(([n])=>(g=n.default,g))),$}const O=new Set([",",";",":","!"," ","quad","qquad","enspace","thinspace"]),S={a:"á",e:"é",i:"í",o:"ó",u:"ú",y:"ý",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú",Y:"Ý"},b={a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"},w={a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"},k={a:"ä",e:"ë",i:"ï",o:"ö",u:"ü",y:"ÿ",A:"Ä",E:"Ë",I:"Ï",O:"Ö",U:"Ü",Y:"Ÿ"},N={"'":S,"`":b,"^":w,'"':k,"~":{n:"ñ",N:"Ñ"}},T={ss:"ß",ae:"æ",AE:"Æ",oe:"œ",OE:"Œ",o:"ø",O:"Ø",l:"ł",L:"Ł"};function I(n,i){var e;return((e=N[n])==null?void 0:e[i])??null}function v(n){const i=[];let e=0,t="";const r=()=>{t&&(i.push({type:"text",content:t}),t="")};for(;e=n.length)return{name:"",end:e};if(!/[a-zA-Z]/.test(n[e]))return{name:n[e],end:e+1};const t=e;for(;e=n.length)return null;if(n[i+1]==="{"){const t=d(n,i+1);return t?{end:t.end}:null}return/[A-Za-z0-9+\-=.]/.test(n[i+1])?{end:i+2}:null}function y(n,i){let e=i;if(n[e]==="\\"){const{name:o,end:s}=j(n,e);if(!o)return null;if(e=s,n[e]==="{"){const a=d(n,e);a&&(e=a.end)}}else if(/[A-Za-z0-9]/.test(n[e])){let o=e+1;for(;oe.length-i.length)}function X(n,i,e){const t=z(i);if(!t.length)return[n];const r=t.map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),o=new RegExp(`(${r.join("|")})`,"gi");return n.split(o).filter(Boolean).map((s,a)=>t.some(p=>p.toLocaleLowerCase()===s.toLocaleLowerCase())?u.jsx("mark",{children:s},`${e}-mark-${a}`):s)}function m(n,i,e){const t=[];let r=0,o=0;const s=()=>`${i}-${o++}`,a=(p,f)=>p==="strong"?u.jsx("strong",{children:f},s()):u.jsx("em",{children:f},s());for(;rr&&t.push(...X(n.slice(r,f),e,s())),r=f}return t}function _({latex:n,display:i}){const[e,t]=A.useState(g);A.useEffect(()=>{if(e)return;let o=!0;return M().then(s=>{o&&t(()=>s)}),()=>{o=!1}},[e]);const r=A.useMemo(()=>{if(e)try{return e.renderToString(n.trim(),{displayMode:i,throwOnError:!1})}catch{return null}},[e,n,i]);return r===void 0?u.jsx(u.Fragment,{children:n}):r?u.jsx("span",{className:i?"katex-display":void 0,dangerouslySetInnerHTML:{__html:r}}):u.jsx(u.Fragment,{children:i?`$$${n}$$`:`$${n}$`})}function D(n,i){const e=v(n),t=[];return e.forEach((r,o)=>{const s=`latex-${o}`;if(r.type==="text"){const a=m(r.content,s,i);a.length===1?t.push(a[0]):a.length>1&&t.push(u.jsx(A.Fragment,{children:a},s));return}if(r.type==="display"){t.push(u.jsx(_,{latex:r.content,display:!0},s));return}t.push(u.jsx(_,{latex:r.content,display:!1},s))}),t.length===1?t[0]:u.jsx(u.Fragment,{children:t})}const P=({text:n,className:i="",highlight:e})=>{const t=A.useMemo(()=>D(n,e),[n,e]);return u.jsx("span",{className:i,children:t})},Z=({title:n,className:i="",highlight:e})=>u.jsx(P,{text:n,className:i,highlight:e});export{Z as L,P as a}; diff --git a/assets/MarkdownText-Bj-G_S-B.js b/assets/MarkdownText-CUzPoC9Y.js similarity index 53% rename from assets/MarkdownText-Bj-G_S-B.js rename to assets/MarkdownText-CUzPoC9Y.js index efb45890922d4bcd4897aa24f93336f022306504..50dee1fb800601183df594c3b0afd49c9afd143b 100644 --- a/assets/MarkdownText-Bj-G_S-B.js +++ b/assets/MarkdownText-CUzPoC9Y.js @@ -1 +1 @@ -import{o as c,j as s,L as u}from"./index-CbgxfyGU.js";/* empty css */import{r as p,a as m,P as d}from"./PaperPreviewLink-DZDNIh1g.js";import{M as h}from"./index-ZkEATkOr.js";import{r as f}from"./index-BH3yOoza.js";function w(e){return(e??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean)}const x=new Set(["paperswithcode.co","www.paperswithcode.co","localhost","127.0.0.1",...w(void 0)]),P=["/methods","/paper","/papers","/tasks","/benchmark","/conferences"];function k(e,a=window.location.origin){if(!e)return null;let t;if(e.startsWith("/"))t=e;else try{const n=new URL(e,a);if(!x.has(n.hostname))return null;t=`${n.pathname}${n.search}${n.hash}`}catch{return null}const r=t.split(/[?#]/,1)[0];return P.some(n=>r===n||r.startsWith(`${n}/`))?t:null}function I(e){const t=e.split(/[?#]/,1)[0].match(/^\/papers?\/([^/]+)$/);if(!t||t[1].includes("%"))return null;const r=t[1],n=/^\d{4}[.-]\d{4,5}(?:v\d+)?$/.test(r),o=/^[1-9]\d*$/.test(r);return!n&&!o?null:c(r)}const M=({text:e,className:a=""})=>s.jsx("div",{className:a,children:s.jsx(h,{remarkPlugins:[f,m],rehypePlugins:[p],components:{a:({href:t,children:r,node:n,...o})=>{const i=k(t);if(i){const l=I(i);return l?s.jsx(d,{routeId:l,to:i,...o,children:r}):s.jsx(u,{to:i,...o,children:r})}return s.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",...o,children:r})}},children:e})});export{M,k as r}; +import{w as c,j as o,L as u}from"./index-DyXq7-Tg.js";/* empty css */import{r as p,a as m,P as d}from"./PaperPreviewLink-CpCZSa8K.js";import{M as h}from"./index-mCi_y_l3.js";import{r as f}from"./index-2CvJmBVB.js";function w(e){return(e??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean)}const x=new Set(["paperswithcode.co","www.paperswithcode.co","localhost","127.0.0.1",...w(void 0)]),P=["/methods","/paper","/papers","/tasks","/benchmark","/conferences"];function k(e,a=window.location.origin){if(!e)return null;let t;if(e.startsWith("/"))t=e;else try{const n=new URL(e,a);if(!x.has(n.hostname))return null;t=`${n.pathname}${n.search}${n.hash}`}catch{return null}const r=t.split(/[?#]/,1)[0];return P.some(n=>r===n||r.startsWith(`${n}/`))?t:null}function I(e){const t=e.split(/[?#]/,1)[0].match(/^\/papers?\/([^/]+)$/);if(!t||t[1].includes("%"))return null;const r=t[1],n=/^\d{4}[.-]\d{4,5}(?:v\d+)?$/.test(r),s=/^[1-9]\d*$/.test(r);return!n&&!s?null:c(r)}const M=({text:e,className:a=""})=>o.jsx("div",{className:a,children:o.jsx(h,{remarkPlugins:[f,m],rehypePlugins:[p],components:{a:({href:t,children:r,node:n,...s})=>{const i=k(t);if(i){const l=I(i);return l?o.jsx(d,{routeId:l,to:i,...s,children:r}):o.jsx(u,{to:i,...s,children:r})}return o.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",...s,children:r})}},children:e})});export{M,k as r}; diff --git a/assets/McpShowcase-CMLfdJM2.js b/assets/McpShowcase-CLO4HLon.js similarity index 84% rename from assets/McpShowcase-CMLfdJM2.js rename to assets/McpShowcase-CLO4HLon.js index 917c6d35fe03a65897717b9bdb8cccba0228d05c..a6087b02db81df73ae3a4809b84cd8f749dcf175 100644 --- a/assets/McpShowcase-CMLfdJM2.js +++ b/assets/McpShowcase-CLO4HLon.js @@ -1 +1 @@ -import{j as e,L as t}from"./index-CbgxfyGU.js";import{A as a}from"./AgentLogos-BBl9UNVD.js";function n({className:s="",canNavigate:r}){return e.jsxs("div",{className:`sidebar-section sidebar-section-tools ${s}`.trim(),children:[e.jsx("div",{className:"sidebar-label",children:"Use PwC with your agent"}),e.jsxs(t,{to:"/mcp",className:"action-btn sidebar-tools-mcp",title:"Connect Claude, Codex, Cursor, or OpenCode to the PwC MCP server",onClick:o=>{r&&!r()&&o.preventDefault()},children:["MCP server",e.jsx(a,{})]}),e.jsxs("p",{className:"sidebar-tools-copy",children:["Search papers, benchmarks, and leaderboards from any MCP client, or from the terminal with the"," ",e.jsxs("a",{href:"https://github.com/huggingface/pwc-cli",target:"_blank",rel:"noreferrer",children:[e.jsx("code",{children:"pwc"})," CLI"]}),"."]})]})}export{n as M}; +import{j as e,L as t}from"./index-DyXq7-Tg.js";import{A as a}from"./AgentLogos-j-Qekw7T.js";function n({className:s="",canNavigate:r}){return e.jsxs("div",{className:`sidebar-section sidebar-section-tools ${s}`.trim(),children:[e.jsx("div",{className:"sidebar-label",children:"Use PwC with your agent"}),e.jsxs(t,{to:"/mcp",className:"action-btn sidebar-tools-mcp",title:"Connect Claude, Codex, Cursor, or OpenCode to the PwC MCP server",onClick:o=>{r&&!r()&&o.preventDefault()},children:["MCP server",e.jsx(a,{})]}),e.jsxs("p",{className:"sidebar-tools-copy",children:["Search papers, benchmarks, and leaderboards from any MCP client, or from the terminal with the"," ",e.jsxs("a",{href:"https://github.com/huggingface/pwc-cli",target:"_blank",rel:"noreferrer",children:[e.jsx("code",{children:"pwc"})," CLI"]}),"."]})]})}export{n as M}; diff --git a/assets/McpView-BrXaRo4V.js b/assets/McpView-BrXaRo4V.js deleted file mode 100644 index 5acc979e3494ecbf5e96b921509f4fecb6b5dc78..0000000000000000000000000000000000000000 --- a/assets/McpView-BrXaRo4V.js +++ /dev/null @@ -1,6 +0,0 @@ -import{n as b,M as h,j as e,C as x}from"./index-CbgxfyGU.js";import{u as j}from"./useQuery-Bx9s5-D2.js";import{f,D as g}from"./latexPlainText-DI8YEXVe.js";import{q as y}from"./queryOptions-C9woPjwX.js";import{G as v}from"./github-BYklgHDz.js";import{E as i}from"./external-link-DZIH4GGr.js";import{C as w}from"./copy-bzw7JVus.js";/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const k=b("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),m="https://paperswithcode.co/mcp",C="https://staging.paperswithcode.co/mcp";function u(s){const a=typeof window>"u"?void 0:window.location;return a?a.hostname==="staging.paperswithcode.co"?C:a.hostname==="paperswithcode.co"||a.hostname==="www.paperswithcode.co"?m:`${a.origin.replace(/\/$/,"")}/mcp`:m}function N(s){if(!s||typeof s!="object"||s.status!=="ok"||s.service!=="pwc-mcp"||typeof s.version!="string"||typeof s.protocol!="string")throw new Error("MCP health response is invalid");return s}async function P(s){const a=new AbortController,c=()=>a.abort();s==null||s.addEventListener("abort",c,{once:!0});const n=window.setTimeout(c,5e3);try{const t=await fetch(`${u()}/health`,{headers:{Accept:"application/json"},signal:a.signal,credentials:"omit"});if(!t.ok)throw new Error("MCP service is unavailable");return N(await t.json())}finally{window.clearTimeout(n),s==null||s.removeEventListener("abort",c)}}const _=()=>y({queryKey:["mcp","health"],queryFn:({signal:s})=>P(s),retry:!1,staleTime:3e4,refetchInterval:6e4,refetchOnWindowFocus:!1}),S=[["search_papers","Search by topic, title, author, or arXiv ID."],["list_papers","Filter and order papers by taxonomy, venue, date, or organization."],["get_paper_info","Read canonical metadata, authors, abstract, links, and resources."],["read_paper","Read stored paper Markdown with safe continuation for long papers."],["list_recent_papers","Browse the most recently indexed research."],["get_related_papers","Find related work already indexed in the catalogue."],["list_trending_papers","Discover papers with recent repository momentum."],["get_paper_evaluations","Inspect benchmark results reported by one paper."],["get_paper_lineage","Follow explicit predecessor and successor relationships."],["list_tasks","Search tasks and retrieve stable slugs for exact lookup."],["get_task","Inspect a research task and its benchmark coverage."],["list_methods","Search methods and retrieve stable slugs for exact lookup."],["get_method","Inspect a method, its source paper, and catalogue metadata."],["list_conferences","Browse conferences with imported papers."],["get_conference","Inspect one exact conference edition."],["list_organizations","Browse research organizations."],["get_organization","Inspect one exact research organization."],["list_frameworks","Browse frameworks by domain, category, or platform."],["get_framework","Inspect one exact research framework."],["list_benchmarks","Browse and filter benchmark leaderboards."],["get_benchmark","Read one benchmark, metrics, datasets, and leading results."]],T=["pwc://papers/{paper}","pwc://papers/{paper}/markdown","pwc://tasks/{task}","pwc://benchmarks/{benchmark}"],I=["Find recent papers on test-time compute and summarize the main approaches.","Compare the methods and reported benchmarks in these three arXiv papers.","What are the leading benchmarks for text-to-video generation?","Trace the predecessor and successor papers for Mamba."],d=[{key:"chatgpt",label:"ChatGPT",summary:"In workspace developer settings, add a custom MCP app and paste the server URL. Availability and admin approval vary by plan."},{key:"claude",label:"Claude",summary:"Open Settings → Connectors → Add custom connector, paste the URL, then enable Papers With Code from Search and tools."},{key:"claude-code",label:"Claude Code",summary:"Add the anonymous Streamable HTTP server from a terminal.",code:s=>`claude mcp add --transport http paperswithcode ${s}`},{key:"cursor",label:"Cursor",summary:"Add this entry to your project or user MCP configuration.",code:s=>JSON.stringify({mcpServers:{paperswithcode:{url:s}}},null,2)},{key:"vscode",label:"VS Code",summary:"Add this Streamable HTTP server to .vscode/mcp.json.",code:s=>JSON.stringify({servers:{paperswithcode:{type:"http",url:s}}},null,2)},{key:"generic",label:"Generic",summary:"Configure an anonymous, stateless Streamable HTTP server using the URL below. No API key or OAuth flow is required."}],l=({value:s,label:a})=>{const[c,n]=h.useState(!1),t=async()=>{var o;(o=navigator.clipboard)!=null&&o.writeText&&(await navigator.clipboard.writeText(s),n(!0),window.setTimeout(()=>n(!1),1500))};return e.jsxs("button",{className:"action-btn mcp-copy",type:"button",onClick:()=>void t(),"aria-label":a,children:[c?e.jsx(x,{size:16,"aria-hidden":!0}):e.jsx(w,{size:16,"aria-hidden":!0}),c?"Copied":"Copy"]})},U=()=>{var o;const s=u(),a=j(_()),[c,n]=h.useState("chatgpt"),t=d.find(r=>r.key===c)??d[0];return h.useEffect(()=>(document.title=f("MCP Server"),()=>{document.title=g}),[]),e.jsxs("article",{className:"page mcp-page",children:[e.jsxs("a",{className:"mcp-repo-banner",href:"https://github.com/huggingface/pwc-cli",target:"_blank",rel:"noreferrer",children:[e.jsx(v,{size:20,"aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("strong",{children:"huggingface/pwc-cli"}),e.jsxs("span",{children:["Open-source MCP server and ",e.jsx("code",{children:"pwc"})," command-line client"]})]}),e.jsxs("span",{className:"mcp-repo-cta",children:["View on GitHub ",e.jsx(k,{size:14,"aria-hidden":!0})]})]}),e.jsxs("header",{className:"mcp-hero",children:[e.jsxs("div",{children:[e.jsx("p",{className:"sidebar-label mcp-kicker",children:"Model Context Protocol"}),e.jsx("h1",{className:"feed-title",children:"Use Papers With Code in your AI assistant"}),e.jsx("p",{className:"mcp-lede",children:"Search research, inspect methods and benchmarks, and read complete papers through one anonymous, read-only MCP connection."}),e.jsxs("div",{className:"mcp-status","aria-live":"polite",children:[e.jsx("span",{className:a.isSuccess?"is-up":"is-unknown","aria-hidden":!0}),a.isSuccess?"Operational":"Status unavailable",a.data?` · v${a.data.version}`:""]})]}),e.jsxs("div",{className:"mcp-endpoint-card",children:[e.jsx("span",{children:"Remote MCP URL"}),e.jsx("code",{children:s}),e.jsx(l,{value:s,label:"Copy MCP server URL"})]})]}),e.jsxs("section",{className:"mcp-section","aria-labelledby":"mcp-connect",children:[e.jsxs("div",{className:"mcp-section-heading",children:[e.jsx("p",{className:"sidebar-label",children:"Connect"}),e.jsx("h2",{id:"mcp-connect",children:"One URL, your preferred client"}),e.jsx("span",{children:"Setup matrix reviewed September 13, 2026; staging qualification pending."})]}),e.jsx("div",{className:"mcp-client-tabs",role:"tablist","aria-label":"MCP client setup",children:d.map(r=>e.jsx("button",{type:"button",role:"tab","aria-selected":c===r.key,onClick:()=>n(r.key),children:r.label},r.key))}),e.jsxs("div",{className:"mcp-setup",role:"tabpanel",children:[e.jsx("p",{children:t.summary}),t.code?e.jsxs("div",{className:"mcp-code-row",children:[e.jsx("pre",{children:e.jsx("code",{children:t.code(s)})}),e.jsx(l,{value:t.code(s),label:`Copy ${t.label} setup`})]}):e.jsxs("div",{className:"mcp-code-row",children:[e.jsx("pre",{children:e.jsx("code",{children:s})}),e.jsx(l,{value:s,label:`Copy ${t.label} endpoint`})]})]})]}),e.jsxs("section",{className:"mcp-section","aria-labelledby":"mcp-capabilities",children:[e.jsxs("div",{className:"mcp-section-heading",children:[e.jsx("p",{className:"sidebar-label",children:"Capabilities"}),e.jsx("h2",{id:"mcp-capabilities",children:"Research context, structured for assistants"})]}),e.jsx("div",{className:"mcp-capability-grid",children:[["Discover","Search recent and established work with catalogue filters."],["Read","Continue through long stored papers without presenting a partial document as complete."],["Connect","Explore related work, paper lineage, tasks, and methods."],["Compare","Inspect benchmarks, datasets, metrics, and reported evaluations."]].map(([r,p])=>e.jsxs("div",{children:[e.jsx("h3",{children:r}),e.jsx("p",{children:p})]},r))})]}),e.jsxs("section",{className:"mcp-section","aria-labelledby":"mcp-tools",children:[e.jsxs("div",{className:"mcp-section-heading",children:[e.jsx("p",{className:"sidebar-label",children:"Catalogue"}),e.jsx("h2",{id:"mcp-tools",children:"Twenty-one focused, read-only tools"})]}),e.jsx("div",{className:"mcp-tool-grid",children:S.map(([r,p])=>e.jsxs("div",{className:"mcp-tool",children:[e.jsx("code",{children:r}),e.jsx("p",{children:p})]},r))}),e.jsx("h3",{className:"mcp-subheading",children:"Resource templates"}),e.jsx("div",{className:"mcp-resource-list",children:T.map(r=>e.jsx("code",{children:r},r))})]}),e.jsxs("section",{className:"mcp-section","aria-labelledby":"mcp-prompts",children:[e.jsxs("div",{className:"mcp-section-heading",children:[e.jsx("p",{className:"sidebar-label",children:"Try asking"}),e.jsx("h2",{id:"mcp-prompts",children:"Prompts that start useful research"})]}),e.jsx("div",{className:"mcp-prompt-list",children:I.map(r=>e.jsxs("div",{children:[e.jsx("p",{children:r}),e.jsx(l,{value:r,label:"Copy example prompt"})]},r))})]}),e.jsxs("section",{className:"mcp-section mcp-notes","aria-labelledby":"mcp-limits",children:[e.jsxs("div",{children:[e.jsx("p",{className:"sidebar-label mcp-kicker",children:"Limits & privacy"}),e.jsx("h2",{id:"mcp-limits",children:"Public by design"}),e.jsx("p",{children:"No account, API key, or write access. Fair-use limits are 60 total requests per minute, 10 semantic searches per minute, four concurrent requests per client, and 25 list results per call."}),e.jsx("p",{children:"MCP telemetry retains tool name, status, latency, response size, protocol, and server version—not prompts, paper IDs, cursors, resource URIs, raw IPs, authorization values, or bodies. Catalogue infrastructure has its own operational logging policy."})]}),e.jsxs("div",{children:[e.jsx("p",{className:"sidebar-label mcp-kicker",children:"Protocol & troubleshooting"}),e.jsx("h2",{children:"Streamable HTTP"}),e.jsxs("p",{children:["Primary protocol: ",((o=a.data)==null?void 0:o.protocol)??"verified during connection setup",". If setup fails, confirm your client supports remote Streamable HTTP, that custom servers are enabled by your workspace administrator, and that you pasted the URL exactly."]}),e.jsxs("nav",{className:"mcp-links","aria-label":"MCP documentation links",children:[e.jsxs("a",{href:"https://github.com/huggingface/pwc-cli",target:"_blank",rel:"noreferrer",children:["CLI repository ",e.jsx(i,{size:13})]}),e.jsxs("a",{href:"https://modelcontextprotocol.io/docs/2026-07-28/learn/server-concepts",target:"_blank",rel:"noreferrer",children:["MCP specification ",e.jsx(i,{size:13})]}),e.jsxs("a",{href:"/docs",target:"_blank",rel:"noreferrer",children:["Public API ",e.jsx(i,{size:13})]}),e.jsxs("a",{href:"/mcp/schema",target:"_blank",rel:"noreferrer",children:["MCP tool schema ",e.jsx(i,{size:13})]}),e.jsxs("a",{href:"/llms.txt",target:"_blank",rel:"noreferrer",children:["llms.txt ",e.jsx(i,{size:13})]})]})]})]})]})};export{U as default}; diff --git a/assets/McpView-DYa6GKrp.js b/assets/McpView-DYa6GKrp.js new file mode 100644 index 0000000000000000000000000000000000000000..37c6fa2c1f9b0aeae0f216b5ded9f1eb9c87a749 --- /dev/null +++ b/assets/McpView-DYa6GKrp.js @@ -0,0 +1,6 @@ +import{s as b,b as x,V as m,j as e,C as j}from"./index-DyXq7-Tg.js";import{u as g,f as y}from"./useDocumentTitle-DcxM2Zv_.js";import{q as f}from"./queryOptions-C9woPjwX.js";import{G as v}from"./github-RNrgGHRT.js";import{E as o}from"./external-link-orY1Xz1I.js";import{C as w}from"./copy-CxR0OKx2.js";/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const k=b("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),h="https://paperswithcode.co/mcp",C="https://staging.paperswithcode.co/mcp";function u(s){const a=typeof window>"u"?void 0:window.location;return a?a.hostname==="staging.paperswithcode.co"?C:a.hostname==="paperswithcode.co"||a.hostname==="www.paperswithcode.co"?h:`${a.origin.replace(/\/$/,"")}/mcp`:h}function N(s){if(!s||typeof s!="object"||s.status!=="ok"||s.service!=="pwc-mcp"||typeof s.version!="string"||typeof s.protocol!="string")throw new Error("MCP health response is invalid");return s}async function P(s){const a=new AbortController,c=()=>a.abort();s==null||s.addEventListener("abort",c,{once:!0});const n=window.setTimeout(c,5e3);try{const t=await fetch(`${u()}/health`,{headers:{Accept:"application/json"},signal:a.signal,credentials:"omit"});if(!t.ok)throw new Error("MCP service is unavailable");return N(await t.json())}finally{window.clearTimeout(n),s==null||s.removeEventListener("abort",c)}}const _=()=>f({queryKey:["mcp","health"],queryFn:({signal:s})=>P(s),retry:!1,staleTime:3e4,refetchInterval:6e4}),S=[["search_papers","Search by topic, title, author, or arXiv ID."],["list_papers","Filter and order papers by taxonomy, venue, date, or organization."],["get_paper_info","Read canonical metadata, authors, abstract, links, and resources."],["read_paper","Read stored paper Markdown with safe continuation for long papers."],["list_recent_papers","Browse the most recently indexed research."],["get_related_papers","Find related work already indexed in the catalogue."],["list_trending_papers","Discover papers with recent repository momentum."],["get_paper_evaluations","Inspect benchmark results reported by one paper."],["get_paper_lineage","Follow explicit predecessor and successor relationships."],["list_tasks","Search tasks and retrieve stable slugs for exact lookup."],["get_task","Inspect a research task and its benchmark coverage."],["list_methods","Search methods and retrieve stable slugs for exact lookup."],["get_method","Inspect a method, its source paper, and catalogue metadata."],["list_conferences","Browse conferences with imported papers."],["get_conference","Inspect one exact conference edition."],["list_organizations","Browse research organizations."],["get_organization","Inspect one exact research organization."],["list_frameworks","Browse frameworks by domain, category, or platform."],["get_framework","Inspect one exact research framework."],["list_benchmarks","Browse and filter benchmark leaderboards."],["get_benchmark","Read one benchmark, metrics, datasets, and leading results."]],T=["pwc://papers/{paper}","pwc://papers/{paper}/markdown","pwc://tasks/{task}","pwc://benchmarks/{benchmark}"],I=["Find recent papers on test-time compute and summarize the main approaches.","Compare the methods and reported benchmarks in these three arXiv papers.","What are the leading benchmarks for text-to-video generation?","Trace the predecessor and successor papers for Mamba."],d=[{key:"chatgpt",label:"ChatGPT",summary:"In workspace developer settings, add a custom MCP app and paste the server URL. Availability and admin approval vary by plan."},{key:"claude",label:"Claude",summary:"Open Settings → Connectors → Add custom connector, paste the URL, then enable Papers With Code from Search and tools."},{key:"claude-code",label:"Claude Code",summary:"Add the anonymous Streamable HTTP server from a terminal.",code:s=>`claude mcp add --transport http paperswithcode ${s}`},{key:"cursor",label:"Cursor",summary:"Add this entry to your project or user MCP configuration.",code:s=>JSON.stringify({mcpServers:{paperswithcode:{url:s}}},null,2)},{key:"vscode",label:"VS Code",summary:"Add this Streamable HTTP server to .vscode/mcp.json.",code:s=>JSON.stringify({servers:{paperswithcode:{type:"http",url:s}}},null,2)},{key:"generic",label:"Generic",summary:"Configure an anonymous, stateless Streamable HTTP server using the URL below. No API key or OAuth flow is required."}],l=({value:s,label:a})=>{const[c,n]=m.useState(!1),t=async()=>{var i;(i=navigator.clipboard)!=null&&i.writeText&&(await navigator.clipboard.writeText(s),n(!0),window.setTimeout(()=>n(!1),1500))};return e.jsxs("button",{className:"action-btn mcp-copy",type:"button",onClick:()=>void t(),"aria-label":a,children:[c?e.jsx(j,{size:16,"aria-hidden":!0}):e.jsx(w,{size:16,"aria-hidden":!0}),c?"Copied":"Copy"]})},O=()=>{var i;const s=u(),a=x(_()),[c,n]=m.useState("chatgpt"),t=d.find(r=>r.key===c)??d[0];return g(y("MCP Server")),e.jsxs("article",{className:"page mcp-page",children:[e.jsxs("a",{className:"mcp-repo-banner",href:"https://github.com/huggingface/pwc-cli",target:"_blank",rel:"noreferrer",children:[e.jsx(v,{size:20,"aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("strong",{children:"huggingface/pwc-cli"}),e.jsxs("span",{children:["Open-source MCP server and ",e.jsx("code",{children:"pwc"})," command-line client"]})]}),e.jsxs("span",{className:"mcp-repo-cta",children:["View on GitHub ",e.jsx(k,{size:14,"aria-hidden":!0})]})]}),e.jsxs("header",{className:"mcp-hero",children:[e.jsxs("div",{children:[e.jsx("p",{className:"sidebar-label mcp-kicker",children:"Model Context Protocol"}),e.jsx("h1",{className:"feed-title",children:"Use Papers With Code in your AI assistant"}),e.jsx("p",{className:"mcp-lede",children:"Search research, inspect methods and benchmarks, and read complete papers through one anonymous, read-only MCP connection."}),e.jsxs("div",{className:"mcp-status","aria-live":"polite",children:[e.jsx("span",{className:a.isSuccess?"is-up":"is-unknown","aria-hidden":!0}),a.isSuccess?"Operational":"Status unavailable",a.data?` · v${a.data.version}`:""]})]}),e.jsxs("div",{className:"mcp-endpoint-card",children:[e.jsx("span",{children:"Remote MCP URL"}),e.jsx("code",{children:s}),e.jsx(l,{value:s,label:"Copy MCP server URL"})]})]}),e.jsxs("section",{className:"mcp-section","aria-labelledby":"mcp-connect",children:[e.jsxs("div",{className:"mcp-section-heading",children:[e.jsx("p",{className:"sidebar-label",children:"Connect"}),e.jsx("h2",{id:"mcp-connect",children:"One URL, your preferred client"}),e.jsx("span",{children:"Setup matrix reviewed September 13, 2026; staging qualification pending."})]}),e.jsx("div",{className:"mcp-client-tabs",role:"tablist","aria-label":"MCP client setup",children:d.map(r=>e.jsx("button",{type:"button",role:"tab","aria-selected":c===r.key,onClick:()=>n(r.key),children:r.label},r.key))}),e.jsxs("div",{className:"mcp-setup",role:"tabpanel",children:[e.jsx("p",{children:t.summary}),t.code?e.jsxs("div",{className:"mcp-code-row",children:[e.jsx("pre",{children:e.jsx("code",{children:t.code(s)})}),e.jsx(l,{value:t.code(s),label:`Copy ${t.label} setup`})]}):e.jsxs("div",{className:"mcp-code-row",children:[e.jsx("pre",{children:e.jsx("code",{children:s})}),e.jsx(l,{value:s,label:`Copy ${t.label} endpoint`})]})]})]}),e.jsxs("section",{className:"mcp-section","aria-labelledby":"mcp-capabilities",children:[e.jsxs("div",{className:"mcp-section-heading",children:[e.jsx("p",{className:"sidebar-label",children:"Capabilities"}),e.jsx("h2",{id:"mcp-capabilities",children:"Research context, structured for assistants"})]}),e.jsx("div",{className:"mcp-capability-grid",children:[["Discover","Search recent and established work with catalogue filters."],["Read","Continue through long stored papers without presenting a partial document as complete."],["Connect","Explore related work, paper lineage, tasks, and methods."],["Compare","Inspect benchmarks, datasets, metrics, and reported evaluations."]].map(([r,p])=>e.jsxs("div",{children:[e.jsx("h3",{children:r}),e.jsx("p",{children:p})]},r))})]}),e.jsxs("section",{className:"mcp-section","aria-labelledby":"mcp-tools",children:[e.jsxs("div",{className:"mcp-section-heading",children:[e.jsx("p",{className:"sidebar-label",children:"Catalogue"}),e.jsx("h2",{id:"mcp-tools",children:"Twenty-one focused, read-only tools"})]}),e.jsx("div",{className:"mcp-tool-grid",children:S.map(([r,p])=>e.jsxs("div",{className:"mcp-tool",children:[e.jsx("code",{children:r}),e.jsx("p",{children:p})]},r))}),e.jsx("h3",{className:"mcp-subheading",children:"Resource templates"}),e.jsx("div",{className:"mcp-resource-list",children:T.map(r=>e.jsx("code",{children:r},r))})]}),e.jsxs("section",{className:"mcp-section","aria-labelledby":"mcp-prompts",children:[e.jsxs("div",{className:"mcp-section-heading",children:[e.jsx("p",{className:"sidebar-label",children:"Try asking"}),e.jsx("h2",{id:"mcp-prompts",children:"Prompts that start useful research"})]}),e.jsx("div",{className:"mcp-prompt-list",children:I.map(r=>e.jsxs("div",{children:[e.jsx("p",{children:r}),e.jsx(l,{value:r,label:"Copy example prompt"})]},r))})]}),e.jsxs("section",{className:"mcp-section mcp-notes","aria-labelledby":"mcp-limits",children:[e.jsxs("div",{children:[e.jsx("p",{className:"sidebar-label mcp-kicker",children:"Limits & privacy"}),e.jsx("h2",{id:"mcp-limits",children:"Public by design"}),e.jsx("p",{children:"No account, API key, or write access. Fair-use limits are 60 total requests per minute, 10 semantic searches per minute, four concurrent requests per client, and 25 list results per call."}),e.jsx("p",{children:"MCP telemetry retains tool name, status, latency, response size, protocol, and server version—not prompts, paper IDs, cursors, resource URIs, raw IPs, authorization values, or bodies. Catalogue infrastructure has its own operational logging policy."})]}),e.jsxs("div",{children:[e.jsx("p",{className:"sidebar-label mcp-kicker",children:"Protocol & troubleshooting"}),e.jsx("h2",{children:"Streamable HTTP"}),e.jsxs("p",{children:["Primary protocol: ",((i=a.data)==null?void 0:i.protocol)??"verified during connection setup",". If setup fails, confirm your client supports remote Streamable HTTP, that custom servers are enabled by your workspace administrator, and that you pasted the URL exactly."]}),e.jsxs("nav",{className:"mcp-links","aria-label":"MCP documentation links",children:[e.jsxs("a",{href:"https://github.com/huggingface/pwc-cli",target:"_blank",rel:"noreferrer",children:["CLI repository ",e.jsx(o,{size:13})]}),e.jsxs("a",{href:"https://modelcontextprotocol.io/docs/2026-07-28/learn/server-concepts",target:"_blank",rel:"noreferrer",children:["MCP specification ",e.jsx(o,{size:13})]}),e.jsxs("a",{href:"/docs",target:"_blank",rel:"noreferrer",children:["Public API ",e.jsx(o,{size:13})]}),e.jsxs("a",{href:"/mcp/schema",target:"_blank",rel:"noreferrer",children:["MCP tool schema ",e.jsx(o,{size:13})]}),e.jsxs("a",{href:"/llms.txt",target:"_blank",rel:"noreferrer",children:["llms.txt ",e.jsx(o,{size:13})]})]})]})]})]})};export{O as default}; diff --git a/assets/MethodDetailView-5wFkSBs8.js b/assets/MethodDetailView-5wFkSBs8.js new file mode 100644 index 0000000000000000000000000000000000000000..bdef4b2d2df54ea7a4ecdd9e981d42ed8ad65700 --- /dev/null +++ b/assets/MethodDetailView-5wFkSBs8.js @@ -0,0 +1 @@ +import{j as e,d as I,u as P,b as k,p as V,L as _,o as A,T as v}from"./index-DyXq7-Tg.js";import{R as H}from"./ResearchFollowButton-Dv316ClR.js";import{M as Q}from"./SotaBadges-vbLLOUtT.js";import{u as q,b as K,a as R}from"./PaperFeed-EBt97iOL.js";import{r as G,M as L}from"./MarkdownText-CUzPoC9Y.js";import{c as b}from"./catalog-CRar2olQ.js";import{p as U}from"./papers-Dh3ljlL0.js";import{i as O}from"./apiErrors-BSvbQBb0.js";import{s as W}from"./slug-BpH-Nkvz.js";import{t as Z}from"./transform-D46m70Qr.js";import{u as X}from"./usePapers-B0s20UcU.js";import{S as N}from"./skeleton-C3IIzpSL.js";import{A as Y,a as J}from"./alert-gbJBhAVE.js";import{s as ee}from"./safeExternalHref-CkBrsh84.js";import te from"./NotFound-DV_nwcxG.js";import"./researchTopic-DbX0eko-.js";import"./useMutation-UWxBeqtn.js";import"./plus-Yh42pKZz.js";import"./colors-BkWRhvFI.js";import"./PaperCard-57p1OSGy.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./Icon-T4LYkEQj.js";import"./LatexTitle-Bkyz3jCs.js";import"./popover-CTBEUp7Y.js";import"./useIntersectionObserver-D6_Iig9a.js";/* empty css */import"./PaperPreviewLink-CpCZSa8K.js";import"./index-mCi_y_l3.js";import"./index-2CvJmBVB.js";import"./katex-DkKDou_j.js";import"./hover-card-B45EJIn_.js";import"./curation-YeS7FBYf.js";import"./useInfiniteQuery-BYh2zN-T.js";const t={pink:"#F8D7D9",pinkS:"#D9B0B3",yellow:"#FBEFC2",yellowS:"#C9B97D",orange:"#F8D7B3",orangeS:"#C99466",blue:"#CDE2EE",blueS:"#7FA4BA",purple:"#D4D2EA",purpleS:"#8E8AC0",green:"#CCE2C5",greenS:"#7DA475",ink:"#1A1814",faint:"#8E8678"},n=({x:s,y:r,w:l,h:d,fill:o,stroke:p,label:h,fontSize:c=10})=>e.jsxs("g",{children:[e.jsx("rect",{x:s,y:r,width:l,height:d,rx:"3",ry:"3",fill:o,stroke:p,strokeWidth:"1"}),e.jsx("text",{x:s+l/2,y:r+d/2,fontSize:c,fontFamily:"var(--sans)",fill:t.ink,textAnchor:"middle",dominantBaseline:"middle",children:h})]}),se=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.faint,textAnchor:"middle",children:"Scaled Dot-Product Attention"}),e.jsx(n,{x:140,y:40,w:80,h:26,fill:t.yellow,stroke:t.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M180 66 L180 80",stroke:t.ink}),e.jsx(n,{x:140,y:80,w:80,h:26,fill:t.green,stroke:t.greenS,label:"SoftMax",fontSize:11}),e.jsx("path",{d:"M180 106 L180 120",stroke:t.ink}),e.jsx(n,{x:140,y:120,w:80,h:26,fill:t.purple,stroke:t.purpleS,label:"Mask (opt.)",fontSize:11}),e.jsx("path",{d:"M180 146 L180 160",stroke:t.ink}),e.jsx(n,{x:140,y:160,w:80,h:26,fill:t.blue,stroke:t.blueS,label:"Scale ÷√dₖ",fontSize:11}),e.jsx("path",{d:"M180 186 L180 200",stroke:t.ink}),e.jsx(n,{x:140,y:200,w:80,h:26,fill:t.yellow,stroke:t.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M156 226 L120 270",stroke:t.ink}),e.jsx("path",{d:"M180 226 L180 270",stroke:t.ink}),e.jsx("path",{d:"M204 226 L240 270",stroke:t.ink}),e.jsx(n,{x:100,y:270,w:40,h:24,fill:t.pink,stroke:t.pinkS,label:"Q",fontSize:13}),e.jsx(n,{x:160,y:270,w:40,h:24,fill:t.pink,stroke:t.pinkS,label:"K",fontSize:13}),e.jsx(n,{x:220,y:270,w:40,h:24,fill:t.pink,stroke:t.pinkS,label:"V",fontSize:13}),e.jsxs("text",{x:"180",y:"330",fontSize:"14",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.ink,textAnchor:"middle",children:["softmax(QK",e.jsx("tspan",{fontSize:"9",baselineShift:"super",children:"⊤"})," / √d) V"]})]}),ae=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.faint,textAnchor:"middle",children:"Contrastive learning"}),e.jsx(n,{x:120,y:40,w:120,h:26,fill:t.blue,stroke:t.blueS,label:"Input x",fontSize:11}),e.jsx("path",{d:"M180 66 V76 M90 76 H270 M90 76 V88 M270 76 V88",stroke:t.ink}),e.jsx(n,{x:35,y:88,w:110,h:26,fill:t.yellow,stroke:t.yellowS,label:"Augment t₁",fontSize:11}),e.jsx(n,{x:215,y:88,w:110,h:26,fill:t.yellow,stroke:t.yellowS,label:"Augment t₂",fontSize:11}),e.jsx("path",{d:"M90 114 V138 M270 114 V138",stroke:t.ink}),e.jsx(n,{x:35,y:138,w:110,h:26,fill:t.orange,stroke:t.orangeS,label:"Encoder f",fontSize:11}),e.jsx(n,{x:215,y:138,w:110,h:26,fill:t.orange,stroke:t.orangeS,label:"Encoder f",fontSize:11}),e.jsx("text",{x:"180",y:"155",fontSize:"9",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.faint,textAnchor:"middle",children:"shared weights"}),e.jsx("path",{d:"M90 164 V188 M270 164 V188",stroke:t.ink}),e.jsx(n,{x:35,y:188,w:110,h:26,fill:t.purple,stroke:t.purpleS,label:"Projection g",fontSize:11}),e.jsx(n,{x:215,y:188,w:110,h:26,fill:t.purple,stroke:t.purpleS,label:"Projection g",fontSize:11}),e.jsx("path",{d:"M90 214 V238 M270 214 V238",stroke:t.ink}),e.jsx(n,{x:35,y:238,w:110,h:26,fill:t.pink,stroke:t.pinkS,label:"z₁",fontSize:13}),e.jsx(n,{x:215,y:238,w:110,h:26,fill:t.pink,stroke:t.pinkS,label:"z₂",fontSize:13}),e.jsx("path",{d:"M145 251 H215",stroke:t.greenS,strokeWidth:"1.5",strokeDasharray:"4 3"}),e.jsx("text",{x:"180",y:"244",fontSize:"9",fontFamily:"var(--sans)",fill:t.greenS,textAnchor:"middle",children:"attract"}),e.jsx("text",{x:"180",y:"318",fontSize:"12",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.ink,textAnchor:"middle",children:"Positive pair: pull together"}),e.jsx("text",{x:"180",y:"336",fontSize:"12",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.ink,textAnchor:"middle",children:"Other samples: push apart"}),e.jsx("text",{x:"180",y:"370",fontSize:"11",fontFamily:"var(--serif)",fill:t.faint,textAnchor:"middle",children:"InfoNCE: maximize sim(z₁, z₂) / τ"})]}),re=[["my-skill/",""],["├── SKILL.md","# Required: metadata + instructions"],["├── scripts/","# Optional: executable code"],["├── references/","# Optional: documentation"],["├── assets/","# Optional: templates, resources"],["└── ...","# Any additional files or directories"]],le=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.faint,textAnchor:"middle",children:"Skill package layout"}),e.jsx("rect",{x:"28",y:"48",width:"304",height:"318",rx:"8",fill:"#FFFDF8",stroke:t.faint,strokeWidth:"1"}),re.map(([s,r],l)=>{const d=92+l*44;return e.jsxs("g",{children:[e.jsx("text",{x:"44",y:d,fontSize:"11",fontFamily:"var(--mono)",fill:t.ink,dominantBaseline:"middle",children:s}),r?e.jsx("text",{x:"138",y:d,fontSize:"8.5",fontFamily:"var(--mono)",fill:t.faint,dominantBaseline:"middle",children:r}):null]},s)})]}),ie={attention:se,"contrastive-learning":ae,"agent-skills":le},ne=({method:s})=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.faint,textAnchor:"middle",children:s.name||"method"}),e.jsx(n,{x:80,y:70,w:200,h:50,fill:t.blue,stroke:t.blueS,label:"Input",fontSize:12}),e.jsx("path",{d:"M180 120 L180 150",stroke:t.ink}),e.jsx(n,{x:80,y:150,w:200,h:70,fill:t.orange,stroke:t.orangeS,label:s.name||"transform",fontSize:13}),e.jsx("path",{d:"M180 220 L180 250",stroke:t.ink}),e.jsx(n,{x:80,y:250,w:200,h:50,fill:t.purple,stroke:t.purpleS,label:"Output",fontSize:12})]}),oe=({method:s})=>{const r=(s.slug||"").toLowerCase(),l=ie[r];if(l)return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(l,{})});if(s.image_url){const d=r==="transformer"||r==="gpt-4"||r==="gpt-4o"||r==="multi-head-attention"?" method-figure-svg--compact":r==="rpn"?" method-figure-svg--scaled-80":"";return e.jsx("div",{className:`method-figure-svg method-figure-svg--image${d}`,children:e.jsx("img",{className:"method-figure-img",src:s.image_url,alt:`${s.name} figure`})})}return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(ne,{method:s})})},w=720,M=138,x={top:8,right:10,bottom:25,left:36},E=56,ce=new Intl.DateTimeFormat("en",{month:"short",year:"2-digit",timeZone:"UTC"}),de=new Intl.DateTimeFormat("en",{year:"numeric",timeZone:"UTC"}),F=s=>ce.format(new Date(`${s}T00:00:00Z`)),me=(s,r)=>{if(s===0)return new Set;const l=s>48?12:s>36?6:s>18?3:2,d=Math.max(1,Math.ceil(E/r)),o=Math.max(l,d),p=s-1,h=new Set([0,p]);for(let c=o;c=E&&h.add(c);return h},T=s=>{if(s.coverage_status===void 0||["complete","not_applicable"].includes(s.coverage_status))return null;const r=s.processed_paper_count!==void 0&&s.eligible_paper_count!==void 0?`; ${s.processed_paper_count.toLocaleString()} of ${s.eligible_paper_count.toLocaleString()} eligible papers processed`:"";return`Historical tagging ${s.coverage_status==="failed"?"needs retry":"in progress"}${r}`},he=({history:s,methodName:r})=>{const[l,d]=I.useState(null),o=Math.max(1,...s.map(i=>i.paper_count)),p=w-x.left-x.right,h=M-x.top-x.bottom,c=s.length?p/s.length:p,a=Math.max(2,c*.68),g=me(s.length,c),j=Array.from(new Set([0,Math.ceil(o/2),o])),f=l==null?null:s[l],y=f?T(f):null;return e.jsxs("div",{className:"method-usage-chart-wrap",children:[e.jsxs("svg",{className:"method-usage-chart",viewBox:`0 0 ${w} ${M}`,role:"group","aria-label":`${r}: papers mentioning this method by publication month`,children:[e.jsxs("title",{children:[r,": papers mentioning this method by publication month"]}),j.map(i=>{const m=x.top+h-i/o*h;return e.jsxs("g",{children:[e.jsx("line",{className:"method-usage-gridline",x1:x.left,x2:w-x.right,y1:m,y2:m}),e.jsx("text",{className:"method-usage-y-label",x:x.left-8,y:m+3,textAnchor:"end",children:i})]},i)}),s.map((i,m)=>{const u=i.paper_count/o*h,S=i.paper_count>0?Math.max(1,u):0,C=x.left+c*m+(c-a)/2,D=x.top+h-S,$=l===m,B=m===s.length-1,z=T(i);return e.jsxs("g",{className:`method-usage-bar${$?" is-active":""}${B?" is-current":""}`,tabIndex:0,role:"img","aria-label":`${F(i.start_date)}: ${i.paper_count} ${i.paper_count===1?"paper":"papers"}${z?`. ${z}`:""}`,onMouseEnter:()=>d(m),onMouseLeave:()=>d(null),onFocus:()=>d(m),onBlur:()=>d(null),children:[e.jsx("rect",{className:"method-usage-bar-hit",x:x.left+c*m,y:x.top,width:c,height:h}),e.jsx("rect",{className:"method-usage-bar-mark",x:C,y:D,width:a,height:S,rx:"1.5"})]},i.start_date)}),s.map((i,m)=>g.has(m)?e.jsx("text",{className:"method-usage-x-label",x:x.left+c*(m+.5),y:M-11,textAnchor:"middle",children:s.length>48?de.format(new Date(`${i.start_date}T00:00:00Z`)):F(i.start_date)},i.start_date):null)]}),f&&e.jsxs("div",{className:"method-usage-tooltip",role:"status",children:[e.jsx("strong",{children:F(f.start_date)}),e.jsxs("span",{children:[f.paper_count," ",f.paper_count===1?"paper":"papers",l===s.length-1?" · month to date":""]}),e.jsxs("span",{children:[(f.catalog_share??0).toFixed(2),"% of"," ",(f.catalog_paper_count??0).toLocaleString()," catalog papers"]}),y&&e.jsx("span",{children:y})]})]})},Ge=()=>{var y,i,m;const{methodSlug:s}=P(),r=q(),l=k({queryKey:A.method(s),queryFn:()=>b.getMethod(s),enabled:!!s,staleTime:v}),d=k({queryKey:A.areas,queryFn:()=>b.listAreas({page_size:50,ordering:"name"}),enabled:!!((y=l.data)!=null&&y.area_id),staleTime:v}),o=k({queryKey:["method-trend",s],queryFn:()=>b.methodTrend(s),enabled:!!s,staleTime:v}),p=X([...V.feeds.method,s,r.filters],u=>U.forMethod(s,{...r.filters,page:u,page_size:20,repository_limit:1}),{enabled:!!s}),h=k({queryKey:["related-methods",s],queryFn:()=>b.relatedMethods(s),enabled:!!s,staleTime:v}),c=I.useMemo(()=>{var u;return((u=p.data)==null?void 0:u.pages.flatMap(S=>S.results.map(Z)))??[]},[p.data]);if(l.isLoading)return e.jsxs("div",{className:"page",children:[e.jsx(N,{className:"h-12 w-1/2 mb-4"}),e.jsx(N,{className:"h-64 w-full"})]});if(O(l.error))return e.jsx(te,{});if(l.error||!l.data)return e.jsx("div",{className:"page",children:e.jsx(Y,{variant:"destructive",children:e.jsx(J,{children:"Method not found."})})});const a=l.data,g=(i=d.data)==null?void 0:i.results.find(u=>u.id===a.area_id),j=G(a.source_url),f=j?null:ee(a.source_url);return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(_,{to:"/methods",children:"Methods"}),g&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(_,{to:`/methods#area-${W(g.name)}`,children:g.name})]}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:a.name})]}),e.jsxs("div",{className:`tag-hero method-hero-grid${a.slug==="grokking"||a.slug==="latent-reasoning"||a.slug==="world-action-models"?" method-hero-grid--wide-figure":""}`,children:[e.jsxs("div",{children:[e.jsx("div",{className:"tag-hero-eyebrow",children:"METHOD"}),e.jsx("h1",{className:"tag-hero-title method-hero-title",children:a.name}),e.jsx(H,{kind:"method",entityId:a.id}),a.full_name&&!a.name.includes(a.full_name)&&e.jsx("div",{style:{fontFamily:"var(--serif)",fontSize:16,fontStyle:"italic",color:"var(--ink-soft)",marginTop:8},children:a.full_name}),a.description&&e.jsx(L,{className:"method-description",text:a.description}),a.source_url&&a.source_title&&e.jsxs("div",{className:"method-source",children:[e.jsx("span",{className:"method-source-label",children:"Source"}),j?e.jsxs(_,{className:"method-source-link",to:j,target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]}):f?e.jsxs("a",{className:"method-source-link",href:f,target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]}):e.jsxs("div",{className:"method-source-link is-static",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]})]}),e.jsxs("div",{className:"tag-hero-meta",children:[e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Papers mentioning"}),e.jsx("span",{className:"value",children:(a.paper_count??0).toLocaleString()})]}),o.data&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Recent mentions"}),e.jsxs("span",{className:"value",children:[(o.data.recent_paper_count*30/o.data.recent_days).toFixed(1),e.jsx("small",{children:"/mo"})]}),!o.data.comparison_complete&&e.jsx("span",{title:"Tagging is still catching up. This rate reflects mentions found so far.",children:"Partial coverage"})]}),a.introduced_year!=null&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Introduced"}),e.jsx("span",{className:"value",children:a.introduced_year})]})]}),o.isLoading?e.jsx(N,{className:"h-36 w-full method-trend-skeleton"}):o.data?e.jsxs("section",{className:"method-trend-panel method-trend-panel--compact",children:[e.jsxs("div",{className:"method-trend-header",children:[e.jsx("div",{children:e.jsx("div",{className:"method-trend-eyebrow",children:"Usage trend"})}),e.jsxs("div",{className:"method-trend-summary",children:[e.jsx("strong",{children:o.data.recent_paper_count}),e.jsxs("span",{children:["papers / ",o.data.recent_days,"d"]})]})]}),e.jsx(he,{history:o.data.history,methodName:a.name})]}):null]}),e.jsxs("figure",{className:"method-figure-card",children:[e.jsx(oe,{method:a}),a.image_credit&&e.jsx("figcaption",{children:e.jsx(L,{className:"method-image-credit",text:a.image_credit})})]})]}),(((m=h.data)==null?void 0:m.results.length)??0)>0&&e.jsxs("div",{className:"filter-row",children:[e.jsx("span",{className:"label",children:"Related methods"}),h.data.results.map(u=>e.jsx(Q,{method:{slug:u.slug,name:u.name}},u.id))]}),e.jsx(K,{feed:r,children:e.jsxs("div",{className:"results-count",children:[c.length," papers mentioning ",a.name]})}),e.jsx(R,{query:p,cards:c,empty:"No papers tagged with this method yet."})]})};export{Ge as default}; diff --git a/assets/MethodDetailView-CEUGGyVV.js b/assets/MethodDetailView-CEUGGyVV.js deleted file mode 100644 index fe7e4e0176a730101650113bd6033ff18344e1f3..0000000000000000000000000000000000000000 --- a/assets/MethodDetailView-CEUGGyVV.js +++ /dev/null @@ -1 +0,0 @@ -import{j as e,r as E,u as $,L as b}from"./index-CbgxfyGU.js";import{R as B}from"./ResearchFollowButton-D2BXlDtQ.js";import{p as P,a as V}from"./paperQueryKeys-B8u1BWlI.js";import{u as k}from"./useQuery-Bx9s5-D2.js";import{M as H}from"./SotaBadges-C-sTR-EF.js";import{u as q,b as Q,a as K}from"./PaperFeed-DMvUfA47.js";import{r as R,M as z}from"./MarkdownText-Bj-G_S-B.js";import{c as v}from"./catalog-DhK7_9-6.js";import{i as G}from"./apiErrors-BZ5h1Kmb.js";import{s as O}from"./slug-BpH-Nkvz.js";import{t as U}from"./transform-0Udg2p6b.js";import{u as W}from"./usePapers-CJaWLZ3y.js";import{S as _}from"./skeleton-HwvdxvSN.js";import{A as Z,a as X}from"./alert-CFDDvdIM.js";import{s as Y}from"./safeExternalHref-CkBrsh84.js";import J from"./NotFound-DtzwOULp.js";import"./useMutation-P_trTy9i.js";import"./research-DgpyzSy_.js";import"./plus-UK0TEjgd.js";import"./curation-C7Gmmp4z.js";import"./colors-BkWRhvFI.js";import"./PaperCard-tdTC_dRN.js";import"./AuthorAvatar-CUJMmp_z.js";import"./Icon-D-kA0Owz.js";import"./LatexTitle-Z-HGmZ-H.js";import"./popover-DKJYnYjk.js";import"./useIntersectionObserver-CID9Kkak.js";/* empty css */import"./PaperPreviewLink-DZDNIh1g.js";import"./index-ZkEATkOr.js";import"./index-BH3yOoza.js";import"./katex-DkKDou_j.js";import"./hover-card-ufez2uMo.js";import"./useInfiniteQuery-BAc_4HO5.js";const t={pink:"#F8D7D9",pinkS:"#D9B0B3",yellow:"#FBEFC2",yellowS:"#C9B97D",orange:"#F8D7B3",orangeS:"#C99466",blue:"#CDE2EE",blueS:"#7FA4BA",purple:"#D4D2EA",purpleS:"#8E8AC0",green:"#CCE2C5",greenS:"#7DA475",ink:"#1A1814",faint:"#8E8678"},n=({x:s,y:r,w:l,h:d,fill:o,stroke:p,label:h,fontSize:c=10})=>e.jsxs("g",{children:[e.jsx("rect",{x:s,y:r,width:l,height:d,rx:"3",ry:"3",fill:o,stroke:p,strokeWidth:"1"}),e.jsx("text",{x:s+l/2,y:r+d/2,fontSize:c,fontFamily:"var(--sans)",fill:t.ink,textAnchor:"middle",dominantBaseline:"middle",children:h})]}),ee=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.faint,textAnchor:"middle",children:"Scaled Dot-Product Attention"}),e.jsx(n,{x:140,y:40,w:80,h:26,fill:t.yellow,stroke:t.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M180 66 L180 80",stroke:t.ink}),e.jsx(n,{x:140,y:80,w:80,h:26,fill:t.green,stroke:t.greenS,label:"SoftMax",fontSize:11}),e.jsx("path",{d:"M180 106 L180 120",stroke:t.ink}),e.jsx(n,{x:140,y:120,w:80,h:26,fill:t.purple,stroke:t.purpleS,label:"Mask (opt.)",fontSize:11}),e.jsx("path",{d:"M180 146 L180 160",stroke:t.ink}),e.jsx(n,{x:140,y:160,w:80,h:26,fill:t.blue,stroke:t.blueS,label:"Scale ÷√dₖ",fontSize:11}),e.jsx("path",{d:"M180 186 L180 200",stroke:t.ink}),e.jsx(n,{x:140,y:200,w:80,h:26,fill:t.yellow,stroke:t.yellowS,label:"MatMul",fontSize:11}),e.jsx("path",{d:"M156 226 L120 270",stroke:t.ink}),e.jsx("path",{d:"M180 226 L180 270",stroke:t.ink}),e.jsx("path",{d:"M204 226 L240 270",stroke:t.ink}),e.jsx(n,{x:100,y:270,w:40,h:24,fill:t.pink,stroke:t.pinkS,label:"Q",fontSize:13}),e.jsx(n,{x:160,y:270,w:40,h:24,fill:t.pink,stroke:t.pinkS,label:"K",fontSize:13}),e.jsx(n,{x:220,y:270,w:40,h:24,fill:t.pink,stroke:t.pinkS,label:"V",fontSize:13}),e.jsxs("text",{x:"180",y:"330",fontSize:"14",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.ink,textAnchor:"middle",children:["softmax(QK",e.jsx("tspan",{fontSize:"9",baselineShift:"super",children:"⊤"})," / √d) V"]})]}),te=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.faint,textAnchor:"middle",children:"Contrastive learning"}),e.jsx(n,{x:120,y:40,w:120,h:26,fill:t.blue,stroke:t.blueS,label:"Input x",fontSize:11}),e.jsx("path",{d:"M180 66 V76 M90 76 H270 M90 76 V88 M270 76 V88",stroke:t.ink}),e.jsx(n,{x:35,y:88,w:110,h:26,fill:t.yellow,stroke:t.yellowS,label:"Augment t₁",fontSize:11}),e.jsx(n,{x:215,y:88,w:110,h:26,fill:t.yellow,stroke:t.yellowS,label:"Augment t₂",fontSize:11}),e.jsx("path",{d:"M90 114 V138 M270 114 V138",stroke:t.ink}),e.jsx(n,{x:35,y:138,w:110,h:26,fill:t.orange,stroke:t.orangeS,label:"Encoder f",fontSize:11}),e.jsx(n,{x:215,y:138,w:110,h:26,fill:t.orange,stroke:t.orangeS,label:"Encoder f",fontSize:11}),e.jsx("text",{x:"180",y:"155",fontSize:"9",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.faint,textAnchor:"middle",children:"shared weights"}),e.jsx("path",{d:"M90 164 V188 M270 164 V188",stroke:t.ink}),e.jsx(n,{x:35,y:188,w:110,h:26,fill:t.purple,stroke:t.purpleS,label:"Projection g",fontSize:11}),e.jsx(n,{x:215,y:188,w:110,h:26,fill:t.purple,stroke:t.purpleS,label:"Projection g",fontSize:11}),e.jsx("path",{d:"M90 214 V238 M270 214 V238",stroke:t.ink}),e.jsx(n,{x:35,y:238,w:110,h:26,fill:t.pink,stroke:t.pinkS,label:"z₁",fontSize:13}),e.jsx(n,{x:215,y:238,w:110,h:26,fill:t.pink,stroke:t.pinkS,label:"z₂",fontSize:13}),e.jsx("path",{d:"M145 251 H215",stroke:t.greenS,strokeWidth:"1.5",strokeDasharray:"4 3"}),e.jsx("text",{x:"180",y:"244",fontSize:"9",fontFamily:"var(--sans)",fill:t.greenS,textAnchor:"middle",children:"attract"}),e.jsx("text",{x:"180",y:"318",fontSize:"12",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.ink,textAnchor:"middle",children:"Positive pair: pull together"}),e.jsx("text",{x:"180",y:"336",fontSize:"12",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.ink,textAnchor:"middle",children:"Other samples: push apart"}),e.jsx("text",{x:"180",y:"370",fontSize:"11",fontFamily:"var(--serif)",fill:t.faint,textAnchor:"middle",children:"InfoNCE: maximize sim(z₁, z₂) / τ"})]}),se=[["my-skill/",""],["├── SKILL.md","# Required: metadata + instructions"],["├── scripts/","# Optional: executable code"],["├── references/","# Optional: documentation"],["├── assets/","# Optional: templates, resources"],["└── ...","# Any additional files or directories"]],ae=()=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",style:{display:"block"},children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.faint,textAnchor:"middle",children:"Skill package layout"}),e.jsx("rect",{x:"28",y:"48",width:"304",height:"318",rx:"8",fill:"#FFFDF8",stroke:t.faint,strokeWidth:"1"}),se.map(([s,r],l)=>{const d=92+l*44;return e.jsxs("g",{children:[e.jsx("text",{x:"44",y:d,fontSize:"11",fontFamily:"var(--mono)",fill:t.ink,dominantBaseline:"middle",children:s}),r?e.jsx("text",{x:"138",y:d,fontSize:"8.5",fontFamily:"var(--mono)",fill:t.faint,dominantBaseline:"middle",children:r}):null]},s)})]}),re={attention:ee,"contrastive-learning":te,"agent-skills":ae},le=({method:s})=>e.jsxs("svg",{viewBox:"0 0 360 420",width:"100%",height:"100%",children:[e.jsx("text",{x:"180",y:"20",fontSize:"11",fontFamily:"var(--serif)",fontStyle:"italic",fill:t.faint,textAnchor:"middle",children:s.name||"method"}),e.jsx(n,{x:80,y:70,w:200,h:50,fill:t.blue,stroke:t.blueS,label:"Input",fontSize:12}),e.jsx("path",{d:"M180 120 L180 150",stroke:t.ink}),e.jsx(n,{x:80,y:150,w:200,h:70,fill:t.orange,stroke:t.orangeS,label:s.name||"transform",fontSize:13}),e.jsx("path",{d:"M180 220 L180 250",stroke:t.ink}),e.jsx(n,{x:80,y:250,w:200,h:50,fill:t.purple,stroke:t.purpleS,label:"Output",fontSize:12})]}),ie=({method:s})=>{const r=(s.slug||"").toLowerCase(),l=re[r];if(l)return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(l,{})});if(s.image_url){const d=r==="transformer"||r==="gpt-4"||r==="gpt-4o"||r==="multi-head-attention"?" method-figure-svg--compact":r==="rpn"?" method-figure-svg--scaled-80":"";return e.jsx("div",{className:`method-figure-svg method-figure-svg--image${d}`,children:e.jsx("img",{className:"method-figure-img",src:s.image_url,alt:`${s.name} figure`})})}return e.jsx("div",{className:"method-figure-svg method-figure-svg--schematic",children:e.jsx(le,{method:s})})},N=720,w=138,x={top:8,right:10,bottom:25,left:36},A=56,ne=new Intl.DateTimeFormat("en",{month:"short",year:"2-digit",timeZone:"UTC"}),oe=new Intl.DateTimeFormat("en",{year:"numeric",timeZone:"UTC"}),M=s=>ne.format(new Date(`${s}T00:00:00Z`)),ce=(s,r)=>{if(s===0)return new Set;const l=s>48?12:s>36?6:s>18?3:2,d=Math.max(1,Math.ceil(A/r)),o=Math.max(l,d),p=s-1,h=new Set([0,p]);for(let c=o;c=A&&h.add(c);return h},L=s=>{if(s.coverage_status===void 0||["complete","not_applicable"].includes(s.coverage_status))return null;const r=s.processed_paper_count!==void 0&&s.eligible_paper_count!==void 0?`; ${s.processed_paper_count.toLocaleString()} of ${s.eligible_paper_count.toLocaleString()} eligible papers processed`:"";return`Historical tagging ${s.coverage_status==="failed"?"needs retry":"in progress"}${r}`},de=({history:s,methodName:r})=>{const[l,d]=E.useState(null),o=Math.max(1,...s.map(i=>i.paper_count)),p=N-x.left-x.right,h=w-x.top-x.bottom,c=s.length?p/s.length:p,a=Math.max(2,c*.68),g=ce(s.length,c),j=Array.from(new Set([0,Math.ceil(o/2),o])),f=l==null?null:s[l],y=f?L(f):null;return e.jsxs("div",{className:"method-usage-chart-wrap",children:[e.jsxs("svg",{className:"method-usage-chart",viewBox:`0 0 ${N} ${w}`,role:"group","aria-label":`${r}: papers mentioning this method by publication month`,children:[e.jsxs("title",{children:[r,": papers mentioning this method by publication month"]}),j.map(i=>{const m=x.top+h-i/o*h;return e.jsxs("g",{children:[e.jsx("line",{className:"method-usage-gridline",x1:x.left,x2:N-x.right,y1:m,y2:m}),e.jsx("text",{className:"method-usage-y-label",x:x.left-8,y:m+3,textAnchor:"end",children:i})]},i)}),s.map((i,m)=>{const u=i.paper_count/o*h,S=i.paper_count>0?Math.max(1,u):0,I=x.left+c*m+(c-a)/2,C=x.top+h-S,D=l===m,T=m===s.length-1,F=L(i);return e.jsxs("g",{className:`method-usage-bar${D?" is-active":""}${T?" is-current":""}`,tabIndex:0,role:"img","aria-label":`${M(i.start_date)}: ${i.paper_count} ${i.paper_count===1?"paper":"papers"}${F?`. ${F}`:""}`,onMouseEnter:()=>d(m),onMouseLeave:()=>d(null),onFocus:()=>d(m),onBlur:()=>d(null),children:[e.jsx("rect",{className:"method-usage-bar-hit",x:x.left+c*m,y:x.top,width:c,height:h}),e.jsx("rect",{className:"method-usage-bar-mark",x:I,y:C,width:a,height:S,rx:"1.5"})]},i.start_date)}),s.map((i,m)=>g.has(m)?e.jsx("text",{className:"method-usage-x-label",x:x.left+c*(m+.5),y:w-11,textAnchor:"middle",children:s.length>48?oe.format(new Date(`${i.start_date}T00:00:00Z`)):M(i.start_date)},i.start_date):null)]}),f&&e.jsxs("div",{className:"method-usage-tooltip",role:"status",children:[e.jsx("strong",{children:M(f.start_date)}),e.jsxs("span",{children:[f.paper_count," ",f.paper_count===1?"paper":"papers",l===s.length-1?" · month to date":""]}),e.jsxs("span",{children:[(f.catalog_share??0).toFixed(2),"% of"," ",(f.catalog_paper_count??0).toLocaleString()," catalog papers"]}),y&&e.jsx("span",{children:y})]})]})},Re=()=>{var y,i,m;const{methodSlug:s}=$(),r=q(),l=k({queryKey:["method",s],queryFn:()=>v.getMethod(s),enabled:!!s,staleTime:10*60*1e3}),d=k({queryKey:["areas-all"],queryFn:()=>v.listAreas({page_size:50,ordering:"name"}),enabled:!!((y=l.data)!=null&&y.area_id),staleTime:10*60*1e3}),o=k({queryKey:["method-trend",s],queryFn:()=>v.methodTrend(s),enabled:!!s,staleTime:10*60*1e3}),p=W([...P.feeds.method,s,r.filters],u=>V.forMethod(s,{...r.filters,page:u,page_size:20,repository_limit:1}),{enabled:!!s}),h=k({queryKey:["related-methods",s],queryFn:()=>v.relatedMethods(s),enabled:!!s,staleTime:10*60*1e3}),c=E.useMemo(()=>{var u;return((u=p.data)==null?void 0:u.pages.flatMap(S=>S.results.map(U)))??[]},[p.data]);if(l.isLoading)return e.jsxs("div",{className:"page",children:[e.jsx(_,{className:"h-12 w-1/2 mb-4"}),e.jsx(_,{className:"h-64 w-full"})]});if(G(l.error))return e.jsx(J,{});if(l.error||!l.data)return e.jsx("div",{className:"page",children:e.jsx(Z,{variant:"destructive",children:e.jsx(X,{children:"Method not found."})})});const a=l.data,g=(i=d.data)==null?void 0:i.results.find(u=>u.id===a.area_id),j=R(a.source_url),f=j?null:Y(a.source_url);return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(b,{to:"/methods",children:"Methods"}),g&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(b,{to:`/methods#area-${O(g.name)}`,children:g.name})]}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:a.name})]}),e.jsxs("div",{className:`tag-hero method-hero-grid${a.slug==="grokking"||a.slug==="latent-reasoning"||a.slug==="world-action-models"?" method-hero-grid--wide-figure":""}`,children:[e.jsxs("div",{children:[e.jsx("div",{className:"tag-hero-eyebrow",children:"METHOD"}),e.jsx("h1",{className:"tag-hero-title method-hero-title",children:a.name}),e.jsx(B,{kind:"method",entityId:a.id}),a.full_name&&!a.name.includes(a.full_name)&&e.jsx("div",{style:{fontFamily:"var(--serif)",fontSize:16,fontStyle:"italic",color:"var(--ink-soft)",marginTop:8},children:a.full_name}),a.description&&e.jsx(z,{className:"method-description",text:a.description}),a.source_url&&a.source_title&&e.jsxs("div",{className:"method-source",children:[e.jsx("span",{className:"method-source-label",children:"Source"}),j?e.jsxs(b,{className:"method-source-link",to:j,target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]}):f?e.jsxs("a",{className:"method-source-link",href:f,target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]}):e.jsxs("div",{className:"method-source-link is-static",children:[e.jsx("span",{className:"method-source-title",children:a.source_title}),a.introduced_year&&e.jsx("span",{className:"method-source-meta",children:a.introduced_year})]})]}),e.jsxs("div",{className:"tag-hero-meta",children:[e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Papers mentioning"}),e.jsx("span",{className:"value",children:(a.paper_count??0).toLocaleString()})]}),o.data&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Recent mentions"}),e.jsxs("span",{className:"value",children:[(o.data.recent_paper_count*30/o.data.recent_days).toFixed(1),e.jsx("small",{children:"/mo"})]}),!o.data.comparison_complete&&e.jsx("span",{title:"Tagging is still catching up. This rate reflects mentions found so far.",children:"Partial coverage"})]}),a.introduced_year!=null&&e.jsxs("div",{className:"stat",children:[e.jsx("span",{className:"label",children:"Introduced"}),e.jsx("span",{className:"value",children:a.introduced_year})]})]}),o.isLoading?e.jsx(_,{className:"h-36 w-full method-trend-skeleton"}):o.data?e.jsxs("section",{className:"method-trend-panel method-trend-panel--compact",children:[e.jsxs("div",{className:"method-trend-header",children:[e.jsx("div",{children:e.jsx("div",{className:"method-trend-eyebrow",children:"Usage trend"})}),e.jsxs("div",{className:"method-trend-summary",children:[e.jsx("strong",{children:o.data.recent_paper_count}),e.jsxs("span",{children:["papers / ",o.data.recent_days,"d"]})]})]}),e.jsx(de,{history:o.data.history,methodName:a.name})]}):null]}),e.jsxs("figure",{className:"method-figure-card",children:[e.jsx(ie,{method:a}),a.image_credit&&e.jsx("figcaption",{children:e.jsx(z,{className:"method-image-credit",text:a.image_credit})})]})]}),(((m=h.data)==null?void 0:m.results.length)??0)>0&&e.jsxs("div",{className:"filter-row",children:[e.jsx("span",{className:"label",children:"Related methods"}),h.data.results.map(u=>e.jsx(H,{method:{slug:u.slug,name:u.name}},u.id))]}),e.jsx(Q,{feed:r,children:e.jsxs("div",{className:"results-count",children:[c.length," papers mentioning ",a.name]})}),e.jsx(K,{query:p,cards:c,empty:"No papers tagged with this method yet."})]})};export{Re as default}; diff --git a/assets/MethodsIndexView-DYp0dUSa.js b/assets/MethodsIndexView-DYp0dUSa.js deleted file mode 100644 index 21f5f2e1d6cf552052158f8c35fd128c0faa1ae6..0000000000000000000000000000000000000000 --- a/assets/MethodsIndexView-DYp0dUSa.js +++ /dev/null @@ -1,6 +0,0 @@ -import{n as y,r as c,j as s,L as f}from"./index-CbgxfyGU.js";import{u as l}from"./useQuery-Bx9s5-D2.js";import{c as m}from"./catalog-DhK7_9-6.js";import{s as _}from"./areas-Dvi8w2dp.js";import{s as v}from"./slug-BpH-Nkvz.js";import{A as N,a as L}from"./alert-CFDDvdIM.js";import{A as T,a as A}from"./AreaSection-NWvfO4Sb.js";import{T as F}from"./TaxonomySuggestionTile-DIw_GKfA.js";import{u as M,T as q}from"./useHashScrollOnReady-DgB3XFQL.js";import"./skeleton-HwvdxvSN.js";import"./SignInToEditDialog-CNIcNqbK.js";import"./button-Bv9oZ-QU.js";import"./input-B6pxtfPe.js";import"./textarea-Bf06GTSH.js";import"./searchable-select-DNdBIahG.js";import"./popover-DKJYnYjk.js";import"./dialog-Cfp_d3CC.js";import"./search-CLtAJGOp.js";import"./loader-circle-CWMja8Zn.js";import"./useMutation-P_trTy9i.js";import"./submissions-aWj7YtuZ.js";import"./plus-UK0TEjgd.js";import"./trending-up-B3K5RlyX.js";/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const S=y("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]),Z=()=>{var p,u,h;const n=l({queryKey:["areas-all"],queryFn:()=>m.listAreas({page_size:50,ordering:"name"}),staleTime:6e5}),i=l({queryKey:["methods-all"],queryFn:async()=>(await m.methodIndex()).results,staleTime:10*60*1e3}),o=l({queryKey:["trending-methods-directory"],queryFn:()=>m.trendingMethods({limit:12}),staleTime:10*60*1e3}),x=c.useMemo(()=>{var t,a;const r=new Map((((t=n.data)==null?void 0:t.results)??[]).map(e=>[e.id,e.name]));return(a=o.data)==null?void 0:a.results.map(e=>({id:e.id,name:e.name,href:`/methods/${e.slug||e.id}`,areaName:e.area_id?r.get(e.area_id):void 0,recentPaperCount:e.recent_paper_count,shareLift:e.share_lift}))},[o.data,n.data]),d=c.useMemo(()=>{if(!i.data||!n.data)return null;const r={};return i.data.forEach(t=>{const a=t.area_id??"_unassigned";(r[a]||(r[a]=[])).push(t)}),Object.values(r).forEach(t=>t.sort((a,e)=>(e.trend_score||0)-(a.trend_score||0)||(e.paper_count||0)-(a.paper_count||0)||a.name.localeCompare(e.name))),r},[i.data,n.data]),g=c.useMemo(()=>{const r=(i.data||[]).filter(a=>(a.trend_score||0)>0).sort((a,e)=>(e.trend_score||0)-(a.trend_score||0)),t=Math.ceil(r.length*.25);return new Set(r.slice(0,t).map(a=>a.id))},[i.data]);return M(!!n.data&&!!i.data&&!o.isLoading),n.error||i.error?s.jsx("div",{className:"page",children:s.jsx(N,{variant:"destructive",children:s.jsx(L,{children:"Failed to load methods."})})}):s.jsxs("div",{className:"page",children:[s.jsx("div",{className:"feed-header",children:s.jsxs("div",{children:[s.jsxs("h1",{className:"feed-title",children:["Methods ",s.jsx("em",{children:"library"})]}),s.jsx("div",{className:"feed-subtitle",children:"Common techniques used across AI research. Trend scores show papers using each method per 30 days, measured over the latest 90 days; the flame marks the top quartile."})]})}),s.jsx(q,{noun:"method",items:x,recentDays:(p=o.data)==null?void 0:p.recent_days,baselineDays:(u=o.data)==null?void 0:u.baseline_days,isLoading:o.isLoading,error:o.error,mono:!0}),n.isLoading||i.isLoading?s.jsx(T,{tiles:8,tileClassName:"h-20"}):_(((h=n.data)==null?void 0:h.results)??[]).map(r=>{const t=(d==null?void 0:d[r.id])||[];if(t.length===0)return null;const a=t.reduce((e,j)=>e+(j.paper_count||0),0);return s.jsxs(A,{id:`area-${v(r.name)}`,title:r.name,meta:`${t.length} methods · ${a.toLocaleString()} papers`,children:[t.map(e=>s.jsxs(f,{to:`/methods/${e.slug||e.id}`,className:"tag-cell",children:[s.jsxs("div",{className:"name",style:{fontFamily:"var(--mono)",fontSize:15},children:[e.name,g.has(e.id)&&s.jsx(S,{className:"method-trending-icon",size:15,"aria-label":"Top quartile by recent method mentions"})]}),s.jsxs("div",{className:"meta",children:[s.jsxs("span",{children:[(e.paper_count??0).toLocaleString()," papers"]}),(e.trend_score??0)>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsxs("span",{className:"method-trend-score",children:[(e.trend_score??0).toFixed(1),"/mo"]})]}),e.introduced_year!=null&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsx("span",{children:e.introduced_year})]})]})]},e.id)),s.jsx(F,{kind:"method"})]},r.id)})]})};export{Z as default}; diff --git a/assets/MethodsIndexView-D_aKGLyJ.js b/assets/MethodsIndexView-D_aKGLyJ.js new file mode 100644 index 0000000000000000000000000000000000000000..3aac10389922d100e08442f233e6835c25532502 --- /dev/null +++ b/assets/MethodsIndexView-D_aKGLyJ.js @@ -0,0 +1,6 @@ +import{s as f,b as c,d as l,j as s,L as _,o as N,T as m}from"./index-DyXq7-Tg.js";import{c as p}from"./catalog-CRar2olQ.js";import{s as T}from"./areas-Dvi8w2dp.js";import{s as v}from"./slug-BpH-Nkvz.js";import{A as L,a as M}from"./alert-gbJBhAVE.js";import{A,a as F}from"./AreaSection-BxnKzNK0.js";import{T as q}from"./TaxonomySuggestionTile-jIiLMp4q.js";import{u as S,T as I}from"./useHashScrollOnReady-D5UCCQuT.js";import"./skeleton-C3IIzpSL.js";import"./SignInToEditDialog-B-oWVno5.js";import"./button-DZeAbOf2.js";import"./input-DJqCAbs7.js";import"./textarea-DPixlM5U.js";import"./searchable-select-DiDLwvbI.js";import"./popover-CTBEUp7Y.js";import"./dialog-CfM0Uql2.js";import"./search-8ssWDP68.js";import"./loader-circle-C75KLEgx.js";import"./useMutation-UWxBeqtn.js";import"./submissions-Cz_J-Ha2.js";import"./plus-Yh42pKZz.js";import"./trending-up-OM6wBVvQ.js";/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E=f("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]),ee=()=>{var u,h,x;const n=c({queryKey:N.areas,queryFn:()=>p.listAreas({page_size:50,ordering:"name"}),staleTime:m}),i=c({queryKey:["methods-all"],queryFn:async()=>(await p.methodIndex()).results,staleTime:m}),o=c({queryKey:["trending-methods-directory"],queryFn:()=>p.trendingMethods({limit:12}),staleTime:m}),g=l.useMemo(()=>{var t,a;const r=new Map((((t=n.data)==null?void 0:t.results)??[]).map(e=>[e.id,e.name]));return(a=o.data)==null?void 0:a.results.map(e=>({id:e.id,name:e.name,href:`/methods/${e.slug||e.id}`,areaName:e.area_id?r.get(e.area_id):void 0,recentPaperCount:e.recent_paper_count,shareLift:e.share_lift}))},[o.data,n.data]),d=l.useMemo(()=>{if(!i.data||!n.data)return null;const r={};return i.data.forEach(t=>{const a=t.area_id??"_unassigned";(r[a]||(r[a]=[])).push(t)}),Object.values(r).forEach(t=>t.sort((a,e)=>(e.trend_score||0)-(a.trend_score||0)||(e.paper_count||0)-(a.paper_count||0)||a.name.localeCompare(e.name))),r},[i.data,n.data]),y=l.useMemo(()=>{const r=(i.data||[]).filter(a=>(a.trend_score||0)>0).sort((a,e)=>(e.trend_score||0)-(a.trend_score||0)),t=Math.ceil(r.length*.25);return new Set(r.slice(0,t).map(a=>a.id))},[i.data]);return S(!!n.data&&!!i.data&&!o.isLoading),n.error||i.error?s.jsx("div",{className:"page",children:s.jsx(L,{variant:"destructive",children:s.jsx(M,{children:"Failed to load methods."})})}):s.jsxs("div",{className:"page",children:[s.jsx("div",{className:"feed-header",children:s.jsxs("div",{children:[s.jsxs("h1",{className:"feed-title",children:["Methods ",s.jsx("em",{children:"library"})]}),s.jsx("div",{className:"feed-subtitle",children:"Common techniques used across AI research. Trend scores show papers using each method per 30 days, measured over the latest 90 days; the flame marks the top quartile."})]})}),s.jsx(I,{noun:"method",items:g,recentDays:(u=o.data)==null?void 0:u.recent_days,baselineDays:(h=o.data)==null?void 0:h.baseline_days,isLoading:o.isLoading,error:o.error,mono:!0}),n.isLoading||i.isLoading?s.jsx(A,{tiles:8,tileClassName:"h-20"}):T(((x=n.data)==null?void 0:x.results)??[]).map(r=>{const t=(d==null?void 0:d[r.id])||[];if(t.length===0)return null;const a=t.reduce((e,j)=>e+(j.paper_count||0),0);return s.jsxs(F,{id:`area-${v(r.name)}`,title:r.name,meta:`${t.length} methods · ${a.toLocaleString()} papers`,children:[t.map(e=>s.jsxs(_,{to:`/methods/${e.slug||e.id}`,className:"tag-cell",children:[s.jsxs("div",{className:"name",style:{fontFamily:"var(--mono)",fontSize:15},children:[e.name,y.has(e.id)&&s.jsx(E,{className:"method-trending-icon",size:15,"aria-label":"Top quartile by recent method mentions"})]}),s.jsxs("div",{className:"meta",children:[s.jsxs("span",{children:[(e.paper_count??0).toLocaleString()," papers"]}),(e.trend_score??0)>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsxs("span",{className:"method-trend-score",children:[(e.trend_score??0).toFixed(1),"/mo"]})]}),e.introduced_year!=null&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsx("span",{children:e.introduced_year})]})]})]},e.id)),s.jsx(q,{kind:"method"})]},r.id)})]})};export{ee as default}; diff --git a/assets/NotFound-DtzwOULp.js b/assets/NotFound-DV_nwcxG.js similarity index 89% rename from assets/NotFound-DtzwOULp.js rename to assets/NotFound-DV_nwcxG.js index 779339efcedbc228eb963921b656846c57af9f95..ffac31d78dffb6b56f77b18c451d9964a3e2b47b 100644 --- a/assets/NotFound-DtzwOULp.js +++ b/assets/NotFound-DV_nwcxG.js @@ -1 +1 @@ -import{b as o,r as s,j as t,L as a}from"./index-CbgxfyGU.js";const r=()=>{const e=o();return s.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),t.jsxs("div",{className:"page",style:{textAlign:"center",paddingTop:96},children:[t.jsx("h1",{className:"detail-title",style:{fontSize:96,marginBottom:8},children:"404"}),t.jsx("p",{style:{fontFamily:"var(--serif)",fontStyle:"italic",color:"var(--ink-soft)",marginBottom:24},children:"That route isn't on the map."}),t.jsx(a,{to:"/",className:"action-btn",children:"Return home"})]})};export{r as default}; +import{c as o,d as s,j as t,L as a}from"./index-DyXq7-Tg.js";const r=()=>{const e=o();return s.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),t.jsxs("div",{className:"page",style:{textAlign:"center",paddingTop:96},children:[t.jsx("h1",{className:"detail-title",style:{fontSize:96,marginBottom:8},children:"404"}),t.jsx("p",{style:{fontFamily:"var(--serif)",fontStyle:"italic",color:"var(--ink-soft)",marginBottom:24},children:"That route isn't on the map."}),t.jsx(a,{to:"/",className:"action-btn",children:"Return home"})]})};export{r as default}; diff --git a/assets/OrganizationContributionGraph-DsoZR4EG.js b/assets/OrganizationContributionGraph-DsoZR4EG.js new file mode 100644 index 0000000000000000000000000000000000000000..94950ecd7ba4bc043b01d270d7850427f2accf61 --- /dev/null +++ b/assets/OrganizationContributionGraph-DsoZR4EG.js @@ -0,0 +1 @@ +import{d as b,j as o,b as $,T as z}from"./index-DyXq7-Tg.js";import{S as w}from"./skeleton-C3IIzpSL.js";import{c as y}from"./catalog-CRar2olQ.js";const x=24*60*60*1e3,f=12,N=3,v=new Map([[1,"Mon"],[3,"Wed"],[5,"Fri"]]),T=n=>new Date(`${n}T00:00:00Z`),_=n=>n.toISOString().slice(0,10),M=(n,a)=>{if(n===0)return 0;const i=a.findIndex(s=>n<=s);return i===-1?4:i+1},S=n=>{const a=T(n.start_date),i=T(n.end_date),s=new Date(a.getTime()-a.getUTCDay()*x),h=new Date(i.getTime()+(6-i.getUTCDay())*x),p=new Map(n.results.map(e=>[e.date,e.paper_count])),u=n.results.map(e=>e.paper_count).sort((e,g)=>e-g),c=[.25,.5,.75].map(e=>u[Math.min(u.length-1,Math.floor(u.length*e))]??1),l=[];for(let e=s.getTime();e<=h.getTime();e+=x){const g=new Date(e),d=_(g),m=e>=a.getTime()&&e<=i.getTime(),C=m?p.get(d)??0:0;l.push({key:d,date:g,count:C,inRange:m,level:M(C,c)})}const t=l.length/7,r=[];let j=-1;for(let e=0;em.inRange&&(e===0||m.date.getUTCDate()<=7));d&&d.date.getUTCMonth()!==j&&(j=d.date.getUTCMonth(),r.length>0&&e-r[r.length-1].column<3&&r.pop(),r.push({label:d.date.toLocaleString("en",{month:"short",timeZone:"UTC"}),column:e}))}return{days:l,months:r,weekCount:t}},D=({data:n,organizationName:a,title:i="Paper contributions",noun:s="paper"})=>{const h=b.useRef(null),{days:p,months:u,weekCount:c}=b.useMemo(()=>S(n),[n]),l=c*f+(c-1)*N;return b.useEffect(()=>{const t=h.current;t&&(t.scrollLeft=t.scrollWidth)},[c]),o.jsxs("section",{className:"organization-contributions","aria-labelledby":"organization-contributions-title",children:[o.jsxs("div",{className:"organization-contributions-header",children:[o.jsx("h2",{id:"organization-contributions-title",className:"organization-contributions-title",children:i}),o.jsxs("p",{className:"organization-contributions-summary",children:[n.total_count.toLocaleString()," ",n.total_count===1?s:`${s}s`," recorded in the last year"]})]}),o.jsx("div",{className:"organization-contributions-scroll",ref:h,children:o.jsxs("div",{className:"organization-contributions-plot",style:{width:l+34},role:"img","aria-label":`${a} recorded ${n.total_count} ${n.total_count===1?s:`${s}s`} in the last year`,children:[o.jsx("div",{className:"organization-contributions-weekdays","aria-hidden":"true",children:Array.from({length:7}).map((t,r)=>o.jsx("span",{children:v.get(r)??""},r))}),o.jsxs("div",{children:[o.jsx("div",{className:"organization-contributions-months",style:{width:l,gridTemplateColumns:`repeat(${c}, ${f}px)`},"aria-hidden":"true",children:u.map(t=>o.jsx("span",{style:{gridColumnStart:t.column+1},children:t.label},`${t.label}-${t.column}`))}),o.jsx("div",{className:"organization-contributions-grid",style:{width:l,gridTemplateColumns:`repeat(${c}, ${f}px)`},"aria-hidden":"true",children:p.map(t=>o.jsx("span",{className:`organization-contribution-cell ${t.inRange?`level-${t.level}`:"is-outside"}`,title:t.inRange?`${t.count} ${t.count===1?s:`${s}s`} on ${t.date.toLocaleDateString("en",{dateStyle:"long",timeZone:"UTC"})}`:void 0},t.key))})]})]})}),o.jsxs("div",{className:"organization-contributions-legend","aria-hidden":"true",children:[o.jsx("span",{children:"Fewer"}),[0,1,2,3,4].map(t=>o.jsx("span",{className:`organization-contribution-cell level-${t}`},t)),o.jsx("span",{children:"More"})]})]})},U=({organizationSlug:n,organizationName:a})=>{const i=$({queryKey:["organization-contributions",n],queryFn:()=>y.organizationContributions(n),staleTime:z});return i.isLoading?o.jsx(w,{className:"organization-contributions-skeleton"}):i.data?o.jsx(D,{data:i.data,organizationName:a}):null};export{D as C,U as O}; diff --git a/assets/OrganizationContributionGraph-ah6EPb13.js b/assets/OrganizationContributionGraph-ah6EPb13.js deleted file mode 100644 index 5f18cd97911f739bbd2f1ce626a725e85c949580..0000000000000000000000000000000000000000 --- a/assets/OrganizationContributionGraph-ah6EPb13.js +++ /dev/null @@ -1 +0,0 @@ -import{r as b,j as o}from"./index-CbgxfyGU.js";import{u as z}from"./useQuery-Bx9s5-D2.js";import{S as T}from"./skeleton-HwvdxvSN.js";import{c as w}from"./catalog-DhK7_9-6.js";const x=24*60*60*1e3,f=12,y=3,v=new Map([[1,"Mon"],[3,"Wed"],[5,"Fri"]]),$=n=>new Date(`${n}T00:00:00Z`),N=n=>n.toISOString().slice(0,10),_=(n,r)=>{if(n===0)return 0;const i=r.findIndex(s=>n<=s);return i===-1?4:i+1},D=n=>{const r=$(n.start_date),i=$(n.end_date),s=new Date(r.getTime()-r.getUTCDay()*x),h=new Date(i.getTime()+(6-i.getUTCDay())*x),p=new Map(n.results.map(e=>[e.date,e.paper_count])),u=n.results.map(e=>e.paper_count).sort((e,m)=>e-m),c=[.25,.5,.75].map(e=>u[Math.min(u.length-1,Math.floor(u.length*e))]??1),l=[];for(let e=s.getTime();e<=h.getTime();e+=x){const m=new Date(e),d=N(m),g=e>=r.getTime()&&e<=i.getTime(),C=g?p.get(d)??0:0;l.push({key:d,date:m,count:C,inRange:g,level:_(C,c)})}const t=l.length/7,a=[];let j=-1;for(let e=0;eg.inRange&&(e===0||g.date.getUTCDate()<=7));d&&d.date.getUTCMonth()!==j&&(j=d.date.getUTCMonth(),a.length>0&&e-a[a.length-1].column<3&&a.pop(),a.push({label:d.date.toLocaleString("en",{month:"short",timeZone:"UTC"}),column:e}))}return{days:l,months:a,weekCount:t}},L=({data:n,organizationName:r,title:i="Paper contributions",noun:s="paper"})=>{const h=b.useRef(null),{days:p,months:u,weekCount:c}=b.useMemo(()=>D(n),[n]),l=c*f+(c-1)*y;return b.useEffect(()=>{const t=h.current;t&&(t.scrollLeft=t.scrollWidth)},[c]),o.jsxs("section",{className:"organization-contributions","aria-labelledby":"organization-contributions-title",children:[o.jsxs("div",{className:"organization-contributions-header",children:[o.jsx("h2",{id:"organization-contributions-title",className:"organization-contributions-title",children:i}),o.jsxs("p",{className:"organization-contributions-summary",children:[n.total_count.toLocaleString()," ",n.total_count===1?s:`${s}s`," recorded in the last year"]})]}),o.jsx("div",{className:"organization-contributions-scroll",ref:h,children:o.jsxs("div",{className:"organization-contributions-plot",style:{width:l+34},role:"img","aria-label":`${r} recorded ${n.total_count} ${n.total_count===1?s:`${s}s`} in the last year`,children:[o.jsx("div",{className:"organization-contributions-weekdays","aria-hidden":"true",children:Array.from({length:7}).map((t,a)=>o.jsx("span",{children:v.get(a)??""},a))}),o.jsxs("div",{children:[o.jsx("div",{className:"organization-contributions-months",style:{width:l,gridTemplateColumns:`repeat(${c}, ${f}px)`},"aria-hidden":"true",children:u.map(t=>o.jsx("span",{style:{gridColumnStart:t.column+1},children:t.label},`${t.label}-${t.column}`))}),o.jsx("div",{className:"organization-contributions-grid",style:{width:l,gridTemplateColumns:`repeat(${c}, ${f}px)`},"aria-hidden":"true",children:p.map(t=>o.jsx("span",{className:`organization-contribution-cell ${t.inRange?`level-${t.level}`:"is-outside"}`,title:t.inRange?`${t.count} ${t.count===1?s:`${s}s`} on ${t.date.toLocaleDateString("en",{dateStyle:"long",timeZone:"UTC"})}`:void 0},t.key))})]})]})}),o.jsxs("div",{className:"organization-contributions-legend","aria-hidden":"true",children:[o.jsx("span",{children:"Fewer"}),[0,1,2,3,4].map(t=>o.jsx("span",{className:`organization-contribution-cell level-${t}`},t)),o.jsx("span",{children:"More"})]})]})},A=({organizationSlug:n,organizationName:r})=>{const i=z({queryKey:["organization-contributions",n],queryFn:()=>w.organizationContributions(n),staleTime:6e5});return i.isLoading?o.jsx(T,{className:"organization-contributions-skeleton"}):i.data?o.jsx(L,{data:i.data,organizationName:r}):null};export{L as C,A as O}; diff --git a/assets/OrganizationDetailView-BD-vOirQ.js b/assets/OrganizationDetailView-BD-vOirQ.js deleted file mode 100644 index de5aee45506d67912188b3641036aa76968b0ce3..0000000000000000000000000000000000000000 --- a/assets/OrganizationDetailView-BD-vOirQ.js +++ /dev/null @@ -1 +0,0 @@ -import{c as q,r as d,j as r,L as N,u as C}from"./index-CbgxfyGU.js";import{R as M}from"./ResearchFollowButton-D2BXlDtQ.js";import{u as y}from"./useQuery-Bx9s5-D2.js";import{M as z}from"./MarkdownText-Bj-G_S-B.js";import{O as Q}from"./OrganizationContributionGraph-ah6EPb13.js";import{u as I,b as E,a as K}from"./PaperFeed-DMvUfA47.js";import{A as R,a as G}from"./alert-CFDDvdIM.js";import{S as H}from"./searchable-select-DNdBIahG.js";import{S as W}from"./skeleton-HwvdxvSN.js";import{u as B}from"./usePapers-CJaWLZ3y.js";import{c as F}from"./catalog-DhK7_9-6.js";import{a as D,p as S}from"./paperQueryKeys-B8u1BWlI.js";import{i as U}from"./apiErrors-BZ5h1Kmb.js";import{d as v,t as V}from"./transform-0Udg2p6b.js";import{o as Z,i as J}from"./organizationNames-BVKzYEBp.js";import L from"./NotFound-DtzwOULp.js";import"./useMutation-P_trTy9i.js";import"./research-DgpyzSy_.js";import"./plus-UK0TEjgd.js";/* empty css */import"./PaperPreviewLink-DZDNIh1g.js";import"./index-ZkEATkOr.js";import"./index-BH3yOoza.js";import"./katex-DkKDou_j.js";import"./hover-card-ufez2uMo.js";import"./PaperCard-tdTC_dRN.js";import"./AuthorAvatar-CUJMmp_z.js";import"./SotaBadges-C-sTR-EF.js";import"./colors-BkWRhvFI.js";import"./Icon-D-kA0Owz.js";import"./LatexTitle-Z-HGmZ-H.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-DKJYnYjk.js";import"./useIntersectionObserver-CID9Kkak.js";import"./button-Bv9oZ-QU.js";import"./dialog-Cfp_d3CC.js";import"./search-CLtAJGOp.js";import"./loader-circle-CWMja8Zn.js";import"./useInfiniteQuery-BAc_4HO5.js";import"./curation-C7Gmmp4z.js";const X=({organizationSlug:a,taskSlug:n})=>{var f,x,j,_,b;const k=q(),c=I(),{searchParams:$}=c,[w,h]=d.useState(!1),u=y({queryKey:["organization",a],queryFn:()=>F.getOrganization(a),staleTime:10*60*1e3}),l=y({queryKey:["organization-areas-with-tasks",a],queryFn:()=>F.organizationAreasWithTasks(a),staleTime:10*60*1e3}),p=B([...S.feeds.organization,a,n,c.filters],t=>D.forOrganization(a,{...c.filters,task:n,page:t,page_size:12}),{enabled:!!a});d.useEffect(()=>{h(!1)},[a,n]);const g=d.useMemo(()=>{var t;return(((t=l.data)==null?void 0:t.results)??[]).flatMap(o=>o.tasks.filter(s=>!!s.slug).map(s=>({...s,slug:s.slug,label:v(s.name,s.slug)})))},[l.data]),i=g.find(t=>t.slug===n),O=d.useMemo(()=>{var t;return(((t=p.data)==null?void 0:t.pages)??[]).flatMap(o=>o.results.map(V))},[p.data]),e=u.data??((f=l.data)==null?void 0:f.organization),m=e?Z(e):null,A=((j=(x=p.data)==null?void 0:x.pages[0])==null?void 0:j.count)??0;if([u.error,l.error,p.error].some(U))return r.jsx(L,{});if(l.error||p.error)return r.jsx("div",{className:"page",children:r.jsx(R,{variant:"destructive",children:r.jsx(G,{children:"Failed to load organization papers. Please try again."})})});const P=t=>{const o=t.trim().toLocaleLowerCase();return g.filter(s=>`${s.label} ${s.slug}`.toLocaleLowerCase().includes(o)).map(s=>({value:s.slug,label:s.label,description:`${s.paper_count.toLocaleString()} ${s.paper_count===1?"paper":"papers"}`}))},T=t=>{const o=t==="__all__"?`/orgs/${a}`:`/orgs/${a}/${t}`,s=$.toString();k({pathname:o,search:s?`?${s}`:""})};return r.jsxs("div",{className:"page",children:[r.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[r.jsx(N,{to:"/",children:"Home"}),r.jsx("span",{children:" / "}),r.jsx(N,{to:"/organizations",children:"Organizations"}),r.jsx("span",{children:" / "}),r.jsx("span",{children:(e==null?void 0:e.name)??a}),i&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:" / "}),r.jsx("span",{children:v(i.name,i.slug)})]})]}),r.jsxs("header",{className:"organization-hero",children:[r.jsxs("div",{className:"organization-hero-profile",children:[r.jsx("div",{className:"organizations-eyebrow",children:"ORGANIZATION"}),r.jsxs("h1",{className:`feed-title organization-hero-title${e&&!m&&J(e.name)?" organization-hero-title--long":""}`,children:[e!=null&&e.logo_url&&!w?r.jsx("img",{src:e.logo_url,alt:"",width:58,height:58,onError:()=>h(!0)}):e?r.jsx("span",{className:"organization-hero-monogram","aria-hidden":"true",children:(m??e.name).slice(0,1).toUpperCase()}):null,e?r.jsxs("span",{className:"organization-hero-name",children:[m??e.name,m&&r.jsx("span",{className:"organization-hero-full-name",children:e.name})]}):r.jsx(W,{className:"h-12 w-64"})]}),e&&r.jsx(M,{kind:"organization",entityId:e.id}),e&&r.jsxs("div",{className:"feed-subtitle",children:[((_=e.paper_count)==null?void 0:_.toLocaleString())??0," papers",(e.organization_trending_score??0)>0&&e.trending_rank&&r.jsxs(r.Fragment,{children:[" · #",e.trending_rank," trending this month"]})]}),(e==null?void 0:e.description)&&r.jsx(z,{className:"method-description",text:e.description}),e&&r.jsxs("div",{className:"organization-hero-links",children:[e.website_url&&r.jsx("a",{href:e.website_url,target:"_blank",rel:"noreferrer",children:"Website ↗"}),e.hf_url&&r.jsx("a",{href:e.hf_url,target:"_blank",rel:"noreferrer",children:"Hugging Face ↗"}),e.github_url&&r.jsx("a",{href:e.github_url,target:"_blank",rel:"noreferrer",children:"GitHub ↗"})]})]}),r.jsx(Q,{organizationSlug:a,organizationName:(e==null?void 0:e.name)??a})]}),r.jsx(E,{feed:c,style:{alignItems:"center",gap:16},leading:r.jsx("div",{style:{minWidth:260},children:r.jsx(H,{value:n??"__all__",onChange:T,placeholder:"All tasks",searchPlaceholder:"Search organization tasks...",emptyMessage:"No matching tasks.",ariaLabel:"Filter papers by task",selectedOption:i?{value:i.slug,label:i.label,description:`${i.paper_count.toLocaleString()} ${i.paper_count===1?"paper":"papers"}`}:{value:"__all__",label:"All tasks",description:`${((b=e==null?void 0:e.paper_count)==null?void 0:b.toLocaleString())??0} papers`},queryKey:["organization-task-options",a],queryFn:async t=>{var o;return[{value:"__all__",label:"All tasks",description:`${((o=e==null?void 0:e.paper_count)==null?void 0:o.toLocaleString())??0} papers`},...P(t)]},enabled:!l.isLoading,className:"h-[38px]"})}),children:r.jsxs("div",{className:"results-count",children:[A.toLocaleString()," papers"]})}),r.jsx(K,{query:p,cards:O,showInstitution:!1,empty:(e==null?void 0:e.paper_count)===0?"No papers indexed yet":"No papers found for this selection."})]})},Ee=()=>{const{orgSlug:a,taskSlug:n}=C();return a?r.jsx(X,{organizationSlug:a,taskSlug:n}):r.jsx(L,{})};export{Ee as default}; diff --git a/assets/OrganizationDetailView-DYOQ1Mwd.js b/assets/OrganizationDetailView-DYOQ1Mwd.js new file mode 100644 index 0000000000000000000000000000000000000000..51dc6d4c3569ce824f6e72d13a6ca7240e21e6a7 --- /dev/null +++ b/assets/OrganizationDetailView-DYOQ1Mwd.js @@ -0,0 +1 @@ +import{e as q,d,b as N,p as C,j as r,L as y,o as Q,T as F,u as z}from"./index-DyXq7-Tg.js";import{R as E}from"./ResearchFollowButton-Dv316ClR.js";import{M as I}from"./MarkdownText-CUzPoC9Y.js";import{O as K}from"./OrganizationContributionGraph-DsoZR4EG.js";import{u as R,b as G,a as H}from"./PaperFeed-EBt97iOL.js";import{A as W,a as B}from"./alert-gbJBhAVE.js";import{S as D}from"./searchable-select-DiDLwvbI.js";import{S}from"./skeleton-C3IIzpSL.js";import{u as U}from"./usePapers-B0s20UcU.js";import{c as v}from"./catalog-CRar2olQ.js";import{p as V}from"./papers-Dh3ljlL0.js";import{i as Z}from"./apiErrors-BSvbQBb0.js";import{d as L,t as J}from"./transform-D46m70Qr.js";import{o as X,i as Y}from"./organizationNames-BVKzYEBp.js";import k from"./NotFound-DV_nwcxG.js";import"./researchTopic-DbX0eko-.js";import"./useMutation-UWxBeqtn.js";import"./plus-Yh42pKZz.js";/* empty css */import"./PaperPreviewLink-CpCZSa8K.js";import"./index-mCi_y_l3.js";import"./index-2CvJmBVB.js";import"./katex-DkKDou_j.js";import"./hover-card-B45EJIn_.js";import"./PaperCard-57p1OSGy.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./SotaBadges-vbLLOUtT.js";import"./colors-BkWRhvFI.js";import"./Icon-T4LYkEQj.js";import"./LatexTitle-Bkyz3jCs.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-CTBEUp7Y.js";import"./useIntersectionObserver-D6_Iig9a.js";import"./button-DZeAbOf2.js";import"./dialog-CfM0Uql2.js";import"./search-8ssWDP68.js";import"./loader-circle-C75KLEgx.js";import"./useInfiniteQuery-BYh2zN-T.js";import"./curation-YeS7FBYf.js";const ee=({organizationSlug:a,taskSlug:n})=>{var f,x,j,_,b;const $=q(),c=R(),{searchParams:w}=c,[O,h]=d.useState(!1),u=N({queryKey:Q.organization(a),queryFn:()=>v.getOrganization(a),staleTime:F}),l=N({queryKey:["organization-areas-with-tasks",a],queryFn:()=>v.organizationAreasWithTasks(a),staleTime:F}),p=U([...C.feeds.organization,a,n,c.filters],t=>V.forOrganization(a,{...c.filters,task:n,page:t,page_size:12}),{enabled:!!a});d.useEffect(()=>{h(!1)},[a,n]);const g=d.useMemo(()=>{var t;return(((t=l.data)==null?void 0:t.results)??[]).flatMap(o=>o.tasks.filter(s=>!!s.slug).map(s=>({...s,slug:s.slug,label:L(s.name,s.slug)})))},[l.data]),i=g.find(t=>t.slug===n),T=d.useMemo(()=>{var t;return(((t=p.data)==null?void 0:t.pages)??[]).flatMap(o=>o.results.map(J))},[p.data]),e=u.data??((f=l.data)==null?void 0:f.organization),m=e?X(e):null,A=((j=(x=p.data)==null?void 0:x.pages[0])==null?void 0:j.count)??0;if([u.error,l.error,p.error].some(Z))return r.jsx(k,{});if(l.error||p.error)return r.jsx("div",{className:"page",children:r.jsx(W,{variant:"destructive",children:r.jsx(B,{children:"Failed to load organization papers. Please try again."})})});const P=t=>{const o=t.trim().toLocaleLowerCase();return g.filter(s=>`${s.label} ${s.slug}`.toLocaleLowerCase().includes(o)).map(s=>({value:s.slug,label:s.label,description:`${s.paper_count.toLocaleString()} ${s.paper_count===1?"paper":"papers"}`}))},M=t=>{const o=t==="__all__"?`/orgs/${a}`:`/orgs/${a}/${t}`,s=w.toString();$({pathname:o,search:s?`?${s}`:""})};return r.jsxs("div",{className:"page",children:[r.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[r.jsx(y,{to:"/",children:"Home"}),r.jsx("span",{children:" / "}),r.jsx(y,{to:"/organizations",children:"Organizations"}),r.jsx("span",{children:" / "}),r.jsx("span",{children:(e==null?void 0:e.name)??a}),i&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:" / "}),r.jsx("span",{children:L(i.name,i.slug)})]})]}),r.jsxs("header",{className:"organization-hero",children:[r.jsxs("div",{className:"organization-hero-profile",children:[r.jsx("div",{className:"organizations-eyebrow",children:"ORGANIZATION"}),r.jsxs("h1",{className:`feed-title organization-hero-title${e&&!m&&Y(e.name)?" organization-hero-title--long":""}`,children:[e!=null&&e.logo_url&&!O?r.jsx("img",{src:e.logo_url,alt:"",width:58,height:58,onError:()=>h(!0)}):e?r.jsx("span",{className:"organization-hero-monogram","aria-hidden":"true",children:(m??e.name).slice(0,1).toUpperCase()}):null,e?r.jsxs("span",{className:"organization-hero-name",children:[m??e.name,m&&r.jsx("span",{className:"organization-hero-full-name",children:e.name})]}):r.jsx(S,{className:"h-12 w-64"})]}),e&&r.jsx(E,{kind:"organization",entityId:e.id}),e&&r.jsxs("div",{className:"feed-subtitle",children:[((_=e.paper_count)==null?void 0:_.toLocaleString())??0," papers",(e.organization_trending_score??0)>0&&e.trending_rank&&r.jsxs(r.Fragment,{children:[" · #",e.trending_rank," trending this month"]})]}),(e==null?void 0:e.description)&&r.jsx(I,{className:"method-description",text:e.description}),e&&r.jsxs("div",{className:"organization-hero-links",children:[e.website_url&&r.jsx("a",{href:e.website_url,target:"_blank",rel:"noreferrer",children:"Website ↗"}),e.hf_url&&r.jsx("a",{href:e.hf_url,target:"_blank",rel:"noreferrer",children:"Hugging Face ↗"}),e.github_url&&r.jsx("a",{href:e.github_url,target:"_blank",rel:"noreferrer",children:"GitHub ↗"})]})]}),r.jsx(K,{organizationSlug:a,organizationName:(e==null?void 0:e.name)??a})]}),r.jsx(G,{feed:c,style:{alignItems:"center",gap:16},leading:r.jsx("div",{style:{minWidth:260},children:r.jsx(D,{value:n??"__all__",onChange:M,placeholder:"All tasks",searchPlaceholder:"Search organization tasks...",emptyMessage:"No matching tasks.",ariaLabel:"Filter papers by task",selectedOption:i?{value:i.slug,label:i.label,description:`${i.paper_count.toLocaleString()} ${i.paper_count===1?"paper":"papers"}`}:{value:"__all__",label:"All tasks",description:`${((b=e==null?void 0:e.paper_count)==null?void 0:b.toLocaleString())??0} papers`},queryKey:["organization-task-options",a],queryFn:async t=>{var o;return[{value:"__all__",label:"All tasks",description:`${((o=e==null?void 0:e.paper_count)==null?void 0:o.toLocaleString())??0} papers`},...P(t)]},enabled:!l.isLoading,className:"h-[38px]"})}),children:r.jsxs("div",{className:"results-count",children:[A.toLocaleString()," papers"]})}),r.jsx(H,{query:p,cards:T,showInstitution:!1,empty:(e==null?void 0:e.paper_count)===0?"No papers indexed yet":"No papers found for this selection."})]})},Ke=()=>{const{orgSlug:a,taskSlug:n}=z();return a?r.jsx(ee,{organizationSlug:a,taskSlug:n}):r.jsx(k,{})};export{Ke as default}; diff --git a/assets/OrganizationsIndexView-Bd4D8teF.js b/assets/OrganizationsIndexView-Bd4D8teF.js deleted file mode 100644 index 50438ea4ae6b4a4dda775b79240065c1ddad632d..0000000000000000000000000000000000000000 --- a/assets/OrganizationsIndexView-Bd4D8teF.js +++ /dev/null @@ -1 +0,0 @@ -import{e as g,r as h,j as e,L as x}from"./index-CbgxfyGU.js";import{u}from"./useQuery-Bx9s5-D2.js";import{A as j,a as y}from"./alert-CFDDvdIM.js";import{c as N}from"./catalog-DhK7_9-6.js";const f=n=>n==="papers"||n==="name"?n:"trending",_=({organization:n})=>{const[d,i]=h.useState(!1);return!n.logo_url||d?e.jsx("span",{className:"organization-logo organization-logo--fallback","aria-hidden":"true",children:n.name.slice(0,1).toUpperCase()}):e.jsx("span",{className:"organization-logo",children:e.jsx("img",{src:n.logo_url,alt:"",width:48,height:48,onError:()=>i(!0)})})},S=()=>{const[n,d]=g(),i=f(n.get("sort")),c=n.get("q")??"",o=u({queryKey:["organizations","featured"],queryFn:()=>N.organizationIndex(),staleTime:10*60*1e3}),p=s=>{const a=new URLSearchParams(n),t=s.sort??i,r=s.query??c;t==="trending"?a.delete("sort"):a.set("sort",t),r.trim()?a.set("q",r):a.delete("q"),d(a)},m=h.useMemo(()=>{var t;const s=c.trim().toLocaleLowerCase(),a=(((t=o.data)==null?void 0:t.results)??[]).filter(r=>[r.name,r.slug,r.hf_slug??""].join(" ").toLocaleLowerCase().includes(s));return i==="papers"?[...a].sort((r,l)=>(l.paper_count??0)-(r.paper_count??0)||r.name.localeCompare(l.name)||r.slug.localeCompare(l.slug)):i==="name"?[...a].sort((r,l)=>r.name.localeCompare(l.name)||r.slug.localeCompare(l.slug)):a},[o.data,c,i]);return e.jsxs("div",{className:"page organizations-page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["AI ",e.jsx("em",{children:"Organizations"})]}),e.jsx("div",{className:"feed-subtitle",children:"Explore papers from leading AI organizations, ranked by sustained community momentum over the past 30 days."})]})}),e.jsxs("section",{"aria-labelledby":"organizations-heading",children:[e.jsxs("div",{className:"organizations-section-heading",children:[e.jsx("h2",{id:"organizations-heading",children:o.data?`${o.data.count.toLocaleString()} organizations`:"Organizations"}),e.jsx("span",{children:i==="trending"?"Ranked by 30-day momentum":i==="papers"?"Sorted by linked papers":"Sorted A–Z"})]}),e.jsxs("div",{className:"organizations-controls",children:[e.jsxs("label",{children:[e.jsx("span",{className:"sr-only",children:"Search organizations"}),e.jsx("input",{type:"search",value:c,onChange:s=>p({query:s.target.value}),placeholder:"Search organizations"})]}),e.jsx("div",{className:"organizations-sort","aria-label":"Sort organizations",children:[["trending","Trending"],["papers","Most papers"],["name","A–Z"]].map(([s,a])=>e.jsx("button",{type:"button",className:i===s?"active":"","aria-pressed":i===s,onClick:()=>p({sort:s}),children:a},s))})]}),o.isLoading?e.jsx("div",{className:"organizations-grid","aria-busy":"true","aria-label":"Loading organizations",children:Array.from({length:12}).map((s,a)=>e.jsxs("div",{className:"organization-card organization-card-skeleton",children:[e.jsxs("div",{className:"organization-card-header",children:[e.jsx("span",{className:"organization-logo"}),e.jsxs("div",{children:[e.jsx("span",{className:"organization-skeleton-line"}),e.jsx("span",{className:"organization-skeleton-line short"})]})]}),e.jsx("div",{className:"organization-card-metrics",children:e.jsx("span",{className:"organization-skeleton-line short"})}),e.jsxs("div",{className:"organization-highlight",children:[e.jsx("span",{className:"organization-skeleton-line"}),e.jsx("span",{className:"organization-skeleton-line"})]})]},a))}):o.error?e.jsx(j,{variant:"destructive",children:e.jsxs(y,{children:["Failed to load organizations."," ",e.jsx("button",{type:"button",onClick:()=>o.refetch(),children:"Try again"})]})}):m.length===0?e.jsxs("div",{className:"organizations-empty",children:["No organizations match “",c,"”."]}):e.jsx("div",{className:"organizations-grid",children:m.map(s=>{var r;const a=s.paper_count??0,t=s.first_paper_year&&s.latest_paper_year?s.first_paper_year===s.latest_paper_year?String(s.first_paper_year):`${s.first_paper_year}–${s.latest_paper_year}`:null;return e.jsxs(x,{to:`/orgs/${s.slug}`,className:"organization-card","aria-label":a?`Browse ${a.toLocaleString()} ${s.name} papers`:`Browse ${s.name} papers`,children:[e.jsxs("div",{className:"organization-card-header",children:[e.jsx(_,{organization:s}),e.jsxs("div",{children:[e.jsx("h3",{children:s.name}),e.jsxs("span",{children:["@",s.hf_slug??s.slug]})]})]}),e.jsxs("div",{className:"organization-card-metrics",children:[e.jsx("strong",{children:a.toLocaleString()}),e.jsx("span",{children:a===1?"paper":"papers"}),i==="trending"&&s.trending_rank&&e.jsxs("span",{className:"organization-rank",children:["#",s.trending_rank]})]}),e.jsxs("div",{className:"organization-highlight",children:[e.jsx("span",{children:"Trending paper"}),e.jsx("strong",{children:((r=s.top_trending_paper)==null?void 0:r.title)??"No papers indexed yet"})]}),e.jsxs("div",{className:"organization-card-footer",children:[t?`Publishing ${t}`:"Research archive ready",e.jsx("span",{"aria-hidden":"true",children:"↗"})]})]},s.id)})})]})]})};export{S as default}; diff --git a/assets/OrganizationsIndexView-DpJistoL.js b/assets/OrganizationsIndexView-DpJistoL.js new file mode 100644 index 0000000000000000000000000000000000000000..99bbdd60fef500d57932241395de73487f25d74a --- /dev/null +++ b/assets/OrganizationsIndexView-DpJistoL.js @@ -0,0 +1 @@ +import{g as m,b as x,d as h,j as e,L as u,o as j,T as y}from"./index-DyXq7-Tg.js";import{A as N,a as f}from"./alert-gbJBhAVE.js";import{c as _}from"./catalog-CRar2olQ.js";const v=n=>n==="papers"||n==="name"?n:"trending",z=({organization:n})=>{const[d,i]=h.useState(!1);return!n.logo_url||d?e.jsx("span",{className:"organization-logo organization-logo--fallback","aria-hidden":"true",children:n.name.slice(0,1).toUpperCase()}):e.jsx("span",{className:"organization-logo",children:e.jsx("img",{src:n.logo_url,alt:"",width:48,height:48,onError:()=>i(!0)})})},L=()=>{const[n,d]=m(),i=v(n.get("sort")),c=n.get("q")??"",o=x({queryKey:[...j.organizations,"featured"],queryFn:()=>_.organizationIndex(),staleTime:y}),p=s=>{const a=new URLSearchParams(n),t=s.sort??i,r=s.query??c;t==="trending"?a.delete("sort"):a.set("sort",t),r.trim()?a.set("q",r):a.delete("q"),d(a)},g=h.useMemo(()=>{var t;const s=c.trim().toLocaleLowerCase(),a=(((t=o.data)==null?void 0:t.results)??[]).filter(r=>[r.name,r.slug,r.hf_slug??""].join(" ").toLocaleLowerCase().includes(s));return i==="papers"?[...a].sort((r,l)=>(l.paper_count??0)-(r.paper_count??0)||r.name.localeCompare(l.name)||r.slug.localeCompare(l.slug)):i==="name"?[...a].sort((r,l)=>r.name.localeCompare(l.name)||r.slug.localeCompare(l.slug)):a},[o.data,c,i]);return e.jsxs("div",{className:"page organizations-page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["AI ",e.jsx("em",{children:"Organizations"})]}),e.jsx("div",{className:"feed-subtitle",children:"Explore papers from leading AI organizations, ranked by sustained community momentum over the past 30 days."})]})}),e.jsxs("section",{"aria-labelledby":"organizations-heading",children:[e.jsxs("div",{className:"organizations-section-heading",children:[e.jsx("h2",{id:"organizations-heading",children:o.data?`${o.data.count.toLocaleString()} organizations`:"Organizations"}),e.jsx("span",{children:i==="trending"?"Ranked by 30-day momentum":i==="papers"?"Sorted by linked papers":"Sorted A–Z"})]}),e.jsxs("div",{className:"organizations-controls",children:[e.jsxs("label",{children:[e.jsx("span",{className:"sr-only",children:"Search organizations"}),e.jsx("input",{type:"search",value:c,onChange:s=>p({query:s.target.value}),placeholder:"Search organizations"})]}),e.jsx("div",{className:"organizations-sort","aria-label":"Sort organizations",children:[["trending","Trending"],["papers","Most papers"],["name","A–Z"]].map(([s,a])=>e.jsx("button",{type:"button",className:i===s?"active":"","aria-pressed":i===s,onClick:()=>p({sort:s}),children:a},s))})]}),o.isLoading?e.jsx("div",{className:"organizations-grid","aria-busy":"true","aria-label":"Loading organizations",children:Array.from({length:12}).map((s,a)=>e.jsxs("div",{className:"organization-card organization-card-skeleton",children:[e.jsxs("div",{className:"organization-card-header",children:[e.jsx("span",{className:"organization-logo"}),e.jsxs("div",{children:[e.jsx("span",{className:"organization-skeleton-line"}),e.jsx("span",{className:"organization-skeleton-line short"})]})]}),e.jsx("div",{className:"organization-card-metrics",children:e.jsx("span",{className:"organization-skeleton-line short"})}),e.jsxs("div",{className:"organization-highlight",children:[e.jsx("span",{className:"organization-skeleton-line"}),e.jsx("span",{className:"organization-skeleton-line"})]})]},a))}):o.error?e.jsx(N,{variant:"destructive",children:e.jsxs(f,{children:["Failed to load organizations."," ",e.jsx("button",{type:"button",onClick:()=>o.refetch(),children:"Try again"})]})}):g.length===0?e.jsxs("div",{className:"organizations-empty",children:["No organizations match “",c,"”."]}):e.jsx("div",{className:"organizations-grid",children:g.map(s=>{var r;const a=s.paper_count??0,t=s.first_paper_year&&s.latest_paper_year?s.first_paper_year===s.latest_paper_year?String(s.first_paper_year):`${s.first_paper_year}–${s.latest_paper_year}`:null;return e.jsxs(u,{to:`/orgs/${s.slug}`,className:"organization-card","aria-label":a?`Browse ${a.toLocaleString()} ${s.name} papers`:`Browse ${s.name} papers`,children:[e.jsxs("div",{className:"organization-card-header",children:[e.jsx(z,{organization:s}),e.jsxs("div",{children:[e.jsx("h3",{children:s.name}),e.jsxs("span",{children:["@",s.hf_slug??s.slug]})]})]}),e.jsxs("div",{className:"organization-card-metrics",children:[e.jsx("strong",{children:a.toLocaleString()}),e.jsx("span",{children:a===1?"paper":"papers"}),i==="trending"&&s.trending_rank&&e.jsxs("span",{className:"organization-rank",children:["#",s.trending_rank]})]}),e.jsxs("div",{className:"organization-highlight",children:[e.jsx("span",{children:"Trending paper"}),e.jsx("strong",{children:((r=s.top_trending_paper)==null?void 0:r.title)??"No papers indexed yet"})]}),e.jsxs("div",{className:"organization-card-footer",children:[t?`Publishing ${t}`:"Research archive ready",e.jsx("span",{"aria-hidden":"true",children:"↗"})]})]},s.id)})})]})]})};export{L as default}; diff --git a/assets/PaperCard-57p1OSGy.js b/assets/PaperCard-57p1OSGy.js new file mode 100644 index 0000000000000000000000000000000000000000..d9d2b77dc79229b10779773234b4dce42acbf46e --- /dev/null +++ b/assets/PaperCard-57p1OSGy.js @@ -0,0 +1 @@ +import{i as v,V as g,T as M,p as y,j as a,L as d}from"./index-DyXq7-Tg.js";import{A as L}from"./AuthorAvatar-B-9xS2Wo.js";import{P as Z,S as A,T as k,M as E}from"./SotaBadges-vbLLOUtT.js";import{I as P}from"./Icon-T4LYkEQj.js";import{L as U,a as w}from"./LatexTitle-Bkyz3jCs.js";import{p as C}from"./papers-Dh3ljlL0.js";import{s as h}from"./safeExternalHref-CkBrsh84.js";const $=({size:s=16})=>a.jsxs("svg",{className:"hf-logo",width:s,height:s,viewBox:"0 0 95 88",fill:"none","aria-hidden":"true",focusable:"false",children:[a.jsx("path",{fill:"#FFD21E",d:"M47.21 76.5a34.75 34.75 0 1 0 0-69.5 34.75 34.75 0 0 0 0 69.5Z"}),a.jsx("path",{fill:"#FF9D0B",d:"M81.96 41.75a34.75 34.75 0 1 0-69.5 0 34.75 34.75 0 0 0 69.5 0Zm-73.5 0a38.75 38.75 0 1 1 77.5 0 38.75 38.75 0 0 1-77.5 0Z"}),a.jsx("path",{fill:"#3A3B45",d:"M58.5 32.3c1.28.44 1.78 3.06 3.07 2.38a5 5 0 1 0-6.76-2.07c.61 1.15 2.55-.72 3.7-.32ZM34.95 32.3c-1.28.44-1.79 3.06-3.07 2.38a5 5 0 1 1 6.76-2.07c-.61 1.15-2.56-.72-3.7-.32Z"}),a.jsx("path",{fill:"#FF323D",d:"M46.96 56.29c9.83 0 13-8.76 13-13.26 0-2.34-1.57-1.6-4.09-.36-2.33 1.15-5.46 2.74-8.9 2.74-7.19 0-13-6.88-13-2.38s3.16 13.26 13 13.26Z"}),a.jsx("path",{fill:"#3A3B45",fillRule:"evenodd",clipRule:"evenodd",d:"M39.43 54a8.7 8.7 0 0 1 5.3-4.49c.4-.12.81.57 1.24 1.28.4.68.82 1.37 1.24 1.37.45 0 .9-.68 1.33-1.35.45-.7.89-1.38 1.32-1.25a8.61 8.61 0 0 1 5 4.17c3.73-2.94 5.1-7.74 5.1-10.7 0-2.34-1.57-1.6-4.09-.36l-.14.07c-2.31 1.15-5.39 2.67-8.77 2.67s-6.45-1.52-8.77-2.67c-2.6-1.29-4.23-2.1-4.23.29 0 3.05 1.46 8.06 5.47 10.97Z"}),a.jsx("path",{fill:"#FF9D0B",d:"M70.71 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM24.21 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM17.52 48c-1.62 0-3.06.66-4.07 1.87a5.97 5.97 0 0 0-1.33 3.76 7.1 7.1 0 0 0-1.94-.3c-1.55 0-2.95.59-3.94 1.66a5.8 5.8 0 0 0-.8 7 5.3 5.3 0 0 0-1.79 2.82c-.24.9-.48 2.8.8 4.74a5.22 5.22 0 0 0-.37 5.02c1.02 2.32 3.57 4.14 8.52 6.1 3.07 1.22 5.89 2 5.91 2.01a44.33 44.33 0 0 0 10.93 1.6c5.86 0 10.05-1.8 12.46-5.34 3.88-5.69 3.33-10.9-1.7-15.92-2.77-2.78-4.62-6.87-5-7.77-.78-2.66-2.84-5.62-6.25-5.62a5.7 5.7 0 0 0-4.6 2.46c-1-1.26-1.98-2.25-2.86-2.82A7.4 7.4 0 0 0 17.52 48Zm0 4c.51 0 1.14.22 1.82.65 2.14 1.36 6.25 8.43 7.76 11.18.5.92 1.37 1.31 2.14 1.31 1.55 0 2.75-1.53.15-3.48-3.92-2.93-2.55-7.72-.68-8.01.08-.02.17-.02.24-.02 1.7 0 2.45 2.93 2.45 2.93s2.2 5.52 5.98 9.3c3.77 3.77 3.97 6.8 1.22 10.83-1.88 2.75-5.47 3.58-9.16 3.58-3.81 0-7.73-.9-9.92-1.46-.11-.03-13.45-3.8-11.76-7 .28-.54.75-.76 1.34-.76 2.38 0 6.7 3.54 8.57 3.54.41 0 .7-.17.83-.6.79-2.85-12.06-4.05-10.98-8.17.2-.73.71-1.02 1.44-1.02 3.14 0 10.2 5.53 11.68 5.53.11 0 .2-.03.24-.1.74-1.2.33-2.04-4.9-5.2-5.21-3.16-8.88-5.06-6.8-7.33.24-.26.58-.38 1-.38 3.17 0 10.66 6.82 10.66 6.82s2.02 2.1 3.25 2.1c.28 0 .52-.1.68-.38.86-1.46-8.06-8.22-8.56-11.01-.34-1.9.24-2.85 1.31-2.85Z"}),a.jsx("path",{fill:"#FFD21E",d:"M38.6 76.69c2.75-4.04 2.55-7.07-1.22-10.84-3.78-3.77-5.98-9.3-5.98-9.3s-.82-3.2-2.69-2.9c-1.87.3-3.24 5.08.68 8.01 3.91 2.93-.78 4.92-2.29 2.17-1.5-2.75-5.62-9.82-7.76-11.18-2.13-1.35-3.63-.6-3.13 2.2.5 2.79 9.43 9.55 8.56 11-.87 1.47-3.93-1.71-3.93-1.71s-9.57-8.71-11.66-6.44c-2.08 2.27 1.59 4.17 6.8 7.33 5.23 3.16 5.64 4 4.9 5.2-.75 1.2-12.28-8.53-13.36-4.4-1.08 4.11 11.77 5.3 10.98 8.15-.8 2.85-9.06-5.38-10.74-2.18-1.7 3.21 11.65 6.98 11.76 7.01 4.3 1.12 15.25 3.49 19.08-2.12Z"}),a.jsx("path",{fill:"#FF9D0B",d:"M77.4 48c1.62 0 3.07.66 4.07 1.87a5.97 5.97 0 0 1 1.33 3.76 7.1 7.1 0 0 1 1.95-.3c1.55 0 2.95.59 3.94 1.66a5.8 5.8 0 0 1 .8 7 5.3 5.3 0 0 1 1.78 2.82c.24.9.48 2.8-.8 4.74a5.22 5.22 0 0 1 .37 5.02c-1.02 2.32-3.57 4.14-8.51 6.1-3.08 1.22-5.9 2-5.92 2.01a44.33 44.33 0 0 1-10.93 1.6c-5.86 0-10.05-1.8-12.46-5.34-3.88-5.69-3.33-10.9 1.7-15.92 2.78-2.78 4.63-6.87 5.01-7.77.78-2.66 2.83-5.62 6.24-5.62a5.7 5.7 0 0 1 4.6 2.46c1-1.26 1.98-2.25 2.87-2.82A7.4 7.4 0 0 1 77.4 48Zm0 4c-.51 0-1.13.22-1.82.65-2.13 1.36-6.25 8.43-7.76 11.18a2.43 2.43 0 0 1-2.14 1.31c-1.54 0-2.75-1.53-.14-3.48 3.91-2.93 2.54-7.72.67-8.01a1.54 1.54 0 0 0-.24-.02c-1.7 0-2.45 2.93-2.45 2.93s-2.2 5.52-5.97 9.3c-3.78 3.77-3.98 6.8-1.22 10.83 1.87 2.75 5.47 3.58 9.15 3.58 3.82 0 7.73-.9 9.93-1.46.1-.03 13.45-3.8 11.76-7-.29-.54-.75-.76-1.34-.76-2.38 0-6.71 3.54-8.57 3.54-.42 0-.71-.17-.83-.6-.8-2.85 12.05-4.05 10.97-8.17-.19-.73-.7-1.02-1.44-1.02-3.14 0-10.2 5.53-11.68 5.53-.1 0-.19-.03-.23-.1-.74-1.2-.34-2.04 4.88-5.2 5.23-3.16 8.9-5.06 6.8-7.33-.23-.26-.57-.38-.98-.38-3.18 0-10.67 6.82-10.67 6.82s-2.02 2.1-3.24 2.1a.74.74 0 0 1-.68-.38c-.87-1.46 8.05-8.22 8.55-11.01.34-1.9-.24-2.85-1.31-2.85Z"}),a.jsx("path",{fill:"#FFD21E",d:"M56.33 76.69c-2.75-4.04-2.56-7.07 1.22-10.84 3.77-3.77 5.97-9.3 5.97-9.3s.82-3.2 2.7-2.9c1.86.3 3.23 5.08-.68 8.01-3.92 2.93.78 4.92 2.28 2.17 1.51-2.75 5.63-9.82 7.76-11.18 2.13-1.35 3.64-.6 3.13 2.2-.5 2.79-9.42 9.55-8.55 11 .86 1.47 3.92-1.71 3.92-1.71s9.58-8.71 11.66-6.44c2.08 2.27-1.58 4.17-6.8 7.33-5.23 3.16-5.63 4-4.9 5.2.75 1.2 12.28-8.53 13.36-4.4 1.08 4.11-11.76 5.3-10.97 8.15.8 2.85 9.05-5.38 10.74-2.18 1.69 3.21-11.65 6.98-11.76 7.01-4.31 1.12-15.26 3.49-19.08-2.12Z"})]});function T(s){const t=[...new Set(s.map(r=>r.replace(/ \(subtask\)$/,"")))],l=t.length>3?[...t.slice(0,2),`${t.length-2} more`]:t;return l.length>1?`${l.slice(0,-1).join(", ")} and ${l[l.length-1]}`:l[0]}const z="language-modeling";function p(s){return s?s.toLowerCase().replace(/\(.*?\)/g," ").replace(/[^a-z]+/g," ").replace(/\bllm\b/g," ").replace(/\s+/g," ").trim().replace(/s$/,""):""}function B(s){return p(s.slug)==="large language model"||p(s.name)==="large language model"}function D(s){return s.tags.includes(z)?s.methods.filter(t=>!B(t)):s.methods}const S=({name:s,slug:t,logoUrl:l})=>{const[r,i]=g.useState(!1);return!l||r?null:a.jsx(d,{to:`/orgs/${t}`,className:"paper-organization-logo","aria-label":`View ${s} organization`,title:s,children:a.jsx("img",{src:l,alt:"",onError:()=>i(!0)})})},q=({paper:s,priority:t=!1,showInstitution:l=!0,highlightQuery:r,followReasons:i})=>{const m=v(),u=`/paper/${s.id}`,n=g.useCallback(()=>{m.prefetchQuery({queryKey:y.detail(s.id),queryFn:()=>C.get(s.id,!0),staleTime:M})},[s.id,m]),F=s.authors.slice(0,3).map((e,o)=>{var b,N;const f=(b=s.authorIds)==null?void 0:b[o],j=(N=s.authorHfProfiles)==null?void 0:N[o];return a.jsxs(g.Fragment,{children:[o>0&&", ",j&&a.jsx(L,{className:"paper-card-author-avatar",url:j.avatarUrl}),f?a.jsx(d,{to:`/authors/${f}`,children:e}):e]},o)}),c=s.authors.length,x=D(s);return a.jsxs("article",{className:"paper-card",children:[a.jsx(d,{to:u,className:"paper-thumb-wrap",onFocus:n,onMouseEnter:n,children:a.jsx(Z,{paperId:s.id,title:s.title,thumbnailUrl:s.thumbnailUrl,priority:t})}),a.jsxs("div",{className:"paper-body",children:[a.jsxs("div",{className:"paper-body-main",children:[i&&i.length>0&&a.jsxs("div",{className:"paper-follow-reason",children:["Because you follow ",T(i)]}),a.jsxs("h3",{className:"paper-title",children:[a.jsx(d,{to:u,onFocus:n,onMouseEnter:n,children:a.jsx(U,{title:s.title,highlight:r})}),l&&s.organizations.length>0&&a.jsx("span",{className:"paper-organization-logos",children:s.organizations.map(e=>a.jsx(S,{...e},e.slug))})]}),a.jsxs("div",{className:"paper-authors",children:[F,c>3&&a.jsxs("span",{children:[", ","+",c-3," authors"]}),s.date&&a.jsxs(a.Fragment,{children:[c>0?" · ":"",a.jsx("span",{children:s.date})]}),s.citations>0&&a.jsxs(a.Fragment,{children:[c>0||s.date?" · ":"",a.jsxs("span",{children:[s.citations.toLocaleString()," citations"]})]})]}),s.abstract&&a.jsx("p",{className:"paper-abstract",children:a.jsx(w,{text:s.abstract,highlight:r})}),s.sotaRanks.length>0&&a.jsx(A,{ranks:s.sotaRanks,paperHref:u}),(s.tags.length>0||x.length>0)&&a.jsxs("div",{className:"paper-tags paper-tags--clamped",children:[s.tags.map(e=>a.jsx(k,{slug:e},e)),x.map(e=>a.jsx(E,{method:e},e.id||e.slug||e.name))]})]}),(s.githubUrl||s.hfUrl)&&a.jsxs("div",{className:"paper-resources",children:[h(s.githubUrl)&&a.jsxs("a",{className:"paper-resource is-link",href:h(s.githubUrl)??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":"Open GitHub repository",onClick:e=>e.stopPropagation(),children:[a.jsx(P,{name:"github",size:20}),s.velocity24h!=null&&s.velocity24h>0&&a.jsxs("span",{className:"resource-stat",children:[a.jsxs("span",{className:"resource-value",children:[a.jsx("span",{className:"gh-rate-arrow",children:"↑"}),s.velocity24h.toFixed(1)]}),a.jsx("span",{className:"resource-label",children:"stars / hr"})]})]}),h(s.hfUrl)&&s.hfKind&&a.jsxs("a",{className:"paper-resource is-link",href:h(s.hfUrl)??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open Hugging Face ${s.hfKind}`,onClick:e=>e.stopPropagation(),children:[a.jsx($,{size:20}),a.jsxs("span",{className:"resource-stat",children:[a.jsx("span",{className:"resource-value",children:s.hfCount}),a.jsx("span",{className:"resource-label",children:s.hfKind})]})]})]})]})]})};export{q as P}; diff --git a/assets/PaperCard-tdTC_dRN.js b/assets/PaperCard-tdTC_dRN.js deleted file mode 100644 index f5954c6cfca7c4fe2ff35f0ba8b1db2a6e920903..0000000000000000000000000000000000000000 --- a/assets/PaperCard-tdTC_dRN.js +++ /dev/null @@ -1 +0,0 @@ -import{f as v,M as g,j as a,L as d}from"./index-CbgxfyGU.js";import{A as M}from"./AuthorAvatar-CUJMmp_z.js";import{P as y,S as L,T as Z,M as A}from"./SotaBadges-C-sTR-EF.js";import{I as k}from"./Icon-D-kA0Owz.js";import{L as P,a as w}from"./LatexTitle-Z-HGmZ-H.js";import{a as C,p as E}from"./paperQueryKeys-B8u1BWlI.js";import{s as h}from"./safeExternalHref-CkBrsh84.js";const U=({size:s=16})=>a.jsxs("svg",{className:"hf-logo",width:s,height:s,viewBox:"0 0 95 88",fill:"none","aria-hidden":"true",focusable:"false",children:[a.jsx("path",{fill:"#FFD21E",d:"M47.21 76.5a34.75 34.75 0 1 0 0-69.5 34.75 34.75 0 0 0 0 69.5Z"}),a.jsx("path",{fill:"#FF9D0B",d:"M81.96 41.75a34.75 34.75 0 1 0-69.5 0 34.75 34.75 0 0 0 69.5 0Zm-73.5 0a38.75 38.75 0 1 1 77.5 0 38.75 38.75 0 0 1-77.5 0Z"}),a.jsx("path",{fill:"#3A3B45",d:"M58.5 32.3c1.28.44 1.78 3.06 3.07 2.38a5 5 0 1 0-6.76-2.07c.61 1.15 2.55-.72 3.7-.32ZM34.95 32.3c-1.28.44-1.79 3.06-3.07 2.38a5 5 0 1 1 6.76-2.07c-.61 1.15-2.56-.72-3.7-.32Z"}),a.jsx("path",{fill:"#FF323D",d:"M46.96 56.29c9.83 0 13-8.76 13-13.26 0-2.34-1.57-1.6-4.09-.36-2.33 1.15-5.46 2.74-8.9 2.74-7.19 0-13-6.88-13-2.38s3.16 13.26 13 13.26Z"}),a.jsx("path",{fill:"#3A3B45",fillRule:"evenodd",clipRule:"evenodd",d:"M39.43 54a8.7 8.7 0 0 1 5.3-4.49c.4-.12.81.57 1.24 1.28.4.68.82 1.37 1.24 1.37.45 0 .9-.68 1.33-1.35.45-.7.89-1.38 1.32-1.25a8.61 8.61 0 0 1 5 4.17c3.73-2.94 5.1-7.74 5.1-10.7 0-2.34-1.57-1.6-4.09-.36l-.14.07c-2.31 1.15-5.39 2.67-8.77 2.67s-6.45-1.52-8.77-2.67c-2.6-1.29-4.23-2.1-4.23.29 0 3.05 1.46 8.06 5.47 10.97Z"}),a.jsx("path",{fill:"#FF9D0B",d:"M70.71 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM24.21 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM17.52 48c-1.62 0-3.06.66-4.07 1.87a5.97 5.97 0 0 0-1.33 3.76 7.1 7.1 0 0 0-1.94-.3c-1.55 0-2.95.59-3.94 1.66a5.8 5.8 0 0 0-.8 7 5.3 5.3 0 0 0-1.79 2.82c-.24.9-.48 2.8.8 4.74a5.22 5.22 0 0 0-.37 5.02c1.02 2.32 3.57 4.14 8.52 6.1 3.07 1.22 5.89 2 5.91 2.01a44.33 44.33 0 0 0 10.93 1.6c5.86 0 10.05-1.8 12.46-5.34 3.88-5.69 3.33-10.9-1.7-15.92-2.77-2.78-4.62-6.87-5-7.77-.78-2.66-2.84-5.62-6.25-5.62a5.7 5.7 0 0 0-4.6 2.46c-1-1.26-1.98-2.25-2.86-2.82A7.4 7.4 0 0 0 17.52 48Zm0 4c.51 0 1.14.22 1.82.65 2.14 1.36 6.25 8.43 7.76 11.18.5.92 1.37 1.31 2.14 1.31 1.55 0 2.75-1.53.15-3.48-3.92-2.93-2.55-7.72-.68-8.01.08-.02.17-.02.24-.02 1.7 0 2.45 2.93 2.45 2.93s2.2 5.52 5.98 9.3c3.77 3.77 3.97 6.8 1.22 10.83-1.88 2.75-5.47 3.58-9.16 3.58-3.81 0-7.73-.9-9.92-1.46-.11-.03-13.45-3.8-11.76-7 .28-.54.75-.76 1.34-.76 2.38 0 6.7 3.54 8.57 3.54.41 0 .7-.17.83-.6.79-2.85-12.06-4.05-10.98-8.17.2-.73.71-1.02 1.44-1.02 3.14 0 10.2 5.53 11.68 5.53.11 0 .2-.03.24-.1.74-1.2.33-2.04-4.9-5.2-5.21-3.16-8.88-5.06-6.8-7.33.24-.26.58-.38 1-.38 3.17 0 10.66 6.82 10.66 6.82s2.02 2.1 3.25 2.1c.28 0 .52-.1.68-.38.86-1.46-8.06-8.22-8.56-11.01-.34-1.9.24-2.85 1.31-2.85Z"}),a.jsx("path",{fill:"#FFD21E",d:"M38.6 76.69c2.75-4.04 2.55-7.07-1.22-10.84-3.78-3.77-5.98-9.3-5.98-9.3s-.82-3.2-2.69-2.9c-1.87.3-3.24 5.08.68 8.01 3.91 2.93-.78 4.92-2.29 2.17-1.5-2.75-5.62-9.82-7.76-11.18-2.13-1.35-3.63-.6-3.13 2.2.5 2.79 9.43 9.55 8.56 11-.87 1.47-3.93-1.71-3.93-1.71s-9.57-8.71-11.66-6.44c-2.08 2.27 1.59 4.17 6.8 7.33 5.23 3.16 5.64 4 4.9 5.2-.75 1.2-12.28-8.53-13.36-4.4-1.08 4.11 11.77 5.3 10.98 8.15-.8 2.85-9.06-5.38-10.74-2.18-1.7 3.21 11.65 6.98 11.76 7.01 4.3 1.12 15.25 3.49 19.08-2.12Z"}),a.jsx("path",{fill:"#FF9D0B",d:"M77.4 48c1.62 0 3.07.66 4.07 1.87a5.97 5.97 0 0 1 1.33 3.76 7.1 7.1 0 0 1 1.95-.3c1.55 0 2.95.59 3.94 1.66a5.8 5.8 0 0 1 .8 7 5.3 5.3 0 0 1 1.78 2.82c.24.9.48 2.8-.8 4.74a5.22 5.22 0 0 1 .37 5.02c-1.02 2.32-3.57 4.14-8.51 6.1-3.08 1.22-5.9 2-5.92 2.01a44.33 44.33 0 0 1-10.93 1.6c-5.86 0-10.05-1.8-12.46-5.34-3.88-5.69-3.33-10.9 1.7-15.92 2.78-2.78 4.63-6.87 5.01-7.77.78-2.66 2.83-5.62 6.24-5.62a5.7 5.7 0 0 1 4.6 2.46c1-1.26 1.98-2.25 2.87-2.82A7.4 7.4 0 0 1 77.4 48Zm0 4c-.51 0-1.13.22-1.82.65-2.13 1.36-6.25 8.43-7.76 11.18a2.43 2.43 0 0 1-2.14 1.31c-1.54 0-2.75-1.53-.14-3.48 3.91-2.93 2.54-7.72.67-8.01a1.54 1.54 0 0 0-.24-.02c-1.7 0-2.45 2.93-2.45 2.93s-2.2 5.52-5.97 9.3c-3.78 3.77-3.98 6.8-1.22 10.83 1.87 2.75 5.47 3.58 9.15 3.58 3.82 0 7.73-.9 9.93-1.46.1-.03 13.45-3.8 11.76-7-.29-.54-.75-.76-1.34-.76-2.38 0-6.71 3.54-8.57 3.54-.42 0-.71-.17-.83-.6-.8-2.85 12.05-4.05 10.97-8.17-.19-.73-.7-1.02-1.44-1.02-3.14 0-10.2 5.53-11.68 5.53-.1 0-.19-.03-.23-.1-.74-1.2-.34-2.04 4.88-5.2 5.23-3.16 8.9-5.06 6.8-7.33-.23-.26-.57-.38-.98-.38-3.18 0-10.67 6.82-10.67 6.82s-2.02 2.1-3.24 2.1a.74.74 0 0 1-.68-.38c-.87-1.46 8.05-8.22 8.55-11.01.34-1.9-.24-2.85-1.31-2.85Z"}),a.jsx("path",{fill:"#FFD21E",d:"M56.33 76.69c-2.75-4.04-2.56-7.07 1.22-10.84 3.77-3.77 5.97-9.3 5.97-9.3s.82-3.2 2.7-2.9c1.86.3 3.23 5.08-.68 8.01-3.92 2.93.78 4.92 2.28 2.17 1.51-2.75 5.63-9.82 7.76-11.18 2.13-1.35 3.64-.6 3.13 2.2-.5 2.79-9.42 9.55-8.55 11 .86 1.47 3.92-1.71 3.92-1.71s9.58-8.71 11.66-6.44c2.08 2.27-1.58 4.17-6.8 7.33-5.23 3.16-5.63 4-4.9 5.2.75 1.2 12.28-8.53 13.36-4.4 1.08 4.11-11.76 5.3-10.97 8.15.8 2.85 9.05-5.38 10.74-2.18 1.69 3.21-11.65 6.98-11.76 7.01-4.31 1.12-15.26 3.49-19.08-2.12Z"})]});function $(s){const t=[...new Set(s.map(r=>r.replace(/ \(subtask\)$/,"")))],l=t.length>3?[...t.slice(0,2),`${t.length-2} more`]:t;return l.length>1?`${l.slice(0,-1).join(", ")} and ${l[l.length-1]}`:l[0]}const z="language-modeling";function p(s){return s?s.toLowerCase().replace(/\(.*?\)/g," ").replace(/[^a-z]+/g," ").replace(/\bllm\b/g," ").replace(/\s+/g," ").trim().replace(/s$/,""):""}function B(s){return p(s.slug)==="large language model"||p(s.name)==="large language model"}function D(s){return s.tags.includes(z)?s.methods.filter(t=>!B(t)):s.methods}const K=({name:s,slug:t,logoUrl:l})=>{const[r,i]=g.useState(!1);return!l||r?null:a.jsx(d,{to:`/orgs/${t}`,className:"paper-organization-logo","aria-label":`View ${s} organization`,title:s,children:a.jsx("img",{src:l,alt:"",onError:()=>i(!0)})})},O=({paper:s,priority:t=!1,showInstitution:l=!0,highlightQuery:r,followReasons:i})=>{const m=v(),u=`/paper/${s.id}`,n=g.useCallback(()=>{m.prefetchQuery({queryKey:E.detail(s.id),queryFn:()=>C.get(s.id,!0),staleTime:10*60*1e3})},[s.id,m]),N=s.authors.slice(0,3).map((e,o)=>{var b,F;const f=(b=s.authorIds)==null?void 0:b[o],j=(F=s.authorHfProfiles)==null?void 0:F[o];return a.jsxs(g.Fragment,{children:[o>0&&", ",j&&a.jsx(M,{className:"paper-card-author-avatar",url:j.avatarUrl}),f?a.jsx(d,{to:`/authors/${f}`,children:e}):e]},o)}),c=s.authors.length,x=D(s);return a.jsxs("article",{className:"paper-card",children:[a.jsx(d,{to:u,className:"paper-thumb-wrap",onFocus:n,onMouseEnter:n,children:a.jsx(y,{paperId:s.id,title:s.title,thumbnailUrl:s.thumbnailUrl,priority:t})}),a.jsxs("div",{className:"paper-body",children:[a.jsxs("div",{className:"paper-body-main",children:[i&&i.length>0&&a.jsxs("div",{className:"paper-follow-reason",children:["Because you follow ",$(i)]}),a.jsxs("h3",{className:"paper-title",children:[a.jsx(d,{to:u,onFocus:n,onMouseEnter:n,children:a.jsx(P,{title:s.title,highlight:r})}),l&&s.organizations.length>0&&a.jsx("span",{className:"paper-organization-logos",children:s.organizations.map(e=>a.jsx(K,{...e},e.slug))})]}),a.jsxs("div",{className:"paper-authors",children:[N,c>3&&a.jsxs("span",{children:[", ","+",c-3," authors"]}),s.date&&a.jsxs(a.Fragment,{children:[c>0?" · ":"",a.jsx("span",{children:s.date})]}),s.citations>0&&a.jsxs(a.Fragment,{children:[c>0||s.date?" · ":"",a.jsxs("span",{children:[s.citations.toLocaleString()," citations"]})]})]}),s.abstract&&a.jsx("p",{className:"paper-abstract",children:a.jsx(w,{text:s.abstract,highlight:r})}),s.sotaRanks.length>0&&a.jsx(L,{ranks:s.sotaRanks,paperHref:u}),(s.tags.length>0||x.length>0)&&a.jsxs("div",{className:"paper-tags paper-tags--clamped",children:[s.tags.map(e=>a.jsx(Z,{slug:e},e)),x.map(e=>a.jsx(A,{method:e},e.id||e.slug||e.name))]})]}),(s.githubUrl||s.hfUrl)&&a.jsxs("div",{className:"paper-resources",children:[h(s.githubUrl)&&a.jsxs("a",{className:"paper-resource is-link",href:h(s.githubUrl)??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":"Open GitHub repository",onClick:e=>e.stopPropagation(),children:[a.jsx(k,{name:"github",size:20}),s.velocity24h!=null&&s.velocity24h>0&&a.jsxs("span",{className:"resource-stat",children:[a.jsxs("span",{className:"resource-value",children:[a.jsx("span",{className:"gh-rate-arrow",children:"↑"}),s.velocity24h.toFixed(1)]}),a.jsx("span",{className:"resource-label",children:"stars / hr"})]})]}),h(s.hfUrl)&&s.hfKind&&a.jsxs("a",{className:"paper-resource is-link",href:h(s.hfUrl)??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open Hugging Face ${s.hfKind}`,onClick:e=>e.stopPropagation(),children:[a.jsx(U,{size:20}),a.jsxs("span",{className:"resource-stat",children:[a.jsx("span",{className:"resource-value",children:s.hfCount}),a.jsx("span",{className:"resource-label",children:s.hfKind})]})]})]})]})]})};export{O as P}; diff --git a/assets/PaperDetailView-BlSDULsI.js b/assets/PaperDetailView-BlSDULsI.js new file mode 100644 index 0000000000000000000000000000000000000000..15e3bfe2753637707ea696f626a1a35a0111d75a --- /dev/null +++ b/assets/PaperDetailView-BlSDULsI.js @@ -0,0 +1,29 @@ +import{s as ft,b as Q,t as ea,T as it,v as re,w as ta,e as rs,x as J,d as b,p as me,j as e,C as gt,i as Z,y as xt,X as ns,o as Lt,P as is,z as ee,A as os,B as pe,D as he,E as ls,F as bt,G as Ce,I as Tt,J as sa,L as K,K as aa,M as ra,R as na,N as ia,O as cs,Q as oa,h as la,S as ca,U as Se,l as da,a as Pe,V as Ee,W as se,k as ds,u as ua,Y as Dt,Z as ma,q as Ft,_ as ha,$ as pa,a0 as fa,a1 as ga,a2 as xa,a3 as ba}from"./index-DyXq7-Tg.js";import{u as ae}from"./useMutation-UWxBeqtn.js";import{I as F}from"./Icon-T4LYkEQj.js";import{T as ja,M as va,S as ya,P as _a}from"./SotaBadges-vbLLOUtT.js";import{L as Ne,a as ot}from"./LatexTitle-Bkyz3jCs.js";import{e as $e,C as ka,E as Na}from"./ExternalSourceEvalBadge-K3r45EmO.js";import{p as U}from"./papers-Dh3ljlL0.js";import{s as wa,a as Ca}from"./transform-D46m70Qr.js";import{r as us,p as Sa}from"./paperReader-BIpQD5HO.js";import{a as Ea}from"./usePapers-B0s20UcU.js";import{u as Pa,f as $a}from"./useDocumentTitle-DcxM2Zv_.js";import{u as Ia}from"./preferences-COzeOLyS.js";import{s as Y}from"./safeExternalHref-CkBrsh84.js";import{F as Ut,i as Ra,P as Aa}from"./curation-YeS7FBYf.js";import{S as ue}from"./skeleton-C3IIzpSL.js";import{A as La,a as Ta}from"./alert-gbJBhAVE.js";import{B as A}from"./button-DZeAbOf2.js";import{D as Ie,a as Re,c as Ae,b as Le,d as Te,e as jt}from"./dialog-CfM0Uql2.js";import{A as Da,a as Fa}from"./AgentLogos-j-Qekw7T.js";import{C as Ua}from"./copy-CxR0OKx2.js";import{u as ye,r as Ba,e as za}from"./evaluationQueryInvalidation-Cm3s7Pfm.js";import{I as z}from"./input-DJqCAbs7.js";import{S as Bt}from"./searchable-select-DiDLwvbI.js";import{L as vt}from"./loader-circle-C75KLEgx.js";import{T as fe,n as He,g as zt,C as Ma}from"./CatalogEntityPreviewLink-BktpwL3_.js";import{S as ms,L as O,a as Ha}from"./SignInToEditDialog-B-oWVno5.js";import{c as G}from"./catalog-CRar2olQ.js";import{s as hs,p as ps}from"./submissions-Cz_J-Ha2.js";import{i as fs,a as gs,r as Oa}from"./queryInvalidation-CfHeNeUY.js";import{D as qa}from"./database-DflzbaZ5.js";import{P as ge}from"./plus-Yh42pKZz.js";import{S as lt}from"./search-8ssWDP68.js";import{B as xs}from"./badge-e6t3GCyf.js";import{G as Mt}from"./globe-BMJtRs4F.js";import{G as Ht}from"./github-RNrgGHRT.js";import{u as bs}from"./index-C041TDos.js";import{c as Oe,A as Ka}from"./codex-DFj4KHqP.js";import{M as Ga}from"./index-mCi_y_l3.js";import{r as Qa}from"./index-2CvJmBVB.js";import{u as Xa}from"./useIntersectionObserver-D6_Iig9a.js";import{a as ct}from"./account-cbblajck.js";import{S as Ot,s as Va}from"./savedPapersAuth-TV7AiXOw.js";import{o as Wa}from"./organizationNames-BVKzYEBp.js";import{A as Ya}from"./AuthorAvatar-B-9xS2Wo.js";import"./colors-BkWRhvFI.js";import"./hover-card-B45EJIn_.js";import"./useInfiniteQuery-BYh2zN-T.js";import"./popover-CTBEUp7Y.js";import"./textarea-DPixlM5U.js";/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ja=ft("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Za=ft("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const js=ft("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);function er(t){return t!=null&&t.can_directly_edit_catalog?"direct":"pending"}function tr(t){return(t??[]).filter(s=>!!(s.dataset_slug&&s.task_slug))}function sr(t,s,r="https://paperswithcode.co"){return s.map(a=>{const i=encodeURIComponent(a.evaluation_id),d=`${r}/api/v1/papers/${encodeURIComponent(t)}/leaderboard-badge.svg?eval=${i}&live=1`,o=`${r}/api/v1/papers/${encodeURIComponent(t)}/leaderboard-badge-link?eval=${i}`;return`[![${`Papers with Code: ${a.best_rank===1?"SOTA":`#${a.best_rank}`} on ${a.dataset_name}`}](${d})](${o})`}).join(` +`)}function ar(t,s=!0){return Q({queryKey:ea.byPaper(t),queryFn:()=>{if(!t)throw new Error("Paper ID is required");return $e.byPaper(t)},enabled:s&&!!t,staleTime:0,refetchOnMount:"always"})}const rr={models:"https://huggingface.co/",datasets:"https://huggingface.co/datasets/",spaces:"https://huggingface.co/spaces/"},qe=(t,s)=>{const r=(t[s]||[]).length;return r<100?{count:r,isLimited:!1}:{count:r,isLimited:!0}},Ke=(t,s)=>{const r=t[s];return Array.isArray(r)?r.map(a=>{if(typeof a=="string")return a;if(a&&typeof a=="object"){const i=a;return i.id||i.repoId||null}return null}).filter(a=>!!a).map(a=>`${rr[s]}${a}`):[]},nr=async t=>{try{return(await fetch(`https://huggingface.co/api/papers/${re(t)}`)).ok}catch{return!1}},ir=async t=>{const s=re(t),[r,a]=await Promise.all([fetch(`https://huggingface.co/api/arxiv/${s}/repos`).then(async l=>l.ok?l.json():(console.warn(`Failed to fetch repos for arXiv:${s}, status: ${l.status}`),null)).catch(l=>(console.warn(`Failed to fetch repos for arXiv:${s}:`,l),null)),nr(s)]);if(!r)return{models:0,datasets:0,spaces:0,modelUrls:[],datasetUrls:[],spaceUrls:[],isLimited:!1,paperExists:a};const i=qe(r,"models"),d=qe(r,"datasets"),o=qe(r,"spaces");return{models:i.count,datasets:d.count,spaces:o.count,modelUrls:Ke(r,"models"),datasetUrls:Ke(r,"datasets"),spaceUrls:Ke(r,"spaces"),isLimited:i.isLimited||d.isLimited||o.isLimited,paperExists:a}},or=t=>Q({queryKey:["huggingface-repos",t],queryFn:()=>ir(t),enabled:!!t,staleTime:it,retry:1});function lr(t,s){try{const r=new URL(t),a=r.pathname.split("/").filter(Boolean);return(a[0]==="datasets"||a[0]==="spaces")&&a.shift(),a.slice(0,2).join("/")||r.hostname.replace(/^www\./,"")}catch{return s}}function Ge(t,s,r){return[...new Set([...t,...s??[]])].map(a=>({href:a,label:lr(a,r)}))}function Qe(t,s,r){if(r==null&&t.length===0&&!(s!=null&&s.length))return;const a=new Set([...t,...s??[]]);return Math.max(a.size,r??0)}function Xe(t,s){if(!(t==null&&s==null))return Math.max(t??0,s??0)}function Ve(t){return t[0]??"https://huggingface.co"}function We(t,s){return s[0]??t}function cr(t){const s=`${t.title.slice(0,60)}${t.title.length>60?"…":""}`,r=`${t.authors[0]||""}${t.authors.length>1?" et al.":""}`,a=t.authors.join(" and "),i=(t.published||"").slice(0,4)||"—",d=(o,l)=>t.arxiv_id?`@article{${t.arxiv_id.replace(".","")}, + title={{${o}}}, + author=${l}, + year={{${i}}}, + eprint={{${t.arxiv_id}}}, + archivePrefix={{arXiv}} +}`:`@misc{paper${t.id}, + title={{${o}}}, + author=${l}, + year={{${i}}}, + url={{${t.source_url||t.url_abs||""}}} +}`;return{citationDisplay:d(s,`{{${r}}}`),citationCopy:d(t.title,`{${a}}`)}}function dr(t,s,r){var h,x,n;const a={models:t.hf_models??[],datasets:t.hf_datasets??[],spaces:t.hf_spaces??[]},i=t.linked_hf_artifacts,d=t.hf_artifact_summary,o={models:[...(s==null?void 0:s.modelUrls)??[],...(i==null?void 0:i.models)??[]],datasets:[...(s==null?void 0:s.datasetUrls)??[],...(i==null?void 0:i.datasets)??[]],spaces:[...(s==null?void 0:s.spaceUrls)??[],...(i==null?void 0:i.spaces)??[]]},l={models:Xe(s==null?void 0:s.models,d==null?void 0:d.model_count),datasets:Xe(s==null?void 0:s.datasets,d==null?void 0:d.dataset_count),spaces:Xe(s==null?void 0:s.spaces,d==null?void 0:d.space_count)},u={models:Ge(a.models,o.models,"Model"),datasets:Ge(a.datasets,o.datasets,"Dataset"),spaces:Ge(a.spaces,o.spaces,"Space")},v={models:u.models.map(({href:m})=>m),datasets:u.datasets.map(({href:m})=>m),spaces:u.spaces.map(({href:m})=>m)},p=t.arxiv_id!=null?re(t.arxiv_id):null,c=t.arxiv_id?{isLoading:r,paperHref:`https://huggingface.co/papers/${p}`,rows:[{label:"Models",href:We(`https://huggingface.co/models?other=arxiv:${t.arxiv_id}`,a.models),count:Qe(a.models,o.models,l.models),isLimited:s==null?void 0:s.isLimited,links:u.models},{label:"Datasets",href:We(`https://huggingface.co/datasets?other=arxiv:${t.arxiv_id}`,a.datasets),count:Qe(a.datasets,o.datasets,l.datasets),isLimited:s==null?void 0:s.isLimited,links:u.datasets},{label:"Spaces",href:We(`https://huggingface.co/papers/${p}`,a.spaces),count:Qe(a.spaces,o.spaces,l.spaces),isLimited:s==null?void 0:s.isLimited,links:u.spaces}],footer:`Cite arxiv.org/abs/${p} in a HF README to link it here.`}:{isLoading:!1,paperHref:null,rows:[{label:"Models",href:Ve(a.models),count:a.models.length,links:u.models},{label:"Datasets",href:Ve(a.datasets),count:a.datasets.length,links:u.datasets},{label:"Spaces",href:Ve(a.spaces),count:a.spaces.length,links:u.spaces}],footer:null},f=(t.methods??[]).filter(({source_paper_id:m})=>m===t.id),g=t.introduced_benchmarks??[],y=t.introduced_frameworks??[],w=[f.length&&(f.length===1?"this method":"these methods"),g.length&&(g.length===1?"this benchmark":"these benchmarks"),y.length&&(y.length===1?"this framework":"these frameworks")].filter(m=>!!m);return{...cr(t),allHfArtifactUrls:v,authorEntries:t.authors.map((m,j)=>{var S,E,C,R,L,B;return{name:m,id:((E=(S=t.author_links)==null?void 0:S[j])==null?void 0:E.id)??null,hf_username:((R=(C=t.author_links)==null?void 0:C[j])==null?void 0:R.hf_username)??null,hf_avatar_url:((B=(L=t.author_links)==null?void 0:L[j])==null?void 0:B.hf_avatar_url)??null}}),copyableRanks:tr(t.leaderboard_ranks),hasIntroducedItems:w.length>0,hasLineageItems:!!((h=t.predecessor_papers)!=null&&h.length||(x=t.successor_papers)!=null&&x.length),hfArtifactViewer:c,hfPaperExists:!!(s!=null&&s.paperExists),introducedBenchmarks:g,introducedFrameworks:y,introducedMethods:f,introducedSummary:w.join(" and "),numPages:t.num_pages||null,paperSourceLabel:t.arxiv_id?`arXiv:${t.arxiv_id}`:"External resource",predecessorPapers:t.predecessor_papers??[],projectPages:((n=t.project_pages)==null?void 0:n.filter(({url:m})=>m).map(m=>({...m,safeHref:Y(m.url)})))??[],repoSummary:wa(t.repositories),safeAbstractUrl:Y(t.url_abs),safeConferenceUrl:Y(t.conference_url_abs),safePdfUrl:Y(t.url_pdf),successorPapers:t.successor_papers??[]}}const ur=["tldr","abstract","tasks","methods","results"];function mr(t){if(!t)return{section:null,resultsTaskSlug:null};const[s,r]=t.split("?",2);if(!ur.includes(s))return{section:null,resultsTaskSlug:null};const a=s;return a!=="results"||!r?{section:a,resultsTaskSlug:null}:{section:a,resultsTaskSlug:new URLSearchParams(r).get("task")}}const vs=t=>`results-task-${t}`,hr=t=>`#results?task=${encodeURIComponent(t)}`;function pr({direct:t,paperId:s,refetchEvaluations:r,refetchPaper:a}){a(),r(),!(!t||!s)&&(U.primeCurationState(s,!0).catch(()=>{}),$e.primeCurationState(s,!0).catch(()=>{}))}function fr(t,s){const r=t?ta(t):"",a=rs(),{toast:i}=J(),{preferences:d}=Ia(),o=Ea(r,!!r),l=o.data,[u,v]=b.useState(!1);b.useEffect(()=>{!t||t===r||a(`/paper/${r}${window.location.search}${window.location.hash}`,{replace:!0})},[r,a,t]),Pa((l==null?void 0:l.title)&&(l.page_title||$a(l.title))),b.useEffect(()=>{if(v(!1),!(l!=null&&l.id))return;const m=window.setTimeout(()=>v(!0),0);return()=>window.clearTimeout(m)},[l==null?void 0:l.id]);const p=u&&!!(l!=null&&l.id),c=or(u?l==null?void 0:l.arxiv_id:void 0),f=ar(l==null?void 0:l.id,p),g=Q({queryKey:[...me.feeds.versions,l==null?void 0:l.arxiv_id],queryFn:()=>U.versions(re(l.arxiv_id)),enabled:p&&!!(l!=null&&l.arxiv_id),staleTime:it}),y=Q({queryKey:[...me.feeds.related,l==null?void 0:l.id],queryFn:()=>U.related(l.arxiv_id||l.id,4),enabled:p,staleTime:it});b.useEffect(()=>{const m=()=>{pr({direct:s==="direct",paperId:l==null?void 0:l.id,refetchEvaluations:f.refetch,refetchPaper:o.refetch}),i({title:"This section changed",description:"The latest state has been reloaded. Review your changes before submitting again.",variant:"destructive"})};return window.addEventListener("pwc:catalog-conflict",m),()=>window.removeEventListener("pwc:catalog-conflict",m)},[s,f.refetch,l==null?void 0:l.id,o.refetch,i]);const w=b.useMemo(()=>{const m=f.data;return!m||!d.hide_closed_source_evals?m:m.filter(j=>j.is_open!==!1)},[f.data,d.hide_closed_source_evals]),h=b.useMemo(()=>{if(!w)return[];const m=new Map;for(const j of w){const S=m.get(j.task_id);S?S.rows.push(j):m.set(j.task_id,{taskId:j.task_id,taskName:j.task_name||"—",taskSlug:j.task_slug,rows:[j]})}return[...m.values()]},[w]),x=b.useMemo(()=>l?dr(l,c.data,c.isLoading):null,[c.data,c.isLoading,l]),n=b.useRef(!1);return b.useEffect(()=>{n.current=!1},[r]),b.useEffect(()=>{let m=0;const j=(E=!1,C=!1)=>{const{section:R,resultsTaskSlug:L}=mr(window.location.hash.slice(1));if(!R||!l||R==="tldr"&&!l.tldr||R==="results"&&(!p||f.isLoading)||!E&&n.current)return;let B=R==="results"&&L?document.getElementById(vs(L)):document.getElementById(R);if(!B&&R==="results"&&L){if(h.some(({taskSlug:H})=>H===L))return;B=document.getElementById("results")}B&&(m=window.requestAnimationFrame(()=>{n.current=!0,B.scrollIntoView({block:"start",behavior:C?"smooth":"auto"})}))};j();const S=()=>{n.current=!1,j(!0,!0)};return window.addEventListener("hashchange",S),()=>{window.removeEventListener("hashchange",S),m&&window.cancelAnimationFrame(m)}},[h,f.isLoading,l,p]),{arxivId:r,evaluations:f.data,evaluationsByTask:h,evaluationsLoading:f.isLoading,paper:l,paperError:o.error,paperLoading:o.isLoading,presentation:x,refetchEvaluations:f.refetch,refetchPaper:o.refetch,relatedQuery:y,versions:g.data??[],visibleEvaluations:w}}function gr(){const[t,s]=b.useState(null),r=b.useCallback(i=>{s(i)},[]),a=b.useCallback((i,d)=>{s(o=>d?i:o===i?null:o)},[]);return{activeEditor:t,openEditor:r,setEditorOpen:a}}function xr({paperId:t}){const[s,r]=b.useState(!1),[a,i]=b.useState(!1),[d,o]=b.useState(!1),l=`Help me edit https://paperswithcode.co/paper/${t} using the public pwc CLI from https://github.com/huggingface/pwc-cli. Install or update the CLI following its README, then run pwc skills add to load its instructions. Run pwc auth login --paper ${t}; I will authorize this paper in my browser. Export with pwc paper edit export ${t} --output edits.json, make explicit operations for the corrections I request, and preview before submitting. For organization changes, use an organizations operation with payload {"organization_ids": [existing organization IDs]}; this replaces the paper’s organization links and publishes directly. Use existing organizations, benchmark and metric definitions, preserve unrelated entries, and cite source URLs where available. Never print or copy credentials. Ask me what to change if I have not specified it.`;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"action-btn",title:"Edit this paper page with Claude, Codex, Cursor, or OpenCode",onClick:()=>{r(!1),i(!1),o(!0)},children:["Edit with your agent",e.jsx(Da,{})]}),e.jsx(Ie,{open:d,onOpenChange:o,children:e.jsxs(Re,{className:"max-w-2xl",children:[e.jsxs(Ae,{children:[e.jsx(Le,{children:"Edit this paper with your agent"}),e.jsx(Te,{children:"Spotted a missing code link, a wrong task, or a missing benchmark result? Your favorite coding agent can fix it for you."})]}),e.jsx(Fa,{}),e.jsxs("ol",{className:"list-decimal space-y-1 pl-5 text-sm text-muted-foreground",children:[e.jsx("li",{children:"Copy the prompt below."}),e.jsx("li",{children:"Paste it into Claude Code, Codex, Cursor, OpenCode, or another coding agent, and tell it what to change."}),e.jsxs("li",{children:["The agent installs the ",e.jsx("a",{className:"underline",href:"https://github.com/huggingface/pwc-cli",target:"_blank",rel:"noreferrer",children:"pwc CLI"}),", asks you to authorize this paper with your Hugging Face account, and previews the edits before submitting them."]})]}),e.jsx("textarea",{"aria-label":"Paper edit prompt",readOnly:!0,value:l,className:"h-48 w-full resize-none rounded border bg-muted/40 p-3 font-mono text-xs",onFocus:u=>u.currentTarget.select()}),a&&e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not copy automatically. Select the prompt above and copy it manually."}),e.jsxs(A,{className:"justify-self-end",onClick:async()=>{try{await navigator.clipboard.writeText(l),r(!0),i(!1)}catch{i(!0)}},children:[s?e.jsx(gt,{size:14}):e.jsx(Ua,{size:14}),s?"Prompt copied":"Copy prompt"]})]})})]})}function br(t){return t.map(s=>{const r=s.best_metric||Object.keys(s.metrics)[0]||"";return{id:s.id,task_id:s.task_id,dataset_id:s.dataset_id,model_name:s.model_name||"",harness:s.harness||"",metric_name:r,metric_value:String(s.metrics[r]??""),original_metrics:{...s.metrics},original_metric_name:r,best_rank:s.best_rank!=null?String(s.best_rank):"",num_parameters:s.num_parameters!=null?String(s.num_parameters):"",hf_model_url:s.hf_model_url||"",is_open:s.is_open!==!1,operation:"unchanged"}})}function jr(t,s){const r={...t.original_metrics},a=r[t.original_metric_name];return t.original_metric_name!==s&&delete r[t.original_metric_name],r[s]=a!=null&&t.metric_value===String(a)?a:t.metric_value,r}function vr(t){const s=t==null?void 0:t.trim();return s?Number(s):void 0}function qt(t){const s=t.trim();return s?Number(s):null}function Ye(t){return t.trim()||null}function Je(t){return!!(t&&/^\d+$/.test(t.trim())&&Number.isSafeInteger(Number(t))&&Number(t)>0)}function ys(t){const s=[];return t.forEach((r,a)=>{var o;if(r.operation==="unchanged")return;const i=(l,u)=>{s.push({rowIndex:a,field:l,message:u})};if(r.operation!=="create"&&!Je(r.id)&&i("id","This result has no valid evaluation ID. Reload the paper before editing it."),r.operation==="delete")return;Je(r.task_id)||i("task_id","Select a valid task."),Je(r.dataset_id)||i("dataset_id","Select a valid dataset.");const d=r.metric_name.trim();d?d!==r.original_metric_name&&Object.prototype.hasOwnProperty.call(r.original_metrics,d)&&i("metric_name",`Cannot rename a metric to "${d}": this evaluation already has that score.`):i("metric_name","Select a metric."),(o=r.best_rank)!=null&&o.trim()&&!Number.isSafeInteger(Number(r.best_rank))&&i("best_rank","Enter a whole-number rank."),r.num_parameters.trim()&&(!Number.isSafeInteger(Number(r.num_parameters))||Number(r.num_parameters)<0)&&i("num_parameters","Enter a non-negative whole-number parameter count."),r.metric_value.trim()||i("metric_value","Enter a metric value.")}),s}function yr(t,s){const r=ys(t);return r.length?{valid:!1,errors:r}:{valid:!0,operations:_r(t,s)}}function _r(t,s){const r=[];for(const a of t){if(a.operation==="delete"){r.push({op:"delete",evaluation_id:Number(a.id)});continue}if(a.operation!=="create"&&a.operation!=="update")continue;const i=a.metric_name.trim(),d=s(a.task_id,a.dataset_id),o={task_id:Number(a.task_id),dataset_id:Number(a.dataset_id),metrics:jr(a,i),best_metric:i,is_open:a.is_open},l=a.model_name.trim(),u=vr(a.best_rank);if(a.operation==="create"){const v=qt(a.num_parameters),p=Ye(a.hf_model_url);r.push({op:"create",data:{...o,...l?{model_name:l}:{},...d&&a.harness.trim()?{harness:a.harness.trim()}:{},...u!==void 0?{best_rank:u}:{},...v!==null?{num_parameters:v}:{},...p!==null?{hf_model_url:p}:{}}});continue}r.push({op:"update",evaluation_id:Number(a.id),data:{...o,...l?{model_name:l}:{},harness:d?Ye(a.harness):null,...u!==void 0?{best_rank:u}:{},num_parameters:qt(a.num_parameters),hf_model_url:Ye(a.hf_model_url)}})}return r}function kr(t,s){return s.map(r=>{switch(r.op){case"delete":return{operation:"delete",evaluation_id:r.evaluation_id};case"update":return{operation:"update",evaluation_id:r.evaluation_id,payload:r.data};case"create":return{operation:"create",payload:{paper_id:t,...r.data}}}})}function Nr(t,s){const r=t.metrics(s.task_id,s.dataset_id).metrics.map(a=>({value:a.metric_name,label:a.metric_name,description:a.metric_direction==="higher_is_better"?"Higher is better":"Lower is better"}));return s.metric_name&&!r.some(a=>a.value===s.metric_name)&&r.unshift({value:s.metric_name,label:`${s.metric_name} (legacy)`}),r}const q="text-left py-2 px-2 font-medium text-sm";function wr({rows:t,catalog:s,draftErrors:r,errorId:a,isAdmin:i,showHarnessColumn:d,onFieldChange:o,onOpenSourceChange:l,onDelete:u}){const v=(f,g)=>r.some(y=>y.rowIndex===f&&y.field===g),p=(f,g)=>{const y=r.find(w=>w.rowIndex===f&&w.field===g);return y?e.jsx("p",{id:`${a}-${f}-${g}-error`,className:"text-xs text-destructive",children:y.message}):null},c=(f,g)=>({id:`${a}-${f}-${g}`,"aria-invalid":v(f,g),"aria-describedby":`${a}-${f}-${g}-error`});return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("th",{className:`${q} min-w-[180px]`,children:"Task"}),e.jsx("th",{className:`${q} min-w-[180px]`,children:"Dataset"}),e.jsx("th",{className:`${q} ${d?"min-w-[140px]":"min-w-[240px]"}`,children:"Model"}),d&&e.jsx("th",{className:`${q} min-w-[140px]`,children:"Harness"}),e.jsx("th",{className:`${q} min-w-[140px]`,children:"Metric"}),e.jsx("th",{className:q,children:"Value"}),e.jsx("th",{className:q,children:"Parameters"}),e.jsx("th",{className:`${q} min-w-[200px]`,children:"HF model URL"}),e.jsx("th",{className:`${q} w-20`,children:"Open source"}),e.jsx("th",{className:`${q} w-16`,children:"Action"})]})}),e.jsx("tbody",{children:t.map((f,g)=>{if(f.operation==="delete")return null;const y=s.task(f.task_id),w=s.dataset(f.dataset_id),h=s.metrics(f.task_id,f.dataset_id),x=Nr(s,f);return e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("td",{className:"py-2 px-2",children:e.jsxs("div",{role:"group","aria-label":"Task","aria-describedby":`${a}-${g}-task_id-error`,children:[e.jsx(Bt,{value:f.task_id,onChange:n=>o(g,"task_id",n),placeholder:"Select task",searchPlaceholder:"Search tasks...",emptyMessage:"No tasks found.",selectedOption:y?{value:y.id,label:y.name}:null,queryKey:["eval-edit-task-search"],queryFn:s.searchTasks}),p(g,"task_id")]})}),e.jsx("td",{className:"py-2 px-2",children:e.jsxs("div",{role:"group","aria-label":"Dataset","aria-describedby":`${a}-${g}-dataset_id-error`,children:[e.jsx(Bt,{value:f.dataset_id,onChange:n=>o(g,"dataset_id",n),placeholder:f.task_id?"Select dataset":"Select task first",searchPlaceholder:"Search datasets...",emptyMessage:f.task_id?"No datasets found for this task.":"Select a task first.",disabled:!f.task_id,selectedOption:w?{value:w.id,label:w.name}:null,queryKey:["eval-edit-dataset-search",f.task_id],queryFn:s.searchDatasets(f.task_id),enabled:!!f.task_id}),p(g,"dataset_id")]})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(z,{type:"text",className:"w-full text-sm",placeholder:"Model name",value:f.model_name,onChange:n=>o(g,"model_name",n.target.value)})}),d&&e.jsx("td",{className:"py-2 px-2",children:s.supportsHarness(f.task_id,f.dataset_id)?e.jsx(z,{type:"text",className:"w-full text-sm",placeholder:"Claude Code, Terminus, ...",value:f.harness,onChange:n=>o(g,"harness",n.target.value)}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not supported"})}),e.jsxs("td",{className:"py-2 px-2",children:[!f.task_id||!f.dataset_id?e.jsx("span",{className:"text-xs text-muted-foreground",children:"Select task + dataset"}):h.loading?e.jsxs("span",{className:"inline-flex items-center text-xs text-muted-foreground",children:[e.jsx(vt,{className:"mr-1 h-3 w-3 animate-spin"}),"Loading metrics..."]}):x.length>0?e.jsxs("select",{className:"w-full rounded-md border border-border bg-background px-2 py-1 text-sm",...c(g,"metric_name"),value:f.metric_name,onChange:n=>o(g,"metric_name",n.target.value),children:[e.jsx("option",{value:"",children:"Select metric"}),x.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))]}):!h.error&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"No configured metrics"}),h.error&&e.jsx("p",{className:"text-xs text-destructive",children:"Could not load metrics"}),p(g,"metric_name")]}),e.jsxs("td",{className:"py-2 px-2",children:[e.jsx(z,{type:"text",className:"w-full text-sm",placeholder:"44.9",...c(g,"metric_value"),value:f.metric_value,onChange:n=>o(g,"metric_value",n.target.value)}),p(g,"metric_value")]}),e.jsxs("td",{className:"py-2 px-2",children:[e.jsx(z,{type:"number",min:0,step:1,className:"w-full text-sm",placeholder:"e.g. 7000000000",...c(g,"num_parameters"),value:f.num_parameters,onChange:n=>o(g,"num_parameters",n.target.value),title:"Raw model parameter count (e.g. 7000000000 for a 7B model). Leave blank if unknown."}),p(g,"num_parameters")]}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(z,{type:"url",className:"w-full text-sm",placeholder:"https://huggingface.co/org/model",value:f.hf_model_url,onChange:n=>o(g,"hf_model_url",n.target.value),title:"Hugging Face model page for this row (must start with https://huggingface.co/). Leave blank if none."})}),e.jsx("td",{className:"py-2 px-2 text-center",children:e.jsx("input",{type:"checkbox",className:"h-4 w-4 align-middle",checked:f.is_open,onChange:n=>l(g,n.target.checked),title:"Whether the evaluated model is open-source. Uncheck for closed-source models."})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(A,{variant:"ghost",size:"sm",onClick:()=>u(g),className:"h-8 w-8 p-0 text-destructive hover:text-destructive",title:f.id&&!i?"Only administrators can delete published results":"Remove row",disabled:!!f.id&&!i,children:e.jsx(fe,{className:"w-4 h-4"})})})]},g)})})]})})}function Cr(t){const s=typeof window<"u"&&window.location.hostname==="staging.paperswithcode.co";return e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100",children:[e.jsx("p",{className:"font-medium",children:s?"Test-only: this change stays on staging.":"Your changes go live right away."}),e.jsx("p",{className:"mt-1 leading-snug",children:s?"This exercises staging-local pending behavior and is not queued for production review.":"Edits are applied immediately and reviewed afterwards. A few, such as links to unfamiliar sites, are held for an admin first."})]})}function V({title:t,description:s,className:r,submitMode:a,isAuthor:i=!1,onOpenChange:d,onSave:o,isSaving:l,saveDisabled:u=!1,footerStart:v,children:p}){const c=a==="pending";return e.jsx(Ie,{open:!0,onOpenChange:d,children:e.jsxs(Re,{className:r,children:[e.jsxs(Ae,{children:[e.jsx(Le,{children:t}),e.jsx(Te,{children:s})]}),c&&e.jsx(Cr,{isAuthor:i}),p,e.jsxs(jt,{children:[v,e.jsx(A,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(A,{onClick:o,disabled:l||u,children:l?e.jsxs(e.Fragment,{children:[e.jsx(vt,{className:"w-4 h-4 mr-2 animate-spin"}),c?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(gt,{className:"w-4 h-4 mr-2"}),c?"Submit for review":"Save Changes"]})})]})]})})}const Ze=100,Kt=t=>["eval-edit","task",t],Gt=t=>["eval-edit","dataset",t];function ce(...t){return new Map(t.flat().flatMap(s=>s?[[s.id,s]]:[]))}function et(t){return[...new Set(t.filter(Boolean))]}function Sr(t,s){var x;const r=Z(),a=b.useMemo(()=>et(t.map(n=>n.task_id)),[t]),i=b.useMemo(()=>et(t.map(n=>n.dataset_id)),[t]),d=b.useMemo(()=>et(t.map(n=>n.task_id&&n.dataset_id?`${n.task_id}:${n.dataset_id}`:"")),[t]),o=b.useMemo(()=>ce(s.map(n=>n.task_name?{id:n.task_id,name:n.task_name,slug:n.task_slug,level:0}:void 0)),[s]),l=b.useMemo(()=>ce(s.map(n=>n.dataset_name?{id:n.dataset_id,name:n.dataset_name,slug:n.dataset_slug}:void 0)),[s]),u=ye({queries:a.filter(n=>!o.has(n)).map(n=>({queryKey:Kt(n),queryFn:()=>G.getTask(n),staleTime:1/0})),combine:n=>n.map(m=>m.data)}),v=ye({queries:a.map(n=>({queryKey:["eval-edit","task-datasets",n],queryFn:async()=>(await G.listDatasets({task_id:Number(n),page_size:Ze})).results}))}),p=ce(...v.map(n=>n.data??[])),c=ye({queries:i.filter(n=>!l.has(n)&&!p.has(n)).map(n=>({queryKey:Gt(n),queryFn:()=>G.getDataset(n),staleTime:1/0})),combine:n=>({data:n.map(m=>m.data),loaded:n.every(m=>m.isSuccess)})}),f=ye({queries:d.map(n=>{const[m,j]=n.split(":");return{queryKey:["eval-edit","leaderboard-metrics",m,j],queryFn:()=>G.leaderboardMetrics(j,m)}})}),g=ce([...o.values()],u),y=ce([...l.values()],[...p.values()],c.data),w=((x=v.find(n=>n.error))==null?void 0:x.error)??null,h=v.every(n=>n.isSuccess)&&c.loaded;return{task:n=>g.get(n),dataset:n=>y.get(n),supportsHarness:(n,m)=>{var j;return!!(n&&m&&((j=y.get(m))!=null&&j.supports_harness))},metrics:(n,m)=>{const j=f[d.indexOf(`${n}:${m}`)];return{metrics:(j==null?void 0:j.data)??[],loading:(j==null?void 0:j.isFetching)??!1,error:(j==null?void 0:j.error)??null}},datasetListError:w,harnessSupportKnown:h,searchTasks:async n=>{const m=await G.listTasks({page_size:Ze,...n?{q:n}:{}});return m.results.forEach(j=>r.setQueryData(Kt(j.id),j)),m.results.map(j=>{var S;return{value:j.id,label:j.name,description:(S=j.description)==null?void 0:S.slice(0,100)}})},searchDatasets:n=>async m=>{const j=await G.listDatasets({task_id:Number(n),page_size:Ze,...m?{q:m}:{}});return j.results.forEach(S=>r.setQueryData(Gt(S.id),S)),j.results.map(S=>({value:S.id,label:S.name,description:S.full_name}))}}}function Er(t,{toast:s,queryClient:r,paperIds:a,queuedDescription:i}){if(t.status==="approved"){fs(r,a),gs(r),s({title:"Edit applied",description:"Your change is now live on this paper."});return}s({title:"Edit submitted for review",description:i})}function W({editType:t,paperId:s,arxivId:r,submitMode:a,messages:i,toPendingPayload:d,applyDirect:o,applyOptimistic:l,onSaved:u,onClose:v}){const p=Z(),{toast:c}=J(),f=a==="pending";return ae({mutationFn:async g=>f?{submitted:await hs.submit(ps(Number(s),t,d(g)))}:{paper:await o(g)},onMutate:async g=>{if(f||!l)return{};const y=await l(g);return v(),{rollback:y}},onSuccess:(g,y)=>{"submitted"in g?(Er(g.submitted,{toast:c,queryClient:p,paperIds:[s,r],queuedDescription:`Thanks! An admin will review your proposed ${i.proposal} shortly.`}),u==null||u(y,{direct:!1,live:g.submitted.status==="approved"})):(g.paper&&Oa(p,g.paper,[s,r]),u==null||u(y,{direct:!0,live:!0})),v()},onError:(g,y,w)=>{var h;(h=w==null?void 0:w.rollback)==null||h.call(w),c({title:f?"Could not submit edit":`Could not save ${i.noun}`,description:xt(g,f?"Failed to submit your edit. Please try again.":i.failure),variant:"destructive"})}})}const Pr={task_id:"",dataset_id:"",model_name:"",harness:"",metric_name:"",metric_value:"",original_metrics:{},original_metric_name:"",best_rank:"",num_parameters:"",hf_model_url:"",is_open:!0,operation:"create"};function $r(t){return(t??[]).some(s=>s.slug==="coding-agents"||s.name.trim().toLowerCase()==="coding agents")}function Qt(t,s){return{...t,...s,operation:t.operation==="unchanged"?"update":t.operation}}function Ir({onOpenChange:t,paperId:s,arxivId:r,initialEvaluations:a,paperTasks:i,submitMode:d="direct",isAdmin:o=!1,isAuthor:l=!1}){const u=b.useId(),v=$r(i),[p,c]=b.useState(null),f=b.useMemo(()=>br(a),[a]),g=p??f,[y,w]=b.useState(!1),h=y?ys(g):[],[x,n]=b.useState(null),m=Sr(g,a),j=Z(),{toast:S}=J(),E=W({editType:"evaluations",paperId:s,arxivId:r,submitMode:d,messages:{proposal:"evaluation changes",noun:"evaluations",failure:"Failed to update evaluations."},toPendingPayload:P=>({operations:P}),applyDirect:async P=>{if(!o&&P.length>50)throw new Error("Contributor evaluation batches are limited to 50 operations; contact an admin.");const N=Number(s);await $e.batch(N,kr(N,P))},onSaved:(P,{live:N})=>{N&&Ba(j,za(s,a,P,r))},onClose:()=>t(!1)}),C=(P,N)=>c(g.map((_,I)=>I===P?N(_):_)),R=P=>{if(!g[P].id){c(g.filter((N,_)=>_!==P));return}window.confirm("Delete this evaluation? You will be asked to sign in again if your session is older than 15 minutes.")&&C(P,N=>({...N,operation:"delete"}))},L=(P,N,_)=>{C(P,I=>{if(I[N]===_)return I;const $={[N]:_};return(N==="task_id"||N==="dataset_id")&&Object.assign($,{original_metrics:{},original_metric_name:"",metric_value:"",best_rank:"",metric_name:""}),N==="task_id"&&Object.assign($,{dataset_id:"",harness:""}),N==="dataset_id"&&_&&!m.supportsHarness(I.task_id,_)&&($.harness=""),Qt(I,$)})},B=()=>{w(!0);const P=yr(g,m.supportsHarness);if(P.valid){if(P.operations.length===0){S({title:"No changes to submit",description:"Your evaluation list matches the existing data."});return}E.mutate(P.operations)}},H=P=>g.slice(0,P+1).filter(N=>N.operation!=="delete").length;return e.jsxs(e.Fragment,{children:[e.jsxs(V,{title:"Edit Evaluation Results",description:"Add, edit, or remove evaluation results for this paper. Each row represents a benchmark result.",className:"max-w-6xl max-h-[800px]",submitMode:d,isAuthor:l,onOpenChange:t,onSave:B,isSaving:E.isPending,saveDisabled:!m.harnessSupportKnown,footerStart:e.jsxs("div",{className:"flex flex-wrap gap-2 sm:mr-auto",children:[e.jsx(A,{variant:"ghost",onClick:()=>n("benchmark"),children:"Suggest a new benchmark"}),e.jsx(A,{variant:"ghost",onClick:()=>n("metric"),children:"Suggest a new metric"})]}),children:[h.length>0&&e.jsxs("div",{role:"alert",className:"text-sm text-destructive",children:["Fix the following errors before saving. No changes have been submitted.",e.jsx("ul",{children:h.map(P=>e.jsxs("li",{children:["Row ",H(P.rowIndex),": ",P.message]},`${P.rowIndex}-${P.field}`))})]}),m.datasetListError&&e.jsxs("p",{className:"text-sm text-destructive",children:["Could not load the benchmarks for these tasks: ",m.datasetListError.message]}),e.jsxs("div",{className:"py-4 overflow-y-auto max-h-[600px]",children:[g.some(P=>P.operation!=="delete")?e.jsx(wr,{rows:g,catalog:m,draftErrors:h,errorId:u,isAdmin:o,showHarnessColumn:v,onFieldChange:L,onOpenSourceChange:(P,N)=>C(P,_=>Qt(_,{is_open:N})),onDelete:R}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(qa,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"No evaluation results yet"}),e.jsx("p",{className:"text-sm mt-2",children:'Click "Add Row" below to add a new evaluation'})]}),e.jsx("div",{className:"mt-4",children:e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>c([...g,Pr]),className:"flex items-center space-x-2",children:[e.jsx(ge,{className:"w-4 h-4"}),e.jsx("span",{children:"Add Row"})]})})]})]}),e.jsx(ms,{open:x!==null,onOpenChange:P=>{P||n(null)},paperId:s,kind:x??"benchmark"})]})}const tt=[{key:"hf_models",label:"Models",placeholder:"https://huggingface.co/org/model"},{key:"hf_datasets",label:"Datasets",placeholder:"https://huggingface.co/datasets/org/data"},{key:"hf_spaces",label:"Spaces",placeholder:"https://huggingface.co/spaces/org/demo"}];function Xt(t){return t.map(s=>s.trim()).filter(Boolean)}function st(t,s){const r=Xt(t).sort(),a=Xt(s).sort();return r.length!==a.length?!1:r.every((i,d)=>i===a[d])}function Rr(t,s){return st(t.hf_models,s.hf_models)&&st(t.hf_datasets,s.hf_datasets)&&st(t.hf_spaces,s.hf_spaces)}function Ar({onOpenChange:t,paperId:s,arxivId:r,initialArtifacts:a,submitMode:i="direct",isAuthor:d=!1}){const[o,l]=b.useState(a),[u,v]=b.useState({hf_models:"",hf_datasets:"",hf_spaces:""}),p=W({editType:"hf_artifacts",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"Hugging Face artifact changes",noun:"Hugging Face artifacts",failure:"Failed to update Hugging Face artifacts."},toPendingPayload:h=>h,applyDirect:h=>U.updateHfArtifacts(s,h),onClose:()=>t(!1)}),c=()=>{const h={hf_models:[...o.hf_models],hf_datasets:[...o.hf_datasets],hf_spaces:[...o.hf_spaces]};for(const{key:x}of tt){const n=u[x].trim();if(n){if(h[x].some(m=>m.trim()===n))return alert(`This ${x.replace("hf_","")} URL is already added`),null;h[x]=[...h[x],n]}}return h},f=h=>{const x=u[h].trim();if(x){if(o[h].some(n=>n.trim()===x)){alert(`This ${h.replace("hf_","")} URL is already added`);return}l(n=>({...n,[h]:[...n[h],x]})),v(n=>({...n,[h]:""}))}},g=(h,x)=>{l(n=>({...n,[h]:n[h].filter(m=>m!==x)}))},y=()=>{const h=c();if(h===null)return;const x=Object.keys(a).some(n=>a[n].some(m=>!h[n].includes(m)));i==="direct"&&x&&!window.confirm("Remove one or more Hugging Face artifact links?")||p.mutate(h)},w=b.useMemo(()=>{const h={hf_models:[...o.hf_models],hf_datasets:[...o.hf_datasets],hf_spaces:[...o.hf_spaces]};for(const{key:x}of tt){const n=u[x].trim();if(n){if(h[x].some(m=>m.trim()===n))return!1;h[x]=[...h[x],n]}}return!Rr(h,a)},[o,u,a]);return e.jsx(V,{title:"Edit Hugging Face Artifacts",description:"Add or remove linked Hugging Face models, datasets, and Spaces for this paper.",className:"max-w-2xl max-h-[700px]",submitMode:i,isAuthor:d,onOpenChange:t,onSave:y,isSaving:p.isPending,saveDisabled:!w,children:e.jsx("div",{className:"space-y-6 py-2 overflow-y-auto max-h-[460px]",children:tt.map(({key:h,label:x,placeholder:n})=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:x}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(z,{type:"url",placeholder:n,value:u[h],onChange:m=>v(j=>({...j,[h]:m.target.value})),onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),f(h))},className:"flex-1"}),e.jsxs(A,{onClick:()=>f(h),size:"sm",disabled:!u[h].trim(),children:[e.jsx(ge,{className:"w-4 h-4 mr-1"}),"Add"]})]}),o[h].length>0?e.jsx("div",{className:"space-y-2",children:o[h].map(m=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate flex-1",children:m}),e.jsx(A,{variant:"ghost",size:"sm",onClick:()=>g(h,m),className:"h-8 px-2 text-destructive hover:text-destructive",title:`Remove ${x.toLowerCase()} URL`,children:e.jsx(fe,{className:"w-4 h-4"})})]},m))}):e.jsxs("div",{className:"text-xs text-muted-foreground",children:["No ",x.toLowerCase()," linked yet."]})]},h))})})}const _s=["image/jpeg","image/png","image/webp","image/gif"],Lr=2*1024*1024;function Tr(t){return _s.includes(t.type)?t.size>Lr?Promise.reject(new Error("Logo must be 2 MB or smaller.")):new Promise((s,r)=>{const a=new FileReader;a.onload=()=>s({file_name:t.name,mime_type:t.type,data_url:String(a.result)}),a.onerror=()=>r(new Error("Could not read that logo.")),a.readAsDataURL(t)}):Promise.reject(new Error("Choose a JPEG, PNG, WebP, or GIF logo."))}function Dr({paperId:t,initialName:s,onApplied:r,onUnsentChange:a}){const[i,d]=b.useState(s),[o,l]=b.useState(""),[u,v]=b.useState(""),[p,c]=b.useState(null),[f,g]=b.useState(""),y=ae({mutationFn:()=>hs.submit(ps(Number(t),"new_organization",{name:i.trim(),...o.trim()?{hf_slug:o.trim()}:{},...u.trim()?{website_url:u.trim()}:{},...p?{image:p}:{}})),onSuccess:h=>{h.status==="approved"&&r(i.trim())}}),w=!y.isSuccess&&!!(o.trim()||u.trim()||p);return b.useEffect(()=>a(w),[a,w]),b.useEffect(()=>()=>a(!1),[a]),y.isSuccess?e.jsxs("p",{className:"rounded border p-3 text-sm",children:['Thanks! "',i.trim(),'" was submitted for review. Once an admin approves it, the organization is created and added to this paper.']}):e.jsxs("form",{className:"space-y-2 rounded border p-3",onSubmit:h=>{h.preventDefault(),y.mutate()},children:[e.jsx("p",{className:"text-sm font-medium",children:"Suggest a new organization"}),e.jsx(z,{"aria-label":"Organization name",placeholder:"Name",value:i,maxLength:200,onChange:h=>d(h.target.value)}),e.jsx(z,{"aria-label":"Hugging Face organization",placeholder:"Hugging Face organization (e.g. https://huggingface.co/PrimeIntellect)",value:o,onChange:h=>l(h.target.value)}),e.jsx(z,{"aria-label":"Website",type:"url",placeholder:"Website (e.g. https://www.primeintellect.ai)",value:u,onChange:h=>v(h.target.value)}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Logo (optional)",e.jsx("input",{"aria-label":"Logo",type:"file",accept:_s.join(","),onChange:h=>{var n;const x=(n=h.target.files)==null?void 0:n[0];c(null),g(""),x&&Tr(x).then(c,m=>g(m.message))}})]}),p&&e.jsx("img",{src:p.data_url,alt:"Selected logo",className:"h-12 w-12 rounded border object-contain"}),f&&e.jsx("p",{className:"text-sm text-destructive",children:f}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"With a Hugging Face organization it is added right away; otherwise an admin reviews it."}),e.jsx(A,{type:"submit",variant:"outline",disabled:!i.trim()||!o.trim()&&!u.trim()||y.isPending,children:y.isPending?"Submitting...":"Submit organization"})]}),y.error&&e.jsx("p",{className:"text-sm text-destructive",children:xt(y.error,"Could not submit this organization.")})]})}const Fr=({onOpenChange:t,paperId:s,arxivId:r,initialOrganizationIds:a,submitMode:i="direct",isAuthor:d})=>{var n;const[o,l]=b.useState(a),[u,v]=b.useState(""),[p,c]=b.useState(!1),f=Z(),{toast:g}=J(),y=Q({queryKey:[...Lt.organizations,"curation"],queryFn:()=>G.organizations(!1)}),w=b.useMemo(()=>{var S,E;const m=u.trim().toLocaleLowerCase();if(!m)return((S=y.data)==null?void 0:S.results)??[];const j=C=>C===m?0:C.startsWith(m)?1:C.split(/[^\p{L}\p{N}]+/u).some(R=>R.startsWith(m))?2:3;return(((E=y.data)==null?void 0:E.results)??[]).map(C=>({organization:C,name:C.name.toLocaleLowerCase()})).filter(({name:C})=>C.includes(m)).sort((C,R)=>j(C.name)-j(R.name)).map(({organization:C})=>C)},[(n=y.data)==null?void 0:n.results,u]),h=W({editType:"organizations",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"organization changes",noun:"organizations",failure:"Failed to update organizations."},toPendingPayload:m=>({organization_ids:m}),applyDirect:m=>U.updateOrganizations(s,m),onClose:()=>t(!1)}),x=()=>{a.some(m=>!o.includes(m))&&!window.confirm("Remove one or more organizations from this paper? Destructive edits may require a fresh sign-in.")||h.mutate(o)};return e.jsxs(V,{title:"Edit organizations",description:"Associate organizations with this paper. If one is missing, search for it and suggest it for review.",submitMode:i,isAuthor:d,onOpenChange:t,onSave:x,isSaving:h.isPending,saveDisabled:p,children:[e.jsxs("div",{className:"relative",children:[e.jsx(lt,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(z,{type:"search","aria-label":"Search organizations",placeholder:"Search organizations...",value:u,onChange:m=>v(m.target.value),className:"pl-9 pr-9"}),u&&e.jsx("button",{type:"button",onClick:()=>v(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear organization search",children:e.jsx(ns,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"max-h-80 space-y-2 overflow-auto",children:[w.map(m=>{const j=Number(m.id);return e.jsxs("label",{className:"flex items-center gap-2 rounded border p-2",children:[e.jsx("input",{type:"checkbox",checked:o.includes(j),onChange:S=>l(E=>S.target.checked?[...E,j]:E.filter(C=>C!==j))}),m.name]},m.id)}),!y.isLoading&&w.length===0&&e.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:u.trim()?`No organizations found matching "${u.trim()}"`:"No organizations available"})]}),!y.isLoading&&w.length===0&&u.trim()&&e.jsx(Dr,{paperId:s,initialName:u.trim(),onApplied:m=>{t(!1),g({title:"Organization added",description:`Added "${m}" to this paper.`}),fs(f,[s]),gs(f),f.invalidateQueries({queryKey:Lt.organizations})},onUnsentChange:c},u.trim()),p&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Submit the organization above, or clear the search, before saving."})]})};function Ur({onOpenChange:t,paperId:s,arxivId:r,initialProjectPages:a,submitMode:i="direct",isAuthor:d=!1}){const[o,l]=b.useState(a),[u,v]=b.useState(""),p=W({editType:"project_pages",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"project page changes",noun:"project pages",failure:"Failed to update project pages."},toPendingPayload:x=>({project_pages:x}),applyDirect:x=>U.updateProjectPages(s,x),onClose:()=>t(!1)}),c=()=>{const x=u.trim();return x?o.some(n=>n.url===x)?(alert("This project page URL is already added"),null):[...o,{url:x,is_official:!1}]:o},f=()=>{const x=c();x!==null&&x.length!==o.length&&(l(x),v(""))},g=x=>{l(o.filter(n=>n.url!==x))},y=x=>{l(o.map(n=>n.url===x?{...n,is_official:!n.is_official}:n))},w=()=>{const x=c();x!==null&&(i==="direct"&&a.some(n=>!x.some(m=>m.url===n.url))&&!window.confirm("Remove one or more project pages from this paper?")||p.mutate(x))},h=b.useMemo(()=>{const x=u.trim(),n=x?[...o,{url:x,is_official:!1}]:o;if(n.length!==a.length)return!0;const m=new Map(a.map(j=>[j.url.trim(),!!j.is_official]));return n.some(j=>{const S=m.get(j.url.trim());return S===void 0||S!==!!j.is_official})},[o,u,a]);return e.jsxs(V,{title:"Edit Paper Project Pages",description:"Add or remove project page URLs (e.g. authors' demo or landing pages) associated with this paper. Mark pages as official if they are created by the paper authors.",className:"max-w-2xl max-h-[600px]",submitMode:i,isAuthor:d,onOpenChange:t,onSave:w,isSaving:p.isPending,saveDisabled:!h,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Add Project Page URL"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(z,{type:"url",placeholder:"https://example.com/project",value:u,onChange:x=>v(x.target.value),onKeyPress:x=>{x.key==="Enter"&&(x.preventDefault(),f())},className:"flex-1"}),e.jsxs(A,{onClick:f,size:"sm",disabled:!u.trim(),children:[e.jsx(ge,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[350px]",children:o.length>0?e.jsx("div",{className:"space-y-2",children:o.map((x,n)=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx(Mt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate",children:x.url}),x.is_official&&e.jsx(xs,{variant:"secondary",className:"text-xs",children:"Official"})]})}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxs(A,{variant:x.is_official?"default":"outline",size:"sm",onClick:()=>y(x.url),className:"h-8 px-2 text-xs",title:x.is_official?"Click to unmark as official (created by paper authors)":"Click to mark as official (created by paper authors)",children:[e.jsx(js,{className:`w-3.5 h-3.5 mr-1 ${x.is_official?"fill-current":""}`}),x.is_official?"Official":"Mark official"]}),e.jsx(A,{variant:"ghost",size:"sm",onClick:()=>g(x.url),className:"h-8 px-2 text-destructive hover:text-destructive",title:"Remove project page",children:e.jsx(fe,{className:"w-4 h-4"})})]})]},n))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Mt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No project pages added yet"}),e.jsx("p",{className:"text-xs mt-1",children:"Add a project page URL above to get started"})]})})]})}function Br({onOpenChange:t,paperId:s,arxivId:r,initialRepositories:a,submitMode:i="direct",isAuthor:d=!1}){const[o,l]=b.useState(a),[u,v]=b.useState(""),p=W({editType:"repositories",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"repository changes",noun:"repositories",failure:"Failed to update paper repositories."},toPendingPayload:n=>({repositories:n}),applyDirect:n=>U.updateRepositories(s,n),onClose:()=>t(!1)}),c=n=>{const m=[];for(const j of n){const S=m.find(E=>zt(E.url,j.url));if(S)S.is_official=S.is_official||j.is_official;else{const E=He(j.url);m.push({url:E??j.url.trim(),is_official:j.is_official})}}return m},f=()=>{const n=u.trim(),m=n?[...o,{url:n,is_official:!1}]:o;return n&&o.some(j=>zt(j.url,n))?(alert("This repository URL is already added"),null):c(m)},g=()=>{const n=f();n!==null&&n.length!==o.length&&(l(n),v(""))},y=n=>{l(o.filter(m=>m.url!==n))},w=n=>{l(o.map(m=>m.url===n?{...m,is_official:!m.is_official}:m))},h=()=>{const n=f();n!==null&&(i==="direct"&&a.some(m=>!n.some(j=>j.url===m.url))&&!window.confirm("Remove one or more repositories from this paper?")||p.mutate(n))},x=b.useMemo(()=>{const n=u.trim(),m=n?[...o,{url:n,is_official:!1}]:o;if(m.length!==a.length)return!0;const j=c(a),S=c(m);if(S.length!==j.length)return!0;const E=new Map(j.map(C=>[He(C.url)??C.url.trim(),!!C.is_official]));return S.some(C=>{const R=He(C.url)??C.url.trim(),L=E.get(R);return L===void 0||L!==!!C.is_official})},[o,u,a]);return e.jsxs(V,{title:"Edit Paper Repositories",description:"Add or remove GitHub repository URLs associated with this paper. Mark repositories as official if they are created by the paper authors.",className:"max-w-2xl max-h-[600px]",submitMode:i,isAuthor:d,onOpenChange:t,onSave:h,isSaving:p.isPending,saveDisabled:!x,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Add Repository URL"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(z,{type:"url",placeholder:"https://github.com/owner/repo",value:u,onChange:n=>v(n.target.value),onKeyPress:n=>{n.key==="Enter"&&(n.preventDefault(),g())},className:"flex-1"}),e.jsxs(A,{onClick:g,size:"sm",disabled:!u.trim(),children:[e.jsx(ge,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[350px]",children:o.length>0?e.jsx("div",{className:"space-y-2",children:o.map((n,m)=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx(Ht,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate",children:n.url}),n.is_official&&e.jsx(xs,{variant:"secondary",className:"text-xs",children:"Official"})]})}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxs(A,{variant:n.is_official?"default":"outline",size:"sm",onClick:()=>w(n.url),className:"h-8 px-2 text-xs",title:n.is_official?"Click to unmark as official (created by paper authors)":"Click to mark as official (created by paper authors)",children:[e.jsx(js,{className:`w-3.5 h-3.5 mr-1 ${n.is_official?"fill-current":""}`}),n.is_official?"Official":"Mark official"]}),e.jsx(A,{variant:"ghost",size:"sm",onClick:()=>y(n.url),className:"h-8 px-2 text-destructive hover:text-destructive",title:"Remove repository",children:e.jsx(fe,{className:"w-4 h-4"})})]})]},m))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Ht,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No repositories added yet"}),e.jsx("p",{className:"text-xs mt-1",children:"Add a repository URL above to get started"})]})})]})}function zr({onOpenChange:t,paperId:s,arxivId:r,initialUrl:a,submitMode:i="direct",isAuthor:d=!1}){const[o,l]=b.useState(a),u=W({editType:"source_url",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"source URL change",noun:"source URL",failure:"Failed to update source URL."},toPendingPayload:g=>({source_url:g}),applyDirect:g=>U.updateSourceUrl(s,g),onClose:()=>t(!1)}),v=o.trim(),p=/^https?:\/\//i.test(v),c=v!==(a||"").trim(),f=()=>{p&&u.mutate(v)};return e.jsx(V,{title:"Edit Source URL",description:'Update the canonical URL for this external paper. This is the page the "Source page" button links to. ArXiv papers cannot edit this field.',className:"max-w-2xl",submitMode:i,isAuthor:d,onOpenChange:t,onSave:f,isSaving:u.isPending,saveDisabled:!p||!c,children:e.jsxs("div",{className:"space-y-2 py-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Source URL"}),e.jsx(z,{type:"url",placeholder:"https://example.com/paper",value:o,onChange:g=>l(g.target.value),onKeyPress:g=>{g.key==="Enter"&&p&&c&&(g.preventDefault(),f())}}),!p&&v.length>0&&e.jsx("p",{className:"text-xs text-destructive",children:"URL must start with http:// or https://"})]})})}var De="Checkbox",[Mr]=bt(De),[Hr,yt]=Mr(De);function Or(t){const{__scopeCheckbox:s,checked:r,children:a,defaultChecked:i,disabled:d,form:o,name:l,onCheckedChange:u,required:v,value:p="on",internal_do_not_use_render:c}=t,[f,g]=os({prop:r,defaultProp:i??!1,onChange:u,caller:De}),[y,w]=b.useState(null),[h,x]=b.useState(null),n=b.useRef(!1),m=y?!!o||!!y.closest("form"):!0,j={checked:f,disabled:d,setChecked:g,control:y,setControl:w,name:l,form:o,value:p,hasConsumerStoppedPropagationRef:n,required:v,defaultChecked:X(i)?!1:i,isFormControl:m,bubbleInput:h,setBubbleInput:x};return e.jsx(Hr,{scope:s,...j,children:qr(c)?c(j):a})}var ks="CheckboxTrigger",Ns=b.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:r,...a},i)=>{const{control:d,value:o,disabled:l,checked:u,required:v,setControl:p,setChecked:c,hasConsumerStoppedPropagationRef:f,isFormControl:g,bubbleInput:y}=yt(ks,t),w=pe(i,p),h=b.useRef(u);return b.useEffect(()=>{const x=d==null?void 0:d.form;if(x){const n=()=>c(h.current);return x.addEventListener("reset",n),()=>x.removeEventListener("reset",n)}},[d,c]),e.jsx(ee.button,{type:"button",role:"checkbox","aria-checked":X(u)?"mixed":u,"aria-required":v,"data-state":Ps(u),"data-disabled":l?"":void 0,disabled:l,value:o,...a,ref:w,onKeyDown:he(s,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:he(r,x=>{c(n=>X(n)?!0:!n),y&&g&&(f.current=x.isPropagationStopped(),f.current||x.stopPropagation())})})});Ns.displayName=ks;var _t=b.forwardRef((t,s)=>{const{__scopeCheckbox:r,name:a,checked:i,defaultChecked:d,required:o,disabled:l,value:u,onCheckedChange:v,form:p,...c}=t;return e.jsx(Or,{__scopeCheckbox:r,checked:i,defaultChecked:d,disabled:l,required:o,onCheckedChange:v,name:a,form:p,value:u,internal_do_not_use_render:({isFormControl:f})=>e.jsxs(e.Fragment,{children:[e.jsx(Ns,{...c,ref:s,__scopeCheckbox:r}),f&&e.jsx(Es,{__scopeCheckbox:r})]})})});_t.displayName=De;var ws="CheckboxIndicator",Cs=b.forwardRef((t,s)=>{const{__scopeCheckbox:r,forceMount:a,...i}=t,d=yt(ws,r);return e.jsx(is,{present:a||X(d.checked)||d.checked===!0,children:e.jsx(ee.span,{"data-state":Ps(d.checked),"data-disabled":d.disabled?"":void 0,...i,ref:s,style:{pointerEvents:"none",...t.style}})})});Cs.displayName=ws;var Ss="CheckboxBubbleInput",Es=b.forwardRef(({__scopeCheckbox:t,...s},r)=>{const{control:a,hasConsumerStoppedPropagationRef:i,checked:d,defaultChecked:o,required:l,disabled:u,name:v,value:p,form:c,bubbleInput:f,setBubbleInput:g}=yt(Ss,t),y=pe(r,g),w=bs(d),h=ls(a);b.useEffect(()=>{const n=f;if(!n)return;const m=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(m,"checked").set,E=!i.current;if(w!==d&&S){const C=new Event("click",{bubbles:E});n.indeterminate=X(d),S.call(n,X(d)?!1:d),n.dispatchEvent(C)}},[f,w,d,i]);const x=b.useRef(X(d)?!1:d);return e.jsx(ee.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??x.current,required:l,disabled:u,name:v,value:p,form:c,...s,tabIndex:-1,ref:y,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Es.displayName=Ss;function qr(t){return typeof t=="function"}function X(t){return t==="indeterminate"}function Ps(t){return X(t)?"indeterminate":t?"checked":"unchecked"}const kt=b.forwardRef(({className:t,style:s,...r},a)=>e.jsx(_t,{ref:a,className:Ce("peer h-4 w-4 shrink-0 rounded-sm ring-offset-background data-[state=checked]:!bg-black data-[state=checked]:!text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),style:{border:"1px solid #000",...s},...r,children:e.jsx(Cs,{className:Ce("flex items-center justify-center text-current"),children:e.jsx(gt,{className:"h-4 w-4"})})}));kt.displayName=_t.displayName;const Kr=250,Gr=100,Qr={editType:"tasks",singular:"task",plural:"tasks",title:"Edit Paper Tasks",description:"Select the tasks that this paper addresses. You can select multiple tasks.",search:t=>G.listTasks(t),toPendingPayload:t=>({task_ids:t}),applyDirect:(t,s)=>U.updateTasks(t,s),patchPaper:(t,s)=>({...t,tasks:[...s].sort((r,a)=>r.name.localeCompare(a.name))})},Xr={editType:"methods",singular:"method",plural:"methods",title:"Edit Paper Methods",description:"Select the methods and techniques used in this paper. You can select multiple methods.",search:t=>G.listMethods(t),toPendingPayload:t=>({method_ids:t}),applyDirect:(t,s)=>U.updateMethods(t,s),subtitle:t=>t.full_name!==t.name?t.full_name:void 0},Vr=t=>t[0].toUpperCase()+t.slice(1),_e=t=>t.map(s=>Number(s.id));function Vt(t){return t.kind==="task"?e.jsx(Wt,{...t,tagKind:Qr}):e.jsx(Wt,{...t,tagKind:Xr})}function Wt({tagKind:t,onOpenChange:s,paperId:r,arxivId:a,initialItems:i,submitMode:d="direct",isAuthor:o=!1}){const{singular:l,plural:u,patchPaper:v}=t,[p,c]=b.useState(i),[f,g]=b.useState(!1),[y,w]=b.useState(""),[h,x]=b.useState(""),n=Z(),{toast:m}=J();b.useEffect(()=>{const N=window.setTimeout(()=>{x(y.trim())},Kr);return()=>window.clearTimeout(N)},[y]);const{data:j,isFetching:S}=Q({queryKey:[`${u}-search`,h],queryFn:()=>t.search({page_size:Gr,...h?{q:h}:{}})}),E=W({editType:t.editType,paperId:r,arxivId:a,submitMode:d,messages:{proposal:`${l} changes`,noun:u,failure:`Failed to update paper ${u}.`},toPendingPayload:N=>t.toPendingPayload(_e(N)),applyDirect:N=>t.applyDirect(r,_e(N)),applyOptimistic:v&&(async N=>{const _=[...new Set([r,a].filter($=>!!$))].flatMap($=>[me.detail($),me.arxiv($)]);await Promise.all(_.map($=>n.cancelQueries({queryKey:$})));const I=_.map($=>({key:$,data:n.getQueryData($)}));return I.forEach(({key:$,data:T})=>{T&&n.setQueryData($,v(T,N))}),()=>I.forEach(({key:$,data:T})=>n.setQueryData($,T))}),onSaved:(N,{direct:_})=>{_&&m({title:`${Vr(u)} updated`,description:`Saved ${N.length} ${N.length===1?l:u} for this paper.`})},onClose:()=>s(!1)}),C=b.useMemo(()=>new Set(_e(p)),[p]),R=b.useMemo(()=>_e(i),[i]),L=b.useMemo(()=>{const N=(j==null?void 0:j.results)??[],_=h?[...N,...p]:[...p,...N];return _.filter((I,$)=>_.findIndex(({id:T})=>T===I.id)===$)},[j,p,h]),B=p.length!==R.length||R.some(N=>!C.has(N)),H=()=>{d==="direct"&&R.some(N=>!C.has(N))&&!window.confirm(`Remove one or more ${l} links from this paper?`)||E.mutate(p)},P=(N,_)=>{c(I=>_?I.some($=>$.id===N.id)?I:[...I,N]:I.filter($=>$.id!==N.id))};return e.jsxs(e.Fragment,{children:[e.jsxs(V,{title:t.title,description:t.description,className:"max-w-2xl max-h-[600px]",submitMode:d,isAuthor:o,onOpenChange:s,onSave:H,isSaving:E.isPending,saveDisabled:!B,footerStart:e.jsxs(A,{variant:"ghost",className:"sm:mr-auto",onClick:()=>g(!0),children:["Suggest a new ",l]}),children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx(lt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(z,{type:"text",placeholder:`Search ${u}...`,value:y,onChange:N=>w(N.target.value),className:"pl-9 pr-9"}),y&&e.jsx("button",{type:"button",onClick:()=>w(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear search",children:e.jsx(ns,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[400px]",children:L.length>0?e.jsx("div",{className:"space-y-2",children:L.map(N=>{var I;const _=(I=t.subtitle)==null?void 0:I.call(t,N);return e.jsxs("div",{className:"flex items-center space-x-2 p-2 hover:bg-muted/50 rounded-md",children:[e.jsx(kt,{id:`${l}-${N.id}`,checked:C.has(Number(N.id)),onCheckedChange:$=>P(N,$===!0),className:"!border !border-black data-[state=checked]:!bg-black data-[state=checked]:!text-white"}),e.jsxs("label",{htmlFor:`${l}-${N.id}`,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[N.name,_&&e.jsx("span",{className:"block text-xs text-muted-foreground font-normal",children:_}),N.description&&e.jsxs("span",{className:"block text-xs text-muted-foreground font-normal mt-1",children:[N.description.substring(0,100),N.description.length>100?"...":""]})]})]},N.id)})}):S?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(vt,{className:"w-8 h-8 mx-auto mb-2 animate-spin"}),e.jsxs("p",{children:["Loading ",u,"..."]})]}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(lt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:h?`No ${u} found matching "${h}"`:`No ${u} available`})]})})]}),e.jsx(ms,{open:f,onOpenChange:g,paperId:r,kind:l})]})}const Yt=10,Wr=/^https?:\/\/(?:www\.|mobile\.)?(?:x|twitter)\.com\/(?:[A-Za-z0-9_]{1,15}|i\/web|i)\/status(?:es)?\/(\d{1,25})(?:[/?#].*)?$/;function te(t){var s;return((s=Wr.exec(t.trim()))==null?void 0:s[1])??null}function Yr({onOpenChange:t,paperId:s,arxivId:r,initialUrls:a,submitMode:i="direct",isAuthor:d=!1}){const[o,l]=b.useState(a),[u,v]=b.useState(""),[p,c]=b.useState(null),f=W({editType:"x_threads",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"X threads",noun:"X threads",failure:"Failed to update X threads."},toPendingPayload:n=>({x_threads:n}),applyDirect:n=>U.updateXThreads(s,n),onClose:()=>t(!1)}),g=()=>{const n=u.trim();if(!n)return o;const m=te(n);return m?o.some(j=>te(j)===m)?(c("This post is already listed."),null):o.length>=Yt?(c(`A paper can link at most ${Yt} X threads.`),null):[...o,n]:(c("Paste a post URL such as https://x.com/user/status/123…"),null)},y=()=>{const n=g();n!==null&&(l(n),v(""),c(null))},w=(n,m)=>{const j=[...o];[j[n],j[n+m]]=[j[n+m],j[n]],l(j)},h=()=>{const n=g();n!==null&&(i==="direct"&&a.some(m=>!n.some(j=>te(j)===te(m)))&&!window.confirm("Remove one or more X threads from this paper?")||f.mutate(n))},x=b.useMemo(()=>(u.trim()?[...o,u.trim()]:o).map(te).join()!==a.map(te).join(),[o,u,a]);return e.jsxs(V,{title:"Edit X threads",description:"Link posts on X (formerly Twitter) in which the authors introduce this paper. A preview of each post is shown on the paper page.",className:"max-w-2xl max-h-[600px]",submitMode:i,isAuthor:d,onOpenChange:t,onSave:h,isSaving:f.isPending,saveDisabled:!x,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",htmlFor:"x-thread-url",children:"Add X post URL"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(z,{id:"x-thread-url",type:"url",placeholder:"https://x.com/user/status/1234567890",value:u,onChange:n=>{v(n.target.value),c(null)},onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),y())},"aria-invalid":!!p,className:"flex-1"}),e.jsxs(A,{onClick:y,size:"sm",disabled:!u.trim(),children:[e.jsx(ge,{className:"w-4 h-4 mr-1"}),"Add"]})]}),p&&e.jsx("p",{className:"text-xs text-destructive",children:p})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[350px]",children:o.length>0?e.jsx("div",{className:"space-y-2",children:o.map((n,m)=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm font-medium",children:n}),e.jsx(A,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m===0,onClick:()=>w(m,-1),"aria-label":"Move up",children:e.jsx(Za,{className:"w-4 h-4"})}),e.jsx(A,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m===o.length-1,onClick:()=>w(m,1),"aria-label":"Move down",children:e.jsx(Ja,{className:"w-4 h-4"})}),e.jsx(A,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive",onClick:()=>l(o.filter(j=>j!==n)),"aria-label":"Remove X thread",children:e.jsx(fe,{className:"w-4 h-4"})})]},n))}):e.jsx("p",{className:"text-center py-8 text-sm text-muted-foreground",children:"No X threads linked yet"})})]})}function Jr({activeEditor:t,arxivId:s,editSubmitMode:r,evaluations:a,isAdmin:i,isLinkedAuthor:d,onOpenChange:o,paper:l}){if(!t)return null;const u={paperId:l.id,arxivId:s,submitMode:r,isAuthor:d,onOpenChange:c=>o(t,c)},v=c=>(c==null?void 0:c.map(({url:f,is_official:g})=>({url:f,is_official:!!g})))??[],p={tasks:()=>e.jsx(Vt,{...u,kind:"task",initialItems:l.tasks??[]}),methods:()=>e.jsx(Vt,{...u,kind:"method",initialItems:l.methods??[]}),repositories:()=>e.jsx(Br,{...u,initialRepositories:v(l.repositories)}),project_pages:()=>e.jsx(Ur,{...u,initialProjectPages:v(l.project_pages)}),evaluations:()=>e.jsx(Ir,{...u,initialEvaluations:a,paperTasks:l.tasks??[],isAdmin:i}),source_url:()=>e.jsx(zr,{...u,initialUrl:l.source_url??l.url_abs??""}),hf_artifacts:()=>e.jsx(Ar,{...u,initialArtifacts:{hf_models:l.hf_models??[],hf_datasets:l.hf_datasets??[],hf_spaces:l.hf_spaces??[]}}),x_threads:()=>{var c;return e.jsx(Yr,{...u,initialUrls:((c=l.x_threads)==null?void 0:c.map(({url:f})=>f))??[]})},organizations:()=>e.jsx(Fr,{...u,initialOrganizationIds:(l.organizations??[]).map(({id:c})=>Number(c))})};return e.jsx(b.Fragment,{children:p[t]()},t)}const Zr={"add-evals":{trigger:"add evals",running:"adding evals…",complete:"add evals ✓",title:"Add evaluations with Codex",description:t=>e.jsxs(e.Fragment,{children:["Codex will run the repository’s add-evals skill for “",t,"”. It will import only paper-native results onto existing, metric-compatible leaderboards. Accepted rows are written directly to the live database."]}),notice:"Comparator rows, unknown benchmarks, and unconfigured metrics will be skipped. Jobs run one at a time in submission order.",progress:"Codex is researching the paper and validating results against the configured leaderboards.",action:"Run add-evals"},"enrich-paper":{trigger:"enrich paper",running:"enriching…",complete:"enriched ✓",title:"Enrich paper with Codex",description:t=>e.jsxs(e.Fragment,{children:["Codex will run the repository’s enrich-paper skill for “",t,"”. It will validate official code and project links, merge high-confidence taxonomy tags, and check the paper thumbnail. Accepted changes are written directly to the live database."]}),notice:"Uncertain URLs and missing taxonomy concepts will be reported rather than guessed. Jobs run one at a time in submission order.",progress:"Codex is validating artifacts, taxonomy tags, and thumbnail quality for this paper.",action:"Run enrich-paper"}},Jt=new Set(["queued","dispatching","running","awaiting_markdown"]);function en({report:t}){return e.jsx("div",{className:"min-w-0 max-h-[50vh] overflow-y-auto overflow-x-hidden rounded-md border bg-muted/40 p-4 text-sm leading-relaxed",children:e.jsx(Ga,{remarkPlugins:[Qa],components:{a:({children:s,...r})=>e.jsx("a",{...r,className:"break-all underline underline-offset-2",target:"_blank",rel:"noreferrer",children:s}),p:({children:s})=>e.jsx("p",{className:"mb-3 break-words last:mb-0",children:s}),ul:({children:s})=>e.jsx("ul",{className:"mb-3 list-disc space-y-1 pl-5 last:mb-0",children:s}),ol:({children:s})=>e.jsx("ol",{className:"mb-3 list-decimal space-y-1 pl-5 last:mb-0",children:s}),h1:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),h2:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),h3:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),code:({children:s})=>e.jsx("code",{className:"break-all rounded bg-background/80 px-1 py-0.5 font-mono text-xs",children:s}),pre:({children:s})=>e.jsx("pre",{className:"mb-3 max-w-full overflow-x-auto whitespace-pre-wrap break-words rounded bg-background/80 p-3 font-mono text-xs last:mb-0",children:s})},children:t})})}function $s({kind:t,paperId:s,paperTitle:r,triggerClassName:a,onComplete:i}){var E;const d=Zr[t],o=Z(),[l,u]=b.useState(!1),[v,p]=b.useState(null),c=b.useRef(null),f=Q({queryKey:Tt.codexPaperJob(t,v),queryFn:()=>Oe.getPaperJob(t,v),enabled:v!==null,refetchInterval:C=>{var L;const R=(L=C.state.data)==null?void 0:L.status;return R==="awaiting_markdown"?6e4:R&&Jt.has(R)?2e3:!1},retry:!1}),g=C=>{o.setQueryData(Tt.codexPaperJob(t,C.id),C),p(C.id)},y=ae({mutationFn:()=>Oe.startPaperJob(t,s),onSuccess:g}),w=ae({mutationFn:C=>Oe.cancelPaperJob(t,C),onSuccess:g}),h=v?f.data:void 0,x=(h==null?void 0:h.status)==="awaiting_markdown",n=h?Jt.has(h.status):!1,m=f.errorUpdatedAt>f.dataUpdatedAt?f.error:null,j=(E=y.error??w.error??m)==null?void 0:E.message;b.useEffect(()=>{(h==null?void 0:h.status)!=="completed"||c.current===h.id||(c.current=h.id,i())},[h,i]);const S=()=>{p(null),y.reset(),w.reset(),c.current=null};return e.jsxs(Ie,{open:l,onOpenChange:u,children:[e.jsx("button",{type:"button",className:a,onClick:()=>u(!0),children:x?"waiting for Markdown…":n?d.running:(h==null?void 0:h.status)==="completed"?d.complete:d.trigger}),e.jsxs(Re,{className:"max-h-[90vh] w-[calc(100vw-2rem)] min-w-0 max-w-2xl overflow-hidden",children:[e.jsxs(Ae,{className:"min-w-0",children:[e.jsx(Le,{children:d.title}),e.jsx(Te,{children:d.description(r)})]}),h?e.jsxs("div",{className:"min-w-0 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"font-mono text-xs uppercase tracking-wide text-muted-foreground",children:["Status: ",h.status.replace("_"," ")]}),h.hf_job_url&&e.jsx("a",{className:"text-sm underline",href:h.hf_job_url,target:"_blank",rel:"noreferrer",children:"View Hugging Face Job"}),x&&e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 text-sm",children:[Ka," You can close this window and return."]}),n&&!x&&e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 text-sm",children:[h.status==="queued"?"This job is queued and will start after the current Codex job finishes.":d.progress," ","This can take several minutes; you can close this window and return."]}),h.report&&e.jsx(en,{report:h.report}),h.error&&!x&&e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:h.error})]}):e.jsx("div",{className:"rounded-md border bg-muted/40 p-3 text-sm text-muted-foreground",children:d.notice}),j&&e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:j}),e.jsxs(jt,{children:[e.jsx(A,{variant:"outline",onClick:()=>u(!1),children:n?"Close":"Cancel"}),n&&h&&e.jsx(A,{variant:"outline",onClick:()=>w.mutate(h.id),children:"Cancel job"}),!h&&e.jsx(A,{onClick:()=>y.mutate(),disabled:y.isPending,children:y.isPending?"Starting…":d.action}),h&&!n&&e.jsx(A,{variant:"outline",onClick:S,children:"Run again"})]})]})]})}function we({accent:t,id:s,label:r}){return e.jsxs("div",{className:"section-rule paper-section-anchor",id:s,children:[e.jsx("span",{children:e.jsx("a",{href:`#${s}`,className:"section-anchor-link",children:r})}),t]})}function tn({canCopyBadge:t,canEdit:s,evaluationsByTask:r,evaluationsLoading:a,isAdmin:i,onCopyBadge:d,onEdit:o,onRefresh:l,paper:u,visibleEvaluationCount:v}){return e.jsxs(e.Fragment,{children:[e.jsx(we,{id:"results",label:"Results",accent:e.jsxs("span",{className:"accent",children:[v," benchmarks",t&&e.jsxs("button",{type:"button",className:"edit-link results-badge-copy",onClick:d,title:"Copy live leaderboard badges for your repository README",children:[e.jsx(F,{name:"copy",size:10})," Copy PwC badge"]}),i&&sa()&&e.jsx($s,{kind:"add-evals",triggerClassName:"edit-link",paperId:Number(u.id),paperTitle:u.title,onComplete:l}),s&&e.jsx("button",{type:"button",onClick:o,className:"edit-link",children:"edit"})]})}),a?e.jsx(ue,{className:"h-32 w-full"}):r.length>0?r.map(p=>e.jsxs("div",{className:p.taskSlug?"paper-section-anchor":void 0,id:p.taskSlug?vs(p.taskSlug):void 0,children:[e.jsxs("div",{className:"section-rule",children:[e.jsx("span",{children:p.taskSlug?e.jsxs(e.Fragment,{children:[e.jsx(K,{to:`/tasks/${p.taskSlug}`,children:p.taskName}),e.jsx("a",{href:hr(p.taskSlug),className:"section-anchor-link results-task-permalink","aria-label":`Permalink to ${p.taskName} results on this paper`,title:"Link to this task's results",children:"#"})]}):p.taskName}),e.jsxs("span",{className:"accent",children:[p.rows.length," ",p.rows.length===1?"result":"results"]})]}),e.jsxs("table",{className:"results-table",children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:"28%"}}),e.jsx("col",{style:{width:"28%"}}),e.jsx("col",{style:{width:"14%"}}),e.jsx("col",{style:{width:"12%"}}),e.jsx("col",{style:{width:"8%"}}),e.jsx("col",{style:{width:"10%"}})]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Benchmark"}),e.jsx("th",{children:"Model"}),e.jsx("th",{children:"Metric"}),e.jsx("th",{children:"Value"}),e.jsx("th",{children:"Rank"}),e.jsx("th",{children:"Compare"})]})}),e.jsx("tbody",{children:p.rows.map(c=>{var f;return e.jsxs("tr",{children:[e.jsx("td",{className:"benchmark",children:c.dataset_slug?e.jsx(K,{to:`/benchmark/${c.dataset_slug}`,children:c.dataset_name||"—"}):c.dataset_name||"—"}),e.jsxs("td",{className:"model",title:c.model_name||void 0,children:[c.hf_model_url?e.jsx("a",{href:c.hf_model_url,target:"_blank",rel:"noopener noreferrer",className:"model-hf-link",title:`Open ${c.model_name||"model"} on Hugging Face`,children:c.model_name||"—"}):c.model_name||"—",c.is_open===!1&&e.jsx(ka,{}),(c.external??c.is_external)&&e.jsx(Na,{sourceUrl:c.source_url||c.external_source_url||c.result_url})]}),e.jsx("td",{className:"metric",children:c.best_metric}),e.jsx("td",{className:"value",children:aa((f=c.metrics)==null?void 0:f[c.best_metric||""])}),e.jsx("td",{className:"rank",children:c.best_rank!=null?`#${c.best_rank}`:"—"}),e.jsx("td",{className:"compare",children:c.dataset_slug&&e.jsx(K,{to:`/benchmark/${c.dataset_slug}?${[c.task_slug?`task=${encodeURIComponent(c.task_slug)}`:"",`eval=${encodeURIComponent(c.id)}`].filter(Boolean).join("&")}`,children:"Compare →"})})]},c.id)})})]})]},p.taskId)):e.jsx("p",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-faint)"},children:"No benchmark results recorded yet."})]})}var Nt="Radio",[sn,Is]=bt(Nt),[an,rn]=sn(Nt),Rs=b.forwardRef((t,s)=>{const{__scopeRadio:r,name:a,checked:i=!1,required:d,disabled:o,value:l="on",onCheck:u,form:v,...p}=t,[c,f]=b.useState(null),g=pe(s,h=>f(h)),y=b.useRef(!1),w=c?v||!!c.closest("form"):!0;return e.jsxs(an,{scope:r,checked:i,disabled:o,children:[e.jsx(ee.button,{type:"button",role:"radio","aria-checked":i,"data-state":Ds(i),"data-disabled":o?"":void 0,disabled:o,value:l,...p,ref:g,onClick:he(t.onClick,h=>{i||u==null||u(),w&&(y.current=h.isPropagationStopped(),y.current||h.stopPropagation())})}),w&&e.jsx(Ts,{control:c,bubbles:!y.current,name:a,value:l,checked:i,required:d,disabled:o,form:v,style:{transform:"translateX(-100%)"}})]})});Rs.displayName=Nt;var As="RadioIndicator",Ls=b.forwardRef((t,s)=>{const{__scopeRadio:r,forceMount:a,...i}=t,d=rn(As,r);return e.jsx(is,{present:a||d.checked,children:e.jsx(ee.span,{"data-state":Ds(d.checked),"data-disabled":d.disabled?"":void 0,...i,ref:s})})});Ls.displayName=As;var nn="RadioBubbleInput",Ts=b.forwardRef(({__scopeRadio:t,control:s,checked:r,bubbles:a=!0,...i},d)=>{const o=b.useRef(null),l=pe(o,d),u=bs(r),v=ls(s);return b.useEffect(()=>{const p=o.current;if(!p)return;const c=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(c,"checked").set;if(u!==r&&g){const y=new Event("click",{bubbles:a});g.call(p,r),p.dispatchEvent(y)}},[u,r,a]),e.jsx(ee.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:l,style:{...i.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Ts.displayName=nn;function Ds(t){return t?"checked":"unchecked"}var on=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Fe="RadioGroup",[ln]=bt(Fe,[cs,Is]),Fs=cs(),Us=Is(),[cn,dn]=ln(Fe),Bs=b.forwardRef((t,s)=>{const{__scopeRadioGroup:r,name:a,defaultValue:i,value:d,required:o=!1,disabled:l=!1,orientation:u,dir:v,loop:p=!0,onValueChange:c,...f}=t,g=Fs(r),y=ra(v),[w,h]=os({prop:d,defaultProp:i??null,onChange:c,caller:Fe});return e.jsx(cn,{scope:r,name:a,required:o,disabled:l,value:w,onValueChange:h,children:e.jsx(na,{asChild:!0,...g,orientation:u,dir:y,loop:p,children:e.jsx(ee.div,{role:"radiogroup","aria-required":o,"aria-orientation":u,"data-disabled":l?"":void 0,dir:y,...f,ref:s})})})});Bs.displayName=Fe;var zs="RadioGroupItem",Ms=b.forwardRef((t,s)=>{const{__scopeRadioGroup:r,disabled:a,...i}=t,d=dn(zs,r),o=d.disabled||a,l=Fs(r),u=Us(r),v=b.useRef(null),p=pe(s,v),c=d.value===i.value,f=b.useRef(!1);return b.useEffect(()=>{const g=w=>{on.includes(w.key)&&(f.current=!0)},y=()=>f.current=!1;return document.addEventListener("keydown",g),document.addEventListener("keyup",y),()=>{document.removeEventListener("keydown",g),document.removeEventListener("keyup",y)}},[]),e.jsx(ia,{asChild:!0,...l,focusable:!o,active:c,children:e.jsx(Rs,{disabled:o,required:d.required,checked:c,...u,...i,name:d.name,ref:p,onCheck:()=>d.onValueChange(i.value),onKeyDown:he(g=>{g.key==="Enter"&&g.preventDefault()}),onFocus:he(i.onFocus,()=>{var g;f.current&&((g=v.current)==null||g.click())})})})});Ms.displayName=zs;var un="RadioGroupIndicator",Hs=b.forwardRef((t,s)=>{const{__scopeRadioGroup:r,...a}=t,i=Us(r);return e.jsx(Ls,{...i,...a,ref:s})});Hs.displayName=un;var Os=Bs,qs=Ms,mn=Hs;const dt=b.forwardRef(({className:t,...s},r)=>e.jsx(Os,{className:Ce("grid gap-2",t),...s,ref:r}));dt.displayName=Os.displayName;const de=b.forwardRef(({className:t,...s},r)=>e.jsx(qs,{ref:r,className:Ce("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(mn,{className:"flex items-center justify-center",children:e.jsx(oa,{className:"h-2.5 w-2.5 fill-current text-current"})})}));de.displayName=qs.displayName;const hn={pdf:"PDF",model:"Model",dataset:"Dataset",space:"Space",github:"GitHub"},ut=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,pn=/^[A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*$/,fn=20,mt="copy_to_bucket";function gn(t){const s=t.trim();if(!pn.test(s))return null;const[r,a]=s.split("/");return`https://huggingface.co/buckets/${encodeURIComponent(r)}/${encodeURIComponent(a)}`}function ht(t){return`pwc:bucket-copy:${t}`}function xn(t){if(typeof window>"u"||new URL(window.location.href).searchParams.get(mt)!==t)return null;try{const r=window.sessionStorage.getItem(ht(t));if(!r)return null;const a=JSON.parse(r);return a.paperId!==t||typeof a.bucketId!="string"||!["new","existing"].includes(a.destinationMode)||!["public","private"].includes(a.visibility)||!Array.isArray(a.selectedIds)||a.selectedIds.some(i=>typeof i!="string")?null:a}catch{return null}}function bn(t,s=fn){if(s<1)throw new Error("Bucket copy batch size must be positive");const r=[];for(let a=0;a!ut.test(u)))return null;const o=d.join("/"),l=s==="model"?"":`${s}s/`;return{id:`${s}:${o}`,kind:s,label:o,url:`https://huggingface.co/${l}${o}`,source:`hf://${l}${o}/`,destination:`${s}s/${o}/`,repoId:o}}catch{return null}}function jn(t){try{const s=new URL(t);if(s.hostname!=="github.com"&&s.hostname!=="www.github.com")return null;const r=s.pathname.split("/").filter(Boolean);if(r.length<2)return null;const a=r[0],i=r[1].replace(/\.git$/,"");if(!ut.test(a)||!ut.test(i))return null;const d=`${a}/${i}`;return{id:`github:${d}`,kind:"github",label:d,url:`https://github.com/${d}`,source:`https://github.com/${d}.git`,destination:`github/${d}/`}}catch{return null}}function vn({githubUrls:t,hfModelUrls:s,hfDatasetUrls:r,hfSpaceUrls:a,paperId:i,pdfName:d,pdfUrl:o}){const l=[o?{id:"pdf",kind:"pdf",label:"Paper PDF",url:o,source:o,destination:`paper/${d||i}.pdf`}:null,...s.map(v=>at(v,"model")),...r.map(v=>at(v,"dataset")),...a.map(v=>at(v,"space")),...t.map(jn)],u=new Set;return l.filter(v=>!v||u.has(v.id)?!1:(u.add(v.id),!0))}function yn(t,s,r){const a=["# Requires the Hugging Face CLI: https://huggingface.co/docs/huggingface_hub/guides/cli",`HF_BUCKET=${ke(t.trim())}`];r.create&&a.push(`hf buckets create "$HF_BUCKET" --exist-ok${r.isPrivate?" --private":""}`);for(const o of s.filter(l=>l.kind!=="github"&&l.kind!=="pdf"))a.push(`hf cp ${ke(o.source)} "hf://buckets/$HF_BUCKET/${o.destination}"`);const i=s.find(o=>o.kind==="pdf");i&&a.push('PWC_PDF="$(mktemp)"',`trap 'rm -f "$PWC_PDF"' EXIT`,`curl --fail --location ${ke(i.source)} --output "$PWC_PDF"`,`hf cp "$PWC_PDF" "hf://buckets/$HF_BUCKET/${i.destination}"`);const d=s.filter(o=>o.kind==="github");if(d.length){a.push('PWC_COPY_DIR="$(mktemp -d)"',`trap 'rm -rf "$PWC_COPY_DIR"' EXIT`);for(const o of d){const l=`$PWC_COPY_DIR/${o.destination.replace(/\/$/,"")}`;a.push(`git clone --depth 1 -- ${ke(o.source)} "${l}"`,`hf sync "${l}" "hf://buckets/$HF_BUCKET/${o.destination}" --exclude '.git/**'`)}}return a.join(` +`)}function _n(t){return`${(t.split(/[:|–—]/,1)[0]||t).normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/g,"")||"paper"}-artifacts`}function kn(t){const{toast:s}=J(),r=b.useMemo(()=>vn({githubUrls:t.githubUrls,hfDatasetUrls:t.hfDatasetUrls,hfModelUrls:t.hfModelUrls,hfSpaceUrls:t.hfSpaceUrls,paperId:t.paperId,pdfName:t.pdfName,pdfUrl:t.pdfUrl}),[t.githubUrls,t.hfDatasetUrls,t.hfModelUrls,t.hfSpaceUrls,t.paperId,t.pdfName,t.pdfUrl]),a=b.useMemo(()=>xn(t.paperId),[t.paperId]),[i,d]=b.useState(!!a),[o,l]=b.useState((a==null?void 0:a.destinationMode)??"new"),[u,v]=b.useState((a==null?void 0:a.bucketId)??""),[p,c]=b.useState((a==null?void 0:a.visibility)??"public"),[f,g]=b.useState(()=>new Set((a==null?void 0:a.selectedIds)??r.map(_=>_.id))),[y,w]=b.useState(!1),[h,x]=b.useState(null),[n,m]=b.useState(!!a),j=r.filter(_=>f.has(_.id)),S=j.length===r.length,E=gn(u),C=E!==null,R=yn(u,j,{create:o==="new",isPrivate:p==="private"}),L=(_,I)=>{g($=>{const T=new Set($);return I?T.add(_):T.delete(_),T})},B=async()=>{try{await navigator.clipboard.writeText(R),s({title:"Bucket copy commands copied",description:"Run them in a terminal where the Hugging Face CLI is signed in."})}catch{s({title:"Copy failed",description:"Could not access the clipboard. Select and copy the commands manually.",variant:"destructive"})}},H=b.useCallback(()=>{const _=new URL(window.location.href);_.searchParams.set(mt,t.paperId),window.sessionStorage.setItem(ht(t.paperId),JSON.stringify({paperId:t.paperId,bucketId:u.trim(),destinationMode:o,visibility:p,selectedIds:Array.from(f)})),window.location.assign(la(_.toString(),{authorizeBucket:!0,bucketCreate:o==="new"}))},[u,o,t.paperId,f,p]),P=b.useCallback(async()=>{if(!t.isSignedIn){H();return}w(!0);let _=0,I=0;try{const $=j.filter(M=>M.kind!=="pdf"&&M.kind!=="github"&&!!M.repoId).map(M=>({kind:M.kind,repo_id:M.repoId})),T=bn($);T.length||T.push([]);for(const[M,xe]of T.entries()){x({current:M+1,total:T.length});const be=await U.copyToBucket(t.paperId,{bucket_id:u.trim(),create:M===0&&o==="new",private:p==="private",include_pdf:M===0&&j.some(Ue=>Ue.kind==="pdf"),artifacts:xe});_+=be.copied.length,I+=be.errors.length}const ne=j.filter(M=>M.kind==="github").length;s({title:I?"Bucket copy partially completed":"Copied to bucket",description:[`${_} item${_===1?"":"s"} copied.`,I?`${I} item${I===1?"":"s"} failed.`:"",ne?"Use the generated commands below to copy GitHub repositories.":""].filter(Boolean).join(" "),variant:I?"destructive":void 0,action:E?e.jsx(ca,{altText:"Open destination bucket",asChild:!0,children:e.jsx("a",{href:E,target:"_blank",rel:"noopener noreferrer",children:"Open bucket"})}):void 0}),!I&&!ne&&d(!1)}catch($){if($ instanceof Se&&$.code==="bucket_authorization_required"){H();return}s({title:_?"Bucket copy partially completed":"Bucket copy failed",description:_?`${_} item${_===1?"":"s"} copied before the request failed. You can retry or use the CLI commands below.`:$ instanceof Se&&typeof $.detail=="string"?$.detail:"Hugging Face could not complete the copy. You can still use the CLI commands below.",variant:"destructive"})}finally{w(!1),x(null)}},[H,u,E,o,t.isSignedIn,t.paperId,j,s,p]);b.useEffect(()=>{if(!n||!t.isSignedIn)return;m(!1),window.sessionStorage.removeItem(ht(t.paperId));const _=new URL(window.location.href);_.searchParams.delete(mt),window.history.replaceState({},"",`${_.pathname}${_.search}${_.hash}`),P()},[P,t.isSignedIn,t.paperId,n]);const N=()=>{g(new Set(r.map(_=>_.id))),!u&&t.suggestedBucketId&&v(t.suggestedBucketId),d(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sidebar-card copy-to-bucket-card",children:[e.jsxs("button",{type:"button",className:"copy-to-bucket-trigger",onClick:N,children:[e.jsx("span",{className:"copy-to-bucket-arrow","aria-hidden":"true",children:"→"}),e.jsx("span",{className:"copy-to-bucket-title",children:"Copy to bucket"}),e.jsx("span",{className:"copy-to-bucket-new",children:"New"})]}),e.jsx("div",{className:"copy-to-bucket-meta",children:r.length?`${r.length} linked artifact${r.length===1?"":"s"}`:"No linked artifacts yet"})]}),e.jsx(Ie,{open:i,onOpenChange:d,children:e.jsxs(Re,{className:"max-h-[90vh] max-w-2xl grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden",children:[e.jsxs(Ae,{children:[e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"copy-to-bucket-dialog-arrow","aria-hidden":"true",children:"→"}),"Copy to bucket"]}),e.jsx(Te,{children:"Keep your own copy of this paper's PDF, linked code, and Hugging Face artifacts. Hub repositories use Xet's server-side copy; GitHub repositories use the generated CLI fallback."})]}),e.jsx("div",{className:"-mx-6 min-h-0 overflow-y-auto px-6",children:r.length?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{children:"Choose your destination"}),e.jsxs(dt,{value:o,onValueChange:_=>l(_),className:"grid grid-cols-2 gap-2",children:[e.jsxs(O,{className:"bucket-choice",children:[e.jsx(de,{value:"new"}),"New bucket"]}),e.jsxs(O,{className:"bucket-choice",children:[e.jsx(de,{value:"existing"}),"Existing bucket"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"bucket-id",children:"Bucket name"}),e.jsx(z,{id:"bucket-id",value:u,onChange:_=>v(_.target.value),placeholder:t.suggestedBucketId||"username/paper-artifacts","aria-invalid":u.length>0&&!C}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"Use the full Hugging Face bucket ID: namespace/name."}),E&&e.jsxs("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 underline underline-offset-4",children:["View bucket",e.jsx(F,{name:"external",size:10})]})]})]}),o==="new"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{children:"Bucket visibility"}),e.jsxs(dt,{value:p,onValueChange:_=>c(_),className:"flex gap-5",children:[e.jsxs(O,{className:"flex items-center gap-2 font-normal",children:[e.jsx(de,{value:"public"}),"Public"]}),e.jsxs(O,{className:"flex items-center gap-2 font-normal",children:[e.jsx(de,{value:"private"}),"Private"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(O,{children:"Artifacts"}),e.jsx(A,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>g(S?new Set:new Set(r.map(_=>_.id))),children:S?"Deselect all":"Select all"})]}),e.jsx("div",{className:"bucket-artifact-list",children:r.map(_=>e.jsxs("div",{className:"bucket-artifact-row",children:[e.jsx(kt,{id:`bucket-artifact-${_.id}`,checked:f.has(_.id),onCheckedChange:I=>L(_.id,I===!0)}),e.jsxs(O,{htmlFor:`bucket-artifact-${_.id}`,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[e.jsx("span",{className:"bucket-artifact-kind",children:hn[_.kind]}),e.jsx("span",{className:"bucket-artifact-name",children:_.label})]}),e.jsxs("a",{href:Y(_.url)??void 0,target:"_blank",rel:"noopener noreferrer",className:"bucket-artifact-open",children:["Open",e.jsx(F,{name:"external",size:10})]})]},_.id))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The PDF and Hugging Face artifacts can be copied directly. GitHub repositories require the CLI workflow below."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"bucket-copy-commands",children:"CLI fallback"}),e.jsx("pre",{id:"bucket-copy-commands",className:"bucket-copy-commands h-[190px]",children:C?R:"Enter a bucket name above to prepare the copy commands."})]})]}):e.jsx("p",{className:"py-5 text-sm text-muted-foreground",children:"This paper does not have a linked GitHub repository or Hugging Face artifact to copy yet."})}),e.jsxs(jt,{children:[e.jsx("a",{href:"https://huggingface.co/docs/huggingface_hub/en/guides/buckets",target:"_blank",rel:"noopener noreferrer",className:"mr-auto text-sm text-muted-foreground underline underline-offset-4",children:"About Hugging Face Buckets"}),e.jsxs(A,{type:"button",onClick:B,variant:"outline",disabled:!C||j.length===0,children:[e.jsx(F,{name:"copy",size:12}),"Copy commands"]}),e.jsx(A,{type:"button",onClick:P,disabled:y||t.isSignedIn&&(!C||!j.some(_=>_.kind!=="github")),children:y?h&&h.total>1?`Copying ${h.current}/${h.total}…`:"Copying…":t.isSignedIn?"Copy now":"Sign in & copy"})]})]})})]})}function Nn({isLoading:t,papers:s}){return t?e.jsxs("div",{className:"sidebar-card","aria-busy":"true",children:[e.jsx("div",{className:"sidebar-card-title",children:"Related papers"}),e.jsx("div",{className:"related-meta",children:"Finding related work…"})]}):s!=null&&s.length?e.jsxs("div",{className:"sidebar-card",children:[e.jsx("div",{className:"sidebar-card-title",children:"Related papers"}),s.map(r=>e.jsxs(K,{to:`/paper/${r.arxiv_id||r.id}`,target:"_blank",rel:"noopener noreferrer",className:"related-paper",style:{textDecoration:"none",color:"inherit"},children:[e.jsx("div",{className:"related-title",children:e.jsx(Ne,{title:r.title})}),e.jsxs("div",{className:"related-meta",children:[e.jsx("span",{children:r.arxiv_id?`arXiv:${r.arxiv_id}`:"External resource"}),r.citation_count!=null&&e.jsxs("span",{children:[r.citation_count.toLocaleString()," cites"]})]})]},r.id))]}):null}const wn=/(https?:\/\/[^\s]+)/g;function Cn({size:t=12}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:e.jsx("path",{fill:"currentColor",d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}function Zt(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Sn(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function En({text:t}){return e.jsx("p",{className:"x-thread-text",children:t.split(wn).map((s,r)=>r%2===1?e.jsx("span",{className:"x-thread-link",children:s.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")},r):e.jsx(b.Fragment,{children:s},r))})}function Pn({thread:t}){const[s,r]=b.useState(!1);return!t.author_avatar_url||s?e.jsx("span",{className:"x-thread-avatar x-thread-avatar--fallback","aria-hidden":"true",children:t.author_name.charAt(0).toUpperCase()}):e.jsx("img",{className:"x-thread-avatar",src:t.author_avatar_url,alt:"",loading:"lazy",referrerPolicy:"no-referrer",onError:()=>r(!0)})}function $n(){var t;return((t=window.matchMedia)==null?void 0:t.call(window,"(prefers-reduced-motion: reduce)").matches)??!1}function In({thread:t}){const[s,r]=b.useState(!1),[a,i]=b.useState(null),[d,o]=b.useState(!1),l=b.useRef(null),{targetRef:u,isIntersecting:v}=Xa({rootMargin:"200px"}),p=t.video_url;if(b.useEffect(()=>{if(!p||a||d||!v||$n())return;const f=new AbortController;return fetch(p,{referrerPolicy:"no-referrer",signal:f.signal}).then(g=>{if(!g.ok)throw new Error(`HTTP ${g.status}`);return g.blob()}).then(g=>i(URL.createObjectURL(g))).catch(()=>{f.signal.aborted||o(!0)}),()=>f.abort()},[p,a,d,v]),b.useEffect(()=>()=>{a&&URL.revokeObjectURL(a)},[a]),b.useEffect(()=>{const f=l.current;f&&(v?f.play().catch(()=>{}):f.pause())},[v,a]),!t.media_url||s)return null;const c=a&&!d;return e.jsx("div",{className:"x-thread-media",ref:u,children:c?e.jsx("video",{ref:l,src:a,poster:t.media_url,muted:!0,loop:!0,playsInline:!0,autoPlay:!0,"aria-label":"Video",onError:()=>o(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:t.media_url,alt:"",loading:"lazy",referrerPolicy:"no-referrer",onError:()=>r(!0)}),t.media_type==="video"&&e.jsx("span",{className:"x-thread-play","aria-label":"Video",children:"▶"})]})})}function Rn({thread:t}){const s=Y(t.url);return s?e.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"x-thread",children:[e.jsxs("div",{className:"x-thread-header",children:[e.jsx(Pn,{thread:t}),e.jsxs("span",{className:"x-thread-author",children:[e.jsx("span",{className:"x-thread-name",children:t.author_name}),e.jsxs("span",{className:"x-thread-handle",children:["@",t.author_handle]})]}),e.jsx("span",{className:"x-thread-logo",children:e.jsx(Cn,{})})]}),e.jsx(En,{text:t.text}),e.jsx(In,{thread:t}),e.jsxs("div",{className:"x-thread-meta",children:[t.posted_at&&e.jsx("time",{dateTime:t.posted_at,children:Sn(t.posted_at)}),t.like_count!=null&&e.jsxs("span",{children:["♥ ",Zt(t.like_count)]}),t.reply_count!=null&&t.reply_count>0&&e.jsxs("span",{children:[Zt(t.reply_count)," ",t.reply_count===1?"reply":"replies"]}),e.jsx("span",{className:"x-thread-read",children:"Read on X →"})]})]}):null}function An({onEdit:t,threads:s}){return e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[e.jsx("span",{children:"X threads"}),e.jsxs("span",{className:"badge",children:[s.length," post",s.length===1?"":"s",e.jsx("button",{type:"button",onClick:t,className:"edit-link",children:"edit"})]})]}),s.length>0?e.jsx("div",{className:"x-thread-list",children:s.map(r=>e.jsx(Rn,{thread:r},r.tweet_id))}):e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",padding:"6px 0"},children:"No author threads linked yet."})]})}const rt=3,es=3;function Ln(t){return t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Tn({allHfArtifactUrls:t,citationCopied:s,citationDisplay:r,hfArtifactViewer:a,onCopyCitation:i,onEditHfArtifacts:d,onEditRepositories:o,onEditXThreads:l,paper:u,relatedIsLoading:v,relatedPapers:p,user:c}){var h;const[f,g]=b.useState(!1),y=[...u.repositories??[]].sort((x,n)=>Number(n.is_official)-Number(x.is_official)||(n.num_stars||0)-(x.num_stars||0)),w=(f?y:y.slice(0,rt)).map(x=>({...x,safeHref:Y(x.url)}));return e.jsxs("aside",{className:"detail-sidebar",children:[e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[e.jsx("span",{children:"GitHub"}),e.jsxs("span",{className:"badge",children:[y.length," repo",y.length===1?"":"s",e.jsx("button",{type:"button",onClick:o,className:"edit-link",children:"edit"})]})]}),w.filter(({safeHref:x})=>x).map(x=>e.jsxs("a",{href:x.safeHref??void 0,target:"_blank",rel:"noopener noreferrer",className:"code-line",style:{textDecoration:"none"},children:[e.jsxs("span",{className:"code-line-repo",children:[e.jsx(F,{name:"github",size:12}),e.jsxs("span",{className:"code-line-repo-name",children:[x.owner,"/",x.name]}),x.is_official&&e.jsx("span",{className:"code-line-official",children:"· Official"})]}),e.jsxs("span",{className:"code-line-stars",children:["★ ",Ln(x.num_stars)]})]},x.id)),y.length===0&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",padding:"6px 0"},children:"No GitHub repositories linked yet."}),y.length>rt&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>g(x=>!x),children:f?"− show top 3":`+ show ${y.length-rt} more repos`})]}),e.jsx(Dn,{viewer:a,onEdit:d}),e.jsx(An,{threads:u.x_threads??[],onEdit:l}),e.jsx(kn,{githubUrls:y.map(({url:x})=>x),hfModelUrls:t.models,hfDatasetUrls:t.datasets,hfSpaceUrls:t.spaces,paperId:u.id,pdfName:((h=u.arxiv_id)==null?void 0:h.replace("/","-"))||u.id,pdfUrl:u.url_pdf,isSignedIn:!!c,suggestedBucketId:c?`${c.username}/${_n(u.title)}`:void 0}),e.jsx(Nn,{isLoading:v,papers:p}),e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[e.jsx("span",{children:"Citation"}),e.jsxs("button",{type:"button",className:"citation-copy-btn",onClick:i,"aria-label":"Copy citation to clipboard",title:"Copy citation to clipboard",children:[e.jsx(F,{name:"copy",size:11}),s?"Copied":"Copy"]})]}),e.jsx("pre",{style:{fontFamily:"var(--mono)",fontSize:10.5,lineHeight:1.5,color:"var(--ink-soft)",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},children:r})]})]})}function Dn({onEdit:t,viewer:s}){return e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[s.paperHref?e.jsx("a",{href:s.paperHref,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"none"},children:"🤗 Hugging Face"}):e.jsx("span",{children:"🤗 Hugging Face"}),e.jsx("button",{type:"button",onClick:t,className:"edit-link",children:"edit"})]}),s.isLoading?e.jsx(ue,{className:"h-16 w-full"}):e.jsxs(e.Fragment,{children:[s.rows.map(r=>e.jsx(Fn,{...r},r.label)),s.footer&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--ink-faint)",marginTop:12},children:s.footer})]})]})}function Fn({count:t,href:s,isLimited:r,label:a,links:i}){const[d,o]=b.useState(!1),l=((i==null?void 0:i.length)??0)>es,u=d?i:i==null?void 0:i.slice(0,es),v=t!=null?`${t}${r?"+":""}`:"—";return e.jsxs("div",{className:"hf-artifact-row",children:[e.jsxs("div",{className:"hf-artifact-row-header",children:[e.jsx("span",{children:a}),t?e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"hf-artifact-count",children:v}):e.jsx("span",{className:"hf-artifact-count hf-artifact-count--empty",children:v})]}),u!=null&&u.length?e.jsxs("div",{className:"hf-artifact-links",children:[u.map(p=>e.jsx("a",{href:p.href,target:"_blank",rel:"noopener noreferrer",children:p.label},p.href)),l&&e.jsx("button",{type:"button",className:"hf-artifact-toggle","aria-expanded":d,onClick:()=>o(p=>!p),children:d?"Show fewer":`View all ${i.length}`})]}):null]})}function Un({abstract:t,mentions:s}){const r=[];let a=0;for(const i of[...s].sort((d,o)=>d.start-o.start))i.startt.length||t.slice(i.start,i.end)===i.surface&&(r.push(e.jsx(ot,{text:t.slice(a,i.start)},`t${a}`)),r.push(e.jsx(Ma,{entity:{kind:i.entity_type,slug:i.slug},className:"abstract-entity-link",newTab:!1,initialPreview:i.preview?{name:i.preview.name,description:i.preview.description??null,imageUrl:i.preview.image_url??null,count:i.preview.count??null,detail:i.preview.detail??null}:void 0,children:i.surface},`m${i.start}`)),a=i.end);return r.push(e.jsx(ot,{text:t.slice(a)},`t${a}`)),e.jsx(e.Fragment,{children:r})}function Bn(t,s){const r=t.arxiv_id?` (arXiv:${re(t.arxiv_id)})`:"";return`About the paper "${t.title}"${r}: ${s}`}function zn({paper:t,readerChatRoute:s}){const r=da()&&!!(t.id&&t.abstract),a=t.suggested_questions,{data:i}=Q({queryKey:["paper-suggested-questions",t.id],queryFn:()=>U.suggestedQuestions(String(t.id)),enabled:r&&Array.isArray(a)&&a.length===0,staleTime:o=>{var l;return(l=o.state.data)!=null&&l.questions.length?1/0:0},retry:!1}),d=a!=null&&a.length?a:(i==null?void 0:i.questions)??[];return!r||d.length===0?null:e.jsx("ul",{className:"suggested-questions","aria-label":"Ask about this paper",children:d.map(o=>{const l=s?`${s}?q=${encodeURIComponent(o)}`:`/chat?q=${encodeURIComponent(Bn(t,o))}`;return e.jsx("li",{children:e.jsxs(K,{className:"suggested-question",to:l,onClick:s?()=>us(s):void 0,children:[e.jsx(F,{name:"chat",size:12}),e.jsx("span",{children:o})]})},o)})})}function Mn({canEdit:t,onEditMethods:s,onEditTasks:r,paper:a,readerChatRoute:i}){var l,u,v;const d=a.abstract||"",[o]=b.useState(()=>window.location.hash==="#tldr");return e.jsxs(e.Fragment,{children:[e.jsx(we,{id:"abstract",label:"Abstract"}),e.jsx("p",{className:"abstract-text",children:(l=a.abstract_mentions)!=null&&l.length?e.jsx(Un,{abstract:d,mentions:a.abstract_mentions}):e.jsx(ot,{text:d})}),a.tldr&&e.jsxs("details",{className:"tldr-details paper-section-anchor",id:"tldr",open:o,children:[e.jsxs("summary",{children:[e.jsx("span",{className:"tldr-toggle-show",children:"Show TL;DR"}),e.jsx("span",{className:"tldr-toggle-hide",children:"Hide TL;DR"}),e.jsx("span",{className:"tldr-toggle-hint",children:"short summary"})]}),e.jsx("div",{className:"tldr-box",children:a.tldr})]}),e.jsx(zn,{paper:a,readerChatRoute:i}),e.jsx(we,{id:"tasks",label:"Tasks",accent:e.jsxs("span",{className:"accent",children:[((u=a.tasks)==null?void 0:u.length)||0," tagged",t&&e.jsx("button",{type:"button",onClick:r,className:"edit-link",children:"edit"})]})}),e.jsx("div",{className:"paper-tags",style:{marginBottom:8},children:(a.tasks??[]).map(p=>e.jsx(ja,{slug:p.slug||"",label:p.name},p.id))}),e.jsx(we,{id:"methods",label:"Methods",accent:e.jsxs("span",{className:"accent",children:[((v=a.methods)==null?void 0:v.length)||0," used",t&&e.jsx("button",{type:"button",onClick:s,className:"edit-link",children:"edit"})]})}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:8},children:(a.methods??[]).map(p=>e.jsx(va,{method:p},p.id))})]})}const pt="pwc:pending-bookmark";function ts(t){window.sessionStorage.setItem(pt,JSON.stringify(t)),window.location.assign(Va(!0))}function Hn(){var a,i;const{user:t}=Pe(),s=Q({queryKey:se.bookmarkIds,queryFn:()=>ct.getBookmarkIds(),enabled:!!t,staleTime:60*1e3}),r=Ee.useMemo(()=>{var d;return new Set(((d=s.data)==null?void 0:d.paper_ids)??[])},[(a=s.data)==null?void 0:a.paper_ids]);return{ids:((i=s.data)==null?void 0:i.paper_ids)??[],idSet:r,isLoading:s.isLoading,isError:s.isError}}function On(){const{user:t}=Pe(),s=Z(),r=ae({mutationFn:async({paperId:i,isBookmarked:d})=>{d?await ct.removeBookmark(i):await ct.addBookmark(i)},onMutate:async({paperId:i,isBookmarked:d})=>{await s.cancelQueries({queryKey:se.bookmarkIds});const o=s.getQueryData(se.bookmarkIds),l=typeof i=="string"?Number(i):i,u=(o==null?void 0:o.paper_ids)??[],v=d?u.filter(p=>p!==l):[l,...u.filter(p=>p!==l)];return s.setQueryData(se.bookmarkIds,{paper_ids:v}),{previous:o}},onError:(i,d,o)=>{o!=null&&o.previous&&s.setQueryData(se.bookmarkIds,o.previous),i instanceof Se&&i.code==="saved_papers_bucket_authorization_required"&&ts(d)},onSettled:()=>{s.invalidateQueries({queryKey:se.bookmarkIds}),s.invalidateQueries({queryKey:[...me.feeds.saved]})}});return Ee.useEffect(()=>{if(!t||r.isPending)return;const i=new URL(window.location.href);if(i.searchParams.get(Ot)!=="1")return;i.searchParams.delete(Ot),window.history.replaceState({},"",`${i.pathname}${i.search}${i.hash}`);const d=window.sessionStorage.getItem(pt);if(d){window.sessionStorage.removeItem(pt);try{const o=JSON.parse(d);(typeof o.paperId=="number"||typeof o.paperId=="string")&&typeof o.isBookmarked=="boolean"&&r.mutate(o)}catch{}}},[r,t]),{toggle:Ee.useCallback((i,d)=>{if(!t){if(ds())return;ts({paperId:i,isBookmarked:d});return}r.mutate({paperId:i,isBookmarked:d})},[r,t]),isPending:r.isPending}}const qn=({paperId:t})=>{const{user:s}=Pe(),{idSet:r}=Hn(),{toggle:a,isPending:i}=On();if(ds())return null;const d=Number(t),o=!!s&&r.has(d),l=()=>{Number.isFinite(d)&&a(d,o)},u=s&&o?"Saved":"Save",v=s?o?"Remove from saved papers":"Save this paper":"Sign in with Hugging Face to save this paper";return e.jsxs("button",{type:"button",className:`action-btn${o?" is-saved":""}`,onClick:l,disabled:i,"aria-pressed":o,"aria-label":v,title:v,children:[e.jsx(F,{name:"bookmark",size:12}),u]})};function nt({children:t,showEdit:s=!1,onEdit:r,editAriaLabel:a}){return s?e.jsxs("span",{className:"action-btn-composite",children:[t,e.jsx("button",{type:"button",className:"action-btn-segment action-btn-edit",onClick:r,"aria-label":a,children:"edit"})]}):t}function ss(t){if(!t)return"—";try{return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function as(t,s){try{const r=new URL(t),i=r.pathname.replace(/\/$/,"").split("/").filter(Boolean).at(-1);return i?i.replace(/[-_]+/g," "):r.hostname.replace(/^www\./,"")}catch{return s}}const zi=()=>{const{arxivId:t}=ua(),s=rs(),{toast:r}=J(),{user:a}=Pe(),i=(a==null?void 0:a.is_admin)??!1,d=!!a,o=er(a),{arxivId:l,evaluations:u,evaluationsByTask:v,evaluationsLoading:p,paper:c,paperError:f,paperLoading:g,presentation:y,refetchEvaluations:w,refetchPaper:h,relatedQuery:x,versions:n,visibleEvaluations:m}=fr(t,o),[j,S]=b.useState(!1),{activeEditor:E,openEditor:C,setEditorOpen:R}=gr();b.useEffect(()=>{o!=="direct"||!(c!=null&&c.id)||(E&&E!=="evaluations"&&U.primeCurationState(c.id).catch(()=>{}),E==="evaluations"&&$e.primeCurationState(c.id).catch(()=>{}))},[E,o,c==null?void 0:c.id]);const[L,B]=b.useState(null),H=b.useRef(!1);b.useEffect(()=>{if(!a||!c||H.current)return;const k=sessionStorage.getItem(Ut);if(!k)return;if(H.current=!0,!U.freshAuthMutationDraft()){sessionStorage.removeItem(Ut),Ra(k)&&C(k);return}if(!window.confirm("You signed in again. Apply the saved destructive catalog edit now? The server will recheck the current catalog version before changing anything.")){r({title:"Edit kept locally",description:"Nothing was changed. Reload this paper when you are ready to confirm the saved edit."});return}U.resumeFreshAuthMutation().then(()=>{r({title:"Edit applied",description:"The restored catalog edit was applied."}),window.location.reload()}).catch(le=>{r({variant:"destructive",title:"Could not apply the saved edit",description:le instanceof Error?le.message:"Please reload and review the edit again."})})},[C,c,r,a]);const P=b.useMemo(()=>{if(!a||!(c!=null&&c.author_links))return!1;const k=a.username.toLowerCase();return c.author_links.some(D=>!!D.hf_username&&D.hf_username.toLowerCase()===k)},[a,c==null?void 0:c.author_links]),N=k=>{if(!d){B(k);return}C(k)},_=ae({mutationFn:()=>U.indexFromArxiv(l),onSuccess:()=>{r({title:"Indexed",description:"Paper added to database."}),setTimeout(()=>h(),1200)}}),I=_.error?xt(_.error,"Failed to index paper"):null,$=_.error instanceof Se&&[429,503].includes(_.error.status)?"Try again later after arXiv has lifted the temporary limit.":null,T=(y==null?void 0:y.citationCopy)??"",ne=(y==null?void 0:y.copyableRanks)??[],[M,xe]=b.useState(!1),be=async()=>{if(T)try{await navigator.clipboard.writeText(T),xe(!0),r({title:"Citation copied",description:"BibTeX entry copied to clipboard."}),window.setTimeout(()=>xe(!1),1500)}catch{r({title:"Copy failed",description:"Could not access the clipboard. Please copy manually.",variant:"destructive"})}},Ue=async()=>{if(!c)return;const k=c.arxiv_id||c.id,D=sr(k,ne);if(D)try{await navigator.clipboard.writeText(D),r({title:"PwC badges copied",description:"Each badge follows its current leaderboard result."})}catch{r({title:"Copy failed",description:"Could not access the clipboard. Please try again.",variant:"destructive"})}};if(g)return e.jsxs("div",{className:"page",children:[e.jsx(ue,{className:"h-12 w-3/4 mb-4"}),e.jsx(ue,{className:"h-6 w-1/3 mb-8"}),e.jsx(ue,{className:"h-64 w-full"})]});if(f||!c)return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(K,{to:"/papers",children:"Papers"}),e.jsx("span",{className:"sep",children:"/"}),e.jsxs("span",{style:{color:"var(--ink)"},children:["arXiv:",l]})]}),e.jsx("h1",{className:"detail-title",children:"Paper not indexed yet"}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:16,maxWidth:640},children:["We don't have ",e.jsxs("span",{style:{fontFamily:"var(--mono)"},children:["arXiv:",l]})," in the database. You can index it from arXiv right now."]}),I&&e.jsx(La,{variant:"destructive",className:"mt-4 max-w-xl",children:e.jsxs(Ta,{children:[e.jsx("div",{children:I}),$&&e.jsx("div",{className:"mt-2",children:$})]})}),e.jsxs("div",{className:"action-row",children:[i&&e.jsxs("button",{className:"action-btn",onClick:()=>l&&_.mutate(),disabled:_.isPending,children:[e.jsx(F,{name:"sparkle",size:12}),_.isPending?"Indexing…":"Index from arXiv"]}),e.jsx(A,{variant:"outline",onClick:()=>s("/papers"),children:"Browse Papers"})]})]});if(!y)return null;const{allHfArtifactUrls:Ks,authorEntries:Be,citationDisplay:Gs,hasIntroducedItems:Qs,hasLineageItems:Xs,hfArtifactViewer:Vs,introducedBenchmarks:Ws,introducedFrameworks:wt,introducedMethods:Ys,introducedSummary:Js,numPages:Ct,paperSourceLabel:St,predecessorPapers:ze,projectPages:ie,safeAbstractUrl:je,safeConferenceUrl:Et,safePdfUrl:Pt,successorPapers:Me}=y,ve=12,oe=Sa(c,l),Zs=oe&&Dt()&&ma()&&(!Ft()||i)?oe:null,$t=c.organizations||[],It=k=>{const D=Wa(k)??k.name;return e.jsx(K,{to:`/orgs/${k.slug}`,className:`detail-title-org${k.logo_url?" detail-title-org--logo":""}`,title:k.name,"aria-label":k.name,children:k.logo_url?e.jsx("img",{src:k.logo_url,alt:"",onError:le=>{var At;(At=le.currentTarget.parentElement)==null||At.classList.remove("detail-title-org--logo"),le.currentTarget.replaceWith(D)}}):D},k.id)},Rt=j||Be.length<=ve?Be:Be.slice(0,ve);return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(K,{to:"/",children:"Trending"}),e.jsx("span",{className:"sep",children:"/"}),c.arxiv_id&&je?e.jsxs("a",{className:"breadcrumb-external",href:je,target:"_blank",rel:"noopener noreferrer",title:"Open on arXiv",children:[St,e.jsx("span",{"aria-hidden":"true",children:"↗"})]}):e.jsx("span",{children:St})]}),e.jsxs("div",{className:"detail-grid",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"detail-hero",children:[e.jsxs("div",{className:"detail-hero-main",children:[e.jsxs("h1",{className:"detail-title",children:[e.jsx(Ne,{title:c.title}),$t.slice(0,-1).map(It),e.jsxs("span",{className:"detail-title-tail",children:[$t.slice(-1).map(It),e.jsx("button",{type:"button",className:"detail-title-edit",onClick:()=>N("organizations"),title:"Edit organizations","aria-label":"Edit organizations",children:e.jsx(F,{name:"pencil",size:11})})]})]}),e.jsxs("div",{className:"detail-meta",children:[e.jsxs("span",{children:["Submitted ",ss(c.published)]}),Ct&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[Ct," pages"]})]}),c.citation_count!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[c.citation_count.toLocaleString()," citations"]})]}),(c.proceeding||c.conference_slug)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),c.conference_slug?e.jsx("a",{href:`/conferences/${c.conference_slug}`,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-text)"},children:(c.proceeding||c.conference_name||"").replace(/\s+\d{1,2}$/,"")}):e.jsx("span",{children:c.proceeding.replace(/\s+\d{1,2}$/,"")})]}),n.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("select",{className:"version-select",value:c.version,onChange:k=>{const D=k.target.value;c.arxiv_id&&s(`/paper/${re(c.arxiv_id)}${D?`?version=${D}`:""}`)},children:n.map(k=>e.jsxs("option",{value:k.version,children:[k.version," — ",ss(k.published)]},k.version))})]})]}),e.jsxs("div",{className:"detail-authors",children:[Rt.map((k,D)=>e.jsxs(Ee.Fragment,{children:[k.hf_username&&e.jsx(Ya,{className:"detail-author-avatar",url:k.hf_avatar_url}),k.id?e.jsx(K,{to:`/authors/${k.id}`,children:k.name}):k.hf_username?e.jsx("a",{href:`https://huggingface.co/${k.hf_username}`,target:"_blank",rel:"noopener noreferrer",title:`@${k.hf_username} on Hugging Face`,children:k.name}):e.jsx("a",{children:k.name}),Dve&&e.jsx("button",{className:"show-more-authors",onClick:()=>S(k=>!k),style:{marginLeft:8,background:"none",border:"none",cursor:"pointer",color:"var(--accent-text)",fontFamily:"var(--mono)",fontSize:12},children:j?"show fewer":`+${c.authors.length-ve} more`})]}),e.jsxs("div",{className:"action-row",children:[oe&&Dt()&&(!Ft()||a!=null&&a.is_admin)?e.jsxs(K,{className:"action-btn",to:oe,onClick:()=>us(oe),children:[e.jsx(F,{name:"pdf",size:12})," Read paper",e.jsx("span",{className:"nav-new-badge","aria-hidden":"true",children:"New"})]}):Pt?e.jsxs("a",{className:"action-btn",href:Pt,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(F,{name:"pdf",size:12})," View PDF"]}):null,je&&c.source==="external"&&e.jsx(nt,{showEdit:!0,onEdit:()=>N("source_url"),editAriaLabel:"Edit source URL",children:e.jsxs("a",{className:"action-btn-segment action-btn-main",href:je,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(F,{name:"external",size:12})," Source page"]})}),ie.length===1?e.jsx(nt,{showEdit:!0,onEdit:()=>N("project_pages"),editAriaLabel:"Edit project pages",children:e.jsxs("a",{className:"action-btn-segment action-btn-main",href:ie[0].safeHref??void 0,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(F,{name:"globe",size:12})," Project page"]})}):null,ie.length>1?e.jsx(nt,{showEdit:!0,onEdit:()=>N("project_pages"),editAriaLabel:"Edit project pages",children:e.jsxs(ha,{children:[e.jsx(pa,{asChild:!0,children:e.jsxs("button",{type:"button",className:"action-btn-segment action-btn-main",children:[e.jsx(F,{name:"globe",size:12})," Project page"]})}),e.jsx(fa,{align:"start",className:"project-page-menu",children:ie.map((k,D)=>e.jsx(ga,{asChild:!0,children:k.safeHref?e.jsx("a",{href:k.safeHref,target:"_blank",rel:"noopener noreferrer",children:as(k.url,`Project page ${D+1}`)}):e.jsx("span",{children:as(k.url,`Project page ${D+1}`)})},k.url))})]})}):null,ie.length===0&&d?e.jsxs("button",{type:"button",className:"action-btn",onClick:()=>N("project_pages"),title:"Add project page",children:[e.jsx(F,{name:"globe",size:12})," Add project page"]}):null,Et&&e.jsxs("a",{className:"action-btn",href:Et,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(F,{name:"external",size:12})," Conference"]}),e.jsx(xr,{paperId:Number(c.id)}),i&&xa()&&e.jsx($s,{kind:"enrich-paper",triggerClassName:"action-btn",paperId:Number(c.id),paperTitle:c.title,onComplete:()=>void h()}),e.jsx(qn,{paperId:c.id})]}),c.leaderboard_ranks&&c.leaderboard_ranks.length>0&&e.jsx(ya,{wrap:!0,paperHref:`/paper/${c.arxiv_id||c.id}`,ranks:Ca(c.leaderboard_ranks)})]}),e.jsx("div",{className:"detail-hero-thumb detail-thumb-wrap",children:e.jsx(_a,{paperId:c.arxiv_id||c.id,title:c.title,thumbnailUrl:ba(c.thumbnail_url),priority:!0})})]}),Qs&&e.jsxs("div",{className:`introduced-banner${wt.length>0?" introduced-banner--framework":""}`,children:[e.jsx("span",{className:"introduced-label",children:"Introduced"}),e.jsxs("div",{className:"introduced-methods",children:[Ys.map(k=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/methods/${k.slug||k.id}`),children:[k.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`method-${k.id}`)),Ws.map(k=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/benchmark/${k.slug||k.id}`),children:[k.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`benchmark-${k.id}`)),wt.map(k=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/frameworks#framework-${k.slug}`),children:[k.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`framework-${k.slug}`))]}),e.jsxs("span",{className:"introduced-note",children:["This paper is the canonical source for ",Js,"."]})]}),Xs&&e.jsxs("div",{className:"introduced-banner lineage-banner",children:[Me.length>0&&e.jsxs("div",{className:"lineage-row",children:[e.jsx("span",{className:"introduced-label lineage-label",children:Me.length===1?"Follow-up paper":"Follow-up papers"}),e.jsx("div",{className:"introduced-methods",children:Me.map(k=>e.jsxs("button",{type:"button",className:"introduced-pill lineage-pill",onClick:()=>s(`/paper/${k.route_identifier}`),children:[e.jsx(Ne,{title:k.title}),e.jsx("span",{className:"introduced-arrow",children:"→"})]},`successor-${k.id}`))})]}),ze.length>0&&e.jsxs("div",{className:"lineage-row",children:[e.jsx("span",{className:"introduced-label lineage-label",children:ze.length===1?"Predecessor paper":"Predecessor papers"}),e.jsx("div",{className:"introduced-methods",children:ze.map(k=>e.jsxs("button",{type:"button",className:"introduced-pill lineage-pill",onClick:()=>s(`/paper/${k.route_identifier}`),children:[e.jsx("span",{className:"introduced-arrow lineage-arrow-back",children:"←"}),e.jsx(Ne,{title:k.title})]},`predecessor-${k.id}`))})]})]}),e.jsx(Mn,{canEdit:!0,onEditMethods:()=>N("methods"),onEditTasks:()=>N("tasks"),paper:c,readerChatRoute:Zs}),e.jsx(tn,{canCopyBadge:ne.length>0,canEdit:!0,evaluationsByTask:v,evaluationsLoading:p,isAdmin:i,onCopyBadge:Ue,onEdit:()=>N("evaluations"),onRefresh:()=>void w(),paper:c,visibleEvaluationCount:(m==null?void 0:m.length)??0})]}),e.jsx(Tn,{allHfArtifactUrls:Ks,citationCopied:M,citationDisplay:Gs,hfArtifactViewer:Vs,onCopyCitation:be,onEditHfArtifacts:()=>N("hf_artifacts"),onEditRepositories:()=>N("repositories"),onEditXThreads:()=>N("x_threads"),paper:c,relatedIsLoading:x.isLoading,relatedPapers:x.data,user:a})]}),e.jsx(Jr,{activeEditor:E,arxivId:l,editSubmitMode:o,evaluations:u??[],isAdmin:i,isLinkedAuthor:P,onOpenChange:R,paper:c}),e.jsx(Ha,{open:L!==null,onOpenChange:k=>{k||B(null)},sectionLabel:L?Aa[L]:"this paper",returnTo:typeof window<"u"?window.location.pathname:"/"})]})};export{zi as default}; diff --git a/assets/PaperDetailView-F3D4F2PU.js b/assets/PaperDetailView-F3D4F2PU.js deleted file mode 100644 index bb5bfe980a08be82cce36b9a95f5bc5ad6d93b5a..0000000000000000000000000000000000000000 --- a/assets/PaperDetailView-F3D4F2PU.js +++ /dev/null @@ -1,29 +0,0 @@ -import{n as pt,s as Ee,o as Js,c as ts,p as J,q as Zs,r as x,j as e,C as ft,f as Z,t as gt,X as ss,P as as,v as ee,w as rs,x as he,y as ue,z as ns,A as xt,B as we,D as ea,L as K,E as ta,F as sa,R as aa,I as ra,G as is,J as na,h as ia,T as oa,K as Ce,g as la,a as Pe,M as Se,N as it,i as os,u as ca,O as At,Q as da,m as Lt,S as ua,U as ma,V as ha,W as pa,Y as fa,Z as ga}from"./index-CbgxfyGU.js";import{u as ae}from"./useMutation-P_trTy9i.js";import{I as U}from"./Icon-D-kA0Owz.js";import{T as xa,M as ba,S as ja,P as va}from"./SotaBadges-C-sTR-EF.js";import{L as ke,a as ot}from"./LatexTitle-Z-HGmZ-H.js";import{e as $e,C as ya,E as _a}from"./ExternalSourceEvalBadge-npO6bZ8N.js";import{p as me,a as B}from"./paperQueryKeys-B8u1BWlI.js";import{s as ka,a as Na}from"./transform-0Udg2p6b.js";import{r as ls,p as wa}from"./paperReader-BIpQD5HO.js";import{u as X}from"./useQuery-Bx9s5-D2.js";import{a as Ca}from"./usePapers-CJaWLZ3y.js";import{f as Sa,D as Ea}from"./latexPlainText-DI8YEXVe.js";import{s as Y}from"./safeExternalHref-CkBrsh84.js";import{F as Tt,i as Pa,P as $a}from"./curation-C7Gmmp4z.js";import{S as de}from"./skeleton-HwvdxvSN.js";import{A as Ia,a as Ra}from"./alert-CFDDvdIM.js";import{B as A}from"./button-Bv9oZ-QU.js";import{D as Ie,a as Re,c as Ae,b as Le,d as Te,e as bt}from"./dialog-Cfp_d3CC.js";import{A as Aa,a as La}from"./AgentLogos-BBl9UNVD.js";import{C as Ta}from"./copy-bzw7JVus.js";import{u as ve,r as Da,e as Fa}from"./evaluationQueryInvalidation-BogLM1gw.js";import{I as z}from"./input-B6pxtfPe.js";import{S as Dt}from"./searchable-select-DNdBIahG.js";import{L as jt}from"./loader-circle-CWMja8Zn.js";import{T as pe,n as He,g as Ft,C as Ua}from"./CatalogEntityPreviewLink-Cvehtzvn.js";import{S as cs,L as O,a as Ba}from"./SignInToEditDialog-CNIcNqbK.js";import{c as G}from"./catalog-DhK7_9-6.js";import{s as ds,p as us}from"./submissions-aWj7YtuZ.js";import{i as ms,a as hs,r as za}from"./queryInvalidation-Chlw4DEx.js";import{D as Ma}from"./database-CTvEb5JG.js";import{P as fe}from"./plus-UK0TEjgd.js";import{S as lt}from"./search-CLtAJGOp.js";import{B as ps}from"./badge-Klg-RRGs.js";import{G as Ut}from"./globe-B_laOt9Z.js";import{G as Bt}from"./github-BYklgHDz.js";import{u as fs}from"./index-CxPKwmVQ.js";import{c as Oe,A as Ha}from"./codex-Bl7j51l-.js";import{M as Oa}from"./index-ZkEATkOr.js";import{r as qa}from"./index-BH3yOoza.js";import{u as Ka}from"./useIntersectionObserver-CID9Kkak.js";import{S as zt,s as Ga}from"./savedPapersAuth-DsQUuWa_.js";import{o as Xa}from"./organizationNames-BVKzYEBp.js";import{A as Qa}from"./AuthorAvatar-CUJMmp_z.js";import"./colors-BkWRhvFI.js";import"./hover-card-ufez2uMo.js";import"./useInfiniteQuery-BAc_4HO5.js";import"./popover-DKJYnYjk.js";import"./textarea-Bf06GTSH.js";/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Va=pt("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wa=pt("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gs=pt("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);function Ya(t){return t!=null&&t.can_directly_edit_catalog?"direct":"pending"}function Ja(t){return(t??[]).filter(s=>!!(s.dataset_slug&&s.task_slug))}function Za(t,s,r="https://paperswithcode.co"){return s.map(a=>{const i=encodeURIComponent(a.evaluation_id),d=`${r}/api/v1/papers/${encodeURIComponent(t)}/leaderboard-badge.svg?eval=${i}&live=1`,o=`${r}/api/v1/papers/${encodeURIComponent(t)}/leaderboard-badge-link?eval=${i}`;return`[![${`Papers with Code: ${a.best_rank===1?"SOTA":`#${a.best_rank}`} on ${a.dataset_name}`}](${d})](${o})`}).join(` -`)}function er(t,s=!0){return X({queryKey:["evaluations","paper",t],queryFn:()=>{if(!t)throw new Error("Paper ID is required");return $e.byPaper(t)},enabled:s&&!!t,staleTime:0,refetchOnMount:"always"})}const xs=t=>t.replace(/v\d+$/,""),tr={models:"https://huggingface.co/",datasets:"https://huggingface.co/datasets/",spaces:"https://huggingface.co/spaces/"},qe=(t,s)=>{const r=(t[s]||[]).length;return r<100?{count:r,isLimited:!1}:{count:r,isLimited:!0}},Ke=(t,s)=>{const r=t[s];return Array.isArray(r)?r.map(a=>{if(typeof a=="string")return a;if(a&&typeof a=="object"){const i=a;return i.id||i.repoId||null}return null}).filter(a=>!!a).map(a=>`${tr[s]}${a}`):[]},sr=async t=>{try{return(await fetch(`https://huggingface.co/api/papers/${xs(t)}`)).ok}catch{return!1}},ar=async t=>{const s=xs(t),[r,a]=await Promise.all([fetch(`https://huggingface.co/api/arxiv/${s}/repos`).then(async l=>l.ok?l.json():(console.warn(`Failed to fetch repos for arXiv:${s}, status: ${l.status}`),null)).catch(l=>(console.warn(`Failed to fetch repos for arXiv:${s}:`,l),null)),sr(s)]);if(!r)return{models:0,datasets:0,spaces:0,modelUrls:[],datasetUrls:[],spaceUrls:[],isLimited:!1,paperExists:a};const i=qe(r,"models"),d=qe(r,"datasets"),o=qe(r,"spaces");return{models:i.count,datasets:d.count,spaces:o.count,modelUrls:Ke(r,"models"),datasetUrls:Ke(r,"datasets"),spaceUrls:Ke(r,"spaces"),isLimited:i.isLimited||d.isLimited||o.isLimited,paperExists:a}},rr=t=>X({queryKey:["huggingface-repos",t],queryFn:()=>ar(t),enabled:!!t,staleTime:10*60*1e3,retry:1});function nr(t,s){try{const r=new URL(t),a=r.pathname.split("/").filter(Boolean);return(a[0]==="datasets"||a[0]==="spaces")&&a.shift(),a.slice(0,2).join("/")||r.hostname.replace(/^www\./,"")}catch{return s}}function Ge(t,s,r){return[...new Set([...t,...s??[]])].map(a=>({href:a,label:nr(a,r)}))}function Xe(t,s,r){if(r==null&&t.length===0&&!(s!=null&&s.length))return;const a=new Set([...t,...s??[]]);return Math.max(a.size,r??0)}function Qe(t,s){if(!(t==null&&s==null))return Math.max(t??0,s??0)}function Ve(t){return t[0]??"https://huggingface.co"}function We(t,s){return s[0]??t}function ir(t){const s=`${t.title.slice(0,60)}${t.title.length>60?"…":""}`,r=`${t.authors[0]||""}${t.authors.length>1?" et al.":""}`,a=t.authors.join(" and "),i=(t.published||"").slice(0,4)||"—",d=(o,l)=>t.arxiv_id?`@article{${t.arxiv_id.replace(".","")}, - title={{${o}}}, - author=${l}, - year={{${i}}}, - eprint={{${t.arxiv_id}}}, - archivePrefix={{arXiv}} -}`:`@misc{paper${t.id}, - title={{${o}}}, - author=${l}, - year={{${i}}}, - url={{${t.source_url||t.url_abs||""}}} -}`;return{citationDisplay:d(s,`{{${r}}}`),citationCopy:d(t.title,`{${a}}`)}}function or(t,s,r){var b,h,n;const a={models:t.hf_models??[],datasets:t.hf_datasets??[],spaces:t.hf_spaces??[]},i=t.linked_hf_artifacts,d=t.hf_artifact_summary,o={models:[...(s==null?void 0:s.modelUrls)??[],...(i==null?void 0:i.models)??[]],datasets:[...(s==null?void 0:s.datasetUrls)??[],...(i==null?void 0:i.datasets)??[]],spaces:[...(s==null?void 0:s.spaceUrls)??[],...(i==null?void 0:i.spaces)??[]]},l={models:Qe(s==null?void 0:s.models,d==null?void 0:d.model_count),datasets:Qe(s==null?void 0:s.datasets,d==null?void 0:d.dataset_count),spaces:Qe(s==null?void 0:s.spaces,d==null?void 0:d.space_count)},u={models:Ge(a.models,o.models,"Model"),datasets:Ge(a.datasets,o.datasets,"Dataset"),spaces:Ge(a.spaces,o.spaces,"Space")},v={models:u.models.map(({href:m})=>m),datasets:u.datasets.map(({href:m})=>m),spaces:u.spaces.map(({href:m})=>m)},p=t.arxiv_id!=null?Ee(t.arxiv_id):null,c=t.arxiv_id?{isLoading:r,paperHref:`https://huggingface.co/papers/${p}`,rows:[{label:"Models",href:We(`https://huggingface.co/models?other=arxiv:${t.arxiv_id}`,a.models),count:Xe(a.models,o.models,l.models),isLimited:s==null?void 0:s.isLimited,links:u.models},{label:"Datasets",href:We(`https://huggingface.co/datasets?other=arxiv:${t.arxiv_id}`,a.datasets),count:Xe(a.datasets,o.datasets,l.datasets),isLimited:s==null?void 0:s.isLimited,links:u.datasets},{label:"Spaces",href:We(`https://huggingface.co/papers/${p}`,a.spaces),count:Xe(a.spaces,o.spaces,l.spaces),isLimited:s==null?void 0:s.isLimited,links:u.spaces}],footer:`Cite arxiv.org/abs/${p} in a HF README to link it here.`}:{isLoading:!1,paperHref:null,rows:[{label:"Models",href:Ve(a.models),count:a.models.length,links:u.models},{label:"Datasets",href:Ve(a.datasets),count:a.datasets.length,links:u.datasets},{label:"Spaces",href:Ve(a.spaces),count:a.spaces.length,links:u.spaces}],footer:null},g=(t.methods??[]).filter(({source_paper_id:m})=>m===t.id),f=t.introduced_benchmarks??[],y=t.introduced_frameworks??[],k=[g.length&&(g.length===1?"this method":"these methods"),f.length&&(f.length===1?"this benchmark":"these benchmarks"),y.length&&(y.length===1?"this framework":"these frameworks")].filter(m=>!!m);return{...ir(t),allHfArtifactUrls:v,authorEntries:t.authors.map((m,j)=>{var S,E,C,I,L,T;return{name:m,id:((E=(S=t.author_links)==null?void 0:S[j])==null?void 0:E.id)??null,hf_username:((I=(C=t.author_links)==null?void 0:C[j])==null?void 0:I.hf_username)??null,hf_avatar_url:((T=(L=t.author_links)==null?void 0:L[j])==null?void 0:T.hf_avatar_url)??null}}),copyableRanks:Ja(t.leaderboard_ranks),hasIntroducedItems:k.length>0,hasLineageItems:!!((b=t.predecessor_papers)!=null&&b.length||(h=t.successor_papers)!=null&&h.length),hfArtifactViewer:c,hfPaperExists:!!(s!=null&&s.paperExists),introducedBenchmarks:f,introducedFrameworks:y,introducedMethods:g,introducedSummary:k.join(" and "),numPages:t.num_pages||null,paperSourceLabel:t.arxiv_id?`arXiv:${t.arxiv_id}`:"External resource",predecessorPapers:t.predecessor_papers??[],projectPages:((n=t.project_pages)==null?void 0:n.filter(({url:m})=>m).map(m=>({...m,safeHref:Y(m.url)})))??[],repoSummary:ka(t.repositories),safeAbstractUrl:Y(t.url_abs),safeConferenceUrl:Y(t.conference_url_abs),safePdfUrl:Y(t.url_pdf),successorPapers:t.successor_papers??[]}}const lr=["tldr","abstract","tasks","methods","results"];function cr(t){if(!t)return{section:null,resultsTaskSlug:null};const[s,r]=t.split("?",2);if(!lr.includes(s))return{section:null,resultsTaskSlug:null};const a=s;return a!=="results"||!r?{section:a,resultsTaskSlug:null}:{section:a,resultsTaskSlug:new URLSearchParams(r).get("task")}}const bs=t=>`results-task-${t}`,dr=t=>`#results?task=${encodeURIComponent(t)}`;function ur({direct:t,paperId:s,refetchEvaluations:r,refetchPaper:a}){a(),r(),!(!t||!s)&&(B.primeCurationState(s,!0).catch(()=>{}),$e.primeCurationState(s,!0).catch(()=>{}))}function mr(t,s){const r=t?Js(t):"",a=ts(),{toast:i}=J(),{preferences:d}=Zs(),o=Ca(r,!!r),l=o.data,[u,v]=x.useState(!1);x.useEffect(()=>{!t||t===r||a(`/paper/${r}${window.location.search}${window.location.hash}`,{replace:!0})},[r,a,t]),x.useEffect(()=>{if(l!=null&&l.title)return document.title=l.page_title||Sa(l.title),()=>{document.title=Ea}},[l==null?void 0:l.page_title,l==null?void 0:l.title]),x.useEffect(()=>{if(v(!1),!(l!=null&&l.id))return;const m=window.setTimeout(()=>v(!0),0);return()=>window.clearTimeout(m)},[l==null?void 0:l.id]);const p=u&&!!(l!=null&&l.id),c=rr(u?l==null?void 0:l.arxiv_id:void 0),g=er(l==null?void 0:l.id,p),f=X({queryKey:[...me.feeds.versions,l==null?void 0:l.arxiv_id],queryFn:()=>B.versions(Ee(l.arxiv_id)),enabled:p&&!!(l!=null&&l.arxiv_id),staleTime:10*60*1e3}),y=X({queryKey:[...me.feeds.related,l==null?void 0:l.id],queryFn:()=>B.related(l.arxiv_id||l.id,4),enabled:p,staleTime:10*60*1e3});x.useEffect(()=>{const m=()=>{ur({direct:s==="direct",paperId:l==null?void 0:l.id,refetchEvaluations:g.refetch,refetchPaper:o.refetch}),i({title:"This section changed",description:"The latest state has been reloaded. Review your changes before submitting again.",variant:"destructive"})};return window.addEventListener("pwc:catalog-conflict",m),()=>window.removeEventListener("pwc:catalog-conflict",m)},[s,g.refetch,l==null?void 0:l.id,o.refetch,i]);const k=x.useMemo(()=>{const m=g.data;return!m||!d.hide_closed_source_evals?m:m.filter(j=>j.is_open!==!1)},[g.data,d.hide_closed_source_evals]),b=x.useMemo(()=>{if(!k)return[];const m=new Map;for(const j of k){const S=m.get(j.task_id);S?S.rows.push(j):m.set(j.task_id,{taskId:j.task_id,taskName:j.task_name||"—",taskSlug:j.task_slug,rows:[j]})}return[...m.values()]},[k]),h=x.useMemo(()=>l?or(l,c.data,c.isLoading):null,[c.data,c.isLoading,l]),n=x.useRef(!1);return x.useEffect(()=>{n.current=!1},[r]),x.useEffect(()=>{let m=0;const j=(E=!1,C=!1)=>{const{section:I,resultsTaskSlug:L}=cr(window.location.hash.slice(1));if(!I||!l||I==="tldr"&&!l.tldr||I==="results"&&(!p||g.isLoading)||!E&&n.current)return;let T=I==="results"&&L?document.getElementById(bs(L)):document.getElementById(I);if(!T&&I==="results"&&L){if(b.some(({taskSlug:H})=>H===L))return;T=document.getElementById("results")}T&&(m=window.requestAnimationFrame(()=>{n.current=!0,T.scrollIntoView({block:"start",behavior:C?"smooth":"auto"})}))};j();const S=()=>{n.current=!1,j(!0,!0)};return window.addEventListener("hashchange",S),()=>{window.removeEventListener("hashchange",S),m&&window.cancelAnimationFrame(m)}},[b,g.isLoading,l,p]),{arxivId:r,evaluations:g.data,evaluationsByTask:b,evaluationsLoading:g.isLoading,paper:l,paperError:o.error,paperLoading:o.isLoading,presentation:h,refetchEvaluations:g.refetch,refetchPaper:o.refetch,relatedQuery:y,versions:f.data??[],visibleEvaluations:k}}function hr(){const[t,s]=x.useState(null),r=x.useCallback(i=>{s(i)},[]),a=x.useCallback((i,d)=>{s(o=>d?i:o===i?null:o)},[]);return{activeEditor:t,openEditor:r,setEditorOpen:a}}function pr({paperId:t}){const[s,r]=x.useState(!1),[a,i]=x.useState(!1),[d,o]=x.useState(!1),l=`Help me edit https://paperswithcode.co/paper/${t} using the public pwc CLI from https://github.com/huggingface/pwc-cli. Install or update the CLI following its README, then run pwc skills add to load its instructions. Run pwc auth login --paper ${t}; I will authorize this paper in my browser. Export with pwc paper edit export ${t} --output edits.json, make explicit operations for the corrections I request, and preview before submitting. For organization changes, use an organizations operation with payload {"organization_ids": [existing organization IDs]}; this replaces the paper’s organization links and publishes directly. Use existing organizations, benchmark and metric definitions, preserve unrelated entries, and cite source URLs where available. Never print or copy credentials. Ask me what to change if I have not specified it.`;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"action-btn",title:"Edit this paper page with Claude, Codex, Cursor, or OpenCode",onClick:()=>{r(!1),i(!1),o(!0)},children:["Edit with your agent",e.jsx(Aa,{})]}),e.jsx(Ie,{open:d,onOpenChange:o,children:e.jsxs(Re,{className:"max-w-2xl",children:[e.jsxs(Ae,{children:[e.jsx(Le,{children:"Edit this paper with your agent"}),e.jsx(Te,{children:"Spotted a missing code link, a wrong task, or a missing benchmark result? Your favorite coding agent can fix it for you."})]}),e.jsx(La,{}),e.jsxs("ol",{className:"list-decimal space-y-1 pl-5 text-sm text-muted-foreground",children:[e.jsx("li",{children:"Copy the prompt below."}),e.jsx("li",{children:"Paste it into Claude Code, Codex, Cursor, OpenCode, or another coding agent, and tell it what to change."}),e.jsxs("li",{children:["The agent installs the ",e.jsx("a",{className:"underline",href:"https://github.com/huggingface/pwc-cli",target:"_blank",rel:"noreferrer",children:"pwc CLI"}),", asks you to authorize this paper with your Hugging Face account, and previews the edits before submitting them."]})]}),e.jsx("textarea",{"aria-label":"Paper edit prompt",readOnly:!0,value:l,className:"h-48 w-full resize-none rounded border bg-muted/40 p-3 font-mono text-xs",onFocus:u=>u.currentTarget.select()}),a&&e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not copy automatically. Select the prompt above and copy it manually."}),e.jsxs(A,{className:"justify-self-end",onClick:async()=>{try{await navigator.clipboard.writeText(l),r(!0),i(!1)}catch{i(!0)}},children:[s?e.jsx(ft,{size:14}):e.jsx(Ta,{size:14}),s?"Prompt copied":"Copy prompt"]})]})})]})}function fr(t){return t.map(s=>{const r=s.best_metric||Object.keys(s.metrics)[0]||"";return{id:s.id,task_id:s.task_id,dataset_id:s.dataset_id,model_name:s.model_name||"",harness:s.harness||"",metric_name:r,metric_value:String(s.metrics[r]??""),original_metrics:{...s.metrics},original_metric_name:r,best_rank:s.best_rank!=null?String(s.best_rank):"",num_parameters:s.num_parameters!=null?String(s.num_parameters):"",hf_model_url:s.hf_model_url||"",is_open:s.is_open!==!1,operation:"unchanged"}})}function gr(t,s){const r={...t.original_metrics},a=r[t.original_metric_name];return t.original_metric_name!==s&&delete r[t.original_metric_name],r[s]=a!=null&&t.metric_value===String(a)?a:t.metric_value,r}function xr(t){const s=t==null?void 0:t.trim();return s?Number(s):void 0}function Mt(t){const s=t.trim();return s?Number(s):null}function Ye(t){return t.trim()||null}function Je(t){return!!(t&&/^\d+$/.test(t.trim())&&Number.isSafeInteger(Number(t))&&Number(t)>0)}function js(t){const s=[];return t.forEach((r,a)=>{var o;if(r.operation==="unchanged")return;const i=(l,u)=>{s.push({rowIndex:a,field:l,message:u})};if(r.operation!=="create"&&!Je(r.id)&&i("id","This result has no valid evaluation ID. Reload the paper before editing it."),r.operation==="delete")return;Je(r.task_id)||i("task_id","Select a valid task."),Je(r.dataset_id)||i("dataset_id","Select a valid dataset.");const d=r.metric_name.trim();d?d!==r.original_metric_name&&Object.prototype.hasOwnProperty.call(r.original_metrics,d)&&i("metric_name",`Cannot rename a metric to "${d}": this evaluation already has that score.`):i("metric_name","Select a metric."),(o=r.best_rank)!=null&&o.trim()&&!Number.isSafeInteger(Number(r.best_rank))&&i("best_rank","Enter a whole-number rank."),r.num_parameters.trim()&&(!Number.isSafeInteger(Number(r.num_parameters))||Number(r.num_parameters)<0)&&i("num_parameters","Enter a non-negative whole-number parameter count."),r.metric_value.trim()||i("metric_value","Enter a metric value.")}),s}function br(t,s){const r=js(t);return r.length?{valid:!1,errors:r}:{valid:!0,operations:jr(t,s)}}function jr(t,s){const r=[];for(const a of t){if(a.operation==="delete"){r.push({op:"delete",evaluation_id:Number(a.id)});continue}if(a.operation!=="create"&&a.operation!=="update")continue;const i=a.metric_name.trim(),d=s(a.task_id,a.dataset_id),o={task_id:Number(a.task_id),dataset_id:Number(a.dataset_id),metrics:gr(a,i),best_metric:i,is_open:a.is_open},l=a.model_name.trim(),u=xr(a.best_rank);if(a.operation==="create"){const v=Mt(a.num_parameters),p=Ye(a.hf_model_url);r.push({op:"create",data:{...o,...l?{model_name:l}:{},...d&&a.harness.trim()?{harness:a.harness.trim()}:{},...u!==void 0?{best_rank:u}:{},...v!==null?{num_parameters:v}:{},...p!==null?{hf_model_url:p}:{}}});continue}r.push({op:"update",evaluation_id:Number(a.id),data:{...o,...l?{model_name:l}:{},harness:d?Ye(a.harness):null,...u!==void 0?{best_rank:u}:{},num_parameters:Mt(a.num_parameters),hf_model_url:Ye(a.hf_model_url)}})}return r}function vr(t,s){return s.map(r=>{switch(r.op){case"delete":return{operation:"delete",evaluation_id:r.evaluation_id};case"update":return{operation:"update",evaluation_id:r.evaluation_id,payload:r.data};case"create":return{operation:"create",payload:{paper_id:t,...r.data}}}})}function yr(t,s){const r=t.metrics(s.task_id,s.dataset_id).metrics.map(a=>({value:a.metric_name,label:a.metric_name,description:a.metric_direction==="higher_is_better"?"Higher is better":"Lower is better"}));return s.metric_name&&!r.some(a=>a.value===s.metric_name)&&r.unshift({value:s.metric_name,label:`${s.metric_name} (legacy)`}),r}const q="text-left py-2 px-2 font-medium text-sm";function _r({rows:t,catalog:s,draftErrors:r,errorId:a,isAdmin:i,showHarnessColumn:d,onFieldChange:o,onOpenSourceChange:l,onDelete:u}){const v=(g,f)=>r.some(y=>y.rowIndex===g&&y.field===f),p=(g,f)=>{const y=r.find(k=>k.rowIndex===g&&k.field===f);return y?e.jsx("p",{id:`${a}-${g}-${f}-error`,className:"text-xs text-destructive",children:y.message}):null},c=(g,f)=>({id:`${a}-${g}-${f}`,"aria-invalid":v(g,f),"aria-describedby":`${a}-${g}-${f}-error`});return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("th",{className:`${q} min-w-[180px]`,children:"Task"}),e.jsx("th",{className:`${q} min-w-[180px]`,children:"Dataset"}),e.jsx("th",{className:`${q} ${d?"min-w-[140px]":"min-w-[240px]"}`,children:"Model"}),d&&e.jsx("th",{className:`${q} min-w-[140px]`,children:"Harness"}),e.jsx("th",{className:`${q} min-w-[140px]`,children:"Metric"}),e.jsx("th",{className:q,children:"Value"}),e.jsx("th",{className:q,children:"Parameters"}),e.jsx("th",{className:`${q} min-w-[200px]`,children:"HF model URL"}),e.jsx("th",{className:`${q} w-20`,children:"Open source"}),e.jsx("th",{className:`${q} w-16`,children:"Action"})]})}),e.jsx("tbody",{children:t.map((g,f)=>{if(g.operation==="delete")return null;const y=s.task(g.task_id),k=s.dataset(g.dataset_id),b=s.metrics(g.task_id,g.dataset_id),h=yr(s,g);return e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("td",{className:"py-2 px-2",children:e.jsxs("div",{role:"group","aria-label":"Task","aria-describedby":`${a}-${f}-task_id-error`,children:[e.jsx(Dt,{value:g.task_id,onChange:n=>o(f,"task_id",n),placeholder:"Select task",searchPlaceholder:"Search tasks...",emptyMessage:"No tasks found.",selectedOption:y?{value:y.id,label:y.name}:null,queryKey:["eval-edit-task-search"],queryFn:s.searchTasks}),p(f,"task_id")]})}),e.jsx("td",{className:"py-2 px-2",children:e.jsxs("div",{role:"group","aria-label":"Dataset","aria-describedby":`${a}-${f}-dataset_id-error`,children:[e.jsx(Dt,{value:g.dataset_id,onChange:n=>o(f,"dataset_id",n),placeholder:g.task_id?"Select dataset":"Select task first",searchPlaceholder:"Search datasets...",emptyMessage:g.task_id?"No datasets found for this task.":"Select a task first.",disabled:!g.task_id,selectedOption:k?{value:k.id,label:k.name}:null,queryKey:["eval-edit-dataset-search",g.task_id],queryFn:s.searchDatasets(g.task_id),enabled:!!g.task_id}),p(f,"dataset_id")]})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(z,{type:"text",className:"w-full text-sm",placeholder:"Model name",value:g.model_name,onChange:n=>o(f,"model_name",n.target.value)})}),d&&e.jsx("td",{className:"py-2 px-2",children:s.supportsHarness(g.task_id,g.dataset_id)?e.jsx(z,{type:"text",className:"w-full text-sm",placeholder:"Claude Code, Terminus, ...",value:g.harness,onChange:n=>o(f,"harness",n.target.value)}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not supported"})}),e.jsxs("td",{className:"py-2 px-2",children:[!g.task_id||!g.dataset_id?e.jsx("span",{className:"text-xs text-muted-foreground",children:"Select task + dataset"}):b.loading?e.jsxs("span",{className:"inline-flex items-center text-xs text-muted-foreground",children:[e.jsx(jt,{className:"mr-1 h-3 w-3 animate-spin"}),"Loading metrics..."]}):h.length>0?e.jsxs("select",{className:"w-full rounded-md border border-border bg-background px-2 py-1 text-sm",...c(f,"metric_name"),value:g.metric_name,onChange:n=>o(f,"metric_name",n.target.value),children:[e.jsx("option",{value:"",children:"Select metric"}),h.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))]}):!b.error&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"No configured metrics"}),b.error&&e.jsx("p",{className:"text-xs text-destructive",children:"Could not load metrics"}),p(f,"metric_name")]}),e.jsxs("td",{className:"py-2 px-2",children:[e.jsx(z,{type:"text",className:"w-full text-sm",placeholder:"44.9",...c(f,"metric_value"),value:g.metric_value,onChange:n=>o(f,"metric_value",n.target.value)}),p(f,"metric_value")]}),e.jsxs("td",{className:"py-2 px-2",children:[e.jsx(z,{type:"number",min:0,step:1,className:"w-full text-sm",placeholder:"e.g. 7000000000",...c(f,"num_parameters"),value:g.num_parameters,onChange:n=>o(f,"num_parameters",n.target.value),title:"Raw model parameter count (e.g. 7000000000 for a 7B model). Leave blank if unknown."}),p(f,"num_parameters")]}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(z,{type:"url",className:"w-full text-sm",placeholder:"https://huggingface.co/org/model",value:g.hf_model_url,onChange:n=>o(f,"hf_model_url",n.target.value),title:"Hugging Face model page for this row (must start with https://huggingface.co/). Leave blank if none."})}),e.jsx("td",{className:"py-2 px-2 text-center",children:e.jsx("input",{type:"checkbox",className:"h-4 w-4 align-middle",checked:g.is_open,onChange:n=>l(f,n.target.checked),title:"Whether the evaluated model is open-source. Uncheck for closed-source models."})}),e.jsx("td",{className:"py-2 px-2",children:e.jsx(A,{variant:"ghost",size:"sm",onClick:()=>u(f),className:"h-8 w-8 p-0 text-destructive hover:text-destructive",title:g.id&&!i?"Only administrators can delete published results":"Remove row",disabled:!!g.id&&!i,children:e.jsx(pe,{className:"w-4 h-4"})})})]},f)})})]})})}function kr(t){const s=typeof window<"u"&&window.location.hostname==="staging.paperswithcode.co";return e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-900 dark:bg-amber-950/40 dark:text-amber-100",children:[e.jsx("p",{className:"font-medium",children:s?"Test-only: this change stays on staging.":"Your changes go live right away."}),e.jsx("p",{className:"mt-1 leading-snug",children:s?"This exercises staging-local pending behavior and is not queued for production review.":"Edits are applied immediately and reviewed afterwards. A few, such as links to unfamiliar sites, are held for an admin first."})]})}function V({title:t,description:s,className:r,submitMode:a,isAuthor:i=!1,onOpenChange:d,onSave:o,isSaving:l,saveDisabled:u=!1,footerStart:v,children:p}){const c=a==="pending";return e.jsx(Ie,{open:!0,onOpenChange:d,children:e.jsxs(Re,{className:r,children:[e.jsxs(Ae,{children:[e.jsx(Le,{children:t}),e.jsx(Te,{children:s})]}),c&&e.jsx(kr,{isAuthor:i}),p,e.jsxs(bt,{children:[v,e.jsx(A,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(A,{onClick:o,disabled:l||u,children:l?e.jsxs(e.Fragment,{children:[e.jsx(jt,{className:"w-4 h-4 mr-2 animate-spin"}),c?"Submitting...":"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ft,{className:"w-4 h-4 mr-2"}),c?"Submit for review":"Save Changes"]})})]})]})})}const Ze=100,Ht=t=>["eval-edit","task",t],Ot=t=>["eval-edit","dataset",t];function le(...t){return new Map(t.flat().flatMap(s=>s?[[s.id,s]]:[]))}function et(t){return[...new Set(t.filter(Boolean))]}function Nr(t,s){var h;const r=Z(),a=x.useMemo(()=>et(t.map(n=>n.task_id)),[t]),i=x.useMemo(()=>et(t.map(n=>n.dataset_id)),[t]),d=x.useMemo(()=>et(t.map(n=>n.task_id&&n.dataset_id?`${n.task_id}:${n.dataset_id}`:"")),[t]),o=x.useMemo(()=>le(s.map(n=>n.task_name?{id:n.task_id,name:n.task_name,slug:n.task_slug,level:0}:void 0)),[s]),l=x.useMemo(()=>le(s.map(n=>n.dataset_name?{id:n.dataset_id,name:n.dataset_name,slug:n.dataset_slug}:void 0)),[s]),u=ve({queries:a.filter(n=>!o.has(n)).map(n=>({queryKey:Ht(n),queryFn:()=>G.getTask(n),staleTime:1/0})),combine:n=>n.map(m=>m.data)}),v=ve({queries:a.map(n=>({queryKey:["eval-edit","task-datasets",n],queryFn:async()=>(await G.listDatasets({task_id:Number(n),page_size:Ze})).results}))}),p=le(...v.map(n=>n.data??[])),c=ve({queries:i.filter(n=>!l.has(n)&&!p.has(n)).map(n=>({queryKey:Ot(n),queryFn:()=>G.getDataset(n),staleTime:1/0})),combine:n=>({data:n.map(m=>m.data),loaded:n.every(m=>m.isSuccess)})}),g=ve({queries:d.map(n=>{const[m,j]=n.split(":");return{queryKey:["eval-edit","leaderboard-metrics",m,j],queryFn:()=>G.leaderboardMetrics(j,m)}})}),f=le([...o.values()],u),y=le([...l.values()],[...p.values()],c.data),k=((h=v.find(n=>n.error))==null?void 0:h.error)??null,b=v.every(n=>n.isSuccess)&&c.loaded;return{task:n=>f.get(n),dataset:n=>y.get(n),supportsHarness:(n,m)=>{var j;return!!(n&&m&&((j=y.get(m))!=null&&j.supports_harness))},metrics:(n,m)=>{const j=g[d.indexOf(`${n}:${m}`)];return{metrics:(j==null?void 0:j.data)??[],loading:(j==null?void 0:j.isFetching)??!1,error:(j==null?void 0:j.error)??null}},datasetListError:k,harnessSupportKnown:b,searchTasks:async n=>{const m=await G.listTasks({page_size:Ze,...n?{q:n}:{}});return m.results.forEach(j=>r.setQueryData(Ht(j.id),j)),m.results.map(j=>{var S;return{value:j.id,label:j.name,description:(S=j.description)==null?void 0:S.slice(0,100)}})},searchDatasets:n=>async m=>{const j=await G.listDatasets({task_id:Number(n),page_size:Ze,...m?{q:m}:{}});return j.results.forEach(S=>r.setQueryData(Ot(S.id),S)),j.results.map(S=>({value:S.id,label:S.name,description:S.full_name}))}}}function wr(t,{toast:s,queryClient:r,paperIds:a,queuedDescription:i}){if(t.status==="approved"){ms(r,a),hs(r),s({title:"Edit applied",description:"Your change is now live on this paper."});return}s({title:"Edit submitted for review",description:i})}function W({editType:t,paperId:s,arxivId:r,submitMode:a,messages:i,toPendingPayload:d,applyDirect:o,applyOptimistic:l,onSaved:u,onClose:v}){const p=Z(),{toast:c}=J(),g=a==="pending";return ae({mutationFn:async f=>g?{submitted:await ds.submit(us(Number(s),t,d(f)))}:{paper:await o(f)},onMutate:async f=>{if(g||!l)return{};const y=await l(f);return v(),{rollback:y}},onSuccess:(f,y)=>{"submitted"in f?(wr(f.submitted,{toast:c,queryClient:p,paperIds:[s,r],queuedDescription:`Thanks! An admin will review your proposed ${i.proposal} shortly.`}),u==null||u(y,{direct:!1,live:f.submitted.status==="approved"})):(f.paper&&za(p,f.paper,[s,r]),u==null||u(y,{direct:!0,live:!0})),v()},onError:(f,y,k)=>{var b;(b=k==null?void 0:k.rollback)==null||b.call(k),c({title:g?"Could not submit edit":`Could not save ${i.noun}`,description:gt(f,g?"Failed to submit your edit. Please try again.":i.failure),variant:"destructive"})}})}const Cr={task_id:"",dataset_id:"",model_name:"",harness:"",metric_name:"",metric_value:"",original_metrics:{},original_metric_name:"",best_rank:"",num_parameters:"",hf_model_url:"",is_open:!0,operation:"create"};function Sr(t){return(t??[]).some(s=>s.slug==="coding-agents"||s.name.trim().toLowerCase()==="coding agents")}function qt(t,s){return{...t,...s,operation:t.operation==="unchanged"?"update":t.operation}}function Er({onOpenChange:t,paperId:s,arxivId:r,initialEvaluations:a,paperTasks:i,submitMode:d="direct",isAdmin:o=!1,isAuthor:l=!1}){const u=x.useId(),v=Sr(i),[p,c]=x.useState(null),g=x.useMemo(()=>fr(a),[a]),f=p??g,[y,k]=x.useState(!1),b=y?js(f):[],[h,n]=x.useState(null),m=Nr(f,a),j=Z(),{toast:S}=J(),E=W({editType:"evaluations",paperId:s,arxivId:r,submitMode:d,messages:{proposal:"evaluation changes",noun:"evaluations",failure:"Failed to update evaluations."},toPendingPayload:P=>({operations:P}),applyDirect:async P=>{if(!o&&P.length>50)throw new Error("Contributor evaluation batches are limited to 50 operations; contact an admin.");const w=Number(s);await $e.batch(w,vr(w,P))},onSaved:(P,{live:w})=>{w&&Da(j,Fa(s,a,P,r))},onClose:()=>t(!1)}),C=(P,w)=>c(f.map((_,R)=>R===P?w(_):_)),I=P=>{if(!f[P].id){c(f.filter((w,_)=>_!==P));return}window.confirm("Delete this evaluation? You will be asked to sign in again if your session is older than 15 minutes.")&&C(P,w=>({...w,operation:"delete"}))},L=(P,w,_)=>{C(P,R=>{if(R[w]===_)return R;const $={[w]:_};return(w==="task_id"||w==="dataset_id")&&Object.assign($,{original_metrics:{},original_metric_name:"",metric_value:"",best_rank:"",metric_name:""}),w==="task_id"&&Object.assign($,{dataset_id:"",harness:""}),w==="dataset_id"&&_&&!m.supportsHarness(R.task_id,_)&&($.harness=""),qt(R,$)})},T=()=>{k(!0);const P=br(f,m.supportsHarness);if(P.valid){if(P.operations.length===0){S({title:"No changes to submit",description:"Your evaluation list matches the existing data."});return}E.mutate(P.operations)}},H=P=>f.slice(0,P+1).filter(w=>w.operation!=="delete").length;return e.jsxs(e.Fragment,{children:[e.jsxs(V,{title:"Edit Evaluation Results",description:"Add, edit, or remove evaluation results for this paper. Each row represents a benchmark result.",className:"max-w-6xl max-h-[800px]",submitMode:d,isAuthor:l,onOpenChange:t,onSave:T,isSaving:E.isPending,saveDisabled:!m.harnessSupportKnown,footerStart:e.jsxs("div",{className:"flex flex-wrap gap-2 sm:mr-auto",children:[e.jsx(A,{variant:"ghost",onClick:()=>n("benchmark"),children:"Suggest a new benchmark"}),e.jsx(A,{variant:"ghost",onClick:()=>n("metric"),children:"Suggest a new metric"})]}),children:[b.length>0&&e.jsxs("div",{role:"alert",className:"text-sm text-destructive",children:["Fix the following errors before saving. No changes have been submitted.",e.jsx("ul",{children:b.map(P=>e.jsxs("li",{children:["Row ",H(P.rowIndex),": ",P.message]},`${P.rowIndex}-${P.field}`))})]}),m.datasetListError&&e.jsxs("p",{className:"text-sm text-destructive",children:["Could not load the benchmarks for these tasks: ",m.datasetListError.message]}),e.jsxs("div",{className:"py-4 overflow-y-auto max-h-[600px]",children:[f.some(P=>P.operation!=="delete")?e.jsx(_r,{rows:f,catalog:m,draftErrors:b,errorId:u,isAdmin:o,showHarnessColumn:v,onFieldChange:L,onOpenSourceChange:(P,w)=>C(P,_=>qt(_,{is_open:w})),onDelete:I}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Ma,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"No evaluation results yet"}),e.jsx("p",{className:"text-sm mt-2",children:'Click "Add Row" below to add a new evaluation'})]}),e.jsx("div",{className:"mt-4",children:e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>c([...f,Cr]),className:"flex items-center space-x-2",children:[e.jsx(fe,{className:"w-4 h-4"}),e.jsx("span",{children:"Add Row"})]})})]})]}),e.jsx(cs,{open:h!==null,onOpenChange:P=>{P||n(null)},paperId:s,kind:h??"benchmark"})]})}const tt=[{key:"hf_models",label:"Models",placeholder:"https://huggingface.co/org/model"},{key:"hf_datasets",label:"Datasets",placeholder:"https://huggingface.co/datasets/org/data"},{key:"hf_spaces",label:"Spaces",placeholder:"https://huggingface.co/spaces/org/demo"}];function Kt(t){return t.map(s=>s.trim()).filter(Boolean)}function st(t,s){const r=Kt(t).sort(),a=Kt(s).sort();return r.length!==a.length?!1:r.every((i,d)=>i===a[d])}function Pr(t,s){return st(t.hf_models,s.hf_models)&&st(t.hf_datasets,s.hf_datasets)&&st(t.hf_spaces,s.hf_spaces)}function $r({onOpenChange:t,paperId:s,arxivId:r,initialArtifacts:a,submitMode:i="direct",isAuthor:d=!1}){const[o,l]=x.useState(a),[u,v]=x.useState({hf_models:"",hf_datasets:"",hf_spaces:""}),p=W({editType:"hf_artifacts",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"Hugging Face artifact changes",noun:"Hugging Face artifacts",failure:"Failed to update Hugging Face artifacts."},toPendingPayload:b=>b,applyDirect:b=>B.updateHfArtifacts(s,b),onClose:()=>t(!1)}),c=()=>{const b={hf_models:[...o.hf_models],hf_datasets:[...o.hf_datasets],hf_spaces:[...o.hf_spaces]};for(const{key:h}of tt){const n=u[h].trim();if(n){if(b[h].some(m=>m.trim()===n))return alert(`This ${h.replace("hf_","")} URL is already added`),null;b[h]=[...b[h],n]}}return b},g=b=>{const h=u[b].trim();if(h){if(o[b].some(n=>n.trim()===h)){alert(`This ${b.replace("hf_","")} URL is already added`);return}l(n=>({...n,[b]:[...n[b],h]})),v(n=>({...n,[b]:""}))}},f=(b,h)=>{l(n=>({...n,[b]:n[b].filter(m=>m!==h)}))},y=()=>{const b=c();if(b===null)return;const h=Object.keys(a).some(n=>a[n].some(m=>!b[n].includes(m)));i==="direct"&&h&&!window.confirm("Remove one or more Hugging Face artifact links?")||p.mutate(b)},k=x.useMemo(()=>{const b={hf_models:[...o.hf_models],hf_datasets:[...o.hf_datasets],hf_spaces:[...o.hf_spaces]};for(const{key:h}of tt){const n=u[h].trim();if(n){if(b[h].some(m=>m.trim()===n))return!1;b[h]=[...b[h],n]}}return!Pr(b,a)},[o,u,a]);return e.jsx(V,{title:"Edit Hugging Face Artifacts",description:"Add or remove linked Hugging Face models, datasets, and Spaces for this paper.",className:"max-w-2xl max-h-[700px]",submitMode:i,isAuthor:d,onOpenChange:t,onSave:y,isSaving:p.isPending,saveDisabled:!k,children:e.jsx("div",{className:"space-y-6 py-2 overflow-y-auto max-h-[460px]",children:tt.map(({key:b,label:h,placeholder:n})=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:h}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(z,{type:"url",placeholder:n,value:u[b],onChange:m=>v(j=>({...j,[b]:m.target.value})),onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),g(b))},className:"flex-1"}),e.jsxs(A,{onClick:()=>g(b),size:"sm",disabled:!u[b].trim(),children:[e.jsx(fe,{className:"w-4 h-4 mr-1"}),"Add"]})]}),o[b].length>0?e.jsx("div",{className:"space-y-2",children:o[b].map(m=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate flex-1",children:m}),e.jsx(A,{variant:"ghost",size:"sm",onClick:()=>f(b,m),className:"h-8 px-2 text-destructive hover:text-destructive",title:`Remove ${h.toLowerCase()} URL`,children:e.jsx(pe,{className:"w-4 h-4"})})]},m))}):e.jsxs("div",{className:"text-xs text-muted-foreground",children:["No ",h.toLowerCase()," linked yet."]})]},b))})})}const vs=["image/jpeg","image/png","image/webp","image/gif"],Ir=2*1024*1024;function Rr(t){return vs.includes(t.type)?t.size>Ir?Promise.reject(new Error("Logo must be 2 MB or smaller.")):new Promise((s,r)=>{const a=new FileReader;a.onload=()=>s({file_name:t.name,mime_type:t.type,data_url:String(a.result)}),a.onerror=()=>r(new Error("Could not read that logo.")),a.readAsDataURL(t)}):Promise.reject(new Error("Choose a JPEG, PNG, WebP, or GIF logo."))}function Ar({paperId:t,initialName:s,onApplied:r,onUnsentChange:a}){const[i,d]=x.useState(s),[o,l]=x.useState(""),[u,v]=x.useState(""),[p,c]=x.useState(null),[g,f]=x.useState(""),y=ae({mutationFn:()=>ds.submit(us(Number(t),"new_organization",{name:i.trim(),...o.trim()?{hf_slug:o.trim()}:{},...u.trim()?{website_url:u.trim()}:{},...p?{image:p}:{}})),onSuccess:b=>{b.status==="approved"&&r(i.trim())}}),k=!y.isSuccess&&!!(o.trim()||u.trim()||p);return x.useEffect(()=>a(k),[a,k]),x.useEffect(()=>()=>a(!1),[a]),y.isSuccess?e.jsxs("p",{className:"rounded border p-3 text-sm",children:['Thanks! "',i.trim(),'" was submitted for review. Once an admin approves it, the organization is created and added to this paper.']}):e.jsxs("form",{className:"space-y-2 rounded border p-3",onSubmit:b=>{b.preventDefault(),y.mutate()},children:[e.jsx("p",{className:"text-sm font-medium",children:"Suggest a new organization"}),e.jsx(z,{"aria-label":"Organization name",placeholder:"Name",value:i,maxLength:200,onChange:b=>d(b.target.value)}),e.jsx(z,{"aria-label":"Hugging Face organization",placeholder:"Hugging Face organization (e.g. https://huggingface.co/PrimeIntellect)",value:o,onChange:b=>l(b.target.value)}),e.jsx(z,{"aria-label":"Website",type:"url",placeholder:"Website (e.g. https://www.primeintellect.ai)",value:u,onChange:b=>v(b.target.value)}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Logo (optional)",e.jsx("input",{"aria-label":"Logo",type:"file",accept:vs.join(","),onChange:b=>{var n;const h=(n=b.target.files)==null?void 0:n[0];c(null),f(""),h&&Rr(h).then(c,m=>f(m.message))}})]}),p&&e.jsx("img",{src:p.data_url,alt:"Selected logo",className:"h-12 w-12 rounded border object-contain"}),g&&e.jsx("p",{className:"text-sm text-destructive",children:g}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"With a Hugging Face organization it is added right away; otherwise an admin reviews it."}),e.jsx(A,{type:"submit",variant:"outline",disabled:!i.trim()||!o.trim()&&!u.trim()||y.isPending,children:y.isPending?"Submitting...":"Submit organization"})]}),y.error&&e.jsx("p",{className:"text-sm text-destructive",children:gt(y.error,"Could not submit this organization.")})]})}const Lr=({onOpenChange:t,paperId:s,arxivId:r,initialOrganizationIds:a,submitMode:i="direct",isAuthor:d})=>{var n;const[o,l]=x.useState(a),[u,v]=x.useState(""),[p,c]=x.useState(!1),g=Z(),{toast:f}=J(),y=X({queryKey:["organizations","curation"],queryFn:()=>G.organizations(!1)}),k=x.useMemo(()=>{var S,E;const m=u.trim().toLocaleLowerCase();if(!m)return((S=y.data)==null?void 0:S.results)??[];const j=C=>C===m?0:C.startsWith(m)?1:C.split(/[^\p{L}\p{N}]+/u).some(I=>I.startsWith(m))?2:3;return(((E=y.data)==null?void 0:E.results)??[]).map(C=>({organization:C,name:C.name.toLocaleLowerCase()})).filter(({name:C})=>C.includes(m)).sort((C,I)=>j(C.name)-j(I.name)).map(({organization:C})=>C)},[(n=y.data)==null?void 0:n.results,u]),b=W({editType:"organizations",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"organization changes",noun:"organizations",failure:"Failed to update organizations."},toPendingPayload:m=>({organization_ids:m}),applyDirect:m=>B.updateOrganizations(s,m),onClose:()=>t(!1)}),h=()=>{a.some(m=>!o.includes(m))&&!window.confirm("Remove one or more organizations from this paper? Destructive edits may require a fresh sign-in.")||b.mutate(o)};return e.jsxs(V,{title:"Edit organizations",description:"Associate organizations with this paper. If one is missing, search for it and suggest it for review.",submitMode:i,isAuthor:d,onOpenChange:t,onSave:h,isSaving:b.isPending,saveDisabled:p,children:[e.jsxs("div",{className:"relative",children:[e.jsx(lt,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(z,{type:"search","aria-label":"Search organizations",placeholder:"Search organizations...",value:u,onChange:m=>v(m.target.value),className:"pl-9 pr-9"}),u&&e.jsx("button",{type:"button",onClick:()=>v(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear organization search",children:e.jsx(ss,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"max-h-80 space-y-2 overflow-auto",children:[k.map(m=>{const j=Number(m.id);return e.jsxs("label",{className:"flex items-center gap-2 rounded border p-2",children:[e.jsx("input",{type:"checkbox",checked:o.includes(j),onChange:S=>l(E=>S.target.checked?[...E,j]:E.filter(C=>C!==j))}),m.name]},m.id)}),!y.isLoading&&k.length===0&&e.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:u.trim()?`No organizations found matching "${u.trim()}"`:"No organizations available"})]}),!y.isLoading&&k.length===0&&u.trim()&&e.jsx(Ar,{paperId:s,initialName:u.trim(),onApplied:m=>{t(!1),f({title:"Organization added",description:`Added "${m}" to this paper.`}),ms(g,[s]),hs(g),g.invalidateQueries({queryKey:["organizations"]})},onUnsentChange:c},u.trim()),p&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Submit the organization above, or clear the search, before saving."})]})};function Tr({onOpenChange:t,paperId:s,arxivId:r,initialProjectPages:a,submitMode:i="direct",isAuthor:d=!1}){const[o,l]=x.useState(a),[u,v]=x.useState(""),p=W({editType:"project_pages",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"project page changes",noun:"project pages",failure:"Failed to update project pages."},toPendingPayload:h=>({project_pages:h}),applyDirect:h=>B.updateProjectPages(s,h),onClose:()=>t(!1)}),c=()=>{const h=u.trim();return h?o.some(n=>n.url===h)?(alert("This project page URL is already added"),null):[...o,{url:h,is_official:!1}]:o},g=()=>{const h=c();h!==null&&h.length!==o.length&&(l(h),v(""))},f=h=>{l(o.filter(n=>n.url!==h))},y=h=>{l(o.map(n=>n.url===h?{...n,is_official:!n.is_official}:n))},k=()=>{const h=c();h!==null&&(i==="direct"&&a.some(n=>!h.some(m=>m.url===n.url))&&!window.confirm("Remove one or more project pages from this paper?")||p.mutate(h))},b=x.useMemo(()=>{const h=u.trim(),n=h?[...o,{url:h,is_official:!1}]:o;if(n.length!==a.length)return!0;const m=new Map(a.map(j=>[j.url.trim(),!!j.is_official]));return n.some(j=>{const S=m.get(j.url.trim());return S===void 0||S!==!!j.is_official})},[o,u,a]);return e.jsxs(V,{title:"Edit Paper Project Pages",description:"Add or remove project page URLs (e.g. authors' demo or landing pages) associated with this paper. Mark pages as official if they are created by the paper authors.",className:"max-w-2xl max-h-[600px]",submitMode:i,isAuthor:d,onOpenChange:t,onSave:k,isSaving:p.isPending,saveDisabled:!b,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Add Project Page URL"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(z,{type:"url",placeholder:"https://example.com/project",value:u,onChange:h=>v(h.target.value),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),g())},className:"flex-1"}),e.jsxs(A,{onClick:g,size:"sm",disabled:!u.trim(),children:[e.jsx(fe,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[350px]",children:o.length>0?e.jsx("div",{className:"space-y-2",children:o.map((h,n)=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx(Ut,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate",children:h.url}),h.is_official&&e.jsx(ps,{variant:"secondary",className:"text-xs",children:"Official"})]})}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxs(A,{variant:h.is_official?"default":"outline",size:"sm",onClick:()=>y(h.url),className:"h-8 px-2 text-xs",title:h.is_official?"Click to unmark as official (created by paper authors)":"Click to mark as official (created by paper authors)",children:[e.jsx(gs,{className:`w-3.5 h-3.5 mr-1 ${h.is_official?"fill-current":""}`}),h.is_official?"Official":"Mark official"]}),e.jsx(A,{variant:"ghost",size:"sm",onClick:()=>f(h.url),className:"h-8 px-2 text-destructive hover:text-destructive",title:"Remove project page",children:e.jsx(pe,{className:"w-4 h-4"})})]})]},n))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Ut,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No project pages added yet"}),e.jsx("p",{className:"text-xs mt-1",children:"Add a project page URL above to get started"})]})})]})}function Dr({onOpenChange:t,paperId:s,arxivId:r,initialRepositories:a,submitMode:i="direct",isAuthor:d=!1}){const[o,l]=x.useState(a),[u,v]=x.useState(""),p=W({editType:"repositories",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"repository changes",noun:"repositories",failure:"Failed to update paper repositories."},toPendingPayload:n=>({repositories:n}),applyDirect:n=>B.updateRepositories(s,n),onClose:()=>t(!1)}),c=n=>{const m=[];for(const j of n){const S=m.find(E=>Ft(E.url,j.url));if(S)S.is_official=S.is_official||j.is_official;else{const E=He(j.url);m.push({url:E??j.url.trim(),is_official:j.is_official})}}return m},g=()=>{const n=u.trim(),m=n?[...o,{url:n,is_official:!1}]:o;return n&&o.some(j=>Ft(j.url,n))?(alert("This repository URL is already added"),null):c(m)},f=()=>{const n=g();n!==null&&n.length!==o.length&&(l(n),v(""))},y=n=>{l(o.filter(m=>m.url!==n))},k=n=>{l(o.map(m=>m.url===n?{...m,is_official:!m.is_official}:m))},b=()=>{const n=g();n!==null&&(i==="direct"&&a.some(m=>!n.some(j=>j.url===m.url))&&!window.confirm("Remove one or more repositories from this paper?")||p.mutate(n))},h=x.useMemo(()=>{const n=u.trim(),m=n?[...o,{url:n,is_official:!1}]:o;if(m.length!==a.length)return!0;const j=c(a),S=c(m);if(S.length!==j.length)return!0;const E=new Map(j.map(C=>[He(C.url)??C.url.trim(),!!C.is_official]));return S.some(C=>{const I=He(C.url)??C.url.trim(),L=E.get(I);return L===void 0||L!==!!C.is_official})},[o,u,a]);return e.jsxs(V,{title:"Edit Paper Repositories",description:"Add or remove GitHub repository URLs associated with this paper. Mark repositories as official if they are created by the paper authors.",className:"max-w-2xl max-h-[600px]",submitMode:i,isAuthor:d,onOpenChange:t,onSave:b,isSaving:p.isPending,saveDisabled:!h,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Add Repository URL"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(z,{type:"url",placeholder:"https://github.com/owner/repo",value:u,onChange:n=>v(n.target.value),onKeyPress:n=>{n.key==="Enter"&&(n.preventDefault(),f())},className:"flex-1"}),e.jsxs(A,{onClick:f,size:"sm",disabled:!u.trim(),children:[e.jsx(fe,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[350px]",children:o.length>0?e.jsx("div",{className:"space-y-2",children:o.map((n,m)=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx(Bt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{className:"text-sm font-medium text-paper-blue truncate",children:n.url}),n.is_official&&e.jsx(ps,{variant:"secondary",className:"text-xs",children:"Official"})]})}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsxs(A,{variant:n.is_official?"default":"outline",size:"sm",onClick:()=>k(n.url),className:"h-8 px-2 text-xs",title:n.is_official?"Click to unmark as official (created by paper authors)":"Click to mark as official (created by paper authors)",children:[e.jsx(gs,{className:`w-3.5 h-3.5 mr-1 ${n.is_official?"fill-current":""}`}),n.is_official?"Official":"Mark official"]}),e.jsx(A,{variant:"ghost",size:"sm",onClick:()=>y(n.url),className:"h-8 px-2 text-destructive hover:text-destructive",title:"Remove repository",children:e.jsx(pe,{className:"w-4 h-4"})})]})]},m))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Bt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No repositories added yet"}),e.jsx("p",{className:"text-xs mt-1",children:"Add a repository URL above to get started"})]})})]})}function Fr({onOpenChange:t,paperId:s,arxivId:r,initialUrl:a,submitMode:i="direct",isAuthor:d=!1}){const[o,l]=x.useState(a),u=W({editType:"source_url",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"source URL change",noun:"source URL",failure:"Failed to update source URL."},toPendingPayload:f=>({source_url:f}),applyDirect:f=>B.updateSourceUrl(s,f),onClose:()=>t(!1)}),v=o.trim(),p=/^https?:\/\//i.test(v),c=v!==(a||"").trim(),g=()=>{p&&u.mutate(v)};return e.jsx(V,{title:"Edit Source URL",description:'Update the canonical URL for this external paper. This is the page the "Source page" button links to. ArXiv papers cannot edit this field.',className:"max-w-2xl",submitMode:i,isAuthor:d,onOpenChange:t,onSave:g,isSaving:u.isPending,saveDisabled:!p||!c,children:e.jsxs("div",{className:"space-y-2 py-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Source URL"}),e.jsx(z,{type:"url",placeholder:"https://example.com/paper",value:o,onChange:f=>l(f.target.value),onKeyPress:f=>{f.key==="Enter"&&p&&c&&(f.preventDefault(),g())}}),!p&&v.length>0&&e.jsx("p",{className:"text-xs text-destructive",children:"URL must start with http:// or https://"})]})})}var De="Checkbox",[Ur]=xt(De),[Br,vt]=Ur(De);function zr(t){const{__scopeCheckbox:s,checked:r,children:a,defaultChecked:i,disabled:d,form:o,name:l,onCheckedChange:u,required:v,value:p="on",internal_do_not_use_render:c}=t,[g,f]=rs({prop:r,defaultProp:i??!1,onChange:u,caller:De}),[y,k]=x.useState(null),[b,h]=x.useState(null),n=x.useRef(!1),m=y?!!o||!!y.closest("form"):!0,j={checked:g,disabled:d,setChecked:f,control:y,setControl:k,name:l,form:o,value:p,hasConsumerStoppedPropagationRef:n,required:v,defaultChecked:Q(i)?!1:i,isFormControl:m,bubbleInput:b,setBubbleInput:h};return e.jsx(Br,{scope:s,...j,children:Mr(c)?c(j):a})}var ys="CheckboxTrigger",_s=x.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:r,...a},i)=>{const{control:d,value:o,disabled:l,checked:u,required:v,setControl:p,setChecked:c,hasConsumerStoppedPropagationRef:g,isFormControl:f,bubbleInput:y}=vt(ys,t),k=he(i,p),b=x.useRef(u);return x.useEffect(()=>{const h=d==null?void 0:d.form;if(h){const n=()=>c(b.current);return h.addEventListener("reset",n),()=>h.removeEventListener("reset",n)}},[d,c]),e.jsx(ee.button,{type:"button",role:"checkbox","aria-checked":Q(u)?"mixed":u,"aria-required":v,"data-state":Ss(u),"data-disabled":l?"":void 0,disabled:l,value:o,...a,ref:k,onKeyDown:ue(s,h=>{h.key==="Enter"&&h.preventDefault()}),onClick:ue(r,h=>{c(n=>Q(n)?!0:!n),y&&f&&(g.current=h.isPropagationStopped(),g.current||h.stopPropagation())})})});_s.displayName=ys;var yt=x.forwardRef((t,s)=>{const{__scopeCheckbox:r,name:a,checked:i,defaultChecked:d,required:o,disabled:l,value:u,onCheckedChange:v,form:p,...c}=t;return e.jsx(zr,{__scopeCheckbox:r,checked:i,defaultChecked:d,disabled:l,required:o,onCheckedChange:v,name:a,form:p,value:u,internal_do_not_use_render:({isFormControl:g})=>e.jsxs(e.Fragment,{children:[e.jsx(_s,{...c,ref:s,__scopeCheckbox:r}),g&&e.jsx(Cs,{__scopeCheckbox:r})]})})});yt.displayName=De;var ks="CheckboxIndicator",Ns=x.forwardRef((t,s)=>{const{__scopeCheckbox:r,forceMount:a,...i}=t,d=vt(ks,r);return e.jsx(as,{present:a||Q(d.checked)||d.checked===!0,children:e.jsx(ee.span,{"data-state":Ss(d.checked),"data-disabled":d.disabled?"":void 0,...i,ref:s,style:{pointerEvents:"none",...t.style}})})});Ns.displayName=ks;var ws="CheckboxBubbleInput",Cs=x.forwardRef(({__scopeCheckbox:t,...s},r)=>{const{control:a,hasConsumerStoppedPropagationRef:i,checked:d,defaultChecked:o,required:l,disabled:u,name:v,value:p,form:c,bubbleInput:g,setBubbleInput:f}=vt(ws,t),y=he(r,f),k=fs(d),b=ns(a);x.useEffect(()=>{const n=g;if(!n)return;const m=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(m,"checked").set,E=!i.current;if(k!==d&&S){const C=new Event("click",{bubbles:E});n.indeterminate=Q(d),S.call(n,Q(d)?!1:d),n.dispatchEvent(C)}},[g,k,d,i]);const h=x.useRef(Q(d)?!1:d);return e.jsx(ee.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??h.current,required:l,disabled:u,name:v,value:p,form:c,...s,tabIndex:-1,ref:y,style:{...s.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Cs.displayName=ws;function Mr(t){return typeof t=="function"}function Q(t){return t==="indeterminate"}function Ss(t){return Q(t)?"indeterminate":t?"checked":"unchecked"}const _t=x.forwardRef(({className:t,style:s,...r},a)=>e.jsx(yt,{ref:a,className:we("peer h-4 w-4 shrink-0 rounded-sm ring-offset-background data-[state=checked]:!bg-black data-[state=checked]:!text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),style:{border:"1px solid #000",...s},...r,children:e.jsx(Ns,{className:we("flex items-center justify-center text-current"),children:e.jsx(ft,{className:"h-4 w-4"})})}));_t.displayName=yt.displayName;const Hr=250,Or=100,qr={editType:"tasks",singular:"task",plural:"tasks",title:"Edit Paper Tasks",description:"Select the tasks that this paper addresses. You can select multiple tasks.",search:t=>G.listTasks(t),toPendingPayload:t=>({task_ids:t}),applyDirect:(t,s)=>B.updateTasks(t,s),patchPaper:(t,s)=>({...t,tasks:[...s].sort((r,a)=>r.name.localeCompare(a.name))})},Kr={editType:"methods",singular:"method",plural:"methods",title:"Edit Paper Methods",description:"Select the methods and techniques used in this paper. You can select multiple methods.",search:t=>G.listMethods(t),toPendingPayload:t=>({method_ids:t}),applyDirect:(t,s)=>B.updateMethods(t,s),subtitle:t=>t.full_name!==t.name?t.full_name:void 0},Gr=t=>t[0].toUpperCase()+t.slice(1),ye=t=>t.map(s=>Number(s.id));function Gt(t){return t.kind==="task"?e.jsx(Xt,{...t,tagKind:qr}):e.jsx(Xt,{...t,tagKind:Kr})}function Xt({tagKind:t,onOpenChange:s,paperId:r,arxivId:a,initialItems:i,submitMode:d="direct",isAuthor:o=!1}){const{singular:l,plural:u,patchPaper:v}=t,[p,c]=x.useState(i),[g,f]=x.useState(!1),[y,k]=x.useState(""),[b,h]=x.useState(""),n=Z(),{toast:m}=J();x.useEffect(()=>{const w=window.setTimeout(()=>{h(y.trim())},Hr);return()=>window.clearTimeout(w)},[y]);const{data:j,isFetching:S}=X({queryKey:[`${u}-search`,b],queryFn:()=>t.search({page_size:Or,...b?{q:b}:{}})}),E=W({editType:t.editType,paperId:r,arxivId:a,submitMode:d,messages:{proposal:`${l} changes`,noun:u,failure:`Failed to update paper ${u}.`},toPendingPayload:w=>t.toPendingPayload(ye(w)),applyDirect:w=>t.applyDirect(r,ye(w)),applyOptimistic:v&&(async w=>{const _=[...new Set([r,a].filter($=>!!$))].flatMap($=>[me.detail($),me.arxiv($)]);await Promise.all(_.map($=>n.cancelQueries({queryKey:$})));const R=_.map($=>({key:$,data:n.getQueryData($)}));return R.forEach(({key:$,data:D})=>{D&&n.setQueryData($,v(D,w))}),()=>R.forEach(({key:$,data:D})=>n.setQueryData($,D))}),onSaved:(w,{direct:_})=>{_&&m({title:`${Gr(u)} updated`,description:`Saved ${w.length} ${w.length===1?l:u} for this paper.`})},onClose:()=>s(!1)}),C=x.useMemo(()=>new Set(ye(p)),[p]),I=x.useMemo(()=>ye(i),[i]),L=x.useMemo(()=>{const w=(j==null?void 0:j.results)??[],_=b?[...w,...p]:[...p,...w];return _.filter((R,$)=>_.findIndex(({id:D})=>D===R.id)===$)},[j,p,b]),T=p.length!==I.length||I.some(w=>!C.has(w)),H=()=>{d==="direct"&&I.some(w=>!C.has(w))&&!window.confirm(`Remove one or more ${l} links from this paper?`)||E.mutate(p)},P=(w,_)=>{c(R=>_?R.some($=>$.id===w.id)?R:[...R,w]:R.filter($=>$.id!==w.id))};return e.jsxs(e.Fragment,{children:[e.jsxs(V,{title:t.title,description:t.description,className:"max-w-2xl max-h-[600px]",submitMode:d,isAuthor:o,onOpenChange:s,onSave:H,isSaving:E.isPending,saveDisabled:!T,footerStart:e.jsxs(A,{variant:"ghost",className:"sm:mr-auto",onClick:()=>f(!0),children:["Suggest a new ",l]}),children:[e.jsxs("div",{className:"relative mb-4",children:[e.jsx(lt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(z,{type:"text",placeholder:`Search ${u}...`,value:y,onChange:w=>k(w.target.value),className:"pl-9 pr-9"}),y&&e.jsx("button",{type:"button",onClick:()=>k(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear search",children:e.jsx(ss,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[400px]",children:L.length>0?e.jsx("div",{className:"space-y-2",children:L.map(w=>{var R;const _=(R=t.subtitle)==null?void 0:R.call(t,w);return e.jsxs("div",{className:"flex items-center space-x-2 p-2 hover:bg-muted/50 rounded-md",children:[e.jsx(_t,{id:`${l}-${w.id}`,checked:C.has(Number(w.id)),onCheckedChange:$=>P(w,$===!0),className:"!border !border-black data-[state=checked]:!bg-black data-[state=checked]:!text-white"}),e.jsxs("label",{htmlFor:`${l}-${w.id}`,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer flex-1",children:[w.name,_&&e.jsx("span",{className:"block text-xs text-muted-foreground font-normal",children:_}),w.description&&e.jsxs("span",{className:"block text-xs text-muted-foreground font-normal mt-1",children:[w.description.substring(0,100),w.description.length>100?"...":""]})]})]},w.id)})}):S?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(jt,{className:"w-8 h-8 mx-auto mb-2 animate-spin"}),e.jsxs("p",{children:["Loading ",u,"..."]})]}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(lt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:b?`No ${u} found matching "${b}"`:`No ${u} available`})]})})]}),e.jsx(cs,{open:g,onOpenChange:f,paperId:r,kind:l})]})}const Qt=10,Xr=/^https?:\/\/(?:www\.|mobile\.)?(?:x|twitter)\.com\/(?:[A-Za-z0-9_]{1,15}|i\/web|i)\/status(?:es)?\/(\d{1,25})(?:[/?#].*)?$/;function te(t){var s;return((s=Xr.exec(t.trim()))==null?void 0:s[1])??null}function Qr({onOpenChange:t,paperId:s,arxivId:r,initialUrls:a,submitMode:i="direct",isAuthor:d=!1}){const[o,l]=x.useState(a),[u,v]=x.useState(""),[p,c]=x.useState(null),g=W({editType:"x_threads",paperId:s,arxivId:r,submitMode:i,messages:{proposal:"X threads",noun:"X threads",failure:"Failed to update X threads."},toPendingPayload:n=>({x_threads:n}),applyDirect:n=>B.updateXThreads(s,n),onClose:()=>t(!1)}),f=()=>{const n=u.trim();if(!n)return o;const m=te(n);return m?o.some(j=>te(j)===m)?(c("This post is already listed."),null):o.length>=Qt?(c(`A paper can link at most ${Qt} X threads.`),null):[...o,n]:(c("Paste a post URL such as https://x.com/user/status/123…"),null)},y=()=>{const n=f();n!==null&&(l(n),v(""),c(null))},k=(n,m)=>{const j=[...o];[j[n],j[n+m]]=[j[n+m],j[n]],l(j)},b=()=>{const n=f();n!==null&&(i==="direct"&&a.some(m=>!n.some(j=>te(j)===te(m)))&&!window.confirm("Remove one or more X threads from this paper?")||g.mutate(n))},h=x.useMemo(()=>(u.trim()?[...o,u.trim()]:o).map(te).join()!==a.map(te).join(),[o,u,a]);return e.jsxs(V,{title:"Edit X threads",description:"Link posts on X (formerly Twitter) in which the authors introduce this paper. A preview of each post is shown on the paper page.",className:"max-w-2xl max-h-[600px]",submitMode:i,isAuthor:d,onOpenChange:t,onSave:b,isSaving:g.isPending,saveDisabled:!h,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",htmlFor:"x-thread-url",children:"Add X post URL"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(z,{id:"x-thread-url",type:"url",placeholder:"https://x.com/user/status/1234567890",value:u,onChange:n=>{v(n.target.value),c(null)},onKeyDown:n=>{n.key==="Enter"&&(n.preventDefault(),y())},"aria-invalid":!!p,className:"flex-1"}),e.jsxs(A,{onClick:y,size:"sm",disabled:!u.trim(),children:[e.jsx(fe,{className:"w-4 h-4 mr-1"}),"Add"]})]}),p&&e.jsx("p",{className:"text-xs text-destructive",children:p})]}),e.jsx("div",{className:"py-4 overflow-y-auto max-h-[350px]",children:o.length>0?e.jsx("div",{className:"space-y-2",children:o.map((n,m)=>e.jsxs("div",{className:"flex items-center space-x-2 p-3 bg-muted/30 rounded-lg",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate text-sm font-medium",children:n}),e.jsx(A,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m===0,onClick:()=>k(m,-1),"aria-label":"Move up",children:e.jsx(Wa,{className:"w-4 h-4"})}),e.jsx(A,{variant:"ghost",size:"sm",className:"h-8 px-2",disabled:m===o.length-1,onClick:()=>k(m,1),"aria-label":"Move down",children:e.jsx(Va,{className:"w-4 h-4"})}),e.jsx(A,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive",onClick:()=>l(o.filter(j=>j!==n)),"aria-label":"Remove X thread",children:e.jsx(pe,{className:"w-4 h-4"})})]},n))}):e.jsx("p",{className:"text-center py-8 text-sm text-muted-foreground",children:"No X threads linked yet"})})]})}function Vr({activeEditor:t,arxivId:s,editSubmitMode:r,evaluations:a,isAdmin:i,isLinkedAuthor:d,onOpenChange:o,paper:l}){if(!t)return null;const u={paperId:l.id,arxivId:s,submitMode:r,isAuthor:d,onOpenChange:c=>o(t,c)},v=c=>(c==null?void 0:c.map(({url:g,is_official:f})=>({url:g,is_official:!!f})))??[],p={tasks:()=>e.jsx(Gt,{...u,kind:"task",initialItems:l.tasks??[]}),methods:()=>e.jsx(Gt,{...u,kind:"method",initialItems:l.methods??[]}),repositories:()=>e.jsx(Dr,{...u,initialRepositories:v(l.repositories)}),project_pages:()=>e.jsx(Tr,{...u,initialProjectPages:v(l.project_pages)}),evaluations:()=>e.jsx(Er,{...u,initialEvaluations:a,paperTasks:l.tasks??[],isAdmin:i}),source_url:()=>e.jsx(Fr,{...u,initialUrl:l.source_url??l.url_abs??""}),hf_artifacts:()=>e.jsx($r,{...u,initialArtifacts:{hf_models:l.hf_models??[],hf_datasets:l.hf_datasets??[],hf_spaces:l.hf_spaces??[]}}),x_threads:()=>{var c;return e.jsx(Qr,{...u,initialUrls:((c=l.x_threads)==null?void 0:c.map(({url:g})=>g))??[]})},organizations:()=>e.jsx(Lr,{...u,initialOrganizationIds:(l.organizations??[]).map(({id:c})=>Number(c))})};return e.jsx(x.Fragment,{children:p[t]()},t)}const Wr={"add-evals":{trigger:"add evals",running:"adding evals…",complete:"add evals ✓",title:"Add evaluations with Codex",description:t=>e.jsxs(e.Fragment,{children:["Codex will run the repository’s add-evals skill for “",t,"”. It will import only paper-native results onto existing, metric-compatible leaderboards. Accepted rows are written directly to the live database."]}),notice:"Comparator rows, unknown benchmarks, and unconfigured metrics will be skipped. Jobs run one at a time in submission order.",progress:"Codex is researching the paper and validating results against the configured leaderboards.",action:"Run add-evals"},"enrich-paper":{trigger:"enrich paper",running:"enriching…",complete:"enriched ✓",title:"Enrich paper with Codex",description:t=>e.jsxs(e.Fragment,{children:["Codex will run the repository’s enrich-paper skill for “",t,"”. It will validate official code and project links, merge high-confidence taxonomy tags, and check the paper thumbnail. Accepted changes are written directly to the live database."]}),notice:"Uncertain URLs and missing taxonomy concepts will be reported rather than guessed. Jobs run one at a time in submission order.",progress:"Codex is validating artifacts, taxonomy tags, and thumbnail quality for this paper.",action:"Run enrich-paper"}},Vt=new Set(["queued","dispatching","running","awaiting_markdown"]);function Yr({report:t}){return e.jsx("div",{className:"min-w-0 max-h-[50vh] overflow-y-auto overflow-x-hidden rounded-md border bg-muted/40 p-4 text-sm leading-relaxed",children:e.jsx(Oa,{remarkPlugins:[qa],components:{a:({children:s,...r})=>e.jsx("a",{...r,className:"break-all underline underline-offset-2",target:"_blank",rel:"noreferrer",children:s}),p:({children:s})=>e.jsx("p",{className:"mb-3 break-words last:mb-0",children:s}),ul:({children:s})=>e.jsx("ul",{className:"mb-3 list-disc space-y-1 pl-5 last:mb-0",children:s}),ol:({children:s})=>e.jsx("ol",{className:"mb-3 list-decimal space-y-1 pl-5 last:mb-0",children:s}),h1:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),h2:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),h3:({children:s})=>e.jsx("h3",{className:"mb-2 font-semibold",children:s}),code:({children:s})=>e.jsx("code",{className:"break-all rounded bg-background/80 px-1 py-0.5 font-mono text-xs",children:s}),pre:({children:s})=>e.jsx("pre",{className:"mb-3 max-w-full overflow-x-auto whitespace-pre-wrap break-words rounded bg-background/80 p-3 font-mono text-xs last:mb-0",children:s})},children:t})})}function Es({kind:t,paperId:s,paperTitle:r,triggerClassName:a,onComplete:i}){var C;const d=Wr[t],o=Z(),[l,u]=x.useState(!1),[v,p]=x.useState(null),c=x.useRef(null),g=I=>["admin","codexPaperJob",t,I],f=X({queryKey:g(v),queryFn:()=>Oe.getPaperJob(t,v),enabled:v!==null,refetchInterval:I=>{var T;const L=(T=I.state.data)==null?void 0:T.status;return L==="awaiting_markdown"?6e4:L&&Vt.has(L)?2e3:!1},retry:!1}),y=I=>{o.setQueryData(g(I.id),I),p(I.id)},k=ae({mutationFn:()=>Oe.startPaperJob(t,s),onSuccess:y}),b=ae({mutationFn:I=>Oe.cancelPaperJob(t,I),onSuccess:y}),h=v?f.data:void 0,n=(h==null?void 0:h.status)==="awaiting_markdown",m=h?Vt.has(h.status):!1,j=f.errorUpdatedAt>f.dataUpdatedAt?f.error:null,S=(C=k.error??b.error??j)==null?void 0:C.message;x.useEffect(()=>{(h==null?void 0:h.status)!=="completed"||c.current===h.id||(c.current=h.id,i())},[h,i]);const E=()=>{p(null),k.reset(),b.reset(),c.current=null};return e.jsxs(Ie,{open:l,onOpenChange:u,children:[e.jsx("button",{type:"button",className:a,onClick:()=>u(!0),children:n?"waiting for Markdown…":m?d.running:(h==null?void 0:h.status)==="completed"?d.complete:d.trigger}),e.jsxs(Re,{className:"max-h-[90vh] w-[calc(100vw-2rem)] min-w-0 max-w-2xl overflow-hidden",children:[e.jsxs(Ae,{className:"min-w-0",children:[e.jsx(Le,{children:d.title}),e.jsx(Te,{children:d.description(r)})]}),h?e.jsxs("div",{className:"min-w-0 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"font-mono text-xs uppercase tracking-wide text-muted-foreground",children:["Status: ",h.status.replace("_"," ")]}),h.hf_job_url&&e.jsx("a",{className:"text-sm underline",href:h.hf_job_url,target:"_blank",rel:"noreferrer",children:"View Hugging Face Job"}),n&&e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 text-sm",children:[Ha," You can close this window and return."]}),m&&!n&&e.jsxs("div",{className:"rounded-md border bg-muted/40 p-3 text-sm",children:[h.status==="queued"?"This job is queued and will start after the current Codex job finishes.":d.progress," ","This can take several minutes; you can close this window and return."]}),h.report&&e.jsx(Yr,{report:h.report}),h.error&&!n&&e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:h.error})]}):e.jsx("div",{className:"rounded-md border bg-muted/40 p-3 text-sm text-muted-foreground",children:d.notice}),S&&e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:S}),e.jsxs(bt,{children:[e.jsx(A,{variant:"outline",onClick:()=>u(!1),children:m?"Close":"Cancel"}),m&&h&&e.jsx(A,{variant:"outline",onClick:()=>b.mutate(h.id),children:"Cancel job"}),!h&&e.jsx(A,{onClick:()=>k.mutate(),disabled:k.isPending,children:k.isPending?"Starting…":d.action}),h&&!m&&e.jsx(A,{variant:"outline",onClick:E,children:"Run again"})]})]})]})}function Ne({accent:t,id:s,label:r}){return e.jsxs("div",{className:"section-rule paper-section-anchor",id:s,children:[e.jsx("span",{children:e.jsx("a",{href:`#${s}`,className:"section-anchor-link",children:r})}),t]})}function Jr({canCopyBadge:t,canEdit:s,evaluationsByTask:r,evaluationsLoading:a,isAdmin:i,onCopyBadge:d,onEdit:o,onRefresh:l,paper:u,visibleEvaluationCount:v}){return e.jsxs(e.Fragment,{children:[e.jsx(Ne,{id:"results",label:"Results",accent:e.jsxs("span",{className:"accent",children:[v," benchmarks",t&&e.jsxs("button",{type:"button",className:"edit-link results-badge-copy",onClick:d,title:"Copy live leaderboard badges for your repository README",children:[e.jsx(U,{name:"copy",size:10})," Copy PwC badge"]}),i&&ea()&&e.jsx(Es,{kind:"add-evals",triggerClassName:"edit-link",paperId:Number(u.id),paperTitle:u.title,onComplete:l}),s&&e.jsx("button",{type:"button",onClick:o,className:"edit-link",children:"edit"})]})}),a?e.jsx(de,{className:"h-32 w-full"}):r.length>0?r.map(p=>e.jsxs("div",{className:p.taskSlug?"paper-section-anchor":void 0,id:p.taskSlug?bs(p.taskSlug):void 0,children:[e.jsxs("div",{className:"section-rule",children:[e.jsx("span",{children:p.taskSlug?e.jsxs(e.Fragment,{children:[e.jsx(K,{to:`/tasks/${p.taskSlug}`,children:p.taskName}),e.jsx("a",{href:dr(p.taskSlug),className:"section-anchor-link results-task-permalink","aria-label":`Permalink to ${p.taskName} results on this paper`,title:"Link to this task's results",children:"#"})]}):p.taskName}),e.jsxs("span",{className:"accent",children:[p.rows.length," ",p.rows.length===1?"result":"results"]})]}),e.jsxs("table",{className:"results-table",children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:"28%"}}),e.jsx("col",{style:{width:"28%"}}),e.jsx("col",{style:{width:"14%"}}),e.jsx("col",{style:{width:"12%"}}),e.jsx("col",{style:{width:"8%"}}),e.jsx("col",{style:{width:"10%"}})]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Benchmark"}),e.jsx("th",{children:"Model"}),e.jsx("th",{children:"Metric"}),e.jsx("th",{children:"Value"}),e.jsx("th",{children:"Rank"}),e.jsx("th",{children:"Compare"})]})}),e.jsx("tbody",{children:p.rows.map(c=>{var g;return e.jsxs("tr",{children:[e.jsx("td",{className:"benchmark",children:c.dataset_slug?e.jsx(K,{to:`/benchmark/${c.dataset_slug}`,children:c.dataset_name||"—"}):c.dataset_name||"—"}),e.jsxs("td",{className:"model",title:c.model_name||void 0,children:[c.hf_model_url?e.jsx("a",{href:c.hf_model_url,target:"_blank",rel:"noopener noreferrer",className:"model-hf-link",title:`Open ${c.model_name||"model"} on Hugging Face`,children:c.model_name||"—"}):c.model_name||"—",c.is_open===!1&&e.jsx(ya,{}),(c.external??c.is_external)&&e.jsx(_a,{sourceUrl:c.source_url||c.external_source_url||c.result_url})]}),e.jsx("td",{className:"metric",children:c.best_metric}),e.jsx("td",{className:"value",children:ta((g=c.metrics)==null?void 0:g[c.best_metric||""])}),e.jsx("td",{className:"rank",children:c.best_rank!=null?`#${c.best_rank}`:"—"}),e.jsx("td",{className:"compare",children:c.dataset_slug&&e.jsx(K,{to:`/benchmark/${c.dataset_slug}?${[c.task_slug?`task=${encodeURIComponent(c.task_slug)}`:"",`eval=${encodeURIComponent(c.id)}`].filter(Boolean).join("&")}`,children:"Compare →"})})]},c.id)})})]})]},p.taskId)):e.jsx("p",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-faint)"},children:"No benchmark results recorded yet."})]})}var kt="Radio",[Zr,Ps]=xt(kt),[en,tn]=Zr(kt),$s=x.forwardRef((t,s)=>{const{__scopeRadio:r,name:a,checked:i=!1,required:d,disabled:o,value:l="on",onCheck:u,form:v,...p}=t,[c,g]=x.useState(null),f=he(s,b=>g(b)),y=x.useRef(!1),k=c?v||!!c.closest("form"):!0;return e.jsxs(en,{scope:r,checked:i,disabled:o,children:[e.jsx(ee.button,{type:"button",role:"radio","aria-checked":i,"data-state":Ls(i),"data-disabled":o?"":void 0,disabled:o,value:l,...p,ref:f,onClick:ue(t.onClick,b=>{i||u==null||u(),k&&(y.current=b.isPropagationStopped(),y.current||b.stopPropagation())})}),k&&e.jsx(As,{control:c,bubbles:!y.current,name:a,value:l,checked:i,required:d,disabled:o,form:v,style:{transform:"translateX(-100%)"}})]})});$s.displayName=kt;var Is="RadioIndicator",Rs=x.forwardRef((t,s)=>{const{__scopeRadio:r,forceMount:a,...i}=t,d=tn(Is,r);return e.jsx(as,{present:a||d.checked,children:e.jsx(ee.span,{"data-state":Ls(d.checked),"data-disabled":d.disabled?"":void 0,...i,ref:s})})});Rs.displayName=Is;var sn="RadioBubbleInput",As=x.forwardRef(({__scopeRadio:t,control:s,checked:r,bubbles:a=!0,...i},d)=>{const o=x.useRef(null),l=he(o,d),u=fs(r),v=ns(s);return x.useEffect(()=>{const p=o.current;if(!p)return;const c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(u!==r&&f){const y=new Event("click",{bubbles:a});f.call(p,r),p.dispatchEvent(y)}},[u,r,a]),e.jsx(ee.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:l,style:{...i.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});As.displayName=sn;function Ls(t){return t?"checked":"unchecked"}var an=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Fe="RadioGroup",[rn]=xt(Fe,[is,Ps]),Ts=is(),Ds=Ps(),[nn,on]=rn(Fe),Fs=x.forwardRef((t,s)=>{const{__scopeRadioGroup:r,name:a,defaultValue:i,value:d,required:o=!1,disabled:l=!1,orientation:u,dir:v,loop:p=!0,onValueChange:c,...g}=t,f=Ts(r),y=sa(v),[k,b]=rs({prop:d,defaultProp:i??null,onChange:c,caller:Fe});return e.jsx(nn,{scope:r,name:a,required:o,disabled:l,value:k,onValueChange:b,children:e.jsx(aa,{asChild:!0,...f,orientation:u,dir:y,loop:p,children:e.jsx(ee.div,{role:"radiogroup","aria-required":o,"aria-orientation":u,"data-disabled":l?"":void 0,dir:y,...g,ref:s})})})});Fs.displayName=Fe;var Us="RadioGroupItem",Bs=x.forwardRef((t,s)=>{const{__scopeRadioGroup:r,disabled:a,...i}=t,d=on(Us,r),o=d.disabled||a,l=Ts(r),u=Ds(r),v=x.useRef(null),p=he(s,v),c=d.value===i.value,g=x.useRef(!1);return x.useEffect(()=>{const f=k=>{an.includes(k.key)&&(g.current=!0)},y=()=>g.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",y),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",y)}},[]),e.jsx(ra,{asChild:!0,...l,focusable:!o,active:c,children:e.jsx($s,{disabled:o,required:d.required,checked:c,...u,...i,name:d.name,ref:p,onCheck:()=>d.onValueChange(i.value),onKeyDown:ue(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:ue(i.onFocus,()=>{var f;g.current&&((f=v.current)==null||f.click())})})})});Bs.displayName=Us;var ln="RadioGroupIndicator",zs=x.forwardRef((t,s)=>{const{__scopeRadioGroup:r,...a}=t,i=Ds(r);return e.jsx(Rs,{...i,...a,ref:s})});zs.displayName=ln;var Ms=Fs,Hs=Bs,cn=zs;const ct=x.forwardRef(({className:t,...s},r)=>e.jsx(Ms,{className:we("grid gap-2",t),...s,ref:r}));ct.displayName=Ms.displayName;const ce=x.forwardRef(({className:t,...s},r)=>e.jsx(Hs,{ref:r,className:we("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(cn,{className:"flex items-center justify-center",children:e.jsx(na,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ce.displayName=Hs.displayName;const dn={pdf:"PDF",model:"Model",dataset:"Dataset",space:"Space",github:"GitHub"},dt=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,un=/^[A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*$/,mn=20,ut="copy_to_bucket";function hn(t){const s=t.trim();if(!un.test(s))return null;const[r,a]=s.split("/");return`https://huggingface.co/buckets/${encodeURIComponent(r)}/${encodeURIComponent(a)}`}function mt(t){return`pwc:bucket-copy:${t}`}function pn(t){if(typeof window>"u"||new URL(window.location.href).searchParams.get(ut)!==t)return null;try{const r=window.sessionStorage.getItem(mt(t));if(!r)return null;const a=JSON.parse(r);return a.paperId!==t||typeof a.bucketId!="string"||!["new","existing"].includes(a.destinationMode)||!["public","private"].includes(a.visibility)||!Array.isArray(a.selectedIds)||a.selectedIds.some(i=>typeof i!="string")?null:a}catch{return null}}function fn(t,s=mn){if(s<1)throw new Error("Bucket copy batch size must be positive");const r=[];for(let a=0;a!dt.test(u)))return null;const o=d.join("/"),l=s==="model"?"":`${s}s/`;return{id:`${s}:${o}`,kind:s,label:o,url:`https://huggingface.co/${l}${o}`,source:`hf://${l}${o}/`,destination:`${s}s/${o}/`,repoId:o}}catch{return null}}function gn(t){try{const s=new URL(t);if(s.hostname!=="github.com"&&s.hostname!=="www.github.com")return null;const r=s.pathname.split("/").filter(Boolean);if(r.length<2)return null;const a=r[0],i=r[1].replace(/\.git$/,"");if(!dt.test(a)||!dt.test(i))return null;const d=`${a}/${i}`;return{id:`github:${d}`,kind:"github",label:d,url:`https://github.com/${d}`,source:`https://github.com/${d}.git`,destination:`github/${d}/`}}catch{return null}}function xn({githubUrls:t,hfModelUrls:s,hfDatasetUrls:r,hfSpaceUrls:a,paperId:i,pdfName:d,pdfUrl:o}){const l=[o?{id:"pdf",kind:"pdf",label:"Paper PDF",url:o,source:o,destination:`paper/${d||i}.pdf`}:null,...s.map(v=>at(v,"model")),...r.map(v=>at(v,"dataset")),...a.map(v=>at(v,"space")),...t.map(gn)],u=new Set;return l.filter(v=>!v||u.has(v.id)?!1:(u.add(v.id),!0))}function bn(t,s,r){const a=["# Requires the Hugging Face CLI: https://huggingface.co/docs/huggingface_hub/guides/cli",`HF_BUCKET=${_e(t.trim())}`];r.create&&a.push(`hf buckets create "$HF_BUCKET" --exist-ok${r.isPrivate?" --private":""}`);for(const o of s.filter(l=>l.kind!=="github"&&l.kind!=="pdf"))a.push(`hf cp ${_e(o.source)} "hf://buckets/$HF_BUCKET/${o.destination}"`);const i=s.find(o=>o.kind==="pdf");i&&a.push('PWC_PDF="$(mktemp)"',`trap 'rm -f "$PWC_PDF"' EXIT`,`curl --fail --location ${_e(i.source)} --output "$PWC_PDF"`,`hf cp "$PWC_PDF" "hf://buckets/$HF_BUCKET/${i.destination}"`);const d=s.filter(o=>o.kind==="github");if(d.length){a.push('PWC_COPY_DIR="$(mktemp -d)"',`trap 'rm -rf "$PWC_COPY_DIR"' EXIT`);for(const o of d){const l=`$PWC_COPY_DIR/${o.destination.replace(/\/$/,"")}`;a.push(`git clone --depth 1 -- ${_e(o.source)} "${l}"`,`hf sync "${l}" "hf://buckets/$HF_BUCKET/${o.destination}" --exclude '.git/**'`)}}return a.join(` -`)}function jn(t){return`${(t.split(/[:|–—]/,1)[0]||t).normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/g,"")||"paper"}-artifacts`}function vn(t){const{toast:s}=J(),r=x.useMemo(()=>xn({githubUrls:t.githubUrls,hfDatasetUrls:t.hfDatasetUrls,hfModelUrls:t.hfModelUrls,hfSpaceUrls:t.hfSpaceUrls,paperId:t.paperId,pdfName:t.pdfName,pdfUrl:t.pdfUrl}),[t.githubUrls,t.hfDatasetUrls,t.hfModelUrls,t.hfSpaceUrls,t.paperId,t.pdfName,t.pdfUrl]),a=x.useMemo(()=>pn(t.paperId),[t.paperId]),[i,d]=x.useState(!!a),[o,l]=x.useState((a==null?void 0:a.destinationMode)??"new"),[u,v]=x.useState((a==null?void 0:a.bucketId)??""),[p,c]=x.useState((a==null?void 0:a.visibility)??"public"),[g,f]=x.useState(()=>new Set((a==null?void 0:a.selectedIds)??r.map(_=>_.id))),[y,k]=x.useState(!1),[b,h]=x.useState(null),[n,m]=x.useState(!!a),j=r.filter(_=>g.has(_.id)),S=j.length===r.length,E=hn(u),C=E!==null,I=bn(u,j,{create:o==="new",isPrivate:p==="private"}),L=(_,R)=>{f($=>{const D=new Set($);return R?D.add(_):D.delete(_),D})},T=async()=>{try{await navigator.clipboard.writeText(I),s({title:"Bucket copy commands copied",description:"Run them in a terminal where the Hugging Face CLI is signed in."})}catch{s({title:"Copy failed",description:"Could not access the clipboard. Select and copy the commands manually.",variant:"destructive"})}},H=x.useCallback(()=>{const _=new URL(window.location.href);_.searchParams.set(ut,t.paperId),window.sessionStorage.setItem(mt(t.paperId),JSON.stringify({paperId:t.paperId,bucketId:u.trim(),destinationMode:o,visibility:p,selectedIds:Array.from(g)})),window.location.assign(ia(_.toString(),{authorizeBucket:!0,bucketCreate:o==="new"}))},[u,o,t.paperId,g,p]),P=x.useCallback(async()=>{if(!t.isSignedIn){H();return}k(!0);let _=0,R=0;try{const $=j.filter(M=>M.kind!=="pdf"&&M.kind!=="github"&&!!M.repoId).map(M=>({kind:M.kind,repo_id:M.repoId})),D=fn($);D.length||D.push([]);for(const[M,ge]of D.entries()){h({current:M+1,total:D.length});const xe=await B.copyToBucket(t.paperId,{bucket_id:u.trim(),create:M===0&&o==="new",private:p==="private",include_pdf:M===0&&j.some(Ue=>Ue.kind==="pdf"),artifacts:ge});_+=xe.copied.length,R+=xe.errors.length}const re=j.filter(M=>M.kind==="github").length;s({title:R?"Bucket copy partially completed":"Copied to bucket",description:[`${_} item${_===1?"":"s"} copied.`,R?`${R} item${R===1?"":"s"} failed.`:"",re?"Use the generated commands below to copy GitHub repositories.":""].filter(Boolean).join(" "),variant:R?"destructive":void 0,action:E?e.jsx(oa,{altText:"Open destination bucket",asChild:!0,children:e.jsx("a",{href:E,target:"_blank",rel:"noopener noreferrer",children:"Open bucket"})}):void 0}),!R&&!re&&d(!1)}catch($){if($ instanceof Ce&&$.code==="bucket_authorization_required"){H();return}s({title:_?"Bucket copy partially completed":"Bucket copy failed",description:_?`${_} item${_===1?"":"s"} copied before the request failed. You can retry or use the CLI commands below.`:$ instanceof Ce&&typeof $.detail=="string"?$.detail:"Hugging Face could not complete the copy. You can still use the CLI commands below.",variant:"destructive"})}finally{k(!1),h(null)}},[H,u,E,o,t.isSignedIn,t.paperId,j,s,p]);x.useEffect(()=>{if(!n||!t.isSignedIn)return;m(!1),window.sessionStorage.removeItem(mt(t.paperId));const _=new URL(window.location.href);_.searchParams.delete(ut),window.history.replaceState({},"",`${_.pathname}${_.search}${_.hash}`),P()},[P,t.isSignedIn,t.paperId,n]);const w=()=>{f(new Set(r.map(_=>_.id))),!u&&t.suggestedBucketId&&v(t.suggestedBucketId),d(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"sidebar-card copy-to-bucket-card",children:[e.jsxs("button",{type:"button",className:"copy-to-bucket-trigger",onClick:w,children:[e.jsx("span",{className:"copy-to-bucket-arrow","aria-hidden":"true",children:"→"}),e.jsx("span",{className:"copy-to-bucket-title",children:"Copy to bucket"}),e.jsx("span",{className:"copy-to-bucket-new",children:"New"})]}),e.jsx("div",{className:"copy-to-bucket-meta",children:r.length?`${r.length} linked artifact${r.length===1?"":"s"}`:"No linked artifacts yet"})]}),e.jsx(Ie,{open:i,onOpenChange:d,children:e.jsxs(Re,{className:"max-h-[90vh] max-w-2xl grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden",children:[e.jsxs(Ae,{children:[e.jsxs(Le,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"copy-to-bucket-dialog-arrow","aria-hidden":"true",children:"→"}),"Copy to bucket"]}),e.jsx(Te,{children:"Keep your own copy of this paper's PDF, linked code, and Hugging Face artifacts. Hub repositories use Xet's server-side copy; GitHub repositories use the generated CLI fallback."})]}),e.jsx("div",{className:"-mx-6 min-h-0 overflow-y-auto px-6",children:r.length?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{children:"Choose your destination"}),e.jsxs(ct,{value:o,onValueChange:_=>l(_),className:"grid grid-cols-2 gap-2",children:[e.jsxs(O,{className:"bucket-choice",children:[e.jsx(ce,{value:"new"}),"New bucket"]}),e.jsxs(O,{className:"bucket-choice",children:[e.jsx(ce,{value:"existing"}),"Existing bucket"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"bucket-id",children:"Bucket name"}),e.jsx(z,{id:"bucket-id",value:u,onChange:_=>v(_.target.value),placeholder:t.suggestedBucketId||"username/paper-artifacts","aria-invalid":u.length>0&&!C}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[e.jsx("p",{className:"text-muted-foreground",children:"Use the full Hugging Face bucket ID: namespace/name."}),E&&e.jsxs("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 underline underline-offset-4",children:["View bucket",e.jsx(U,{name:"external",size:10})]})]})]}),o==="new"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{children:"Bucket visibility"}),e.jsxs(ct,{value:p,onValueChange:_=>c(_),className:"flex gap-5",children:[e.jsxs(O,{className:"flex items-center gap-2 font-normal",children:[e.jsx(ce,{value:"public"}),"Public"]}),e.jsxs(O,{className:"flex items-center gap-2 font-normal",children:[e.jsx(ce,{value:"private"}),"Private"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(O,{children:"Artifacts"}),e.jsx(A,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>f(S?new Set:new Set(r.map(_=>_.id))),children:S?"Deselect all":"Select all"})]}),e.jsx("div",{className:"bucket-artifact-list",children:r.map(_=>e.jsxs("div",{className:"bucket-artifact-row",children:[e.jsx(_t,{id:`bucket-artifact-${_.id}`,checked:g.has(_.id),onCheckedChange:R=>L(_.id,R===!0)}),e.jsxs(O,{htmlFor:`bucket-artifact-${_.id}`,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[e.jsx("span",{className:"bucket-artifact-kind",children:dn[_.kind]}),e.jsx("span",{className:"bucket-artifact-name",children:_.label})]}),e.jsxs("a",{href:Y(_.url)??void 0,target:"_blank",rel:"noopener noreferrer",className:"bucket-artifact-open",children:["Open",e.jsx(U,{name:"external",size:10})]})]},_.id))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The PDF and Hugging Face artifacts can be copied directly. GitHub repositories require the CLI workflow below."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"bucket-copy-commands",children:"CLI fallback"}),e.jsx("pre",{id:"bucket-copy-commands",className:"bucket-copy-commands h-[190px]",children:C?I:"Enter a bucket name above to prepare the copy commands."})]})]}):e.jsx("p",{className:"py-5 text-sm text-muted-foreground",children:"This paper does not have a linked GitHub repository or Hugging Face artifact to copy yet."})}),e.jsxs(bt,{children:[e.jsx("a",{href:"https://huggingface.co/docs/huggingface_hub/en/guides/buckets",target:"_blank",rel:"noopener noreferrer",className:"mr-auto text-sm text-muted-foreground underline underline-offset-4",children:"About Hugging Face Buckets"}),e.jsxs(A,{type:"button",onClick:T,variant:"outline",disabled:!C||j.length===0,children:[e.jsx(U,{name:"copy",size:12}),"Copy commands"]}),e.jsx(A,{type:"button",onClick:P,disabled:y||t.isSignedIn&&(!C||!j.some(_=>_.kind!=="github")),children:y?b&&b.total>1?`Copying ${b.current}/${b.total}…`:"Copying…":t.isSignedIn?"Copy now":"Sign in & copy"})]})]})})]})}function yn({isLoading:t,papers:s}){return t?e.jsxs("div",{className:"sidebar-card","aria-busy":"true",children:[e.jsx("div",{className:"sidebar-card-title",children:"Related papers"}),e.jsx("div",{className:"related-meta",children:"Finding related work…"})]}):s!=null&&s.length?e.jsxs("div",{className:"sidebar-card",children:[e.jsx("div",{className:"sidebar-card-title",children:"Related papers"}),s.map(r=>e.jsxs(K,{to:`/paper/${r.arxiv_id||r.id}`,target:"_blank",rel:"noopener noreferrer",className:"related-paper",style:{textDecoration:"none",color:"inherit"},children:[e.jsx("div",{className:"related-title",children:e.jsx(ke,{title:r.title})}),e.jsxs("div",{className:"related-meta",children:[e.jsx("span",{children:r.arxiv_id?`arXiv:${r.arxiv_id}`:"External resource"}),r.citation_count!=null&&e.jsxs("span",{children:[r.citation_count.toLocaleString()," cites"]})]})]},r.id))]}):null}const _n=/(https?:\/\/[^\s]+)/g;function kn({size:t=12}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:e.jsx("path",{fill:"currentColor",d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}function Wt(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Nn(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function wn({text:t}){return e.jsx("p",{className:"x-thread-text",children:t.split(_n).map((s,r)=>r%2===1?e.jsx("span",{className:"x-thread-link",children:s.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")},r):e.jsx(x.Fragment,{children:s},r))})}function Cn({thread:t}){const[s,r]=x.useState(!1);return!t.author_avatar_url||s?e.jsx("span",{className:"x-thread-avatar x-thread-avatar--fallback","aria-hidden":"true",children:t.author_name.charAt(0).toUpperCase()}):e.jsx("img",{className:"x-thread-avatar",src:t.author_avatar_url,alt:"",loading:"lazy",referrerPolicy:"no-referrer",onError:()=>r(!0)})}function Sn(){var t;return((t=window.matchMedia)==null?void 0:t.call(window,"(prefers-reduced-motion: reduce)").matches)??!1}function En({thread:t}){const[s,r]=x.useState(!1),[a,i]=x.useState(null),[d,o]=x.useState(!1),l=x.useRef(null),{targetRef:u,isIntersecting:v}=Ka({rootMargin:"200px"}),p=t.video_url;if(x.useEffect(()=>{if(!p||a||d||!v||Sn())return;const g=new AbortController;return fetch(p,{referrerPolicy:"no-referrer",signal:g.signal}).then(f=>{if(!f.ok)throw new Error(`HTTP ${f.status}`);return f.blob()}).then(f=>i(URL.createObjectURL(f))).catch(()=>{g.signal.aborted||o(!0)}),()=>g.abort()},[p,a,d,v]),x.useEffect(()=>()=>{a&&URL.revokeObjectURL(a)},[a]),x.useEffect(()=>{const g=l.current;g&&(v?g.play().catch(()=>{}):g.pause())},[v,a]),!t.media_url||s)return null;const c=a&&!d;return e.jsx("div",{className:"x-thread-media",ref:u,children:c?e.jsx("video",{ref:l,src:a,poster:t.media_url,muted:!0,loop:!0,playsInline:!0,autoPlay:!0,"aria-label":"Video",onError:()=>o(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:t.media_url,alt:"",loading:"lazy",referrerPolicy:"no-referrer",onError:()=>r(!0)}),t.media_type==="video"&&e.jsx("span",{className:"x-thread-play","aria-label":"Video",children:"▶"})]})})}function Pn({thread:t}){const s=Y(t.url);return s?e.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"x-thread",children:[e.jsxs("div",{className:"x-thread-header",children:[e.jsx(Cn,{thread:t}),e.jsxs("span",{className:"x-thread-author",children:[e.jsx("span",{className:"x-thread-name",children:t.author_name}),e.jsxs("span",{className:"x-thread-handle",children:["@",t.author_handle]})]}),e.jsx("span",{className:"x-thread-logo",children:e.jsx(kn,{})})]}),e.jsx(wn,{text:t.text}),e.jsx(En,{thread:t}),e.jsxs("div",{className:"x-thread-meta",children:[t.posted_at&&e.jsx("time",{dateTime:t.posted_at,children:Nn(t.posted_at)}),t.like_count!=null&&e.jsxs("span",{children:["♥ ",Wt(t.like_count)]}),t.reply_count!=null&&t.reply_count>0&&e.jsxs("span",{children:[Wt(t.reply_count)," ",t.reply_count===1?"reply":"replies"]}),e.jsx("span",{className:"x-thread-read",children:"Read on X →"})]})]}):null}function $n({onEdit:t,threads:s}){return e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[e.jsx("span",{children:"X threads"}),e.jsxs("span",{className:"badge",children:[s.length," post",s.length===1?"":"s",e.jsx("button",{type:"button",onClick:t,className:"edit-link",children:"edit"})]})]}),s.length>0?e.jsx("div",{className:"x-thread-list",children:s.map(r=>e.jsx(Pn,{thread:r},r.tweet_id))}):e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",padding:"6px 0"},children:"No author threads linked yet."})]})}const rt=3,Yt=3;function In(t){return t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Rn({allHfArtifactUrls:t,citationCopied:s,citationDisplay:r,hfArtifactViewer:a,onCopyCitation:i,onEditHfArtifacts:d,onEditRepositories:o,onEditXThreads:l,paper:u,relatedIsLoading:v,relatedPapers:p,user:c}){var b;const[g,f]=x.useState(!1),y=[...u.repositories??[]].sort((h,n)=>Number(n.is_official)-Number(h.is_official)||(n.num_stars||0)-(h.num_stars||0)),k=(g?y:y.slice(0,rt)).map(h=>({...h,safeHref:Y(h.url)}));return e.jsxs("aside",{className:"detail-sidebar",children:[e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[e.jsx("span",{children:"GitHub"}),e.jsxs("span",{className:"badge",children:[y.length," repo",y.length===1?"":"s",e.jsx("button",{type:"button",onClick:o,className:"edit-link",children:"edit"})]})]}),k.filter(({safeHref:h})=>h).map(h=>e.jsxs("a",{href:h.safeHref??void 0,target:"_blank",rel:"noopener noreferrer",className:"code-line",style:{textDecoration:"none"},children:[e.jsxs("span",{className:"code-line-repo",children:[e.jsx(U,{name:"github",size:12}),e.jsxs("span",{className:"code-line-repo-name",children:[h.owner,"/",h.name]}),h.is_official&&e.jsx("span",{className:"code-line-official",children:"· Official"})]}),e.jsxs("span",{className:"code-line-stars",children:["★ ",In(h.num_stars)]})]},h.id)),y.length===0&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--ink-faint)",padding:"6px 0"},children:"No GitHub repositories linked yet."}),y.length>rt&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>f(h=>!h),children:g?"− show top 3":`+ show ${y.length-rt} more repos`})]}),e.jsx(An,{viewer:a,onEdit:d}),e.jsx($n,{threads:u.x_threads??[],onEdit:l}),e.jsx(vn,{githubUrls:y.map(({url:h})=>h),hfModelUrls:t.models,hfDatasetUrls:t.datasets,hfSpaceUrls:t.spaces,paperId:u.id,pdfName:((b=u.arxiv_id)==null?void 0:b.replace("/","-"))||u.id,pdfUrl:u.url_pdf,isSignedIn:!!c,suggestedBucketId:c?`${c.username}/${jn(u.title)}`:void 0}),e.jsx(yn,{isLoading:v,papers:p}),e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[e.jsx("span",{children:"Citation"}),e.jsxs("button",{type:"button",className:"citation-copy-btn",onClick:i,"aria-label":"Copy citation to clipboard",title:"Copy citation to clipboard",children:[e.jsx(U,{name:"copy",size:11}),s?"Copied":"Copy"]})]}),e.jsx("pre",{style:{fontFamily:"var(--mono)",fontSize:10.5,lineHeight:1.5,color:"var(--ink-soft)",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},children:r})]})]})}function An({onEdit:t,viewer:s}){return e.jsxs("div",{className:"sidebar-card",children:[e.jsxs("div",{className:"sidebar-card-title",children:[s.paperHref?e.jsx("a",{href:s.paperHref,target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"none"},children:"🤗 Hugging Face"}):e.jsx("span",{children:"🤗 Hugging Face"}),e.jsx("button",{type:"button",onClick:t,className:"edit-link",children:"edit"})]}),s.isLoading?e.jsx(de,{className:"h-16 w-full"}):e.jsxs(e.Fragment,{children:[s.rows.map(r=>e.jsx(Ln,{...r},r.label)),s.footer&&e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--ink-faint)",marginTop:12},children:s.footer})]})]})}function Ln({count:t,href:s,isLimited:r,label:a,links:i}){const[d,o]=x.useState(!1),l=((i==null?void 0:i.length)??0)>Yt,u=d?i:i==null?void 0:i.slice(0,Yt),v=t!=null?`${t}${r?"+":""}`:"—";return e.jsxs("div",{className:"hf-artifact-row",children:[e.jsxs("div",{className:"hf-artifact-row-header",children:[e.jsx("span",{children:a}),t?e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"hf-artifact-count",children:v}):e.jsx("span",{className:"hf-artifact-count hf-artifact-count--empty",children:v})]}),u!=null&&u.length?e.jsxs("div",{className:"hf-artifact-links",children:[u.map(p=>e.jsx("a",{href:p.href,target:"_blank",rel:"noopener noreferrer",children:p.label},p.href)),l&&e.jsx("button",{type:"button",className:"hf-artifact-toggle","aria-expanded":d,onClick:()=>o(p=>!p),children:d?"Show fewer":`View all ${i.length}`})]}):null]})}function Tn({abstract:t,mentions:s}){const r=[];let a=0;for(const i of[...s].sort((d,o)=>d.start-o.start))i.startt.length||t.slice(i.start,i.end)===i.surface&&(r.push(e.jsx(ot,{text:t.slice(a,i.start)},`t${a}`)),r.push(e.jsx(Ua,{entity:{kind:i.entity_type,slug:i.slug},className:"abstract-entity-link",newTab:!1,initialPreview:i.preview?{name:i.preview.name,description:i.preview.description??null,imageUrl:i.preview.image_url??null,count:i.preview.count??null,detail:i.preview.detail??null}:void 0,children:i.surface},`m${i.start}`)),a=i.end);return r.push(e.jsx(ot,{text:t.slice(a)},`t${a}`)),e.jsx(e.Fragment,{children:r})}function Dn(t,s){const r=t.arxiv_id?` (arXiv:${Ee(t.arxiv_id)})`:"";return`About the paper "${t.title}"${r}: ${s}`}function Fn({paper:t,readerChatRoute:s}){const r=la()&&!!(t.id&&t.abstract),a=t.suggested_questions,{data:i}=X({queryKey:["paper-suggested-questions",t.id],queryFn:()=>B.suggestedQuestions(String(t.id)),enabled:r&&Array.isArray(a)&&a.length===0,staleTime:o=>{var l;return(l=o.state.data)!=null&&l.questions.length?1/0:0},retry:!1}),d=a!=null&&a.length?a:(i==null?void 0:i.questions)??[];return!r||d.length===0?null:e.jsx("ul",{className:"suggested-questions","aria-label":"Ask about this paper",children:d.map(o=>{const l=s?`${s}?q=${encodeURIComponent(o)}`:`/chat?q=${encodeURIComponent(Dn(t,o))}`;return e.jsx("li",{children:e.jsxs(K,{className:"suggested-question",to:l,onClick:s?()=>ls(s):void 0,children:[e.jsx(U,{name:"chat",size:12}),e.jsx("span",{children:o})]})},o)})})}function Un({canEdit:t,onEditMethods:s,onEditTasks:r,paper:a,readerChatRoute:i}){var l,u,v;const d=a.abstract||"",[o]=x.useState(()=>window.location.hash==="#tldr");return e.jsxs(e.Fragment,{children:[e.jsx(Ne,{id:"abstract",label:"Abstract"}),e.jsx("p",{className:"abstract-text",children:(l=a.abstract_mentions)!=null&&l.length?e.jsx(Tn,{abstract:d,mentions:a.abstract_mentions}):e.jsx(ot,{text:d})}),a.tldr&&e.jsxs("details",{className:"tldr-details paper-section-anchor",id:"tldr",open:o,children:[e.jsxs("summary",{children:[e.jsx("span",{className:"tldr-toggle-show",children:"Show TL;DR"}),e.jsx("span",{className:"tldr-toggle-hide",children:"Hide TL;DR"}),e.jsx("span",{className:"tldr-toggle-hint",children:"short summary"})]}),e.jsx("div",{className:"tldr-box",children:a.tldr})]}),e.jsx(Fn,{paper:a,readerChatRoute:i}),e.jsx(Ne,{id:"tasks",label:"Tasks",accent:e.jsxs("span",{className:"accent",children:[((u=a.tasks)==null?void 0:u.length)||0," tagged",t&&e.jsx("button",{type:"button",onClick:r,className:"edit-link",children:"edit"})]})}),e.jsx("div",{className:"paper-tags",style:{marginBottom:8},children:(a.tasks??[]).map(p=>e.jsx(xa,{slug:p.slug||"",label:p.name},p.id))}),e.jsx(Ne,{id:"methods",label:"Methods",accent:e.jsxs("span",{className:"accent",children:[((v=a.methods)==null?void 0:v.length)||0," used",t&&e.jsx("button",{type:"button",onClick:s,className:"edit-link",children:"edit"})]})}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:8},children:(a.methods??[]).map(p=>e.jsx(ba,{method:p},p.id))})]})}const se=["my-bookmark-ids"],ht="pwc:pending-bookmark";function Jt(t){window.sessionStorage.setItem(ht,JSON.stringify(t)),window.location.assign(Ga(!0))}function Bn(){var a,i;const{user:t}=Pe(),s=X({queryKey:se,queryFn:()=>it.getBookmarkIds(),enabled:!!t,staleTime:60*1e3,refetchOnWindowFocus:!1}),r=Se.useMemo(()=>{var d;return new Set(((d=s.data)==null?void 0:d.paper_ids)??[])},[(a=s.data)==null?void 0:a.paper_ids]);return{ids:((i=s.data)==null?void 0:i.paper_ids)??[],idSet:r,isLoading:s.isLoading,isError:s.isError}}function zn(){const{user:t}=Pe(),s=Z(),r=ae({mutationFn:async({paperId:i,isBookmarked:d})=>{d?await it.removeBookmark(i):await it.addBookmark(i)},onMutate:async({paperId:i,isBookmarked:d})=>{await s.cancelQueries({queryKey:se});const o=s.getQueryData(se),l=typeof i=="string"?Number(i):i,u=(o==null?void 0:o.paper_ids)??[],v=d?u.filter(p=>p!==l):[l,...u.filter(p=>p!==l)];return s.setQueryData(se,{paper_ids:v}),{previous:o}},onError:(i,d,o)=>{o!=null&&o.previous&&s.setQueryData(se,o.previous),i instanceof Ce&&i.code==="saved_papers_bucket_authorization_required"&&Jt(d)},onSettled:()=>{s.invalidateQueries({queryKey:se}),s.invalidateQueries({queryKey:[...me.feeds.saved]})}});return Se.useEffect(()=>{if(!t||r.isPending)return;const i=new URL(window.location.href);if(i.searchParams.get(zt)!=="1")return;i.searchParams.delete(zt),window.history.replaceState({},"",`${i.pathname}${i.search}${i.hash}`);const d=window.sessionStorage.getItem(ht);if(d){window.sessionStorage.removeItem(ht);try{const o=JSON.parse(d);(typeof o.paperId=="number"||typeof o.paperId=="string")&&typeof o.isBookmarked=="boolean"&&r.mutate(o)}catch{}}},[r,t]),{toggle:Se.useCallback((i,d)=>{if(!t){if(os())return;Jt({paperId:i,isBookmarked:d});return}r.mutate({paperId:i,isBookmarked:d})},[r,t]),isPending:r.isPending}}const Mn=({paperId:t})=>{const{user:s}=Pe(),{idSet:r}=Bn(),{toggle:a,isPending:i}=zn();if(os())return null;const d=Number(t),o=!!s&&r.has(d),l=()=>{Number.isFinite(d)&&a(d,o)},u=s&&o?"Saved":"Save",v=s?o?"Remove from saved papers":"Save this paper":"Sign in with Hugging Face to save this paper";return e.jsxs("button",{type:"button",className:`action-btn${o?" is-saved":""}`,onClick:l,disabled:i,"aria-pressed":o,"aria-label":v,title:v,children:[e.jsx(U,{name:"bookmark",size:12}),u]})};function nt({children:t,showEdit:s=!1,onEdit:r,editAriaLabel:a}){return s?e.jsxs("span",{className:"action-btn-composite",children:[t,e.jsx("button",{type:"button",className:"action-btn-segment action-btn-edit",onClick:r,"aria-label":a,children:"edit"})]}):t}function Zt(t){if(!t)return"—";try{return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return"—"}}function es(t,s){try{const r=new URL(t),i=r.pathname.replace(/\/$/,"").split("/").filter(Boolean).at(-1);return i?i.replace(/[-_]+/g," "):r.hostname.replace(/^www\./,"")}catch{return s}}const Di=()=>{const{arxivId:t}=ca(),s=ts(),{toast:r}=J(),{user:a}=Pe(),i=(a==null?void 0:a.is_admin)??!1,d=!!a,o=Ya(a),{arxivId:l,evaluations:u,evaluationsByTask:v,evaluationsLoading:p,paper:c,paperError:g,paperLoading:f,presentation:y,refetchEvaluations:k,refetchPaper:b,relatedQuery:h,versions:n,visibleEvaluations:m}=mr(t,o),[j,S]=x.useState(!1),{activeEditor:E,openEditor:C,setEditorOpen:I}=hr();x.useEffect(()=>{o!=="direct"||!(c!=null&&c.id)||(E&&E!=="evaluations"&&B.primeCurationState(c.id).catch(()=>{}),E==="evaluations"&&$e.primeCurationState(c.id).catch(()=>{}))},[E,o,c==null?void 0:c.id]);const[L,T]=x.useState(null),H=x.useRef(!1);x.useEffect(()=>{if(!a||!c||H.current)return;const N=sessionStorage.getItem(Tt);if(!N)return;if(H.current=!0,!B.freshAuthMutationDraft()){sessionStorage.removeItem(Tt),Pa(N)&&C(N);return}if(!window.confirm("You signed in again. Apply the saved destructive catalog edit now? The server will recheck the current catalog version before changing anything.")){r({title:"Edit kept locally",description:"Nothing was changed. Reload this paper when you are ready to confirm the saved edit."});return}B.resumeFreshAuthMutation().then(()=>{r({title:"Edit applied",description:"The restored catalog edit was applied."}),window.location.reload()}).catch(oe=>{r({variant:"destructive",title:"Could not apply the saved edit",description:oe instanceof Error?oe.message:"Please reload and review the edit again."})})},[C,c,r,a]);const P=x.useMemo(()=>{if(!a||!(c!=null&&c.author_links))return!1;const N=a.username.toLowerCase();return c.author_links.some(F=>!!F.hf_username&&F.hf_username.toLowerCase()===N)},[a,c==null?void 0:c.author_links]),w=N=>{if(!d){T(N);return}C(N)},_=ae({mutationFn:()=>B.indexFromArxiv(l),onSuccess:()=>{r({title:"Indexed",description:"Paper added to database."}),setTimeout(()=>b(),1200)}}),R=_.error?gt(_.error,"Failed to index paper"):null,$=_.error instanceof Ce&&[429,503].includes(_.error.status)?"Try again later after arXiv has lifted the temporary limit.":null,D=(y==null?void 0:y.citationCopy)??"",re=(y==null?void 0:y.copyableRanks)??[],[M,ge]=x.useState(!1),xe=async()=>{if(D)try{await navigator.clipboard.writeText(D),ge(!0),r({title:"Citation copied",description:"BibTeX entry copied to clipboard."}),window.setTimeout(()=>ge(!1),1500)}catch{r({title:"Copy failed",description:"Could not access the clipboard. Please copy manually.",variant:"destructive"})}},Ue=async()=>{if(!c)return;const N=c.arxiv_id||c.id,F=Za(N,re);if(F)try{await navigator.clipboard.writeText(F),r({title:"PwC badges copied",description:"Each badge follows its current leaderboard result."})}catch{r({title:"Copy failed",description:"Could not access the clipboard. Please try again.",variant:"destructive"})}};if(f)return e.jsxs("div",{className:"page",children:[e.jsx(de,{className:"h-12 w-3/4 mb-4"}),e.jsx(de,{className:"h-6 w-1/3 mb-8"}),e.jsx(de,{className:"h-64 w-full"})]});if(g||!c)return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(K,{to:"/papers",children:"Papers"}),e.jsx("span",{className:"sep",children:"/"}),e.jsxs("span",{style:{color:"var(--ink)"},children:["arXiv:",l]})]}),e.jsx("h1",{className:"detail-title",children:"Paper not indexed yet"}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:16,maxWidth:640},children:["We don't have ",e.jsxs("span",{style:{fontFamily:"var(--mono)"},children:["arXiv:",l]})," in the database. You can index it from arXiv right now."]}),R&&e.jsx(Ia,{variant:"destructive",className:"mt-4 max-w-xl",children:e.jsxs(Ra,{children:[e.jsx("div",{children:R}),$&&e.jsx("div",{className:"mt-2",children:$})]})}),e.jsxs("div",{className:"action-row",children:[i&&e.jsxs("button",{className:"action-btn",onClick:()=>l&&_.mutate(),disabled:_.isPending,children:[e.jsx(U,{name:"sparkle",size:12}),_.isPending?"Indexing…":"Index from arXiv"]}),e.jsx(A,{variant:"outline",onClick:()=>s("/papers"),children:"Browse Papers"})]})]});if(!y)return null;const{allHfArtifactUrls:Os,authorEntries:Be,citationDisplay:qs,hasIntroducedItems:Ks,hasLineageItems:Gs,hfArtifactViewer:Xs,introducedBenchmarks:Qs,introducedFrameworks:Nt,introducedMethods:Vs,introducedSummary:Ws,numPages:wt,paperSourceLabel:Ct,predecessorPapers:ze,projectPages:ne,safeAbstractUrl:be,safeConferenceUrl:St,safePdfUrl:Et,successorPapers:Me}=y,je=12,ie=wa(c,l),Ys=ie&&At()&&da()&&(!Lt()||i)?ie:null,Pt=c.organizations||[],$t=N=>{const F=Xa(N)??N.name;return e.jsx(K,{to:`/orgs/${N.slug}`,className:`detail-title-org${N.logo_url?" detail-title-org--logo":""}`,title:N.name,"aria-label":N.name,children:N.logo_url?e.jsx("img",{src:N.logo_url,alt:"",onError:oe=>{var Rt;(Rt=oe.currentTarget.parentElement)==null||Rt.classList.remove("detail-title-org--logo"),oe.currentTarget.replaceWith(F)}}):F},N.id)},It=j||Be.length<=je?Be:Be.slice(0,je);return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"breadcrumb",children:[e.jsx(K,{to:"/",children:"Trending"}),e.jsx("span",{className:"sep",children:"/"}),c.arxiv_id&&be?e.jsxs("a",{className:"breadcrumb-external",href:be,target:"_blank",rel:"noopener noreferrer",title:"Open on arXiv",children:[Ct,e.jsx("span",{"aria-hidden":"true",children:"↗"})]}):e.jsx("span",{children:Ct})]}),e.jsxs("div",{className:"detail-grid",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"detail-hero",children:[e.jsxs("div",{className:"detail-hero-main",children:[e.jsxs("h1",{className:"detail-title",children:[e.jsx(ke,{title:c.title}),Pt.slice(0,-1).map($t),e.jsxs("span",{className:"detail-title-tail",children:[Pt.slice(-1).map($t),e.jsx("button",{type:"button",className:"detail-title-edit",onClick:()=>w("organizations"),title:"Edit organizations","aria-label":"Edit organizations",children:e.jsx(U,{name:"pencil",size:11})})]})]}),e.jsxs("div",{className:"detail-meta",children:[e.jsxs("span",{children:["Submitted ",Zt(c.published)]}),wt&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[wt," pages"]})]}),c.citation_count!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[c.citation_count.toLocaleString()," citations"]})]}),(c.proceeding||c.conference_slug)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),c.conference_slug?e.jsx("a",{href:`/conferences/${c.conference_slug}`,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-text)"},children:(c.proceeding||c.conference_name||"").replace(/\s+\d{1,2}$/,"")}):e.jsx("span",{children:c.proceeding.replace(/\s+\d{1,2}$/,"")})]}),n.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("select",{className:"version-select",value:c.version,onChange:N=>{const F=N.target.value;c.arxiv_id&&s(`/paper/${Ee(c.arxiv_id)}${F?`?version=${F}`:""}`)},children:n.map(N=>e.jsxs("option",{value:N.version,children:[N.version," — ",Zt(N.published)]},N.version))})]})]}),e.jsxs("div",{className:"detail-authors",children:[It.map((N,F)=>e.jsxs(Se.Fragment,{children:[N.hf_username&&e.jsx(Qa,{className:"detail-author-avatar",url:N.hf_avatar_url}),N.id?e.jsx(K,{to:`/authors/${N.id}`,children:N.name}):N.hf_username?e.jsx("a",{href:`https://huggingface.co/${N.hf_username}`,target:"_blank",rel:"noopener noreferrer",title:`@${N.hf_username} on Hugging Face`,children:N.name}):e.jsx("a",{children:N.name}),Fje&&e.jsx("button",{className:"show-more-authors",onClick:()=>S(N=>!N),style:{marginLeft:8,background:"none",border:"none",cursor:"pointer",color:"var(--accent-text)",fontFamily:"var(--mono)",fontSize:12},children:j?"show fewer":`+${c.authors.length-je} more`})]}),e.jsxs("div",{className:"action-row",children:[ie&&At()&&(!Lt()||a!=null&&a.is_admin)?e.jsxs(K,{className:"action-btn",to:ie,onClick:()=>ls(ie),children:[e.jsx(U,{name:"pdf",size:12})," Read paper",e.jsx("span",{className:"nav-new-badge","aria-hidden":"true",children:"New"})]}):Et?e.jsxs("a",{className:"action-btn",href:Et,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(U,{name:"pdf",size:12})," View PDF"]}):null,be&&c.source==="external"&&e.jsx(nt,{showEdit:!0,onEdit:()=>w("source_url"),editAriaLabel:"Edit source URL",children:e.jsxs("a",{className:"action-btn-segment action-btn-main",href:be,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(U,{name:"external",size:12})," Source page"]})}),ne.length===1?e.jsx(nt,{showEdit:!0,onEdit:()=>w("project_pages"),editAriaLabel:"Edit project pages",children:e.jsxs("a",{className:"action-btn-segment action-btn-main",href:ne[0].safeHref??void 0,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(U,{name:"globe",size:12})," Project page"]})}):null,ne.length>1?e.jsx(nt,{showEdit:!0,onEdit:()=>w("project_pages"),editAriaLabel:"Edit project pages",children:e.jsxs(ua,{children:[e.jsx(ma,{asChild:!0,children:e.jsxs("button",{type:"button",className:"action-btn-segment action-btn-main",children:[e.jsx(U,{name:"globe",size:12})," Project page"]})}),e.jsx(ha,{align:"start",className:"project-page-menu",children:ne.map((N,F)=>e.jsx(pa,{asChild:!0,children:N.safeHref?e.jsx("a",{href:N.safeHref,target:"_blank",rel:"noopener noreferrer",children:es(N.url,`Project page ${F+1}`)}):e.jsx("span",{children:es(N.url,`Project page ${F+1}`)})},N.url))})]})}):null,ne.length===0&&d?e.jsxs("button",{type:"button",className:"action-btn",onClick:()=>w("project_pages"),title:"Add project page",children:[e.jsx(U,{name:"globe",size:12})," Add project page"]}):null,St&&e.jsxs("a",{className:"action-btn",href:St,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(U,{name:"external",size:12})," Conference"]}),e.jsx(pr,{paperId:Number(c.id)}),i&&fa()&&e.jsx(Es,{kind:"enrich-paper",triggerClassName:"action-btn",paperId:Number(c.id),paperTitle:c.title,onComplete:()=>void b()}),e.jsx(Mn,{paperId:c.id})]}),c.leaderboard_ranks&&c.leaderboard_ranks.length>0&&e.jsx(ja,{wrap:!0,paperHref:`/paper/${c.arxiv_id||c.id}`,ranks:Na(c.leaderboard_ranks)})]}),e.jsx("div",{className:"detail-hero-thumb detail-thumb-wrap",children:e.jsx(va,{paperId:c.arxiv_id||c.id,title:c.title,thumbnailUrl:ga(c.thumbnail_url),priority:!0})})]}),Ks&&e.jsxs("div",{className:`introduced-banner${Nt.length>0?" introduced-banner--framework":""}`,children:[e.jsx("span",{className:"introduced-label",children:"Introduced"}),e.jsxs("div",{className:"introduced-methods",children:[Vs.map(N=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/methods/${N.slug||N.id}`),children:[N.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`method-${N.id}`)),Qs.map(N=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/benchmark/${N.slug||N.id}`),children:[N.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`benchmark-${N.id}`)),Nt.map(N=>e.jsxs("button",{type:"button",className:"introduced-pill",onClick:()=>s(`/frameworks#framework-${N.slug}`),children:[N.name,e.jsx("span",{className:"introduced-arrow",children:"→"})]},`framework-${N.slug}`))]}),e.jsxs("span",{className:"introduced-note",children:["This paper is the canonical source for ",Ws,"."]})]}),Gs&&e.jsxs("div",{className:"introduced-banner lineage-banner",children:[Me.length>0&&e.jsxs("div",{className:"lineage-row",children:[e.jsx("span",{className:"introduced-label lineage-label",children:Me.length===1?"Follow-up paper":"Follow-up papers"}),e.jsx("div",{className:"introduced-methods",children:Me.map(N=>e.jsxs("button",{type:"button",className:"introduced-pill lineage-pill",onClick:()=>s(`/paper/${N.route_identifier}`),children:[e.jsx(ke,{title:N.title}),e.jsx("span",{className:"introduced-arrow",children:"→"})]},`successor-${N.id}`))})]}),ze.length>0&&e.jsxs("div",{className:"lineage-row",children:[e.jsx("span",{className:"introduced-label lineage-label",children:ze.length===1?"Predecessor paper":"Predecessor papers"}),e.jsx("div",{className:"introduced-methods",children:ze.map(N=>e.jsxs("button",{type:"button",className:"introduced-pill lineage-pill",onClick:()=>s(`/paper/${N.route_identifier}`),children:[e.jsx("span",{className:"introduced-arrow lineage-arrow-back",children:"←"}),e.jsx(ke,{title:N.title})]},`predecessor-${N.id}`))})]})]}),e.jsx(Un,{canEdit:!0,onEditMethods:()=>w("methods"),onEditTasks:()=>w("tasks"),paper:c,readerChatRoute:Ys}),e.jsx(Jr,{canCopyBadge:re.length>0,canEdit:!0,evaluationsByTask:v,evaluationsLoading:p,isAdmin:i,onCopyBadge:Ue,onEdit:()=>w("evaluations"),onRefresh:()=>void k(),paper:c,visibleEvaluationCount:(m==null?void 0:m.length)??0})]}),e.jsx(Rn,{allHfArtifactUrls:Os,citationCopied:M,citationDisplay:qs,hfArtifactViewer:Xs,onCopyCitation:xe,onEditHfArtifacts:()=>w("hf_artifacts"),onEditRepositories:()=>w("repositories"),onEditXThreads:()=>w("x_threads"),paper:c,relatedIsLoading:h.isLoading,relatedPapers:h.data,user:a})]}),e.jsx(Vr,{activeEditor:E,arxivId:l,editSubmitMode:o,evaluations:u??[],isAdmin:i,isLinkedAuthor:P,onOpenChange:I,paper:c}),e.jsx(Ba,{open:L!==null,onOpenChange:N=>{N||T(null)},sectionLabel:L?$a[L]:"this paper",returnTo:typeof window<"u"?window.location.pathname:"/"})]})};export{Di as default}; diff --git a/assets/PaperFeed-DMvUfA47.js b/assets/PaperFeed-EBt97iOL.js similarity index 97% rename from assets/PaperFeed-DMvUfA47.js rename to assets/PaperFeed-EBt97iOL.js index 1b4f4923b1867d0e4c2026ff54ce9fe18974465b..6d265c5e2597cd4f4d8355246c570dab867e2407 100644 --- a/assets/PaperFeed-DMvUfA47.js +++ b/assets/PaperFeed-EBt97iOL.js @@ -1 +1 @@ -import{r as u,j as t,e as J,M as K}from"./index-CbgxfyGU.js";import{P as X}from"./PaperCard-tdTC_dRN.js";import{P as ee,a as te,b as ae}from"./popover-DKJYnYjk.js";import{I as se}from"./Icon-D-kA0Owz.js";import{S as j}from"./skeleton-HwvdxvSN.js";import{u as ne}from"./useIntersectionObserver-CID9Kkak.js";const Y=(e,a)=>{const s=new Date(a),n=new Date(s);return n.setUTCDate(s.getUTCDate()-(e==="week"?6:29)),{startDate:n.toISOString().slice(0,10),endDate:s.toISOString().slice(0,10)}},V=e=>({startDate:e.get("start_date")||void 0,endDate:e.get("end_date")||void 0}),Ne=(e,a=new Date,s="week")=>{const n=V(e);if(n.startDate||n.endDate||e.get("time")==="all_time")return n;const o=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));return Y(s,o)},Z=(e,a)=>{const s=new URLSearchParams(e);return a.startDate?s.set("start_date",a.startDate):s.delete("start_date"),a.endDate?s.set("end_date",a.endDate):s.delete("end_date"),s.delete("time"),s},Se=(e,a)=>{const s=Z(e,a);return!a.startDate&&!a.endDate&&s.set("time","all_time"),s},re=new Intl.DateTimeFormat("en",{month:"long",year:"numeric",timeZone:"UTC"}),H=new Intl.DateTimeFormat("en",{month:"short",timeZone:"UTC"}),O="(max-width: 640px)",oe=()=>{const[e,a]=u.useState(()=>typeof window<"u"&&window.matchMedia(O).matches);return u.useEffect(()=>{const s=window.matchMedia(O),n=o=>a(o.matches);return a(s.matches),s.addEventListener("change",n),()=>s.removeEventListener("change",n)},[]),e},W=e=>e.toISOString().slice(0,10),b=e=>new Date(`${e}T00:00:00Z`),ie=()=>{const e=new Date;return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))},F=(e,a)=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+a,1)),v=e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),ce=(e,a)=>new Date(Date.UTC(a,e.getUTCMonth(),1)),w=(e,a)=>e.startDate===a.startDate&&e.endDate===a.endDate,le=(e,a)=>{const s=b(e),n=b(a),o=H.format(s),i=H.format(n),d=s.getUTCDate(),l=n.getUTCDate(),r=s.getUTCFullYear(),p=n.getUTCFullYear();return e===a?`${o} ${d}, ${r}`:r===p&&s.getUTCMonth()===n.getUTCMonth()?`${o} ${d}–${l}, ${r}`:r===p?`${o} ${d}–${i} ${l}, ${r}`:`${o} ${d}, ${r}–${i} ${l}, ${p}`},de=e=>{const a=e.getUTCFullYear(),s=e.getUTCMonth(),n=new Date(Date.UTC(a,s,1)),o=(n.getUTCDay()+6)%7,i=new Date(n);return i.setUTCDate(n.getUTCDate()-o),Array.from({length:42},(d,l)=>{const r=new Date(i);return r.setUTCDate(i.getUTCDate()+l),{iso:W(r),day:r.getUTCDate(),outsideMonth:r.getUTCMonth()!==s}})},L=({month:e,today:a,startDate:s,endDate:n,onSelect:o,yearLabel:i,yearValue:d,onYearChange:l,secondary:r=!1})=>{const p=u.useMemo(()=>de(e),[e]);return t.jsxs("section",{className:`paper-date-calendar${r?" paper-date-calendar-secondary":""}`,children:[t.jsxs("label",{className:"paper-date-year",children:[t.jsx("span",{children:i}),t.jsx("input",{type:"number",inputMode:"numeric",min:"1900",max:a.slice(0,4),step:"1",value:d,onChange:c=>l(c.target.value)})]}),t.jsx("h3",{children:re.format(e)}),t.jsx("div",{className:"paper-date-weekdays","aria-hidden":"true",children:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(c=>t.jsx("span",{children:c},c))}),t.jsx("div",{className:"paper-date-days",children:p.map(c=>{const g=c.iso===s||c.iso===n,m=!!(s&&n&&c.iso>s&&c.isoa;return t.jsx("button",{type:"button","aria-label":c.iso,"aria-selected":g,disabled:f,className:["paper-date-day",c.outsideMonth?"outside":"",g?"selected":"",m?"in-range":"",c.iso===a?"today":""].filter(Boolean).join(" "),onClick:()=>o(c.iso),children:c.day},c.iso)})})]})},I=({calendar:e,onPrevious:a,onNext:s,secondary:n=!1})=>t.jsxs("div",{className:`paper-date-navigation-group${n?" paper-date-navigation-group-secondary":""}`,children:[t.jsx("button",{type:"button","aria-label":`Previous ${e} month`,onClick:a,children:"←"}),t.jsx("button",{type:"button","aria-label":`Next ${e} month`,onClick:s,children:"→"})]}),he=({startDate:e,endDate:a,onChange:s,currentDate:n})=>{const o=oe(),i=n?b(n):ie(),[d,l]=u.useState(!1),[r,p]=u.useState(),[c,g]=u.useState(),[m,f]=u.useState(()=>v(i)),[_,T]=u.useState(()=>F(v(i),1)),[z,D]=u.useState(()=>String(i.getUTCFullYear())),[G,y]=u.useState(()=>String(i.getUTCFullYear())),N={startDate:e,endDate:a},M=Y("week",i),P=Y("month",i),k=W(i),R=!!(e&&a&&!w(N,M)&&!w(N,P)),Q=()=>{p(e),g(a);const h=v(e?b(e):i),x=v(a?b(a):F(h,1));f(h),T(x),D(String(h.getUTCFullYear())),y(String(x.getUTCFullYear())),l(!0)},E=(h,x,$)=>{if(x(h),!/^\d{4}$/.test(h))return;const C=Number(h);C>=1900&&C<=i.getUTCFullYear()&&$(U=>ce(U,C))},S=(h,x,$,C)=>{const U=F(h,x);$(U),C(String(U.getUTCFullYear()))},A=h=>{!r||c?(p(h),g(void 0)):h{s({}),l(!1)};return t.jsxs("div",{className:`paper-date-filter${o?" paper-date-filter-single-calendar":""}`,role:"group","aria-label":"Publication date",children:[t.jsx("button",{type:"button",className:`sort-btn sort-btn-time${w(N,M)?" active":""}`,onClick:()=>s(M),children:"Last Week"}),t.jsx("button",{type:"button",className:`sort-btn sort-btn-time${w(N,P)?" active":""}`,onClick:()=>s(P),children:"Last Month"}),t.jsx("button",{type:"button",className:`sort-btn sort-btn-time${!e&&!a?" active":""}`,onClick:()=>s({}),children:"All Time"}),t.jsxs(ee,{open:d,onOpenChange:h=>{h?Q():l(!1)},children:[t.jsx(te,{asChild:!0,children:t.jsx("button",{type:"button",className:`sort-btn sort-btn-time${R?" active":""}`,"aria-label":R?"Change date range":"Select a range",children:R&&e&&a?le(e,a):"Select a range"})}),t.jsxs(ae,{align:"end",className:`paper-date-popover${o?" paper-date-popover-single-calendar":""}`,role:"dialog","aria-label":"Select a date range",children:[t.jsxs("div",{className:"paper-date-popover-header",children:[t.jsx("h2",{children:"Select a date range"}),t.jsx("p",{children:"Choose an inclusive start and end publication date."})]}),t.jsxs("div",{className:"paper-date-navigation",children:[t.jsx(I,{calendar:"start",onPrevious:()=>S(m,-1,f,D),onNext:()=>S(m,1,f,D)}),!o&&t.jsx(I,{calendar:"end",onPrevious:()=>S(_,-1,T,y),onNext:()=>S(_,1,T,y),secondary:!0})]}),t.jsxs("div",{className:"paper-date-calendars",children:[t.jsx(L,{month:m,today:k,startDate:r,endDate:c,onSelect:A,yearLabel:o?"Year":"Start year",yearValue:z,onYearChange:h=>E(h,D,f)}),!o&&t.jsx(L,{month:_,today:k,startDate:r,endDate:c,onSelect:A,yearLabel:"End year",yearValue:G,onYearChange:h=>E(h,y,T),secondary:!0})]}),t.jsxs("div",{className:"paper-date-actions",children:[t.jsx("button",{type:"button",className:"paper-date-clear",onClick:q,children:"Clear range"}),t.jsxs("div",{children:[t.jsx("button",{type:"button",onClick:()=>l(!1),children:"Cancel"}),t.jsx("button",{type:"button",className:"paper-date-apply",disabled:!r||!c,onClick:()=>{r&&c&&s({startDate:r,endDate:c}),l(!1)},children:"Apply"})]})]})]})]})]})},pe=()=>t.jsxs("span",{className:"hf-resource-logo",children:[t.jsx("img",{className:"hf-resource-logo-black",src:"/hf-logo-monochrome-black.svg?v=20260729",alt:""}),t.jsx("img",{className:"hf-resource-logo-white",src:"/hf-logo-monochrome-white.svg?v=20260729",alt:""})]}),B=({checked:e,icon:a,label:s,onChange:n})=>t.jsxs("button",{type:"button",className:`paper-feed-filter ${e?"active":""}`,"aria-pressed":e,onClick:()=>n(!e),children:[t.jsxs("span",{className:"paper-feed-filter-content",children:[t.jsx("span",{className:"paper-feed-filter-icon","aria-hidden":"true",children:a}),s]}),e&&t.jsx("span",{className:"paper-feed-filter-check","aria-hidden":"true",children:"✓"})]}),ge=({hasCode:e,hasHfArtifacts:a,onHasCodeChange:s,onHasHfArtifactsChange:n,showDivider:o=!0,showHasCode:i=!0})=>t.jsxs("div",{className:"paper-feed-resource-controls",role:"group","aria-label":"Resource filters",children:[o&&t.jsx("span",{className:"paper-feed-resource-divider","aria-hidden":"true"}),t.jsxs("div",{className:"paper-feed-filter-options",children:[i&&t.jsx(B,{checked:e,icon:t.jsx(se,{name:"github",size:14}),label:"Has code",onChange:s}),t.jsx(B,{checked:a,icon:t.jsx(pe,{}),label:"Has artifacts",onChange:n})]})]});function ue(e,a="200px"){const{targetRef:s,isIntersecting:n}=ne({rootMargin:a}),{data:o,hasNextPage:i,isFetchingNextPage:d,fetchNextPage:l}=e;return u.useEffect(()=>{n&&i&&!d&&l()},[n,i,d,l,o]),s}const me=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]];function Ue(){const[e,a]=J(),s=e.get("order_by"),n=s==="date_published"||s==="citation_count"?s:"trending",o=e.get("has_code")==="true",i=e.get("has_hf_artifacts")==="true",d=V(e),l=(r,p)=>{const c=new URLSearchParams(e);p?c.set(r,p):c.delete(r),a(c)};return{searchParams:e,setSearchParams:a,orderBy:n,hasCode:o,hasHfArtifacts:i,dateRange:d,setOrderBy:r=>l("order_by",r==="trending"?null:r),setHasCode:r=>l("has_code",r?"true":null),setHasHfArtifacts:r=>l("has_hf_artifacts",r?"true":null),setDateRange:r=>a(Z(e,r)),filters:{order_by:n,order_dir:"desc",latest_only:!0,include_resources:!0,has_code:o,has_hf_artifacts:i,start_date:d.startDate,end_date:d.endDate}}}const ve=({feed:e,sorts:a=me,activeSort:s=e.orderBy,showDateFilter:n=!0,showHasCode:o,style:i,leading:d,children:l})=>t.jsxs("div",{className:"sort-bar",style:i,children:[d,t.jsxs("div",{className:"paper-feed-toolbar-controls",children:[a&&t.jsx("div",{className:"sort-options",children:a.map(([r,p])=>t.jsx("button",{type:"button",className:`sort-btn ${s===r?"active":""}`,onClick:()=>e.setOrderBy(r),children:p},r))}),t.jsx(ge,{hasCode:e.hasCode,hasHfArtifacts:e.hasHfArtifacts,onHasCodeChange:e.setHasCode,onHasHfArtifactsChange:e.setHasHfArtifacts,showDivider:!!a,showHasCode:o})]}),n&&t.jsx(he,{startDate:e.dateRange.startDate,endDate:e.dateRange.endDate,onChange:e.setDateRange}),l]}),fe=()=>t.jsx(j,{className:"h-40 w-full"}),xe=()=>t.jsxs("div",{className:"paper-card",children:[t.jsx("div",{className:"paper-thumb-wrap",children:t.jsx(j,{className:"paper-thumb-skeleton"})}),t.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[t.jsx(j,{className:"h-6 w-3/4"}),t.jsx(j,{className:"h-4 w-1/2"}),t.jsx(j,{className:"h-12 w-full"})]})]}),we=({query:e,isLoading:a=e.isLoading,cards:s,empty:n,skeleton:o="block",showInstitution:i,highlightQuery:d,cardHeader:l,rootMargin:r,children:p})=>{const c=ue(e,r);if(a){const g=o==="card"?xe:fe;return t.jsx("div",{className:"paper-list",children:Array.from({length:o==="card"?6:4}).map((m,f)=>t.jsx(g,{},f))})}return s.length===0?n===null?null:t.jsx("div",{className:"no-results",children:n}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"paper-list",children:s.map((g,m)=>t.jsxs(K.Fragment,{children:[l==null?void 0:l(m),t.jsx(X,{paper:g,priority:m<3,showInstitution:i,highlightQuery:d,followReasons:g.followReasons})]},g.id))}),t.jsx("div",{ref:c,style:{height:1}}),e.isFetchingNextPage&&t.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"}),p]})};export{he as P,we as a,ve as b,me as c,Ne as r,Ue as u,Se as w}; +import{d as u,j as t,g as J,V as K}from"./index-DyXq7-Tg.js";import{P as X}from"./PaperCard-57p1OSGy.js";import{P as ee,a as te,b as ae}from"./popover-CTBEUp7Y.js";import{I as se}from"./Icon-T4LYkEQj.js";import{S as j}from"./skeleton-C3IIzpSL.js";import{u as ne}from"./useIntersectionObserver-D6_Iig9a.js";const Y=(e,a)=>{const s=new Date(a),n=new Date(s);return n.setUTCDate(s.getUTCDate()-(e==="week"?6:29)),{startDate:n.toISOString().slice(0,10),endDate:s.toISOString().slice(0,10)}},V=e=>({startDate:e.get("start_date")||void 0,endDate:e.get("end_date")||void 0}),Ne=(e,a=new Date,s="week")=>{const n=V(e);if(n.startDate||n.endDate||e.get("time")==="all_time")return n;const o=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()));return Y(s,o)},Z=(e,a)=>{const s=new URLSearchParams(e);return a.startDate?s.set("start_date",a.startDate):s.delete("start_date"),a.endDate?s.set("end_date",a.endDate):s.delete("end_date"),s.delete("time"),s},Se=(e,a)=>{const s=Z(e,a);return!a.startDate&&!a.endDate&&s.set("time","all_time"),s},re=new Intl.DateTimeFormat("en",{month:"long",year:"numeric",timeZone:"UTC"}),H=new Intl.DateTimeFormat("en",{month:"short",timeZone:"UTC"}),O="(max-width: 640px)",oe=()=>{const[e,a]=u.useState(()=>typeof window<"u"&&window.matchMedia(O).matches);return u.useEffect(()=>{const s=window.matchMedia(O),n=o=>a(o.matches);return a(s.matches),s.addEventListener("change",n),()=>s.removeEventListener("change",n)},[]),e},W=e=>e.toISOString().slice(0,10),b=e=>new Date(`${e}T00:00:00Z`),ie=()=>{const e=new Date;return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))},F=(e,a)=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+a,1)),v=e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),ce=(e,a)=>new Date(Date.UTC(a,e.getUTCMonth(),1)),w=(e,a)=>e.startDate===a.startDate&&e.endDate===a.endDate,le=(e,a)=>{const s=b(e),n=b(a),o=H.format(s),i=H.format(n),d=s.getUTCDate(),l=n.getUTCDate(),r=s.getUTCFullYear(),p=n.getUTCFullYear();return e===a?`${o} ${d}, ${r}`:r===p&&s.getUTCMonth()===n.getUTCMonth()?`${o} ${d}–${l}, ${r}`:r===p?`${o} ${d}–${i} ${l}, ${r}`:`${o} ${d}, ${r}–${i} ${l}, ${p}`},de=e=>{const a=e.getUTCFullYear(),s=e.getUTCMonth(),n=new Date(Date.UTC(a,s,1)),o=(n.getUTCDay()+6)%7,i=new Date(n);return i.setUTCDate(n.getUTCDate()-o),Array.from({length:42},(d,l)=>{const r=new Date(i);return r.setUTCDate(i.getUTCDate()+l),{iso:W(r),day:r.getUTCDate(),outsideMonth:r.getUTCMonth()!==s}})},L=({month:e,today:a,startDate:s,endDate:n,onSelect:o,yearLabel:i,yearValue:d,onYearChange:l,secondary:r=!1})=>{const p=u.useMemo(()=>de(e),[e]);return t.jsxs("section",{className:`paper-date-calendar${r?" paper-date-calendar-secondary":""}`,children:[t.jsxs("label",{className:"paper-date-year",children:[t.jsx("span",{children:i}),t.jsx("input",{type:"number",inputMode:"numeric",min:"1900",max:a.slice(0,4),step:"1",value:d,onChange:c=>l(c.target.value)})]}),t.jsx("h3",{children:re.format(e)}),t.jsx("div",{className:"paper-date-weekdays","aria-hidden":"true",children:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(c=>t.jsx("span",{children:c},c))}),t.jsx("div",{className:"paper-date-days",children:p.map(c=>{const g=c.iso===s||c.iso===n,m=!!(s&&n&&c.iso>s&&c.isoa;return t.jsx("button",{type:"button","aria-label":c.iso,"aria-selected":g,disabled:f,className:["paper-date-day",c.outsideMonth?"outside":"",g?"selected":"",m?"in-range":"",c.iso===a?"today":""].filter(Boolean).join(" "),onClick:()=>o(c.iso),children:c.day},c.iso)})})]})},I=({calendar:e,onPrevious:a,onNext:s,secondary:n=!1})=>t.jsxs("div",{className:`paper-date-navigation-group${n?" paper-date-navigation-group-secondary":""}`,children:[t.jsx("button",{type:"button","aria-label":`Previous ${e} month`,onClick:a,children:"←"}),t.jsx("button",{type:"button","aria-label":`Next ${e} month`,onClick:s,children:"→"})]}),he=({startDate:e,endDate:a,onChange:s,currentDate:n})=>{const o=oe(),i=n?b(n):ie(),[d,l]=u.useState(!1),[r,p]=u.useState(),[c,g]=u.useState(),[m,f]=u.useState(()=>v(i)),[_,T]=u.useState(()=>F(v(i),1)),[z,D]=u.useState(()=>String(i.getUTCFullYear())),[G,y]=u.useState(()=>String(i.getUTCFullYear())),N={startDate:e,endDate:a},M=Y("week",i),P=Y("month",i),k=W(i),R=!!(e&&a&&!w(N,M)&&!w(N,P)),Q=()=>{p(e),g(a);const h=v(e?b(e):i),x=v(a?b(a):F(h,1));f(h),T(x),D(String(h.getUTCFullYear())),y(String(x.getUTCFullYear())),l(!0)},E=(h,x,$)=>{if(x(h),!/^\d{4}$/.test(h))return;const C=Number(h);C>=1900&&C<=i.getUTCFullYear()&&$(U=>ce(U,C))},S=(h,x,$,C)=>{const U=F(h,x);$(U),C(String(U.getUTCFullYear()))},A=h=>{!r||c?(p(h),g(void 0)):h{s({}),l(!1)};return t.jsxs("div",{className:`paper-date-filter${o?" paper-date-filter-single-calendar":""}`,role:"group","aria-label":"Publication date",children:[t.jsx("button",{type:"button",className:`sort-btn sort-btn-time${w(N,M)?" active":""}`,onClick:()=>s(M),children:"Last Week"}),t.jsx("button",{type:"button",className:`sort-btn sort-btn-time${w(N,P)?" active":""}`,onClick:()=>s(P),children:"Last Month"}),t.jsx("button",{type:"button",className:`sort-btn sort-btn-time${!e&&!a?" active":""}`,onClick:()=>s({}),children:"All Time"}),t.jsxs(ee,{open:d,onOpenChange:h=>{h?Q():l(!1)},children:[t.jsx(te,{asChild:!0,children:t.jsx("button",{type:"button",className:`sort-btn sort-btn-time${R?" active":""}`,"aria-label":R?"Change date range":"Select a range",children:R&&e&&a?le(e,a):"Select a range"})}),t.jsxs(ae,{align:"end",className:`paper-date-popover${o?" paper-date-popover-single-calendar":""}`,role:"dialog","aria-label":"Select a date range",children:[t.jsxs("div",{className:"paper-date-popover-header",children:[t.jsx("h2",{children:"Select a date range"}),t.jsx("p",{children:"Choose an inclusive start and end publication date."})]}),t.jsxs("div",{className:"paper-date-navigation",children:[t.jsx(I,{calendar:"start",onPrevious:()=>S(m,-1,f,D),onNext:()=>S(m,1,f,D)}),!o&&t.jsx(I,{calendar:"end",onPrevious:()=>S(_,-1,T,y),onNext:()=>S(_,1,T,y),secondary:!0})]}),t.jsxs("div",{className:"paper-date-calendars",children:[t.jsx(L,{month:m,today:k,startDate:r,endDate:c,onSelect:A,yearLabel:o?"Year":"Start year",yearValue:z,onYearChange:h=>E(h,D,f)}),!o&&t.jsx(L,{month:_,today:k,startDate:r,endDate:c,onSelect:A,yearLabel:"End year",yearValue:G,onYearChange:h=>E(h,y,T),secondary:!0})]}),t.jsxs("div",{className:"paper-date-actions",children:[t.jsx("button",{type:"button",className:"paper-date-clear",onClick:q,children:"Clear range"}),t.jsxs("div",{children:[t.jsx("button",{type:"button",onClick:()=>l(!1),children:"Cancel"}),t.jsx("button",{type:"button",className:"paper-date-apply",disabled:!r||!c,onClick:()=>{r&&c&&s({startDate:r,endDate:c}),l(!1)},children:"Apply"})]})]})]})]})]})},pe=()=>t.jsxs("span",{className:"hf-resource-logo",children:[t.jsx("img",{className:"hf-resource-logo-black",src:"/hf-logo-monochrome-black.svg?v=20260729",alt:""}),t.jsx("img",{className:"hf-resource-logo-white",src:"/hf-logo-monochrome-white.svg?v=20260729",alt:""})]}),B=({checked:e,icon:a,label:s,onChange:n})=>t.jsxs("button",{type:"button",className:`paper-feed-filter ${e?"active":""}`,"aria-pressed":e,onClick:()=>n(!e),children:[t.jsxs("span",{className:"paper-feed-filter-content",children:[t.jsx("span",{className:"paper-feed-filter-icon","aria-hidden":"true",children:a}),s]}),e&&t.jsx("span",{className:"paper-feed-filter-check","aria-hidden":"true",children:"✓"})]}),ge=({hasCode:e,hasHfArtifacts:a,onHasCodeChange:s,onHasHfArtifactsChange:n,showDivider:o=!0,showHasCode:i=!0})=>t.jsxs("div",{className:"paper-feed-resource-controls",role:"group","aria-label":"Resource filters",children:[o&&t.jsx("span",{className:"paper-feed-resource-divider","aria-hidden":"true"}),t.jsxs("div",{className:"paper-feed-filter-options",children:[i&&t.jsx(B,{checked:e,icon:t.jsx(se,{name:"github",size:14}),label:"Has code",onChange:s}),t.jsx(B,{checked:a,icon:t.jsx(pe,{}),label:"Has artifacts",onChange:n})]})]});function ue(e,a="200px"){const{targetRef:s,isIntersecting:n}=ne({rootMargin:a}),{data:o,hasNextPage:i,isFetchingNextPage:d,fetchNextPage:l}=e;return u.useEffect(()=>{n&&i&&!d&&l()},[n,i,d,l,o]),s}const me=[["trending","trending"],["date_published","newest"],["citation_count","most cited"]];function Ue(){const[e,a]=J(),s=e.get("order_by"),n=s==="date_published"||s==="citation_count"?s:"trending",o=e.get("has_code")==="true",i=e.get("has_hf_artifacts")==="true",d=V(e),l=(r,p)=>{const c=new URLSearchParams(e);p?c.set(r,p):c.delete(r),a(c)};return{searchParams:e,setSearchParams:a,orderBy:n,hasCode:o,hasHfArtifacts:i,dateRange:d,setOrderBy:r=>l("order_by",r==="trending"?null:r),setHasCode:r=>l("has_code",r?"true":null),setHasHfArtifacts:r=>l("has_hf_artifacts",r?"true":null),setDateRange:r=>a(Z(e,r)),filters:{order_by:n,order_dir:"desc",latest_only:!0,include_resources:!0,has_code:o,has_hf_artifacts:i,start_date:d.startDate,end_date:d.endDate}}}const ve=({feed:e,sorts:a=me,activeSort:s=e.orderBy,showDateFilter:n=!0,showHasCode:o,style:i,leading:d,children:l})=>t.jsxs("div",{className:"sort-bar",style:i,children:[d,t.jsxs("div",{className:"paper-feed-toolbar-controls",children:[a&&t.jsx("div",{className:"sort-options",children:a.map(([r,p])=>t.jsx("button",{type:"button",className:`sort-btn ${s===r?"active":""}`,onClick:()=>e.setOrderBy(r),children:p},r))}),t.jsx(ge,{hasCode:e.hasCode,hasHfArtifacts:e.hasHfArtifacts,onHasCodeChange:e.setHasCode,onHasHfArtifactsChange:e.setHasHfArtifacts,showDivider:!!a,showHasCode:o})]}),n&&t.jsx(he,{startDate:e.dateRange.startDate,endDate:e.dateRange.endDate,onChange:e.setDateRange}),l]}),fe=()=>t.jsx(j,{className:"h-40 w-full"}),xe=()=>t.jsxs("div",{className:"paper-card",children:[t.jsx("div",{className:"paper-thumb-wrap",children:t.jsx(j,{className:"paper-thumb-skeleton"})}),t.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[t.jsx(j,{className:"h-6 w-3/4"}),t.jsx(j,{className:"h-4 w-1/2"}),t.jsx(j,{className:"h-12 w-full"})]})]}),we=({query:e,isLoading:a=e.isLoading,cards:s,empty:n,skeleton:o="block",showInstitution:i,highlightQuery:d,cardHeader:l,rootMargin:r,children:p})=>{const c=ue(e,r);if(a){const g=o==="card"?xe:fe;return t.jsx("div",{className:"paper-list",children:Array.from({length:o==="card"?6:4}).map((m,f)=>t.jsx(g,{},f))})}return s.length===0?n===null?null:t.jsx("div",{className:"no-results",children:n}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"paper-list",children:s.map((g,m)=>t.jsxs(K.Fragment,{children:[l==null?void 0:l(m),t.jsx(X,{paper:g,priority:m<3,showInstitution:i,highlightQuery:d,followReasons:g.followReasons})]},g.id))}),t.jsx("div",{ref:c,style:{height:1}}),e.isFetchingNextPage&&t.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--ink-faint)"},children:"Loading more…"}),p]})};export{he as P,we as a,ve as b,me as c,Ne as r,Ue as u,Se as w}; diff --git a/assets/PaperPreviewLink-DZDNIh1g.js b/assets/PaperPreviewLink-CpCZSa8K.js similarity index 82% rename from assets/PaperPreviewLink-DZDNIh1g.js rename to assets/PaperPreviewLink-CpCZSa8K.js index 4c8ffe41da53e8595e539fa1b28c7b5a8cec8676..263ec86273708819e6e3e0687def06451b1f2b03 100644 --- a/assets/PaperPreviewLink-DZDNIh1g.js +++ b/assets/PaperPreviewLink-CpCZSa8K.js @@ -1,7 +1,7 @@ -import{o as F,f as j,m as b,a as le,p as O,b as z,n as D,h as ce,s as ue,c as he,v as pe,S as me}from"./index-ZkEATkOr.js";import{l as fe}from"./index-BH3yOoza.js";import R from"./katex-DkKDou_j.js";import{j as p,M as A,Z as de,o as C,d as xe,f as ge,L as T,K as ye}from"./index-CbgxfyGU.js";import{u as we}from"./useQuery-Bx9s5-D2.js";import{H as be,a as Ne,b as ve}from"./hover-card-ufez2uMo.js";import{a as I,p as ke}from"./paperQueryKeys-B8u1BWlI.js";import{u as Fe}from"./useMutation-P_trTy9i.js";function je(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:s},exit:{mathFlow:i,mathFlowFence:n,mathFlowFenceMeta:r,mathFlowValue:l,mathText:o,mathTextData:l}};function e(a){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},a)}function t(){this.buffer()}function r(){const a=this.resume(),c=this.stack[this.stack.length-1];F(c.type==="math"),c.meta=a}function n(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(a){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];F(m.type==="math"),this.exit(a),m.value=c;const f=m.data.hChildren[0];F(f.type==="element"),F(f.tagName==="code"),f.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function s(a){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},a),this.buffer()}function o(a){const c=this.resume(),m=this.stack[this.stack.length-1];F(m.type==="inlineMath"),this.exit(a),m.value=c,m.data.hChildren.push({type:"text",value:c})}function l(a){this.config.enter.data.call(this,a),this.config.exit.data.call(this,a)}}function Ce(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),n.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +import{o as F,f as j,m as b,a as le,p as O,b as z,n as D,h as ce,s as ue,c as he,v as pe,S as me}from"./index-mCi_y_l3.js";import{l as fe}from"./index-2CvJmBVB.js";import R from"./katex-DkKDou_j.js";import{j as p,V as A,a3 as de,w as C,p as xe,f as ge,i as ye,L as T,b as we,U as be}from"./index-DyXq7-Tg.js";import{H as Ne,a as ve,b as ke}from"./hover-card-B45EJIn_.js";import{p as I}from"./papers-Dh3ljlL0.js";import{u as Fe}from"./useMutation-UWxBeqtn.js";function je(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:s},exit:{mathFlow:i,mathFlowFence:n,mathFlowFenceMeta:r,mathFlowValue:l,mathText:o,mathTextData:l}};function e(a){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},a)}function t(){this.buffer()}function r(){const a=this.resume(),c=this.stack[this.stack.length-1];F(c.type==="math"),c.meta=a}function n(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(a){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),m=this.stack[this.stack.length-1];F(m.type==="math"),this.exit(a),m.value=c;const f=m.data.hChildren[0];F(f.type==="element"),F(f.tagName==="code"),f.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function s(a){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},a),this.buffer()}function o(a){const c=this.resume(),m=this.stack[this.stack.length-1];F(m.type==="inlineMath"),this.exit(a),m.value=c,m.data.hChildren.push({type:"text",value:c})}function l(a){this.config.enter.data.call(this,a),this.config.exit.data.call(this,a)}}function Ce(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),n.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` `,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:r,inlineMath:n}};function r(s,o,l,a){const c=s.value||"",m=l.createTracker(a),f="$".repeat(Math.max(fe(c,"$")+1,2)),g=l.enter("mathFlow");let d=m.move(f);if(s.meta){const x=l.enter("mathFlowMeta");d+=m.move(l.safe(s.meta,{after:` `,before:d,encode:["$"],...m.current()})),x()}return d+=m.move(` `),c&&(d+=m.move(c+` -`)),d+=m.move(f),g(),d}function n(s,o,l){let a=s.value||"",c=1;for(t||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(a);)c++;const m="$".repeat(c);/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^\$|\$$/.test(a))&&(a=" "+a+" ");let f=-1;for(;++fc&&(c=m):m&&(c!==void 0&&c>-1&&a.push(` -`.repeat(c)||" "),c=-1,a.push(m))}return a.join("")}function re(e,t,r){return e.type==="element"?it(e,t,r):e.type==="text"?r.whitespace==="normal"?ie(e,r):at(e):[]}function it(e,t,r){const n=ae(e,r),i=e.children||[];let s=-1,o=[];if(nt(e))return o;let l,a;for(P(e)||W(e)&&V(t,e,W)?a=` -`:tt(e)?(l=2,a=2):ne(e)&&(l=1,a=1);++s({name:r.name,slug:r.slug??""}))}}function mt(e){if(!e.authors.length)return"";const t=e.authors.slice(0,3).join(", ");return e.authors.length>3?`${t}, et al.`:t}function ft(e){var r;if(e.conference)return e.conference;const t=(r=e.published)==null?void 0:r.slice(0,4);if(e.arxivId)return t?`arXiv ${t}`:"arXiv";if(e.sourceUrl)try{return new URL(e.sourceUrl).hostname.replace(/^www\./,"")}catch{}return t??"external"}const dt=({seed:e=0})=>p.jsxs("div",{className:"paper-preview-thumb","aria-hidden":"true","data-testid":"faux-paper-thumb",children:[p.jsxs("div",{className:"paper-preview-thumb-title",children:[p.jsx("span",{}),p.jsx("span",{})]}),p.jsx("div",{className:"paper-preview-thumb-auth"}),p.jsxs("div",{className:"paper-preview-thumb-cols",children:[p.jsx("div",{className:"paper-preview-thumb-col"}),p.jsx("div",{className:"paper-preview-thumb-col"})]}),p.jsx("div",{className:"paper-preview-thumb-fig",style:{top:62+e%3*8}})]}),xt=({thumbnailUrl:e,seed:t})=>{const[r,n]=A.useState(!1),i=de(e);return A.useEffect(()=>n(!1),[i]),!i||r?p.jsx(dt,{seed:t}):p.jsx("div",{className:"paper-preview-thumb paper-preview-thumb-real",children:p.jsx("img",{"data-testid":"paper-preview-image",src:i,alt:"",loading:"lazy",decoding:"async",onError:()=>n(!0)})})},Z=({data:e})=>{const t=e.routeId.split("").reduce((n,i)=>n+i.charCodeAt(0),0),r=mt(e);return p.jsxs("div",{className:"paper-preview-inner",children:[p.jsx(xt,{thumbnailUrl:e.thumbnailUrl,seed:t}),p.jsxs("div",{className:"paper-preview-meta",children:[p.jsx("div",{className:"paper-preview-title",children:e.title}),r&&p.jsx("div",{className:"paper-preview-auth",children:r}),p.jsxs("div",{className:"paper-preview-venue",children:[ft(e),e.arxivId&&p.jsxs(p.Fragment,{children:[" · arXiv:",e.arxivId]}),e.citationCount!=null&&p.jsxs(p.Fragment,{children:[" · ↑ ",e.citationCount.toLocaleString()]})]}),e.tasks.length>0&&p.jsx("div",{className:"paper-preview-tags",children:e.tasks.map(n=>p.jsx("span",{className:"paper-preview-tag",children:n.name},n.slug||n.name))})]})]})},M=e=>ke.preview(C(e)),gt=e=>e.arxiv_id??e.id,Y=200;function St(e,t=I){const r=new Set,n=async s=>{const o=new Map;for(const l of s)l.arxiv_id&&r.add(C(l.arxiv_id));for(let l=0;l{const o=s.filter(l=>{const a=C(l);return r.has(a)||e.getQueryData(M(a))?!1:(r.add(a),!0)});o.length&&n(o.map(l=>({key:l,arxiv_id:l}))).catch(()=>{})}}}const yt=/^(\d{4}\.\d{4,5}|[a-z-]+(\.[A-Z]{2})?\/\d{7})$/i,wt=({arxivId:e})=>{var i;const t=xe(),r=ge(),n=Fe({mutationFn:()=>I.submit({arxiv_id:e}),onSuccess:s=>{s.pending_review||r.invalidateQueries({queryKey:M(e)})}});return(i=n.data)!=null&&i.pending_review?p.jsxs("div",{className:"paper-preview-status paper-preview-index-request",children:[p.jsx("span",{children:"Indexing request queued for review."}),p.jsx(T,{to:"/submissions",target:"_blank",rel:"noopener noreferrer",children:"View submissions ↗"})]}):p.jsxs("div",{className:"paper-preview-status paper-preview-index-request",children:[p.jsx("span",{children:"Not indexed on Papers with Code yet."}),t!=null&&t.user?p.jsx("button",{type:"button",disabled:n.isPending,onClick:()=>n.mutate(),children:n.isPending?"Requesting…":"Request indexing"}):p.jsx(T,{to:`/submit?arxiv_id=${encodeURIComponent(e)}`,target:"_blank",rel:"noopener noreferrer",children:"Request indexing ↗"}),n.isError&&p.jsx("span",{role:"alert",children:n.error.message})]})},bt=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,Pt=({routeId:e,to:t,initialData:r,className:n,children:i,target:s,title:o,ariaLabel:l,onClick:a,previewFooter:c,cardOpensPaper:m=!1})=>{const f=C(e),[g,d]=A.useState(!1),x=!!(r!=null&&r.title.trim()),h=we({queryKey:M(f),queryFn:()=>I.get(f,!1),enabled:g&&!x,staleTime:5*60*1e3,gcTime:30*60*1e3,retry:!1}),y=r??(h.data?pt(h.data,f):void 0),v=h.error instanceof ye&&h.error.status===404&&yt.test(f),u=p.jsx(T,{className:n,to:t??`/paper/${f}`,target:s,title:o,"aria-label":l,onClick:k=>{d(!1),a==null||a(k)},rel:s==="_blank"?"noopener noreferrer":void 0,children:i});return p.jsxs(be,{open:g,onOpenChange:k=>{(!k||!bt())&&d(k)},openDelay:150,closeDelay:100,children:[p.jsx(Ne,{asChild:!0,children:u}),p.jsx(ve,{className:"paper-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:y?p.jsxs(p.Fragment,{children:[m?p.jsx(T,{className:"paper-preview-card-link",to:`/paper/${encodeURIComponent(f)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>d(!1),children:p.jsx(Z,{data:y})}):p.jsx(Z,{data:y}),c==null?void 0:c(y)]}):v?p.jsx(wt,{arxivId:f}):h.isError?p.jsx("div",{className:"paper-preview-status",children:"Preview unavailable"}):p.jsx("div",{className:"paper-preview-status","aria-live":"polite",children:"Loading preview…"})})]})};export{Pt as P,Et as a,St as c,At as r}; +`)),d+=m.move(f),g(),d}function n(s,o,l){let a=s.value||"",c=1;for(t||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(a);)c++;const m="$".repeat(c);/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^\$|\$$/.test(a))&&(a=" "+a+" ");let f=-1;for(;++fc&&(c=m):m&&(c!==void 0&&c>-1&&a.push(` +`.repeat(c)||" "),c=-1,a.push(m))}return a.join("")}function re(e,t,r){return e.type==="element"?it(e,t,r):e.type==="text"?r.whitespace==="normal"?ie(e,r):at(e):[]}function it(e,t,r){const n=ae(e,r),i=e.children||[];let s=-1,o=[];if(nt(e))return o;let l,a;for(P(e)||W(e)&&K(t,e,W)?a=` +`:tt(e)?(l=2,a=2):ne(e)&&(l=1,a=1);++s({name:r.name,slug:r.slug??""}))}}function mt(e){if(!e.authors.length)return"";const t=e.authors.slice(0,3).join(", ");return e.authors.length>3?`${t}, et al.`:t}function ft(e){var r;if(e.conference)return e.conference;const t=(r=e.published)==null?void 0:r.slice(0,4);if(e.arxivId)return t?`arXiv ${t}`:"arXiv";if(e.sourceUrl)try{return new URL(e.sourceUrl).hostname.replace(/^www\./,"")}catch{}return t??"external"}const dt=({seed:e=0})=>p.jsxs("div",{className:"paper-preview-thumb","aria-hidden":"true","data-testid":"faux-paper-thumb",children:[p.jsxs("div",{className:"paper-preview-thumb-title",children:[p.jsx("span",{}),p.jsx("span",{})]}),p.jsx("div",{className:"paper-preview-thumb-auth"}),p.jsxs("div",{className:"paper-preview-thumb-cols",children:[p.jsx("div",{className:"paper-preview-thumb-col"}),p.jsx("div",{className:"paper-preview-thumb-col"})]}),p.jsx("div",{className:"paper-preview-thumb-fig",style:{top:62+e%3*8}})]}),xt=({thumbnailUrl:e,seed:t})=>{const[r,n]=A.useState(!1),i=de(e);return A.useEffect(()=>n(!1),[i]),!i||r?p.jsx(dt,{seed:t}):p.jsx("div",{className:"paper-preview-thumb paper-preview-thumb-real",children:p.jsx("img",{"data-testid":"paper-preview-image",src:i,alt:"",loading:"lazy",decoding:"async",onError:()=>n(!0)})})},Y=({data:e})=>{const t=e.routeId.split("").reduce((n,i)=>n+i.charCodeAt(0),0),r=mt(e);return p.jsxs("div",{className:"paper-preview-inner",children:[p.jsx(xt,{thumbnailUrl:e.thumbnailUrl,seed:t}),p.jsxs("div",{className:"paper-preview-meta",children:[p.jsx("div",{className:"paper-preview-title",children:e.title}),r&&p.jsx("div",{className:"paper-preview-auth",children:r}),p.jsxs("div",{className:"paper-preview-venue",children:[ft(e),e.arxivId&&p.jsxs(p.Fragment,{children:[" · arXiv:",e.arxivId]}),e.citationCount!=null&&p.jsxs(p.Fragment,{children:[" · ↑ ",e.citationCount.toLocaleString()]})]}),e.tasks.length>0&&p.jsx("div",{className:"paper-preview-tags",children:e.tasks.map(n=>p.jsx("span",{className:"paper-preview-tag",children:n.name},n.slug||n.name))})]})]})},M=e=>xe.preview(C(e)),gt=e=>e.arxiv_id??e.id,Z=200;function At(e,t=I){const r=new Set,n=async s=>{const o=new Map;for(const l of s)l.arxiv_id&&r.add(C(l.arxiv_id));for(let l=0;l{const o=s.filter(l=>{const a=C(l);return r.has(a)||e.getQueryData(M(a))?!1:(r.add(a),!0)});o.length&&n(o.map(l=>({key:l,arxiv_id:l}))).catch(()=>{})}}}const yt=/^(\d{4}\.\d{4,5}|[a-z-]+(\.[A-Z]{2})?\/\d{7})$/i,wt=({arxivId:e})=>{var i;const t=ge(),r=ye(),n=Fe({mutationFn:()=>I.submit({arxiv_id:e}),onSuccess:s=>{s.pending_review||r.invalidateQueries({queryKey:M(e)})}});return(i=n.data)!=null&&i.pending_review?p.jsxs("div",{className:"paper-preview-status paper-preview-index-request",children:[p.jsx("span",{children:"Indexing request queued for review."}),p.jsx(T,{to:"/submissions",target:"_blank",rel:"noopener noreferrer",children:"View submissions ↗"})]}):p.jsxs("div",{className:"paper-preview-status paper-preview-index-request",children:[p.jsx("span",{children:"Not indexed on Papers with Code yet."}),t!=null&&t.user?p.jsx("button",{type:"button",disabled:n.isPending,onClick:()=>n.mutate(),children:n.isPending?"Requesting…":"Request indexing"}):p.jsx(T,{to:`/submit?arxiv_id=${encodeURIComponent(e)}`,target:"_blank",rel:"noopener noreferrer",children:"Request indexing ↗"}),n.isError&&p.jsx("span",{role:"alert",children:n.error.message})]})},bt=()=>typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches,St=({routeId:e,to:t,initialData:r,className:n,children:i,target:s,title:o,ariaLabel:l,onClick:a,previewFooter:c,cardOpensPaper:m=!1})=>{const f=C(e),[g,d]=A.useState(!1),x=!!(r!=null&&r.title.trim()),h=we({queryKey:M(f),queryFn:()=>I.get(f,!1),enabled:g&&!x,staleTime:5*60*1e3,gcTime:30*60*1e3,retry:!1}),y=r??(h.data?pt(h.data,f):void 0),v=h.error instanceof be&&h.error.status===404&&yt.test(f),u=p.jsx(T,{className:n,to:t??`/paper/${f}`,target:s,title:o,"aria-label":l,onClick:k=>{d(!1),a==null||a(k)},rel:s==="_blank"?"noopener noreferrer":void 0,children:i});return p.jsxs(Ne,{open:g,onOpenChange:k=>{(!k||!bt())&&d(k)},openDelay:150,closeDelay:100,children:[p.jsx(ve,{asChild:!0,children:u}),p.jsx(ke,{className:"paper-preview-pop",side:"bottom",align:"start",collisionPadding:12,children:y?p.jsxs(p.Fragment,{children:[m?p.jsx(T,{className:"paper-preview-card-link",to:`/paper/${encodeURIComponent(f)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>d(!1),children:p.jsx(Y,{data:y})}):p.jsx(Y,{data:y}),c==null?void 0:c(y)]}):v?p.jsx(wt,{arxivId:f}):h.isError?p.jsx("div",{className:"paper-preview-status",children:"Preview unavailable"}):p.jsx("div",{className:"paper-preview-status","aria-live":"polite",children:"Loading preview…"})})]})};export{St as P,Mt as a,At as c,Et as r}; diff --git a/assets/PaperReaderView-9hbbSNRK.js b/assets/PaperReaderView-9hbbSNRK.js deleted file mode 100644 index 97a211e9ec6a145e5b0caaa96b988ec47a64b625..0000000000000000000000000000000000000000 --- a/assets/PaperReaderView-9hbbSNRK.js +++ /dev/null @@ -1 +0,0 @@ -import{r as s,j as a,K as J,u as Se,c as Ue,o as De,Z as je,Q as Oe,L as Z}from"./index-CbgxfyGU.js";import{u as ee}from"./useQuery-Bx9s5-D2.js";import{u as Ve,R as Qe,A as Xe,c as Ze,d as Ye,a as Ge,P as Je,e as et}from"./ArtifactWorkspace-Cwix1Wp6.js";import{M as tt}from"./MarkdownText-Bj-G_S-B.js";import{g as rt,b as at}from"./paperQueryKeys-B8u1BWlI.js";import{w as st,e as nt}from"./paperReader-BIpQD5HO.js";import{a as ot}from"./usePapers-CJaWLZ3y.js";import{c as it}from"./chat-DzTo2WUO.js";import{s as te}from"./safeExternalHref-CkBrsh84.js";import{ChatExperience as ct}from"./ChatView-DlSbJMKT.js";import"./chatSessions-DwLUbLRo.js";/* empty css */import"./hover-card-ufez2uMo.js";import"./CatalogEntityPreviewLink-Cvehtzvn.js";import"./catalog-DhK7_9-6.js";import"./github-BYklgHDz.js";import"./file-text-BK_7Q2rV.js";import"./PaperPreviewLink-DZDNIh1g.js";import"./index-ZkEATkOr.js";import"./index-BH3yOoza.js";import"./katex-DkKDou_j.js";import"./useMutation-P_trTy9i.js";import"./copy-bzw7JVus.js";import"./thumbs-up-CDCzGuPd.js";import"./arrow-left-Czeu3VzJ.js";import"./external-link-DZIH4GGr.js";import"./plus-UK0TEjgd.js";import"./search-CLtAJGOp.js";import"./chevron-up-Cpt5JLeI.js";import"./AuthorAvatar-CUJMmp_z.js";import"./curation-C7Gmmp4z.js";import"./useInfiniteQuery-BAc_4HO5.js";import"./McpShowcase-CMLfdJM2.js";import"./AgentLogos-BBl9UNVD.js";import"./share-2-hXe4dX_y.js";import"./openrouter-DiuY1sPP.js";import"./queryOptions-C9woPjwX.js";function lt(r){return r instanceof J&&r.status===422?"This page could not be turned into a readable paper.":r instanceof J&&r.status===503?"Paper content is still being prepared. Please try again later.":"The paper could not be loaded."}function dt({paperId:r,paperKey:i,paperTitle:o,paperHref:b,sourceUrl:d,resources:t,paperVersion:f="",selectionEnabled:v=!1,onReady:h,onPaperSelection:I,onPaperSelectionError:B}){const c=s.useRef(null),g=ee({queryKey:["paperWebMarkdown",r],queryFn:()=>rt(r),staleTime:5*6e4,retry:(w,j)=>w<2&&!(j instanceof J&&j.status<500),retryDelay:3e3}),x=g.isSuccess;s.useEffect(()=>{x&&(h==null||h())},[h,x]),Ve({enabled:v&&!!f&&x,pagesRoot:c,routeId:i,paperVersion:f,numPages:1,onSelect:I,onError:B});const S=g.data?st(g.data):"";return a.jsxs("div",{className:"pdf-viewer",children:[a.jsx(Qe,{paperTitle:o,paperHref:b,resources:t,label:"Paper controls",children:a.jsx("div",{className:"pdf-toolbar-controls",children:a.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",children:"Open original"})})}),a.jsx("div",{className:"pdf-scroll-frame",children:a.jsx("div",{className:"pdf-scroll",role:"region","aria-label":"Paper web page",children:g.isPending?a.jsx("div",{className:"pdf-loading",role:"status",children:"Preparing a readable version of this page…"}):g.isError?a.jsxs("div",{className:"pdf-error",role:"alert",children:[a.jsx("p",{children:lt(g.error)}),a.jsxs("div",{children:[a.jsx("button",{type:"button",onClick:()=>void g.refetch(),children:"Retry"})," ",a.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",children:"Open original"})]})]}):a.jsxs("article",{ref:c,className:"reader-web-document","data-page":"1",children:[!S.startsWith("# ")&&a.jsx("h1",{children:o}),a.jsx(tt,{text:S})]})})})]})}const _e=66,ut=240,re="pwc:reader:split-ratio",L=r=>`pwc:reader:session:${r}`,Y=r=>`pwc:reader:assistant-collapsed:${r}`,Ce=r=>`pwc:reader:page:${r}`;function G(r){const i=Number(sessionStorage.getItem(Ce(r)));return Number.isInteger(i)&&i>0?i:1}function pt(){const r=Number(localStorage.getItem(re));return Number.isFinite(r)&&r>=45&&r<=75?r:_e}function ft(r){const i=te(r);if(!i)return null;const o=new URL(i);return(o.hostname==="arxiv.org"||o.hostname==="www.arxiv.org")&&o.pathname.startsWith("/pdf/")&&o.pathname.endsWith(".pdf")&&(o.pathname=o.pathname.slice(0,-4)),o.href}const mt=/^\/pdf\/(\d{4}\.\d{4,5}(?:v\d{1,3})?|[a-z]+(?:-[a-z]+)*(?:\.[A-Z]{2})?\/\d{7}(?:v\d{1,3})?)$/;function ht(r){const i=new URL(r),o=i.pathname.match(mt);return(i.hostname==="arxiv.org"||i.hostname==="www.arxiv.org")&&o&&!i.search?je(`/paper-assets/arxiv-pdf/${o[1]}`)??r:r}function gt(r){return new URL(r).hostname.replace(/^www\./,"")}function bt(r){if(!r)return{};const i={};for(const d of r.repositories??[]){if(!d.is_official)continue;const t=te(d.url);if(!t)continue;const f=new URL(t),v=f.pathname.split("/").filter(Boolean);if((f.hostname==="github.com"||f.hostname==="www.github.com")&&v.length>=2){i.repository={href:t,stars:d.num_stars||0};break}}const o=[...r.project_pages??[]].sort((d,t)=>Number(t.is_official)-Number(d.is_official));for(const d of o){const t=te(d.url);if(t){i.projectPage={href:t,label:gt(t)};break}}const b=r.hf_artifact_summary?r.hf_artifact_summary.model_count+r.hf_artifact_summary.dataset_count+r.hf_artifact_summary.space_count:new Set([...r.hf_models??[],...r.hf_datasets??[],...r.hf_spaces??[]]).size;return b>0&&r.arxiv_id&&(i.huggingFace={href:`https://huggingface.co/papers/${r.arxiv_id.replace(/v\d+$/i,"")}`,count:b}),i}function vt(){var xe,Pe,we,ye,Re;const r=Ue(),{paperId:i}=Se(),o=De(i??"").replace(/v\d+$/i,""),b=ot(o,!!o),d=ee({queryKey:["chatAvailability"],queryFn:()=>it.getAvailability(),refetchInterval:3e4,retry:!1}),t=b.data,f=t?nt(t):null,v=f?null:(t==null?void 0:t.source)==="external"?je(`/paper-assets/external/${t.id}/paper.pdf`):ft(t==null?void 0:t.url_pdf),h=v&&(t==null?void 0:t.source)!=="external"?ht(v):v,I=bt(t),B=s.useMemo(()=>{var e;return(e=t==null?void 0:t.author_links)==null?void 0:e.flatMap(n=>n.id?[{id:n.id,name:n.name,avatarUrl:n.hf_avatar_url}]:[])},[t==null?void 0:t.author_links]),c=((xe=t==null?void 0:t.arxiv_id)==null?void 0:xe.replace(/v\d+$/i,""))||o,g=s.useCallback(()=>r(`/paper/${c}`),[c,r]),[x,S]=s.useState(()=>sessionStorage.getItem(L(o))||void 0),[w,j]=s.useState(pt),[u,ae]=s.useState(()=>sessionStorage.getItem(Y(o))==="1"),[P,_]=s.useState("paper"),[H,C]=s.useState(),[ke,se]=s.useState(),[Ae,ne]=s.useState(!1),Ie=s.useCallback(()=>ne(!0),[]),[$e,y]=s.useState(""),[Ne,Ee]=s.useState(()=>G(o)),[k,Te]=s.useState(0),[oe,ie]=s.useState(!1),[Me,F]=s.useState(!1),$=s.useRef(null),K=s.useRef(null),N=s.useRef(null),ce=s.useRef(null),le=s.useRef(null),q=s.useRef(!1),E=s.useRef(!1),T=s.useRef(0),R=s.useRef(0),U=s.useRef(0),A=s.useRef(w),D=s.useRef(G(o)),O=s.useRef(t==null?void 0:t.version),de=Ze().reset,ue=s.useRef(`${o}:${x??"new"}`),p=k>=840;s.useEffect(()=>{const e=`${o}:${x??"new"}`;ue.current!==e&&(ue.current=e,de())},[x,de,o]),s.useEffect(()=>{t!=null&&t.version&&O.current&&t.version!==O.current&&(C(void 0),y("")),O.current=t==null?void 0:t.version},[t==null?void 0:t.version]),s.useEffect(()=>{window.clearTimeout(T.current),F(!1);const e=sessionStorage.getItem(L(o));S(e||void 0),ae(sessionStorage.getItem(Y(o))==="1"),_("paper"),ne(!1),C(void 0),se(void 0),y("");const n=G(o);D.current=n,Ee(n)},[o]),s.useEffect(()=>()=>{window.clearTimeout(T.current),cancelAnimationFrame(R.current)},[]),s.useLayoutEffect(()=>{const e=$.current;if(!e)return;const n=()=>Te(e.clientWidth);n();const l=new ResizeObserver(n);return l.observe(e),()=>l.disconnect()},[t]),s.useEffect(()=>{if(!t)return;document.title=`${t.title} — Papers With Code reader`;let e=document.querySelector('meta[name="robots"]');const n=!e;e||(e=document.createElement("meta"),e.name="robots",document.head.appendChild(e));const l=e.content;e.content="noindex, nofollow";let m=document.querySelector('link[rel="canonical"]');const Ke=!m;m||(m=document.createElement("link"),m.rel="canonical",document.head.appendChild(m));const qe=m.href;return m.href=`${window.location.origin}/paper/${c}`,()=>{document.title="Papers With Code",n?e==null||e.remove():e&&(e.content=l),Ke?m==null||m.remove():m&&(m.href=qe)}},[c,t]);const M=s.useCallback(e=>{if(!k)return Math.max(45,Math.min(75,e));const n=480/k*100,l=100-360/k*100;return Math.max(n,Math.min(l,e))},[k]);s.useEffect(()=>j(e=>{const n=M(e);return A.current=n,n}),[M]);const W=e=>{const n=M(e);A.current=n,j(n),localStorage.setItem(re,String(n))},pe=e=>{var l;const n=M(e);A.current=n,K.current&&(K.current.style.width=`${n}%`),N.current&&(N.current.style.width=`${100-n}%`),(l=ce.current)==null||l.setAttribute("aria-valuenow",String(Math.round(n)))},fe=e=>{U.current=e,!R.current&&(R.current=requestAnimationFrame(()=>{var l;R.current=0;const n=(l=$.current)==null?void 0:l.getBoundingClientRect();n!=null&&n.width&&pe((U.current-n.left)/n.width*100)}))},We=e=>{E.current=!0,ie(!0),e.currentTarget.setPointerCapture(e.pointerId),fe(e.clientX)},V=()=>{var e;if(E.current){if(R.current){cancelAnimationFrame(R.current),R.current=0;const n=(e=$.current)==null?void 0:e.getBoundingClientRect();n!=null&&n.width&&pe((U.current-n.left)/n.width*100)}E.current=!1,j(A.current),localStorage.setItem(re,String(A.current)),ie(!1)}},me=e=>{window.clearTimeout(T.current),F(!0),ae(e),sessionStorage.setItem(Y(o),e?"1":"0"),T.current=window.setTimeout(()=>F(!1),ut+40)},he=e=>{q.current=!0,me(e)};s.useEffect(()=>{var e;q.current&&(q.current=!1,(e=u?le.current:N.current)==null||e.focus())},[u]);const ze=e=>{S(e),sessionStorage.setItem(L(o),e)},Le=()=>{S(void 0),sessionStorage.removeItem(L(o)),C(void 0),y("")},ge=((Pe=d.data)==null?void 0:Pe.paper_reader_selection_enabled)===!0,be=e=>{C(e),y(`Selection from page ${e.page} added to chat`),p&&u&&me(!1)},Be=s.useCallback(e=>{C(e),e||y("")},[]),Q=((we=d.data)==null?void 0:we.paper_reader_citations_enabled)===!0&&!!h,z=ee({queryKey:["paper-layout",c],queryFn:()=>at(c),enabled:Q&&!!c,staleTime:5*6e4}).data,He=s.useMemo(()=>Q?{layout:z,open:e=>{const n=z?Ye(z,e):[];n.length&&(se(l=>({boxes:n,nonce:((l==null?void 0:l.nonce)??0)+1})),_("paper"))}}:null,[Q,z]),ve=Oe()&&((ye=d.data)==null?void 0:ye.paper_reader_chat_enabled)!==!1,X=!!(t&&ve&&!(f&&!Ae)),Fe=t&&ve&&!X?a.jsx("div",{className:"reader-chat-unavailable",role:"status",children:"Chat opens once the paper is ready."}):t&&X?a.jsx(ct,{mode:"paper",routeSessionId:x,primaryPaper:{id:t.id,routeId:c,title:t.title},currentPage:()=>D.current,paperSelection:H,onPaperSelectionChange:Be,onSessionId:ze,onReaderSubmit:()=>_("assistant"),onReaderNewChat:Le,onReaderClose:p?()=>he(!0):void 0}):a.jsx("div",{className:"reader-chat-unavailable",children:"Chat is not enabled for this preview."});return b.isLoading?a.jsx("div",{className:"reader-status",role:"status",children:"Loading paper…"}):b.error||!t?a.jsxs("div",{className:"reader-status",role:"alert",children:[a.jsx("p",{children:"Paper not found."}),a.jsx(Z,{to:"/papers",children:"Browse papers"})]}):((Re=d.data)==null?void 0:Re.native_pdf_reader_enabled)===!1?a.jsxs("div",{className:"reader-status",role:"alert",children:[a.jsx("p",{children:"The native reader is currently unavailable."}),a.jsx(Z,{to:`/paper/${c}`,children:"Back to paper"})]}):!h&&!f?a.jsxs("div",{className:"reader-status",role:"alert",children:[a.jsx("p",{children:"Native reading is unavailable for this resource."}),a.jsx(Z,{to:`/paper/${c}`,children:"Back to paper"})]}):a.jsxs("div",{className:"paper-reader-shell",children:[!p&&a.jsxs("div",{className:"reader-tabs",role:"tablist","aria-label":"Reader panels",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":P==="paper",onClick:()=>_("paper"),children:"Paper"}),a.jsxs("button",{type:"button",role:"tab","aria-selected":P==="assistant","aria-label":H&&P!=="assistant"?"Chat, selection attached":"Chat",onClick:()=>_("assistant"),children:["Chat",H&&P!=="assistant"&&a.jsx("span",{className:"reader-tab-pending","aria-hidden":"true"})]})]}),a.jsx(Ge,{variant:"reader",children:a.jsxs("div",{ref:$,className:`reader-workspace${p?" is-desktop":" is-tabs"}${u?" is-assistant-collapsed":""}${oe?" is-resizing":""}`,"data-testid":"paper-chat-workspace",children:[a.jsx("section",{ref:K,className:`reader-paper-pane${!p&&P!=="paper"?" is-hidden":""}`,style:p?{width:u?"100%":`${w}%`}:void 0,role:"tabpanel","aria-label":"Paper","aria-hidden":!p&&P!=="paper",children:f?a.jsx(dt,{paperId:t.id,paperKey:c,paperTitle:t.title,paperHref:`/paper/${c}`,sourceUrl:f,resources:I,paperVersion:t.version,selectionEnabled:ge,onReady:Ie,onPaperSelection:be,onPaperSelectionError:y}):h&&a.jsx(Je,{url:h,downloadUrl:v??h,paperKey:c,paperTitle:t.title,paperHref:`/paper/${c}`,onClose:g,resources:I,initialPage:Ne,resizeActive:oe||Me,selectionEnabled:ge,paperVersion:t.version,authors:B,loadErrorMessage:t.source==="external"?"Paper content is still being prepared. Please try again later.":void 0,onPaperSelection:be,onPaperSelectionError:y,highlight:ke,onPageChange:e=>{D.current=e,sessionStorage.setItem(Ce(o),String(e))}})}),p&&!u&&a.jsx("div",{ref:ce,className:"reader-resize-handle",role:"separator","aria-label":"Resize paper and Chat panels","aria-orientation":"vertical","aria-valuemin":45,"aria-valuemax":75,"aria-valuenow":Math.round(w),tabIndex:0,onPointerDown:We,onPointerMove:e=>{E.current&&fe(e.clientX)},onPointerUp:V,onPointerCancel:V,onLostPointerCapture:V,onDoubleClick:()=>W(_e),onKeyDown:e=>{(e.key==="ArrowLeft"||e.key==="ArrowRight")&&(e.preventDefault(),W(w+(e.key==="ArrowRight"?2:-2))),e.key==="Home"&&W(45),e.key==="End"&&W(75)}}),a.jsx("aside",{ref:N,id:"reader-chat-panel",className:`reader-assistant-pane${!p&&P!=="assistant"?" is-hidden":""}${p&&u?" is-collapsed":""}`,style:p?{width:u?0:`${100-w}%`}:void 0,role:"tabpanel","aria-label":"Chat","aria-hidden":!p&&P!=="assistant"||u,tabIndex:-1,children:a.jsx(et.Provider,{value:He,children:Fe})}),a.jsx("div",{className:"sr-only","aria-live":"polite",children:$e}),p&&(u||!X)&&a.jsx("button",{ref:le,type:"button",className:"reader-collapse-assistant","aria-controls":"reader-chat-panel","aria-expanded":!u,onClick:()=>he(!u),children:u?"Open chat":"Hide chat"})]})})]})}function sr(){const{paperId:r=""}=Se();return a.jsx(Xe,{workspaceKey:`reader:${r}`,children:a.jsx(vt,{})})}export{sr as default,bt as readerToolbarResources}; diff --git a/assets/PaperReaderView-C7GrMxPx.js b/assets/PaperReaderView-C7GrMxPx.js new file mode 100644 index 0000000000000000000000000000000000000000..903716df4634d39e61c0e5cb1cbb2c16635de67c --- /dev/null +++ b/assets/PaperReaderView-C7GrMxPx.js @@ -0,0 +1 @@ +import{d as s,b as J,j as a,U as ee,u as Se,e as Ke,w as De,a3 as je,Z as Oe,L as Z}from"./index-DyXq7-Tg.js";import{u as Ve,R as Qe,A as Xe,c as Ze,d as Ye,a as Ge,P as Je,e as et}from"./ArtifactWorkspace-Ya79_F5k.js";import{M as tt}from"./MarkdownText-CUzPoC9Y.js";import{g as rt,a as at}from"./papers-Dh3ljlL0.js";import{w as st,e as nt}from"./paperReader-BIpQD5HO.js";import{a as ot}from"./usePapers-B0s20UcU.js";import{c as it}from"./chat-Ix1IrIwq.js";import{s as te}from"./safeExternalHref-CkBrsh84.js";import{ChatExperience as ct}from"./ChatView-D06zYumh.js";import"./chatSessions-Ck_dyM0d.js";/* empty css */import"./hover-card-B45EJIn_.js";import"./CatalogEntityPreviewLink-BktpwL3_.js";import"./catalog-CRar2olQ.js";import"./github-RNrgGHRT.js";import"./file-text-dvKtHbmD.js";import"./PaperPreviewLink-CpCZSa8K.js";import"./index-mCi_y_l3.js";import"./index-2CvJmBVB.js";import"./katex-DkKDou_j.js";import"./useMutation-UWxBeqtn.js";import"./copy-CxR0OKx2.js";import"./thumbs-up-CPLlGli7.js";import"./arrow-left-PA_b6law.js";import"./external-link-orY1Xz1I.js";import"./plus-Yh42pKZz.js";import"./search-8ssWDP68.js";import"./chevron-up-DYSYRyvz.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./curation-YeS7FBYf.js";import"./useInfiniteQuery-BYh2zN-T.js";import"./McpShowcase-CLO4HLon.js";import"./AgentLogos-j-Qekw7T.js";import"./share-2-fiavn5SS.js";import"./openrouter-o51Eagw8.js";import"./queryOptions-C9woPjwX.js";function lt(r){return r instanceof ee&&r.status===422?"This page could not be turned into a readable paper.":r instanceof ee&&r.status===503?"Paper content is still being prepared. Please try again later.":"The paper could not be loaded."}function dt({paperId:r,paperKey:i,paperTitle:o,paperHref:b,sourceUrl:d,resources:t,paperVersion:f="",selectionEnabled:v=!1,onReady:h,onPaperSelection:I,onPaperSelectionError:B}){const c=s.useRef(null),g=J({queryKey:["paperWebMarkdown",r],queryFn:()=>rt(r),staleTime:5*6e4,retry:(P,j)=>P<2&&!(j instanceof ee&&j.status<500),retryDelay:3e3}),x=g.isSuccess;s.useEffect(()=>{x&&(h==null||h())},[h,x]),Ve({enabled:v&&!!f&&x,pagesRoot:c,routeId:i,paperVersion:f,numPages:1,onSelect:I,onError:B});const S=g.data?st(g.data):"";return a.jsxs("div",{className:"pdf-viewer",children:[a.jsx(Qe,{paperTitle:o,paperHref:b,resources:t,label:"Paper controls",children:a.jsx("div",{className:"pdf-toolbar-controls",children:a.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",children:"Open original"})})}),a.jsx("div",{className:"pdf-scroll-frame",children:a.jsx("div",{className:"pdf-scroll",role:"region","aria-label":"Paper web page",children:g.isPending?a.jsx("div",{className:"pdf-loading",role:"status",children:"Preparing a readable version of this page…"}):g.isError?a.jsxs("div",{className:"pdf-error",role:"alert",children:[a.jsx("p",{children:lt(g.error)}),a.jsxs("div",{children:[a.jsx("button",{type:"button",onClick:()=>void g.refetch(),children:"Retry"})," ",a.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",children:"Open original"})]})]}):a.jsxs("article",{ref:c,className:"reader-web-document","data-page":"1",children:[!S.startsWith("# ")&&a.jsx("h1",{children:o}),a.jsx(tt,{text:S})]})})})]})}const _e=66,ut=240,re="pwc:reader:split-ratio",L=r=>`pwc:reader:session:${r}`,Y=r=>`pwc:reader:assistant-collapsed:${r}`,Ce=r=>`pwc:reader:page:${r}`;function G(r){const i=Number(sessionStorage.getItem(Ce(r)));return Number.isInteger(i)&&i>0?i:1}function pt(){const r=Number(localStorage.getItem(re));return Number.isFinite(r)&&r>=45&&r<=75?r:_e}function ft(r){const i=te(r);if(!i)return null;const o=new URL(i);return(o.hostname==="arxiv.org"||o.hostname==="www.arxiv.org")&&o.pathname.startsWith("/pdf/")&&o.pathname.endsWith(".pdf")&&(o.pathname=o.pathname.slice(0,-4)),o.href}const mt=/^\/pdf\/(\d{4}\.\d{4,5}(?:v\d{1,3})?|[a-z]+(?:-[a-z]+)*(?:\.[A-Z]{2})?\/\d{7}(?:v\d{1,3})?)$/;function ht(r){const i=new URL(r),o=i.pathname.match(mt);return(i.hostname==="arxiv.org"||i.hostname==="www.arxiv.org")&&o&&!i.search?je(`/paper-assets/arxiv-pdf/${o[1]}`)??r:r}function gt(r){return new URL(r).hostname.replace(/^www\./,"")}function bt(r){if(!r)return{};const i={};for(const d of r.repositories??[]){if(!d.is_official)continue;const t=te(d.url);if(!t)continue;const f=new URL(t),v=f.pathname.split("/").filter(Boolean);if((f.hostname==="github.com"||f.hostname==="www.github.com")&&v.length>=2){i.repository={href:t,stars:d.num_stars||0};break}}const o=[...r.project_pages??[]].sort((d,t)=>Number(t.is_official)-Number(d.is_official));for(const d of o){const t=te(d.url);if(t){i.projectPage={href:t,label:gt(t)};break}}const b=r.hf_artifact_summary?r.hf_artifact_summary.model_count+r.hf_artifact_summary.dataset_count+r.hf_artifact_summary.space_count:new Set([...r.hf_models??[],...r.hf_datasets??[],...r.hf_spaces??[]]).size;return b>0&&r.arxiv_id&&(i.huggingFace={href:`https://huggingface.co/papers/${r.arxiv_id.replace(/v\d+$/i,"")}`,count:b}),i}function vt(){var xe,we,Pe,ye,Re;const r=Ke(),{paperId:i}=Se(),o=De(i??"").replace(/v\d+$/i,""),b=ot(o,!!o),d=J({queryKey:["chatAvailability"],queryFn:()=>it.getAvailability(),refetchInterval:3e4,retry:!1}),t=b.data,f=t?nt(t):null,v=f?null:(t==null?void 0:t.source)==="external"?je(`/paper-assets/external/${t.id}/paper.pdf`):ft(t==null?void 0:t.url_pdf),h=v&&(t==null?void 0:t.source)!=="external"?ht(v):v,I=bt(t),B=s.useMemo(()=>{var e;return(e=t==null?void 0:t.author_links)==null?void 0:e.flatMap(n=>n.id?[{id:n.id,name:n.name,avatarUrl:n.hf_avatar_url}]:[])},[t==null?void 0:t.author_links]),c=((xe=t==null?void 0:t.arxiv_id)==null?void 0:xe.replace(/v\d+$/i,""))||o,g=s.useCallback(()=>r(`/paper/${c}`),[c,r]),[x,S]=s.useState(()=>sessionStorage.getItem(L(o))||void 0),[P,j]=s.useState(pt),[u,ae]=s.useState(()=>sessionStorage.getItem(Y(o))==="1"),[w,_]=s.useState("paper"),[H,C]=s.useState(),[ke,se]=s.useState(),[Ae,ne]=s.useState(!1),Ie=s.useCallback(()=>ne(!0),[]),[$e,y]=s.useState(""),[Ne,Ee]=s.useState(()=>G(o)),[k,Te]=s.useState(0),[oe,ie]=s.useState(!1),[Me,F]=s.useState(!1),$=s.useRef(null),U=s.useRef(null),N=s.useRef(null),ce=s.useRef(null),le=s.useRef(null),q=s.useRef(!1),E=s.useRef(!1),T=s.useRef(0),R=s.useRef(0),K=s.useRef(0),A=s.useRef(P),D=s.useRef(G(o)),O=s.useRef(t==null?void 0:t.version),de=Ze().reset,ue=s.useRef(`${o}:${x??"new"}`),p=k>=840;s.useEffect(()=>{const e=`${o}:${x??"new"}`;ue.current!==e&&(ue.current=e,de())},[x,de,o]),s.useEffect(()=>{t!=null&&t.version&&O.current&&t.version!==O.current&&(C(void 0),y("")),O.current=t==null?void 0:t.version},[t==null?void 0:t.version]),s.useEffect(()=>{window.clearTimeout(T.current),F(!1);const e=sessionStorage.getItem(L(o));S(e||void 0),ae(sessionStorage.getItem(Y(o))==="1"),_("paper"),ne(!1),C(void 0),se(void 0),y("");const n=G(o);D.current=n,Ee(n)},[o]),s.useEffect(()=>()=>{window.clearTimeout(T.current),cancelAnimationFrame(R.current)},[]),s.useLayoutEffect(()=>{const e=$.current;if(!e)return;const n=()=>Te(e.clientWidth);n();const l=new ResizeObserver(n);return l.observe(e),()=>l.disconnect()},[t]),s.useEffect(()=>{if(!t)return;document.title=`${t.title} — Papers With Code reader`;let e=document.querySelector('meta[name="robots"]');const n=!e;e||(e=document.createElement("meta"),e.name="robots",document.head.appendChild(e));const l=e.content;e.content="noindex, nofollow";let m=document.querySelector('link[rel="canonical"]');const Ue=!m;m||(m=document.createElement("link"),m.rel="canonical",document.head.appendChild(m));const qe=m.href;return m.href=`${window.location.origin}/paper/${c}`,()=>{document.title="Papers With Code",n?e==null||e.remove():e&&(e.content=l),Ue?m==null||m.remove():m&&(m.href=qe)}},[c,t]);const M=s.useCallback(e=>{if(!k)return Math.max(45,Math.min(75,e));const n=480/k*100,l=100-360/k*100;return Math.max(n,Math.min(l,e))},[k]);s.useEffect(()=>j(e=>{const n=M(e);return A.current=n,n}),[M]);const W=e=>{const n=M(e);A.current=n,j(n),localStorage.setItem(re,String(n))},pe=e=>{var l;const n=M(e);A.current=n,U.current&&(U.current.style.width=`${n}%`),N.current&&(N.current.style.width=`${100-n}%`),(l=ce.current)==null||l.setAttribute("aria-valuenow",String(Math.round(n)))},fe=e=>{K.current=e,!R.current&&(R.current=requestAnimationFrame(()=>{var l;R.current=0;const n=(l=$.current)==null?void 0:l.getBoundingClientRect();n!=null&&n.width&&pe((K.current-n.left)/n.width*100)}))},We=e=>{E.current=!0,ie(!0),e.currentTarget.setPointerCapture(e.pointerId),fe(e.clientX)},V=()=>{var e;if(E.current){if(R.current){cancelAnimationFrame(R.current),R.current=0;const n=(e=$.current)==null?void 0:e.getBoundingClientRect();n!=null&&n.width&&pe((K.current-n.left)/n.width*100)}E.current=!1,j(A.current),localStorage.setItem(re,String(A.current)),ie(!1)}},me=e=>{window.clearTimeout(T.current),F(!0),ae(e),sessionStorage.setItem(Y(o),e?"1":"0"),T.current=window.setTimeout(()=>F(!1),ut+40)},he=e=>{q.current=!0,me(e)};s.useEffect(()=>{var e;q.current&&(q.current=!1,(e=u?le.current:N.current)==null||e.focus())},[u]);const ze=e=>{S(e),sessionStorage.setItem(L(o),e)},Le=()=>{S(void 0),sessionStorage.removeItem(L(o)),C(void 0),y("")},ge=((we=d.data)==null?void 0:we.paper_reader_selection_enabled)===!0,be=e=>{C(e),y(`Selection from page ${e.page} added to chat`),p&&u&&me(!1)},Be=s.useCallback(e=>{C(e),e||y("")},[]),Q=((Pe=d.data)==null?void 0:Pe.paper_reader_citations_enabled)===!0&&!!h,z=J({queryKey:["paper-layout",c],queryFn:()=>at(c),enabled:Q&&!!c,staleTime:5*6e4}).data,He=s.useMemo(()=>Q?{layout:z,open:e=>{const n=z?Ye(z,e):[];n.length&&(se(l=>({boxes:n,nonce:((l==null?void 0:l.nonce)??0)+1})),_("paper"))}}:null,[Q,z]),ve=Oe()&&((ye=d.data)==null?void 0:ye.paper_reader_chat_enabled)!==!1,X=!!(t&&ve&&!(f&&!Ae)),Fe=t&&ve&&!X?a.jsx("div",{className:"reader-chat-unavailable",role:"status",children:"Chat opens once the paper is ready."}):t&&X?a.jsx(ct,{mode:"paper",routeSessionId:x,primaryPaper:{id:t.id,routeId:c,title:t.title},currentPage:()=>D.current,paperSelection:H,onPaperSelectionChange:Be,onSessionId:ze,onReaderSubmit:()=>_("assistant"),onReaderNewChat:Le,onReaderClose:p?()=>he(!0):void 0}):a.jsx("div",{className:"reader-chat-unavailable",children:"Chat is not enabled for this preview."});return b.isLoading?a.jsx("div",{className:"reader-status",role:"status",children:"Loading paper…"}):b.error||!t?a.jsxs("div",{className:"reader-status",role:"alert",children:[a.jsx("p",{children:"Paper not found."}),a.jsx(Z,{to:"/papers",children:"Browse papers"})]}):((Re=d.data)==null?void 0:Re.native_pdf_reader_enabled)===!1?a.jsxs("div",{className:"reader-status",role:"alert",children:[a.jsx("p",{children:"The native reader is currently unavailable."}),a.jsx(Z,{to:`/paper/${c}`,children:"Back to paper"})]}):!h&&!f?a.jsxs("div",{className:"reader-status",role:"alert",children:[a.jsx("p",{children:"Native reading is unavailable for this resource."}),a.jsx(Z,{to:`/paper/${c}`,children:"Back to paper"})]}):a.jsxs("div",{className:"paper-reader-shell",children:[!p&&a.jsxs("div",{className:"reader-tabs",role:"tablist","aria-label":"Reader panels",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":w==="paper",onClick:()=>_("paper"),children:"Paper"}),a.jsxs("button",{type:"button",role:"tab","aria-selected":w==="assistant","aria-label":H&&w!=="assistant"?"Chat, selection attached":"Chat",onClick:()=>_("assistant"),children:["Chat",H&&w!=="assistant"&&a.jsx("span",{className:"reader-tab-pending","aria-hidden":"true"})]})]}),a.jsx(Ge,{variant:"reader",children:a.jsxs("div",{ref:$,className:`reader-workspace${p?" is-desktop":" is-tabs"}${u?" is-assistant-collapsed":""}${oe?" is-resizing":""}`,"data-testid":"paper-chat-workspace",children:[a.jsx("section",{ref:U,className:`reader-paper-pane${!p&&w!=="paper"?" is-hidden":""}`,style:p?{width:u?"100%":`${P}%`}:void 0,role:"tabpanel","aria-label":"Paper","aria-hidden":!p&&w!=="paper",children:f?a.jsx(dt,{paperId:t.id,paperKey:c,paperTitle:t.title,paperHref:`/paper/${c}`,sourceUrl:f,resources:I,paperVersion:t.version,selectionEnabled:ge,onReady:Ie,onPaperSelection:be,onPaperSelectionError:y}):h&&a.jsx(Je,{url:h,downloadUrl:v??h,paperKey:c,paperTitle:t.title,paperHref:`/paper/${c}`,onClose:g,resources:I,initialPage:Ne,resizeActive:oe||Me,selectionEnabled:ge,paperVersion:t.version,authors:B,loadErrorMessage:t.source==="external"?"Paper content is still being prepared. Please try again later.":void 0,onPaperSelection:be,onPaperSelectionError:y,highlight:ke,onPageChange:e=>{D.current=e,sessionStorage.setItem(Ce(o),String(e))}})}),p&&!u&&a.jsx("div",{ref:ce,className:"reader-resize-handle",role:"separator","aria-label":"Resize paper and Chat panels","aria-orientation":"vertical","aria-valuemin":45,"aria-valuemax":75,"aria-valuenow":Math.round(P),tabIndex:0,onPointerDown:We,onPointerMove:e=>{E.current&&fe(e.clientX)},onPointerUp:V,onPointerCancel:V,onLostPointerCapture:V,onDoubleClick:()=>W(_e),onKeyDown:e=>{(e.key==="ArrowLeft"||e.key==="ArrowRight")&&(e.preventDefault(),W(P+(e.key==="ArrowRight"?2:-2))),e.key==="Home"&&W(45),e.key==="End"&&W(75)}}),a.jsx("aside",{ref:N,id:"reader-chat-panel",className:`reader-assistant-pane${!p&&w!=="assistant"?" is-hidden":""}${p&&u?" is-collapsed":""}`,style:p?{width:u?0:`${100-P}%`}:void 0,role:"tabpanel","aria-label":"Chat","aria-hidden":!p&&w!=="assistant"||u,tabIndex:-1,children:a.jsx(et.Provider,{value:He,children:Fe})}),a.jsx("div",{className:"sr-only","aria-live":"polite",children:$e}),p&&(u||!X)&&a.jsx("button",{ref:le,type:"button",className:"reader-collapse-assistant","aria-controls":"reader-chat-panel","aria-expanded":!u,onClick:()=>he(!u),children:u?"Open chat":"Hide chat"})]})})]})}function ar(){const{paperId:r=""}=Se();return a.jsx(Xe,{workspaceKey:`reader:${r}`,children:a.jsx(vt,{})})}export{ar as default,bt as readerToolbarResources}; diff --git a/assets/PapersListView-BwwaBBb8.js b/assets/PapersListView-BwwaBBb8.js new file mode 100644 index 0000000000000000000000000000000000000000..357d44ccebf4f25e9566d60f8cdf1df4cf18ab8a --- /dev/null +++ b/assets/PapersListView-BwwaBBb8.js @@ -0,0 +1 @@ +import{d as f,p as M,b as K,j as e,L as x,l as V,o as X,T as J}from"./index-DyXq7-Tg.js";import{T as W}from"./SotaBadges-vbLLOUtT.js";import{I as H}from"./Icon-T4LYkEQj.js";import{u as Y,P as Z,b as ee,c as se,a as re}from"./PaperFeed-EBt97iOL.js";import{c as ae}from"./catalog-CRar2olQ.js";import{p as O}from"./papers-Dh3ljlL0.js";import{t as te,d as ne}from"./transform-D46m70Qr.js";import{u as Q}from"./usePapers-B0s20UcU.js";import{u as ie}from"./useDebounce-B9jkN7LV.js";import{S as oe}from"./skeleton-C3IIzpSL.js";import{A as le,a as ce}from"./alert-gbJBhAVE.js";import{i as de}from"./apiErrors-BSvbQBb0.js";import{f as me}from"./frameworks-DDA0P4Tf.js";import"./colors-BkWRhvFI.js";import"./PaperCard-57p1OSGy.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./LatexTitle-Bkyz3jCs.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-CTBEUp7Y.js";import"./useIntersectionObserver-D6_Iig9a.js";import"./curation-YeS7FBYf.js";import"./useInfiniteQuery-BYh2zN-T.js";const g=360;function pe(r,t){const c=r.toLocaleLowerCase();return t.trim().split(/\s+/).filter(Boolean).reduce((i,l)=>{const o=c.indexOf(l.toLocaleLowerCase());return o>=0&&(i<0||o=0?l+1:t}function he(r,t){if(r.length<=g)return r;const c=pe(r,t);if(c<0||c0?"…":""}${r.slice(i,l).trim()}${l{var L,R,T,D,$,A,I,B,q;const r=Y(),{searchParams:t,setSearchParams:c}=r,i=t.get("framework")||void 0,l=t.get("repository")||void 0,o=!!(i||l),d=t.get("search")||"",[b,F]=f.useState(d),h=ie(b,300),n=!o&&d.trim().length>0;f.useEffect(()=>F(d),[d]),f.useEffect(()=>{if(h===d)return;const a=new URLSearchParams(t);h?a.set("search",h):a.delete("search"),c(a,{replace:!0})},[h]),f.useEffect(()=>{const a=t.get("order_by"),m=new URLSearchParams(t);n&&!["relevance","date_published","citation_count"].includes(a||"")?(m.set("order_by","relevance"),c(m,{replace:!0})):!n&&a==="relevance"&&(m.delete("order_by"),c(m,{replace:!0}))},[n,t,c]);const j=n&&r.orderBy==="trending"?"relevance":r.orderBy,S=!o&&r.hasCode,P={...r.filters,has_code:S,search:o&&h||void 0,conference:t.get("conference")||void 0,latest_only:t.get("latest_only")!=="false",framework:i,repository:l},k=Q([...M.feeds.infinite,P],a=>O.list({...P,page:a,page_size:20}),{enabled:!n}),_={q:h.trim(),order_by:j==="trending"?"relevance":j,start_date:r.dateRange.startDate,end_date:r.dateRange.endDate,has_code:S,has_hf_artifacts:r.hasHfArtifacts},E=Q([...M.feeds.search,_],a=>O.searchFeed({..._,page:a,page_size:20,mode:"hybrid"}),{enabled:n&&_.q.length>0}),p=n?E:k,C=K({queryKey:X.topTasksSidebar,queryFn:()=>ae.topTasks(8),enabled:!o&&!n,staleTime:J}),v=f.useMemo(()=>{var m;return(((m=p.data)==null?void 0:m.pages.flatMap(N=>N.results))||[]).map(N=>{const w=te(N);return n?{...w,abstract:he(w.abstract,d)}:w})},[p.data,n,d]),u=((T=(R=(L=k.data)==null?void 0:L.pages)==null?void 0:R[0])==null?void 0:T.count)??0,s=(A=($=(D=k.data)==null?void 0:D.pages)==null?void 0:$[0])==null?void 0:A.scope,y=(B=(I=E.data)==null?void 0:I.pages)==null?void 0:B.at(-1),G=i&&de(p.error),U=(s==null?void 0:s.kind)==="framework"?s.framework_name:s==null?void 0:s.repository;return e.jsxs("div",{className:"page",children:[(s==null?void 0:s.kind)==="framework"&&e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(x,{to:"/",children:"Papers"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx(x,{to:"/frameworks",children:"Frameworks"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:s.framework_name})]}),e.jsxs("div",{className:"feed-header",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"feed-title",children:o?e.jsxs(e.Fragment,{children:["Papers implemented by ",e.jsx("em",{children:U||i||l})]}):n?e.jsxs(e.Fragment,{children:["Search results for ",e.jsxs("em",{children:["“",d,"”"]})]}):e.jsxs(e.Fragment,{children:["All ",e.jsx("em",{children:"Papers"})]})}),e.jsx("div",{className:"feed-subtitle",children:o?(s==null?void 0:s.kind)==="framework"?u>0&&`${u.toLocaleString()} papers.`:s!=null&&s.repository?e.jsxs(e.Fragment,{children:["GitHub repository ",e.jsx("strong",{children:s.repository}),". ",u>0&&`${u.toLocaleString()} papers.`]}):"Repository-scoped paper feed.":n?`${v.length} loaded from the most relevant results.`:e.jsxs(e.Fragment,{children:["Search the full corpus. ",u>0&&`${u.toLocaleString()} papers indexed.`]})}),o&&s&&e.jsxs("div",{className:"paper-feed-scope-links",children:[e.jsxs("div",{className:"paper-feed-primary-links",children:[s.github_url&&e.jsxs("a",{href:s.github_url,target:"_blank",rel:"noopener noreferrer",className:s.kind==="framework"?"task-framework-link":"framework-link",children:[e.jsx(H,{name:"github",size:13}),s.kind==="framework"?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:s.repository||"GitHub"}),s.num_stars!=null&&e.jsxs("span",{className:"task-framework-link-stars",children:["★ ",me(s.num_stars)]})]}):"GitHub"]}),s.kind==="framework"&&s.introducing_paper_arxiv_id&&e.jsx(x,{to:`/paper/${s.introducing_paper_arxiv_id}`,className:"framework-link",children:"Introducing paper"})]}),s.kind==="framework"&&s.recommended_tasks&&s.recommended_tasks.length>0&&e.jsx("div",{className:"paper-feed-task-tags",children:s.recommended_tasks.map(a=>a.slug?e.jsx(W,{slug:a.slug,label:a.name},a.id):null)})]})]}),e.jsx(Z,{startDate:r.dateRange.startDate,endDate:r.dateRange.endDate,onChange:r.setDateRange})]}),e.jsx("div",{className:"papers-search-row",children:e.jsxs("div",{className:"papers-search-input-wrap",children:[e.jsx(H,{name:"search",size:14}),e.jsx("input",{className:"papers-search-input",placeholder:"Search title or abstract…",value:b,onChange:a=>F(a.target.value)})]})}),e.jsxs("div",{className:o||n?"papers-feed-layout-scoped":"layout-with-sidebar",children:[!o&&!n&&e.jsx("aside",{className:"sidebar",children:e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Top Domains"}),C.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((a,m)=>e.jsx(oe,{className:"h-5 w-full"},m))}),e.jsx("div",{className:"sidebar-links",children:(q=C.data)==null?void 0:q.map(a=>e.jsxs(x,{to:`/tasks/${a.slug}`,className:"sidebar-link",children:[ne(a.name,a.slug),a.paper_count!=null&&e.jsx("span",{className:"count",children:a.paper_count})]},a.id))})]})}),e.jsxs("div",{children:[e.jsx(ee,{feed:r,sorts:n?ue:se,activeSort:j,showDateFilter:!1,showHasCode:!o,children:e.jsxs("div",{className:"results-count",children:[v.length," loaded"]})}),G?e.jsx("div",{className:"no-results",children:"Framework not found."}):e.jsxs(e.Fragment,{children:[p.error&&e.jsx(le,{variant:"destructive",className:"mb-4",children:e.jsx(ce,{children:"Failed to load papers. Please try again."})}),e.jsx(re,{query:p,cards:v,skeleton:"card",highlightQuery:n?d:void 0,empty:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"No matching papers."}),n&&V()&&e.jsx(x,{to:`/chat?q=${encodeURIComponent(d.trim())}`,children:"Ask the assistant instead"})]}),children:!p.hasNextPage&&!p.isFetchingNextPage&&n&&e.jsx("div",{className:"search-results-end",children:y!=null&&y.cap_reached?"End of the top 100 results":"End of results"})})]})]})]})]})};export{Ie as default}; diff --git a/assets/PapersListView-DhkGuTns.js b/assets/PapersListView-DhkGuTns.js deleted file mode 100644 index 465be1c8cdbc3d866ab41acd451d754fb830e67d..0000000000000000000000000000000000000000 --- a/assets/PapersListView-DhkGuTns.js +++ /dev/null @@ -1 +0,0 @@ -import{r as f,j as e,L as x,g as K}from"./index-CbgxfyGU.js";import{T as V}from"./SotaBadges-C-sTR-EF.js";import{I as H}from"./Icon-D-kA0Owz.js";import{u as X,P as J,b as W,c as Y,a as Z}from"./PaperFeed-DMvUfA47.js";import{c as ee}from"./catalog-DhK7_9-6.js";import{a as M,p as O}from"./paperQueryKeys-B8u1BWlI.js";import{t as re,d as se}from"./transform-0Udg2p6b.js";import{u as z}from"./usePapers-CJaWLZ3y.js";import{u as ae}from"./useDebounce-DkuI5tkx.js";import{S as te}from"./skeleton-HwvdxvSN.js";import{A as ne,a as ie}from"./alert-CFDDvdIM.js";import{u as oe}from"./useQuery-Bx9s5-D2.js";import{i as le}from"./apiErrors-BZ5h1Kmb.js";import{f as ce}from"./frameworks-DDA0P4Tf.js";import"./colors-BkWRhvFI.js";import"./PaperCard-tdTC_dRN.js";import"./AuthorAvatar-CUJMmp_z.js";import"./LatexTitle-Z-HGmZ-H.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-DKJYnYjk.js";import"./useIntersectionObserver-CID9Kkak.js";import"./curation-C7Gmmp4z.js";import"./useInfiniteQuery-BAc_4HO5.js";const g=360;function de(s,t){const c=s.toLocaleLowerCase();return t.trim().split(/\s+/).filter(Boolean).reduce((i,l)=>{const o=c.indexOf(l.toLocaleLowerCase());return o>=0&&(i<0||o=0?l+1:t}function me(s,t){if(s.length<=g)return s;const c=de(s,t);if(c<0||c0?"…":""}${s.slice(i,l).trim()}${l{var L,R,D,$,T,A,B,I,q;const s=X(),{searchParams:t,setSearchParams:c}=s,i=t.get("framework")||void 0,l=t.get("repository")||void 0,o=!!(i||l),d=t.get("search")||"",[b,F]=f.useState(d),h=ae(b,300),n=!o&&d.trim().length>0;f.useEffect(()=>F(d),[d]),f.useEffect(()=>{if(h===d)return;const a=new URLSearchParams(t);h?a.set("search",h):a.delete("search"),c(a,{replace:!0})},[h]),f.useEffect(()=>{const a=t.get("order_by"),m=new URLSearchParams(t);n&&!["relevance","date_published","citation_count"].includes(a||"")?(m.set("order_by","relevance"),c(m,{replace:!0})):!n&&a==="relevance"&&(m.delete("order_by"),c(m,{replace:!0}))},[n,t,c]);const j=n&&s.orderBy==="trending"?"relevance":s.orderBy,S=!o&&s.hasCode,P={...s.filters,has_code:S,search:o&&h||void 0,conference:t.get("conference")||void 0,latest_only:t.get("latest_only")!=="false",framework:i,repository:l},k=z([...O.feeds.infinite,P],a=>M.list({...P,page:a,page_size:20}),{enabled:!n}),_={q:h.trim(),order_by:j==="trending"?"relevance":j,start_date:s.dateRange.startDate,end_date:s.dateRange.endDate,has_code:S,has_hf_artifacts:s.hasHfArtifacts},C=z([...O.feeds.search,_],a=>M.searchFeed({..._,page:a,page_size:20,mode:"hybrid"}),{enabled:n&&_.q.length>0}),p=n?C:k,E=oe({queryKey:["top-tasks-sidebar"],queryFn:()=>ee.topTasks(8),enabled:!o&&!n,staleTime:10*60*1e3}),v=f.useMemo(()=>{var m;return(((m=p.data)==null?void 0:m.pages.flatMap(N=>N.results))||[]).map(N=>{const w=re(N);return n?{...w,abstract:me(w.abstract,d)}:w})},[p.data,n,d]),u=((D=(R=(L=k.data)==null?void 0:L.pages)==null?void 0:R[0])==null?void 0:D.count)??0,r=(A=(T=($=k.data)==null?void 0:$.pages)==null?void 0:T[0])==null?void 0:A.scope,y=(I=(B=C.data)==null?void 0:B.pages)==null?void 0:I.at(-1),Q=i&&le(p.error),U=(r==null?void 0:r.kind)==="framework"?r.framework_name:r==null?void 0:r.repository;return e.jsxs("div",{className:"page",children:[(r==null?void 0:r.kind)==="framework"&&e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(x,{to:"/",children:"Papers"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx(x,{to:"/frameworks",children:"Frameworks"}),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--ink)"},children:r.framework_name})]}),e.jsxs("div",{className:"feed-header",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"feed-title",children:o?e.jsxs(e.Fragment,{children:["Papers implemented by ",e.jsx("em",{children:U||i||l})]}):n?e.jsxs(e.Fragment,{children:["Search results for ",e.jsxs("em",{children:["“",d,"”"]})]}):e.jsxs(e.Fragment,{children:["All ",e.jsx("em",{children:"Papers"})]})}),e.jsx("div",{className:"feed-subtitle",children:o?(r==null?void 0:r.kind)==="framework"?u>0&&`${u.toLocaleString()} papers.`:r!=null&&r.repository?e.jsxs(e.Fragment,{children:["GitHub repository ",e.jsx("strong",{children:r.repository}),". ",u>0&&`${u.toLocaleString()} papers.`]}):"Repository-scoped paper feed.":n?`${v.length} loaded from the most relevant results.`:e.jsxs(e.Fragment,{children:["Search the full corpus. ",u>0&&`${u.toLocaleString()} papers indexed.`]})}),o&&r&&e.jsxs("div",{className:"paper-feed-scope-links",children:[e.jsxs("div",{className:"paper-feed-primary-links",children:[r.github_url&&e.jsxs("a",{href:r.github_url,target:"_blank",rel:"noopener noreferrer",className:r.kind==="framework"?"task-framework-link":"framework-link",children:[e.jsx(H,{name:"github",size:13}),r.kind==="framework"?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:r.repository||"GitHub"}),r.num_stars!=null&&e.jsxs("span",{className:"task-framework-link-stars",children:["★ ",ce(r.num_stars)]})]}):"GitHub"]}),r.kind==="framework"&&r.introducing_paper_arxiv_id&&e.jsx(x,{to:`/paper/${r.introducing_paper_arxiv_id}`,className:"framework-link",children:"Introducing paper"})]}),r.kind==="framework"&&r.recommended_tasks&&r.recommended_tasks.length>0&&e.jsx("div",{className:"paper-feed-task-tags",children:r.recommended_tasks.map(a=>a.slug?e.jsx(V,{slug:a.slug,label:a.name},a.id):null)})]})]}),e.jsx(J,{startDate:s.dateRange.startDate,endDate:s.dateRange.endDate,onChange:s.setDateRange})]}),e.jsx("div",{className:"papers-search-row",children:e.jsxs("div",{className:"papers-search-input-wrap",children:[e.jsx(H,{name:"search",size:14}),e.jsx("input",{className:"papers-search-input",placeholder:"Search title or abstract…",value:b,onChange:a=>F(a.target.value)})]})}),e.jsxs("div",{className:o||n?"papers-feed-layout-scoped":"layout-with-sidebar",children:[!o&&!n&&e.jsx("aside",{className:"sidebar",children:e.jsxs("div",{className:"sidebar-section",children:[e.jsx("div",{className:"sidebar-label",children:"Top Domains"}),E.isLoading&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:6}).map((a,m)=>e.jsx(te,{className:"h-5 w-full"},m))}),e.jsx("div",{className:"sidebar-links",children:(q=E.data)==null?void 0:q.map(a=>e.jsxs(x,{to:`/tasks/${a.slug}`,className:"sidebar-link",children:[se(a.name,a.slug),a.paper_count!=null&&e.jsx("span",{className:"count",children:a.paper_count})]},a.id))})]})}),e.jsxs("div",{children:[e.jsx(W,{feed:s,sorts:n?pe:Y,activeSort:j,showDateFilter:!1,showHasCode:!o,children:e.jsxs("div",{className:"results-count",children:[v.length," loaded"]})}),Q?e.jsx("div",{className:"no-results",children:"Framework not found."}):e.jsxs(e.Fragment,{children:[p.error&&e.jsx(ne,{variant:"destructive",className:"mb-4",children:e.jsx(ie,{children:"Failed to load papers. Please try again."})}),e.jsx(Z,{query:p,cards:v,skeleton:"card",highlightQuery:n?d:void 0,empty:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"No matching papers."}),n&&K()&&e.jsx(x,{to:`/chat?q=${encodeURIComponent(d.trim())}`,children:"Ask the assistant instead"})]}),children:!p.hasNextPage&&!p.isFetchingNextPage&&n&&e.jsx("div",{className:"search-results-end",children:y!=null&&y.cap_reached?"End of the top 100 results":"End of results"})})]})]})]})]})};export{Ae as default}; diff --git a/assets/PrivacyView-BQ3x7IFA.js b/assets/PrivacyView-BQ3x7IFA.js new file mode 100644 index 0000000000000000000000000000000000000000..1c4a87e7ddaa05774286620162249554c109d48d --- /dev/null +++ b/assets/PrivacyView-BQ3x7IFA.js @@ -0,0 +1 @@ +import{j as e}from"./index-DyXq7-Tg.js";import{u as s,f as i}from"./useDocumentTitle-DcxM2Zv_.js";const t=()=>(s(i("Privacy Policy")),e.jsxs("article",{className:"page legal-page",children:[e.jsxs("header",{className:"legal-header",children:[e.jsx("p",{className:"legal-kicker",children:"Legal"}),e.jsx("h1",{children:"Privacy Policy"}),e.jsx("p",{className:"legal-effective-date",children:"Effective August 11, 2026"})]}),e.jsx("p",{children:"This Privacy Policy explains how Hugging Face, Inc. (“Hugging Face,” “we,” or “us”) collects, uses, and shares information when you use Papers With Code, including its website, research assistant, APIs, and related services (the “Service”)."}),e.jsxs("section",{children:[e.jsx("h2",{children:"1. Information we collect"}),e.jsx("h3",{children:"Information you provide"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Account information."})," If you sign in with Hugging Face, we receive account identifiers and profile details needed to authenticate you, such as your user ID, username, and avatar. If you request contributor access, we also receive and retain the verified email address associated with your Hugging Face account so we can review and communicate about your request."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Contributions and preferences."})," We collect information you submit or save, such as paper submissions and edits, bookmarks, display preferences, feedback, and communications with us. Material you submit to a public research page may be publicly visible."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Research assistant content."})," We collect your questions, conversation history, generated answers, citations, tool calls and results, and feedback about answers. Chats are private to your account unless you choose to create a share link; anyone with that link may be able to view the shared chat."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Provider and billing information."})," If you enable a model provider, we process the authorization or API credentials needed to make requests on your behalf. Hugging Face or another provider processes its own billing information under its terms. Papers With Code does not collect your payment-card details."]})]}),e.jsx("h3",{children:"Information collected automatically"}),e.jsx("p",{children:"We collect technical and usage information such as IP address, browser and device type, operating system, pages or features used, dates and times, referring pages, request identifiers, cookies, logs, and diagnostic data. For research-assistant requests, this may include the selected model, token and cost details, latency, errors, and other operational metadata."}),e.jsx("h3",{children:"Research assistant tracing"}),e.jsxs("p",{children:["To evaluate, debug, secure, and improve the research assistant, we use Langfuse to record traces. A trace may contain the complete text of your question and the assistant's answer, as well as tool inputs, tool outputs, retrieved research material, model details, usage data, and related operational metadata.",e.jsx("strong",{children:" This trace content is not redacted before it is sent to Langfuse."})]}),e.jsx("p",{children:"Papers With Code is designed for questions about research literature. Do not put passwords, API keys, confidential information, health or financial data, or other sensitive personal information in research-assistant prompts."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"2. How we use information"}),e.jsx("p",{children:"We use information to:"}),e.jsxs("ul",{children:[e.jsx("li",{children:"provide, personalize, maintain, and operate the Service;"}),e.jsx("li",{children:"authenticate users and keep accounts and the Service secure;"}),e.jsx("li",{children:"run research-assistant requests and preserve conversation history;"}),e.jsx("li",{children:"measure performance, troubleshoot failures, and improve quality;"}),e.jsx("li",{children:"review contributions, prevent abuse, and enforce applicable terms;"}),e.jsx("li",{children:"communicate with you and respond to requests; and"}),e.jsx("li",{children:"comply with law and protect users, Hugging Face, and the public."})]})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"3. How we share information"}),e.jsx("p",{children:"We may share information in these circumstances:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Service providers."})," Vendors process information for hosting, authentication, analytics, observability, security, and support. These include Hugging Face services, Langfuse for research-assistant tracing, Plausible for website analytics, and infrastructure providers."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Model providers."})," Research-assistant content is sent to the model provider you use, such as Hugging Face Inference Providers or OpenRouter, so it can generate a response. That provider's privacy terms also apply to its processing."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Public and shared content."})," Contributions intended for public pages are public. A chat is disclosed through the Service when you create and distribute a share link."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Legal, safety, and corporate events."})," We may disclose information when reasonably necessary to comply with law, protect rights and safety, investigate abuse, or complete a merger, acquisition, financing, or transfer of assets."]})]}),e.jsx("p",{children:"We do not sell your personal information."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"4. Cookies and analytics"}),e.jsx("p",{children:"We use cookies and similar storage when needed for sign-in, security, preferences, and operation of the Service. We also use Plausible to understand aggregate website usage. You can control cookies through your browser, but disabling necessary cookies may prevent account features from working."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"5. Legal bases"}),e.jsx("p",{children:"Where applicable law requires a legal basis, we process information as needed to perform our agreement with you, with your consent, to comply with legal obligations, and for legitimate interests such as operating, securing, and improving the Service. You may withdraw consent where consent is the basis for processing, without affecting earlier processing."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"6. Retention and deletion"}),e.jsx("p",{children:"Private chats are retained until you delete them, subject to limits of 500 active chats and 100 MB of chat data per user. Archiving hides a chat and frees active-chat quota but does not delete it. You may deliberately share an unlisted snapshot; deleting its private chat removes the durable transcript, workspace reference, and share link after deletion is verified. No dedicated private-chat export format is currently offered."}),e.jsx("p",{children:"We keep information for as long as reasonably needed for the purposes described here, including providing the Service, maintaining security and audit records, resolving disputes, and meeting legal obligations. Retention periods vary by data type and service provider. You can delete individual chats in the Service. Deletion may not immediately remove information from backups, security logs, or third-party systems where limited retention is required."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"7. Security and international transfers"}),e.jsx("p",{children:"We use reasonable administrative, technical, and organizational safeguards, but no internet service can guarantee absolute security. We and our service providers may process information in the United States and other countries, which may have different data-protection laws from your country. Where required, we use appropriate safeguards for international transfers."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"8. Your privacy rights"}),e.jsx("p",{children:"Depending on where you live, you may have rights to access, correct, delete, or receive a copy of your personal information; object to or restrict processing; withdraw consent; or appeal a decision about a request. You may also have the right to complain to a data-protection authority. We may need to verify your identity before fulfilling a request."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"9. Children"}),e.jsx("p",{children:"The Service is not directed to children under 13, and we do not knowingly collect personal information from children under 13. If you believe a child has provided personal information, please contact us."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"10. Changes to this policy"}),e.jsx("p",{children:"We may update this policy as the Service changes. We will post the revised policy here and update its effective date. If a change is material, we will provide additional notice when appropriate."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"11. Contact us"}),e.jsxs("p",{children:["For questions or privacy requests, contact"," ",e.jsx("a",{href:"mailto:privacy@huggingface.co",children:"privacy@huggingface.co"}),". Please do not include passwords, API keys, or other sensitive credentials in your message."]})]})]}));export{t as default}; diff --git a/assets/PrivacyView-CodFIqUq.js b/assets/PrivacyView-CodFIqUq.js deleted file mode 100644 index 232fb279614267d7343c6e0ca303d6ba01b75d53..0000000000000000000000000000000000000000 --- a/assets/PrivacyView-CodFIqUq.js +++ /dev/null @@ -1 +0,0 @@ -import{M as s,j as e}from"./index-CbgxfyGU.js";import{f as i,D as r}from"./latexPlainText-DI8YEXVe.js";const n=()=>(s.useEffect(()=>(document.title=i("Privacy Policy"),()=>{document.title=r}),[]),e.jsxs("article",{className:"page legal-page",children:[e.jsxs("header",{className:"legal-header",children:[e.jsx("p",{className:"legal-kicker",children:"Legal"}),e.jsx("h1",{children:"Privacy Policy"}),e.jsx("p",{className:"legal-effective-date",children:"Effective August 11, 2026"})]}),e.jsx("p",{children:"This Privacy Policy explains how Hugging Face, Inc. (“Hugging Face,” “we,” or “us”) collects, uses, and shares information when you use Papers With Code, including its website, research assistant, APIs, and related services (the “Service”)."}),e.jsxs("section",{children:[e.jsx("h2",{children:"1. Information we collect"}),e.jsx("h3",{children:"Information you provide"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Account information."})," If you sign in with Hugging Face, we receive account identifiers and profile details needed to authenticate you, such as your user ID, username, and avatar. If you request contributor access, we also receive and retain the verified email address associated with your Hugging Face account so we can review and communicate about your request."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Contributions and preferences."})," We collect information you submit or save, such as paper submissions and edits, bookmarks, display preferences, feedback, and communications with us. Material you submit to a public research page may be publicly visible."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Research assistant content."})," We collect your questions, conversation history, generated answers, citations, tool calls and results, and feedback about answers. Chats are private to your account unless you choose to create a share link; anyone with that link may be able to view the shared chat."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Provider and billing information."})," If you enable a model provider, we process the authorization or API credentials needed to make requests on your behalf. Hugging Face or another provider processes its own billing information under its terms. Papers With Code does not collect your payment-card details."]})]}),e.jsx("h3",{children:"Information collected automatically"}),e.jsx("p",{children:"We collect technical and usage information such as IP address, browser and device type, operating system, pages or features used, dates and times, referring pages, request identifiers, cookies, logs, and diagnostic data. For research-assistant requests, this may include the selected model, token and cost details, latency, errors, and other operational metadata."}),e.jsx("h3",{children:"Research assistant tracing"}),e.jsxs("p",{children:["To evaluate, debug, secure, and improve the research assistant, we use Langfuse to record traces. A trace may contain the complete text of your question and the assistant's answer, as well as tool inputs, tool outputs, retrieved research material, model details, usage data, and related operational metadata.",e.jsx("strong",{children:" This trace content is not redacted before it is sent to Langfuse."})]}),e.jsx("p",{children:"Papers With Code is designed for questions about research literature. Do not put passwords, API keys, confidential information, health or financial data, or other sensitive personal information in research-assistant prompts."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"2. How we use information"}),e.jsx("p",{children:"We use information to:"}),e.jsxs("ul",{children:[e.jsx("li",{children:"provide, personalize, maintain, and operate the Service;"}),e.jsx("li",{children:"authenticate users and keep accounts and the Service secure;"}),e.jsx("li",{children:"run research-assistant requests and preserve conversation history;"}),e.jsx("li",{children:"measure performance, troubleshoot failures, and improve quality;"}),e.jsx("li",{children:"review contributions, prevent abuse, and enforce applicable terms;"}),e.jsx("li",{children:"communicate with you and respond to requests; and"}),e.jsx("li",{children:"comply with law and protect users, Hugging Face, and the public."})]})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"3. How we share information"}),e.jsx("p",{children:"We may share information in these circumstances:"}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Service providers."})," Vendors process information for hosting, authentication, analytics, observability, security, and support. These include Hugging Face services, Langfuse for research-assistant tracing, Plausible for website analytics, and infrastructure providers."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Model providers."})," Research-assistant content is sent to the model provider you use, such as Hugging Face Inference Providers or OpenRouter, so it can generate a response. That provider's privacy terms also apply to its processing."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Public and shared content."})," Contributions intended for public pages are public. A chat is disclosed through the Service when you create and distribute a share link."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Legal, safety, and corporate events."})," We may disclose information when reasonably necessary to comply with law, protect rights and safety, investigate abuse, or complete a merger, acquisition, financing, or transfer of assets."]})]}),e.jsx("p",{children:"We do not sell your personal information."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"4. Cookies and analytics"}),e.jsx("p",{children:"We use cookies and similar storage when needed for sign-in, security, preferences, and operation of the Service. We also use Plausible to understand aggregate website usage. You can control cookies through your browser, but disabling necessary cookies may prevent account features from working."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"5. Legal bases"}),e.jsx("p",{children:"Where applicable law requires a legal basis, we process information as needed to perform our agreement with you, with your consent, to comply with legal obligations, and for legitimate interests such as operating, securing, and improving the Service. You may withdraw consent where consent is the basis for processing, without affecting earlier processing."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"6. Retention and deletion"}),e.jsx("p",{children:"Private chats are retained until you delete them, subject to limits of 500 active chats and 100 MB of chat data per user. Archiving hides a chat and frees active-chat quota but does not delete it. You may deliberately share an unlisted snapshot; deleting its private chat removes the durable transcript, workspace reference, and share link after deletion is verified. No dedicated private-chat export format is currently offered."}),e.jsx("p",{children:"We keep information for as long as reasonably needed for the purposes described here, including providing the Service, maintaining security and audit records, resolving disputes, and meeting legal obligations. Retention periods vary by data type and service provider. You can delete individual chats in the Service. Deletion may not immediately remove information from backups, security logs, or third-party systems where limited retention is required."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"7. Security and international transfers"}),e.jsx("p",{children:"We use reasonable administrative, technical, and organizational safeguards, but no internet service can guarantee absolute security. We and our service providers may process information in the United States and other countries, which may have different data-protection laws from your country. Where required, we use appropriate safeguards for international transfers."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"8. Your privacy rights"}),e.jsx("p",{children:"Depending on where you live, you may have rights to access, correct, delete, or receive a copy of your personal information; object to or restrict processing; withdraw consent; or appeal a decision about a request. You may also have the right to complain to a data-protection authority. We may need to verify your identity before fulfilling a request."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"9. Children"}),e.jsx("p",{children:"The Service is not directed to children under 13, and we do not knowingly collect personal information from children under 13. If you believe a child has provided personal information, please contact us."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"10. Changes to this policy"}),e.jsx("p",{children:"We may update this policy as the Service changes. We will post the revised policy here and update its effective date. If a change is material, we will provide additional notice when appropriate."})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"11. Contact us"}),e.jsxs("p",{children:["For questions or privacy requests, contact"," ",e.jsx("a",{href:"mailto:privacy@huggingface.co",children:"privacy@huggingface.co"}),". Please do not include passwords, API keys, or other sensitive credentials in your message."]})]})]}));export{n as default}; diff --git a/assets/RateLimitsView-C9bDo_Dq.js b/assets/RateLimitsView-C9bDo_Dq.js deleted file mode 100644 index d9069bbd9eb2a2ada6666da03b828e07b194fb36..0000000000000000000000000000000000000000 --- a/assets/RateLimitsView-C9bDo_Dq.js +++ /dev/null @@ -1 +0,0 @@ -import{j as e,N as t}from"./index-CbgxfyGU.js";import{u as s}from"./useQuery-Bx9s5-D2.js";const n=()=>{const i=s({queryKey:["submission-rate-limit-policy"],queryFn:()=>t.getRateLimitPolicy()}).data;return e.jsxs("div",{className:"page",style:{maxWidth:760},children:[e.jsx("h1",{children:"Submission and rate-limit policy"}),i?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Each account may have up to ",i.active_pending," active submissions."]}),e.jsxs("p",{children:["New submissions are limited to ",i.subject_per_hour," per account and ",i.ip_per_hour," per source network in a rolling hour."]})]}):e.jsx("p",{children:"Loading current limits…"}),e.jsx("p",{children:"Duplicate, no-op, and idempotently replayed requests do not consume creation quota."}),e.jsx("p",{children:"Rate-limited responses use HTTP 429 with Retry-After, RateLimit, and RateLimit-Policy headers."}),e.jsx("p",{children:"Good-faith contributors who are blocked should contact the Papers with Code maintainers with their Hugging Face username."})]})};export{n as default}; diff --git a/assets/RateLimitsView-phVSVOy1.js b/assets/RateLimitsView-phVSVOy1.js new file mode 100644 index 0000000000000000000000000000000000000000..841509f7bc3888b861d3e8be038073ecca7cd82c --- /dev/null +++ b/assets/RateLimitsView-phVSVOy1.js @@ -0,0 +1 @@ +import{b as t,j as e}from"./index-DyXq7-Tg.js";import{a as s}from"./account-cbblajck.js";const n=()=>{const i=t({queryKey:["submission-rate-limit-policy"],queryFn:()=>s.getRateLimitPolicy()}).data;return e.jsxs("div",{className:"page",style:{maxWidth:760},children:[e.jsx("h1",{children:"Submission and rate-limit policy"}),i?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Each account may have up to ",i.active_pending," active submissions."]}),e.jsxs("p",{children:["New submissions are limited to ",i.subject_per_hour," per account and ",i.ip_per_hour," per source network in a rolling hour."]})]}):e.jsx("p",{children:"Loading current limits…"}),e.jsx("p",{children:"Duplicate, no-op, and idempotently replayed requests do not consume creation quota."}),e.jsx("p",{children:"Rate-limited responses use HTTP 429 with Retry-After, RateLimit, and RateLimit-Policy headers."}),e.jsx("p",{children:"Good-faith contributors who are blocked should contact the Papers with Code maintainers with their Hugging Face username."})]})};export{n as default}; diff --git a/assets/ResearchFollowButton-D2BXlDtQ.js b/assets/ResearchFollowButton-D2BXlDtQ.js deleted file mode 100644 index d931106e13a225cc1c94624601829fb06cbbf66a..0000000000000000000000000000000000000000 --- a/assets/ResearchFollowButton-D2BXlDtQ.js +++ /dev/null @@ -1 +0,0 @@ -import{d as y,b as F,f as N,r as S,i as v,j as e,h as C,C as L,L as c}from"./index-CbgxfyGU.js";import{u as G}from"./useQuery-Bx9s5-D2.js";import{u as Q}from"./useMutation-P_trTy9i.js";import{r as m}from"./research-DgpyzSy_.js";import{P as p}from"./plus-UK0TEjgd.js";const j={task:"Get new papers on this task",method:"Get new papers using this method",benchmark:"Get new results on this benchmark",author:"Get new papers by this author",organization:"Get new papers from this organization"};function _({kind:a,entityId:t}){var f;const l=y(),s=l==null?void 0:l.user,h=F(),n=N(),[x,g]=S.useState(null),u=`${a}:${t}`,d=["research-follows",s==null?void 0:s.hf_subject],r=G({queryKey:d,queryFn:m.follows,enabled:!!s}),o=((f=r.data)==null?void 0:f.some(w=>w.kind===a&&String(w.entity_id)===String(t)))??!1,i=Q({mutationFn:()=>m.setFollow(a,t,!o),onSuccess:async()=>{g(o?null:u),await n.invalidateQueries({queryKey:d}),await n.invalidateQueries({queryKey:["research-feed",s==null?void 0:s.hf_subject]}),await n.invalidateQueries({queryKey:["research-email",s==null?void 0:s.hf_subject]})}});if(!l||!s&&v())return null;if(!s)return e.jsxs("div",{className:"research-follow",children:[e.jsxs("a",{className:"research-follow-btn",href:C(h.pathname+h.search),children:[e.jsx(p,{"aria-hidden":"true"}),"Follow"]}),e.jsxs("span",{className:"research-follow-hint",children:["Sign in to ",j[a].toLowerCase(),"."]})]});const b=i.error||r.error;return e.jsxs("div",{className:"research-follow",children:[e.jsx("button",{type:"button",className:o?"research-follow-btn is-following":"research-follow-btn",disabled:r.isLoading||!!r.error||i.isPending,"aria-pressed":o,"aria-label":o?"Unfollow":"Follow",onClick:()=>i.mutate(),children:o?e.jsxs(e.Fragment,{children:[e.jsx(L,{"aria-hidden":"true"}),e.jsx("span",{className:"research-follow-label",children:"Following"}),e.jsx("span",{className:"research-follow-label-hover",children:"Unfollow"})]}):e.jsxs(e.Fragment,{children:[e.jsx(p,{"aria-hidden":"true"}),"Follow"]})}),b?e.jsx("span",{className:"research-follow-hint is-error",role:"alert",children:"Could not update follows. Please try again."}):o?x===u&&e.jsxs("span",{className:"research-follow-hint",role:"status",children:["Added to ",e.jsx(c,{to:"/following",children:"your Following feed"})," · ",e.jsx(c,{to:"/settings",children:"Manage in Settings"})]}):e.jsxs("span",{className:"research-follow-hint",children:[j[a]," in ",e.jsx(c,{to:"/following",children:"your Following feed"}),"."]})]})}export{_ as R}; diff --git a/assets/ResearchFollowButton-Dv316ClR.js b/assets/ResearchFollowButton-Dv316ClR.js new file mode 100644 index 0000000000000000000000000000000000000000..27fc00667a266b3c950f82f79eada46999606f11 --- /dev/null +++ b/assets/ResearchFollowButton-Dv316ClR.js @@ -0,0 +1 @@ +import{f as x,c as j,d as b,k as F,j as e,h as N,C as S,L as i}from"./index-DyXq7-Tg.js";import{u as y,g as C}from"./researchTopic-DbX0eko-.js";import{P as w}from"./plus-Yh42pKZz.js";const f={task:"Get new papers on this task",method:"Get new papers using this method",benchmark:"Get new results on this benchmark",author:"Get new papers by this author",organization:"Get new papers from this organization"};function R({kind:o,entityId:n}){var u;const l=x(),c=l==null?void 0:l.user,h=j(),[m,p]=b.useState(null),d=`${o}:${n}`,a=y(),s=((u=a.data)==null?void 0:u.some(r=>r.kind===o&&String(r.entity_id)===String(n)))??!1,t=C({onChanged:({follow:r})=>p(r?d:null),awaitRefresh:!0});if(!l||!c&&F())return null;if(!c)return e.jsxs("div",{className:"research-follow",children:[e.jsxs("a",{className:"research-follow-btn",href:N(h.pathname+h.search),children:[e.jsx(w,{"aria-hidden":"true"}),"Follow"]}),e.jsxs("span",{className:"research-follow-hint",children:["Sign in to ",f[o].toLowerCase(),"."]})]});const g=t.error||a.error;return e.jsxs("div",{className:"research-follow",children:[e.jsx("button",{type:"button",className:s?"research-follow-btn is-following":"research-follow-btn",disabled:a.isLoading||!!a.error||t.isPending,"aria-pressed":s,"aria-label":s?"Unfollow":"Follow",onClick:()=>t.mutate({kind:o,entityId:n,follow:!s}),children:s?e.jsxs(e.Fragment,{children:[e.jsx(S,{"aria-hidden":"true"}),e.jsx("span",{className:"research-follow-label",children:"Following"}),e.jsx("span",{className:"research-follow-label-hover",children:"Unfollow"})]}):e.jsxs(e.Fragment,{children:[e.jsx(w,{"aria-hidden":"true"}),"Follow"]})}),g?e.jsx("span",{className:"research-follow-hint is-error",role:"alert",children:"Could not update follows. Please try again."}):s?m===d&&e.jsxs("span",{className:"research-follow-hint",role:"status",children:["Added to ",e.jsx(i,{to:"/following",children:"your Following feed"})," · ",e.jsx(i,{to:"/settings",children:"Manage in Settings"})]}):e.jsxs("span",{className:"research-follow-hint",children:[f[o]," in ",e.jsx(i,{to:"/following",children:"your Following feed"}),"."]})]})}export{R}; diff --git a/assets/SavedPapersView-B2fQDeYi.js b/assets/SavedPapersView-B2fQDeYi.js new file mode 100644 index 0000000000000000000000000000000000000000..d11e5a8f08dd9366753600ef872e636d2014bb15 --- /dev/null +++ b/assets/SavedPapersView-B2fQDeYi.js @@ -0,0 +1 @@ +import{a as g,b as v,U as x,j as e,H as j,L as b,p as N}from"./index-DyXq7-Tg.js";import{P as f}from"./PaperCard-57p1OSGy.js";import{T as k}from"./SotaBadges-vbLLOUtT.js";import{S as r}from"./skeleton-C3IIzpSL.js";import{A as y,a as w}from"./alert-gbJBhAVE.js";import{a as A}from"./account-cbblajck.js";import{t as B}from"./transform-D46m70Qr.js";import{s as F}from"./savedPapersAuth-TV7AiXOw.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./Icon-T4LYkEQj.js";import"./LatexTitle-Bkyz3jCs.js";import"./papers-Dh3ljlL0.js";import"./curation-YeS7FBYf.js";import"./safeExternalHref-CkBrsh84.js";import"./colors-BkWRhvFI.js";const Q=()=>{var d,l;const{user:i,isLoading:m}=g(),a=v({queryKey:[...N.feeds.saved],queryFn:()=>A.getBookmarks(),enabled:!!i,staleTime:30*1e3}),c=a.error instanceof x&&a.error.code==="saved_papers_bucket_authorization_required",o=!!a.data&&!a.data.bucket_connected,n=()=>{window.location.assign(F())};if(m)return e.jsxs("div",{className:"page",children:[e.jsx(r,{className:"h-10 w-1/3 mb-4"}),e.jsx(r,{className:"h-6 w-1/2 mb-8"})]});if(!i)return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Saved ",e.jsx("em",{children:"Papers"})]}),e.jsx("div",{className:"feed-subtitle",children:"Sign in with Hugging Face to save papers and revisit them later."})]})}),e.jsx("div",{className:"saved-signin-panel",children:e.jsx(j,{returnTo:"/saved"})})]});let h=0;return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Saved ",e.jsx("em",{children:"Papers"})]}),e.jsxs("div",{className:"feed-subtitle",children:[(d=a.data)!=null&&d.count?`${a.data.count.toLocaleString()} saved · grouped by domain`:"Your bookmarked papers, grouped by domain.",(l=a.data)!=null&&l.bucket_connected?e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:`https://huggingface.co/buckets/${i.username}/pwc-saved-papers`,target:"_blank",rel:"noopener noreferrer",children:"Open your Hugging Face Bucket"})]}):null]})]})}),c?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsx("p",{children:"Your saved papers are still safe in Papers With Code. Approve Bucket access to copy them into a private Hugging Face Bucket that belongs to you."}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:n,children:"Approve and migrate saved papers"})]}):a.error?e.jsx(y,{variant:"destructive",className:"mb-4",children:e.jsx(w,{children:"Failed to load your saved papers. Please try again."})}):null,o&&a.data.bucket_migrated?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsx("p",{children:"Your saved papers are already in your private Hugging Face Bucket. Reconnect it in this browser to read from it and save new papers there."}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:n,children:"Reconnect Hugging Face Bucket"})]}):o?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsxs("p",{children:[a.data.count?`Your ${a.data.count.toLocaleString()} saved ${a.data.count===1?"paper is":"papers are"} still available below. `:"When you save your first paper, ","Approve Bucket access to copy saved papers into a private Hugging Face Bucket that belongs to you. The existing data is kept until the copy is verified."]}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:n,children:a.data.count?"Approve and migrate saved papers":"Use a Hugging Face Bucket"})]}):null,c||a.error?null:a.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((t,s)=>e.jsxs("div",{className:"paper-card",children:[e.jsx(r,{className:"h-[220px] w-[160px]"}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(r,{className:"h-6 w-3/4"}),e.jsx(r,{className:"h-4 w-1/2"}),e.jsx(r,{className:"h-12 w-full"})]})]},s))}):!a.data||a.data.count===0?e.jsxs("div",{className:"no-results",children:["No saved papers yet."," ",e.jsx(b,{to:"/papers",className:"sidebar-link",style:{display:"inline"},children:"Browse papers →"})]}):a.data.areas.map(t=>e.jsxs("section",{className:"saved-area-section",children:[e.jsx("h2",{className:"saved-area-heading",children:t.name}),t.tasks.map(s=>{const p=s.papers.length;return e.jsxs("div",{className:"saved-task-block",children:[e.jsxs("div",{className:"saved-task-row",children:[s.slug?e.jsx(k,{slug:s.slug,label:s.name}):e.jsx("span",{className:"tag-chip",style:{background:"var(--surface)"},children:s.name}),e.jsxs("span",{className:"saved-task-count",children:[p," ",p===1?"paper":"papers"]})]}),e.jsx("div",{className:"paper-list",children:s.papers.map(u=>e.jsx(f,{paper:B(u),priority:h++<3},u.id))})]},`task-${t.id??"other"}-${s.id??"untagged"}`)})]},`area-${t.id??"other"}`))]})};export{Q as default}; diff --git a/assets/SavedPapersView-CewIlVsw.js b/assets/SavedPapersView-CewIlVsw.js deleted file mode 100644 index 30944e07ac02f75c1445175b9e36e2b9e0f98a9b..0000000000000000000000000000000000000000 --- a/assets/SavedPapersView-CewIlVsw.js +++ /dev/null @@ -1 +0,0 @@ -import{a as g,K as v,j as e,H as x,L as j,N as b}from"./index-CbgxfyGU.js";import{p as f}from"./paperQueryKeys-B8u1BWlI.js";import{u as N}from"./useQuery-Bx9s5-D2.js";import{P as k}from"./PaperCard-tdTC_dRN.js";import{T as y}from"./SotaBadges-C-sTR-EF.js";import{S as r}from"./skeleton-HwvdxvSN.js";import{A as w,a as A}from"./alert-CFDDvdIM.js";import{t as B}from"./transform-0Udg2p6b.js";import{s as F}from"./savedPapersAuth-DsQUuWa_.js";import"./curation-C7Gmmp4z.js";import"./AuthorAvatar-CUJMmp_z.js";import"./Icon-D-kA0Owz.js";import"./LatexTitle-Z-HGmZ-H.js";import"./safeExternalHref-CkBrsh84.js";import"./colors-BkWRhvFI.js";const O=()=>{var d,l;const{user:i,isLoading:m}=g(),a=N({queryKey:[...f.feeds.saved],queryFn:()=>b.getBookmarks(),enabled:!!i,staleTime:30*1e3,refetchOnWindowFocus:!1}),c=a.error instanceof v&&a.error.code==="saved_papers_bucket_authorization_required",o=!!a.data&&!a.data.bucket_connected,n=()=>{window.location.assign(F())};if(m)return e.jsxs("div",{className:"page",children:[e.jsx(r,{className:"h-10 w-1/3 mb-4"}),e.jsx(r,{className:"h-6 w-1/2 mb-8"})]});if(!i)return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Saved ",e.jsx("em",{children:"Papers"})]}),e.jsx("div",{className:"feed-subtitle",children:"Sign in with Hugging Face to save papers and revisit them later."})]})}),e.jsx("div",{className:"saved-signin-panel",children:e.jsx(x,{returnTo:"/saved"})})]});let h=0;return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Saved ",e.jsx("em",{children:"Papers"})]}),e.jsxs("div",{className:"feed-subtitle",children:[(d=a.data)!=null&&d.count?`${a.data.count.toLocaleString()} saved · grouped by domain`:"Your bookmarked papers, grouped by domain.",(l=a.data)!=null&&l.bucket_connected?e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:`https://huggingface.co/buckets/${i.username}/pwc-saved-papers`,target:"_blank",rel:"noopener noreferrer",children:"Open your Hugging Face Bucket"})]}):null]})]})}),c?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsx("p",{children:"Your saved papers are still safe in Papers With Code. Approve Bucket access to copy them into a private Hugging Face Bucket that belongs to you."}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:n,children:"Approve and migrate saved papers"})]}):a.error?e.jsx(w,{variant:"destructive",className:"mb-4",children:e.jsx(A,{children:"Failed to load your saved papers. Please try again."})}):null,o&&a.data.bucket_migrated?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsx("p",{children:"Your saved papers are already in your private Hugging Face Bucket. Reconnect it in this browser to read from it and save new papers there."}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:n,children:"Reconnect Hugging Face Bucket"})]}):o?e.jsxs("div",{className:"saved-bucket-migration",children:[e.jsxs("p",{children:[a.data.count?`Your ${a.data.count.toLocaleString()} saved ${a.data.count===1?"paper is":"papers are"} still available below. `:"When you save your first paper, ","Approve Bucket access to copy saved papers into a private Hugging Face Bucket that belongs to you. The existing data is kept until the copy is verified."]}),e.jsx("button",{type:"button",className:"hf-signin-btn",onClick:n,children:a.data.count?"Approve and migrate saved papers":"Use a Hugging Face Bucket"})]}):null,c||a.error?null:a.isLoading?e.jsx("div",{className:"paper-list",children:Array.from({length:4}).map((t,s)=>e.jsxs("div",{className:"paper-card",children:[e.jsx(r,{className:"h-[220px] w-[160px]"}),e.jsxs("div",{className:"paper-body",style:{flex:1,gap:12},children:[e.jsx(r,{className:"h-6 w-3/4"}),e.jsx(r,{className:"h-4 w-1/2"}),e.jsx(r,{className:"h-12 w-full"})]})]},s))}):!a.data||a.data.count===0?e.jsxs("div",{className:"no-results",children:["No saved papers yet."," ",e.jsx(j,{to:"/papers",className:"sidebar-link",style:{display:"inline"},children:"Browse papers →"})]}):a.data.areas.map(t=>e.jsxs("section",{className:"saved-area-section",children:[e.jsx("h2",{className:"saved-area-heading",children:t.name}),t.tasks.map(s=>{const p=s.papers.length;return e.jsxs("div",{className:"saved-task-block",children:[e.jsxs("div",{className:"saved-task-row",children:[s.slug?e.jsx(y,{slug:s.slug,label:s.name}):e.jsx("span",{className:"tag-chip",style:{background:"var(--surface)"},children:s.name}),e.jsxs("span",{className:"saved-task-count",children:[p," ",p===1?"paper":"papers"]})]}),e.jsx("div",{className:"paper-list",children:s.papers.map(u=>e.jsx(k,{paper:B(u),priority:h++<3},u.id))})]},`task-${t.id??"other"}-${s.id??"untagged"}`)})]},`area-${t.id??"other"}`))]})};export{O as default}; diff --git a/assets/SearchOverlay-5zBt7fdP.js b/assets/SearchOverlay-5zBt7fdP.js new file mode 100644 index 0000000000000000000000000000000000000000..e7ed99e94eccd346af0b8de314d11331751f8def --- /dev/null +++ b/assets/SearchOverlay-5zBt7fdP.js @@ -0,0 +1 @@ +import{d as K,e as O,V as M,l as B,b as i,j as e,p as H}from"./index-DyXq7-Tg.js";import{L as U}from"./LatexTitle-Bkyz3jCs.js";import{c as x}from"./catalog-CRar2olQ.js";import{p as R}from"./papers-Dh3ljlL0.js";import{u as Y}from"./useDebounce-B9jkN7LV.js";import{c as G,h as V}from"./colors-BkWRhvFI.js";import{d as X}from"./transform-D46m70Qr.js";import"./curation-YeS7FBYf.js";const Z=10,S=6,W=350,v=3,ls=({open:t,onClose:h})=>{var A,C,w,P,Q,z;const f=K.useRef(null),$=O(),[c,D]=M.useState(""),a=Y(c,W),j=c.trim(),r=a.trim().length>=v,y=B();K.useEffect(()=>{var l;if(!t)return;(l=f.current)==null||l.focus();const s=N=>{N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),h())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[t,h]);const k=i({queryKey:[...H.feeds.searchOverlay,a],queryFn:()=>R.search(a,1,Z),enabled:t&&r,staleTime:6e4,retry:!1}),_=i({queryKey:["search-tasks",a],queryFn:()=>x.listTasks({q:a,page_size:6}),enabled:t&&r,staleTime:6e4,retry:!1}),b=i({queryKey:["search-methods",a],queryFn:()=>x.listMethods({q:a,page_size:6}),enabled:t&&r,staleTime:6e4,retry:!1}),E=i({queryKey:["search-benchmarks",a],queryFn:()=>x.listDatasets({q:a,page_size:6}),enabled:t&&r,staleTime:6e4,retry:!1}),F=i({queryKey:["search-authors",a],queryFn:()=>R.searchAuthors(a,S),enabled:t&&r,staleTime:6e4,retry:!1}),q=i({queryKey:["search-organizations",a],queryFn:()=>x.searchOrganizations(a,S),enabled:t&&r,staleTime:6e4,retry:!1});if(!t)return null;const o=((A=_.data)==null?void 0:A.results)||[],d=((C=b.data)==null?void 0:C.results)||[],u=((w=E.data)==null?void 0:w.results)||[],m=((P=F.data)==null?void 0:P.results)||[],p=((Q=q.data)==null?void 0:Q.results)||[],g=((z=k.data)==null?void 0:z.results)||[],I=k.isFetching||_.isFetching||b.isFetching||E.isFetching||F.isFetching||q.isFetching,L=o.length||g.length||d.length||u.length||m.length||p.length,n=s=>{h(),$(s)},T=()=>{const s=c.trim();s&&n(`/chat?q=${encodeURIComponent(s)}`)};return e.jsx("div",{className:"search-overlay",onClick:h,children:e.jsxs("div",{className:"search-modal",onClick:s=>s.stopPropagation(),children:[e.jsx("input",{ref:f,className:"search-modal-input",placeholder:"Search papers, tasks, methods, benchmarks, authors, or organizations…",value:c,onChange:s=>D(s.target.value),onKeyDown:s=>{y&&s.key==="Enter"&&(s.preventDefault(),T())}}),e.jsxs("div",{className:"search-results",children:[y&&c.trim()&&e.jsxs("button",{type:"button",className:"search-ask-row",onClick:T,children:[e.jsx("span",{className:"search-ask-chip",children:"assistant"}),e.jsxs("span",{className:"search-ask-text",children:["Ask: “",c.trim(),"”"]}),e.jsx("kbd",{children:"↵"})]}),!a&&e.jsxs("div",{className:"search-empty",children:["Try “diffusion”, “object detection”, or an arXiv id.",y&&e.jsx("span",{className:"search-empty-sub",children:"Press Enter to ask the assistant"})]}),a&&!r&&e.jsxs("div",{className:"search-empty",children:["Keep typing: results appear from ",v," characters."]}),r&&!I&&!L&&e.jsxs("div",{className:"search-empty",children:['No matches for "',c,'"']}),o.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Tasks · ",o.length]}),o.map(s=>{const l=G(V(s.slug||""));return e.jsxs("div",{className:"search-result-tag",onClick:()=>n(`/tasks/${s.slug}`),children:[e.jsx("span",{className:"dot",style:{width:6,height:6,borderRadius:"50%",background:l.dot}}),e.jsx("span",{className:"name",children:X(s.name,s.slug)}),s.paper_count!=null&&e.jsxs("span",{className:"count",children:[s.paper_count," papers"]})]},s.id)})]}),d.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Methods · ",d.length]}),d.map(s=>e.jsxs("div",{className:"search-result-tag",onClick:()=>n(`/methods/${s.slug||s.id}`),children:[e.jsx("span",{style:{fontFamily:"var(--mono)",fontWeight:600},children:s.name}),s.paper_count!=null&&e.jsxs("span",{className:"count",children:[s.paper_count," papers"]})]},s.id))]}),u.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Benchmarks · ",u.length]}),u.map(s=>e.jsxs("div",{className:"search-result-tag",onClick:()=>n(`/benchmark/${s.slug||s.id}`),children:[e.jsx("span",{className:"name",children:s.name}),s.paper_count!=null&&s.paper_count>0&&e.jsxs("span",{className:"count",children:[s.paper_count," entries"]})]},s.id))]}),m.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Authors · ",m.length]}),m.map(s=>e.jsxs("div",{className:"search-result-tag",onClick:()=>n(`/authors/${s.id}`),children:[e.jsx("span",{className:"name",children:s.full_name}),s.hf_username&&e.jsxs("span",{className:"handle",children:["@",s.hf_username]}),s.paper_count>0&&e.jsxs("span",{className:"count",children:[s.paper_count," papers"]})]},s.id))]}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Organizations · ",p.length]}),p.map(s=>e.jsxs("div",{className:"search-result-tag",onClick:()=>n(`/orgs/${s.slug}`),children:[s.logo_url&&e.jsx("img",{className:"logo",src:s.logo_url,alt:"",loading:"lazy"}),e.jsx("span",{className:"name",children:s.name}),s.paper_count!=null&&s.paper_count>0&&e.jsxs("span",{className:"count",children:[s.paper_count," papers"]})]},s.id))]}),g.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Papers · ",g.length]}),g.map(s=>{var l;return e.jsxs("div",{className:"search-result",onClick:()=>n(`/paper/${s.arxiv_id||s.id}`),children:[e.jsx("div",{className:"search-result-title",children:e.jsx(U,{title:s.title})}),e.jsxs("div",{className:"search-result-meta",children:[e.jsx("span",{children:s.arxiv_id?`arXiv:${s.arxiv_id}`:"External resource"}),((l=s.authors)==null?void 0:l[0])&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[s.authors[0],s.authors.length>1?" et al.":""]})]}),s.citation_count!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:["↑ ",s.citation_count.toLocaleString()]})]})]})]},s.id)})]}),j.length>=v&&e.jsxs("button",{type:"button",className:"search-view-all-row",onClick:()=>n(`/papers?search=${encodeURIComponent(j)}`),children:["View all paper results for “",j,"”"]})]})]})})};export{ls as default}; diff --git a/assets/SearchOverlay-LaDVSpVs.js b/assets/SearchOverlay-LaDVSpVs.js deleted file mode 100644 index 3210e65e0933339de66efb1096067600adc48cb3..0000000000000000000000000000000000000000 --- a/assets/SearchOverlay-LaDVSpVs.js +++ /dev/null @@ -1 +0,0 @@ -import{r as K,c as M,M as O,g as B,j as e}from"./index-CbgxfyGU.js";import{p as H,a as R}from"./paperQueryKeys-B8u1BWlI.js";import{u as i}from"./useQuery-Bx9s5-D2.js";import{L as U}from"./LatexTitle-Z-HGmZ-H.js";import{c as x}from"./catalog-DhK7_9-6.js";import{u as Y}from"./useDebounce-DkuI5tkx.js";import{c as G,h as X}from"./colors-BkWRhvFI.js";import{d as Z}from"./transform-0Udg2p6b.js";import"./curation-C7Gmmp4z.js";const V=10,S=6,W=350,f=3,is=({open:t,onClose:h})=>{var A,C,w,P,Q,z;const v=K.useRef(null),$=M(),[c,D]=O.useState(""),a=Y(c,W),j=c.trim(),r=a.trim().length>=f,y=B();K.useEffect(()=>{var l;if(!t)return;(l=v.current)==null||l.focus();const s=N=>{N.key==="Escape"&&(N.preventDefault(),N.stopPropagation(),h())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[t,h]);const k=i({queryKey:[...H.feeds.searchOverlay,a],queryFn:()=>R.search(a,1,V),enabled:t&&r,staleTime:6e4,retry:!1}),_=i({queryKey:["search-tasks",a],queryFn:()=>x.listTasks({q:a,page_size:6}),enabled:t&&r,staleTime:6e4,retry:!1}),b=i({queryKey:["search-methods",a],queryFn:()=>x.listMethods({q:a,page_size:6}),enabled:t&&r,staleTime:6e4,retry:!1}),E=i({queryKey:["search-benchmarks",a],queryFn:()=>x.listDatasets({q:a,page_size:6}),enabled:t&&r,staleTime:6e4,retry:!1}),F=i({queryKey:["search-authors",a],queryFn:()=>R.searchAuthors(a,S),enabled:t&&r,staleTime:6e4,retry:!1}),q=i({queryKey:["search-organizations",a],queryFn:()=>x.searchOrganizations(a,S),enabled:t&&r,staleTime:6e4,retry:!1});if(!t)return null;const o=((A=_.data)==null?void 0:A.results)||[],d=((C=b.data)==null?void 0:C.results)||[],m=((w=E.data)==null?void 0:w.results)||[],u=((P=F.data)==null?void 0:P.results)||[],p=((Q=q.data)==null?void 0:Q.results)||[],g=((z=k.data)==null?void 0:z.results)||[],I=k.isFetching||_.isFetching||b.isFetching||E.isFetching||F.isFetching||q.isFetching,L=o.length||g.length||d.length||m.length||u.length||p.length,n=s=>{h(),$(s)},T=()=>{const s=c.trim();s&&n(`/chat?q=${encodeURIComponent(s)}`)};return e.jsx("div",{className:"search-overlay",onClick:h,children:e.jsxs("div",{className:"search-modal",onClick:s=>s.stopPropagation(),children:[e.jsx("input",{ref:v,className:"search-modal-input",placeholder:"Search papers, tasks, methods, benchmarks, authors, or organizations…",value:c,onChange:s=>D(s.target.value),onKeyDown:s=>{y&&s.key==="Enter"&&(s.preventDefault(),T())}}),e.jsxs("div",{className:"search-results",children:[y&&c.trim()&&e.jsxs("button",{type:"button",className:"search-ask-row",onClick:T,children:[e.jsx("span",{className:"search-ask-chip",children:"assistant"}),e.jsxs("span",{className:"search-ask-text",children:["Ask: “",c.trim(),"”"]}),e.jsx("kbd",{children:"↵"})]}),!a&&e.jsxs("div",{className:"search-empty",children:["Try “diffusion”, “object detection”, or an arXiv id.",y&&e.jsx("span",{className:"search-empty-sub",children:"Press Enter to ask the assistant"})]}),a&&!r&&e.jsxs("div",{className:"search-empty",children:["Keep typing: results appear from ",f," characters."]}),r&&!I&&!L&&e.jsxs("div",{className:"search-empty",children:['No matches for "',c,'"']}),o.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Tasks · ",o.length]}),o.map(s=>{const l=G(X(s.slug||""));return e.jsxs("div",{className:"search-result-tag",onClick:()=>n(`/tasks/${s.slug}`),children:[e.jsx("span",{className:"dot",style:{width:6,height:6,borderRadius:"50%",background:l.dot}}),e.jsx("span",{className:"name",children:Z(s.name,s.slug)}),s.paper_count!=null&&e.jsxs("span",{className:"count",children:[s.paper_count," papers"]})]},s.id)})]}),d.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Methods · ",d.length]}),d.map(s=>e.jsxs("div",{className:"search-result-tag",onClick:()=>n(`/methods/${s.slug||s.id}`),children:[e.jsx("span",{style:{fontFamily:"var(--mono)",fontWeight:600},children:s.name}),s.paper_count!=null&&e.jsxs("span",{className:"count",children:[s.paper_count," papers"]})]},s.id))]}),m.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Benchmarks · ",m.length]}),m.map(s=>e.jsxs("div",{className:"search-result-tag",onClick:()=>n(`/benchmark/${s.slug||s.id}`),children:[e.jsx("span",{className:"name",children:s.name}),s.paper_count!=null&&s.paper_count>0&&e.jsxs("span",{className:"count",children:[s.paper_count," entries"]})]},s.id))]}),u.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Authors · ",u.length]}),u.map(s=>e.jsxs("div",{className:"search-result-tag",onClick:()=>n(`/authors/${s.id}`),children:[e.jsx("span",{className:"name",children:s.full_name}),s.hf_username&&e.jsxs("span",{className:"handle",children:["@",s.hf_username]}),s.paper_count>0&&e.jsxs("span",{className:"count",children:[s.paper_count," papers"]})]},s.id))]}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Organizations · ",p.length]}),p.map(s=>e.jsxs("div",{className:"search-result-tag",onClick:()=>n(`/orgs/${s.slug}`),children:[s.logo_url&&e.jsx("img",{className:"logo",src:s.logo_url,alt:"",loading:"lazy"}),e.jsx("span",{className:"name",children:s.name}),s.paper_count!=null&&s.paper_count>0&&e.jsxs("span",{className:"count",children:[s.paper_count," papers"]})]},s.id))]}),g.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"search-section-label",children:["Papers · ",g.length]}),g.map(s=>{var l;return e.jsxs("div",{className:"search-result",onClick:()=>n(`/paper/${s.arxiv_id||s.id}`),children:[e.jsx("div",{className:"search-result-title",children:e.jsx(U,{title:s.title})}),e.jsxs("div",{className:"search-result-meta",children:[e.jsx("span",{children:s.arxiv_id?`arXiv:${s.arxiv_id}`:"External resource"}),((l=s.authors)==null?void 0:l[0])&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:[s.authors[0],s.authors.length>1?" et al.":""]})]}),s.citation_count!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{children:["↑ ",s.citation_count.toLocaleString()]})]})]})]},s.id)})]}),j.length>=f&&e.jsxs("button",{type:"button",className:"search-view-all-row",onClick:()=>n(`/papers?search=${encodeURIComponent(j)}`),children:["View all paper results for “",j,"”"]})]})]})})};export{is as default}; diff --git a/assets/SettingsView-BuCdwlbq.js b/assets/SettingsView-BuCdwlbq.js new file mode 100644 index 0000000000000000000000000000000000000000..90cf86349540593064a12181c14204a8230175c0 --- /dev/null +++ b/assets/SettingsView-BuCdwlbq.js @@ -0,0 +1,36 @@ +import{s as k,a as A,c as ce,d as L,b as I,r as Q,j as e,L as T,i as W,H as C,h as de,aw as he,l as ue,V as P,U as ae}from"./index-DyXq7-Tg.js";import{u as E}from"./useMutation-UWxBeqtn.js";import{a as ge,T as se,r as z,u as me,g as pe}from"./researchTopic-DbX0eko-.js";import{S as K}from"./switch-nfvTohnt.js";import{S as fe}from"./sparkles-CcIiUzzc.js";import{A as ye}from"./arrow-right-BzPanrWZ.js";import{T as xe}from"./trophy-BtgLmZ39.js";import{c as N}from"./chat-Ix1IrIwq.js";import{u as je,f as be}from"./useDocumentTitle-DcxM2Zv_.js";import{a as ve,u as we,r as ke,O as Y}from"./openrouter-o51Eagw8.js";import{u as Ne}from"./preferences-COzeOLyS.js";import{E as ne}from"./external-link-orY1Xz1I.js";import{M as Ce}from"./moon-DMVsctTM.js";import"./index-C041TDos.js";import"./account-cbblajck.js";/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Re=k("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fe=k("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ee=k("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Se=k("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _e=k("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Me=k("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Oe=k("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),Pe={task:"task",method:"method",benchmark:"benchmark",author:"author",organization:"organization"};function Le(s){return s.status==="failed"?"We could not finish finding papers for this topic. Save it again to retry.":s.status==="done"?"Matching papers appear in your Following feed, and new ones are added every hour.":s.total?`Your feed shows the closest papers now. Refining matches: ${s.judged.toLocaleString()} of ${s.total.toLocaleString()} checked…`:"Your feed shows the closest papers now. Refining matches…"}function Ie(){var d,R,w;const{user:s}=A(),h=ce(),g=L.useRef(null),l=I({queryKey:Q.topic(s==null?void 0:s.hf_subject),queryFn:z.topic,enabled:!!s,refetchInterval:a=>a.state.data&&["pending","running"].includes(a.state.data.status)?5e3:!1}),[j,p]=L.useState(null),u=ge(()=>p(null));if(L.useEffect(()=>{var a,F;h.hash==="#topic"&&l.isSuccess&&((a=g.current)==null||a.scrollIntoView({block:"center"}),(F=g.current)==null||F.focus())},[h.hash,l.isSuccess]),!s)return null;const t=((d=l.data)==null?void 0:d.text)??"",r=j??t,i=r.trim().replace(/\s+/g," "),c=((R=l.data)==null?void 0:R.status)==="failed"&&i===t,m=i.length>=3&&(i!==t||c),o=()=>{m&&!u.isPending&&u.mutate(i)};return e.jsxs("div",{className:"research-topic",id:"topic",children:[e.jsxs("h3",{className:"research-follow-group-title",children:[e.jsx(fe,{"aria-hidden":"true"}),"Topic"]}),e.jsxs("p",{className:"settings-row-desc",children:["Describe the research you want to follow in your own words, for example"," ",e.jsx("em",{children:"real-time video generation"})," or ",e.jsx("em",{children:"speculative decoding for LLM inference"}),". A model reads every new paper and adds the ones that match to your Following feed."]}),l.isLoading?e.jsx("p",{className:"settings-billing-loading",children:"Loading your topic…"}):l.error?e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not load your topic."}):e.jsxs("form",{className:"research-topic-form",onSubmit:a=>{a.preventDefault(),o()},children:[e.jsx("textarea",{ref:g,className:"research-topic-input",rows:4,maxLength:se,"aria-label":"Research topic",placeholder:"e.g. diffusion policies for robot manipulation",value:r,onChange:a=>p(a.target.value),onKeyDown:a=>{a.key==="Enter"&&!a.shiftKey&&!a.nativeEvent.isComposing&&(a.preventDefault(),o())}}),e.jsxs("div",{className:"research-topic-actions",children:[e.jsxs("span",{className:"research-topic-count",children:[r.length,"/",se]}),t&&e.jsx("button",{type:"button",className:"research-follow-action",disabled:u.isPending,onClick:()=>u.mutate(null),children:"Remove"}),e.jsx("button",{type:"submit",className:"research-topic-save",disabled:u.isPending||!m,children:c?"Retry":t?"Update topic":"Follow topic"})]})]}),l.data&&e.jsx("p",{className:"research-email-status",role:"status",children:Le(l.data)}),(w=l.data)==null?void 0:w.suggestions.map(a=>e.jsxs("p",{className:"research-topic-suggestion",children:[e.jsx(T,{to:a.url,children:a.name})," is a ",Pe[a.kind]," in the catalog. Following it as well adds every paper tagged with it."]},`${a.kind}:${a.entity_id}`)),u.error&&e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not save your topic. Please try again."})]})}const te=[{kind:"task",label:"Tasks",icon:Ee,browse:"/tasks"},{kind:"method",label:"Methods",icon:Fe,browse:"/methods"},{kind:"benchmark",label:"Benchmarks",icon:xe},{kind:"author",label:"Authors",icon:Oe},{kind:"organization",label:"Organizations",icon:Re,browse:"/organizations"}],v=s=>`${s.kind}:${s.entity_id}`,Ae=s=>new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});function Te({follows:s}){const{user:h}=A(),g=W(),[l,j]=L.useState([]),p=pe({onChanged:({row:r,follow:i})=>{g.setQueryData(Q.follows(h==null?void 0:h.hf_subject),c=>i?[...c??[],r]:(c??[]).filter(m=>v(m)!==v(r))),j(c=>[...c.filter(m=>v(m)!==v(r)),...i?[]:[r]])}}),u=new Set(s.map(v)),t=[...s,...l.filter(r=>!u.has(v(r)))];return t.length?e.jsxs(e.Fragment,{children:[te.map(({kind:r,label:i,icon:c})=>{const m=t.filter(o=>o.kind===r).sort((o,d)=>o.name.localeCompare(d.name));return m.length?e.jsxs("div",{className:"research-follow-group",children:[e.jsxs("h3",{className:"research-follow-group-title",children:[e.jsx(c,{"aria-hidden":"true"}),i]}),e.jsx("ul",{className:"research-follow-list",children:m.map(o=>{const d=u.has(v(o));return e.jsxs("li",{className:d?"research-follow-row":"research-follow-row is-unfollowed",children:[e.jsxs("div",{className:"research-follow-text",children:[e.jsx(T,{to:o.url,children:o.name}),e.jsx("span",{children:d?`Following since ${Ae(o.created_at)}`:"Unfollowed"})]}),e.jsx("button",{type:"button",className:d?"research-follow-action":"research-follow-action is-refollow",disabled:p.isPending,"aria-label":`${d?"Unfollow":"Follow"} ${o.name}`,onClick:()=>p.mutate({kind:o.kind,entityId:o.entity_id,follow:!d,row:o}),children:d?"Unfollow":"Follow again"})]},v(o))})})]},r):null}),p.error&&e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not update follows. Please try again."})]}):e.jsx(De,{})}function De(){return e.jsxs("div",{className:"research-follow-empty",children:[e.jsx("p",{children:e.jsx("strong",{children:"You are not following any tasks, methods, benchmarks, authors, or organizations yet."})}),e.jsx("p",{children:"Use the Follow button on any task, method, benchmark, author, or organization page."}),e.jsx("div",{className:"research-follow-browse",children:te.filter(s=>s.browse).map(({kind:s,label:h,icon:g,browse:l})=>e.jsxs(T,{to:l,children:[e.jsx(g,{"aria-hidden":"true"}),"Browse ",h.toLowerCase()]},s))})]})}function qe(){var i;const{user:s}=A(),h=W(),g=me(),l=Q.email(s==null?void 0:s.hf_subject),j=I({queryKey:l,queryFn:z.email,enabled:!!s}),p=E({mutationFn:z.setEmail,onSuccess:c=>h.setQueryData(l,c)}),u=((i=g.data)==null?void 0:i.length)??0,t=j.data,r=!!(t!=null&&t.email)&&!t.suppressed;return e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"settings-section","aria-labelledby":"research-following-heading",children:[e.jsxs("div",{className:"research-section-heading",children:[e.jsxs("h2",{className:"settings-section-title",id:"research-following-heading",children:["Following",u>0&&e.jsx("span",{className:"research-follow-count",children:u})]}),s&&e.jsxs(T,{className:"research-feed-link",to:"/following",children:["Open Following feed ",e.jsx(ye,{"aria-hidden":"true"})]})]}),e.jsx("p",{className:"settings-row-desc research-section-intro",children:"New papers and benchmark results from your topic and what you follow appear in your Following feed. Your topic and follows are private."}),s?g.isLoading?e.jsx("p",{className:"settings-billing-loading",children:"Loading follows…"}):g.error?e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not load your follows."}):e.jsxs(e.Fragment,{children:[e.jsx(Ie,{}),e.jsx(Te,{follows:g.data??[]})]}):e.jsxs("div",{className:"settings-note",children:[e.jsx("span",{children:"Sign in to follow research and build your personal feed."}),e.jsx("div",{className:"settings-note-action",children:e.jsx(C,{returnTo:"/settings"})})]})]}),s&&e.jsxs("section",{className:"settings-section","aria-labelledby":"research-email-heading",children:[e.jsx("h2",{className:"settings-section-title",id:"research-email-heading",children:"Weekly research email"}),j.isLoading?e.jsx("p",{className:"settings-billing-loading",children:"Loading email preferences…"}):j.error||!t?e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not load email preferences."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"settings-row",children:[e.jsxs("label",{className:"settings-row-text",htmlFor:"research-weekly-email",children:[e.jsx("span",{className:"settings-row-label",children:"Email me a weekly digest"}),e.jsx("span",{className:"settings-row-desc",children:"Up to 20 new papers and benchmark results matching your follows, sent Mondays at 08:00 UTC. No email is sent in weeks without new matches. On by default once you follow something; turn it off here or from any email."})]}),e.jsx(K,{id:"research-weekly-email",checked:t.enabled,disabled:p.isPending||!t.enabled&&!r,onCheckedChange:c=>p.mutate(c)})]}),e.jsxs("div",{className:"research-email-destination",children:[e.jsx(Se,{"aria-hidden":"true"}),t.email?e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Sending to ",e.jsx("strong",{children:t.email})]}),e.jsx("a",{href:de("/settings",{collectEmail:!0}),children:"Refresh from Hugging Face"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"To receive it, allow access to the verified email on your Hugging Face account."}),e.jsx(C,{returnTo:"/settings",collectEmail:!0,label:"Allow email access"})]})]}),t.suppressed&&e.jsx("p",{className:"research-email-status is-warning",role:"status",children:"Delivery to this address is paused after a bounce or spam complaint."}),!t.delivery_ready&&e.jsx("p",{className:"research-email-status",role:"status",children:"Weekly emails have not launched yet. Your preference is saved and applies from launch."}),p.error&&e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not save your preference. Refresh your email from Hugging Face and try again."})]})]})]})}const He="https://openrouter.ai/settings/keys";function Ue(s,h){if(s instanceof ae){if(typeof s.detail=="string")return s.detail;if(typeof s.detail=="object"&&s.detail!==null&&"message"in s.detail&&typeof s.detail.message=="string")return s.detail.message}return s instanceof Error&&!s.message.startsWith("API request failed:")?s.message:h}const as=()=>{var J;const{user:s,isLoading:h}=A(),{preferences:g,setHideClosedSourceEvals:l,canPersist:j,isLoading:p}=Ne(),{theme:u,setTheme:t}=he(),r=u??"system",i=ue(),[c,m]=P.useState(""),[o,d]=P.useState(""),[R,w]=P.useState(""),[a,F]=P.useState(""),S=W(),_=I({queryKey:["chat","models","settings"],enabled:i&&!!s,queryFn:()=>N.getModels()}),D=new Set((((J=_.data)==null?void 0:J.items)??[]).map(n=>n.provider)),q=D.has("huggingface"),M=D.has("openrouter"),ie=D.has("openai"),O=I({queryKey:["inference-billing",s==null?void 0:s.hf_subject],enabled:i&&!!s&&q,queryFn:()=>N.getInferenceBilling()}),x=O.data??null,H=ve(i&&!!s&&M),V=we(i&&!!s&&M),f=H.data,b=V.data,y=f?ke(f.resets_at):null,oe=i&&!!s&&(_.isLoading||!_.isError&&(q&&O.isLoading||M&&(H.isLoading||V.isLoading))),le=h||p||u===void 0||oe,G=E({mutationFn:n=>N.selectInferenceBillingAccount(n),onSuccess:n=>{S.setQueryData(["inference-billing",s==null?void 0:s.hf_subject],n),m("")},onError:n=>{m(n instanceof Error?n.message:"Could not change the billing account.")}}),re=O.isLoading||G.isPending,U=(n,B)=>{d(Ue(n,B)),w(n instanceof ae?n.code??"":"")},$=E({mutationFn:n=>N.connectOpenRouterCredential(n),onSuccess:n=>{S.setQueryData(Y,n),F(""),d(""),w("")},onError:n=>U(n,"Could not connect the OpenRouter key.")}),X=E({mutationFn:n=>N.setOpenRouterFallback(n),onSuccess:n=>{S.setQueryData(Y,n),d(""),w("")},onError:n=>U(n,"Could not change paid fallback.")}),Z=E({mutationFn:()=>N.disconnectOpenRouterCredential(),onSuccess:()=>{S.setQueryData(Y,{connected:!1,verified_at:null,fallback_enabled:!1}),d(""),w("")},onError:n=>U(n,"Could not disconnect the OpenRouter key.")});return je(be("Settings")),e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsx("h1",{className:"feed-title",children:e.jsx("em",{children:"Settings"})}),e.jsx("div",{className:"feed-subtitle",children:"Manage what you follow, your weekly email, and how papers are displayed."})]})}),le?e.jsx("div",{className:"settings-page-loading",role:"status","aria-live":"polite",children:e.jsx("span",{className:"sr-only",children:"Loading settings…"})}):e.jsxs("div",{className:"settings-page-content",children:[e.jsx(qe,{}),s&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Catalog access"}),e.jsx("div",{className:"settings-note settings-note-flush",children:e.jsxs("span",{children:["Role: ",e.jsx("strong",{children:s.role??"community member"}),"."," ",s.can_directly_edit_catalog?"You can apply catalog edits directly. Destructive changes require a recent sign-in.":"Your catalog suggestions are sent to the submissions queue for review.",s.is_admin?" You can also review submissions and use administrative maintenance tools.":" Submission review and maintenance tools remain admin-only."]})})]}),i&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Chat usage & billing"}),s?_.isError?e.jsx("div",{className:"settings-billing-loading",role:"alert",children:"Could not load the enabled chat providers."}):e.jsxs("div",{className:"settings-provider-grid",children:[q&&e.jsxs("section",{className:"settings-provider-card","aria-labelledby":"inference-providers-heading",children:[e.jsxs("div",{className:"settings-provider-heading",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"inference-providers-heading",children:"Inference Providers"}),e.jsx("p",{children:"Hugging Face-billed model usage"})]}),(x==null?void 0:x.connected)&&e.jsx("span",{className:"settings-connected-badge",children:"Connected"})]}),O.isError?e.jsx("div",{className:"settings-billing-loading",role:"alert",children:"Hugging Face billing is currently unavailable."}):x!=null&&x.connected?e.jsxs("div",{className:"settings-billing",children:[e.jsx("div",{className:"settings-row-label",children:x.bill_to?`Organization · ${x.bill_to}`:`Personal account · @${s.username}`}),e.jsx("p",{className:"settings-row-desc",children:"Usage for Hugging Face Inference Providers is billed by Hugging Face to your selected account. Included Hugging Face usage is applied first; pay-as-you-go billing follows your Hugging Face plan and billing settings. Papers With Code does not fund, meter, or reset these credits."}),e.jsx("label",{className:"settings-token-label",htmlFor:"hf-billing-account",children:"Bill chat usage to"}),e.jsxs("select",{id:"hf-billing-account",className:"settings-billing-select",value:x.bill_to??"",onChange:n=>{m(""),G.mutate(n.target.value||null)},disabled:re,children:[e.jsxs("option",{value:"",children:["Personal account (@",s.username,")"]}),x.organizations.map(n=>e.jsxs("option",{value:n.name,children:[n.display_name," (",n.name,")"]},n.name))]}),c&&e.jsx("div",{className:"settings-token-error",children:c}),e.jsx("div",{className:"settings-billing-actions",children:e.jsxs("a",{className:"button button-primary",href:x.usage_url,target:"_blank",rel:"noreferrer",children:["View Hugging Face usage & billing ",e.jsx(ne,{"aria-hidden":"true"})]})})]}):e.jsxs("div",{className:"settings-billing-connect",children:[e.jsx("p",{className:"settings-row-desc",children:"Reconnect with Hugging Face to authorize Inference Providers. Hugging Face bills your personal account or the organization you select."}),e.jsx("div",{className:"settings-billing-actions",children:e.jsx(C,{returnTo:"/settings",label:"Re-sign in with Hugging Face",authorizeInference:!0})})]})]}),M&&e.jsxs("section",{className:"settings-provider-card",id:"openrouter-byok","aria-labelledby":"openrouter-heading",children:[e.jsxs("div",{className:"settings-provider-heading",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"openrouter-heading",children:"OpenRouter"}),e.jsx("p",{children:"Papers With Code-funded allowance and optional fallback"})]}),(b==null?void 0:b.connected)&&e.jsx("span",{className:"settings-connected-badge",children:"Key connected"})]}),e.jsx("p",{className:"settings-row-desc",children:"Papers With Code pays for these OpenRouter requests and provides free but limited monthly usage. Your own key is available as an optional fallback."}),f?e.jsxs("div",{className:"settings-usage-row",children:[e.jsxs("div",{className:"settings-usage-heading",children:[e.jsxs("div",{children:[e.jsx("div",{className:"settings-row-label",children:"Monthly OpenRouter usage"}),e.jsxs("div",{className:"settings-row-desc",children:["Resets ",y==null?void 0:y.local," ",e.jsxs("span",{"aria-label":"UTC reset time",children:["(",y==null?void 0:y.utc,")"]})]})]}),e.jsx("strong",{children:f.available?`${f.remaining_percent}% left`:"Unavailable"})]}),e.jsx("div",{className:"settings-usage-track",role:"progressbar","aria-label":`${f.remaining_percent}% remaining; resets ${y==null?void 0:y.local}; ${y==null?void 0:y.utc}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":f.remaining_percent,children:e.jsx("span",{style:{width:`${f.remaining_percent}%`}})}),!f.available&&e.jsxs("p",{className:"settings-limit-note",children:[f.unavailable_reason==="personal_allowance_exhausted"?"Your free monthly allowance is depleted.":`The shared OpenRouter credits are currently unavailable. ${f.remaining_percent}% of your personal allowance remains.`," DeepSeek V4 Flash is temporarily unavailable unless you enable your own key below."]})]}):e.jsx("div",{className:"settings-billing-loading",children:H.isError||f?"OpenRouter usage is currently unavailable.":"Checking OpenRouter usage…"}),e.jsxs("div",{className:"settings-byok-controls",children:[e.jsx("div",{className:"settings-row-label",children:"Provide your own OpenRouter API key"}),b!=null&&b.connected?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"settings-row-desc",children:["Connected",b.verified_at?` · Last verified ${new Date(b.verified_at).toLocaleString()}`:"",". Your API key is stored securely using AES-256 encryption. It is never shown again."]}),e.jsxs("label",{className:"settings-fallback-control",children:[e.jsx(K,{checked:b.fallback_enabled,disabled:X.isPending,onCheckedChange:n=>X.mutate(!!n)}),e.jsxs("span",{children:[e.jsx("strong",{children:"Use my OpenRouter key when Papers With Code-funded OpenRouter access is unavailable"}),e.jsx("small",{children:"OpenRouter bills this usage to your own account. It is not covered by Papers With Code."})]})]}),e.jsx("p",{className:"settings-billing-help",children:"Disconnecting prevents new requests but cannot cancel a request already sent to OpenRouter."}),e.jsxs("div",{className:"settings-billing-actions",children:[e.jsx("button",{className:"button",type:"button",disabled:Z.isPending,onClick:()=>Z.mutate(),children:"Disconnect"}),e.jsxs("a",{className:"button",href:He,target:"_blank",rel:"noreferrer",children:["Revoke or rotate at OpenRouter ",e.jsx(ne,{"aria-hidden":"true"})]})]})]}):e.jsxs("form",{onSubmit:n=>{n.preventDefault(),a.trim()&&$.mutate(a.trim())},children:[e.jsx("label",{className:"settings-token-label",htmlFor:"openrouter-api-key",children:"OpenRouter API key"}),e.jsx("input",{id:"openrouter-api-key",type:"password",autoComplete:"off",value:a,onChange:n=>F(n.target.value),placeholder:"sk-or-…"}),e.jsx("p",{className:"settings-billing-help",children:"Connecting stores the key but does not authorize paid fallback. Enable billing separately after it is verified."}),e.jsx("div",{className:"settings-billing-actions",children:e.jsx("button",{className:"button button-primary",type:"submit",disabled:!a.trim()||$.isPending,children:$.isPending?"Verifying…":"Connect key"})})]}),o&&e.jsxs("div",{className:"settings-token-error",children:[e.jsx("p",{children:R==="fresh_auth_required"?"Your account is signed in, but adding or enabling an API key requires a Hugging Face sign-in from the last 15 minutes.":o}),R==="fresh_auth_required"&&e.jsx("div",{className:"settings-billing-actions",children:e.jsx(C,{returnTo:"/settings#openrouter-byok",label:"Re-authenticate with Hugging Face"})})]})]})]}),ie&&e.jsx("div",{className:"settings-note settings-note-flush",role:"note",children:"Direct OpenAI usage is provided by Papers With Code. No OpenAI API key or billing account is required from you."})]}):e.jsxs("div",{className:"settings-note settings-note-flush",children:[e.jsx("span",{children:"Sign in to manage billing and credentials for the enabled chat providers."}),e.jsx("div",{className:"settings-note-action",children:e.jsx(C,{returnTo:"/settings",authorizeInference:!0})})]})]}),i&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Chat privacy & retention"}),e.jsx("div",{className:"settings-note settings-note-flush",children:e.jsx("span",{children:"Chats are private and retained until you delete them. You can keep up to 500 active chats and 100 MB of chat data. Archiving removes chats from the active list and frees active-chat quota, but does not delete them. Deleting a chat permanently removes its durable transcript, workspace reference, and any public share link after deletion is verified. You can deliberately share an unlisted snapshot, but no dedicated private-chat export format is currently offered."})})]}),e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Appearance"}),e.jsx("div",{className:"theme-options","aria-label":"Color theme",children:[{value:"system",label:"System",description:"Match your device",icon:_e},{value:"light",label:"Light",description:"Always use light mode",icon:Me},{value:"dark",label:"Dark",description:"Always use dark mode",icon:Ce}].map(n=>{const B=n.icon,ee=r===n.value;return e.jsxs("button",{type:"button",className:`theme-option ${ee?"is-selected":""}`,"aria-pressed":ee,onClick:()=>t(n.value),children:[e.jsx(B,{"aria-hidden":"true"}),e.jsxs("span",{className:"theme-option-copy",children:[e.jsx("span",{className:"theme-option-label",children:n.label}),e.jsx("span",{className:"theme-option-desc",children:n.description})]})]},n.value)})})]}),e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Evaluations"}),e.jsxs("div",{className:"settings-row",children:[e.jsxs("label",{className:"settings-row-text",htmlFor:"hide-closed-source-evals",children:[e.jsx("span",{className:"settings-row-label",children:"Hide closed-source models"}),e.jsx("span",{className:"settings-row-desc",children:"When enabled, evaluations of closed-source models (proprietary APIs and unreleased flagship models) are hidden from benchmark leaderboards and paper result tables."})]}),e.jsx(K,{id:"hide-closed-source-evals",checked:g.hide_closed_source_evals,onCheckedChange:n=>{l(!!n)}})]}),!h&&!j&&!s&&e.jsxs("div",{className:"settings-note",children:[e.jsx("span",{children:"You are browsing as a guest, so this choice only applies to the current session. Sign in to save it to your account."}),e.jsx("div",{className:"settings-note-action",children:e.jsx(C,{returnTo:"/settings"})})]})]})]})]})};export{as as default}; diff --git a/assets/SettingsView-C0A-yv3U.js b/assets/SettingsView-C0A-yv3U.js deleted file mode 100644 index 98c71adab7aa0a696191222e14213e3d751246c3..0000000000000000000000000000000000000000 --- a/assets/SettingsView-C0A-yv3U.js +++ /dev/null @@ -1,36 +0,0 @@ -import{n as C,a as q,b as le,r as A,j as e,L as T,f as Q,H as R,h as ce,q as de,aq as he,g as ue,M as S,K as ne}from"./index-CbgxfyGU.js";import{u as O}from"./useQuery-Bx9s5-D2.js";import{u as _}from"./useMutation-P_trTy9i.js";import{T as ee,r as M}from"./research-DgpyzSy_.js";import{S as z}from"./switch-BSZohE4x.js";import{u as ge}from"./researchTopic-CteUev4M.js";import{S as me}from"./sparkles-BqBXJPmy.js";import{A as pe}from"./arrow-right-DotD9yNb.js";import{T as fe}from"./trophy-BQwEH3L7.js";import{c as F}from"./chat-DzTo2WUO.js";import{f as ye,D as xe}from"./latexPlainText-DI8YEXVe.js";import{a as je,u as be,r as ve,O as Y}from"./openrouter-DiuY1sPP.js";import{E as se}from"./external-link-DZIH4GGr.js";import{M as we}from"./moon-BVv5zopc.js";import"./index-CxPKwmVQ.js";/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ke=C("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ne=C("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ce=C("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fe=C("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Re=C("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _e=C("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ee=C("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),Se={task:"task",method:"method",benchmark:"benchmark",author:"author",organization:"organization"};function Me(s){return s.status==="failed"?"We could not finish finding papers for this topic. Save it again to retry.":s.status==="done"?"Matching papers appear in your Following feed, and new ones are added every hour.":s.total?`Your feed shows the closest papers now. Refining matches: ${s.judged.toLocaleString()} of ${s.total.toLocaleString()} checked…`:"Your feed shows the closest papers now. Refining matches…"}function Oe(){var E,w,k;const{user:s}=q(),l=le(),h=A.useRef(null),j=["research-topic",s==null?void 0:s.hf_subject],d=O({queryKey:j,queryFn:M.topic,enabled:!!s,refetchInterval:i=>i.state.data&&["pending","running"].includes(i.state.data.status)?5e3:!1}),[f,y]=A.useState(null),a=ge(()=>y(null));if(A.useEffect(()=>{var i,N;l.hash==="#topic"&&d.isSuccess&&((i=h.current)==null||i.scrollIntoView({block:"center"}),(N=h.current)==null||N.focus())},[l.hash,d.isSuccess]),!s)return null;const c=((E=d.data)==null?void 0:E.text)??"",t=f??c,u=t.trim().replace(/\s+/g," "),g=((w=d.data)==null?void 0:w.status)==="failed"&&u===c,o=u.length>=3&&(u!==c||g),r=()=>{o&&!a.isPending&&a.mutate(u)};return e.jsxs("div",{className:"research-topic",id:"topic",children:[e.jsxs("h3",{className:"research-follow-group-title",children:[e.jsx(me,{"aria-hidden":"true"}),"Topic"]}),e.jsxs("p",{className:"settings-row-desc",children:["Describe the research you want to follow in your own words, for example"," ",e.jsx("em",{children:"real-time video generation"})," or ",e.jsx("em",{children:"speculative decoding for LLM inference"}),". A model reads every new paper and adds the ones that match to your Following feed."]}),d.isLoading?e.jsx("p",{className:"settings-billing-loading",children:"Loading your topic…"}):d.error?e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not load your topic."}):e.jsxs("form",{className:"research-topic-form",onSubmit:i=>{i.preventDefault(),r()},children:[e.jsx("textarea",{ref:h,className:"research-topic-input",rows:4,maxLength:ee,"aria-label":"Research topic",placeholder:"e.g. diffusion policies for robot manipulation",value:t,onChange:i=>y(i.target.value),onKeyDown:i=>{i.key==="Enter"&&!i.shiftKey&&!i.nativeEvent.isComposing&&(i.preventDefault(),r())}}),e.jsxs("div",{className:"research-topic-actions",children:[e.jsxs("span",{className:"research-topic-count",children:[t.length,"/",ee]}),c&&e.jsx("button",{type:"button",className:"research-follow-action",disabled:a.isPending,onClick:()=>a.mutate(null),children:"Remove"}),e.jsx("button",{type:"submit",className:"research-topic-save",disabled:a.isPending||!o,children:g?"Retry":c?"Update topic":"Follow topic"})]})]}),d.data&&e.jsx("p",{className:"research-email-status",role:"status",children:Me(d.data)}),(k=d.data)==null?void 0:k.suggestions.map(i=>e.jsxs("p",{className:"research-topic-suggestion",children:[e.jsx(T,{to:i.url,children:i.name})," is a ",Se[i.kind]," in the catalog. Following it as well adds every paper tagged with it."]},`${i.kind}:${i.entity_id}`)),a.error&&e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not save your topic. Please try again."})]})}const ae=[{kind:"task",label:"Tasks",icon:Ce,browse:"/tasks"},{kind:"method",label:"Methods",icon:Ne,browse:"/methods"},{kind:"benchmark",label:"Benchmarks",icon:fe},{kind:"author",label:"Authors",icon:Ee},{kind:"organization",label:"Organizations",icon:ke,browse:"/organizations"}],v=s=>`${s.kind}:${s.entity_id}`,Le=s=>new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});function Pe({follows:s}){const{user:l}=q(),h=Q(),[j,d]=A.useState([]),f=_({mutationFn:({follow:c,enabled:t})=>M.setFollow(c.kind,c.entity_id,t),onSuccess:(c,{follow:t,enabled:u})=>{const g=["research-follows",l==null?void 0:l.hf_subject];h.setQueryData(g,o=>u?[...o??[],t]:(o??[]).filter(r=>v(r)!==v(t))),d(o=>[...o.filter(r=>v(r)!==v(t)),...u?[]:[t]]),h.invalidateQueries({queryKey:g}),h.invalidateQueries({queryKey:["research-feed",l==null?void 0:l.hf_subject]})}}),y=new Set(s.map(v)),a=[...s,...j.filter(c=>!y.has(v(c)))];return a.length?e.jsxs(e.Fragment,{children:[ae.map(({kind:c,label:t,icon:u})=>{const g=a.filter(o=>o.kind===c).sort((o,r)=>o.name.localeCompare(r.name));return g.length?e.jsxs("div",{className:"research-follow-group",children:[e.jsxs("h3",{className:"research-follow-group-title",children:[e.jsx(u,{"aria-hidden":"true"}),t]}),e.jsx("ul",{className:"research-follow-list",children:g.map(o=>{const r=y.has(v(o));return e.jsxs("li",{className:r?"research-follow-row":"research-follow-row is-unfollowed",children:[e.jsxs("div",{className:"research-follow-text",children:[e.jsx(T,{to:o.url,children:o.name}),e.jsx("span",{children:r?`Following since ${Le(o.created_at)}`:"Unfollowed"})]}),e.jsx("button",{type:"button",className:r?"research-follow-action":"research-follow-action is-refollow",disabled:f.isPending,"aria-label":`${r?"Unfollow":"Follow"} ${o.name}`,onClick:()=>f.mutate({follow:o,enabled:!r}),children:r?"Unfollow":"Follow again"})]},v(o))})})]},c):null}),f.error&&e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not update follows. Please try again."})]}):e.jsx(Ie,{})}function Ie(){return e.jsxs("div",{className:"research-follow-empty",children:[e.jsx("p",{children:e.jsx("strong",{children:"You are not following any tasks, methods, benchmarks, authors, or organizations yet."})}),e.jsx("p",{children:"Use the Follow button on any task, method, benchmark, author, or organization page."}),e.jsx("div",{className:"research-follow-browse",children:ae.filter(s=>s.browse).map(({kind:s,label:l,icon:h,browse:j})=>e.jsxs(T,{to:j,children:[e.jsx(h,{"aria-hidden":"true"}),"Browse ",l.toLowerCase()]},s))})]})}function Ae(){var t;const{user:s}=q(),l=Q(),h=O({queryKey:["research-follows",s==null?void 0:s.hf_subject],queryFn:M.follows,enabled:!!s}),j=["research-email",s==null?void 0:s.hf_subject],d=O({queryKey:j,queryFn:M.email,enabled:!!s}),f=_({mutationFn:M.setEmail,onSuccess:u=>l.setQueryData(j,u)}),y=((t=h.data)==null?void 0:t.length)??0,a=d.data,c=!!(a!=null&&a.email)&&!a.suppressed;return e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"settings-section","aria-labelledby":"research-following-heading",children:[e.jsxs("div",{className:"research-section-heading",children:[e.jsxs("h2",{className:"settings-section-title",id:"research-following-heading",children:["Following",y>0&&e.jsx("span",{className:"research-follow-count",children:y})]}),s&&e.jsxs(T,{className:"research-feed-link",to:"/following",children:["Open Following feed ",e.jsx(pe,{"aria-hidden":"true"})]})]}),e.jsx("p",{className:"settings-row-desc research-section-intro",children:"New papers and benchmark results from your topic and what you follow appear in your Following feed. Your topic and follows are private."}),s?h.isLoading?e.jsx("p",{className:"settings-billing-loading",children:"Loading follows…"}):h.error?e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not load your follows."}):e.jsxs(e.Fragment,{children:[e.jsx(Oe,{}),e.jsx(Pe,{follows:h.data??[]})]}):e.jsxs("div",{className:"settings-note",children:[e.jsx("span",{children:"Sign in to follow research and build your personal feed."}),e.jsx("div",{className:"settings-note-action",children:e.jsx(R,{returnTo:"/settings"})})]})]}),s&&e.jsxs("section",{className:"settings-section","aria-labelledby":"research-email-heading",children:[e.jsx("h2",{className:"settings-section-title",id:"research-email-heading",children:"Weekly research email"}),d.isLoading?e.jsx("p",{className:"settings-billing-loading",children:"Loading email preferences…"}):d.error||!a?e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not load email preferences."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"settings-row",children:[e.jsxs("label",{className:"settings-row-text",htmlFor:"research-weekly-email",children:[e.jsx("span",{className:"settings-row-label",children:"Email me a weekly digest"}),e.jsx("span",{className:"settings-row-desc",children:"Up to 20 new papers and benchmark results matching your follows, sent Mondays at 08:00 UTC. No email is sent in weeks without new matches. On by default once you follow something; turn it off here or from any email."})]}),e.jsx(z,{id:"research-weekly-email",checked:a.enabled,disabled:f.isPending||!a.enabled&&!c,onCheckedChange:u=>f.mutate(u)})]}),e.jsxs("div",{className:"research-email-destination",children:[e.jsx(Fe,{"aria-hidden":"true"}),a.email?e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Sending to ",e.jsx("strong",{children:a.email})]}),e.jsx("a",{href:ce("/settings",{collectEmail:!0}),children:"Refresh from Hugging Face"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"To receive it, allow access to the verified email on your Hugging Face account."}),e.jsx(R,{returnTo:"/settings",collectEmail:!0,label:"Allow email access"})]})]}),a.suppressed&&e.jsx("p",{className:"research-email-status is-warning",role:"status",children:"Delivery to this address is paused after a bounce or spam complaint."}),!a.delivery_ready&&e.jsx("p",{className:"research-email-status",role:"status",children:"Weekly emails have not launched yet. Your preference is saved and applies from launch."}),f.error&&e.jsx("p",{className:"settings-token-error",role:"alert",children:"Could not save your preference. Refresh your email from Hugging Face and try again."})]})]})]})}const qe="https://openrouter.ai/settings/keys";function Te(s,l){if(s instanceof ne){if(typeof s.detail=="string")return s.detail;if(typeof s.detail=="object"&&s.detail!==null&&"message"in s.detail&&typeof s.detail.message=="string")return s.detail.message}return s instanceof Error&&!s.message.startsWith("API request failed:")?s.message:l}const es=()=>{var Z;const{user:s,isLoading:l}=q(),{preferences:h,setHideClosedSourceEvals:j,canPersist:d,isLoading:f}=de(),{theme:y,setTheme:a}=he(),c=y??"system",t=ue(),[u,g]=S.useState(""),[o,r]=S.useState(""),[E,w]=S.useState(""),[k,i]=S.useState(""),N=Q(),L=O({queryKey:["chat","models","settings"],enabled:t&&!!s,queryFn:()=>F.getModels()}),D=new Set((((Z=L.data)==null?void 0:Z.items)??[]).map(n=>n.provider)),H=D.has("huggingface"),P=D.has("openrouter"),te=D.has("openai"),I=O({queryKey:["inference-billing",s==null?void 0:s.hf_subject],enabled:t&&!!s&&H,queryFn:()=>F.getInferenceBilling()}),x=I.data??null,U=je(t&&!!s&&P),W=be(t&&!!s&&P),m=U.data,b=W.data,p=m?ve(m.resets_at):null,ie=t&&!!s&&(L.isLoading||!L.isError&&(H&&I.isLoading||P&&(U.isLoading||W.isLoading))),oe=l||f||y===void 0||ie,V=_({mutationFn:n=>F.selectInferenceBillingAccount(n),onSuccess:n=>{N.setQueryData(["inference-billing",s==null?void 0:s.hf_subject],n),g("")},onError:n=>{g(n instanceof Error?n.message:"Could not change the billing account.")}}),re=I.isLoading||V.isPending,K=(n,B)=>{r(Te(n,B)),w(n instanceof ne?n.code??"":"")},$=_({mutationFn:n=>F.connectOpenRouterCredential(n),onSuccess:n=>{N.setQueryData(Y,n),i(""),r(""),w("")},onError:n=>K(n,"Could not connect the OpenRouter key.")}),G=_({mutationFn:n=>F.setOpenRouterFallback(n),onSuccess:n=>{N.setQueryData(Y,n),r(""),w("")},onError:n=>K(n,"Could not change paid fallback.")}),X=_({mutationFn:()=>F.disconnectOpenRouterCredential(),onSuccess:()=>{N.setQueryData(Y,{connected:!1,verified_at:null,fallback_enabled:!1}),r(""),w("")},onError:n=>K(n,"Could not disconnect the OpenRouter key.")});return S.useEffect(()=>(document.title=ye("Settings"),()=>{document.title=xe}),[]),e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsx("h1",{className:"feed-title",children:e.jsx("em",{children:"Settings"})}),e.jsx("div",{className:"feed-subtitle",children:"Manage what you follow, your weekly email, and how papers are displayed."})]})}),oe?e.jsx("div",{className:"settings-page-loading",role:"status","aria-live":"polite",children:e.jsx("span",{className:"sr-only",children:"Loading settings…"})}):e.jsxs("div",{className:"settings-page-content",children:[e.jsx(Ae,{}),s&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Catalog access"}),e.jsx("div",{className:"settings-note settings-note-flush",children:e.jsxs("span",{children:["Role: ",e.jsx("strong",{children:s.role??"community member"}),"."," ",s.can_directly_edit_catalog?"You can apply catalog edits directly. Destructive changes require a recent sign-in.":"Your catalog suggestions are sent to the submissions queue for review.",s.is_admin?" You can also review submissions and use administrative maintenance tools.":" Submission review and maintenance tools remain admin-only."]})})]}),t&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Chat usage & billing"}),s?L.isError?e.jsx("div",{className:"settings-billing-loading",role:"alert",children:"Could not load the enabled chat providers."}):e.jsxs("div",{className:"settings-provider-grid",children:[H&&e.jsxs("section",{className:"settings-provider-card","aria-labelledby":"inference-providers-heading",children:[e.jsxs("div",{className:"settings-provider-heading",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"inference-providers-heading",children:"Inference Providers"}),e.jsx("p",{children:"Hugging Face-billed model usage"})]}),(x==null?void 0:x.connected)&&e.jsx("span",{className:"settings-connected-badge",children:"Connected"})]}),I.isError?e.jsx("div",{className:"settings-billing-loading",role:"alert",children:"Hugging Face billing is currently unavailable."}):x!=null&&x.connected?e.jsxs("div",{className:"settings-billing",children:[e.jsx("div",{className:"settings-row-label",children:x.bill_to?`Organization · ${x.bill_to}`:`Personal account · @${s.username}`}),e.jsx("p",{className:"settings-row-desc",children:"Usage for Hugging Face Inference Providers is billed by Hugging Face to your selected account. Included Hugging Face usage is applied first; pay-as-you-go billing follows your Hugging Face plan and billing settings. Papers With Code does not fund, meter, or reset these credits."}),e.jsx("label",{className:"settings-token-label",htmlFor:"hf-billing-account",children:"Bill chat usage to"}),e.jsxs("select",{id:"hf-billing-account",className:"settings-billing-select",value:x.bill_to??"",onChange:n=>{g(""),V.mutate(n.target.value||null)},disabled:re,children:[e.jsxs("option",{value:"",children:["Personal account (@",s.username,")"]}),x.organizations.map(n=>e.jsxs("option",{value:n.name,children:[n.display_name," (",n.name,")"]},n.name))]}),u&&e.jsx("div",{className:"settings-token-error",children:u}),e.jsx("div",{className:"settings-billing-actions",children:e.jsxs("a",{className:"button button-primary",href:x.usage_url,target:"_blank",rel:"noreferrer",children:["View Hugging Face usage & billing ",e.jsx(se,{"aria-hidden":"true"})]})})]}):e.jsxs("div",{className:"settings-billing-connect",children:[e.jsx("p",{className:"settings-row-desc",children:"Reconnect with Hugging Face to authorize Inference Providers. Hugging Face bills your personal account or the organization you select."}),e.jsx("div",{className:"settings-billing-actions",children:e.jsx(R,{returnTo:"/settings",label:"Re-sign in with Hugging Face",authorizeInference:!0})})]})]}),P&&e.jsxs("section",{className:"settings-provider-card",id:"openrouter-byok","aria-labelledby":"openrouter-heading",children:[e.jsxs("div",{className:"settings-provider-heading",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"openrouter-heading",children:"OpenRouter"}),e.jsx("p",{children:"Papers With Code-funded allowance and optional fallback"})]}),(b==null?void 0:b.connected)&&e.jsx("span",{className:"settings-connected-badge",children:"Key connected"})]}),e.jsx("p",{className:"settings-row-desc",children:"Papers With Code pays for these OpenRouter requests and provides free but limited monthly usage. Your own key is available as an optional fallback."}),m?e.jsxs("div",{className:"settings-usage-row",children:[e.jsxs("div",{className:"settings-usage-heading",children:[e.jsxs("div",{children:[e.jsx("div",{className:"settings-row-label",children:"Monthly OpenRouter usage"}),e.jsxs("div",{className:"settings-row-desc",children:["Resets ",p==null?void 0:p.local," ",e.jsxs("span",{"aria-label":"UTC reset time",children:["(",p==null?void 0:p.utc,")"]})]})]}),e.jsx("strong",{children:m.available?`${m.remaining_percent}% left`:"Unavailable"})]}),e.jsx("div",{className:"settings-usage-track",role:"progressbar","aria-label":`${m.remaining_percent}% remaining; resets ${p==null?void 0:p.local}; ${p==null?void 0:p.utc}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m.remaining_percent,children:e.jsx("span",{style:{width:`${m.remaining_percent}%`}})}),!m.available&&e.jsxs("p",{className:"settings-limit-note",children:[m.unavailable_reason==="personal_allowance_exhausted"?"Your free monthly allowance is depleted.":`The shared OpenRouter credits are currently unavailable. ${m.remaining_percent}% of your personal allowance remains.`," DeepSeek V4 Flash is temporarily unavailable unless you enable your own key below."]})]}):e.jsx("div",{className:"settings-billing-loading",children:U.isError||m?"OpenRouter usage is currently unavailable.":"Checking OpenRouter usage…"}),e.jsxs("div",{className:"settings-byok-controls",children:[e.jsx("div",{className:"settings-row-label",children:"Provide your own OpenRouter API key"}),b!=null&&b.connected?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"settings-row-desc",children:["Connected",b.verified_at?` · Last verified ${new Date(b.verified_at).toLocaleString()}`:"",". Your API key is stored securely using AES-256 encryption. It is never shown again."]}),e.jsxs("label",{className:"settings-fallback-control",children:[e.jsx(z,{checked:b.fallback_enabled,disabled:G.isPending,onCheckedChange:n=>G.mutate(!!n)}),e.jsxs("span",{children:[e.jsx("strong",{children:"Use my OpenRouter key when Papers With Code-funded OpenRouter access is unavailable"}),e.jsx("small",{children:"OpenRouter bills this usage to your own account. It is not covered by Papers With Code."})]})]}),e.jsx("p",{className:"settings-billing-help",children:"Disconnecting prevents new requests but cannot cancel a request already sent to OpenRouter."}),e.jsxs("div",{className:"settings-billing-actions",children:[e.jsx("button",{className:"button",type:"button",disabled:X.isPending,onClick:()=>X.mutate(),children:"Disconnect"}),e.jsxs("a",{className:"button",href:qe,target:"_blank",rel:"noreferrer",children:["Revoke or rotate at OpenRouter ",e.jsx(se,{"aria-hidden":"true"})]})]})]}):e.jsxs("form",{onSubmit:n=>{n.preventDefault(),k.trim()&&$.mutate(k.trim())},children:[e.jsx("label",{className:"settings-token-label",htmlFor:"openrouter-api-key",children:"OpenRouter API key"}),e.jsx("input",{id:"openrouter-api-key",type:"password",autoComplete:"off",value:k,onChange:n=>i(n.target.value),placeholder:"sk-or-…"}),e.jsx("p",{className:"settings-billing-help",children:"Connecting stores the key but does not authorize paid fallback. Enable billing separately after it is verified."}),e.jsx("div",{className:"settings-billing-actions",children:e.jsx("button",{className:"button button-primary",type:"submit",disabled:!k.trim()||$.isPending,children:$.isPending?"Verifying…":"Connect key"})})]}),o&&e.jsxs("div",{className:"settings-token-error",children:[e.jsx("p",{children:E==="fresh_auth_required"?"Your account is signed in, but adding or enabling an API key requires a Hugging Face sign-in from the last 15 minutes.":o}),E==="fresh_auth_required"&&e.jsx("div",{className:"settings-billing-actions",children:e.jsx(R,{returnTo:"/settings#openrouter-byok",label:"Re-authenticate with Hugging Face"})})]})]})]}),te&&e.jsx("div",{className:"settings-note settings-note-flush",role:"note",children:"Direct OpenAI usage is provided by Papers With Code. No OpenAI API key or billing account is required from you."})]}):e.jsxs("div",{className:"settings-note settings-note-flush",children:[e.jsx("span",{children:"Sign in to manage billing and credentials for the enabled chat providers."}),e.jsx("div",{className:"settings-note-action",children:e.jsx(R,{returnTo:"/settings",authorizeInference:!0})})]})]}),t&&e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Chat privacy & retention"}),e.jsx("div",{className:"settings-note settings-note-flush",children:e.jsx("span",{children:"Chats are private and retained until you delete them. You can keep up to 500 active chats and 100 MB of chat data. Archiving removes chats from the active list and frees active-chat quota, but does not delete them. Deleting a chat permanently removes its durable transcript, workspace reference, and any public share link after deletion is verified. You can deliberately share an unlisted snapshot, but no dedicated private-chat export format is currently offered."})})]}),e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Appearance"}),e.jsx("div",{className:"theme-options","aria-label":"Color theme",children:[{value:"system",label:"System",description:"Match your device",icon:Re},{value:"light",label:"Light",description:"Always use light mode",icon:_e},{value:"dark",label:"Dark",description:"Always use dark mode",icon:we}].map(n=>{const B=n.icon,J=c===n.value;return e.jsxs("button",{type:"button",className:`theme-option ${J?"is-selected":""}`,"aria-pressed":J,onClick:()=>a(n.value),children:[e.jsx(B,{"aria-hidden":"true"}),e.jsxs("span",{className:"theme-option-copy",children:[e.jsx("span",{className:"theme-option-label",children:n.label}),e.jsx("span",{className:"theme-option-desc",children:n.description})]})]},n.value)})})]}),e.jsxs("section",{className:"settings-section",children:[e.jsx("h2",{className:"settings-section-title",children:"Evaluations"}),e.jsxs("div",{className:"settings-row",children:[e.jsxs("label",{className:"settings-row-text",htmlFor:"hide-closed-source-evals",children:[e.jsx("span",{className:"settings-row-label",children:"Hide closed-source models"}),e.jsx("span",{className:"settings-row-desc",children:"When enabled, evaluations of closed-source models (proprietary APIs and unreleased flagship models) are hidden from benchmark leaderboards and paper result tables."})]}),e.jsx(z,{id:"hide-closed-source-evals",checked:h.hide_closed_source_evals,onCheckedChange:n=>{j(!!n)}})]}),!l&&!d&&!s&&e.jsxs("div",{className:"settings-note",children:[e.jsx("span",{children:"You are browsing as a guest, so this choice only applies to the current session. Sign in to save it to your account."}),e.jsx("div",{className:"settings-note-action",children:e.jsx(R,{returnTo:"/settings"})})]})]})]})]})};export{es as default}; diff --git a/assets/SharedChatView-Cd2cL7B4.js b/assets/SharedChatView-Cd2cL7B4.js new file mode 100644 index 0000000000000000000000000000000000000000..6a2ea7c72f1ee18871820ace0b12b9a58c9cf56c --- /dev/null +++ b/assets/SharedChatView-Cd2cL7B4.js @@ -0,0 +1 @@ +import{u as f,e as x,d as h,b as g,j as e,q as v}from"./index-DyXq7-Tg.js";import{A as j,a as b,C as y,U as S,b as k}from"./ArtifactWorkspace-Ya79_F5k.js";import{C as m,e as w,p as N,q,g as C}from"./chatSessions-Ck_dyM0d.js";/* empty css */import"./hover-card-B45EJIn_.js";import"./CatalogEntityPreviewLink-BktpwL3_.js";import"./catalog-CRar2olQ.js";import"./github-RNrgGHRT.js";import"./file-text-dvKtHbmD.js";import"./PaperPreviewLink-CpCZSa8K.js";import"./index-mCi_y_l3.js";import"./index-2CvJmBVB.js";import"./katex-DkKDou_j.js";import"./papers-Dh3ljlL0.js";import"./curation-YeS7FBYf.js";import"./useMutation-UWxBeqtn.js";import"./chat-Ix1IrIwq.js";import"./copy-CxR0OKx2.js";import"./thumbs-up-CPLlGli7.js";import"./arrow-left-PA_b6law.js";import"./external-link-orY1Xz1I.js";import"./plus-Yh42pKZz.js";import"./search-8ssWDP68.js";import"./chevron-up-DYSYRyvz.js";import"./AuthorAvatar-B-9xS2Wo.js";const _=({detail:i})=>{const[d,l]=h.useState(()=>N(i)),p=h.useMemo(()=>{const t={};for(const c of d)for(const n of c.blocks??[])if(n.kind==="tool")for(const r of n.results??[])t[r.route_id]=r;return t},[d]),u=(t,c)=>{l(n=>n.map(r=>{var a;return r.id!==t?r:{...r,blocks:(a=r.blocks)==null?void 0:a.map((s,o)=>o===c&&(s.kind==="reasoning"||s.kind==="tool")?{...s,open:!s.open}:s)}}))};return e.jsx("div",{className:"shared-chat-transcript",children:d.map(t=>t.role==="user"?e.jsx(S,{id:t.id,text:t.text??"",paperMentions:t.paperMentions??[],paperSelection:t.paperSelection},t.id):e.jsx(k,{msg:t,papers:p,onToggleBlock:u},t.id))})},ee=()=>{const{shareId:i=""}=f(),d=x(),l=v(),[p,u]=h.useState(60),t=g({queryKey:["shared-chat",i],queryFn:()=>C(i),retry:(r,a)=>!(a instanceof m&&a.status===404)&&r<1});h.useEffect(()=>{const r=document.title,a=document.head.querySelector('meta[name="robots"]'),s=a==null?void 0:a.content,o=a??document.createElement("meta");return o.name="robots",o.content="noindex,nofollow",a||document.head.appendChild(o),document.title="Shared conversation",()=>{document.title=r,a?a.content=s??"":o.remove()}},[]),h.useLayoutEffect(()=>{const r=document.querySelector(".app-header");if(!r)return;const a=()=>u(r.offsetHeight);a();const s=new ResizeObserver(a);return s.observe(r),()=>s.disconnect()},[]);const c=r=>{q(r,void 0,{autoSend:!1}),d("/chat")},n=t.error instanceof m&&t.error.status===404;return t.isLoading?e.jsxs("div",{className:"shared-chat-state",role:"status",children:[e.jsx(w,{})," Loading shared conversation…"]}):n?e.jsxs("div",{className:"shared-chat-state shared-chat-not-found",children:[e.jsx("h1",{children:"Shared conversation not found"}),e.jsx("p",{children:"This link is invalid or is no longer available."})]}):t.isError||!t.data?e.jsxs("div",{className:"shared-chat-state",role:"alert",children:[e.jsx("h1",{children:"Couldn’t load this conversation"}),e.jsx("p",{children:"Please check your connection and try again."}),e.jsx("button",{type:"button",onClick:()=>void t.refetch(),children:"Try again"})]}):e.jsx(j,{workspaceKey:`share:${i}:${t.data.updated_at}`,autoOpenOnMount:!0,children:e.jsxs("div",{className:"shared-chat-page",style:{height:`calc(100dvh - ${p}px)`},children:[e.jsxs("div",{className:"shared-chat-heading",children:[e.jsx("h1",{children:"Shared conversation"}),l&&e.jsx("span",{className:"chat-staging-badge",children:"Staging"})]}),e.jsx(b,{variant:"shared",children:e.jsxs("div",{className:"shared-chat-content","data-testid":"shared-conversation-pane",children:[e.jsx(_,{detail:t.data},t.data.updated_at),t.data.model_label&&e.jsxs("div",{className:"shared-chat-attribution",children:[e.jsxs("span",{children:["Generated with ",t.data.model_label]}),t.data.model_provider==="huggingface"&&e.jsxs("span",{children:["Powered by ",e.jsx("span",{"aria-hidden":"true",children:"🤗"})," ",e.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"})]}),t.data.model_provider==="openrouter"&&e.jsxs("span",{children:["Powered by ",e.jsx("a",{href:"https://openrouter.ai",target:"_blank",rel:"noreferrer",children:"OpenRouter"})]}),t.data.model_provider==="openai"&&e.jsx("span",{children:"Powered by OpenAI"})]}),e.jsxs("section",{className:"shared-chat-fresh","aria-labelledby":"shared-chat-fresh-title",children:[e.jsx("h2",{id:"shared-chat-fresh-title",children:"Start a new conversation"}),e.jsx("p",{children:"Your new question starts with an empty context."}),l&&e.jsxs("div",{className:"shared-chat-access-note",role:"note",children:[e.jsx("strong",{children:"Limited staging preview."})," Starting a chat is available only to approved Hugging Face users."]}),e.jsx(y,{onSend:r=>c(r.text),placeholder:"Ask a new research question…"})]})]})})]})})};export{ee as default}; diff --git a/assets/SharedChatView-DO_TTtXn.js b/assets/SharedChatView-DO_TTtXn.js deleted file mode 100644 index 86fd98fdec73ce7613e2af4ede57397a3077dfa7..0000000000000000000000000000000000000000 --- a/assets/SharedChatView-DO_TTtXn.js +++ /dev/null @@ -1 +0,0 @@ -import{u as f,c as x,r as h,j as e,m as g}from"./index-CbgxfyGU.js";import{u as v}from"./useQuery-Bx9s5-D2.js";import{A as j,a as b,C as y,U as S,b as k}from"./ArtifactWorkspace-Cwix1Wp6.js";import{C as m,e as w,p as N,q as C,g as q}from"./chatSessions-DwLUbLRo.js";/* empty css */import"./hover-card-ufez2uMo.js";import"./CatalogEntityPreviewLink-Cvehtzvn.js";import"./catalog-DhK7_9-6.js";import"./github-BYklgHDz.js";import"./file-text-BK_7Q2rV.js";import"./PaperPreviewLink-DZDNIh1g.js";import"./index-ZkEATkOr.js";import"./index-BH3yOoza.js";import"./katex-DkKDou_j.js";import"./paperQueryKeys-B8u1BWlI.js";import"./curation-C7Gmmp4z.js";import"./useMutation-P_trTy9i.js";import"./chat-DzTo2WUO.js";import"./copy-bzw7JVus.js";import"./thumbs-up-CDCzGuPd.js";import"./arrow-left-Czeu3VzJ.js";import"./external-link-DZIH4GGr.js";import"./plus-UK0TEjgd.js";import"./search-CLtAJGOp.js";import"./chevron-up-Cpt5JLeI.js";import"./AuthorAvatar-CUJMmp_z.js";const _=({detail:i})=>{const[d,l]=h.useState(()=>N(i)),p=h.useMemo(()=>{const t={};for(const c of d)for(const n of c.blocks??[])if(n.kind==="tool")for(const r of n.results??[])t[r.route_id]=r;return t},[d]),u=(t,c)=>{l(n=>n.map(r=>{var a;return r.id!==t?r:{...r,blocks:(a=r.blocks)==null?void 0:a.map((s,o)=>o===c&&(s.kind==="reasoning"||s.kind==="tool")?{...s,open:!s.open}:s)}}))};return e.jsx("div",{className:"shared-chat-transcript",children:d.map(t=>t.role==="user"?e.jsx(S,{id:t.id,text:t.text??"",paperMentions:t.paperMentions??[],paperSelection:t.paperSelection},t.id):e.jsx(k,{msg:t,papers:p,onToggleBlock:u},t.id))})},te=()=>{const{shareId:i=""}=f(),d=x(),l=g(),[p,u]=h.useState(60),t=v({queryKey:["shared-chat",i],queryFn:()=>q(i),retry:(r,a)=>!(a instanceof m&&a.status===404)&&r<1});h.useEffect(()=>{const r=document.title,a=document.head.querySelector('meta[name="robots"]'),s=a==null?void 0:a.content,o=a??document.createElement("meta");return o.name="robots",o.content="noindex,nofollow",a||document.head.appendChild(o),document.title="Shared conversation",()=>{document.title=r,a?a.content=s??"":o.remove()}},[]),h.useLayoutEffect(()=>{const r=document.querySelector(".app-header");if(!r)return;const a=()=>u(r.offsetHeight);a();const s=new ResizeObserver(a);return s.observe(r),()=>s.disconnect()},[]);const c=r=>{C(r,void 0,{autoSend:!1}),d("/chat")},n=t.error instanceof m&&t.error.status===404;return t.isLoading?e.jsxs("div",{className:"shared-chat-state",role:"status",children:[e.jsx(w,{})," Loading shared conversation…"]}):n?e.jsxs("div",{className:"shared-chat-state shared-chat-not-found",children:[e.jsx("h1",{children:"Shared conversation not found"}),e.jsx("p",{children:"This link is invalid or is no longer available."})]}):t.isError||!t.data?e.jsxs("div",{className:"shared-chat-state",role:"alert",children:[e.jsx("h1",{children:"Couldn’t load this conversation"}),e.jsx("p",{children:"Please check your connection and try again."}),e.jsx("button",{type:"button",onClick:()=>void t.refetch(),children:"Try again"})]}):e.jsx(j,{workspaceKey:`share:${i}:${t.data.updated_at}`,autoOpenOnMount:!0,children:e.jsxs("div",{className:"shared-chat-page",style:{height:`calc(100dvh - ${p}px)`},children:[e.jsxs("div",{className:"shared-chat-heading",children:[e.jsx("h1",{children:"Shared conversation"}),l&&e.jsx("span",{className:"chat-staging-badge",children:"Staging"})]}),e.jsx(b,{variant:"shared",children:e.jsxs("div",{className:"shared-chat-content","data-testid":"shared-conversation-pane",children:[e.jsx(_,{detail:t.data},t.data.updated_at),t.data.model_label&&e.jsxs("div",{className:"shared-chat-attribution",children:[e.jsxs("span",{children:["Generated with ",t.data.model_label]}),t.data.model_provider==="huggingface"&&e.jsxs("span",{children:["Powered by ",e.jsx("span",{"aria-hidden":"true",children:"🤗"})," ",e.jsx("a",{href:"https://huggingface.co/docs/inference-providers/en/index",target:"_blank",rel:"noreferrer",children:"Inference Providers"})]}),t.data.model_provider==="openrouter"&&e.jsxs("span",{children:["Powered by ",e.jsx("a",{href:"https://openrouter.ai",target:"_blank",rel:"noreferrer",children:"OpenRouter"})]}),t.data.model_provider==="openai"&&e.jsx("span",{children:"Powered by OpenAI"})]}),e.jsxs("section",{className:"shared-chat-fresh","aria-labelledby":"shared-chat-fresh-title",children:[e.jsx("h2",{id:"shared-chat-fresh-title",children:"Start a new conversation"}),e.jsx("p",{children:"Your new question starts with an empty context."}),l&&e.jsxs("div",{className:"shared-chat-access-note",role:"note",children:[e.jsx("strong",{children:"Limited staging preview."})," Starting a chat is available only to approved Hugging Face users."]}),e.jsx(y,{onSend:r=>c(r.text),placeholder:"Ask a new research question…"})]})]})})]})})};export{te as default}; diff --git a/assets/SignInToEditDialog-CNIcNqbK.js b/assets/SignInToEditDialog-B-oWVno5.js similarity index 69% rename from assets/SignInToEditDialog-CNIcNqbK.js rename to assets/SignInToEditDialog-B-oWVno5.js index f7a81841b84eca4f79c7fee823e5c6d5f496e7f6..296f74a27de6380ebe94c8f5bb5cc008c29058d6 100644 --- a/assets/SignInToEditDialog-CNIcNqbK.js +++ b/assets/SignInToEditDialog-B-oWVno5.js @@ -1,6 +1,6 @@ -import{n as be,r as a,j as e,a7 as je,B as fe,a8 as ye,p as Ne,t as we,X as Se,C as _e,H as ke}from"./index-CbgxfyGU.js";import{B as P}from"./button-Bv9oZ-QU.js";import{I as u}from"./input-B6pxtfPe.js";import{T as Ce}from"./textarea-Bf06GTSH.js";import{S as te}from"./searchable-select-DNdBIahG.js";import{D as ie,a as oe,c as le,b as ce,d as de,e as De}from"./dialog-Cfp_d3CC.js";import{u as Ie}from"./useMutation-P_trTy9i.js";import{s as b,p as j}from"./submissions-aWj7YtuZ.js";import{c as se}from"./catalog-DhK7_9-6.js";import{L as Ee}from"./loader-circle-CWMja8Zn.js";/** +import{s as be,d as a,j as e,ad as je,G as fe,ae as ye,x as Ne,y as we,X as Se,C as _e,H as ke}from"./index-DyXq7-Tg.js";import{B as P}from"./button-DZeAbOf2.js";import{I as u}from"./input-DJqCAbs7.js";import{T as Ce}from"./textarea-DPixlM5U.js";import{S as se}from"./searchable-select-DiDLwvbI.js";import{D as ie,a as oe,c as le,b as ce,d as de,e as De}from"./dialog-CfM0Uql2.js";import{u as Ie}from"./useMutation-UWxBeqtn.js";import{s as b,p as j}from"./submissions-Cz_J-Ha2.js";import{c as te}from"./catalog-CRar2olQ.js";import{L as Ee}from"./loader-circle-C75KLEgx.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Me=be("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);var Le=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pe=Le.reduce((l,c)=>{const d=je(`Primitive.${c}`),s=a.forwardRef((o,f)=>{const{asChild:m,...y}=o,p=m?d:c;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(p,{...y,ref:f})});return s.displayName=`Primitive.${c}`,{...l,[c]:s}},{}),Fe="Label",ue=a.forwardRef((l,c)=>e.jsx(Pe.label,{...l,ref:c,onMouseDown:d=>{var o;d.target.closest("button, input, select, textarea")||((o=l.onMouseDown)==null||o.call(l,d),!d.defaultPrevented&&d.detail>1&&d.preventDefault())}}));ue.displayName=Fe;var me=ue;const Ae=ye("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),i=a.forwardRef(({className:l,...c},d)=>e.jsx(me,{ref:d,className:fe(Ae(),l),...c}));i.displayName=me.displayName;const ae=200,Be=2e3,Re=300,Te=500,re=1e3,Ge=2*1024*1024,ne=["image/jpeg","image/png","image/webp","image/gif"],He={task:"e.g. Long-context Retrieval",method:"e.g. Rotary Position Embedding",benchmark:"e.g. ImageNet (ReaL)",metric:"e.g. Top-5 Accuracy",conference:"e.g. International Conference on Machine Learning 2026"},Ue={task:"Briefly describe this task and what it covers.",method:"Briefly describe this method and what it covers.",benchmark:"Briefly describe this benchmark, the task it belongs to, and where it comes from.",metric:"Briefly describe this metric and whether higher or lower is better.",conference:"Briefly describe this conference, including its research focus and edition."};function Qe({open:l,onOpenChange:c,paperId:d,kind:s}){const[o,f]=a.useState(""),[m,y]=a.useState(""),[p,F]=a.useState(""),[A,B]=a.useState(""),[R,T]=a.useState(""),[G,H]=a.useState(""),[S,U]=a.useState(""),[x,_]=a.useState(null),[k,O]=a.useState(""),[C,V]=a.useState(""),[X,K]=a.useState(""),[D,z]=a.useState(""),[I,$]=a.useState(""),[E,q]=a.useState(""),[n,Y]=a.useState(null),[g,M]=a.useState(null),[J,W]=a.useState("higher_is_better"),[Q,h]=a.useState(""),N=a.useRef(null),{toast:Z}=Ne(),w=s,ge=s==="task"||s==="method";a.useEffect(()=>{l||(f(""),y(""),F(""),B(""),T(""),H(""),U(""),_(null),O(""),V(""),K(""),z(""),$(""),q(""),Y(null),M(null),W("higher_is_better"),h(""))},[l]);const ee=t=>{if(!t)return;if(h(""),!ne.includes(t.type)){h("Choose a JPEG, PNG, WebP, or GIF image.");return}if(t.size>Ge){h("Image must be 2 MB or smaller.");return}const r=new FileReader;r.onload=()=>{if(typeof r.result!="string"){h("Could not read that image.");return}_({file_name:t.name,mime_type:t.type,data_url:r.result})},r.onerror=()=>h("Could not read that image."),r.readAsDataURL(t)},he=t=>{t.preventDefault(),ee(t.dataTransfer.files[0])},pe=async t=>(await se.listTasks({page_size:100,...t?{q:t}:{}})).results.map(v=>({value:v.id,label:v.name})),xe=async t=>n?(await se.listDatasets({task_id:Number(n.value),page_size:100,...t?{q:t}:{}})).results.map(v=>({value:v.id,label:v.name})):[],L=Ie({mutationFn:async()=>{const t=d?parseInt(d):null,r=m.trim()||void 0;switch(s){case"task":return b.submit(j(t,"new_task",{name:o.trim(),description:r,image:x??void 0,image_credit:k.trim()||void 0,keywords:X.trim()||void 0,parent_id:D?Number(D):void 0,area_id:I?Number(I):void 0}));case"method":return b.submit(j(t,"new_method",{name:o.trim(),description:r,image:x??void 0,image_credit:k.trim()||void 0,source_url:C.trim()||void 0}));case"benchmark":return b.submit(j(t,"new_benchmark",{benchmark:o.trim(),task:E.trim(),description:m.trim()}));case"metric":return b.submit(j(t,"new_metric",{name:o.trim(),description:m.trim(),direction:J==="lower_is_better"?"lower_is_better":"higher_is_better",task_id:Number(n==null?void 0:n.value),dataset_id:Number(g==null?void 0:g.value)}));case"conference":return b.submit(j(t,"new_conference",{name:o.trim(),description:r,year:Number(p),start_date:A||void 0,end_date:R||void 0,venue:G.trim()||void 0,url:S.trim()}))}},onSuccess:()=>{Z({title:"Suggestion submitted for review",description:`Thanks! An admin will review your suggested ${w} shortly.`}),c(!1)},onError:t=>{const r=we(t,`Failed to submit your ${w} suggestion.`);Z({title:"Could not submit suggestion",description:r,variant:"destructive"})}}),ve=o.trim().length>0&&(s==="task"||s==="method"&&!!C.trim()||s==="conference"&&!!p&&!!S.trim()||s==="benchmark"&&!!E.trim()&&!!m.trim()||s==="metric"&&!!n&&!!g&&!!m.trim());return e.jsx(ie,{open:l,onOpenChange:c,children:e.jsxs(oe,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(le,{children:[e.jsxs(ce,{children:["Suggest a new ",w]}),e.jsxs(de,{children:["Propose a ",w," that isn't in the list yet. An admin will review the suggestion, but approval won't automatically change the catalog."]})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-name",children:s==="benchmark"?"Benchmark":"Name"}),e.jsx(u,{id:"suggest-name",value:o,maxLength:ae,placeholder:He[s],onChange:t=>f(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{htmlFor:"suggest-description",children:["Description",s==="task"||s==="method"||s==="conference"?" (optional)":""]}),e.jsx(Ce,{id:"suggest-description",value:m,maxLength:Be,placeholder:Ue[s],onChange:t=>y(t.target.value)})]}),s==="task"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-keywords",children:"Keywords (optional)"}),e.jsx(u,{id:"suggest-keywords",value:X,onChange:t=>K(t.target.value),placeholder:"comma-separated matching terms"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(u,{type:"number",min:"1",value:D,onChange:t=>z(t.target.value),placeholder:"Parent task ID (optional)"}),e.jsx(u,{type:"number",min:"1",value:I,onChange:t=>$(t.target.value),placeholder:"Area ID (optional)"})]})]}),s==="benchmark"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-benchmark-task",children:"Task"}),e.jsx(u,{id:"suggest-benchmark-task",value:E,maxLength:ae,placeholder:"e.g. Deepfake Detection",onChange:t=>q(t.target.value)})]}),s==="metric"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(i,{children:"Intended leaderboard"}),e.jsxs("select",{"aria-label":"Metric direction",className:"w-full rounded-md border bg-background p-2",value:J,onChange:t=>W(t.target.value),children:[e.jsx("option",{value:"higher_is_better",children:"Higher is better"}),e.jsx("option",{value:"lower_is_better",children:"Lower is better"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Task"}),e.jsx(te,{value:(n==null?void 0:n.value)??"",onChange:(t,r)=>{Y(r),M(null)},selectedOption:n,placeholder:"Select task",searchPlaceholder:"Search tasks...",emptyMessage:"No tasks found.",errorMessage:"Could not load tasks. Try again.",queryKey:["suggest-metric-task-search"],queryFn:pe,ariaLabel:"Select task",className:"h-10"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Benchmark"}),e.jsx(te,{value:(g==null?void 0:g.value)??"",onChange:(t,r)=>M(r),selectedOption:g,placeholder:n?"Select benchmark":"Select task first",searchPlaceholder:"Search benchmarks...",emptyMessage:"No benchmarks found for this task.",errorMessage:"Could not load benchmarks. Try again.",disabled:!n,queryKey:["suggest-metric-benchmark-search",n==null?void 0:n.value],queryFn:xe,enabled:!!n,ariaLabel:"Select benchmark",className:"h-10"})]})]})]}),ge&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Image (optional)"}),e.jsx("input",{ref:N,className:"sr-only",type:"file",accept:ne.join(","),onChange:t=>{var r;return ee((r=t.target.files)==null?void 0:r[0])}}),x?e.jsxs("div",{className:"relative overflow-hidden rounded-md border border-border bg-muted/30",children:[e.jsx("img",{src:x.data_url,alt:"Selected suggestion",className:"max-h-48 w-full object-contain"}),e.jsxs(P,{type:"button",variant:"secondary",size:"sm",className:"absolute right-2 top-2 h-8 px-2",onClick:()=>{_(null),N.current&&(N.current.value="")},children:[e.jsx(Se,{className:"mr-1 h-4 w-4"}),"Remove"]}),e.jsx("div",{className:"truncate border-t border-border px-3 py-2 text-xs text-muted-foreground",children:x.file_name})]}):e.jsxs("button",{type:"button",className:"flex w-full flex-col items-center justify-center rounded-md border border-dashed border-border px-4 py-6 text-center text-sm text-muted-foreground transition-colors hover:border-foreground/50 hover:text-foreground",onClick:()=>{var t;return(t=N.current)==null?void 0:t.click()},onDragOver:t=>t.preventDefault(),onDrop:he,children:[e.jsx(Me,{className:"mb-2 h-6 w-6"}),e.jsx("span",{children:"Drop an image here, or click to choose one"}),e.jsx("span",{className:"mt-1 text-xs",children:"JPEG, PNG, WebP, or GIF · max 2 MB"})]}),Q&&e.jsx("p",{className:"text-sm text-destructive",role:"alert",children:Q})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-image-source",children:"Image source (optional)"}),e.jsx(u,{id:"suggest-image-source",value:k,maxLength:re,placeholder:"Creator, publication, or source URL",onChange:t=>O(t.target.value)})]}),s==="method"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-method-source",children:"Source URL (optional)"}),e.jsx(u,{id:"suggest-method-source",value:C,maxLength:re,placeholder:"https://arxiv.org/abs/...",onChange:t=>V(t.target.value)})]})]}),s==="conference"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-year",children:"Edition year"}),e.jsx(u,{id:"suggest-year",type:"number",min:"1900",max:"2200",value:p,placeholder:"2026",onChange:t=>F(t.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(i,{htmlFor:"suggest-start-date",children:"Start date (optional)"}),e.jsx(u,{id:"suggest-start-date",type:"date",value:A,onChange:t=>B(t.target.value)})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"suggest-end-date",children:"End date (optional)"}),e.jsx(u,{id:"suggest-end-date",type:"date",value:R,onChange:t=>T(t.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-venue",children:"Venue (optional)"}),e.jsx(u,{id:"suggest-venue",value:G,maxLength:Re,placeholder:"e.g. Vancouver Convention Centre, Canada",onChange:t=>H(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-url",children:"URL (optional)"}),e.jsx(u,{id:"suggest-url",type:"url",inputMode:"url",value:S,maxLength:Te,placeholder:"https://example.org/conference",onChange:t=>U(t.target.value)})]})]})]}),e.jsxs(De,{children:[e.jsx(P,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(P,{onClick:()=>L.mutate(),disabled:L.isPending||!ve,children:L.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{className:"w-4 h-4 mr-2 animate-spin"}),"Submitting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{className:"w-4 h-4 mr-2"}),"Submit suggestion"]})})]})]})})}function Ze({open:l,onOpenChange:c,sectionLabel:d,returnTo:s,taxonomySuggestion:o=!1}){return e.jsx(ie,{open:l,onOpenChange:c,children:e.jsxs(oe,{className:"max-w-md",children:[e.jsxs(le,{children:[e.jsxs(ce,{children:["Sign in to ",o?"suggest":"edit"," ",d]}),e.jsx(de,{children:o?"Sign in with your Hugging Face account so an admin can review your suggestion.":"Anyone can suggest edits to a paper page. Sign in with your Hugging Face account first so an admin can review your submission."})]}),e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(ke,{returnTo:s})})]})})}export{i as L,Qe as S,Ze as a}; + */const Me=be("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);var Le=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pe=Le.reduce((l,c)=>{const d=je(`Primitive.${c}`),t=a.forwardRef((o,f)=>{const{asChild:m,...y}=o,p=m?d:c;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(p,{...y,ref:f})});return t.displayName=`Primitive.${c}`,{...l,[c]:t}},{}),Fe="Label",ue=a.forwardRef((l,c)=>e.jsx(Pe.label,{...l,ref:c,onMouseDown:d=>{var o;d.target.closest("button, input, select, textarea")||((o=l.onMouseDown)==null||o.call(l,d),!d.defaultPrevented&&d.detail>1&&d.preventDefault())}}));ue.displayName=Fe;var me=ue;const Ae=ye("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),i=a.forwardRef(({className:l,...c},d)=>e.jsx(me,{ref:d,className:fe(Ae(),l),...c}));i.displayName=me.displayName;const ae=200,Be=2e3,Re=300,Te=500,re=1e3,Ge=2*1024*1024,ne=["image/jpeg","image/png","image/webp","image/gif"],He={task:"e.g. Long-context Retrieval",method:"e.g. Rotary Position Embedding",benchmark:"e.g. ImageNet (ReaL)",metric:"e.g. Top-5 Accuracy",conference:"e.g. International Conference on Machine Learning 2026"},Ue={task:"Briefly describe this task and what it covers.",method:"Briefly describe this method and what it covers.",benchmark:"Briefly describe this benchmark, the task it belongs to, and where it comes from.",metric:"Briefly describe this metric and whether higher or lower is better.",conference:"Briefly describe this conference, including its research focus and edition."};function Qe({open:l,onOpenChange:c,paperId:d,kind:t}){const[o,f]=a.useState(""),[m,y]=a.useState(""),[p,F]=a.useState(""),[A,B]=a.useState(""),[R,T]=a.useState(""),[G,H]=a.useState(""),[S,U]=a.useState(""),[x,_]=a.useState(null),[k,O]=a.useState(""),[C,V]=a.useState(""),[X,K]=a.useState(""),[D,z]=a.useState(""),[I,$]=a.useState(""),[E,q]=a.useState(""),[n,Y]=a.useState(null),[g,M]=a.useState(null),[J,W]=a.useState("higher_is_better"),[Q,h]=a.useState(""),N=a.useRef(null),{toast:Z}=Ne(),w=t,ge=t==="task"||t==="method";a.useEffect(()=>{l||(f(""),y(""),F(""),B(""),T(""),H(""),U(""),_(null),O(""),V(""),K(""),z(""),$(""),q(""),Y(null),M(null),W("higher_is_better"),h(""))},[l]);const ee=s=>{if(!s)return;if(h(""),!ne.includes(s.type)){h("Choose a JPEG, PNG, WebP, or GIF image.");return}if(s.size>Ge){h("Image must be 2 MB or smaller.");return}const r=new FileReader;r.onload=()=>{if(typeof r.result!="string"){h("Could not read that image.");return}_({file_name:s.name,mime_type:s.type,data_url:r.result})},r.onerror=()=>h("Could not read that image."),r.readAsDataURL(s)},he=s=>{s.preventDefault(),ee(s.dataTransfer.files[0])},pe=async s=>(await te.listTasks({page_size:100,...s?{q:s}:{}})).results.map(v=>({value:v.id,label:v.name})),xe=async s=>n?(await te.listDatasets({task_id:Number(n.value),page_size:100,...s?{q:s}:{}})).results.map(v=>({value:v.id,label:v.name})):[],L=Ie({mutationFn:async()=>{const s=d?parseInt(d):null,r=m.trim()||void 0;switch(t){case"task":return b.submit(j(s,"new_task",{name:o.trim(),description:r,image:x??void 0,image_credit:k.trim()||void 0,keywords:X.trim()||void 0,parent_id:D?Number(D):void 0,area_id:I?Number(I):void 0}));case"method":return b.submit(j(s,"new_method",{name:o.trim(),description:r,image:x??void 0,image_credit:k.trim()||void 0,source_url:C.trim()||void 0}));case"benchmark":return b.submit(j(s,"new_benchmark",{benchmark:o.trim(),task:E.trim(),description:m.trim()}));case"metric":return b.submit(j(s,"new_metric",{name:o.trim(),description:m.trim(),direction:J==="lower_is_better"?"lower_is_better":"higher_is_better",task_id:Number(n==null?void 0:n.value),dataset_id:Number(g==null?void 0:g.value)}));case"conference":return b.submit(j(s,"new_conference",{name:o.trim(),description:r,year:Number(p),start_date:A||void 0,end_date:R||void 0,venue:G.trim()||void 0,url:S.trim()}))}},onSuccess:()=>{Z({title:"Suggestion submitted for review",description:`Thanks! An admin will review your suggested ${w} shortly.`}),c(!1)},onError:s=>{const r=we(s,`Failed to submit your ${w} suggestion.`);Z({title:"Could not submit suggestion",description:r,variant:"destructive"})}}),ve=o.trim().length>0&&(t==="task"||t==="method"&&!!C.trim()||t==="conference"&&!!p&&!!S.trim()||t==="benchmark"&&!!E.trim()&&!!m.trim()||t==="metric"&&!!n&&!!g&&!!m.trim());return e.jsx(ie,{open:l,onOpenChange:c,children:e.jsxs(oe,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(le,{children:[e.jsxs(ce,{children:["Suggest a new ",w]}),e.jsxs(de,{children:["Propose a ",w," that isn't in the list yet. An admin will review the suggestion, but approval won't automatically change the catalog."]})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-name",children:t==="benchmark"?"Benchmark":"Name"}),e.jsx(u,{id:"suggest-name",value:o,maxLength:ae,placeholder:He[t],onChange:s=>f(s.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(i,{htmlFor:"suggest-description",children:["Description",t==="task"||t==="method"||t==="conference"?" (optional)":""]}),e.jsx(Ce,{id:"suggest-description",value:m,maxLength:Be,placeholder:Ue[t],onChange:s=>y(s.target.value)})]}),t==="task"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-keywords",children:"Keywords (optional)"}),e.jsx(u,{id:"suggest-keywords",value:X,onChange:s=>K(s.target.value),placeholder:"comma-separated matching terms"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(u,{type:"number",min:"1",value:D,onChange:s=>z(s.target.value),placeholder:"Parent task ID (optional)"}),e.jsx(u,{type:"number",min:"1",value:I,onChange:s=>$(s.target.value),placeholder:"Area ID (optional)"})]})]}),t==="benchmark"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-benchmark-task",children:"Task"}),e.jsx(u,{id:"suggest-benchmark-task",value:E,maxLength:ae,placeholder:"e.g. Deepfake Detection",onChange:s=>q(s.target.value)})]}),t==="metric"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(i,{children:"Intended leaderboard"}),e.jsxs("select",{"aria-label":"Metric direction",className:"w-full rounded-md border bg-background p-2",value:J,onChange:s=>W(s.target.value),children:[e.jsx("option",{value:"higher_is_better",children:"Higher is better"}),e.jsx("option",{value:"lower_is_better",children:"Lower is better"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Task"}),e.jsx(se,{value:(n==null?void 0:n.value)??"",onChange:(s,r)=>{Y(r),M(null)},selectedOption:n,placeholder:"Select task",searchPlaceholder:"Search tasks...",emptyMessage:"No tasks found.",errorMessage:"Could not load tasks. Try again.",queryKey:["suggest-metric-task-search"],queryFn:pe,ariaLabel:"Select task",className:"h-10"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Benchmark"}),e.jsx(se,{value:(g==null?void 0:g.value)??"",onChange:(s,r)=>M(r),selectedOption:g,placeholder:n?"Select benchmark":"Select task first",searchPlaceholder:"Search benchmarks...",emptyMessage:"No benchmarks found for this task.",errorMessage:"Could not load benchmarks. Try again.",disabled:!n,queryKey:["suggest-metric-benchmark-search",n==null?void 0:n.value],queryFn:xe,enabled:!!n,ariaLabel:"Select benchmark",className:"h-10"})]})]})]}),ge&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Image (optional)"}),e.jsx("input",{ref:N,className:"sr-only",type:"file",accept:ne.join(","),onChange:s=>{var r;return ee((r=s.target.files)==null?void 0:r[0])}}),x?e.jsxs("div",{className:"relative overflow-hidden rounded-md border border-border bg-muted/30",children:[e.jsx("img",{src:x.data_url,alt:"Selected suggestion",className:"max-h-48 w-full object-contain"}),e.jsxs(P,{type:"button",variant:"secondary",size:"sm",className:"absolute right-2 top-2 h-8 px-2",onClick:()=>{_(null),N.current&&(N.current.value="")},children:[e.jsx(Se,{className:"mr-1 h-4 w-4"}),"Remove"]}),e.jsx("div",{className:"truncate border-t border-border px-3 py-2 text-xs text-muted-foreground",children:x.file_name})]}):e.jsxs("button",{type:"button",className:"flex w-full flex-col items-center justify-center rounded-md border border-dashed border-border px-4 py-6 text-center text-sm text-muted-foreground transition-colors hover:border-foreground/50 hover:text-foreground",onClick:()=>{var s;return(s=N.current)==null?void 0:s.click()},onDragOver:s=>s.preventDefault(),onDrop:he,children:[e.jsx(Me,{className:"mb-2 h-6 w-6"}),e.jsx("span",{children:"Drop an image here, or click to choose one"}),e.jsx("span",{className:"mt-1 text-xs",children:"JPEG, PNG, WebP, or GIF · max 2 MB"})]}),Q&&e.jsx("p",{className:"text-sm text-destructive",role:"alert",children:Q})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-image-source",children:"Image source (optional)"}),e.jsx(u,{id:"suggest-image-source",value:k,maxLength:re,placeholder:"Creator, publication, or source URL",onChange:s=>O(s.target.value)})]}),t==="method"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-method-source",children:"Source URL (optional)"}),e.jsx(u,{id:"suggest-method-source",value:C,maxLength:re,placeholder:"https://arxiv.org/abs/...",onChange:s=>V(s.target.value)})]})]}),t==="conference"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-year",children:"Edition year"}),e.jsx(u,{id:"suggest-year",type:"number",min:"1900",max:"2200",value:p,placeholder:"2026",onChange:s=>F(s.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(i,{htmlFor:"suggest-start-date",children:"Start date (optional)"}),e.jsx(u,{id:"suggest-start-date",type:"date",value:A,onChange:s=>B(s.target.value)})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"suggest-end-date",children:"End date (optional)"}),e.jsx(u,{id:"suggest-end-date",type:"date",value:R,onChange:s=>T(s.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-venue",children:"Venue (optional)"}),e.jsx(u,{id:"suggest-venue",value:G,maxLength:Re,placeholder:"e.g. Vancouver Convention Centre, Canada",onChange:s=>H(s.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"suggest-url",children:"URL (optional)"}),e.jsx(u,{id:"suggest-url",type:"url",inputMode:"url",value:S,maxLength:Te,placeholder:"https://example.org/conference",onChange:s=>U(s.target.value)})]})]})]}),e.jsxs(De,{children:[e.jsx(P,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(P,{onClick:()=>L.mutate(),disabled:L.isPending||!ve,children:L.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{className:"w-4 h-4 mr-2 animate-spin"}),"Submitting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{className:"w-4 h-4 mr-2"}),"Submit suggestion"]})})]})]})})}function Ze({open:l,onOpenChange:c,sectionLabel:d,returnTo:t,taxonomySuggestion:o=!1}){return e.jsx(ie,{open:l,onOpenChange:c,children:e.jsxs(oe,{className:"max-w-md",children:[e.jsxs(le,{children:[e.jsxs(ce,{children:["Sign in to ",o?"suggest":"edit"," ",d]}),e.jsx(de,{children:o?"Sign in with your Hugging Face account so an admin can review your suggestion.":"Anyone can suggest edits to a paper page. Sign in with your Hugging Face account first so an admin can review your submission."})]}),e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(ke,{returnTo:t})})]})})}export{i as L,Qe as S,Ze as a}; diff --git a/assets/SotaBadges-C-sTR-EF.js b/assets/SotaBadges-vbLLOUtT.js similarity index 95% rename from assets/SotaBadges-C-sTR-EF.js rename to assets/SotaBadges-vbLLOUtT.js index b045051906698e6f346262a6a489d0697618e38b..0b2a5d27c9a9ae7da16cd4685cb80fb4c362dd7e 100644 --- a/assets/SotaBadges-C-sTR-EF.js +++ b/assets/SotaBadges-vbLLOUtT.js @@ -1 +1 @@ -import{c as M,j as e,M as x,L as C}from"./index-CbgxfyGU.js";import{h as F,c as E}from"./colors-BkWRhvFI.js";import{d as A,h as P}from"./transform-0Udg2p6b.js";const D=({slug:t,label:s,onClick:r})=>{const a=M(),j=F(t),o=E(j),p=c=>{if(c.stopPropagation(),r){r(t);return}a(`/tasks/${t}`)};return e.jsxs("span",{className:"tag-chip",style:{background:o.bg,color:o.text},onClick:p,children:[e.jsx("span",{className:"dot",style:{background:o.dot}}),A(s||P(t),t)]})},I=({method:t,onClick:s})=>{const r=M(),a=t.slug||t.id||"";if(!a)return null;const j=o=>{if(o.stopPropagation(),s){s(a);return}r(`/methods/${a}`)};return e.jsx("span",{className:"method-chip",onClick:j,children:t.name})},W=t=>{let s=2166136261;for(let r=0;r(s=Math.imul(s^s>>>15,2246822507),s=Math.imul(s^s>>>13,3266489909),s^=s>>>16,(s>>>0)%1e4/1e4)},O=({paperId:t})=>{const s=W(t),r=160,a=220,j=[.85+s()*.1,.55+s()*.25],o=.45+s()*.3,p=[],c=9+Math.floor(s()*3);for(let y=0;y.3,l=Math.floor(s()*3),m=[],$=6+Math.floor(s()*3);for(let y=0;y<$;y++)m.push(.5+s()*.45);const d="#9A9588",u="#3A352D",i=5,h=(r-i*2-2)/2,k=i,f=i+h+2;let w=i+2;const R=w;w+=6;const T=w+1;w+=5;const L=w;w+=3;const g=w+1;return e.jsx("div",{style:{width:r,height:a,background:"#FDFCF9",border:"1px solid var(--hairline-strong)",borderRadius:2,boxShadow:"0 1px 0 rgba(0,0,0,0.04), 0 4px 8px -4px rgba(0,0,0,0.08)",flexShrink:0,overflow:"hidden",position:"relative"},children:e.jsxs("svg",{width:r,height:a,viewBox:`0 0 ${r} ${a}`,style:{display:"block"},children:[j.map((y,v)=>e.jsx("rect",{x:i+(r-i*2)*(1-y)/2,y:R+v*2.4,width:(r-i*2)*y,height:1.4,fill:u,rx:.3},`t${v}`)),e.jsx("rect",{x:i+(r-i*2)*(1-o)/2,y:T,width:(r-i*2)*o,height:.9,fill:d,opacity:.7,rx:.2}),e.jsx("rect",{x:i,y:L,width:6,height:1,fill:u,opacity:.6}),p.map((y,v)=>{const b=g+v*2.1;return b>a-i-1?null:e.jsx("rect",{x:k,y:b,width:h*y,height:.8,fill:d,opacity:.55,rx:.2},`l${v}`)}),n&&e.jsxs("g",{children:[e.jsx("rect",{x:f,y:g,width:h,height:14,fill:"#F0EBE0",stroke:d,strokeWidth:.3,opacity:.9}),l===0&&e.jsx("g",{stroke:u,strokeWidth:.4,fill:"none",opacity:.6,children:e.jsx("polyline",{points:`${f+2},${g+11} ${f+6},${g+8} ${f+10},${g+9} ${f+14},${g+5} ${f+18},${g+6} ${f+22},${g+3}`})}),l===1&&e.jsxs("g",{opacity:.55,children:[e.jsx("circle",{cx:f+h/2,cy:g+7,r:3.5,fill:u}),e.jsx("rect",{x:f+2,y:g+11,width:h-4,height:1.5,fill:d})]}),l===2&&e.jsxs("g",{opacity:.55,children:[e.jsx("rect",{x:f+3,y:g+5,width:h-6,height:1,fill:u}),e.jsx("rect",{x:f+6,y:g+8,width:h-12,height:.8,fill:u})]})]}),m.map((y,v)=>{const b=g+(n?16:0)+v*2.1;return b>a-i-1?null:e.jsx("rect",{x:f,y:b,width:h*y,height:.8,fill:d,opacity:.55,rx:.2},`r${v}`)})]})})},Y=({paperId:t,title:s,thumbnailUrl:r,priority:a=!1})=>{const[j,o]=x.useState(!1),[p,c]=x.useState(0),[n,l]=x.useState(a),m=x.useRef(null);x.useEffect(()=>{o(!1),c(0)},[r]);const $=x.useMemo(()=>{if(!r)return null;if(p===0)return r;const d=r.includes("?")?"&":"?";return`${r}${d}retry=${p}`},[r,p]);return x.useEffect(()=>{if(a||n)return;const d=m.current;if(!d)return;const u=new IntersectionObserver(([i])=>{i.isIntersecting&&(l(!0),u.disconnect())},{rootMargin:"250px"});return u.observe(d),()=>u.disconnect()},[a,n]),r&&!j?e.jsx("div",{ref:m,style:{width:160,height:220,background:"#FDFCF9",border:"1px solid var(--hairline-strong)",borderRadius:2,boxShadow:"0 1px 0 rgba(0,0,0,0.04), 0 4px 8px -4px rgba(0,0,0,0.08)",flexShrink:0,overflow:"hidden",position:"relative"},children:(a||n)&&$&&e.jsx("img",{src:$,alt:`Thumbnail for ${s}`,loading:a?"eager":"lazy",decoding:"async",fetchPriority:a?"high":"auto",style:{width:"100%",height:"100%",objectFit:"contain",display:"block"},onError:()=>{if(p<1){c(d=>d+1);return}o(!0)}},$)}):e.jsx(O,{paperId:t})},S={1:"SOTA 🏆",2:"#2",3:"#3"},N=({units:t,paperHref:s})=>{const r=x.useRef(null),a=x.useRef(null),[j,o]=x.useState(t.length);if(x.useLayoutEffect(()=>{const n=r.current,l=a.current;if(!n||!l||t.length===0)return;const m=u=>(l.textContent=u,l.scrollWidth),$=()=>{const u=n.clientWidth;if(u<=0)return;let i=0,h=0;for(const k of t){const f=m(k.measureText);if(i+f<=u)i+=f,h+=1;else break}if(h0&&i+m(` · +${t.length-h} more`)>u;)h-=1,i-=m(t[h].measureText);h===0&&(h=1)}o(h)};$();const d=new ResizeObserver($);return d.observe(n),()=>d.disconnect()},[t]),t.length===0)return null;const p=t.slice(0,Math.max(1,Math.min(j,t.length))),c=t.length-p.length;return e.jsxs("div",{className:"paper-sota",ref:r,children:[e.jsx("span",{ref:a,className:"paper-sota-measure","aria-hidden":"true"}),p.map((n,l)=>e.jsxs(x.Fragment,{children:[n.isGroupStart?e.jsxs(e.Fragment,{children:[l>0&&e.jsx("span",{className:"paper-sota-sep",children:" · "}),e.jsx("span",{className:`paper-sota-label${n.rank===1?" paper-sota-label--sota":""}`,children:S[n.rank]}),e.jsx("span",{className:"paper-sota-on",children:" on "})]}):e.jsx("span",{className:"paper-sota-sep",children:", "}),n.href?e.jsx(C,{to:n.href,className:"paper-sota-name",onClick:m=>m.stopPropagation(),children:n.name}):e.jsx("span",{className:"paper-sota-name",children:n.name})]},`${n.href||n.name}-${l}`)),c>0&&e.jsxs(C,{to:`${s}#results`,className:"paper-sota-more",onClick:n=>n.stopPropagation(),children:[" · +",c," more"]})]})},_=({ranks:t,paperHref:s,wrap:r=!1})=>{const a=x.useMemo(()=>{const o=[];let p=!0;for(const c of[1,2,3]){const n=t.filter(l=>l.rank===c);n.forEach((l,m)=>{const $=m===0,d=$?`${p?"":" · "}${S[c]} on `:", ";o.push({name:l.name,href:l.href,rank:c,isGroupStart:$,measureText:d+l.name})}),n.length>0&&(p=!1)}return o},[t]),j=x.useMemo(()=>[1,2,3].map(o=>t.filter(c=>c.rank===o).map((c,n)=>({name:c.name,href:c.href,rank:o,isGroupStart:n===0,measureText:(n===0?`${S[o]} on `:", ")+c.name}))).filter(o=>o.length>0),[t]);return r?j.length===0?null:e.jsx("div",{className:"paper-sota-stack",children:j.map(o=>e.jsx(N,{units:o,paperHref:s},o[0].rank))}):a.length===0?null:e.jsx(N,{units:a,paperHref:s})};export{I as M,Y as P,_ as S,D as T}; +import{e as M,j as e,V as x,L as C}from"./index-DyXq7-Tg.js";import{h as F,c as E}from"./colors-BkWRhvFI.js";import{d as A,h as P}from"./transform-D46m70Qr.js";const D=({slug:t,label:s,onClick:r})=>{const a=M(),j=F(t),o=E(j),p=c=>{if(c.stopPropagation(),r){r(t);return}a(`/tasks/${t}`)};return e.jsxs("span",{className:"tag-chip",style:{background:o.bg,color:o.text},onClick:p,children:[e.jsx("span",{className:"dot",style:{background:o.dot}}),A(s||P(t),t)]})},I=({method:t,onClick:s})=>{const r=M(),a=t.slug||t.id||"";if(!a)return null;const j=o=>{if(o.stopPropagation(),s){s(a);return}r(`/methods/${a}`)};return e.jsx("span",{className:"method-chip",onClick:j,children:t.name})},W=t=>{let s=2166136261;for(let r=0;r(s=Math.imul(s^s>>>15,2246822507),s=Math.imul(s^s>>>13,3266489909),s^=s>>>16,(s>>>0)%1e4/1e4)},O=({paperId:t})=>{const s=W(t),r=160,a=220,j=[.85+s()*.1,.55+s()*.25],o=.45+s()*.3,p=[],c=9+Math.floor(s()*3);for(let y=0;y.3,l=Math.floor(s()*3),m=[],$=6+Math.floor(s()*3);for(let y=0;y<$;y++)m.push(.5+s()*.45);const d="#9A9588",u="#3A352D",i=5,h=(r-i*2-2)/2,k=i,f=i+h+2;let w=i+2;const R=w;w+=6;const T=w+1;w+=5;const L=w;w+=3;const g=w+1;return e.jsx("div",{style:{width:r,height:a,background:"#FDFCF9",border:"1px solid var(--hairline-strong)",borderRadius:2,boxShadow:"0 1px 0 rgba(0,0,0,0.04), 0 4px 8px -4px rgba(0,0,0,0.08)",flexShrink:0,overflow:"hidden",position:"relative"},children:e.jsxs("svg",{width:r,height:a,viewBox:`0 0 ${r} ${a}`,style:{display:"block"},children:[j.map((y,v)=>e.jsx("rect",{x:i+(r-i*2)*(1-y)/2,y:R+v*2.4,width:(r-i*2)*y,height:1.4,fill:u,rx:.3},`t${v}`)),e.jsx("rect",{x:i+(r-i*2)*(1-o)/2,y:T,width:(r-i*2)*o,height:.9,fill:d,opacity:.7,rx:.2}),e.jsx("rect",{x:i,y:L,width:6,height:1,fill:u,opacity:.6}),p.map((y,v)=>{const b=g+v*2.1;return b>a-i-1?null:e.jsx("rect",{x:k,y:b,width:h*y,height:.8,fill:d,opacity:.55,rx:.2},`l${v}`)}),n&&e.jsxs("g",{children:[e.jsx("rect",{x:f,y:g,width:h,height:14,fill:"#F0EBE0",stroke:d,strokeWidth:.3,opacity:.9}),l===0&&e.jsx("g",{stroke:u,strokeWidth:.4,fill:"none",opacity:.6,children:e.jsx("polyline",{points:`${f+2},${g+11} ${f+6},${g+8} ${f+10},${g+9} ${f+14},${g+5} ${f+18},${g+6} ${f+22},${g+3}`})}),l===1&&e.jsxs("g",{opacity:.55,children:[e.jsx("circle",{cx:f+h/2,cy:g+7,r:3.5,fill:u}),e.jsx("rect",{x:f+2,y:g+11,width:h-4,height:1.5,fill:d})]}),l===2&&e.jsxs("g",{opacity:.55,children:[e.jsx("rect",{x:f+3,y:g+5,width:h-6,height:1,fill:u}),e.jsx("rect",{x:f+6,y:g+8,width:h-12,height:.8,fill:u})]})]}),m.map((y,v)=>{const b=g+(n?16:0)+v*2.1;return b>a-i-1?null:e.jsx("rect",{x:f,y:b,width:h*y,height:.8,fill:d,opacity:.55,rx:.2},`r${v}`)})]})})},Y=({paperId:t,title:s,thumbnailUrl:r,priority:a=!1})=>{const[j,o]=x.useState(!1),[p,c]=x.useState(0),[n,l]=x.useState(a),m=x.useRef(null);x.useEffect(()=>{o(!1),c(0)},[r]);const $=x.useMemo(()=>{if(!r)return null;if(p===0)return r;const d=r.includes("?")?"&":"?";return`${r}${d}retry=${p}`},[r,p]);return x.useEffect(()=>{if(a||n)return;const d=m.current;if(!d)return;const u=new IntersectionObserver(([i])=>{i.isIntersecting&&(l(!0),u.disconnect())},{rootMargin:"250px"});return u.observe(d),()=>u.disconnect()},[a,n]),r&&!j?e.jsx("div",{ref:m,style:{width:160,height:220,background:"#FDFCF9",border:"1px solid var(--hairline-strong)",borderRadius:2,boxShadow:"0 1px 0 rgba(0,0,0,0.04), 0 4px 8px -4px rgba(0,0,0,0.08)",flexShrink:0,overflow:"hidden",position:"relative"},children:(a||n)&&$&&e.jsx("img",{src:$,alt:`Thumbnail for ${s}`,loading:a?"eager":"lazy",decoding:"async",fetchPriority:a?"high":"auto",style:{width:"100%",height:"100%",objectFit:"contain",display:"block"},onError:()=>{if(p<1){c(d=>d+1);return}o(!0)}},$)}):e.jsx(O,{paperId:t})},S={1:"SOTA 🏆",2:"#2",3:"#3"},N=({units:t,paperHref:s})=>{const r=x.useRef(null),a=x.useRef(null),[j,o]=x.useState(t.length);if(x.useLayoutEffect(()=>{const n=r.current,l=a.current;if(!n||!l||t.length===0)return;const m=u=>(l.textContent=u,l.scrollWidth),$=()=>{const u=n.clientWidth;if(u<=0)return;let i=0,h=0;for(const k of t){const f=m(k.measureText);if(i+f<=u)i+=f,h+=1;else break}if(h0&&i+m(` · +${t.length-h} more`)>u;)h-=1,i-=m(t[h].measureText);h===0&&(h=1)}o(h)};$();const d=new ResizeObserver($);return d.observe(n),()=>d.disconnect()},[t]),t.length===0)return null;const p=t.slice(0,Math.max(1,Math.min(j,t.length))),c=t.length-p.length;return e.jsxs("div",{className:"paper-sota",ref:r,children:[e.jsx("span",{ref:a,className:"paper-sota-measure","aria-hidden":"true"}),p.map((n,l)=>e.jsxs(x.Fragment,{children:[n.isGroupStart?e.jsxs(e.Fragment,{children:[l>0&&e.jsx("span",{className:"paper-sota-sep",children:" · "}),e.jsx("span",{className:`paper-sota-label${n.rank===1?" paper-sota-label--sota":""}`,children:S[n.rank]}),e.jsx("span",{className:"paper-sota-on",children:" on "})]}):e.jsx("span",{className:"paper-sota-sep",children:", "}),n.href?e.jsx(C,{to:n.href,className:"paper-sota-name",onClick:m=>m.stopPropagation(),children:n.name}):e.jsx("span",{className:"paper-sota-name",children:n.name})]},`${n.href||n.name}-${l}`)),c>0&&e.jsxs(C,{to:`${s}#results`,className:"paper-sota-more",onClick:n=>n.stopPropagation(),children:[" · +",c," more"]})]})},V=({ranks:t,paperHref:s,wrap:r=!1})=>{const a=x.useMemo(()=>{const o=[];let p=!0;for(const c of[1,2,3]){const n=t.filter(l=>l.rank===c);n.forEach((l,m)=>{const $=m===0,d=$?`${p?"":" · "}${S[c]} on `:", ";o.push({name:l.name,href:l.href,rank:c,isGroupStart:$,measureText:d+l.name})}),n.length>0&&(p=!1)}return o},[t]),j=x.useMemo(()=>[1,2,3].map(o=>t.filter(c=>c.rank===o).map((c,n)=>({name:c.name,href:c.href,rank:o,isGroupStart:n===0,measureText:(n===0?`${S[o]} on `:", ")+c.name}))).filter(o=>o.length>0),[t]);return r?j.length===0?null:e.jsx("div",{className:"paper-sota-stack",children:j.map(o=>e.jsx(N,{units:o,paperHref:s},o[0].rank))}):a.length===0?null:e.jsx(N,{units:a,paperHref:s})};export{I as M,Y as P,V as S,D as T}; diff --git a/assets/StagingAccessRequestView-DgeEeE2r.js b/assets/StagingAccessRequestView-CZz80h2x.js similarity index 95% rename from assets/StagingAccessRequestView-DgeEeE2r.js rename to assets/StagingAccessRequestView-CZz80h2x.js index bba1c28d9e8747d35bacd13c3edf909d9c20f900..f9ca342fc18e0e4ef9e6f4f9ed2419b7a0db2e43 100644 --- a/assets/StagingAccessRequestView-DgeEeE2r.js +++ b/assets/StagingAccessRequestView-CZz80h2x.js @@ -1 +1 @@ -import{a as m,M as a,j as e,H as g,aY as p}from"./index-CbgxfyGU.js";import{C as j}from"./circle-check-Bci9ZTu9.js";const f=()=>{const{user:s,isLoading:u}=m(),[l,d]=a.useState(!1),[r,t]=a.useState(!1),[c,i]=a.useState(null),o=async h=>{h.preventDefault(),t(!0),i(null);try{await p.requestStagingAccess(),d(!0)}catch(n){i(n instanceof Error?n.message:"Could not submit your request.")}finally{t(!1)}};return e.jsx("main",{className:"access-request-page",children:e.jsxs("section",{className:"access-request-card","aria-labelledby":"access-request-title",children:[e.jsxs("a",{className:"access-request-brand",href:"https://paperswithcode.co",children:[e.jsx("span",{className:"brand-mark","aria-hidden":"true"}),e.jsxs("span",{className:"brand-name",children:["Papers ",e.jsx("em",{children:"with"})," Code"]})]}),l?e.jsxs("div",{className:"access-request-success",role:"status",children:[e.jsx(j,{size:34,strokeWidth:1.6,"aria-hidden":"true"}),e.jsx("h1",{id:"access-request-title",children:"Request received"}),e.jsxs("p",{children:["Thanks, @",s==null?void 0:s.username,". We’ll review your contributor access request."]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"access-request-heading",children:[e.jsx("p",{className:"access-request-eyebrow",children:"Staging preview"}),e.jsx("h1",{id:"access-request-title",children:"Request access"}),e.jsx("p",{children:"This preview is limited to project contributors. Send us your verified Hugging Face username and email address to request access."})]}),u?e.jsx("p",{className:"access-request-status",role:"status",children:"Checking your Hugging Face account…"}):s?e.jsxs("form",{className:"access-request-form",onSubmit:o,children:[e.jsx("label",{htmlFor:"hf-username",children:"Hugging Face username"}),e.jsxs("div",{className:"access-request-input-wrap",children:[e.jsx("span",{"aria-hidden":"true",children:"@"}),e.jsx("input",{id:"hf-username",name:"hf_username",value:s.username,readOnly:!0,autoComplete:"username"})]}),e.jsxs("p",{className:"access-request-verified",children:["Username and email verified through Hugging Face sign-in. See our"," ",e.jsx("a",{href:"https://paperswithcode.co/privacy",children:"Privacy Policy"}),"."]}),c&&e.jsx("p",{className:"access-request-error",role:"alert",children:c}),e.jsx("button",{className:"access-request-submit",type:"submit",disabled:r,children:r?"Sending…":"Request access"})]}):e.jsxs("div",{className:"access-request-signin",children:[e.jsx("p",{children:"Sign in first so we can verify the account you’re requesting access for."}),e.jsx(g,{returnTo:"/request-access",label:"Sign in with Hugging Face",collectEmail:!0})]})]})]})})};export{f as default}; +import{a as m,V as a,j as e,H as g,b3 as p}from"./index-DyXq7-Tg.js";import{C as j}from"./circle-check-GGlu5UCV.js";const f=()=>{const{user:s,isLoading:u}=m(),[l,d]=a.useState(!1),[r,t]=a.useState(!1),[c,i]=a.useState(null),o=async h=>{h.preventDefault(),t(!0),i(null);try{await p.requestStagingAccess(),d(!0)}catch(n){i(n instanceof Error?n.message:"Could not submit your request.")}finally{t(!1)}};return e.jsx("main",{className:"access-request-page",children:e.jsxs("section",{className:"access-request-card","aria-labelledby":"access-request-title",children:[e.jsxs("a",{className:"access-request-brand",href:"https://paperswithcode.co",children:[e.jsx("span",{className:"brand-mark","aria-hidden":"true"}),e.jsxs("span",{className:"brand-name",children:["Papers ",e.jsx("em",{children:"with"})," Code"]})]}),l?e.jsxs("div",{className:"access-request-success",role:"status",children:[e.jsx(j,{size:34,strokeWidth:1.6,"aria-hidden":"true"}),e.jsx("h1",{id:"access-request-title",children:"Request received"}),e.jsxs("p",{children:["Thanks, @",s==null?void 0:s.username,". We’ll review your contributor access request."]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"access-request-heading",children:[e.jsx("p",{className:"access-request-eyebrow",children:"Staging preview"}),e.jsx("h1",{id:"access-request-title",children:"Request access"}),e.jsx("p",{children:"This preview is limited to project contributors. Send us your verified Hugging Face username and email address to request access."})]}),u?e.jsx("p",{className:"access-request-status",role:"status",children:"Checking your Hugging Face account…"}):s?e.jsxs("form",{className:"access-request-form",onSubmit:o,children:[e.jsx("label",{htmlFor:"hf-username",children:"Hugging Face username"}),e.jsxs("div",{className:"access-request-input-wrap",children:[e.jsx("span",{"aria-hidden":"true",children:"@"}),e.jsx("input",{id:"hf-username",name:"hf_username",value:s.username,readOnly:!0,autoComplete:"username"})]}),e.jsxs("p",{className:"access-request-verified",children:["Username and email verified through Hugging Face sign-in. See our"," ",e.jsx("a",{href:"https://paperswithcode.co/privacy",children:"Privacy Policy"}),"."]}),c&&e.jsx("p",{className:"access-request-error",role:"alert",children:c}),e.jsx("button",{className:"access-request-submit",type:"submit",disabled:r,children:r?"Sending…":"Request access"})]}):e.jsxs("div",{className:"access-request-signin",children:[e.jsx("p",{children:"Sign in first so we can verify the account you’re requesting access for."}),e.jsx(g,{returnTo:"/request-access",label:"Sign in with Hugging Face",collectEmail:!0})]})]})]})})};export{f as default}; diff --git a/assets/SubmissionsDashboard-CZ6QfHso.js b/assets/SubmissionsDashboard-CZ6QfHso.js new file mode 100644 index 0000000000000000000000000000000000000000..b8fc46ae617bbabbc0e8677b27f14cf0a57cf637 --- /dev/null +++ b/assets/SubmissionsDashboard-CZ6QfHso.js @@ -0,0 +1,11 @@ +import{s as ae,V as v,j as e,G as y,b as ne,o as H,a3 as re,x as oe,p as le,y as E,i as de,aA as T,aB as ce,aC as ue,aD as pe}from"./index-DyXq7-Tg.js";import{u as G,r as me,e as he}from"./evaluationQueryInvalidation-Cm3s7Pfm.js";import{i as X,a as K}from"./queryInvalidation-CfHeNeUY.js";import{u as D}from"./useMutation-UWxBeqtn.js";import{u as fe}from"./useInfiniteQuery-BYh2zN-T.js";import{c as C}from"./catalog-CRar2olQ.js";import{s as xe}from"./safeExternalHref-CkBrsh84.js";import{E as O,s as I}from"./submissions-Cz_J-Ha2.js";import{p as je}from"./papers-Dh3ljlL0.js";import{R as ge,C as ve}from"./refresh-cw-DYXzpRir.js";import{L as $}from"./loader-circle-C75KLEgx.js";import{C as be}from"./circle-check-GGlu5UCV.js";import"./curation-YeS7FBYf.js";/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y=ae("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ye=ae("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function x({title:s,children:t}){return e.jsxs("div",{className:"submission-diff-column",children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("div",{className:"submission-diff-pills",children:t})]})}function g({children:s}){return e.jsx("span",{className:"submission-muted",children:s})}function k({url:s,empty:t,className:i}){return s?e.jsx("a",{className:y("submission-url-link",i),href:xe(s)??void 0,target:"_blank",rel:"noopener noreferrer",children:s}):t?e.jsx(g,{children:t}):null}function N({label:s,value:t}){return e.jsxs("div",{children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("div",{className:"submission-field-value",children:t??e.jsx("span",{className:"submission-muted",children:"Not set"})})]})}function Z({title:s,value:t}){return e.jsxs("div",{className:"submission-json-block",children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("pre",{children:JSON.stringify(t,null,2)})]})}function _e({currentPayload:s,proposedPayload:t}){const[i,a]=v.useState(!1);return e.jsxs("div",{className:"submission-raw-toggle",children:[e.jsx("button",{type:"button",className:"raw-json-btn",onClick:()=>a(n=>!n),children:i?"Hide raw JSON":"Show raw JSON"}),i&&e.jsxs("div",{className:"submission-json-grid",children:[e.jsx(Z,{title:"Current payload",value:s??{}}),e.jsx(Z,{title:"Proposed payload",value:t})]})]})}function J({currentItems:s,proposedIds:t,queryPrefix:i,fetchEntity:a,knownNames:n}){const o=v.useMemo(()=>Array.from(new Set([...s.map(d=>d.id),...t])).sort((d,f)=>d-f),[s,t]),c=G({queries:a?o.map(d=>({queryKey:H[i](String(d)),queryFn:()=>a(String(d)),staleTime:5*60*1e3})):[]}),h=v.useMemo(()=>{const d=new Map;return s.forEach(f=>d.set(f.id,f.name)),n==null||n.forEach((f,j)=>d.set(j,f)),c.forEach(({data:f})=>{f&&d.set(Number(f.id),f.name)}),d},[s,c,n]),r=new Set(s.map(d=>d.id)),u=new Set(t),m=(d,f)=>e.jsx("span",{className:y("submission-diff-pill",f==="current"&&!u.has(d)&&"removed",f==="proposed"&&!r.has(d)&&"added"),children:h.get(d)??`#${d}`},d);return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(x,{title:"Currently tagged",children:s.length>0?s.map(d=>m(d.id,"current")):e.jsx(g,{children:"No current tags"})}),e.jsx(x,{title:"Will be tagged",children:t.length>0?t.map(d=>m(d,"proposed")):e.jsx(g,{children:"No proposed tags"})})]})}function Ne({currentItems:s,proposedIds:t}){var n;const i=ne({queryKey:[...H.organizations,"submission-diff"],queryFn:()=>C.organizations(),staleTime:3e5}),a=new Map(s.map(o=>[o.id,o.name]));return(n=i.data)==null||n.results.forEach(o=>{a.set(Number(o.id),o.name)}),e.jsx(J,{currentItems:s,proposedIds:t,queryPrefix:"organization",knownNames:a})}function ee(s,t,i){return G({queries:t.map(a=>({queryKey:H[s](String(a)),queryFn:()=>i(String(a)),staleTime:5*60*1e3})),combine:a=>new Map(a.flatMap(({data:n})=>n?[[Number(n.id),n.name]]:[]))})}function ke({edit:s}){const t=v.useMemo(()=>{var r;return((r=s.current_payload)==null?void 0:r.evaluations)??[]},[s.current_payload]),i=s.proposed_payload.operations,{taskIds:a,datasetIds:n}=v.useMemo(()=>{const r=[...t,...i.flatMap(m=>m.op==="delete"?[]:[m.data])],u=m=>Array.from(new Set(r.flatMap(d=>d[m]?[d[m]]:[])));return{taskIds:u("task_id"),datasetIds:u("dataset_id")}},[t,i]),o=ee("task",a,r=>C.getTask(r)),c=ee("dataset",n,r=>C.getDataset(r)),h=new Map(t.filter(r=>r.id!=null).map(r=>[r.id,r]));return i.length===0?e.jsx(g,{children:"No evaluation operations in this payload."}):e.jsx("div",{className:"submission-eval-list",children:i.map((r,u)=>{const m=r.op==="create"?void 0:r.evaluation_id,d=m?h.get(m):void 0,f=r.op==="update"?{...d,...r.data}:r.op==="create"?r.data:d??{};return e.jsxs("div",{className:"submission-eval-op",children:[e.jsxs("div",{className:"submission-eval-op-header",children:[e.jsx("span",{className:y("submission-pill status",r.op==="create"&&"approved",r.op==="update"&&"changed",r.op==="delete"&&"rejected"),children:r.op}),m&&e.jsxs("span",{className:"submission-meta",children:["Evaluation #",m]})]}),e.jsx(we,{evaluation:f,taskNames:o,datasetNames:c})]},`${r.op}-${m??u}`)})})}function we({evaluation:s,taskNames:t,datasetNames:i}){const{task_id:a,dataset_id:n}=s,o=s.metrics??{};return e.jsxs("div",{className:"submission-eval-fields",children:[e.jsx(N,{label:"Task",value:a?t.get(a)??`#${a}`:null}),e.jsx(N,{label:"Dataset",value:n?i.get(n)??`#${n}`:null}),e.jsx(N,{label:"Model",value:s.model_name||null}),e.jsx(N,{label:"Harness",value:s.harness||null}),e.jsx(N,{label:"Best rank",value:s.best_rank??null}),e.jsx(N,{label:"Parameters",value:s.num_parameters??null}),e.jsx(N,{label:"HF model URL",value:s.hf_model_url||null}),e.jsx(N,{label:"Open source",value:s.is_open===void 0?null:s.is_open?"Yes":"No"}),e.jsxs("div",{className:"submission-eval-metrics",children:[e.jsx("div",{className:"submission-diff-label",children:"Metrics"}),Object.keys(o).length>0?e.jsx("div",{className:"submission-metric-list",children:Object.entries(o).map(([c,h])=>e.jsxs("span",{className:"submission-metric-pill",children:[c,": ",String(h)]},c))}):e.jsx(g,{children:"No metrics"})]})]})}function L({label:s,currentItems:t,proposedItems:i}){const a=new Map(t.map(c=>[c.url,c])),n=new Map(i.map(c=>[c.url,c])),o=Array.from(new Set([...a.keys(),...n.keys()])).sort();return o.length===0?e.jsxs(g,{children:["No ",s," in this submission."]}):e.jsx("div",{className:"submission-url-list",children:o.map(c=>{var f;const h=a.get(c),r=n.get(c),u=!h&&r,m=h&&!r,d=h&&r&&h.is_official!==r.is_official;return e.jsx("div",{className:y("submission-url-row",u&&"added",m&&"removed",d&&"changed"),children:e.jsxs("div",{className:"submission-url-content",children:[e.jsx(k,{url:c,className:y(m&&"removed")}),u&&e.jsx("span",{className:"submission-pill status approved",children:"Added"}),m&&e.jsx("span",{className:"submission-pill status rejected",children:"Removed"}),d&&e.jsxs("span",{className:"submission-pill changed",children:["Official: ",String(h.is_official)," ","->"," ",String(r.is_official)]}),((f=r??h)==null?void 0:f.is_official)&&e.jsx("span",{className:"submission-pill",children:"Official"})]})},c)})})}const z=s=>({url:s,is_official:!1});function Se({edit:s}){const t=[{key:"hf_models",label:"Models"},{key:"hf_datasets",label:"Datasets"},{key:"hf_spaces",label:"Spaces"}];return e.jsx("div",{className:"submission-hf-artifacts-diff",children:t.map(({key:i,label:a})=>{var n;return e.jsxs("div",{className:"submission-hf-artifacts-section",children:[e.jsx("div",{className:"submission-diff-label",children:a}),e.jsx(L,{label:a.toLowerCase(),currentItems:(((n=s.current_payload)==null?void 0:n[i])??[]).map(z),proposedItems:s.proposed_payload[i].map(z)})]},i)})})}function Ee({edit:s}){var t;return e.jsx(L,{label:"X threads",currentItems:(((t=s.current_payload)==null?void 0:t.x_threads)??[]).map(({url:i})=>z(i)),proposedItems:s.proposed_payload.x_threads.map(z)})}function Ce({edit:s}){var t;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(x,{title:"Current source URL",children:e.jsx(k,{url:(t=s.current_payload)==null?void 0:t.source_url,empty:"No current URL"})}),e.jsx(x,{title:"Proposed source URL",children:e.jsx(k,{url:s.proposed_payload.source_url,empty:"No proposed URL"})})]})}const Re={new_task:"task",new_method:"method",new_benchmark:"benchmark",new_metric:"metric",new_conference:"conference"};function q({text:s,empty:t}){return s?e.jsx("span",{className:"submission-field-value",children:s}):e.jsx(g,{children:t})}function se({edit:s}){var n;const{image:t,image_credit:i}=s.proposed_payload,a=(t==null?void 0:t.url)!==void 0?re(t.url)??"":(n=t==null?void 0:t.data_url)!=null&&n.startsWith("data:image/")?t.data_url:"";return e.jsxs(e.Fragment,{children:[e.jsx(x,{title:"Image",children:a?e.jsx("img",{src:a,alt:(t==null?void 0:t.file_name)??"Suggested image",className:"max-h-64 max-w-full rounded-md border border-border object-contain"}):e.jsx(g,{children:"No image provided"})}),e.jsx(x,{title:"Image source",children:i||e.jsx(g,{children:"No image source provided"})})]})}function Me({edit:s}){switch(s.edit_type){case"new_task":{const{parent_id:t,area_id:i,keywords:a}=s.proposed_payload;return e.jsxs(e.Fragment,{children:[e.jsx(se,{edit:s}),e.jsx(x,{title:"Placement and keywords",children:e.jsx("span",{className:"submission-field-value",children:JSON.stringify({parent_id:t??null,area_id:i??null,keywords:a??null})})})]})}case"new_method":{const t=s.proposed_payload.source_url??"";return e.jsxs(e.Fragment,{children:[e.jsx(se,{edit:s}),e.jsx(x,{title:"Source",children:/^https?:\/\//.test(t)?e.jsx(k,{url:t}):e.jsx(q,{text:t,empty:"No source provided"})})]})}case"new_benchmark":{const t=s.proposed_payload;return e.jsx(x,{title:"Task",children:e.jsx("span",{className:"submission-field-value",children:"task"in t?t.task:JSON.stringify(t.task_ids)})})}case"new_metric":{const{direction:t,scale:i,task_id:a,dataset_id:n}=s.proposed_payload;return e.jsx(x,{title:"Metric and leaderboard definition",children:e.jsx("span",{className:"submission-field-value",children:JSON.stringify({direction:t,scale:i,task_id:a,dataset_id:n})})})}case"new_conference":{const{year:t,start_date:i,end_date:a,venue:n,url:o}=s.proposed_payload;return e.jsxs(e.Fragment,{children:[e.jsx(x,{title:"Edition and dates",children:t?`${t}${i?` · ${i}${a?` – ${a}`:""}`:""}`:e.jsx(g,{children:"No edition provided"})}),e.jsx(x,{title:"Venue",children:n||e.jsx(g,{children:"No venue provided"})}),e.jsx(x,{title:"URL",children:e.jsx(k,{url:o,empty:"No URL provided"})})]})}}}function Pe({edit:s}){const t=s.proposed_payload,i="benchmark"in t?t.benchmark:t.name;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(x,{title:`Suggested ${Re[s.edit_type]} name`,children:i?e.jsx("span",{className:"submission-diff-pill added",children:i}):e.jsx(g,{children:"No name provided"})}),e.jsx(x,{title:"Description",children:e.jsx(q,{text:t.description,empty:"No description provided"})}),e.jsx(Me,{edit:s})]})}function Te({edit:s}){var c;const{name:t,hf_slug:i,website_url:a,image:n}=s.proposed_payload,o=n!=null&&n.url?re(n.url):(c=n==null?void 0:n.data_url)!=null&&c.startsWith("data:image/")?n.data_url:void 0;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(x,{title:"Suggested organization name",children:e.jsx("span",{className:"submission-diff-pill added",children:t})}),e.jsx(x,{title:"Hugging Face organization",children:e.jsx(k,{url:i?`https://huggingface.co/${i}`:void 0,empty:"No Hugging Face organization provided"})}),e.jsx(x,{title:"Website",children:e.jsx(k,{url:a,empty:"No website provided"})}),e.jsx(x,{title:"Logo",children:o?e.jsx("img",{src:o,alt:(n==null?void 0:n.file_name)??"Suggested logo",className:"max-h-32 max-w-full rounded-md border border-border object-contain"}):e.jsx(g,{children:"No logo provided"})})]})}function Ie({edit:s}){const{title:t,source_url:i,abstract:a,date_published:n,authors:o}=s.proposed_payload;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(x,{title:"Title",children:e.jsx(q,{text:t,empty:"No title provided"})}),e.jsx(x,{title:"Publication date",children:n||e.jsx(g,{children:"No publication date provided"})}),e.jsx(x,{title:"Authors",children:o.length>0?o.map((c,h)=>e.jsx("span",{className:"submission-diff-pill added",children:c},`${c}-${h}`)):e.jsx(g,{children:"No authors provided"})}),e.jsx(x,{title:"Source URL",children:e.jsx(k,{url:i,empty:"No source URL provided"})}),e.jsx(x,{title:"Abstract",children:e.jsx(q,{text:a,empty:"No abstract provided"})})]})}function $e(s){throw new Error(`Unhandled pending edit: ${JSON.stringify(s)}`)}function Fe({edit:s}){var t,i,a,n,o;switch(s.edit_type){case"tasks":return e.jsx(J,{currentItems:((t=s.current_payload)==null?void 0:t.tasks)??[],proposedIds:s.proposed_payload.task_ids,queryPrefix:"task",fetchEntity:c=>C.getTask(c)});case"methods":return e.jsx(J,{currentItems:((i=s.current_payload)==null?void 0:i.methods)??[],proposedIds:s.proposed_payload.method_ids,queryPrefix:"method",fetchEntity:c=>C.getMethod(c)});case"organizations":return e.jsx(Ne,{currentItems:((a=s.current_payload)==null?void 0:a.organizations)??[],proposedIds:s.proposed_payload.organization_ids});case"repositories":return e.jsx(L,{label:"repositories",currentItems:((n=s.current_payload)==null?void 0:n.repositories)??[],proposedItems:s.proposed_payload.repositories});case"project_pages":return e.jsx(L,{label:"project pages",currentItems:((o=s.current_payload)==null?void 0:o.project_pages)??[],proposedItems:s.proposed_payload.project_pages});case"evaluations":return e.jsx(ke,{edit:s});case"source_url":return e.jsx(Ce,{edit:s});case"hf_artifacts":return e.jsx(Se,{edit:s});case"x_threads":return e.jsx(Ee,{edit:s});case"new_task":case"new_method":case"new_benchmark":case"new_metric":case"new_conference":return e.jsx(Pe,{edit:s});case"new_organization":return e.jsx(Te,{edit:s});case"new_external_paper":return e.jsx(Ie,{edit:s});default:return $e(s)}}function Ae({edit:s}){return e.jsxs("div",{className:"submission-diff-body",children:[e.jsx(Fe,{edit:s}),e.jsx(_e,{currentPayload:s.current_payload,proposedPayload:s.proposed_payload})]})}const te=25,De=["pending","approved","rejected","all"],Ue=["all",...Object.keys(O)],B=["pending","approved","rejected"];function Oe(s){return s.slice(0,2).toUpperCase()}function U(s){return s.replace(/_/g," ")}function ie(s){if(!s)return"unknown time";const t=new Date(s);if(Number.isNaN(t.getTime()))return s;const i=Date.now()-t.getTime(),a=Math.floor(i/6e4),n=Math.floor(i/36e5),o=Math.floor(i/864e5);return a<1?"just now":a<60?`${a}m ago`:n<24?`${n}h ago`:o<14?`${o}d ago`:t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Le(s){return s==="approved"?"approved":s==="rejected"?"rejected":"pending"}function ze(s,t){return(s==null?void 0:s.arxiv_id)||(s==null?void 0:s.id)||String(t)}function qe(s){return[...s].sort((t,i)=>new Date(i.created_at).getTime()-new Date(t.created_at).getTime())}async function Qe(s,t,i,a){const n=await Promise.all(s.map(u=>I.list({status:u,edit_type:t==="all"?void 0:t,reviewed_by_kind:i?"auto":void 0,limit:te,offset:a[u]??0}))),o=qe(n.flatMap(u=>u.results)).slice(0,te),c={};s.forEach((u,m)=>{const d=o.filter(f=>n[m].results.includes(f)).length;c[u]=(a[u]??0)+d});const h=n.reduce((u,m)=>u+m.count,0),r=s.reduce((u,m)=>u+(c[m]??0),0);return{count:h,results:o,nextOffsets:o.length>0&&r{i.invalidateQueries({queryKey:T.pendingEdits}),p.paper_id!=null&&p.edit_type!=="evaluations"&&X(i,[String(p.paper_id),t==null?void 0:t.arxiv_id])},[t==null?void 0:t.arxiv_id,i]),F=D({mutationFn:()=>I.approve(s.id),onSuccess:p=>{var A;j(p),p.edit_type==="evaluations"&&p.paper_id!=null?me(i,he(String(p.paper_id),((A=p.current_payload)==null?void 0:A.evaluations)??[],p.proposed_payload.operations,(t==null?void 0:t.arxiv_id)??void 0)):p.paper_id!=null&&!c&&K(i),a({title:"Submission approved",description:c?`Marked ${U(s.edit_type)} suggestion as approved. No catalog changes were applied.`:`Applied ${U(s.edit_type)} changes for ${u}.`})},onError:p=>{a({title:"Could not approve submission",description:E(p,"Approval failed. Please try again."),variant:"destructive"})}}),R=D({mutationFn:()=>I.reject(s.id),onSuccess:p=>{j(p),a({title:"Submission rejected",description:`Rejected ${U(s.edit_type)} changes for ${u}.`})},onError:p=>{a({title:"Could not reject submission",description:E(p,"Rejection failed. Please try again."),variant:"destructive"})}}),S=D({mutationFn:()=>C.rollbackEvent(s.catalog_event_id),onSuccess:()=>{i.invalidateQueries({queryKey:T.pendingEdits}),s.paper_id!=null&&(X(i,[String(s.paper_id),t==null?void 0:t.arxiv_id]),K(i)),a({title:"Edit reverted",description:`Restored ${u} to its previous state.`})},onError:p=>{a({title:"Could not revert edit",description:E(p,"The paper changed after this edit, or it was already reverted."),variant:"destructive"})}}),M=D({mutationFn:p=>I.revertAutoApproved(s.hf_subject,{suspend:p}),onSuccess:p=>{i.invalidateQueries({queryKey:T.pendingEdits}),K(i),a({title:`Reverted ${p.reverted} edits by @${s.hf_username}`,description:p.skipped.length?`${p.skipped.length} were skipped because the paper changed since.`:void 0})},onError:p=>{a({title:"Could not revert edits",description:E(p,"Bulk revert failed. Please try again."),variant:"destructive"})}}),P=p=>{const A=`Revert every edit @${s.hf_username} had auto-applied in the last 7 days${p?" and suspend the account":""}?`;window.confirm(A)&&M.mutate(p)},l=s.reviewed_by_kind==="auto",_=l&&!!s.catalog_event_id,b=F.isPending,w=R.isPending,W=b||w,Q=S.isPending||M.isPending;return e.jsxs("article",{id:`submission-${s.id}`,className:"submission-card",children:[e.jsxs("header",{className:"submission-card-header",children:[e.jsxs("div",{className:"submission-card-top",children:[e.jsxs("div",{children:[r?e.jsx("a",{href:`/paper/${encodeURIComponent(r)}`,target:"_blank",rel:"noopener noreferrer",className:"submission-title",children:u}):e.jsx("div",{className:"submission-title",children:u}),e.jsxs("div",{className:"submission-meta",children:[e.jsxs("span",{children:["#",s.id]}),e.jsx("span",{children:o?h.subtitle:`Paper #${s.paper_id}`}),e.jsx("span",{children:ie(s.created_at)})]})]}),e.jsxs("div",{className:"submission-badges",children:[e.jsx("span",{className:"submission-pill",children:U(s.edit_type)}),l&&e.jsx("span",{className:"submission-pill",children:"Auto-applied"}),s.is_author&&e.jsx("span",{className:"submission-pill author",children:"Linked author"}),e.jsx("span",{className:y("submission-pill status",Le(s.status)),children:s.status})]})]}),e.jsxs("a",{href:`https://huggingface.co/${encodeURIComponent(s.hf_username)}`,target:"_blank",rel:"noopener noreferrer",className:"submission-user",children:[e.jsxs(ce,{className:"h-6 w-6",children:[e.jsx(ue,{src:m,alt:s.hf_username}),e.jsx(pe,{className:"text-[10px]",children:Oe(s.hf_username)})]}),e.jsxs("span",{children:["@",s.hf_username]})]})]}),e.jsx("div",{className:"submission-diff",children:e.jsx(Ae,{edit:s})}),s.conflict_payload&&e.jsxs("div",{className:"submission-empty submission-empty-warn",children:["Canonical state changed after this submission. Review the conflict before deciding.",e.jsx("pre",{children:JSON.stringify(s.conflict_payload,null,2)})]}),e.jsx("footer",{className:"submission-actions",children:d?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"submission-action-buttons",children:[e.jsxs("button",{type:"button",onClick:()=>R.mutate(),disabled:W,className:"submission-action-btn reject",children:[w?e.jsx($,{className:"spin",size:14}):e.jsx(ve,{size:14}),"Reject"]}),e.jsxs("button",{type:"button",onClick:()=>F.mutate(),disabled:W,className:"submission-action-btn approve",children:[b?e.jsx($,{className:"spin",size:14}):e.jsx(be,{size:14}),"Approve"]})]})}):e.jsxs("div",{className:"submission-reviewed",children:[e.jsxs("span",{children:["Reviewed by ",e.jsx("strong",{children:s.reviewed_by||"unknown"}),s.reviewed_at?` ${ie(s.reviewed_at)}`:""]}),s.admin_note&&e.jsxs("span",{children:["Admin note: ",e.jsx("strong",{children:s.admin_note})]}),f&&e.jsxs("span",{children:["Submitter-visible reason: ",e.jsx("strong",{children:s.user_review_reason})]}),_&&e.jsxs("div",{className:"submission-action-buttons",children:[e.jsxs("button",{type:"button",onClick:()=>S.mutate(),disabled:Q,className:"submission-action-btn reject",children:[S.isPending?e.jsx($,{className:"spin",size:14}):e.jsx(ye,{size:14}),"Revert this edit"]}),s.hf_subject&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>P(!1),disabled:Q,className:"submission-action-btn reject",children:["Revert all by @",s.hf_username]}),e.jsx("button",{type:"button",onClick:()=>P(!0),disabled:Q,className:"submission-action-btn reject",children:"Revert all and suspend"})]})]}),s.applied_payload&&e.jsxs("details",{children:[e.jsx("summary",{children:c?"Reviewed payload":"Applied payload"}),e.jsx("pre",{children:JSON.stringify(s.applied_payload,null,2)})]}),s.result_entity_type&&e.jsxs("span",{children:["Created/applied: ",e.jsxs("strong",{children:[s.result_entity_type," #",s.result_entity_id]})]})]})})]})}function as(){var M,P;const{toast:s}=oe(),[t,i]=v.useState("pending"),[a,n]=v.useState("all"),[o,c]=v.useState(!1),h=ne({queryKey:[...T.pendingEdits,"counts",a,o],queryFn:async()=>{const l=a==="all"?void 0:a,_=await Promise.all(B.map(b=>I.list({status:b,edit_type:l,reviewed_by_kind:o?"auto":void 0,limit:1,offset:0})));return Object.fromEntries(_.map((b,w)=>[B[w],b.count]))},staleTime:30*1e3}),r=fe({queryKey:[...T.pendingEdits,{status:t,editType:a,autoOnly:o}],queryFn:({pageParam:l})=>Qe(t==="all"?B:[t],a,o,l),initialPageParam:{},getNextPageParam:l=>l.nextOffsets??void 0,retry:!1}),u=v.useMemo(()=>{var l;return((l=r.data)==null?void 0:l.pages.flatMap(_=>_.results))??[]},[r.data]),m=v.useMemo(()=>Array.from(new Set(u.map(l=>l.paper_id).filter(l=>l!=null))).sort((l,_)=>l-_),[u]),d=G({queries:m.map(l=>({queryKey:le.summary(String(l)),queryFn:()=>je.get(String(l),!1),staleTime:5*60*1e3}))}),f=v.useMemo(()=>{const l=new Map;return d.forEach(_=>{const b=_.data;if(!b)return;const w=Number(b.id);Number.isFinite(w)&&l.set(w,b)}),l},[d]);v.useEffect(()=>{r.error&&s({title:"Could not load submissions",description:E(r.error,"Failed to load pending paper edits."),variant:"destructive"})},[r.error,s]);const j=h.data,F=j?j.pending+j.approved+j.rejected:void 0,R={pending:j==null?void 0:j.pending,approved:j==null?void 0:j.approved,rejected:j==null?void 0:j.rejected,all:F},S=((P=(M=r.data)==null?void 0:M.pages[0])==null?void 0:P.count)??0;return e.jsxs("div",{className:"page submissions-page",children:[e.jsxs("div",{className:"feed-header",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Pending ",e.jsx("em",{children:"Edits"})]}),e.jsx("div",{className:"feed-subtitle",children:"Review submitted changes to paper metadata and benchmark results"})]}),e.jsxs("button",{type:"button",className:"feedback-link",onClick:()=>{h.refetch(),r.refetch()},disabled:r.isFetching||h.isFetching,children:[e.jsx(ge,{className:y((r.isFetching||h.isFetching)&&"spin"),size:14}),"Refresh"]})]}),e.jsxs("div",{className:"submissions-filter-panel",children:[e.jsxs("div",{className:"submission-filter-block",children:[e.jsx("div",{className:"sidebar-label",children:"Status"}),e.jsxs("div",{className:"period-switch",children:[De.map(l=>e.jsxs("button",{type:"button",className:y("period-btn",t===l&&"active"),onClick:()=>i(l),children:[l,R[l]!=null&&e.jsx("span",{className:"submission-count",children:R[l]})]},l)),e.jsx("button",{type:"button",className:y("period-btn",o&&"active"),onClick:()=>{c(l=>!l),o||i("approved")},children:"auto-applied only"})]})]}),e.jsxs("div",{className:"submission-filter-block",children:[e.jsx("div",{className:"sidebar-label",children:"Edit Type"}),e.jsx("div",{className:"sort-options submissions-type-options",children:Ue.map(l=>e.jsx("button",{type:"button",className:y("sort-btn",a===l&&"active"),onClick:()=>n(l),children:l==="all"?"all":O[l].label},l))})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"sort-bar submissions-sort-bar",children:e.jsx("div",{children:e.jsx("div",{className:"sort-options",children:e.jsx("span",{className:"results-count",children:r.isFetching?"refreshing":`${S} submissions`})})})}),r.isLoading?e.jsxs("div",{className:"submission-loading",children:[e.jsx($,{className:"spin",size:18}),e.jsx("span",{children:"Loading submissions..."})]}):r.isError?e.jsxs("div",{className:"submission-empty submission-empty-warn",role:"alert",children:[e.jsx(Y,{size:28}),e.jsx("h2",{children:"Could not display submissions."}),e.jsx("p",{children:E(r.error,"The submissions response was invalid.")})]}):u.length===0?e.jsxs("div",{className:"submission-empty",children:[e.jsx(Y,{size:28}),e.jsx("h2",{children:"No pending submissions."}),e.jsxs("p",{children:["The SQL and curl fallback is still documented in"," ",e.jsx("a",{href:"https://github.com/huggingface/paperswithcode/blob/main/docs/operations.md",target:"_blank",rel:"noopener noreferrer",children:"operations.md"}),"."]})]}):e.jsx("div",{className:"submission-list",children:u.map(l=>e.jsx(Ke,{submission:l,paper:l.paper_id==null?void 0:f.get(l.paper_id)},l.id))}),u.length>0&&e.jsxs("div",{className:"submission-pagination",children:[e.jsxs("p",{children:["Showing ",u.length," of ",S," submissions"]}),r.hasNextPage&&e.jsxs("button",{type:"button",className:"feedback-link",onClick:()=>r.fetchNextPage(),disabled:r.isFetching,children:[r.isFetchingNextPage&&e.jsx($,{className:"spin",size:14}),"Load more"]})]})]})]})}export{as as default}; diff --git a/assets/SubmissionsDashboard-eKjMsSf9.js b/assets/SubmissionsDashboard-eKjMsSf9.js deleted file mode 100644 index ff57f1b8873ea731629936e19ce40738dd45da49..0000000000000000000000000000000000000000 --- a/assets/SubmissionsDashboard-eKjMsSf9.js +++ /dev/null @@ -1,11 +0,0 @@ -import{n as te,M as v,j as e,B as y,Z as ie,p as ae,t as E,f as re,au as oe,av as le,aw as de}from"./index-CbgxfyGU.js";import{u as J,r as ce,e as ue}from"./evaluationQueryInvalidation-BogLM1gw.js";import{a as pe,p as me}from"./paperQueryKeys-B8u1BWlI.js";import{i as G,a as Q}from"./queryInvalidation-Chlw4DEx.js";import{u as ne}from"./useQuery-Bx9s5-D2.js";import{u as A}from"./useMutation-P_trTy9i.js";import{u as he}from"./useInfiniteQuery-BAc_4HO5.js";import{c as C}from"./catalog-DhK7_9-6.js";import{s as fe}from"./safeExternalHref-CkBrsh84.js";import{E as U,s as T}from"./submissions-aWj7YtuZ.js";import{R as je,C as xe}from"./refresh-cw-Cps6nypW.js";import{L as I}from"./loader-circle-CWMja8Zn.js";import{C as ge}from"./circle-check-Bci9ZTu9.js";import"./curation-C7Gmmp4z.js";/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const X=te("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ve=te("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function j({title:s,children:t}){return e.jsxs("div",{className:"submission-diff-column",children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("div",{className:"submission-diff-pills",children:t})]})}function g({children:s}){return e.jsx("span",{className:"submission-muted",children:s})}function k({url:s,empty:t,className:i}){return s?e.jsx("a",{className:y("submission-url-link",i),href:fe(s)??void 0,target:"_blank",rel:"noopener noreferrer",children:s}):t?e.jsx(g,{children:t}):null}function N({label:s,value:t}){return e.jsxs("div",{children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("div",{className:"submission-field-value",children:t??e.jsx("span",{className:"submission-muted",children:"Not set"})})]})}function Y({title:s,value:t}){return e.jsxs("div",{className:"submission-json-block",children:[e.jsx("div",{className:"submission-diff-label",children:s}),e.jsx("pre",{children:JSON.stringify(t,null,2)})]})}function be({currentPayload:s,proposedPayload:t}){const[i,a]=v.useState(!1);return e.jsxs("div",{className:"submission-raw-toggle",children:[e.jsx("button",{type:"button",className:"raw-json-btn",onClick:()=>a(n=>!n),children:i?"Hide raw JSON":"Show raw JSON"}),i&&e.jsxs("div",{className:"submission-json-grid",children:[e.jsx(Y,{title:"Current payload",value:s??{}}),e.jsx(Y,{title:"Proposed payload",value:t})]})]})}function B({currentItems:s,proposedIds:t,queryPrefix:i,fetchEntity:a,knownNames:n}){const o=v.useMemo(()=>Array.from(new Set([...s.map(d=>d.id),...t])).sort((d,f)=>d-f),[s,t]),c=J({queries:a?o.map(d=>({queryKey:[i,String(d)],queryFn:()=>a(String(d)),staleTime:5*60*1e3})):[]}),h=v.useMemo(()=>{const d=new Map;return s.forEach(f=>d.set(f.id,f.name)),n==null||n.forEach((f,x)=>d.set(x,f)),c.forEach(({data:f})=>{f&&d.set(Number(f.id),f.name)}),d},[s,c,n]),r=new Set(s.map(d=>d.id)),u=new Set(t),m=(d,f)=>e.jsx("span",{className:y("submission-diff-pill",f==="current"&&!u.has(d)&&"removed",f==="proposed"&&!r.has(d)&&"added"),children:h.get(d)??`#${d}`},d);return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(j,{title:"Currently tagged",children:s.length>0?s.map(d=>m(d.id,"current")):e.jsx(g,{children:"No current tags"})}),e.jsx(j,{title:"Will be tagged",children:t.length>0?t.map(d=>m(d,"proposed")):e.jsx(g,{children:"No proposed tags"})})]})}function ye({currentItems:s,proposedIds:t}){var n;const i=ne({queryKey:["organizations","submission-diff"],queryFn:()=>C.organizations(),staleTime:3e5}),a=new Map(s.map(o=>[o.id,o.name]));return(n=i.data)==null||n.results.forEach(o=>{a.set(Number(o.id),o.name)}),e.jsx(B,{currentItems:s,proposedIds:t,queryPrefix:"organization",knownNames:a})}function V(s,t,i){return J({queries:t.map(a=>({queryKey:[s,String(a)],queryFn:()=>i(String(a)),staleTime:5*60*1e3})),combine:a=>new Map(a.flatMap(({data:n})=>n?[[Number(n.id),n.name]]:[]))})}function _e({edit:s}){const t=v.useMemo(()=>{var r;return((r=s.current_payload)==null?void 0:r.evaluations)??[]},[s.current_payload]),i=s.proposed_payload.operations,{taskIds:a,datasetIds:n}=v.useMemo(()=>{const r=[...t,...i.flatMap(m=>m.op==="delete"?[]:[m.data])],u=m=>Array.from(new Set(r.flatMap(d=>d[m]?[d[m]]:[])));return{taskIds:u("task_id"),datasetIds:u("dataset_id")}},[t,i]),o=V("task",a,r=>C.getTask(r)),c=V("dataset",n,r=>C.getDataset(r)),h=new Map(t.filter(r=>r.id!=null).map(r=>[r.id,r]));return i.length===0?e.jsx(g,{children:"No evaluation operations in this payload."}):e.jsx("div",{className:"submission-eval-list",children:i.map((r,u)=>{const m=r.op==="create"?void 0:r.evaluation_id,d=m?h.get(m):void 0,f=r.op==="update"?{...d,...r.data}:r.op==="create"?r.data:d??{};return e.jsxs("div",{className:"submission-eval-op",children:[e.jsxs("div",{className:"submission-eval-op-header",children:[e.jsx("span",{className:y("submission-pill status",r.op==="create"&&"approved",r.op==="update"&&"changed",r.op==="delete"&&"rejected"),children:r.op}),m&&e.jsxs("span",{className:"submission-meta",children:["Evaluation #",m]})]}),e.jsx(Ne,{evaluation:f,taskNames:o,datasetNames:c})]},`${r.op}-${m??u}`)})})}function Ne({evaluation:s,taskNames:t,datasetNames:i}){const{task_id:a,dataset_id:n}=s,o=s.metrics??{};return e.jsxs("div",{className:"submission-eval-fields",children:[e.jsx(N,{label:"Task",value:a?t.get(a)??`#${a}`:null}),e.jsx(N,{label:"Dataset",value:n?i.get(n)??`#${n}`:null}),e.jsx(N,{label:"Model",value:s.model_name||null}),e.jsx(N,{label:"Harness",value:s.harness||null}),e.jsx(N,{label:"Best rank",value:s.best_rank??null}),e.jsx(N,{label:"Parameters",value:s.num_parameters??null}),e.jsx(N,{label:"HF model URL",value:s.hf_model_url||null}),e.jsx(N,{label:"Open source",value:s.is_open===void 0?null:s.is_open?"Yes":"No"}),e.jsxs("div",{className:"submission-eval-metrics",children:[e.jsx("div",{className:"submission-diff-label",children:"Metrics"}),Object.keys(o).length>0?e.jsx("div",{className:"submission-metric-list",children:Object.entries(o).map(([c,h])=>e.jsxs("span",{className:"submission-metric-pill",children:[c,": ",String(h)]},c))}):e.jsx(g,{children:"No metrics"})]})]})}function O({label:s,currentItems:t,proposedItems:i}){const a=new Map(t.map(c=>[c.url,c])),n=new Map(i.map(c=>[c.url,c])),o=Array.from(new Set([...a.keys(),...n.keys()])).sort();return o.length===0?e.jsxs(g,{children:["No ",s," in this submission."]}):e.jsx("div",{className:"submission-url-list",children:o.map(c=>{var f;const h=a.get(c),r=n.get(c),u=!h&&r,m=h&&!r,d=h&&r&&h.is_official!==r.is_official;return e.jsx("div",{className:y("submission-url-row",u&&"added",m&&"removed",d&&"changed"),children:e.jsxs("div",{className:"submission-url-content",children:[e.jsx(k,{url:c,className:y(m&&"removed")}),u&&e.jsx("span",{className:"submission-pill status approved",children:"Added"}),m&&e.jsx("span",{className:"submission-pill status rejected",children:"Removed"}),d&&e.jsxs("span",{className:"submission-pill changed",children:["Official: ",String(h.is_official)," ","->"," ",String(r.is_official)]}),((f=r??h)==null?void 0:f.is_official)&&e.jsx("span",{className:"submission-pill",children:"Official"})]})},c)})})}const L=s=>({url:s,is_official:!1});function ke({edit:s}){const t=[{key:"hf_models",label:"Models"},{key:"hf_datasets",label:"Datasets"},{key:"hf_spaces",label:"Spaces"}];return e.jsx("div",{className:"submission-hf-artifacts-diff",children:t.map(({key:i,label:a})=>{var n;return e.jsxs("div",{className:"submission-hf-artifacts-section",children:[e.jsx("div",{className:"submission-diff-label",children:a}),e.jsx(O,{label:a.toLowerCase(),currentItems:(((n=s.current_payload)==null?void 0:n[i])??[]).map(L),proposedItems:s.proposed_payload[i].map(L)})]},i)})})}function we({edit:s}){var t;return e.jsx(O,{label:"X threads",currentItems:(((t=s.current_payload)==null?void 0:t.x_threads)??[]).map(({url:i})=>L(i)),proposedItems:s.proposed_payload.x_threads.map(L)})}function Se({edit:s}){var t;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(j,{title:"Current source URL",children:e.jsx(k,{url:(t=s.current_payload)==null?void 0:t.source_url,empty:"No current URL"})}),e.jsx(j,{title:"Proposed source URL",children:e.jsx(k,{url:s.proposed_payload.source_url,empty:"No proposed URL"})})]})}const Ee={new_task:"task",new_method:"method",new_benchmark:"benchmark",new_metric:"metric",new_conference:"conference"};function z({text:s,empty:t}){return s?e.jsx("span",{className:"submission-field-value",children:s}):e.jsx(g,{children:t})}function Z({edit:s}){var n;const{image:t,image_credit:i}=s.proposed_payload,a=(t==null?void 0:t.url)!==void 0?ie(t.url)??"":(n=t==null?void 0:t.data_url)!=null&&n.startsWith("data:image/")?t.data_url:"";return e.jsxs(e.Fragment,{children:[e.jsx(j,{title:"Image",children:a?e.jsx("img",{src:a,alt:(t==null?void 0:t.file_name)??"Suggested image",className:"max-h-64 max-w-full rounded-md border border-border object-contain"}):e.jsx(g,{children:"No image provided"})}),e.jsx(j,{title:"Image source",children:i||e.jsx(g,{children:"No image source provided"})})]})}function Ce({edit:s}){switch(s.edit_type){case"new_task":{const{parent_id:t,area_id:i,keywords:a}=s.proposed_payload;return e.jsxs(e.Fragment,{children:[e.jsx(Z,{edit:s}),e.jsx(j,{title:"Placement and keywords",children:e.jsx("span",{className:"submission-field-value",children:JSON.stringify({parent_id:t??null,area_id:i??null,keywords:a??null})})})]})}case"new_method":{const t=s.proposed_payload.source_url??"";return e.jsxs(e.Fragment,{children:[e.jsx(Z,{edit:s}),e.jsx(j,{title:"Source",children:/^https?:\/\//.test(t)?e.jsx(k,{url:t}):e.jsx(z,{text:t,empty:"No source provided"})})]})}case"new_benchmark":{const t=s.proposed_payload;return e.jsx(j,{title:"Task",children:e.jsx("span",{className:"submission-field-value",children:"task"in t?t.task:JSON.stringify(t.task_ids)})})}case"new_metric":{const{direction:t,scale:i,task_id:a,dataset_id:n}=s.proposed_payload;return e.jsx(j,{title:"Metric and leaderboard definition",children:e.jsx("span",{className:"submission-field-value",children:JSON.stringify({direction:t,scale:i,task_id:a,dataset_id:n})})})}case"new_conference":{const{year:t,start_date:i,end_date:a,venue:n,url:o}=s.proposed_payload;return e.jsxs(e.Fragment,{children:[e.jsx(j,{title:"Edition and dates",children:t?`${t}${i?` · ${i}${a?` – ${a}`:""}`:""}`:e.jsx(g,{children:"No edition provided"})}),e.jsx(j,{title:"Venue",children:n||e.jsx(g,{children:"No venue provided"})}),e.jsx(j,{title:"URL",children:e.jsx(k,{url:o,empty:"No URL provided"})})]})}}}function Pe({edit:s}){const t=s.proposed_payload,i="benchmark"in t?t.benchmark:t.name;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(j,{title:`Suggested ${Ee[s.edit_type]} name`,children:i?e.jsx("span",{className:"submission-diff-pill added",children:i}):e.jsx(g,{children:"No name provided"})}),e.jsx(j,{title:"Description",children:e.jsx(z,{text:t.description,empty:"No description provided"})}),e.jsx(Ce,{edit:s})]})}function Re({edit:s}){var c;const{name:t,hf_slug:i,website_url:a,image:n}=s.proposed_payload,o=n!=null&&n.url?ie(n.url):(c=n==null?void 0:n.data_url)!=null&&c.startsWith("data:image/")?n.data_url:void 0;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(j,{title:"Suggested organization name",children:e.jsx("span",{className:"submission-diff-pill added",children:t})}),e.jsx(j,{title:"Hugging Face organization",children:e.jsx(k,{url:i?`https://huggingface.co/${i}`:void 0,empty:"No Hugging Face organization provided"})}),e.jsx(j,{title:"Website",children:e.jsx(k,{url:a,empty:"No website provided"})}),e.jsx(j,{title:"Logo",children:o?e.jsx("img",{src:o,alt:(n==null?void 0:n.file_name)??"Suggested logo",className:"max-h-32 max-w-full rounded-md border border-border object-contain"}):e.jsx(g,{children:"No logo provided"})})]})}function Me({edit:s}){const{title:t,source_url:i,abstract:a,date_published:n,authors:o}=s.proposed_payload;return e.jsxs("div",{className:"submission-diff-columns",children:[e.jsx(j,{title:"Title",children:e.jsx(z,{text:t,empty:"No title provided"})}),e.jsx(j,{title:"Publication date",children:n||e.jsx(g,{children:"No publication date provided"})}),e.jsx(j,{title:"Authors",children:o.length>0?o.map((c,h)=>e.jsx("span",{className:"submission-diff-pill added",children:c},`${c}-${h}`)):e.jsx(g,{children:"No authors provided"})}),e.jsx(j,{title:"Source URL",children:e.jsx(k,{url:i,empty:"No source URL provided"})}),e.jsx(j,{title:"Abstract",children:e.jsx(z,{text:a,empty:"No abstract provided"})})]})}function Te(s){throw new Error(`Unhandled pending edit: ${JSON.stringify(s)}`)}function Ie({edit:s}){var t,i,a,n,o;switch(s.edit_type){case"tasks":return e.jsx(B,{currentItems:((t=s.current_payload)==null?void 0:t.tasks)??[],proposedIds:s.proposed_payload.task_ids,queryPrefix:"task",fetchEntity:c=>C.getTask(c)});case"methods":return e.jsx(B,{currentItems:((i=s.current_payload)==null?void 0:i.methods)??[],proposedIds:s.proposed_payload.method_ids,queryPrefix:"method",fetchEntity:c=>C.getMethod(c)});case"organizations":return e.jsx(ye,{currentItems:((a=s.current_payload)==null?void 0:a.organizations)??[],proposedIds:s.proposed_payload.organization_ids});case"repositories":return e.jsx(O,{label:"repositories",currentItems:((n=s.current_payload)==null?void 0:n.repositories)??[],proposedItems:s.proposed_payload.repositories});case"project_pages":return e.jsx(O,{label:"project pages",currentItems:((o=s.current_payload)==null?void 0:o.project_pages)??[],proposedItems:s.proposed_payload.project_pages});case"evaluations":return e.jsx(_e,{edit:s});case"source_url":return e.jsx(Se,{edit:s});case"hf_artifacts":return e.jsx(ke,{edit:s});case"x_threads":return e.jsx(we,{edit:s});case"new_task":case"new_method":case"new_benchmark":case"new_metric":case"new_conference":return e.jsx(Pe,{edit:s});case"new_organization":return e.jsx(Re,{edit:s});case"new_external_paper":return e.jsx(Me,{edit:s});default:return Te(s)}}function $e({edit:s}){return e.jsxs("div",{className:"submission-diff-body",children:[e.jsx(Ie,{edit:s}),e.jsx(be,{currentPayload:s.current_payload,proposedPayload:s.proposed_payload})]})}const ee=25,Fe=["pending","approved","rejected","all"],Ae=["all",...Object.keys(U)],K=["pending","approved","rejected"];function De(s){return s.slice(0,2).toUpperCase()}function D(s){return s.replace(/_/g," ")}function se(s){if(!s)return"unknown time";const t=new Date(s);if(Number.isNaN(t.getTime()))return s;const i=Date.now()-t.getTime(),a=Math.floor(i/6e4),n=Math.floor(i/36e5),o=Math.floor(i/864e5);return a<1?"just now":a<60?`${a}m ago`:n<24?`${n}h ago`:o<14?`${o}d ago`:t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Ue(s){return s==="approved"?"approved":s==="rejected"?"rejected":"pending"}function Oe(s,t){return(s==null?void 0:s.arxiv_id)||(s==null?void 0:s.id)||String(t)}function Le(s){return[...s].sort((t,i)=>new Date(i.created_at).getTime()-new Date(t.created_at).getTime())}async function ze(s,t,i,a){const n=await Promise.all(s.map(u=>T.list({status:u,edit_type:t==="all"?void 0:t,reviewed_by_kind:i?"auto":void 0,limit:ee,offset:a[u]??0}))),o=Le(n.flatMap(u=>u.results)).slice(0,ee),c={};s.forEach((u,m)=>{const d=o.filter(f=>n[m].results.includes(f)).length;c[u]=(a[u]??0)+d});const h=n.reduce((u,m)=>u+m.count,0),r=s.reduce((u,m)=>u+(c[m]??0),0);return{count:h,results:o,nextOffsets:o.length>0&&r{i.invalidateQueries({queryKey:["pendingPaperEdits"]}),i.invalidateQueries({queryKey:["pendingPaperEdit",p.id]}),p.paper_id!=null&&p.edit_type!=="evaluations"&&G(i,[String(p.paper_id),t==null?void 0:t.arxiv_id])},[t==null?void 0:t.arxiv_id,i]),$=A({mutationFn:()=>T.approve(s.id),onSuccess:p=>{var F;x(p),p.edit_type==="evaluations"&&p.paper_id!=null?ce(i,ue(String(p.paper_id),((F=p.current_payload)==null?void 0:F.evaluations)??[],p.proposed_payload.operations,(t==null?void 0:t.arxiv_id)??void 0)):p.paper_id!=null&&!c&&Q(i),a({title:"Submission approved",description:c?`Marked ${D(s.edit_type)} suggestion as approved. No catalog changes were applied.`:`Applied ${D(s.edit_type)} changes for ${u}.`})},onError:p=>{a({title:"Could not approve submission",description:E(p,"Approval failed. Please try again."),variant:"destructive"})}}),P=A({mutationFn:()=>T.reject(s.id),onSuccess:p=>{x(p),a({title:"Submission rejected",description:`Rejected ${D(s.edit_type)} changes for ${u}.`})},onError:p=>{a({title:"Could not reject submission",description:E(p,"Rejection failed. Please try again."),variant:"destructive"})}}),S=A({mutationFn:()=>C.rollbackEvent(s.catalog_event_id),onSuccess:()=>{i.invalidateQueries({queryKey:["pendingPaperEdits"]}),s.paper_id!=null&&(G(i,[String(s.paper_id),t==null?void 0:t.arxiv_id]),Q(i)),a({title:"Edit reverted",description:`Restored ${u} to its previous state.`})},onError:p=>{a({title:"Could not revert edit",description:E(p,"The paper changed after this edit, or it was already reverted."),variant:"destructive"})}}),R=A({mutationFn:p=>T.revertAutoApproved(s.hf_subject,{suspend:p}),onSuccess:p=>{i.invalidateQueries({queryKey:["pendingPaperEdits"]}),Q(i),a({title:`Reverted ${p.reverted} edits by @${s.hf_username}`,description:p.skipped.length?`${p.skipped.length} were skipped because the paper changed since.`:void 0})},onError:p=>{a({title:"Could not revert edits",description:E(p,"Bulk revert failed. Please try again."),variant:"destructive"})}}),M=p=>{const F=`Revert every edit @${s.hf_username} had auto-applied in the last 7 days${p?" and suspend the account":""}?`;window.confirm(F)&&R.mutate(p)},l=s.reviewed_by_kind==="auto",_=l&&!!s.catalog_event_id,b=$.isPending,w=P.isPending,H=b||w,q=S.isPending||R.isPending;return e.jsxs("article",{id:`submission-${s.id}`,className:"submission-card",children:[e.jsxs("header",{className:"submission-card-header",children:[e.jsxs("div",{className:"submission-card-top",children:[e.jsxs("div",{children:[r?e.jsx("a",{href:`/paper/${encodeURIComponent(r)}`,target:"_blank",rel:"noopener noreferrer",className:"submission-title",children:u}):e.jsx("div",{className:"submission-title",children:u}),e.jsxs("div",{className:"submission-meta",children:[e.jsxs("span",{children:["#",s.id]}),e.jsx("span",{children:o?h.subtitle:`Paper #${s.paper_id}`}),e.jsx("span",{children:se(s.created_at)})]})]}),e.jsxs("div",{className:"submission-badges",children:[e.jsx("span",{className:"submission-pill",children:D(s.edit_type)}),l&&e.jsx("span",{className:"submission-pill",children:"Auto-applied"}),s.is_author&&e.jsx("span",{className:"submission-pill author",children:"Linked author"}),e.jsx("span",{className:y("submission-pill status",Ue(s.status)),children:s.status})]})]}),e.jsxs("a",{href:`https://huggingface.co/${encodeURIComponent(s.hf_username)}`,target:"_blank",rel:"noopener noreferrer",className:"submission-user",children:[e.jsxs(oe,{className:"h-6 w-6",children:[e.jsx(le,{src:m,alt:s.hf_username}),e.jsx(de,{className:"text-[10px]",children:De(s.hf_username)})]}),e.jsxs("span",{children:["@",s.hf_username]})]})]}),e.jsx("div",{className:"submission-diff",children:e.jsx($e,{edit:s})}),s.conflict_payload&&e.jsxs("div",{className:"submission-empty submission-empty-warn",children:["Canonical state changed after this submission. Review the conflict before deciding.",e.jsx("pre",{children:JSON.stringify(s.conflict_payload,null,2)})]}),e.jsx("footer",{className:"submission-actions",children:d?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"submission-action-buttons",children:[e.jsxs("button",{type:"button",onClick:()=>P.mutate(),disabled:H,className:"submission-action-btn reject",children:[w?e.jsx(I,{className:"spin",size:14}):e.jsx(xe,{size:14}),"Reject"]}),e.jsxs("button",{type:"button",onClick:()=>$.mutate(),disabled:H,className:"submission-action-btn approve",children:[b?e.jsx(I,{className:"spin",size:14}):e.jsx(ge,{size:14}),"Approve"]})]})}):e.jsxs("div",{className:"submission-reviewed",children:[e.jsxs("span",{children:["Reviewed by ",e.jsx("strong",{children:s.reviewed_by||"unknown"}),s.reviewed_at?` ${se(s.reviewed_at)}`:""]}),s.admin_note&&e.jsxs("span",{children:["Admin note: ",e.jsx("strong",{children:s.admin_note})]}),f&&e.jsxs("span",{children:["Submitter-visible reason: ",e.jsx("strong",{children:s.user_review_reason})]}),_&&e.jsxs("div",{className:"submission-action-buttons",children:[e.jsxs("button",{type:"button",onClick:()=>S.mutate(),disabled:q,className:"submission-action-btn reject",children:[S.isPending?e.jsx(I,{className:"spin",size:14}):e.jsx(ve,{size:14}),"Revert this edit"]}),s.hf_subject&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>M(!1),disabled:q,className:"submission-action-btn reject",children:["Revert all by @",s.hf_username]}),e.jsx("button",{type:"button",onClick:()=>M(!0),disabled:q,className:"submission-action-btn reject",children:"Revert all and suspend"})]})]}),s.applied_payload&&e.jsxs("details",{children:[e.jsx("summary",{children:c?"Reviewed payload":"Applied payload"}),e.jsx("pre",{children:JSON.stringify(s.applied_payload,null,2)})]}),s.result_entity_type&&e.jsxs("span",{children:["Created/applied: ",e.jsxs("strong",{children:[s.result_entity_type," #",s.result_entity_id]})]})]})})]})}function is(){var R,M;const{toast:s}=ae(),[t,i]=v.useState("pending"),[a,n]=v.useState("all"),[o,c]=v.useState(!1),h=ne({queryKey:["pendingPaperEdits","counts",a,o],queryFn:async()=>{const l=a==="all"?void 0:a,_=await Promise.all(K.map(b=>T.list({status:b,edit_type:l,reviewed_by_kind:o?"auto":void 0,limit:1,offset:0})));return Object.fromEntries(_.map((b,w)=>[K[w],b.count]))},staleTime:30*1e3}),r=he({queryKey:["pendingPaperEdits",{status:t,editType:a,autoOnly:o}],queryFn:({pageParam:l})=>ze(t==="all"?K:[t],a,o,l),initialPageParam:{},getNextPageParam:l=>l.nextOffsets??void 0,retry:!1}),u=v.useMemo(()=>{var l;return((l=r.data)==null?void 0:l.pages.flatMap(_=>_.results))??[]},[r.data]),m=v.useMemo(()=>Array.from(new Set(u.map(l=>l.paper_id).filter(l=>l!=null))).sort((l,_)=>l-_),[u]),d=J({queries:m.map(l=>({queryKey:me.summary(String(l)),queryFn:()=>pe.get(String(l),!1),staleTime:5*60*1e3}))}),f=v.useMemo(()=>{const l=new Map;return d.forEach(_=>{const b=_.data;if(!b)return;const w=Number(b.id);Number.isFinite(w)&&l.set(w,b)}),l},[d]);v.useEffect(()=>{r.error&&s({title:"Could not load submissions",description:E(r.error,"Failed to load pending paper edits."),variant:"destructive"})},[r.error,s]);const x=h.data,$=x?x.pending+x.approved+x.rejected:void 0,P={pending:x==null?void 0:x.pending,approved:x==null?void 0:x.approved,rejected:x==null?void 0:x.rejected,all:$},S=((M=(R=r.data)==null?void 0:R.pages[0])==null?void 0:M.count)??0;return e.jsxs("div",{className:"page submissions-page",children:[e.jsxs("div",{className:"feed-header",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Pending ",e.jsx("em",{children:"Edits"})]}),e.jsx("div",{className:"feed-subtitle",children:"Review submitted changes to paper metadata and benchmark results"})]}),e.jsxs("button",{type:"button",className:"feedback-link",onClick:()=>{h.refetch(),r.refetch()},disabled:r.isFetching||h.isFetching,children:[e.jsx(je,{className:y((r.isFetching||h.isFetching)&&"spin"),size:14}),"Refresh"]})]}),e.jsxs("div",{className:"submissions-filter-panel",children:[e.jsxs("div",{className:"submission-filter-block",children:[e.jsx("div",{className:"sidebar-label",children:"Status"}),e.jsxs("div",{className:"period-switch",children:[Fe.map(l=>e.jsxs("button",{type:"button",className:y("period-btn",t===l&&"active"),onClick:()=>i(l),children:[l,P[l]!=null&&e.jsx("span",{className:"submission-count",children:P[l]})]},l)),e.jsx("button",{type:"button",className:y("period-btn",o&&"active"),onClick:()=>{c(l=>!l),o||i("approved")},children:"auto-applied only"})]})]}),e.jsxs("div",{className:"submission-filter-block",children:[e.jsx("div",{className:"sidebar-label",children:"Edit Type"}),e.jsx("div",{className:"sort-options submissions-type-options",children:Ae.map(l=>e.jsx("button",{type:"button",className:y("sort-btn",a===l&&"active"),onClick:()=>n(l),children:l==="all"?"all":U[l].label},l))})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"sort-bar submissions-sort-bar",children:e.jsx("div",{children:e.jsx("div",{className:"sort-options",children:e.jsx("span",{className:"results-count",children:r.isFetching?"refreshing":`${S} submissions`})})})}),r.isLoading?e.jsxs("div",{className:"submission-loading",children:[e.jsx(I,{className:"spin",size:18}),e.jsx("span",{children:"Loading submissions..."})]}):r.isError?e.jsxs("div",{className:"submission-empty submission-empty-warn",role:"alert",children:[e.jsx(X,{size:28}),e.jsx("h2",{children:"Could not display submissions."}),e.jsx("p",{children:E(r.error,"The submissions response was invalid.")})]}):u.length===0?e.jsxs("div",{className:"submission-empty",children:[e.jsx(X,{size:28}),e.jsx("h2",{children:"No pending submissions."}),e.jsxs("p",{children:["The SQL and curl fallback is still documented in"," ",e.jsx("a",{href:"https://github.com/huggingface/paperswithcode/blob/main/docs/operations.md",target:"_blank",rel:"noopener noreferrer",children:"operations.md"}),"."]})]}):e.jsx("div",{className:"submission-list",children:u.map(l=>e.jsx(qe,{submission:l,paper:l.paper_id==null?void 0:f.get(l.paper_id)},l.id))}),u.length>0&&e.jsxs("div",{className:"submission-pagination",children:[e.jsxs("p",{children:["Showing ",u.length," of ",S," submissions"]}),r.hasNextPage&&e.jsxs("button",{type:"button",className:"feedback-link",onClick:()=>r.fetchNextPage(),disabled:r.isFetching,children:[r.isFetchingNextPage&&e.jsx(I,{className:"spin",size:14}),"Load more"]})]})]})]})}export{is as default}; diff --git a/assets/SubmitView-C6p4dpHt.js b/assets/SubmitView-C6p4dpHt.js deleted file mode 100644 index b5334886b3b967fc723f2871a4ed64c1c3ea571b..0000000000000000000000000000000000000000 --- a/assets/SubmitView-C6p4dpHt.js +++ /dev/null @@ -1 +0,0 @@ -import{c as D,f as E,p as C,a as F,e as N,M as o,t as X,j as e,h as z}from"./index-CbgxfyGU.js";import{u as U}from"./useMutation-P_trTy9i.js";import{A as O,a as M}from"./alert-CFDDvdIM.js";import{B as P}from"./button-Bv9oZ-QU.js";import{I as h}from"./input-B6pxtfPe.js";import{T as q}from"./textarea-Bf06GTSH.js";import{a as B}from"./paperQueryKeys-B8u1BWlI.js";import{a as H}from"./queryInvalidation-Chlw4DEx.js";import"./curation-C7Gmmp4z.js";const S="pwc:paper-submit-draft",R={color:"var(--accent-text)",fontWeight:600,textDecoration:"underline",textUnderlineOffset:2},V=/^\d{4}\.\d{4,5}(v\d+)?$/i,J=/^[a-z-]+(\.[A-Z]{2})?\/\d{7}$/,W=/^https?:\/\/(?:www\.)?arxiv\.org\//i;function k(l){const i=l.trim();return i?V.test(i)||J.test(i)||W.test(i)?"arxiv":/^https?:\/\//i.test(i)?"external":"arxiv":"empty"}function $(l,i){const r=l.trim();if(k(r)==="arxiv")return/^https?:\/\//i.test(r)?{source_url:r}:{arxiv_id:r};const s={source_url:r},p=i.title.trim();p&&(s.title=p);const d=i.abstract.trim();d&&(s.abstract=d);const n=i.authors.split(/[,\n]/).map(c=>c.trim()).filter(Boolean);return n.length>0&&(s.authors=n),i.datePublished&&(s.date_published=i.datePublished),s}const re=()=>{const l=D(),i=E(),{toast:r}=C(),{user:g,isLoading:s}=F(),[p]=N(),d=p.get("arxiv_id")??"",[n,c]=o.useState(d),[f,j]=o.useState(""),[x,w]=o.useState(""),[b,I]=o.useState(""),[v,_]=o.useState(""),[A,y]=o.useState(null);o.useEffect(()=>{if(d)return;const t=sessionStorage.getItem(S);if(t){sessionStorage.removeItem(S);try{const a=JSON.parse(t);c(a.input??""),j(a.title??""),w(a.abstract??""),I(a.authors??""),_(a.datePublished??"")}catch{}}},[d]);const m=k(n),L=m==="external",u=U({mutationFn:t=>B.submit(t),onSuccess:t=>{if(t.pending_review){r({title:"Submission queued for review",description:"No source page was fetched and no catalog row was changed."}),u.reset();return}H(i);const a=t.refreshed&&t.created&&t.latest_version;r({title:a?`Paper updated to ${t.latest_version}`:t.created?"Paper submitted":"Paper already indexed",description:a?"Opening the updated paper page…":t.created?"Opening the paper page…":"Opening the existing paper page…"}),t.route_identifier&&l(`/paper/${t.route_identifier}`)},onError:t=>{y(X(t,"Submission failed"))}}),T=t=>{if(t.preventDefault(),y(null),m==="empty"){y("Enter an arXiv ID or a paper URL to submit.");return}if(!g){sessionStorage.setItem(S,JSON.stringify({input:n,title:f,abstract:x,authors:b,datePublished:v})),window.location.assign(z(window.location.href));return}const a=$(n,{title:f,abstract:x,authors:b,datePublished:v});u.mutate(a)};return e.jsxs("div",{className:"page",style:{maxWidth:720},children:[e.jsx("h1",{className:"detail-title",children:"Submit a paper"}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:12,lineHeight:1.55},children:["If your paper is on arXiv, submit it on"," ",e.jsx("a",{href:"https://huggingface.co/papers/submit",target:"_blank",rel:"noopener noreferrer",style:R,children:"Hugging Face"}),", which will automatically index it on Papers with Code."]}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:12,lineHeight:1.55},children:["If your paper is not on arXiv, submit it here. Non-arXiv papers (blog posts, technical reports, model release pages) enter the submission queue and appear only after review."," ",e.jsx("a",{href:"/rate-limits",style:R,children:"Read the submission and rate-limit policy."})]}),e.jsxs("form",{onSubmit:T,style:{marginTop:28,display:"grid",gap:20},children:[e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-input",style:{fontWeight:600,fontSize:14},children:"arXiv ID or paper URL"}),e.jsx(h,{id:"submit-input",value:n,onChange:t=>c(t.target.value),placeholder:"2501.12345 · https://arxiv.org/abs/2501.12345 · https://blog.example.com/release",autoFocus:!0,required:!0}),e.jsx("div",{style:{fontSize:12,color:"var(--ink-soft)",minHeight:18},children:m==="arxiv"?"Detected: arXiv paper — metadata will be fetched automatically.":m==="external"?"Detected: external URL — we'll extract metadata and you can override below.":"Paste an arXiv ID like 2501.12345 or any paper/blog URL."})]}),L&&e.jsxs("fieldset",{style:{border:"1px solid var(--rule)",borderRadius:8,padding:"16px 20px 20px",display:"grid",gap:16},children:[e.jsx("legend",{style:{padding:"0 8px",fontSize:12,color:"var(--ink-soft)",textTransform:"uppercase",letterSpacing:.5},children:"External paper details (optional)"}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-title",style:{fontSize:13},children:"Title"}),e.jsx(h,{id:"submit-title",value:f,onChange:t=>j(t.target.value),placeholder:"Leave blank to extract automatically"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-abstract",style:{fontSize:13},children:"Abstract or summary"}),e.jsx(q,{id:"submit-abstract",value:x,onChange:t=>w(t.target.value),rows:4,placeholder:"Leave blank to extract automatically"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-authors",style:{fontSize:13},children:"Authors (comma-separated)"}),e.jsx(h,{id:"submit-authors",value:b,onChange:t=>I(t.target.value),placeholder:"Jane Smith, John Doe"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-date",style:{fontSize:13},children:"Publication date"}),e.jsx(h,{id:"submit-date",type:"date",value:v,onChange:t=>_(t.target.value),style:{maxWidth:220}}),e.jsx("div",{style:{fontSize:12,color:"var(--ink-soft)"},children:"Required only if we cannot infer a date from the page."})]})]}),A&&e.jsx(O,{variant:"destructive",children:e.jsx(M,{children:A})}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[e.jsx(P,{type:"submit",disabled:u.isPending||s,children:s?"Checking sign-in…":u.isPending?"Submitting…":g?"Submit paper":"Sign in to submit"}),e.jsx(P,{type:"button",variant:"outline",onClick:()=>l(-1),disabled:u.isPending,children:"Cancel"})]})]})]})};export{re as default}; diff --git a/assets/SubmitView-CDuD6xEz.js b/assets/SubmitView-CDuD6xEz.js new file mode 100644 index 0000000000000000000000000000000000000000..d7cedc9d53d3b1439b27bb48408f9e3c10aed2bb --- /dev/null +++ b/assets/SubmitView-CDuD6xEz.js @@ -0,0 +1 @@ +import{e as D,i as E,x as C,a as F,g as N,V as o,y as X,j as e,h as z}from"./index-DyXq7-Tg.js";import{u as U}from"./useMutation-UWxBeqtn.js";import{A as O,a as V}from"./alert-gbJBhAVE.js";import{B as P}from"./button-DZeAbOf2.js";import{I as h}from"./input-DJqCAbs7.js";import{T as q}from"./textarea-DPixlM5U.js";import{p as B}from"./papers-Dh3ljlL0.js";import{a as H}from"./queryInvalidation-CfHeNeUY.js";import"./curation-YeS7FBYf.js";const S="pwc:paper-submit-draft",R={color:"var(--accent-text)",fontWeight:600,textDecoration:"underline",textUnderlineOffset:2},M=/^\d{4}\.\d{4,5}(v\d+)?$/i,J=/^[a-z-]+(\.[A-Z]{2})?\/\d{7}$/,W=/^https?:\/\/(?:www\.)?arxiv\.org\//i;function k(l){const i=l.trim();return i?M.test(i)||J.test(i)||W.test(i)?"arxiv":/^https?:\/\//i.test(i)?"external":"arxiv":"empty"}function $(l,i){const r=l.trim();if(k(r)==="arxiv")return/^https?:\/\//i.test(r)?{source_url:r}:{arxiv_id:r};const s={source_url:r},p=i.title.trim();p&&(s.title=p);const d=i.abstract.trim();d&&(s.abstract=d);const n=i.authors.split(/[,\n]/).map(c=>c.trim()).filter(Boolean);return n.length>0&&(s.authors=n),i.datePublished&&(s.date_published=i.datePublished),s}const re=()=>{const l=D(),i=E(),{toast:r}=C(),{user:g,isLoading:s}=F(),[p]=N(),d=p.get("arxiv_id")??"",[n,c]=o.useState(d),[f,j]=o.useState(""),[x,w]=o.useState(""),[b,I]=o.useState(""),[v,_]=o.useState(""),[A,y]=o.useState(null);o.useEffect(()=>{if(d)return;const t=sessionStorage.getItem(S);if(t){sessionStorage.removeItem(S);try{const a=JSON.parse(t);c(a.input??""),j(a.title??""),w(a.abstract??""),I(a.authors??""),_(a.datePublished??"")}catch{}}},[d]);const m=k(n),L=m==="external",u=U({mutationFn:t=>B.submit(t),onSuccess:t=>{if(t.pending_review){r({title:"Submission queued for review",description:"No source page was fetched and no catalog row was changed."}),u.reset();return}H(i);const a=t.refreshed&&t.created&&t.latest_version;r({title:a?`Paper updated to ${t.latest_version}`:t.created?"Paper submitted":"Paper already indexed",description:a?"Opening the updated paper page…":t.created?"Opening the paper page…":"Opening the existing paper page…"}),t.route_identifier&&l(`/paper/${t.route_identifier}`)},onError:t=>{y(X(t,"Submission failed"))}}),T=t=>{if(t.preventDefault(),y(null),m==="empty"){y("Enter an arXiv ID or a paper URL to submit.");return}if(!g){sessionStorage.setItem(S,JSON.stringify({input:n,title:f,abstract:x,authors:b,datePublished:v})),window.location.assign(z(window.location.href));return}const a=$(n,{title:f,abstract:x,authors:b,datePublished:v});u.mutate(a)};return e.jsxs("div",{className:"page",style:{maxWidth:720},children:[e.jsx("h1",{className:"detail-title",children:"Submit a paper"}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:12,lineHeight:1.55},children:["If your paper is on arXiv, submit it on"," ",e.jsx("a",{href:"https://huggingface.co/papers/submit",target:"_blank",rel:"noopener noreferrer",style:R,children:"Hugging Face"}),", which will automatically index it on Papers with Code."]}),e.jsxs("p",{style:{fontFamily:"var(--serif)",color:"var(--ink-soft)",marginTop:12,lineHeight:1.55},children:["If your paper is not on arXiv, submit it here. Non-arXiv papers (blog posts, technical reports, model release pages) enter the submission queue and appear only after review."," ",e.jsx("a",{href:"/rate-limits",style:R,children:"Read the submission and rate-limit policy."})]}),e.jsxs("form",{onSubmit:T,style:{marginTop:28,display:"grid",gap:20},children:[e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-input",style:{fontWeight:600,fontSize:14},children:"arXiv ID or paper URL"}),e.jsx(h,{id:"submit-input",value:n,onChange:t=>c(t.target.value),placeholder:"2501.12345 · https://arxiv.org/abs/2501.12345 · https://blog.example.com/release",autoFocus:!0,required:!0}),e.jsx("div",{style:{fontSize:12,color:"var(--ink-soft)",minHeight:18},children:m==="arxiv"?"Detected: arXiv paper — metadata will be fetched automatically.":m==="external"?"Detected: external URL — we'll extract metadata and you can override below.":"Paste an arXiv ID like 2501.12345 or any paper/blog URL."})]}),L&&e.jsxs("fieldset",{style:{border:"1px solid var(--rule)",borderRadius:8,padding:"16px 20px 20px",display:"grid",gap:16},children:[e.jsx("legend",{style:{padding:"0 8px",fontSize:12,color:"var(--ink-soft)",textTransform:"uppercase",letterSpacing:.5},children:"External paper details (optional)"}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-title",style:{fontSize:13},children:"Title"}),e.jsx(h,{id:"submit-title",value:f,onChange:t=>j(t.target.value),placeholder:"Leave blank to extract automatically"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-abstract",style:{fontSize:13},children:"Abstract or summary"}),e.jsx(q,{id:"submit-abstract",value:x,onChange:t=>w(t.target.value),rows:4,placeholder:"Leave blank to extract automatically"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-authors",style:{fontSize:13},children:"Authors (comma-separated)"}),e.jsx(h,{id:"submit-authors",value:b,onChange:t=>I(t.target.value),placeholder:"Jane Smith, John Doe"})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{htmlFor:"submit-date",style:{fontSize:13},children:"Publication date"}),e.jsx(h,{id:"submit-date",type:"date",value:v,onChange:t=>_(t.target.value),style:{maxWidth:220}}),e.jsx("div",{style:{fontSize:12,color:"var(--ink-soft)"},children:"Required only if we cannot infer a date from the page."})]})]}),A&&e.jsx(O,{variant:"destructive",children:e.jsx(V,{children:A})}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[e.jsx(P,{type:"submit",disabled:u.isPending||s,children:s?"Checking sign-in…":u.isPending?"Submitting…":g?"Submit paper":"Sign in to submit"}),e.jsx(P,{type:"button",variant:"outline",onClick:()=>l(-1),disabled:u.isPending,children:"Cancel"})]})]})]})};export{re as default}; diff --git a/assets/TagBrowseView-CRgLg1ki.js b/assets/TagBrowseView-CRgLg1ki.js deleted file mode 100644 index e8f4cdfa814d13d6850fa207856d28d21cdd9c32..0000000000000000000000000000000000000000 --- a/assets/TagBrowseView-CRgLg1ki.js +++ /dev/null @@ -1 +0,0 @@ -import{j as e,L as g,M as ce,u as le,c as oe,r as j,q as de,Z as me}from"./index-CbgxfyGU.js";import{R as he}from"./ResearchFollowButton-D2BXlDtQ.js";import{u as U}from"./useQuery-Bx9s5-D2.js";import{M as pe}from"./SotaBadges-C-sTR-EF.js";import{u as ue,b as ge,a as be}from"./PaperFeed-DMvUfA47.js";import{A as L}from"./arrow-right-DotD9yNb.js";import{B as xe}from"./BenchmarkTrendSparkline-C135_NtS.js";import{M as K}from"./MarkdownText-Bj-G_S-B.js";import{c as O}from"./catalog-DhK7_9-6.js";import{p as je,a as ke}from"./paperQueryKeys-B8u1BWlI.js";import{i as _e}from"./apiErrors-BZ5h1Kmb.js";import{f as fe}from"./frameworks-DDA0P4Tf.js";import{s as Ne}from"./slug-BpH-Nkvz.js";import{d as N,t as we}from"./transform-0Udg2p6b.js";import{u as ve}from"./usePapers-CJaWLZ3y.js";import{S as P}from"./skeleton-HwvdxvSN.js";import{A as ye,a as Se}from"./alert-CFDDvdIM.js";import Ee from"./NotFound-DtzwOULp.js";import{T as Te}from"./trophy-BQwEH3L7.js";import{G as $e}from"./github-BYklgHDz.js";import"./useMutation-P_trTy9i.js";import"./research-DgpyzSy_.js";import"./plus-UK0TEjgd.js";import"./colors-BkWRhvFI.js";import"./PaperCard-tdTC_dRN.js";import"./AuthorAvatar-CUJMmp_z.js";import"./Icon-D-kA0Owz.js";import"./LatexTitle-Z-HGmZ-H.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-DKJYnYjk.js";import"./useIntersectionObserver-CID9Kkak.js";/* empty css */import"./PaperPreviewLink-DZDNIh1g.js";import"./index-ZkEATkOr.js";import"./index-BH3yOoza.js";import"./katex-DkKDou_j.js";import"./hover-card-ufez2uMo.js";import"./curation-C7Gmmp4z.js";import"./useInfiniteQuery-BAc_4HO5.js";const Be=()=>e.jsxs(g,{to:"/astra-for-robotics",className:"task-featured-collection","aria-label":"Featured collection: GPT-6 Astra for Robotics",children:[e.jsx("span",{className:"task-featured-collection-eyebrow",children:"Featured collection"}),e.jsx("strong",{children:"GPT-6 Astra for Robotics"}),e.jsx("span",{className:"task-featured-collection-description",children:"Papers and demos that put GPT-6 Astra in control of real and simulated robots, as the policy itself or as an agent orchestrating the stack."}),e.jsxs("span",{className:"task-featured-collection-meta",children:["Explore the collection",e.jsx(L,{size:14,"aria-hidden":"true"})]})]}),W=n=>{const c=n.match(/\(([^()]*)\)\s*$/);return c?c[1].split(",").map(d=>d.trim()).filter(Boolean):[]};function Me(n,c){const d=W(n);if(c===void 0)return"standard";const i=new Set(W(c).map(l=>l.toLowerCase())),m=d.filter(l=>!i.has(l.toLowerCase()));return m.length?m.join(", "):n}function Ce(n,c){const d=new Map(n.map(l=>[l.id,l])),i=l=>{const x=new Set([l.id]);let k=l;for(;;){const w=c(k),_=w?d.get(w):void 0;if(!_)return k.id;if(x.has(_.id))return l.id;x.add(_.id),k=_}},m=new Map;return n.forEach(l=>{const x=i(l);m.set(x,[...m.get(x)||[],l])}),[...m].map(([l,x])=>({key:l,members:[d.get(l),...x.filter(k=>k.id!==l)]}))}const R=3,Fe=[{slug:"healthcare",eyebrow:"Clinical systems",title:"Clinical AI & Healthcare",description:"Agents, clinical workflows, medical calculators, safety, and decision support.",href:"#benchmarks"},{slug:"medical-question-answering",eyebrow:"Language & reasoning",title:"Medical Question Answering",description:"Medical exams, biomedical evidence, clinical comprehension, and explanations.",href:"/tasks/medical-question-answering"},{slug:"medical-imaging",eyebrow:"Vision",title:"Medical Imaging",description:"Radiology, pathology, ophthalmology, ultrasound, and diagnostic imaging.",href:"/tasks/medical-imaging"},{slug:"medical-visual-question-answering",eyebrow:"Multimodal",title:"Medical Visual Question Answering",description:"Questions grounded in radiology, pathology, and other biomedical images.",href:"/tasks/medical-visual-question-answering"}],Ae=({frameworks:n})=>n.length===0?null:e.jsxs("div",{className:"task-framework-links",children:[e.jsx("span",{className:"task-framework-links-label",children:"Recommended frameworks"}),n.map(c=>e.jsxs(g,{to:`/papers?framework=${encodeURIComponent(c.framework_slug)}`,className:"task-framework-link",children:[e.jsx("span",{children:c.framework_name}),e.jsxs("span",{className:"task-framework-link-stars",children:["★ ",fe(c.num_stars)]})]},c.framework_id))]}),Pe=({task:n,area:c,parents:d})=>e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(g,{to:"/tasks",children:"Tasks"}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(g,{to:`/tasks#area-${Ne(c.name)}`,children:c.name})]}),[...d].reverse().map(i=>e.jsxs(ce.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(g,{to:`/tasks/${i.slug||i.id}`,children:N(i.name,i.slug)})]},i.id)),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--accent-text)"},children:N(n.name,n.slug)})]}),Re=({task:n,relatedTasks:c})=>{const d=new Map([n,...c].map(i=>[i.slug,i]));return e.jsxs("section",{className:"medical-ai-hub","aria-labelledby":"medical-ai-hub-title",children:[e.jsxs("div",{className:"medical-ai-hub-heading",children:[e.jsx("span",{children:"Medical AI directory"}),e.jsx("h2",{id:"medical-ai-hub-title",children:"Explore Healthcare & Medical AI"}),e.jsx("p",{children:"Browse the field by clinical application, language, vision, or multimodal reasoning."})]}),e.jsx("div",{className:"medical-ai-hub-grid",children:Fe.map(i=>{const m=d.get(i.slug),l=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"medical-ai-hub-card-eyebrow",children:i.eyebrow}),e.jsx("strong",{children:i.title}),e.jsx("span",{className:"medical-ai-hub-card-description",children:i.description}),e.jsxs("span",{className:"medical-ai-hub-card-meta",children:[(m==null?void 0:m.paper_count)!=null?`${m.paper_count.toLocaleString()} papers`:"Explore task",e.jsx(L,{size:14,"aria-hidden":"true"})]})]});return i.slug==="healthcare"?e.jsx("a",{href:i.href,className:"medical-ai-hub-card",children:l},i.slug):e.jsx(g,{to:i.href,className:"medical-ai-hub-card",children:l},i.slug)})})]})},Le=n=>[...n].sort((c,d)=>{const i=c.slug==="classic-language-modeling",m=d.slug==="classic-language-modeling";return i!==m?i?1:-1:0}),ws=()=>{var z,V,G;const{taskSlug:n}=le(),c=oe(),d=ue(),{searchParams:i}=d,[m,l]=j.useState(!1),[x,k]=j.useState({}),[w,_]=j.useState(()=>new Set),{preferences:Z}=de(),T=(s,a)=>{const t=s||"";return a?`/benchmark/${t}?task=${encodeURIComponent(a)}`:`/benchmark/${t}`},v=Z.hide_closed_source_evals?!0:void 0,h=U({queryKey:["task-page",n,v],queryFn:()=>O.taskPage(n,{is_open:v}),enabled:!!n,staleTime:10*60*1e3});j.useEffect(()=>{var t;const s=(t=h.data)==null?void 0:t.task.slug;if(!n||!s||s===n)return;const a=i.toString();c(`/tasks/${s}${a?`?${a}`:""}`,{replace:!0})},[c,(z=h.data)==null?void 0:z.task.slug,i,n]);const I=U({queryKey:["task-benchmark-trends",n,v],queryFn:()=>O.trendingBenchmarks(n,{limit:100,min_recent_papers:0,is_open:v}),enabled:!!n,staleTime:10*60*1e3}),y=j.useMemo(()=>{var s;return Le(((s=h.data)==null?void 0:s.children)||[])},[h.data]),$=j.useMemo(()=>{var a;const s=new Map;return(((a=h.data)==null?void 0:a.subtask_benchmarks)||[]).forEach(t=>{s.set(t.subtask_id,t.benchmarks||[])}),s},[h.data]),f=ve([...je.feeds.task,n,d.filters],s=>ke.forTask(n,{...d.filters,page:s,page_size:20,repository_limit:1}),{enabled:!!n}),J=j.useMemo(()=>{var s;return((s=f.data)==null?void 0:s.pages.flatMap(a=>a.results.map(we)))??[]},[f.data]),B=j.useMemo(()=>{var a;const s={};return(a=f.data)==null||a.pages.forEach(t=>t.results.forEach(b=>(b.methods||[]).forEach(u=>{const r=u.slug||u.id;s[r]||(s[r]={id:u.id,name:u.name,slug:u.slug||"",count:0}),s[r].count++}))),Object.values(s).sort((t,b)=>b.count-t.count).slice(0,8)},[f.data]);if(h.isLoading)return e.jsxs("div",{className:"page",children:[e.jsx(P,{className:"h-12 w-1/2 mb-4"}),e.jsx(P,{className:"h-6 w-1/3 mb-8"}),e.jsx(P,{className:"h-64 w-full"})]});if(_e(h.error))return e.jsx(Ee,{});if(h.error||!h.data)return e.jsx("div",{className:"page",children:e.jsx(ye,{variant:"destructive",children:e.jsx(Se,{children:"Task not found."})})});const o=h.data.task,X=h.data.parents||[],M=N(o.name,o.slug),C=(h.data.sisters||[]).filter(s=>s.id!==o.id),Y=h.data.recommended_frameworks||[],S=h.data.benchmarks||[],q=new Map(S.map(s=>[s.id,s])),ee=new Set(S.map(s=>s.id)),H=(((V=I.data)==null?void 0:V.results)||[]).filter(s=>ee.has(s.id)).map(s=>{const a=q.get(s.id);return{...s,best_model_name:(a==null?void 0:a.best_model_name)??s.best_model_name,best_paper_route:a==null?void 0:a.best_paper_route,best_paper_title:a==null?void 0:a.best_paper_title,best_code_url:a==null?void 0:a.best_code_url}}),F=H.length?H:S.map(s=>({id:s.id,name:s.name,slug:s.slug,full_name:s.full_name,recent_paper_count:0,baseline_paper_count:0,all_time_paper_count:s.paper_count||0,trend_score:0,support_weighted_score:0,rate_change:null,latest_reported_on:null,best_model_name:s.best_model_name,best_paper_route:s.best_paper_route,best_paper_title:s.best_paper_title,best_code_url:s.best_code_url,history:[]})),E=Ce(F,s=>{var a;return(a=q.get(s.id))==null?void 0:a.parent_dataset_id}),se=m?E:E.slice(0,5),ae=E.slice(5).reduce((s,a)=>s+a.members.length,0),D=((G=I.data)==null?void 0:G.recent_days)||90,re=y.some(s=>($.get(s.id)||[]).length>0),ne=y.length>0,Q=F.length>0,te=(()=>{const s=new Set;return S.forEach(a=>s.add(a.id)),$.forEach(a=>a.forEach(t=>s.add(t.id))),s.size})(),ie=s=>{_(a=>{const t=new Set(a);return t.has(s)?t.delete(s):t.add(s),t})};return e.jsxs("div",{className:"page",children:[e.jsx(Pe,{task:o,area:h.data.area,parents:X}),e.jsxs("div",{className:o.image_url?`task-hero-grid${o.slug==="auto-research"?" task-hero-grid--wide":""}`:void 0,children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:"TASK"}),e.jsx("h1",{className:"domain-mega-title",children:M}),e.jsx(he,{kind:"task",entityId:o.id}),o.description&&e.jsx(K,{className:"task-explainer",text:o.description}),e.jsxs("div",{className:"task-quickstats",children:[e.jsxs("span",{children:[e.jsx("span",{className:"num",children:(o.paper_count??0).toLocaleString()}),"PAPERS"]}),e.jsxs("span",{children:[e.jsx("span",{className:"num",children:te}),"BENCHMARKS"]}),e.jsxs("span",{children:[e.jsxs("span",{className:"num",children:[B.length,"+"]}),"METHODS USED"]})]}),e.jsx(Ae,{frameworks:Y})]}),o.image_url&&e.jsxs("figure",{className:`task-figure-card${o.slug==="omni-models"?" task-figure-card--compact":""}`,children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:me(o.image_url)??void 0,alt:`${M} schematic`,onError:s=>{var a,t;(t=(a=s.currentTarget.parentElement)==null?void 0:a.parentElement)==null||t.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",M,o.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(K,{className:"task-image-credit",text:o.image_credit})]})]})]})]}),o.slug==="healthcare"&&e.jsx(Re,{task:o,relatedTasks:C}),o.slug==="robotics"&&e.jsx(Be,{}),e.jsxs("div",{className:"task-page-grid",style:{marginTop:28},children:[e.jsxs("div",{children:[Q&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"task-section-head",id:"benchmarks",children:[e.jsxs("div",{className:"task-section-eyebrow",children:[D,"-day reporting activity · select a benchmark"]}),e.jsxs("div",{className:"task-section-title",children:["Benchmarks ",e.jsxs("span",{className:"meta",children:["[",F.length,"]"]})]})]}),e.jsxs("div",{className:"benchmark-trend-table",role:"table","aria-label":"Trending benchmarks",children:[e.jsxs("div",{className:"benchmark-trend-head",role:"row",children:[e.jsx("span",{role:"columnheader",children:"Trend"}),e.jsx("span",{role:"columnheader",children:"Benchmark"}),e.jsx("span",{role:"columnheader",children:"Best model"}),e.jsx("span",{role:"columnheader",children:"Paper title"}),e.jsx("span",{role:"columnheader",children:"Code"}),e.jsx("span",{role:"columnheader",children:"Compare"})]}),se.map(({key:s,members:a})=>{const t=a[0],b=p=>p===t?"standard":Me(p.name,t.name),u=[t,...a.slice(1).sort((p,A)=>b(p).localeCompare(b(A),void 0,{sensitivity:"base"}))],r=u.find(p=>p.id===x[s])??t;return e.jsxs("div",{className:"benchmark-trend-row",role:"row",children:[e.jsxs("div",{className:"benchmark-trend-cell",role:"cell",children:[e.jsx(xe,{history:r.history,benchmarkName:r.name}),e.jsxs("div",{className:"benchmark-trend-meta",children:[e.jsxs("span",{children:[e.jsx("strong",{children:r.recent_paper_count})," ",r.recent_paper_count===1?"paper":"papers"," /"," ",D,"d"]}),r.rate_change==null?r.recent_paper_count>0&&e.jsx("span",{className:"benchmark-trend-change is-new",children:"new"}):e.jsxs("span",{className:`benchmark-trend-change ${r.rate_change>=1?"is-up":"is-down"}`,children:[r.rate_change>=1?"↑":"↓"," ",r.rate_change.toFixed(1),"×"]})]})]}),e.jsxs("div",{className:"benchmark-trend-benchmark",role:"cell",children:[e.jsx(g,{className:"bench-row-name",to:T(r.slug||r.id,n),children:r.name}),u.length>1&&e.jsx("div",{className:"bench-row-variants",role:"group","aria-label":`Evaluation protocols for ${t.name}`,children:u.map(p=>e.jsx("button",{type:"button",className:"bench-row-variant","aria-pressed":p.id===r.id,title:p.name,onClick:()=>k(A=>({...A,[s]:p.id})),children:b(p)},p.id))}),e.jsx("div",{className:"bench-row-sub",children:e.jsxs("span",{children:[e.jsx("strong",{children:r.all_time_paper_count})," reporting papers"]})})]}),e.jsx("div",{className:"bench-row-best",role:"cell",children:r.best_model_name?e.jsxs(e.Fragment,{children:[e.jsx(Te,{size:13,className:"bench-row-best-icon"}),e.jsx("span",{className:"bench-row-best-name",children:r.best_model_name})]}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-paper",role:"cell",children:r.best_paper_route&&r.best_paper_title?e.jsx(g,{to:`/paper/${encodeURIComponent(r.best_paper_route)}`,children:r.best_paper_title}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-code",role:"cell",children:r.best_code_url?e.jsx("a",{href:r.best_code_url,target:"_blank",rel:"noopener noreferrer","aria-label":`Code for ${r.best_paper_title||r.best_model_name}`,children:e.jsx($e,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-compare",role:"cell",children:e.jsxs(g,{to:T(r.slug||r.id,n),"aria-label":`Compare ${r.best_model_name||"the best model"} with all results on ${r.name}`,children:[e.jsx("span",{children:"See all"}),e.jsx(L,{size:11,strokeWidth:2,"aria-hidden":"true"})]})})]},s)})]}),E.length>5&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>l(s=>!s),children:m?"− show top 5":`+ show ${ae} more benchmarks`})]}),ne&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"task-section-head",style:Q?{marginTop:36}:void 0,children:[e.jsx("div",{className:"task-section-eyebrow",children:re?"Benchmarks by capability":"Task hierarchy"}),e.jsxs("div",{className:"task-section-title",children:["Subtasks ",e.jsxs("span",{className:"meta",children:["[",y.length,"]"]})]})]}),e.jsx("div",{className:"subtask-grid",children:y.map(s=>{const a=$.get(s.id)||[],t=w.has(s.id),b=t?a:a.slice(0,R),u=a.length-R;return e.jsxs("div",{className:"subtask-section",children:[e.jsxs("div",{className:"subtask-head",children:[e.jsx(g,{to:`/tasks/${s.slug||s.id}`,className:"subtask-head-name",children:N(s.name,s.slug)}),e.jsx("span",{className:"subtask-head-meta",children:a.length>0?`[${a.length} benchmark${a.length===1?"":"s"}]`:`[${(s.paper_count??0).toLocaleString()} papers]`})]}),b.length>0?b.map((r,p)=>e.jsxs("div",{className:"bench-row",onClick:()=>c(T(r.slug||r.id,s.slug||s.id)),children:[e.jsx("div",{className:"bench-row-num",children:String(p+1).padStart(2,"0")}),e.jsxs("div",{className:"bench-row-main",children:[e.jsx("div",{className:"bench-row-name",children:r.name}),e.jsx("div",{className:"bench-row-sub",children:r.paper_count!=null&&e.jsxs("span",{children:[e.jsx("strong",{children:r.paper_count})," ENTRIES"]})})]}),e.jsx("div",{className:"bench-row-arrow",children:"→"})]},r.id)):e.jsxs(g,{to:`/tasks/${s.slug||s.id}`,className:"subtask-summary",children:[e.jsxs("span",{children:[(s.paper_count??0).toLocaleString()," papers"]}),s.description&&e.jsx("span",{className:"subtask-summary-desc",children:s.description})]}),u>0&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>ie(s.id),children:t?`− show top ${R}`:`+ show ${u} more benchmark${u===1?"":"s"}`})]},s.id)})})]}),e.jsxs("div",{className:"task-section-head",style:{marginTop:36},children:[e.jsx("div",{className:"task-section-eyebrow",children:"Top trending · sort below"}),e.jsxs("div",{className:"task-section-title",children:["Papers ",e.jsxs("span",{className:"meta",children:["[",(o.paper_count??0).toLocaleString(),"]"]})]})]}),e.jsx(ge,{feed:d}),e.jsx(be,{query:f,cards:J,empty:"No papers in this task yet."})]}),e.jsxs("aside",{className:"task-side",children:[C.length>0&&o.slug!=="healthcare"&&e.jsxs("div",{className:"side-block",children:[e.jsx("div",{className:"side-block-num",children:"01/"}),e.jsx("div",{className:"side-block-label",children:"Sister Tasks"}),C.slice(0,8).map(s=>e.jsxs(g,{to:`/tasks/${s.slug||s.id}`,className:"side-link-row",children:[e.jsx("span",{children:N(s.name,s.slug)}),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count.toLocaleString()})]},s.id))]}),B.length>0&&e.jsxs("div",{className:"side-block",children:[e.jsx("div",{className:"side-block-num",children:"02/"}),e.jsx("div",{className:"side-block-label",children:"Common Methods"}),B.map(s=>e.jsxs("div",{className:"side-method-row",children:[e.jsx(pe,{method:{slug:s.slug,name:s.name}}),e.jsxs("span",{className:"num",children:["·",s.count]})]},s.id))]})]})]})]})};export{Re as HealthcareMedicalAiHub,Ae as RecommendedFrameworkLinks,Pe as TaskBreadcrumb,ws as default}; diff --git a/assets/TagBrowseView-DKVo9Mlp.js b/assets/TagBrowseView-DKVo9Mlp.js new file mode 100644 index 0000000000000000000000000000000000000000..8b510a7a3e75d48345fe4e67216f1348e6ff9ee2 --- /dev/null +++ b/assets/TagBrowseView-DKVo9Mlp.js @@ -0,0 +1 @@ +import{j as e,L as g,V as oe,u as de,e as me,d as j,b as G,p as he,a3 as pe,o as K,T as O}from"./index-DyXq7-Tg.js";import{R as ue}from"./ResearchFollowButton-Dv316ClR.js";import{M as ge}from"./SotaBadges-vbLLOUtT.js";import{u as be,b as xe,a as je}from"./PaperFeed-EBt97iOL.js";import{A as L}from"./arrow-right-BzPanrWZ.js";import{B as ke}from"./BenchmarkTrendSparkline-DhXxdQ2D.js";import{M as W}from"./MarkdownText-CUzPoC9Y.js";import{c as J}from"./catalog-CRar2olQ.js";import{p as _e}from"./papers-Dh3ljlL0.js";import{i as Ne}from"./apiErrors-BSvbQBb0.js";import{f as fe}from"./frameworks-DDA0P4Tf.js";import{u as we}from"./preferences-COzeOLyS.js";import{s as ve}from"./slug-BpH-Nkvz.js";import{d as f,t as ye}from"./transform-D46m70Qr.js";import{u as Se}from"./usePapers-B0s20UcU.js";import{S as P}from"./skeleton-C3IIzpSL.js";import{A as Te,a as Ee}from"./alert-gbJBhAVE.js";import Be from"./NotFound-DV_nwcxG.js";import{T as $e}from"./trophy-BtgLmZ39.js";import{G as Me}from"./github-RNrgGHRT.js";import"./researchTopic-DbX0eko-.js";import"./useMutation-UWxBeqtn.js";import"./plus-Yh42pKZz.js";import"./colors-BkWRhvFI.js";import"./PaperCard-57p1OSGy.js";import"./AuthorAvatar-B-9xS2Wo.js";import"./Icon-T4LYkEQj.js";import"./LatexTitle-Bkyz3jCs.js";import"./safeExternalHref-CkBrsh84.js";import"./popover-CTBEUp7Y.js";import"./useIntersectionObserver-D6_Iig9a.js";/* empty css */import"./PaperPreviewLink-CpCZSa8K.js";import"./index-mCi_y_l3.js";import"./index-2CvJmBVB.js";import"./katex-DkKDou_j.js";import"./hover-card-B45EJIn_.js";import"./curation-YeS7FBYf.js";import"./account-cbblajck.js";import"./useInfiniteQuery-BYh2zN-T.js";const Ce=()=>e.jsxs(g,{to:"/astra-for-robotics",className:"task-featured-collection","aria-label":"Featured collection: GPT-6 Astra for Robotics",children:[e.jsx("span",{className:"task-featured-collection-eyebrow",children:"Featured collection"}),e.jsx("strong",{children:"GPT-6 Astra for Robotics"}),e.jsx("span",{className:"task-featured-collection-description",children:"Papers and demos that put GPT-6 Astra in control of real and simulated robots, as the policy itself or as an agent orchestrating the stack."}),e.jsxs("span",{className:"task-featured-collection-meta",children:["Explore the collection",e.jsx(L,{size:14,"aria-hidden":"true"})]})]}),X=n=>{const c=n.match(/\(([^()]*)\)\s*$/);return c?c[1].split(",").map(d=>d.trim()).filter(Boolean):[]};function Fe(n,c){const d=X(n);if(c===void 0)return"standard";const i=new Set(X(c).map(l=>l.toLowerCase())),m=d.filter(l=>!i.has(l.toLowerCase()));return m.length?m.join(", "):n}function Ae(n,c){const d=new Map(n.map(l=>[l.id,l])),i=l=>{const x=new Set([l.id]);let k=l;for(;;){const w=c(k),_=w?d.get(w):void 0;if(!_)return k.id;if(x.has(_.id))return l.id;x.add(_.id),k=_}},m=new Map;return n.forEach(l=>{const x=i(l);m.set(x,[...m.get(x)||[],l])}),[...m].map(([l,x])=>({key:l,members:[d.get(l),...x.filter(k=>k.id!==l)]}))}const R=3,Pe=[{slug:"healthcare",eyebrow:"Clinical systems",title:"Clinical AI & Healthcare",description:"Agents, clinical workflows, medical calculators, safety, and decision support.",href:"#benchmarks"},{slug:"medical-question-answering",eyebrow:"Language & reasoning",title:"Medical Question Answering",description:"Medical exams, biomedical evidence, clinical comprehension, and explanations.",href:"/tasks/medical-question-answering"},{slug:"medical-imaging",eyebrow:"Vision",title:"Medical Imaging",description:"Radiology, pathology, ophthalmology, ultrasound, and diagnostic imaging.",href:"/tasks/medical-imaging"},{slug:"medical-visual-question-answering",eyebrow:"Multimodal",title:"Medical Visual Question Answering",description:"Questions grounded in radiology, pathology, and other biomedical images.",href:"/tasks/medical-visual-question-answering"}],Re=({frameworks:n})=>n.length===0?null:e.jsxs("div",{className:"task-framework-links",children:[e.jsx("span",{className:"task-framework-links-label",children:"Recommended frameworks"}),n.map(c=>e.jsxs(g,{to:`/papers?framework=${encodeURIComponent(c.framework_slug)}`,className:"task-framework-link",children:[e.jsx("span",{children:c.framework_name}),e.jsxs("span",{className:"task-framework-link-stars",children:["★ ",fe(c.num_stars)]})]},c.framework_id))]}),Le=({task:n,area:c,parents:d})=>e.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[e.jsx(g,{to:"/tasks",children:"Tasks"}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(g,{to:`/tasks#area-${ve(c.name)}`,children:c.name})]}),[...d].reverse().map(i=>e.jsxs(oe.Fragment,{children:[e.jsx("span",{className:"sep",children:"/"}),e.jsx(g,{to:`/tasks/${i.slug||i.id}`,children:f(i.name,i.slug)})]},i.id)),e.jsx("span",{className:"sep",children:"/"}),e.jsx("span",{style:{color:"var(--accent-text)"},children:f(n.name,n.slug)})]}),Ie=({task:n,relatedTasks:c})=>{const d=new Map([n,...c].map(i=>[i.slug,i]));return e.jsxs("section",{className:"medical-ai-hub","aria-labelledby":"medical-ai-hub-title",children:[e.jsxs("div",{className:"medical-ai-hub-heading",children:[e.jsx("span",{children:"Medical AI directory"}),e.jsx("h2",{id:"medical-ai-hub-title",children:"Explore Healthcare & Medical AI"}),e.jsx("p",{children:"Browse the field by clinical application, language, vision, or multimodal reasoning."})]}),e.jsx("div",{className:"medical-ai-hub-grid",children:Pe.map(i=>{const m=d.get(i.slug),l=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"medical-ai-hub-card-eyebrow",children:i.eyebrow}),e.jsx("strong",{children:i.title}),e.jsx("span",{className:"medical-ai-hub-card-description",children:i.description}),e.jsxs("span",{className:"medical-ai-hub-card-meta",children:[(m==null?void 0:m.paper_count)!=null?`${m.paper_count.toLocaleString()} papers`:"Explore task",e.jsx(L,{size:14,"aria-hidden":"true"})]})]});return i.slug==="healthcare"?e.jsx("a",{href:i.href,className:"medical-ai-hub-card",children:l},i.slug):e.jsx(g,{to:i.href,className:"medical-ai-hub-card",children:l},i.slug)})})]})},qe=n=>[...n].sort((c,d)=>{const i=c.slug==="classic-language-modeling",m=d.slug==="classic-language-modeling";return i!==m?i?1:-1:0}),Ss=()=>{var V,z,U;const{taskSlug:n}=de(),c=me(),d=be(),{searchParams:i}=d,[m,l]=j.useState(!1),[x,k]=j.useState({}),[w,_]=j.useState(()=>new Set),{preferences:Y}=we(),E=(s,a)=>{const t=s||"";return a?`/benchmark/${t}?task=${encodeURIComponent(a)}`:`/benchmark/${t}`},v=Y.hide_closed_source_evals?!0:void 0,h=G({queryKey:[...K.taskPage,n,v],queryFn:()=>J.taskPage(n,{is_open:v}),enabled:!!n,staleTime:O});j.useEffect(()=>{var t;const s=(t=h.data)==null?void 0:t.task.slug;if(!n||!s||s===n)return;const a=i.toString();c(`/tasks/${s}${a?`?${a}`:""}`,{replace:!0})},[c,(V=h.data)==null?void 0:V.task.slug,i,n]);const I=G({queryKey:[...K.taskBenchmarkTrends,n,v],queryFn:()=>J.trendingBenchmarks(n,{limit:100,min_recent_papers:0,is_open:v}),enabled:!!n,staleTime:O}),y=j.useMemo(()=>{var s;return qe(((s=h.data)==null?void 0:s.children)||[])},[h.data]),B=j.useMemo(()=>{var a;const s=new Map;return(((a=h.data)==null?void 0:a.subtask_benchmarks)||[]).forEach(t=>{s.set(t.subtask_id,t.benchmarks||[])}),s},[h.data]),N=Se([...he.feeds.task,n,d.filters],s=>_e.forTask(n,{...d.filters,page:s,page_size:20,repository_limit:1}),{enabled:!!n}),Z=j.useMemo(()=>{var s;return((s=N.data)==null?void 0:s.pages.flatMap(a=>a.results.map(ye)))??[]},[N.data]),$=j.useMemo(()=>{var a;const s={};return(a=N.data)==null||a.pages.forEach(t=>t.results.forEach(b=>(b.methods||[]).forEach(u=>{const r=u.slug||u.id;s[r]||(s[r]={id:u.id,name:u.name,slug:u.slug||"",count:0}),s[r].count++}))),Object.values(s).sort((t,b)=>b.count-t.count).slice(0,8)},[N.data]);if(h.isLoading)return e.jsxs("div",{className:"page",children:[e.jsx(P,{className:"h-12 w-1/2 mb-4"}),e.jsx(P,{className:"h-6 w-1/3 mb-8"}),e.jsx(P,{className:"h-64 w-full"})]});if(Ne(h.error))return e.jsx(Be,{});if(h.error||!h.data)return e.jsx("div",{className:"page",children:e.jsx(Te,{variant:"destructive",children:e.jsx(Ee,{children:"Task not found."})})});const o=h.data.task,ee=h.data.parents||[],M=f(o.name,o.slug),C=(h.data.sisters||[]).filter(s=>s.id!==o.id),se=h.data.recommended_frameworks||[],S=h.data.benchmarks||[],q=new Map(S.map(s=>[s.id,s])),ae=new Set(S.map(s=>s.id)),H=(((z=I.data)==null?void 0:z.results)||[]).filter(s=>ae.has(s.id)).map(s=>{const a=q.get(s.id);return{...s,best_model_name:(a==null?void 0:a.best_model_name)??s.best_model_name,best_paper_route:a==null?void 0:a.best_paper_route,best_paper_title:a==null?void 0:a.best_paper_title,best_code_url:a==null?void 0:a.best_code_url}}),F=H.length?H:S.map(s=>({id:s.id,name:s.name,slug:s.slug,full_name:s.full_name,recent_paper_count:0,baseline_paper_count:0,all_time_paper_count:s.paper_count||0,trend_score:0,support_weighted_score:0,rate_change:null,latest_reported_on:null,best_model_name:s.best_model_name,best_paper_route:s.best_paper_route,best_paper_title:s.best_paper_title,best_code_url:s.best_code_url,history:[]})),T=Ae(F,s=>{var a;return(a=q.get(s.id))==null?void 0:a.parent_dataset_id}),re=m?T:T.slice(0,5),ne=T.slice(5).reduce((s,a)=>s+a.members.length,0),Q=((U=I.data)==null?void 0:U.recent_days)||90,te=y.some(s=>(B.get(s.id)||[]).length>0),ie=y.length>0,D=F.length>0,ce=(()=>{const s=new Set;return S.forEach(a=>s.add(a.id)),B.forEach(a=>a.forEach(t=>s.add(t.id))),s.size})(),le=s=>{_(a=>{const t=new Set(a);return t.has(s)?t.delete(s):t.add(s),t})};return e.jsxs("div",{className:"page",children:[e.jsx(Le,{task:o,area:h.data.area,parents:ee}),e.jsxs("div",{className:o.image_url?`task-hero-grid${o.slug==="auto-research"?" task-hero-grid--wide":""}`:void 0,children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:"var(--mono)",fontSize:11,color:"var(--accent-text)",letterSpacing:"0.1em",marginBottom:8},children:"TASK"}),e.jsx("h1",{className:"domain-mega-title",children:M}),e.jsx(ue,{kind:"task",entityId:o.id}),o.description&&e.jsx(W,{className:"task-explainer",text:o.description}),e.jsxs("div",{className:"task-quickstats",children:[e.jsxs("span",{children:[e.jsx("span",{className:"num",children:(o.paper_count??0).toLocaleString()}),"PAPERS"]}),e.jsxs("span",{children:[e.jsx("span",{className:"num",children:ce}),"BENCHMARKS"]}),e.jsxs("span",{children:[e.jsxs("span",{className:"num",children:[$.length,"+"]}),"METHODS USED"]})]}),e.jsx(Re,{frameworks:se})]}),o.image_url&&e.jsxs("figure",{className:`task-figure-card${o.slug==="omni-models"?" task-figure-card--compact":""}`,children:[e.jsx("div",{className:"task-figure-img-wrap",children:e.jsx("img",{className:"task-figure-img",src:pe(o.image_url)??void 0,alt:`${M} schematic`,onError:s=>{var a,t;(t=(a=s.currentTarget.parentElement)==null?void 0:a.parentElement)==null||t.style.setProperty("display","none")}})}),e.jsxs("figcaption",{children:["Figure · ",M,o.image_credit&&e.jsxs(e.Fragment,{children:[e.jsx("br",{}),e.jsx(W,{className:"task-image-credit",text:o.image_credit})]})]})]})]}),o.slug==="healthcare"&&e.jsx(Ie,{task:o,relatedTasks:C}),o.slug==="robotics"&&e.jsx(Ce,{}),e.jsxs("div",{className:"task-page-grid",style:{marginTop:28},children:[e.jsxs("div",{children:[D&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"task-section-head",id:"benchmarks",children:[e.jsxs("div",{className:"task-section-eyebrow",children:[Q,"-day reporting activity · select a benchmark"]}),e.jsxs("div",{className:"task-section-title",children:["Benchmarks ",e.jsxs("span",{className:"meta",children:["[",F.length,"]"]})]})]}),e.jsxs("div",{className:"benchmark-trend-table",role:"table","aria-label":"Trending benchmarks",children:[e.jsxs("div",{className:"benchmark-trend-head",role:"row",children:[e.jsx("span",{role:"columnheader",children:"Trend"}),e.jsx("span",{role:"columnheader",children:"Benchmark"}),e.jsx("span",{role:"columnheader",children:"Best model"}),e.jsx("span",{role:"columnheader",children:"Paper title"}),e.jsx("span",{role:"columnheader",children:"Code"}),e.jsx("span",{role:"columnheader",children:"Compare"})]}),re.map(({key:s,members:a})=>{const t=a[0],b=p=>p===t?"standard":Fe(p.name,t.name),u=[t,...a.slice(1).sort((p,A)=>b(p).localeCompare(b(A),void 0,{sensitivity:"base"}))],r=u.find(p=>p.id===x[s])??t;return e.jsxs("div",{className:"benchmark-trend-row",role:"row",children:[e.jsxs("div",{className:"benchmark-trend-cell",role:"cell",children:[e.jsx(ke,{history:r.history,benchmarkName:r.name}),e.jsxs("div",{className:"benchmark-trend-meta",children:[e.jsxs("span",{children:[e.jsx("strong",{children:r.recent_paper_count})," ",r.recent_paper_count===1?"paper":"papers"," /"," ",Q,"d"]}),r.rate_change==null?r.recent_paper_count>0&&e.jsx("span",{className:"benchmark-trend-change is-new",children:"new"}):e.jsxs("span",{className:`benchmark-trend-change ${r.rate_change>=1?"is-up":"is-down"}`,children:[r.rate_change>=1?"↑":"↓"," ",r.rate_change.toFixed(1),"×"]})]})]}),e.jsxs("div",{className:"benchmark-trend-benchmark",role:"cell",children:[e.jsx(g,{className:"bench-row-name",to:E(r.slug||r.id,n),children:r.name}),u.length>1&&e.jsx("div",{className:"bench-row-variants",role:"group","aria-label":`Evaluation protocols for ${t.name}`,children:u.map(p=>e.jsx("button",{type:"button",className:"bench-row-variant","aria-pressed":p.id===r.id,title:p.name,onClick:()=>k(A=>({...A,[s]:p.id})),children:b(p)},p.id))}),e.jsx("div",{className:"bench-row-sub",children:e.jsxs("span",{children:[e.jsx("strong",{children:r.all_time_paper_count})," reporting papers"]})})]}),e.jsx("div",{className:"bench-row-best",role:"cell",children:r.best_model_name?e.jsxs(e.Fragment,{children:[e.jsx($e,{size:13,className:"bench-row-best-icon"}),e.jsx("span",{className:"bench-row-best-name",children:r.best_model_name})]}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-paper",role:"cell",children:r.best_paper_route&&r.best_paper_title?e.jsx(g,{to:`/paper/${encodeURIComponent(r.best_paper_route)}`,children:r.best_paper_title}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-code",role:"cell",children:r.best_code_url?e.jsx("a",{href:r.best_code_url,target:"_blank",rel:"noopener noreferrer","aria-label":`Code for ${r.best_paper_title||r.best_model_name}`,children:e.jsx(Me,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}):e.jsx("span",{className:"bench-row-best-empty",children:"—"})}),e.jsx("div",{className:"bench-row-compare",role:"cell",children:e.jsxs(g,{to:E(r.slug||r.id,n),"aria-label":`Compare ${r.best_model_name||"the best model"} with all results on ${r.name}`,children:[e.jsx("span",{children:"See all"}),e.jsx(L,{size:11,strokeWidth:2,"aria-hidden":"true"})]})})]},s)})]}),T.length>5&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>l(s=>!s),children:m?"− show top 5":`+ show ${ne} more benchmarks`})]}),ie&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"task-section-head",style:D?{marginTop:36}:void 0,children:[e.jsx("div",{className:"task-section-eyebrow",children:te?"Benchmarks by capability":"Task hierarchy"}),e.jsxs("div",{className:"task-section-title",children:["Subtasks ",e.jsxs("span",{className:"meta",children:["[",y.length,"]"]})]})]}),e.jsx("div",{className:"subtask-grid",children:y.map(s=>{const a=B.get(s.id)||[],t=w.has(s.id),b=t?a:a.slice(0,R),u=a.length-R;return e.jsxs("div",{className:"subtask-section",children:[e.jsxs("div",{className:"subtask-head",children:[e.jsx(g,{to:`/tasks/${s.slug||s.id}`,className:"subtask-head-name",children:f(s.name,s.slug)}),e.jsx("span",{className:"subtask-head-meta",children:a.length>0?`[${a.length} benchmark${a.length===1?"":"s"}]`:`[${(s.paper_count??0).toLocaleString()} papers]`})]}),b.length>0?b.map((r,p)=>e.jsxs("div",{className:"bench-row",onClick:()=>c(E(r.slug||r.id,s.slug||s.id)),children:[e.jsx("div",{className:"bench-row-num",children:String(p+1).padStart(2,"0")}),e.jsxs("div",{className:"bench-row-main",children:[e.jsx("div",{className:"bench-row-name",children:r.name}),e.jsx("div",{className:"bench-row-sub",children:r.paper_count!=null&&e.jsxs("span",{children:[e.jsx("strong",{children:r.paper_count})," ENTRIES"]})})]}),e.jsx("div",{className:"bench-row-arrow",children:"→"})]},r.id)):e.jsxs(g,{to:`/tasks/${s.slug||s.id}`,className:"subtask-summary",children:[e.jsxs("span",{children:[(s.paper_count??0).toLocaleString()," papers"]}),s.description&&e.jsx("span",{className:"subtask-summary-desc",children:s.description})]}),u>0&&e.jsx("button",{type:"button",className:"bench-show-more",onClick:()=>le(s.id),children:t?`− show top ${R}`:`+ show ${u} more benchmark${u===1?"":"s"}`})]},s.id)})})]}),e.jsxs("div",{className:"task-section-head",style:{marginTop:36},children:[e.jsx("div",{className:"task-section-eyebrow",children:"Top trending · sort below"}),e.jsxs("div",{className:"task-section-title",children:["Papers ",e.jsxs("span",{className:"meta",children:["[",(o.paper_count??0).toLocaleString(),"]"]})]})]}),e.jsx(xe,{feed:d}),e.jsx(je,{query:N,cards:Z,empty:"No papers in this task yet."})]}),e.jsxs("aside",{className:"task-side",children:[C.length>0&&o.slug!=="healthcare"&&e.jsxs("div",{className:"side-block",children:[e.jsx("div",{className:"side-block-num",children:"01/"}),e.jsx("div",{className:"side-block-label",children:"Sister Tasks"}),C.slice(0,8).map(s=>e.jsxs(g,{to:`/tasks/${s.slug||s.id}`,className:"side-link-row",children:[e.jsx("span",{children:f(s.name,s.slug)}),s.paper_count!=null&&e.jsx("span",{className:"count",children:s.paper_count.toLocaleString()})]},s.id))]}),$.length>0&&e.jsxs("div",{className:"side-block",children:[e.jsx("div",{className:"side-block-num",children:"02/"}),e.jsx("div",{className:"side-block-label",children:"Common Methods"}),$.map(s=>e.jsxs("div",{className:"side-method-row",children:[e.jsx(ge,{method:{slug:s.slug,name:s.name}}),e.jsxs("span",{className:"num",children:["·",s.count]})]},s.id))]})]})]})]})};export{Ie as HealthcareMedicalAiHub,Re as RecommendedFrameworkLinks,Le as TaskBreadcrumb,Ss as default}; diff --git a/assets/TagsIndexView-jyuGT4BB.js b/assets/TagsIndexView-BwVoxBoD.js similarity index 75% rename from assets/TagsIndexView-jyuGT4BB.js rename to assets/TagsIndexView-BwVoxBoD.js index 83f5fcfae62d488a9c90642692028bc4f70ce562..5bb63c740fff15b57549d69930c99f85ba913ae7 100644 --- a/assets/TagsIndexView-jyuGT4BB.js +++ b/assets/TagsIndexView-BwVoxBoD.js @@ -1,234 +1,234 @@ -import{n as e,r as x,j as a,L as q}from"./index-CbgxfyGU.js";import{u as s}from"./useQuery-Bx9s5-D2.js";import{c as p}from"./catalog-DhK7_9-6.js";import{c as g,h as v}from"./colors-BkWRhvFI.js";import{d as u}from"./transform-0Udg2p6b.js";import{s as z}from"./slug-BpH-Nkvz.js";import{S as j}from"./search-CLtAJGOp.js";import{I as L,T as S}from"./triangle-alert-U7T_j3JE.js";import{S as C}from"./share-2-hXe4dX_y.js";import{T as V}from"./trending-up-B3K5RlyX.js";import{M as A}from"./moon-BVv5zopc.js";import{T as H}from"./thumbs-up-CDCzGuPd.js";import{D as T}from"./database-CTvEb5JG.js";import{T as F}from"./trophy-BQwEH3L7.js";import{F as Z}from"./file-text-BK_7Q2rV.js";import{A as B}from"./activity-dcKMRXBy.js";import{G as P}from"./globe-B_laOt9Z.js";import{S as N}from"./sparkles-BqBXJPmy.js";import{A as D,a as G}from"./alert-CFDDvdIM.js";import{A as _,a as E,b as I}from"./AreaSection-NWvfO4Sb.js";import{T as U}from"./TaxonomySuggestionTile-DIw_GKfA.js";import{u as W,T as Q}from"./useHashScrollOnReady-DgB3XFQL.js";import{s as R}from"./areas-Dvi8w2dp.js";import"./skeleton-HwvdxvSN.js";import"./SignInToEditDialog-CNIcNqbK.js";import"./button-Bv9oZ-QU.js";import"./input-B6pxtfPe.js";import"./textarea-Bf06GTSH.js";import"./searchable-select-DNdBIahG.js";import"./popover-DKJYnYjk.js";import"./dialog-Cfp_d3CC.js";import"./loader-circle-CWMja8Zn.js";import"./useMutation-P_trTy9i.js";import"./submissions-aWj7YtuZ.js";import"./plus-UK0TEjgd.js";/** +import{s as e,b as s,d as g,j as a,L as z,o as j,T as p}from"./index-DyXq7-Tg.js";import{c as k}from"./catalog-CRar2olQ.js";import{c as v,h as u}from"./colors-BkWRhvFI.js";import{d as f}from"./transform-D46m70Qr.js";import{s as S}from"./slug-BpH-Nkvz.js";import{S as L}from"./search-8ssWDP68.js";import{I as C,T as V}from"./triangle-alert-uZ3fXFkp.js";import{S as A}from"./share-2-fiavn5SS.js";import{T as H}from"./trending-up-OM6wBVvQ.js";import{M as T}from"./moon-DMVsctTM.js";import{T as F}from"./thumbs-up-CPLlGli7.js";import{D as Z}from"./database-DflzbaZ5.js";import{T as B}from"./trophy-BtgLmZ39.js";import{F as P}from"./file-text-dvKtHbmD.js";import{A as N}from"./activity-S-FQ6Anu.js";import{G as D}from"./globe-BMJtRs4F.js";import{S as E}from"./sparkles-CcIiUzzc.js";import{A as _,a as G}from"./alert-gbJBhAVE.js";import{A as I,a as U,b as W}from"./AreaSection-BxnKzNK0.js";import{T as Q}from"./TaxonomySuggestionTile-jIiLMp4q.js";import{u as R,T as $}from"./useHashScrollOnReady-D5UCCQuT.js";import{s as K}from"./areas-Dvi8w2dp.js";import"./skeleton-C3IIzpSL.js";import"./SignInToEditDialog-B-oWVno5.js";import"./button-DZeAbOf2.js";import"./input-DJqCAbs7.js";import"./textarea-DPixlM5U.js";import"./searchable-select-DiDLwvbI.js";import"./popover-CTBEUp7Y.js";import"./dialog-CfM0Uql2.js";import"./loader-circle-C75KLEgx.js";import"./useMutation-UWxBeqtn.js";import"./submissions-Cz_J-Ha2.js";import"./plus-Yh42pKZz.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $=e("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** + */const O=e("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const K=e("ArrowUpFromDot",[["path",{d:"m5 9 7-7 7 7",key:"1hw5ic"}],["path",{d:"M12 16V2",key:"ywoabb"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** + */const J=e("ArrowUpFromDot",[["path",{d:"m5 9 7-7 7 7",key:"1hw5ic"}],["path",{d:"M12 16V2",key:"ywoabb"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const O=e("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/** + */const X=e("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const J=e("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]);/** + */const Y=e("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const X=e("Axis3d",[["path",{d:"M4 4v16h16",key:"1s015l"}],["path",{d:"m4 20 7-7",key:"17qe9y"}]]);/** + */const e1=e("Axis3d",[["path",{d:"M4 4v16h16",key:"1s015l"}],["path",{d:"m4 20 7-7",key:"17qe9y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Y=e("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const a1=e("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const e1=e("Bandage",[["path",{d:"M10 10.01h.01",key:"1e9xi7"}],["path",{d:"M10 14.01h.01",key:"ac23bv"}],["path",{d:"M14 10.01h.01",key:"2wfrvf"}],["path",{d:"M14 14.01h.01",key:"8tw8yn"}],["path",{d:"M18 6v11.5",key:"dkbidh"}],["path",{d:"M6 6v12",key:"vkc79e"}],["rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",key:"1wpnh2"}]]);/** + */const t1=e("Bandage",[["path",{d:"M10 10.01h.01",key:"1e9xi7"}],["path",{d:"M10 14.01h.01",key:"ac23bv"}],["path",{d:"M14 10.01h.01",key:"2wfrvf"}],["path",{d:"M14 14.01h.01",key:"8tw8yn"}],["path",{d:"M18 6v11.5",key:"dkbidh"}],["path",{d:"M6 6v12",key:"vkc79e"}],["rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",key:"1wpnh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const a1=e("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/** + */const y1=e("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const t1=e("Blend",[["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["circle",{cx:"15",cy:"15",r:"7",key:"19ennj"}]]);/** + */const i1=e("Blend",[["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["circle",{cx:"15",cy:"15",r:"7",key:"19ennj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const y1=e("Bone",[["path",{d:"M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",key:"w610uw"}]]);/** + */const c1=e("Bone",[["path",{d:"M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",key:"w610uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const i1=e("BotMessageSquare",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z",key:"w2lp3e"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M9 11v2",key:"1ueba0"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);/** + */const h1=e("BotMessageSquare",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z",key:"w2lp3e"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M9 11v2",key:"1ueba0"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const c1=e("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + */const n1=e("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const h1=e("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** + */const d1=e("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const n1=e("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + */const r1=e("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const d1=e("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** + */const o1=e("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const r1=e("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + */const s1=e("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const o1=e("Brush",[["path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08",key:"1styjt"}],["path",{d:"M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z",key:"z0l1mu"}]]);/** + */const p1=e("Brush",[["path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08",key:"1styjt"}],["path",{d:"M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z",key:"z0l1mu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const s1=e("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** + */const k1=e("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const p1=e("Captions",[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]]);/** + */const l1=e("Captions",[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const k1=e("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** + */const m1=e("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const l1=e("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/** + */const M1=e("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const m1=e("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const x1=e("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const M1=e("Clapperboard",[["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:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/** + */const g1=e("Clapperboard",[["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:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const x1=e("ContactRound",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M17.915 22a6 6 0 0 0-12 0",key:"suqz9p"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** + */const v1=e("ContactRound",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M17.915 22a6 6 0 0 0-12 0",key:"suqz9p"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const g1=e("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** + */const u1=e("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const v1=e("Cylinder",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5v14a9 3 0 0 0 18 0V5",key:"aqi0yr"}]]);/** + */const f1=e("Cylinder",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5v14a9 3 0 0 0 18 0V5",key:"aqi0yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const u1=e("Diff",[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** + */const w1=e("Diff",[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const f1=e("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);/** + */const b1=e("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const w1=e("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);/** + */const q1=e("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const b1=e("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const z1=e("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const q1=e("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** + */const j1=e("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const z1=e("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const S1=e("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const j1=e("FastForward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]);/** + */const L1=e("FastForward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const L1=e("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);/** + */const C1=e("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const S1=e("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/** + */const V1=e("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const C1=e("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/** + */const A1=e("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const V1=e("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/** + */const H1=e("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const A1=e("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/** + */const T1=e("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const H1=e("Flashlight",[["path",{d:"M18 6c0 2-2 2-2 4v10a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4V2h12z",key:"1orkel"}],["line",{x1:"6",x2:"18",y1:"6",y2:"6",key:"1z11jq"}],["line",{x1:"12",x2:"12",y1:"12",y2:"12",key:"1f4yc1"}]]);/** + */const F1=e("Flashlight",[["path",{d:"M18 6c0 2-2 2-2 4v10a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4V2h12z",key:"1orkel"}],["line",{x1:"6",x2:"18",y1:"6",y2:"6",key:"1z11jq"}],["line",{x1:"12",x2:"12",y1:"12",y2:"12",key:"1f4yc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const T1=e("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** + */const Z1=e("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const F1=e("GalleryHorizontalEnd",[["path",{d:"M2 7v10",key:"a2pl2d"}],["path",{d:"M6 5v14",key:"1kq3d7"}],["rect",{width:"12",height:"18",x:"10",y:"3",rx:"2",key:"13i7bc"}]]);/** + */const B1=e("GalleryHorizontalEnd",[["path",{d:"M2 7v10",key:"a2pl2d"}],["path",{d:"M6 5v14",key:"1kq3d7"}],["rect",{width:"12",height:"18",x:"10",y:"3",rx:"2",key:"13i7bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Z1=e("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/** + */const P1=e("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const B1=e("GitCompareArrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);/** + */const N1=e("GitCompareArrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const P1=e("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/** + */const D1=e("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const N1=e("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** + */const E1=e("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const D1=e("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** + */const _1=e("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. @@ -238,267 +238,267 @@ import{n as e,r as x,j as a,L as q}from"./index-CbgxfyGU.js";import{u as s}from" * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _1=e("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/** + */const I1=e("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const E1=e("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);/** + */const U1=e("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const I1=e("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** + */const W1=e("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const U1=e("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** + */const Q1=e("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const W1=e("Layers3",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m6.08 9.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1e5n1m"}],["path",{d:"m6.08 14.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1iwflc"}]]);/** + */const R1=e("Layers3",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m6.08 9.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1e5n1m"}],["path",{d:"m6.08 14.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1iwflc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Q1=e("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + */const $1=e("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const R1=e("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** + */const K1=e("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $1=e("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** + */const O1=e("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const K1=e("ListFilter",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** + */const J1=e("ListFilter",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const O1=e("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** + */const X1=e("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const J1=e("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** + */const Y1=e("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const X1=e("LocateFixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const e2=e("LocateFixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Y1=e("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** + */const a2=e("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const e2=e("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + */const t2=e("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const a2=e("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);/** + */const y2=e("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const t2=e("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const i2=e("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const y2=e("MessageSquareQuote",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 12a2 2 0 0 0 2-2V8H8",key:"1jfesj"}],["path",{d:"M14 12a2 2 0 0 0 2-2V8h-2",key:"1dq9mh"}]]);/** + */const c2=e("MessageSquareQuote",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 12a2 2 0 0 0 2-2V8H8",key:"1jfesj"}],["path",{d:"M14 12a2 2 0 0 0 2-2V8h-2",key:"1dq9mh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const i2=e("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/** + */const h2=e("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const c2=e("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** + */const n2=e("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const h2=e("MicVocal",[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]]);/** + */const d2=e("MicVocal",[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const n2=e("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** + */const r2=e("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const d2=e("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** + */const o2=e("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const r2=e("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** + */const s2=e("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const o2=e("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/** + */const p2=e("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const s2=e("Move3d",[["path",{d:"M5 3v16h16",key:"1mqmf9"}],["path",{d:"m5 19 6-6",key:"jh6hbb"}],["path",{d:"m2 6 3-3 3 3",key:"tkyvxa"}],["path",{d:"m18 16 3 3-3 3",key:"1d4glt"}]]);/** + */const k2=e("Move3d",[["path",{d:"M5 3v16h16",key:"1mqmf9"}],["path",{d:"m5 19 6-6",key:"jh6hbb"}],["path",{d:"m2 6 3-3 3 3",key:"tkyvxa"}],["path",{d:"m18 16 3 3-3 3",key:"1d4glt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const p2=e("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** + */const l2=e("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const k2=e("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + */const m2=e("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const l2=e("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** + */const M2=e("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const m2=e("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** + */const x2=e("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const M2=e("PaintBucket",[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]]);/** + */const g2=e("PaintBucket",[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const x2=e("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** + */const v2=e("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const g2=e("PersonStanding",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["path",{d:"m9 20 3-6 3 6",key:"se2kox"}],["path",{d:"m6 8 6 2 6-2",key:"4o3us4"}],["path",{d:"M12 10v4",key:"1kjpxc"}]]);/** + */const u2=e("PersonStanding",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["path",{d:"m9 20 3-6 3 6",key:"se2kox"}],["path",{d:"m6 8 6 2 6-2",key:"4o3us4"}],["path",{d:"M12 10v4",key:"1kjpxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const v2=e("PhoneCall",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/** + */const f2=e("PhoneCall",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const u2=e("Popcorn",[["path",{d:"M18 8a2 2 0 0 0 0-4 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0 0 4",key:"10td1f"}],["path",{d:"M10 22 9 8",key:"yjptiv"}],["path",{d:"m14 22 1-14",key:"8jwc8b"}],["path",{d:"M20 8c.5 0 .9.4.8 1l-2.6 12c-.1.5-.7 1-1.2 1H7c-.6 0-1.1-.4-1.2-1L3.2 9c-.1-.6.3-1 .8-1Z",key:"1qo33t"}]]);/** + */const w2=e("Popcorn",[["path",{d:"M18 8a2 2 0 0 0 0-4 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0 0 4",key:"10td1f"}],["path",{d:"M10 22 9 8",key:"yjptiv"}],["path",{d:"m14 22 1-14",key:"8jwc8b"}],["path",{d:"M20 8c.5 0 .9.4.8 1l-2.6 12c-.1.5-.7 1-1.2 1H7c-.6 0-1.1-.4-1.2-1L3.2 9c-.1-.6.3-1 .8-1Z",key:"1qo33t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const f2=e("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** + */const b2=e("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const w2=e("Rainbow",[["path",{d:"M22 17a10 10 0 0 0-20 0",key:"ozegv"}],["path",{d:"M6 17a6 6 0 0 1 12 0",key:"5giftw"}],["path",{d:"M10 17a2 2 0 0 1 4 0",key:"gnsikk"}]]);/** + */const q2=e("Rainbow",[["path",{d:"M22 17a10 10 0 0 0-20 0",key:"ozegv"}],["path",{d:"M6 17a6 6 0 0 1 12 0",key:"5giftw"}],["path",{d:"M10 17a2 2 0 0 1 4 0",key:"gnsikk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const b2=e("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/** + */const z2=e("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const q2=e("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** + */const j2=e("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const z2=e("ScanEye",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** + */const S2=e("ScanEye",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const j2=e("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);/** + */const L2=e("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const L2=e("ScanText",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);/** + */const C2=e("ScanText",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const S2=e("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** + */const V2=e("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const C2=e("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/** + */const A2=e("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const V2=e("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** + */const H2=e("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const A2=e("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** + */const T2=e("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const H2=e("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]);/** + */const F2=e("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const T2=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const Z2=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const F2=e("Sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]);/** + */const B2=e("Sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Z2=e("Signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);/** + */const P2=e("Signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const B2=e("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/** + */const N2=e("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const P2=e("SmilePlus",[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]]);/** + */const D2=e("SmilePlus",[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const N2=e("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** + */const E2=e("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const D2=e("Speech",[["path",{d:"M8.8 20v-4.1l1.9.2a2.3 2.3 0 0 0 2.164-2.1V8.3A5.37 5.37 0 0 0 2 8.25c0 2.8.656 3.054 1 4.55a5.77 5.77 0 0 1 .029 2.758L2 20",key:"11atix"}],["path",{d:"M19.8 17.8a7.5 7.5 0 0 0 .003-10.603",key:"yol142"}],["path",{d:"M17 15a3.5 3.5 0 0 0-.025-4.975",key:"ssbmkc"}]]);/** + */const _2=e("Speech",[["path",{d:"M8.8 20v-4.1l1.9.2a2.3 2.3 0 0 0 2.164-2.1V8.3A5.37 5.37 0 0 0 2 8.25c0 2.8.656 3.054 1 4.55a5.77 5.77 0 0 1 .029 2.758L2 20",key:"11atix"}],["path",{d:"M19.8 17.8a7.5 7.5 0 0 0 .003-10.603",key:"yol142"}],["path",{d:"M17 15a3.5 3.5 0 0 0-.025-4.975",key:"ssbmkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. @@ -508,89 +508,89 @@ import{n as e,r as x,j as a,L as q}from"./index-CbgxfyGU.js";import{u as s}from" * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _2=e("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** + */const I2=e("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const E2=e("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** + */const U2=e("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const I2=e("SwitchCamera",[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]]);/** + */const W2=e("SwitchCamera",[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const U2=e("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** + */const Q2=e("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const W2=e("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + */const R2=e("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Q2=e("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/** + */const $2=e("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const R2=e("TextSelect",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}],["line",{x1:"7",x2:"15",y1:"8",y2:"8",key:"1758g8"}],["line",{x1:"7",x2:"17",y1:"12",y2:"12",key:"197423"}],["line",{x1:"7",x2:"13",y1:"16",y2:"16",key:"37cgm6"}]]);/** + */const K2=e("TextSelect",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}],["line",{x1:"7",x2:"15",y1:"8",y2:"8",key:"1758g8"}],["line",{x1:"7",x2:"17",y1:"12",y2:"12",key:"197423"}],["line",{x1:"7",x2:"13",y1:"16",y2:"16",key:"37cgm6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $2=e("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** + */const O2=e("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const K2=e("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** + */const J2=e("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const O2=e("UserSearch",[["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}],["path",{d:"M10.3 15H7a4 4 0 0 0-4 4v2",key:"3bnktk"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}]]);/** + */const X2=e("UserSearch",[["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}],["path",{d:"M10.3 15H7a4 4 0 0 0-4 4v2",key:"3bnktk"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const J2=e("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + */const Y2=e("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const X2=e("VenetianMask",[["path",{d:"M18 11c-1.5 0-2.5.5-3 2",key:"1fod00"}],["path",{d:"M4 6a2 2 0 0 0-2 2v4a5 5 0 0 0 5 5 8 8 0 0 1 5 2 8 8 0 0 1 5-2 5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3a8 8 0 0 0-5 2 8 8 0 0 0-5-2z",key:"d70hit"}],["path",{d:"M6 11c1.5 0 2.5.5 3 2",key:"136fht"}]]);/** + */const ee=e("VenetianMask",[["path",{d:"M18 11c-1.5 0-2.5.5-3 2",key:"1fod00"}],["path",{d:"M4 6a2 2 0 0 0-2 2v4a5 5 0 0 0 5 5 8 8 0 0 1 5 2 8 8 0 0 1 5-2 5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3a8 8 0 0 0-5 2 8 8 0 0 0-5-2z",key:"d70hit"}],["path",{d:"M6 11c1.5 0 2.5.5 3 2",key:"136fht"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Y2=e("Vibrate",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]]);/** + */const ae=e("Vibrate",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ee=e("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** + */const te=e("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ae=e("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** + */const ye=e("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const te=e("Wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);/** + */const ie=e("Wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ye=e("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + */const ce=e("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ie=e("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),f={"audio-editing":C2,"audio-classification":O1,"audio-compression":L1,"audio-generation":J,"audio-understanding":w1,"automatic-music-transcription":p2,"automatic-speech-recognition":n2,"full-duplex-spoken-dialogue":v2,"sound-event-detection":B2,"speaker-diarization":J2,"speaker-verification":K2,"speech-enhancement":O,"speech-translation":$,"spoken-language-identification":P,"text-to-speech":D2,"voice-activity-detection":B,"voice-cloning":h2,agents:i1,"anomaly-detection":S,"autonomous-driving":k1,"classic-reinforcement-learning":Z1,"coding-agents":_2,"computer-use-agents":o2,"continual-learning":E1,"deepfake-detection":X2,"document-understanding":Z,"embedding-models":X,"emotion-recognition":N2,"language-modeling":i2,math:F2,"membership-inference":A1,"multimodal-sentiment-analysis":P2,ocr:L2,"omni-models":t1,"open-set-recognition":m1,"pseudo-labelling":W2,reasoning:r1,"reinforcement-learning":F,"remote-sensing":b2,robotics:c1,"scene-text-recognition":Z2,"trajectory-prediction":G2,"world-models":b1,"dialogue-state-tracking":c2,"entity-typing":Q2,"fake-news-detection":l2,"machine-translation":U1,"named-entity-recognition":_1,"part-of-speech-tagging":$2,"question-answering":t2,"relation-extraction":$1,summarization:V2,"table-question-answering":U2,"text-classification":K1,"text-reranking":J1,"text-to-sql":T,biology:f1,"brain-computer-interface":d1,"graph-machine-learning":k2,healthcare:E2,"knowledge-tracing":N1,"motion-sensing":Y2,"recommendation-systems":H,"sleep-stage-classification":A,"tabular-learning":H2,"time-series-classification":l1,"time-series-forecasting":V,"action-recognition":a1,"cross-view-object-correspondence":I2,"object-tracking":g1,"video-classification":M1,"video-compression":C1,"video-editing":V1,"video-frame-interpolation":F1,"video-generation":ee,"video-matting":Q1,"video-quality-assessment":Y,"video-restoration":ye,"video-segmentation":f2,"video-summarization":j1,"video-super-resolution":e2,"video-text-retrieval":d2,"video-understanding":u2,"visual-speech-recognition":p1,"point-tracking":X1,"3d-generation":h1,"3d-instance-segmentation":n1,"3d-object-detection":m2,"3d-scene-graph-generation":C,"3d-semantic-segmentation":W1,"3d-tracking":s2,"3d-understanding":v1,"camera-pose-estimation":s1,"change-detection":u1,"depth-estimation":r2,"document-layout-analysis":R1,"earth-observation":q2,"face-anti-spoofing":T2,"face-recognition":j2,"face-verification":x1,"gaze-estimation":z1,"hyperspectral-image-classification":w2,"image-captioning":y2,"image-classification":L,"image-compression":S1,"image-editing":o1,"image-fusion":a2,"image-generation":x2,"image-inpainting":M2,"image-matching":B1,"image-matting":q1,"image-registration":D1,"image-restoration":e1,"image-retrieval":j,"image-segmentation":A2,"image-super-resolution":ie,"image-to-image-translation":ae,"image-understanding":z2,"medical-imaging":y1,"motion-generation":T1,"object-counting":G1,"object-detection":S2,"optical-flow":te,"person-re-identification":O2,"pose-estimation":g2,"saliency-detection":H1,"scene-text-detection":R2,"stereo-matching":P1,"surface-normal-estimation":K,"visual-grounding":Y1,"visual-place-recognition":I1};function w(c,y){return f[c.toLowerCase()]??f[(y==null?void 0:y.toLowerCase())??""]??N}const Ge=()=>{var m,M;const c=s({queryKey:["areas-with-tasks"],queryFn:()=>p.areasWithTasks(),staleTime:6e5}),y=s({queryKey:["trending-tasks-directory"],queryFn:()=>p.trendingTasks({limit:12,min_recent_papers:10}),staleTime:10*60*1e3}),k=s({queryKey:["areas-all"],queryFn:()=>p.listAreas({page_size:50,ordering:"name"}),staleTime:10*60*1e3}),b=x.useMemo(()=>{var r,h,n;const i=new Map((((r=k.data)==null?void 0:r.results)??[]).map(t=>[t.id,t.name])),d=new Map((((h=c.data)==null?void 0:h.results)??[]).flatMap(t=>t.tasks.map(o=>[o.id,o.slug])));return(n=y.data)==null?void 0:n.results.map(t=>({id:t.id,name:u(t.name,t.slug),href:`/tasks/${t.slug}`,icon:w(t.slug??"",t.parent_id?d.get(t.parent_id):void 0),iconColor:g(v(t.slug??"")).dot,areaName:t.area_id?i.get(t.area_id):void 0,recentPaperCount:t.recent_paper_count,shareLift:t.share_lift}))},[y.data,k.data,c.data]),l=x.useMemo(()=>{var i;return R(((i=c.data)==null?void 0:i.results)??[])},[c.data]);return W(!!c.data&&!y.isLoading),c.error?a.jsx("div",{className:"page",children:a.jsx(D,{variant:"destructive",children:a.jsx(G,{children:"Failed to load taxonomy. Please try again."})})}):a.jsxs("div",{className:"page",children:[a.jsx("div",{className:"feed-header",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"feed-title",children:["All ",a.jsx("em",{children:"Domains"})]}),a.jsx("div",{className:"feed-subtitle",children:"Browse research by area. Click any task to see trending work."})]})}),a.jsx(Q,{noun:"task",items:b,recentDays:(m=y.data)==null?void 0:m.recent_days,baselineDays:(M=y.data)==null?void 0:M.baseline_days,isLoading:y.isLoading,error:y.error}),c.isLoading?a.jsx(_,{tiles:6,tileClassName:"h-24"}):l.map(i=>{const d=i.tasks;if(d.length===0)return null;const r=d.reduce((h,n)=>h+(n.paper_count||0),0);return a.jsxs(E,{id:`area-${z(i.name)}`,title:i.name,description:i.description,meta:`${d.length} ${d.length===1?"task":"tasks"} · ${r.toLocaleString()} papers`,children:[d.map(h=>{const n=h.slug||"",t=g(v(n)),o=w(n);return a.jsxs(q,{to:`/tasks/${n}`,className:"tag-cell",children:[a.jsxs("div",{className:"name",children:[a.jsx("span",{className:"task-icon",style:{color:t.dot},children:a.jsx(o,{size:16,strokeWidth:2,"aria-hidden":"true"})}),u(h.name,n)]}),a.jsx("div",{className:"meta",children:a.jsxs("span",{children:[(h.paper_count??0).toLocaleString()," papers"]})})]},h.id)}),a.jsx(U,{kind:"task"})]},i.id)}),a.jsx(I,{areas:l})]})};export{Ge as default}; + */const he=e("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),w={"audio-editing":A2,"audio-classification":X1,"audio-compression":C1,"audio-generation":Y,"audio-understanding":q1,"automatic-music-transcription":l2,"automatic-speech-recognition":r2,"full-duplex-spoken-dialogue":f2,"sound-event-detection":N2,"speaker-diarization":Y2,"speaker-verification":J2,"speech-enhancement":X,"speech-translation":O,"spoken-language-identification":D,"text-to-speech":_2,"voice-activity-detection":N,"voice-cloning":d2,agents:h1,"anomaly-detection":V,"autonomous-driving":m1,"classic-reinforcement-learning":P1,"coding-agents":I2,"computer-use-agents":p2,"continual-learning":U1,"deepfake-detection":ee,"document-understanding":P,"embedding-models":e1,"emotion-recognition":E2,"language-modeling":h2,math:B2,"membership-inference":T1,"multimodal-sentiment-analysis":D2,ocr:C2,"omni-models":i1,"open-set-recognition":x1,"pseudo-labelling":R2,reasoning:s1,"reinforcement-learning":B,"remote-sensing":z2,robotics:n1,"scene-text-recognition":P2,"trajectory-prediction":G2,"world-models":z1,"dialogue-state-tracking":n2,"entity-typing":$2,"fake-news-detection":M2,"machine-translation":Q1,"named-entity-recognition":I1,"part-of-speech-tagging":O2,"question-answering":i2,"relation-extraction":O1,summarization:H2,"table-question-answering":Q2,"text-classification":J1,"text-reranking":Y1,"text-to-sql":Z,biology:b1,"brain-computer-interface":o1,"graph-machine-learning":m2,healthcare:U2,"knowledge-tracing":E1,"motion-sensing":ae,"recommendation-systems":F,"sleep-stage-classification":T,"tabular-learning":F2,"time-series-classification":M1,"time-series-forecasting":H,"action-recognition":y1,"cross-view-object-correspondence":W2,"object-tracking":u1,"video-classification":g1,"video-compression":A1,"video-editing":H1,"video-frame-interpolation":B1,"video-generation":te,"video-matting":$1,"video-quality-assessment":a1,"video-restoration":ce,"video-segmentation":b2,"video-summarization":L1,"video-super-resolution":t2,"video-text-retrieval":o2,"video-understanding":w2,"visual-speech-recognition":l1,"point-tracking":e2,"3d-generation":d1,"3d-instance-segmentation":r1,"3d-object-detection":x2,"3d-scene-graph-generation":A,"3d-semantic-segmentation":R1,"3d-tracking":k2,"3d-understanding":f1,"camera-pose-estimation":k1,"change-detection":w1,"depth-estimation":s2,"document-layout-analysis":K1,"earth-observation":j2,"face-anti-spoofing":Z2,"face-recognition":L2,"face-verification":v1,"gaze-estimation":S1,"hyperspectral-image-classification":q2,"image-captioning":c2,"image-classification":C,"image-compression":V1,"image-editing":p1,"image-fusion":y2,"image-generation":v2,"image-inpainting":g2,"image-matching":N1,"image-matting":j1,"image-registration":_1,"image-restoration":t1,"image-retrieval":L,"image-segmentation":T2,"image-super-resolution":he,"image-to-image-translation":ye,"image-understanding":S2,"medical-imaging":c1,"motion-generation":Z1,"object-counting":G1,"object-detection":V2,"optical-flow":ie,"person-re-identification":X2,"pose-estimation":u2,"saliency-detection":F1,"scene-text-detection":K2,"stereo-matching":D1,"surface-normal-estimation":J,"visual-grounding":a2,"visual-place-recognition":W1};function b(c,y){return w[c.toLowerCase()]??w[(y==null?void 0:y.toLowerCase())??""]??E}const _e=()=>{var M,x;const c=s({queryKey:["areas-with-tasks"],queryFn:()=>k.areasWithTasks(),staleTime:p}),y=s({queryKey:["trending-tasks-directory"],queryFn:()=>k.trendingTasks({limit:12,min_recent_papers:10}),staleTime:p}),l=s({queryKey:j.areas,queryFn:()=>k.listAreas({page_size:50,ordering:"name"}),staleTime:p}),q=g.useMemo(()=>{var r,h,n;const i=new Map((((r=l.data)==null?void 0:r.results)??[]).map(t=>[t.id,t.name])),d=new Map((((h=c.data)==null?void 0:h.results)??[]).flatMap(t=>t.tasks.map(o=>[o.id,o.slug])));return(n=y.data)==null?void 0:n.results.map(t=>({id:t.id,name:f(t.name,t.slug),href:`/tasks/${t.slug}`,icon:b(t.slug??"",t.parent_id?d.get(t.parent_id):void 0),iconColor:v(u(t.slug??"")).dot,areaName:t.area_id?i.get(t.area_id):void 0,recentPaperCount:t.recent_paper_count,shareLift:t.share_lift}))},[y.data,l.data,c.data]),m=g.useMemo(()=>{var i;return K(((i=c.data)==null?void 0:i.results)??[])},[c.data]);return R(!!c.data&&!y.isLoading),c.error?a.jsx("div",{className:"page",children:a.jsx(_,{variant:"destructive",children:a.jsx(G,{children:"Failed to load taxonomy. Please try again."})})}):a.jsxs("div",{className:"page",children:[a.jsx("div",{className:"feed-header",children:a.jsxs("div",{children:[a.jsxs("h1",{className:"feed-title",children:["All ",a.jsx("em",{children:"Domains"})]}),a.jsx("div",{className:"feed-subtitle",children:"Browse research by area. Click any task to see trending work."})]})}),a.jsx($,{noun:"task",items:q,recentDays:(M=y.data)==null?void 0:M.recent_days,baselineDays:(x=y.data)==null?void 0:x.baseline_days,isLoading:y.isLoading,error:y.error}),c.isLoading?a.jsx(I,{tiles:6,tileClassName:"h-24"}):m.map(i=>{const d=i.tasks;if(d.length===0)return null;const r=d.reduce((h,n)=>h+(n.paper_count||0),0);return a.jsxs(U,{id:`area-${S(i.name)}`,title:i.name,description:i.description,meta:`${d.length} ${d.length===1?"task":"tasks"} · ${r.toLocaleString()} papers`,children:[d.map(h=>{const n=h.slug||"",t=v(u(n)),o=b(n);return a.jsxs(z,{to:`/tasks/${n}`,className:"tag-cell",children:[a.jsxs("div",{className:"name",children:[a.jsx("span",{className:"task-icon",style:{color:t.dot},children:a.jsx(o,{size:16,strokeWidth:2,"aria-hidden":"true"})}),f(h.name,n)]}),a.jsx("div",{className:"meta",children:a.jsxs("span",{children:[(h.paper_count??0).toLocaleString()," papers"]})})]},h.id)}),a.jsx(Q,{kind:"task"})]},i.id)}),a.jsx(W,{areas:m})]})};export{_e as default}; diff --git a/assets/TaxonomySuggestionTile-DIw_GKfA.js b/assets/TaxonomySuggestionTile-jIiLMp4q.js similarity index 52% rename from assets/TaxonomySuggestionTile-DIw_GKfA.js rename to assets/TaxonomySuggestionTile-jIiLMp4q.js index 86aa5fc8d35e3efbb0d8851928305c271be1fd1c..afc40f8a5e7c906f702afe9a893a40d1b77c614f 100644 --- a/assets/TaxonomySuggestionTile-DIw_GKfA.js +++ b/assets/TaxonomySuggestionTile-jIiLMp4q.js @@ -1 +1 @@ -import{a as u,r as t,j as e}from"./index-CbgxfyGU.js";import{S as c,a as m}from"./SignInToEditDialog-CNIcNqbK.js";import{P as p}from"./plus-UK0TEjgd.js";function j({kind:s}){const{user:a}=u(),[i,n]=t.useState(!1),[r,o]=t.useState(!1),l=`Suggest a new ${s}...`,g=()=>{a?n(!0):o(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"tag-cell taxonomy-suggestion-cell",onClick:g,children:[e.jsxs("div",{className:"name",children:[e.jsx(p,{className:"taxonomy-suggestion-icon","aria-hidden":"true"}),l]}),e.jsx("div",{className:"meta",children:e.jsx("span",{children:"Propose an addition"})})]}),e.jsx(c,{open:i,onOpenChange:n,kind:s}),e.jsx(m,{open:r,onOpenChange:o,sectionLabel:`${s}s`,returnTo:typeof window<"u"?window.location.pathname:`/${s}s`,taxonomySuggestion:!0})]})}export{j as T}; +import{a as u,d as t,j as e}from"./index-DyXq7-Tg.js";import{S as c,a as m}from"./SignInToEditDialog-B-oWVno5.js";import{P as p}from"./plus-Yh42pKZz.js";function j({kind:s}){const{user:a}=u(),[i,n]=t.useState(!1),[l,o]=t.useState(!1),r=`Suggest a new ${s}...`,g=()=>{a?n(!0):o(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"tag-cell taxonomy-suggestion-cell",onClick:g,children:[e.jsxs("div",{className:"name",children:[e.jsx(p,{className:"taxonomy-suggestion-icon","aria-hidden":"true"}),r]}),e.jsx("div",{className:"meta",children:e.jsx("span",{children:"Propose an addition"})})]}),e.jsx(c,{open:i,onOpenChange:n,kind:s}),e.jsx(m,{open:l,onOpenChange:o,sectionLabel:`${s}s`,returnTo:typeof window<"u"?window.location.pathname:`/${s}s`,taxonomySuggestion:!0})]})}export{j as T}; diff --git a/assets/TrendsView-DCijqOnv.js b/assets/TrendsView-DCijqOnv.js new file mode 100644 index 0000000000000000000000000000000000000000..48e3ae0daf653ac96cc9cd0811ed425d1e6cb688 --- /dev/null +++ b/assets/TrendsView-DCijqOnv.js @@ -0,0 +1 @@ +import{V as I,j as e,ac as X,b as G}from"./index-DyXq7-Tg.js";import{A as J,a as V}from"./alert-gbJBhAVE.js";import{S as P}from"./skeleton-C3IIzpSL.js";const m=t=>{const r=/^(\d{4})-(0[1-9]|1[0-2])$/.exec(t);if(!r)return t;const[,s,l]=r;return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][Number(l)-1]} '${s.slice(2)}`},g=980,j=400,x=62,B=26,f=30,E=58,u=g-x-B,A=j-f-E,v=f+A,Q=t=>{if(t.length<3)return t.map((s,l)=>`${l?"L":"M"}${s[0]} ${s[1]}`).join(" ");let r=`M${t[0][0]} ${t[0][1]}`;for(let s=0;s{const[a,y]=I.useState(null),i=r.length,b=l[l.length-1],d=n=>x+u*(i===1?0:n/(i-1)),p=n=>f+A*(1-n/b);if(i===0)return null;const R=r.map((n,h)=>[d(h),p(n.percent)]),F=Q(R),_=`${F} L ${d(i-1)} ${v} L ${x} ${v} Z`,w=i<=12?1:Math.ceil(i/8),O=n=>{const h=n.currentTarget.getBoundingClientRect(),S=(n.clientX-h.left)/h.width*g,k=i>1?u/(i-1):u,q=Math.max(0,Math.min(i-1,Math.round((S-x)/k)));y(q)},H=`trend-gradient-${t}`;return e.jsxs("figure",{className:"trend-chart",children:[e.jsxs("div",{className:"trend-chart-visual",children:[e.jsxs("svg",{viewBox:`0 0 ${g} ${j}`,width:"100%",role:"img","aria-label":`${c} by ${o.toLowerCase()}, from ${m(r[0].month)} (${r[0].percent}%) to ${m(r[i-1].month)} (${r[i-1].percent}%)`,style:{display:"block",overflow:"visible",cursor:"crosshair"},onPointerMove:O,onPointerLeave:()=>y(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:H,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",style:{stopColor:s,stopOpacity:.26}}),e.jsx("stop",{offset:"100%",style:{stopColor:s,stopOpacity:.02}})]})}),l.map(n=>e.jsxs("g",{children:[e.jsx("line",{x1:x,x2:g-B,y1:p(n),y2:p(n),stroke:"var(--hairline)",strokeWidth:1}),e.jsxs("text",{x:x-14,y:p(n)+4,textAnchor:"end",style:W,children:[n,"%"]})]},n)),e.jsx("path",{d:_,fill:`url(#${H})`}),e.jsx("path",{d:F,fill:"none",stroke:s,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}),r.map((n,h)=>{const S=h===i-1,k=h%w===0&&i-1-h>=w/2;return!S&&!k?null:e.jsx("text",{x:d(h),y:v+24,textAnchor:"middle",style:W,children:m(n.month)},n.month)}),e.jsx("text",{x:x+u/2,y:j-4,textAnchor:"middle",style:z,children:o}),e.jsx("text",{transform:`translate(16 ${f+A/2}) rotate(-90)`,textAnchor:"middle",style:z,children:c}),a!=null&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:d(a),x2:d(a),y1:f,y2:v,stroke:s,strokeWidth:1,strokeDasharray:"3 4",opacity:.5}),e.jsx("circle",{cx:d(a),cy:p(r[a].percent),r:5,fill:"var(--bg)",stroke:s,strokeWidth:2})]})]}),a!=null&&e.jsxs("div",{style:{position:"absolute",left:`${d(a)/g*100}%`,top:`${p(r[a].percent)/j*100}%`,transform:"translate(-50%, calc(-100% - 14px))",background:"var(--bg-elevated)",border:"1px solid var(--hairline)",borderRadius:6,boxShadow:"0 8px 26px rgba(0,0,0,.13)",padding:"7px 12px",pointerEvents:"none",whiteSpace:"nowrap",zIndex:3},children:[e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",color:"var(--ink-faint)",fontSize:13,marginBottom:2},children:m(r[a].month)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,fontFamily:"var(--mono)",fontWeight:600,fontSize:15,color:"var(--ink)"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:s,display:"inline-block"}}),r[a].percent,"%"]})]})]}),e.jsxs("details",{className:"trend-chart-table",children:[e.jsx("summary",{style:{fontFamily:"var(--mono)",fontSize:11,letterSpacing:"0.04em",color:"var(--ink-faint)",cursor:"pointer"},children:"View data table"}),e.jsxs("table",{style:{marginTop:8,borderCollapse:"collapse",fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",padding:"3px 18px 3px 0"},children:o}),e.jsx("th",{style:{textAlign:"right",padding:"3px 0"},children:c})]})}),e.jsx("tbody",{children:r.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 18px 2px 0"},children:m(n.month)}),e.jsxs("td",{style:{textAlign:"right",padding:"2px 0"},children:[n.percent,"%"]})]},n.month))})]})]})]})};class Y{constructor(r){this.request=r}trends(){return this.request("/stats/trends")}}const K=new Y(X),$={maxWidth:960,padding:"48px 0 8px",borderTop:"1px solid var(--hairline)",marginTop:48},T={fontFamily:"var(--serif)",fontSize:34,fontWeight:500,letterSpacing:"-0.02em",margin:"0 0 10px",color:"var(--ink)"},M={fontFamily:"var(--serif)",fontSize:18,lineHeight:1.55,color:"var(--ink-soft)",maxWidth:620,margin:"0 0 8px"},C={fontFamily:"var(--mono)",fontSize:12,fontWeight:600,letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--ink-faint)",marginBottom:8},N={fontFamily:"var(--serif)",fontSize:17,lineHeight:1.6,color:"var(--ink-soft)",margin:0},D={height:320,marginTop:26},te=()=>{const t=G({queryKey:["research-trends"],queryFn:()=>K.trends(),staleTime:36e5});return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Research ",e.jsx("em",{children:"Trends"})]}),e.jsx("div",{className:"feed-subtitle",children:"How open science is changing across machine learning — tracked over time from arXiv and the Hugging Face Hub."})]})}),t.error&&e.jsx(J,{variant:"destructive",children:e.jsx(V,{children:"Failed to load research trends. Please try again."})}),e.jsxs("section",{style:$,children:[e.jsx("h2",{style:T,children:"Code Availability"}),e.jsx("p",{style:M,children:"The percentage of published papers that have at least one official code implementation on GitHub."}),e.jsx("div",{style:{marginTop:26},children:t.data?e.jsx(L,{id:"code",data:t.data.code_availability,color:"var(--trend-code)",yTicks:[0,20,40,60,80],yLabel:"Code Availability",xLabel:"Paper Publication Date"}):!t.error&&e.jsx(P,{style:D})})]}),e.jsxs("section",{style:$,children:[e.jsx("h2",{style:T,children:"Papers with Hugging Face artifacts"}),e.jsx("p",{style:M,children:"The percentage of published papers linked to at least one Hugging Face artifact — a model, dataset or Space — making the work directly runnable and reusable."}),e.jsx("div",{style:{marginTop:26},children:t.data?e.jsx(L,{id:"hf",data:t.data.hf_artifacts,color:"var(--trend-hf)",yTicks:[0,10,20,30,40,50],yLabel:"HF Artifact Coverage",xLabel:"Paper Publication Date"}):!t.error&&e.jsx(P,{style:D})})]}),e.jsxs("section",{style:{...$,paddingBottom:72},children:[e.jsx("h2",{style:{...T,fontSize:27},children:"How the data is collected"}),e.jsxs("div",{style:{display:"grid",gap:24,maxWidth:680},children:[e.jsxs("div",{children:[e.jsx("div",{style:C,children:"Code Availability"}),e.jsx("p",{style:N,children:"For every open-access machine learning paper, we check whether an official code implementation is linked on GitHub. The date axis is the paper's publication date."})]}),e.jsxs("div",{children:[e.jsx("div",{style:C,children:"Hugging Face artifacts"}),e.jsx("p",{style:N,children:"We resolve links between papers and the Hugging Face Hub, counting a paper as covered when it references at least one model, dataset or Space. The date axis is the paper's publication date."})]}),e.jsx("p",{style:{fontFamily:"var(--mono)",fontSize:12,lineHeight:1.6,color:"var(--ink-faint)",margin:"8px 0 0",letterSpacing:"0.02em"},children:"Figures use complete publication months. Historical Hugging Face coverage reflects artifacts currently linked in the catalog."})]})]})]})};export{te as default}; diff --git a/assets/TrendsView-DhWigqns.js b/assets/TrendsView-DhWigqns.js deleted file mode 100644 index 7d5bd3dce3ce83e5c226b341b915fba6b4c798cf..0000000000000000000000000000000000000000 --- a/assets/TrendsView-DhWigqns.js +++ /dev/null @@ -1 +0,0 @@ -import{M as I,j as e,a6 as X}from"./index-CbgxfyGU.js";import{u as G}from"./useQuery-Bx9s5-D2.js";import{A as J,a as E}from"./alert-CFDDvdIM.js";import{S as P}from"./skeleton-HwvdxvSN.js";const m=t=>{const r=/^(\d{4})-(0[1-9]|1[0-2])$/.exec(t);if(!r)return t;const[,s,l]=r;return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][Number(l)-1]} '${s.slice(2)}`},f=980,j=400,x=62,B=26,g=30,Q=58,u=f-x-B,A=j-g-Q,v=g+A,V=t=>{if(t.length<3)return t.map((s,l)=>`${l?"L":"M"}${s[0]} ${s[1]}`).join(" ");let r=`M${t[0][0]} ${t[0][1]}`;for(let s=0;s{const[a,y]=I.useState(null),i=r.length,b=l[l.length-1],d=n=>x+u*(i===1?0:n/(i-1)),p=n=>g+A*(1-n/b);if(i===0)return null;const R=r.map((n,h)=>[d(h),p(n.percent)]),F=V(R),_=`${F} L ${d(i-1)} ${v} L ${x} ${v} Z`,w=i<=12?1:Math.ceil(i/8),O=n=>{const h=n.currentTarget.getBoundingClientRect(),S=(n.clientX-h.left)/h.width*f,k=i>1?u/(i-1):u,q=Math.max(0,Math.min(i-1,Math.round((S-x)/k)));y(q)},H=`trend-gradient-${t}`;return e.jsxs("figure",{className:"trend-chart",children:[e.jsxs("div",{className:"trend-chart-visual",children:[e.jsxs("svg",{viewBox:`0 0 ${f} ${j}`,width:"100%",role:"img","aria-label":`${c} by ${o.toLowerCase()}, from ${m(r[0].month)} (${r[0].percent}%) to ${m(r[i-1].month)} (${r[i-1].percent}%)`,style:{display:"block",overflow:"visible",cursor:"crosshair"},onPointerMove:O,onPointerLeave:()=>y(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:H,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",style:{stopColor:s,stopOpacity:.26}}),e.jsx("stop",{offset:"100%",style:{stopColor:s,stopOpacity:.02}})]})}),l.map(n=>e.jsxs("g",{children:[e.jsx("line",{x1:x,x2:f-B,y1:p(n),y2:p(n),stroke:"var(--hairline)",strokeWidth:1}),e.jsxs("text",{x:x-14,y:p(n)+4,textAnchor:"end",style:W,children:[n,"%"]})]},n)),e.jsx("path",{d:_,fill:`url(#${H})`}),e.jsx("path",{d:F,fill:"none",stroke:s,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}),r.map((n,h)=>{const S=h===i-1,k=h%w===0&&i-1-h>=w/2;return!S&&!k?null:e.jsx("text",{x:d(h),y:v+24,textAnchor:"middle",style:W,children:m(n.month)},n.month)}),e.jsx("text",{x:x+u/2,y:j-4,textAnchor:"middle",style:z,children:o}),e.jsx("text",{transform:`translate(16 ${g+A/2}) rotate(-90)`,textAnchor:"middle",style:z,children:c}),a!=null&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:d(a),x2:d(a),y1:g,y2:v,stroke:s,strokeWidth:1,strokeDasharray:"3 4",opacity:.5}),e.jsx("circle",{cx:d(a),cy:p(r[a].percent),r:5,fill:"var(--bg)",stroke:s,strokeWidth:2})]})]}),a!=null&&e.jsxs("div",{style:{position:"absolute",left:`${d(a)/f*100}%`,top:`${p(r[a].percent)/j*100}%`,transform:"translate(-50%, calc(-100% - 14px))",background:"var(--bg-elevated)",border:"1px solid var(--hairline)",borderRadius:6,boxShadow:"0 8px 26px rgba(0,0,0,.13)",padding:"7px 12px",pointerEvents:"none",whiteSpace:"nowrap",zIndex:3},children:[e.jsx("div",{style:{fontFamily:"var(--serif)",fontStyle:"italic",color:"var(--ink-faint)",fontSize:13,marginBottom:2},children:m(r[a].month)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,fontFamily:"var(--mono)",fontWeight:600,fontSize:15,color:"var(--ink)"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:2,background:s,display:"inline-block"}}),r[a].percent,"%"]})]})]}),e.jsxs("details",{className:"trend-chart-table",children:[e.jsx("summary",{style:{fontFamily:"var(--mono)",fontSize:11,letterSpacing:"0.04em",color:"var(--ink-faint)",cursor:"pointer"},children:"View data table"}),e.jsxs("table",{style:{marginTop:8,borderCollapse:"collapse",fontFamily:"var(--mono)",fontSize:12,color:"var(--ink-soft)"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",padding:"3px 18px 3px 0"},children:o}),e.jsx("th",{style:{textAlign:"right",padding:"3px 0"},children:c})]})}),e.jsx("tbody",{children:r.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 18px 2px 0"},children:m(n.month)}),e.jsxs("td",{style:{textAlign:"right",padding:"2px 0"},children:[n.percent,"%"]})]},n.month))})]})]})]})};class Y{constructor(r){this.request=r}trends(){return this.request("/stats/trends")}}const K=new Y(X),$={maxWidth:960,padding:"48px 0 8px",borderTop:"1px solid var(--hairline)",marginTop:48},T={fontFamily:"var(--serif)",fontSize:34,fontWeight:500,letterSpacing:"-0.02em",margin:"0 0 10px",color:"var(--ink)"},L={fontFamily:"var(--serif)",fontSize:18,lineHeight:1.55,color:"var(--ink-soft)",maxWidth:620,margin:"0 0 8px"},C={fontFamily:"var(--mono)",fontSize:12,fontWeight:600,letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--ink-faint)",marginBottom:8},N={fontFamily:"var(--serif)",fontSize:17,lineHeight:1.6,color:"var(--ink-soft)",margin:0},D={height:320,marginTop:26},ne=()=>{const t=G({queryKey:["research-trends"],queryFn:()=>K.trends(),staleTime:36e5});return e.jsxs("div",{className:"page",children:[e.jsx("div",{className:"feed-header",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"feed-title",children:["Research ",e.jsx("em",{children:"Trends"})]}),e.jsx("div",{className:"feed-subtitle",children:"How open science is changing across machine learning — tracked over time from arXiv and the Hugging Face Hub."})]})}),t.error&&e.jsx(J,{variant:"destructive",children:e.jsx(E,{children:"Failed to load research trends. Please try again."})}),e.jsxs("section",{style:$,children:[e.jsx("h2",{style:T,children:"Code Availability"}),e.jsx("p",{style:L,children:"The percentage of published papers that have at least one official code implementation on GitHub."}),e.jsx("div",{style:{marginTop:26},children:t.data?e.jsx(M,{id:"code",data:t.data.code_availability,color:"var(--trend-code)",yTicks:[0,20,40,60,80],yLabel:"Code Availability",xLabel:"Paper Publication Date"}):!t.error&&e.jsx(P,{style:D})})]}),e.jsxs("section",{style:$,children:[e.jsx("h2",{style:T,children:"Papers with Hugging Face artifacts"}),e.jsx("p",{style:L,children:"The percentage of published papers linked to at least one Hugging Face artifact — a model, dataset or Space — making the work directly runnable and reusable."}),e.jsx("div",{style:{marginTop:26},children:t.data?e.jsx(M,{id:"hf",data:t.data.hf_artifacts,color:"var(--trend-hf)",yTicks:[0,10,20,30,40,50],yLabel:"HF Artifact Coverage",xLabel:"Paper Publication Date"}):!t.error&&e.jsx(P,{style:D})})]}),e.jsxs("section",{style:{...$,paddingBottom:72},children:[e.jsx("h2",{style:{...T,fontSize:27},children:"How the data is collected"}),e.jsxs("div",{style:{display:"grid",gap:24,maxWidth:680},children:[e.jsxs("div",{children:[e.jsx("div",{style:C,children:"Code Availability"}),e.jsx("p",{style:N,children:"For every open-access machine learning paper, we check whether an official code implementation is linked on GitHub. The date axis is the paper's publication date."})]}),e.jsxs("div",{children:[e.jsx("div",{style:C,children:"Hugging Face artifacts"}),e.jsx("p",{style:N,children:"We resolve links between papers and the Hugging Face Hub, counting a paper as covered when it references at least one model, dataset or Space. The date axis is the paper's publication date."})]}),e.jsx("p",{style:{fontFamily:"var(--mono)",fontSize:12,lineHeight:1.6,color:"var(--ink-faint)",margin:"8px 0 0",letterSpacing:"0.02em"},children:"Figures use complete publication months. Historical Hugging Face coverage reflects artifacts currently linked in the catalog."})]})]})]})};export{ne as default}; diff --git a/assets/UserProfileView-BnW4I15t.js b/assets/UserProfileView-BnW4I15t.js new file mode 100644 index 0000000000000000000000000000000000000000..af690c0800dafc52a9d9d03b8db03dcb2015746c --- /dev/null +++ b/assets/UserProfileView-BnW4I15t.js @@ -0,0 +1 @@ +import{aV as n,u as i,b as o,j as e,ao as d}from"./index-DyXq7-Tg.js";import{C as l}from"./OrganizationContributionGraph-DsoZR4EG.js";import"./skeleton-C3IIzpSL.js";import"./catalog-CRar2olQ.js";const c={async get(s){const a=await n(`/profiles/${encodeURIComponent(s)}`),r=await a.json();if(!a.redirected)return r;const t=decodeURIComponent(new URL(a.url).pathname.split("/").pop()||r.username);return{...r,username:t,redirected_from_alias:!0}}},x=()=>{const{username:s=""}=i(),a=o({queryKey:["user-profile",s.toLowerCase()],queryFn:()=>c.get(s)});return a.isLoading?e.jsx("div",{className:"page",children:"Loading profile…"}):a.data?a.data.redirected_from_alias?e.jsx(d,{to:`/${a.data.username}`,replace:!0}):e.jsxs("div",{className:"page",style:{maxWidth:960},children:[e.jsxs("h1",{children:["@",a.data.username]}),e.jsx("p",{children:"Canonical Papers with Code contributions"}),e.jsx(l,{data:a.data.calendar,organizationName:`@${a.data.username}`,title:"Canonical contributions",noun:"contribution"}),a.data.is_owner&&e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{children:"Your submissions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Limits and duplicate behavior are documented on ",e.jsx("a",{href:"/rate-limits",children:"the policy page"}),"."]}),e.jsx("div",{className:"mt-4 space-y-3",children:a.data.submissions.map(r=>e.jsxs("article",{className:"rounded-md border p-4",children:[e.jsx("strong",{children:r.edit_type})," · ",r.status,e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Original and applied payload"}),e.jsx("pre",{children:JSON.stringify({proposed:r.proposed_payload,applied:r.applied_payload},null,2)})]}),r.review_reason&&e.jsx("p",{children:r.review_reason})]},r.id))})]})]}):e.jsx("div",{className:"page",children:e.jsx("h1",{children:"Profile not found"})})};export{x as default}; diff --git a/assets/UserProfileView-gm0usnRn.js b/assets/UserProfileView-gm0usnRn.js deleted file mode 100644 index b591814cc99564eb0890eb71f839e6d4fcba0684..0000000000000000000000000000000000000000 --- a/assets/UserProfileView-gm0usnRn.js +++ /dev/null @@ -1 +0,0 @@ -import{aP as n,u as i,j as e,ai as o}from"./index-CbgxfyGU.js";import{u as d}from"./useQuery-Bx9s5-D2.js";import{C as l}from"./OrganizationContributionGraph-ah6EPb13.js";import"./skeleton-HwvdxvSN.js";import"./catalog-DhK7_9-6.js";const c={async get(s){const a=await n(`/profiles/${encodeURIComponent(s)}`),r=await a.json();if(!a.redirected)return r;const t=decodeURIComponent(new URL(a.url).pathname.split("/").pop()||r.username);return{...r,username:t,redirected_from_alias:!0}}},j=()=>{const{username:s=""}=i(),a=d({queryKey:["user-profile",s.toLowerCase()],queryFn:()=>c.get(s)});return a.isLoading?e.jsx("div",{className:"page",children:"Loading profile…"}):a.data?a.data.redirected_from_alias?e.jsx(o,{to:`/${a.data.username}`,replace:!0}):e.jsxs("div",{className:"page",style:{maxWidth:960},children:[e.jsxs("h1",{children:["@",a.data.username]}),e.jsx("p",{children:"Canonical Papers with Code contributions"}),e.jsx(l,{data:a.data.calendar,organizationName:`@${a.data.username}`,title:"Canonical contributions",noun:"contribution"}),a.data.is_owner&&e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{children:"Your submissions"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Limits and duplicate behavior are documented on ",e.jsx("a",{href:"/rate-limits",children:"the policy page"}),"."]}),e.jsx("div",{className:"mt-4 space-y-3",children:a.data.submissions.map(r=>e.jsxs("article",{className:"rounded-md border p-4",children:[e.jsx("strong",{children:r.edit_type})," · ",r.status,e.jsxs("details",{className:"mt-2 text-xs",children:[e.jsx("summary",{children:"Original and applied payload"}),e.jsx("pre",{children:JSON.stringify({proposed:r.proposed_payload,applied:r.applied_payload},null,2)})]}),r.review_reason&&e.jsx("p",{children:r.review_reason})]},r.id))})]})]}):e.jsx("div",{className:"page",children:e.jsx("h1",{children:"Profile not found"})})};export{j as default}; diff --git a/assets/account-cbblajck.js b/assets/account-cbblajck.js new file mode 100644 index 0000000000000000000000000000000000000000..843c6b83abc67cc5d6159ba84c1b31ce3aa4aa54 --- /dev/null +++ b/assets/account-cbblajck.js @@ -0,0 +1 @@ +import{ac as r}from"./index-DyXq7-Tg.js";class t{constructor(e){this.request=e}getPreferences(){return this.request("/me/preferences")}updatePreferences(e){return this.request("/me/preferences",{method:"PUT",body:JSON.stringify(e)})}getRateLimitPolicy(){return this.request("/rate-limits",{credentials:"omit"})}getBookmarkIds(){return this.request("/me/bookmarks/ids")}getBookmarks(){return this.request("/me/bookmarks")}addBookmark(e){return this.request(`/me/bookmarks/${e}`,{method:"POST"})}removeBookmark(e){return this.request(`/me/bookmarks/${e}`,{method:"DELETE"})}}const m=new t(r);export{m as a}; diff --git a/assets/activity-dcKMRXBy.js b/assets/activity-S-FQ6Anu.js similarity index 89% rename from assets/activity-dcKMRXBy.js rename to assets/activity-S-FQ6Anu.js index 8a138dde1e82de01c131d6489ab57ca7f5424f19..712add152170d2dfc50d29e0e27dd86b57965ef2 100644 --- a/assets/activity-dcKMRXBy.js +++ b/assets/activity-S-FQ6Anu.js @@ -1,4 +1,4 @@ -import{n as t}from"./index-CbgxfyGU.js";/** +import{s as t}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/alert-CFDDvdIM.js b/assets/alert-CFDDvdIM.js deleted file mode 100644 index e64e01115986ce79c18954ba2fd48f9d702976ed..0000000000000000000000000000000000000000 --- a/assets/alert-CFDDvdIM.js +++ /dev/null @@ -1 +0,0 @@ -import{r as a,j as s,B as l,a8 as i}from"./index-CbgxfyGU.js";const o=i("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),n=a.forwardRef(({className:e,variant:t,...r},d)=>s.jsx("div",{ref:d,role:"alert",className:l(o({variant:t}),e),...r}));n.displayName="Alert";const v=a.forwardRef(({className:e,...t},r)=>s.jsx("h5",{ref:r,className:l("mb-1 font-medium leading-none tracking-tight",e),...t}));v.displayName="AlertTitle";const c=a.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:l("text-sm [&_p]:leading-relaxed",e),...t}));c.displayName="AlertDescription";export{n as A,c as a}; diff --git a/assets/alert-gbJBhAVE.js b/assets/alert-gbJBhAVE.js new file mode 100644 index 0000000000000000000000000000000000000000..298e47c5b7eb4ab7f3d54ced0ce7fedb41170bc1 --- /dev/null +++ b/assets/alert-gbJBhAVE.js @@ -0,0 +1 @@ +import{d as r,j as s,G as d,ae as i}from"./index-DyXq7-Tg.js";const o=i("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),n=r.forwardRef(({className:e,variant:t,...a},l)=>s.jsx("div",{ref:l,role:"alert",className:d(o({variant:t}),e),...a}));n.displayName="Alert";const v=r.forwardRef(({className:e,...t},a)=>s.jsx("h5",{ref:a,className:d("mb-1 font-medium leading-none tracking-tight",e),...t}));v.displayName="AlertTitle";const c=r.forwardRef(({className:e,...t},a)=>s.jsx("div",{ref:a,className:d("text-sm [&_p]:leading-relaxed",e),...t}));c.displayName="AlertDescription";export{n as A,c as a}; diff --git a/assets/apiErrors-BSvbQBb0.js b/assets/apiErrors-BSvbQBb0.js new file mode 100644 index 0000000000000000000000000000000000000000..e239d538e255fb6c2658f00a09fd1cb5c8849b02 --- /dev/null +++ b/assets/apiErrors-BSvbQBb0.js @@ -0,0 +1 @@ +import{U as s}from"./index-DyXq7-Tg.js";const i=o=>o instanceof s&&o.status===404;export{i}; diff --git a/assets/apiErrors-BZ5h1Kmb.js b/assets/apiErrors-BZ5h1Kmb.js deleted file mode 100644 index 387767507722943d7b35510b17e4f020e03450a1..0000000000000000000000000000000000000000 --- a/assets/apiErrors-BZ5h1Kmb.js +++ /dev/null @@ -1 +0,0 @@ -import{K as s}from"./index-CbgxfyGU.js";const i=o=>o instanceof s&&o.status===404;export{i}; diff --git a/assets/arrow-left-Czeu3VzJ.js b/assets/arrow-left-PA_b6law.js similarity index 86% rename from assets/arrow-left-Czeu3VzJ.js rename to assets/arrow-left-PA_b6law.js index 42a1c9096ff41cd310871bd4b1602207d3ba9873..2ef032a4716d6d9a2fba327e180aa075859212dc 100644 --- a/assets/arrow-left-Czeu3VzJ.js +++ b/assets/arrow-left-PA_b6law.js @@ -1,4 +1,4 @@ -import{n as e}from"./index-CbgxfyGU.js";/** +import{s as e}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/arrow-right-DotD9yNb.js b/assets/arrow-right-BzPanrWZ.js similarity index 86% rename from assets/arrow-right-DotD9yNb.js rename to assets/arrow-right-BzPanrWZ.js index eb98b8c69a7926be78d7cacbb724eb030a71b6c0..598f909b9703d52b64a8c6c7328c6953165ae7f2 100644 --- a/assets/arrow-right-DotD9yNb.js +++ b/assets/arrow-right-BzPanrWZ.js @@ -1,4 +1,4 @@ -import{n as r}from"./index-CbgxfyGU.js";/** +import{s as r}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/badge-Klg-RRGs.js b/assets/badge-e6t3GCyf.js similarity index 90% rename from assets/badge-Klg-RRGs.js rename to assets/badge-e6t3GCyf.js index 65bcf7192c1c418ae98cb904d6719da4ee103291..e15f2ff6b6b1973d0425947b56c36d3045716ba1 100644 --- a/assets/badge-Klg-RRGs.js +++ b/assets/badge-e6t3GCyf.js @@ -1 +1 @@ -import{j as n,B as o,a8 as a}from"./index-CbgxfyGU.js";const s=a("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function d({className:r,variant:e,...t}){return n.jsx("div",{className:o(s({variant:e}),r),...t})}export{d as B}; +import{j as n,G as o,ae as a}from"./index-DyXq7-Tg.js";const s=a("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function d({className:r,variant:e,...t}){return n.jsx("div",{className:o(s({variant:e}),r),...t})}export{d as B}; diff --git a/assets/button-Bv9oZ-QU.js b/assets/button-DZeAbOf2.js similarity index 89% rename from assets/button-Bv9oZ-QU.js rename to assets/button-DZeAbOf2.js index cf0839bd7fe24ef5e7d64d545bbc803cf28f599c..7fdb915723fcda1724196185b46ca624707cab75 100644 --- a/assets/button-Bv9oZ-QU.js +++ b/assets/button-DZeAbOf2.js @@ -1 +1 @@ -import{r as a,j as d,at as u,B as c,a8 as f}from"./index-CbgxfyGU.js";const g=f("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),v=a.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},s)=>{const i=n?u:"button";return d.jsx(i,{className:c(g({variant:t,size:r,className:e})),ref:s,...o})});v.displayName="Button";export{v as B}; +import{d as a,j as d,az as u,G as c,ae as f}from"./index-DyXq7-Tg.js";const g=f("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),v=a.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},s)=>{const i=n?u:"button";return d.jsx(i,{className:c(g({variant:t,size:r,className:e})),ref:s,...o})});v.displayName="Button";export{v as B}; diff --git a/assets/catalog-DhK7_9-6.js b/assets/catalog-CRar2olQ.js similarity index 97% rename from assets/catalog-DhK7_9-6.js rename to assets/catalog-CRar2olQ.js index 097a7ab627b8897490fdc09faee65890eb3caf98..a54e4fed428b5e3554d79a0e7118fdfa94af5a42 100644 --- a/assets/catalog-DhK7_9-6.js +++ b/assets/catalog-CRar2olQ.js @@ -1 +1 @@ -import{a6 as o}from"./index-CbgxfyGU.js";function s(a,e){const t=new URLSearchParams;for(const[i,n]of Object.entries(e??{}))n!==void 0&&n!==""&&t.set(i,String(n));const r=t.toString();return`${a}${r?`?${r}`:""}`}class u{constructor(e){this.request=e}listAreas(e){return this.request(s("/areas/",e))}getArea(e){return this.request(`/areas/${e}`)}areasWithTasks(){return this.request("/areas/with-tasks/")}listTasks(e){return this.request(s("/tasks/",e))}getTask(e){return this.request(`/tasks/${e}`)}topTasks(e){return this.request(s("/tasks/top",{limit:e}))}trendingTasks(e){return this.request(s("/tasks/trending",e))}taskChildren(e,t){return this.request(s(`/tasks/${e}/children`,t))}taskParents(e){return this.request(`/tasks/${e}/parents`)}taskPage(e,t){return this.request(s(`/tasks/${e}/page`,t))}trendingBenchmarks(e,t){return this.request(s(`/tasks/${encodeURIComponent(e)}/trending-benchmarks`,t))}frameworkCatalog(){return this.request("/frameworks/")}listMethods(e){return this.request(s("/methods/",e))}methodIndex(){return this.request("/methods/index/cards")}trendingMethods(e){return this.request(s("/methods/trending",e))}getMethod(e){return this.request(`/methods/${encodeURIComponent(e)}`)}relatedMethods(e){return this.request(`/methods/${encodeURIComponent(e)}/related`)}methodTrend(e,t){return this.request(s(`/methods/${encodeURIComponent(e)}/trend`,t))}listDatasets(e){const{task_id:t,...r}=e??{};return this.request(s("/datasets/",{...r,task:r.task??t}))}getDataset(e){return this.request(`/datasets/${e}`)}getDatasetBySlug(e,t){return this.request(s(`/datasets/${e}`,t))}async datasetTasks(e){return(await this.request(`/datasets/${e}/tasks/`)).results}async leaderboardMetrics(e,t){return(await this.request(`/datasets/${e}/tasks/${t}/metrics`)).metrics}metricDirections(){return this.request("/metrics/directions")}conferences(){return this.request("/conferences/")}conferenceDeadlines(){return this.request("/conferences/deadlines")}getConference(e){return this.request(`/conferences/${e}`)}conferenceAreasWithTasks(e){return this.request(`/conferences/${e}/areas-with-tasks`)}organizations(e=!1){return this.request(`/organizations/${e?"?featured_only=true":""}`)}searchOrganizations(e,t){return this.request(s("/organizations/",{q:e,limit:t}))}organizationIndex(){return this.request("/organizations/index/cards")}getOrganization(e){return this.request(`/organizations/${e}`)}organizationContributions(e){return this.request(`/organizations/${e}/contributions`)}organizationAreasWithTasks(e){return this.request(`/organizations/${e}/areas-with-tasks`)}audit(e){return this.request(s("/admin/catalog-audit",{cursor:e}))}acknowledgeAudit(){return this.request("/admin/catalog-audit/acknowledge",{method:"POST"})}rollbackEvent(e){return this.request(`/admin/catalog-audit/${e}/rollback`,{method:"POST"})}}const d=new u(o);export{d as c}; +import{ac as o}from"./index-DyXq7-Tg.js";function s(a,e){const t=new URLSearchParams;for(const[i,n]of Object.entries(e??{}))n!==void 0&&n!==""&&t.set(i,String(n));const r=t.toString();return`${a}${r?`?${r}`:""}`}class u{constructor(e){this.request=e}listAreas(e){return this.request(s("/areas/",e))}getArea(e){return this.request(`/areas/${e}`)}areasWithTasks(){return this.request("/areas/with-tasks/")}listTasks(e){return this.request(s("/tasks/",e))}getTask(e){return this.request(`/tasks/${e}`)}topTasks(e){return this.request(s("/tasks/top",{limit:e}))}trendingTasks(e){return this.request(s("/tasks/trending",e))}taskChildren(e,t){return this.request(s(`/tasks/${e}/children`,t))}taskParents(e){return this.request(`/tasks/${e}/parents`)}taskPage(e,t){return this.request(s(`/tasks/${e}/page`,t))}trendingBenchmarks(e,t){return this.request(s(`/tasks/${encodeURIComponent(e)}/trending-benchmarks`,t))}frameworkCatalog(){return this.request("/frameworks/")}listMethods(e){return this.request(s("/methods/",e))}methodIndex(){return this.request("/methods/index/cards")}trendingMethods(e){return this.request(s("/methods/trending",e))}getMethod(e){return this.request(`/methods/${encodeURIComponent(e)}`)}relatedMethods(e){return this.request(`/methods/${encodeURIComponent(e)}/related`)}methodTrend(e,t){return this.request(s(`/methods/${encodeURIComponent(e)}/trend`,t))}listDatasets(e){const{task_id:t,...r}=e??{};return this.request(s("/datasets/",{...r,task:r.task??t}))}getDataset(e){return this.request(`/datasets/${e}`)}getDatasetBySlug(e,t){return this.request(s(`/datasets/${e}`,t))}async datasetTasks(e){return(await this.request(`/datasets/${e}/tasks/`)).results}async leaderboardMetrics(e,t){return(await this.request(`/datasets/${e}/tasks/${t}/metrics`)).metrics}metricDirections(){return this.request("/metrics/directions")}conferences(){return this.request("/conferences/")}conferenceDeadlines(){return this.request("/conferences/deadlines")}getConference(e){return this.request(`/conferences/${e}`)}conferenceAreasWithTasks(e){return this.request(`/conferences/${e}/areas-with-tasks`)}organizations(e=!1){return this.request(`/organizations/${e?"?featured_only=true":""}`)}searchOrganizations(e,t){return this.request(s("/organizations/",{q:e,limit:t}))}organizationIndex(){return this.request("/organizations/index/cards")}getOrganization(e){return this.request(`/organizations/${e}`)}organizationContributions(e){return this.request(`/organizations/${e}/contributions`)}organizationAreasWithTasks(e){return this.request(`/organizations/${e}/areas-with-tasks`)}audit(e){return this.request(s("/admin/catalog-audit",{cursor:e}))}acknowledgeAudit(){return this.request("/admin/catalog-audit/acknowledge",{method:"POST"})}rollbackEvent(e){return this.request(`/admin/catalog-audit/${e}/rollback`,{method:"POST"})}}const d=new u(o);export{d as c}; diff --git a/assets/chat-DzTo2WUO.js b/assets/chat-Ix1IrIwq.js similarity index 96% rename from assets/chat-DzTo2WUO.js rename to assets/chat-Ix1IrIwq.js index 684bce5c5cc86f3d7675cd117a9f6949236be76a..25965977561c41284ea1475b90e13e5cd944fb7d 100644 --- a/assets/chat-DzTo2WUO.js +++ b/assets/chat-Ix1IrIwq.js @@ -1 +1 @@ -import{a6 as n,as as r}from"./index-CbgxfyGU.js";class o{constructor(e){this.request=e}listSessions(e){const t=new URLSearchParams({limit:"50"});return e&&t.set("cursor",e),this.request(`/chat/sessions?${t.toString()}`)}createSession(e,t="low"){return this.request("/chat/sessions",{method:"POST",body:JSON.stringify({selected_model:e||null,reasoning_effort:t})})}getSession(e){return this.request(`/chat/sessions/${e}`)}updateSession(e,t){return this.request(`/chat/sessions/${e}`,{method:"PATCH",body:JSON.stringify(t)})}removeSession(e){return this.request(`/chat/sessions/${e}`,{method:"DELETE"})}archiveOldChats(){return this.request("/chat/sessions/archive-old",{method:"POST"})}archiveOldestChats(){return this.request("/chat/sessions/archive-oldest",{method:"POST"})}cancelSession(e){return this.request(`/chat/sessions/${e}/cancel`,{method:"POST"})}createOrRefreshShare(e){return this.request(`/chat/sessions/${e}/share`,{method:"POST"})}getSessionPublicShare(e){return this.request(`/chat/sessions/${encodeURIComponent(e)}/public-share`,{credentials:"omit"})}getSharedChat(e){return this.request(`/chat/shares/${encodeURIComponent(e)}`,{credentials:"omit"})}getModels(){return this.request("/chat/models")}getUsage(){return this.request("/chat/usage",{cache:"no-store"})}getOpenAIUsage(){return this.request("/chat/openai-usage",{cache:"no-store"})}getAvailability(){return this.request("/chat/availability",{cache:"no-store"})}getAutocompleteVocabulary(){return this.request("/chat/autocomplete-vocabulary")}getInferenceBilling(){return this.request("/me/inference-billing",{cache:"no-store"})}selectInferenceBillingAccount(e){return this.request("/me/inference-billing",{method:"PATCH",body:JSON.stringify({bill_to:e})})}prewarmPaperContext(e){return this.request("/chat/paper-context/prewarm",{method:"POST",body:JSON.stringify({route_id:e}),credentials:"omit",cache:"no-store"})}getSandboxSpend(e){const t=e?`?environment=${encodeURIComponent(e)}`:"";return this.request(`/chat/admin/sandbox-spend${t}`,{cache:"no-store"})}getWebSearchBudget(){return this.request("/chat/admin/web-search-budget",{cache:"no-store"})}getOpenRouterCredential(){return this.request("/chat/openrouter-key",{cache:"no-store"})}connectOpenRouterCredential(e){return this.request("/chat/openrouter-key",{method:"PUT",body:JSON.stringify({api_key:e})})}setOpenRouterFallback(e){return this.request("/chat/openrouter-key",{method:"PATCH",body:JSON.stringify({enabled:e})})}disconnectOpenRouterCredential(){return this.request("/chat/openrouter-key",{method:"DELETE"})}reportLatency(e,t){return r(`/chat/latency/${encodeURIComponent(e)}`,{method:"POST",keepalive:!0,body:JSON.stringify(t)})}reportFeedback(e,t,s){return this.request(`/chat/messages/${encodeURIComponent(e)}/feedback`,{method:"POST",body:JSON.stringify({value:t,...s?{comment:s}:{}})})}stream(e,t){return r("/chat/stream",{method:"POST",headers:{Accept:"text/event-stream"},body:JSON.stringify(e),signal:t})}resumeStream(e,t,s){return r(`/chat/sessions/${encodeURIComponent(e)}/stream`,{method:"GET",headers:{Accept:"text/event-stream",...s&&s>0?{"Last-Event-ID":String(s)}:{}},signal:t})}}const h=new o(n);export{h as c}; +import{ac as n,ay as r}from"./index-DyXq7-Tg.js";class o{constructor(e){this.request=e}listSessions(e){const t=new URLSearchParams({limit:"50"});return e&&t.set("cursor",e),this.request(`/chat/sessions?${t.toString()}`)}createSession(e,t="low"){return this.request("/chat/sessions",{method:"POST",body:JSON.stringify({selected_model:e||null,reasoning_effort:t})})}getSession(e){return this.request(`/chat/sessions/${e}`)}updateSession(e,t){return this.request(`/chat/sessions/${e}`,{method:"PATCH",body:JSON.stringify(t)})}removeSession(e){return this.request(`/chat/sessions/${e}`,{method:"DELETE"})}archiveOldChats(){return this.request("/chat/sessions/archive-old",{method:"POST"})}archiveOldestChats(){return this.request("/chat/sessions/archive-oldest",{method:"POST"})}cancelSession(e){return this.request(`/chat/sessions/${e}/cancel`,{method:"POST"})}createOrRefreshShare(e){return this.request(`/chat/sessions/${e}/share`,{method:"POST"})}getSessionPublicShare(e){return this.request(`/chat/sessions/${encodeURIComponent(e)}/public-share`,{credentials:"omit"})}getSharedChat(e){return this.request(`/chat/shares/${encodeURIComponent(e)}`,{credentials:"omit"})}getModels(){return this.request("/chat/models")}getUsage(){return this.request("/chat/usage",{cache:"no-store"})}getOpenAIUsage(){return this.request("/chat/openai-usage",{cache:"no-store"})}getAvailability(){return this.request("/chat/availability",{cache:"no-store"})}getAutocompleteVocabulary(){return this.request("/chat/autocomplete-vocabulary")}getInferenceBilling(){return this.request("/me/inference-billing",{cache:"no-store"})}selectInferenceBillingAccount(e){return this.request("/me/inference-billing",{method:"PATCH",body:JSON.stringify({bill_to:e})})}prewarmPaperContext(e){return this.request("/chat/paper-context/prewarm",{method:"POST",body:JSON.stringify({route_id:e}),credentials:"omit",cache:"no-store"})}getSandboxSpend(e){const t=e?`?environment=${encodeURIComponent(e)}`:"";return this.request(`/chat/admin/sandbox-spend${t}`,{cache:"no-store"})}getWebSearchBudget(){return this.request("/chat/admin/web-search-budget",{cache:"no-store"})}getOpenRouterCredential(){return this.request("/chat/openrouter-key",{cache:"no-store"})}connectOpenRouterCredential(e){return this.request("/chat/openrouter-key",{method:"PUT",body:JSON.stringify({api_key:e})})}setOpenRouterFallback(e){return this.request("/chat/openrouter-key",{method:"PATCH",body:JSON.stringify({enabled:e})})}disconnectOpenRouterCredential(){return this.request("/chat/openrouter-key",{method:"DELETE"})}reportLatency(e,t){return r(`/chat/latency/${encodeURIComponent(e)}`,{method:"POST",keepalive:!0,body:JSON.stringify(t)})}reportFeedback(e,t,s){return this.request(`/chat/messages/${encodeURIComponent(e)}/feedback`,{method:"POST",body:JSON.stringify({value:t,...s?{comment:s}:{}})})}stream(e,t){return r("/chat/stream",{method:"POST",headers:{Accept:"text/event-stream"},body:JSON.stringify(e),signal:t})}resumeStream(e,t,s){return r(`/chat/sessions/${encodeURIComponent(e)}/stream`,{method:"GET",headers:{Accept:"text/event-stream",...s&&s>0?{"Last-Event-ID":String(s)}:{}},signal:t})}}const c=new o(n);export{c}; diff --git a/assets/chatSessions-DwLUbLRo.js b/assets/chatSessions-Ck_dyM0d.js similarity index 85% rename from assets/chatSessions-DwLUbLRo.js rename to assets/chatSessions-Ck_dyM0d.js index 23b36ce40400e4d663419fd728b381ff81776f20..884b30955f111109da5f1d3a27f911b5dffbb8e5 100644 --- a/assets/chatSessions-DwLUbLRo.js +++ b/assets/chatSessions-Ck_dyM0d.js @@ -1,14 +1,14 @@ -import{j as h,M as f,K as ee,a5 as Oe}from"./index-CbgxfyGU.js";import{u as te}from"./useQuery-Bx9s5-D2.js";import{c as m}from"./chat-DzTo2WUO.js";import{a as be}from"./paperQueryKeys-B8u1BWlI.js";const Qe=({light:e})=>h.jsx("span",{className:`chat-spinner${e?" chat-spinner-light":""}`}),Je=({open:e})=>h.jsx("svg",{className:`chat-chev${e?" chat-chev-open":""}`,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:h.jsx("path",{d:"m6 9 6 6 6-6"})}),Ze=()=>h.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"9"}),h.jsx("path",{d:"m9 12 2 2 4-4"})]}),et=({size:e=14})=>h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"m21 21-4.3-4.3"})]}),tt=()=>h.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",children:h.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),rt=()=>h.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:h.jsx("path",{d:"M12 5v14M5 12h14"})}),nt=()=>h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[h.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),h.jsx("path",{d:"M9 4v16"})]}),at=()=>h.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:h.jsx("path",{d:"M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M6 6l1 14a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-14"})}),ot=({text:e,mentions:t,scrollTop:n=0,variant:r="composer",completion:a=""})=>{const i=[];let s=0;for(const o of[...t].sort((u,d)=>u.start-d.start)){const u=e.slice(o.start,o.end),d=u===o.title||u===`@${o.title}`;o.starte.length||!d||(i.push(e.slice(s,o.start)),i.push(h.jsx("span",{className:`chat-paper-inline-highlight${o.unavailable?" is-unavailable":""}`,"data-paper-route-id":o.route_id,children:u},o.key)),s=o.end)}return i.push(e.slice(s)),a&&i.push(h.jsx("span",{className:"chat-prompt-completion",children:a},"completion")),e.endsWith(` -`)&&i.push("​"),h.jsx("div",{"aria-hidden":"true",className:`chat-paper-highlight-layer chat-paper-highlight-layer-${r}`,children:h.jsx("div",{style:{transform:`translateY(-${n}px)`},children:i})})},st=({open:e,query:t,results:n,activeIndex:r,loading:a,error:i,onSelect:s,id:o="chat-paper-picker",optionIdPrefix:u="chat-paper-option"})=>{if(!e)return null;const d=t.trim()?a?"Searching papers…":i?"Paper search is unavailable":n.length?`${n.length} paper${n.length===1?"":"s"} found`:"No papers found":"Type to search papers";return h.jsxs("div",{className:"chat-paper-picker",id:o,role:"listbox","aria-label":"Paper results",children:[h.jsx("div",{className:"chat-paper-picker-status",role:"status","aria-live":"polite",children:d}),n.map((p,l)=>{const O=p.arxiv_id||p.id,k=p.arxiv_id||(()=>{try{return p.source_url?new URL(p.source_url).hostname:"External resource"}catch{return"External resource"}})();return h.jsxs("button",{type:"button",id:`${u}-${l}`,role:"option","aria-selected":l===r,className:`chat-paper-option${l===r?" is-active":""}`,onMouseDown:P=>{P.preventDefault(),s(p)},children:[h.jsx("span",{className:"chat-paper-option-title",children:p.title}),h.jsx("span",{className:"chat-paper-option-meta",children:k})]},O)})]})},Te=["What are decision models?","Find relevant papers on RLVR","What's the state-of-the-art for real-time object detection?"],Ee=[...Te,"What are the latest papers on ","Which benchmarks are used for ","Which methods work best for ","How does ","Explain how ","Compare ","Summarize the key contributions of "],Ce=3,Re=4,xe=new Set(["about","all","and","are","best","can","compare","does","explain","find","for","from","give","how","into","latest","list","method","methods","model","models","new","paper","papers","recent","show","state","summarize","task","tasks","the","this","use","what","when","where","which","who","why","with","work"]),ke=new RegExp(`(?:^|(?<=[\\s("'“‘]))(?=\\S)`,"g"),Ae=e=>{const t=e.toLowerCase(),n=Ee.find(r=>r.length>e.length&&r.toLowerCase().startsWith(t));return n?n.slice(e.length):""},De=(e,t)=>{const n=[...e.matchAll(ke)].map(r=>r.index??0);for(const r of n.slice(-4)){const a=e.slice(r),i=a.toLowerCase(),s=/\s/.test(a);if(a.length<(s?Ce:Re)||!s&&xe.has(i))continue;const o=t.find(u=>u.length>a.length&&u.toLowerCase().startsWith(i));if(o)return o.slice(a.length)}return""},Le=(e,t)=>!e.trim()||/\s$/.test(e)?"":Ae(e)||De(e,t);function it(e,t=!1){var p;const n=e.text,[r,a]=f.useState(null),i=te({queryKey:["chatAutocompleteVocabulary"],queryFn:()=>m.getAutocompleteVocabulary(),enabled:n.length>0,staleTime:1/0,gcTime:1/0,retry:!1}),s=(r==null?void 0:r.text)===n?r.atEnd:!0,o=e.paperMentions.some(l=>l.end===n.length);return{completion:!t&&s&&!o?Le(n,((p=i.data)==null?void 0:p.names)??[]):"",trackCaret:l=>a({text:l.value,atEnd:l.selectionStart===l.selectionEnd&&l.selectionEnd===l.value.length})}}const ct=e=>e.key==="Tab"&&!e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.nativeEvent.isComposing,lt=e=>{var n;const t=(n=e.parentElement)==null?void 0:n.querySelector(".chat-paper-highlight-layer");return Math.max(e.scrollHeight,(t==null?void 0:t.scrollHeight)??0)},re=8e3,ne=16384,ae=1e4,E={crossPage:"Select text within one PDF page.",outside:"Select text from the paper, not the surrounding interface.",tooLarge:"Select a shorter passage (maximum 8,000 characters)."};function oe(e){return new TextEncoder().encode(e).length}function se(e){return e.replace(/\r\n/g,` +import{j as h,V as f,b as ee,U as te,ab as Oe}from"./index-DyXq7-Tg.js";import{c as m}from"./chat-Ix1IrIwq.js";import{p as be}from"./papers-Dh3ljlL0.js";const Xe=({light:e})=>h.jsx("span",{className:`chat-spinner${e?" chat-spinner-light":""}`}),Qe=({open:e})=>h.jsx("svg",{className:`chat-chev${e?" chat-chev-open":""}`,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:h.jsx("path",{d:"m6 9 6 6 6-6"})}),Je=()=>h.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"12",cy:"12",r:"9"}),h.jsx("path",{d:"m9 12 2 2 4-4"})]}),Ze=({size:e=14})=>h.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"m21 21-4.3-4.3"})]}),et=()=>h.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",children:h.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),tt=()=>h.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:h.jsx("path",{d:"M12 5v14M5 12h14"})}),rt=()=>h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[h.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),h.jsx("path",{d:"M9 4v16"})]}),nt=()=>h.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:h.jsx("path",{d:"M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M6 6l1 14a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-14"})}),at=({text:e,mentions:t,scrollTop:n=0,variant:r="composer",completion:a=""})=>{const i=[];let s=0;for(const o of[...t].sort((u,d)=>u.start-d.start)){const u=e.slice(o.start,o.end),d=u===o.title||u===`@${o.title}`;o.starte.length||!d||(i.push(e.slice(s,o.start)),i.push(h.jsx("span",{className:`chat-paper-inline-highlight${o.unavailable?" is-unavailable":""}`,"data-paper-route-id":o.route_id,children:u},o.key)),s=o.end)}return i.push(e.slice(s)),a&&i.push(h.jsx("span",{className:"chat-prompt-completion",children:a},"completion")),e.endsWith(` +`)&&i.push("​"),h.jsx("div",{"aria-hidden":"true",className:`chat-paper-highlight-layer chat-paper-highlight-layer-${r}`,children:h.jsx("div",{style:{transform:`translateY(-${n}px)`},children:i})})},ot=({open:e,query:t,results:n,activeIndex:r,loading:a,error:i,onSelect:s,id:o="chat-paper-picker",optionIdPrefix:u="chat-paper-option"})=>{if(!e)return null;const d=t.trim()?a?"Searching papers…":i?"Paper search is unavailable":n.length?`${n.length} paper${n.length===1?"":"s"} found`:"No papers found":"Type to search papers";return h.jsxs("div",{className:"chat-paper-picker",id:o,role:"listbox","aria-label":"Paper results",children:[h.jsx("div",{className:"chat-paper-picker-status",role:"status","aria-live":"polite",children:d}),n.map((p,l)=>{const O=p.arxiv_id||p.id,k=p.arxiv_id||(()=>{try{return p.source_url?new URL(p.source_url).hostname:"External resource"}catch{return"External resource"}})();return h.jsxs("button",{type:"button",id:`${u}-${l}`,role:"option","aria-selected":l===r,className:`chat-paper-option${l===r?" is-active":""}`,onMouseDown:P=>{P.preventDefault(),s(p)},children:[h.jsx("span",{className:"chat-paper-option-title",children:p.title}),h.jsx("span",{className:"chat-paper-option-meta",children:k})]},O)})]})},Te=["What are decision models?","Find relevant papers on RLVR","What's the state-of-the-art for real-time object detection?"],Ee=[...Te,"What are the latest papers on ","Which benchmarks are used for ","Which methods work best for ","How does ","Explain how ","Compare ","Summarize the key contributions of "],Ce=3,Re=4,xe=new Set(["about","all","and","are","best","can","compare","does","explain","find","for","from","give","how","into","latest","list","method","methods","model","models","new","paper","papers","recent","show","state","summarize","task","tasks","the","this","use","what","when","where","which","who","why","with","work"]),ke=new RegExp(`(?:^|(?<=[\\s("'“‘]))(?=\\S)`,"g"),Ae=e=>{const t=e.toLowerCase(),n=Ee.find(r=>r.length>e.length&&r.toLowerCase().startsWith(t));return n?n.slice(e.length):""},De=(e,t)=>{const n=[...e.matchAll(ke)].map(r=>r.index??0);for(const r of n.slice(-4)){const a=e.slice(r),i=a.toLowerCase(),s=/\s/.test(a);if(a.length<(s?Ce:Re)||!s&&xe.has(i))continue;const o=t.find(u=>u.length>a.length&&u.toLowerCase().startsWith(i));if(o)return o.slice(a.length)}return""},Le=(e,t)=>!e.trim()||/\s$/.test(e)?"":Ae(e)||De(e,t);function st(e,t=!1){var p;const n=e.text,[r,a]=f.useState(null),i=ee({queryKey:["chatAutocompleteVocabulary"],queryFn:()=>m.getAutocompleteVocabulary(),enabled:n.length>0,staleTime:1/0,gcTime:1/0,retry:!1}),s=(r==null?void 0:r.text)===n?r.atEnd:!0,o=e.paperMentions.some(l=>l.end===n.length);return{completion:!t&&s&&!o?Le(n,((p=i.data)==null?void 0:p.names)??[]):"",trackCaret:l=>a({text:l.value,atEnd:l.selectionStart===l.selectionEnd&&l.selectionEnd===l.value.length})}}const it=e=>e.key==="Tab"&&!e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.nativeEvent.isComposing,ct=e=>{var n;const t=(n=e.parentElement)==null?void 0:n.querySelector(".chat-paper-highlight-layer");return Math.max(e.scrollHeight,(t==null?void 0:t.scrollHeight)??0)},re=8e3,ne=16384,ae=1e4,E={crossPage:"Select text within one PDF page.",outside:"Select text from the paper, not the surrounding interface.",tooLarge:"Select a shorter passage (maximum 8,000 characters)."};function oe(e){return new TextEncoder().encode(e).length}function se(e){return e.replace(/\r\n/g,` `).replace(/\r/g,` -`).replace(/\u00a0/g," ").replace(/[^\S\n]+/g," ").trim()}function ut(e){return`${e.routeId}\0${e.paperVersion}\0${e.page}\0${e.text}`}function dt(e){return{route_id:e.routeId,paper_version:e.paperVersion,page:e.page,text:e.text}}function L(e="",t){return t?{text:e,paperMentions:[],paperSelection:t}:{text:e,paperMentions:[]}}function V(e,t,n){return e.paperSelection?{text:t,paperMentions:n,paperSelection:e.paperSelection}:{text:t,paperMentions:n}}function Pe(e){if(!e||typeof e!="object")return;const t=e;if(typeof t.routeId!="string"||!t.routeId.trim()||typeof t.paperVersion!="string"||!t.paperVersion.trim())return;const n=t.page;if(typeof n!="number"||!Number.isInteger(n)||n<1||n>ae||typeof t.text!="string")return;const r=se(t.text);if(r&&!(r.length>re)&&!(oe(r)>ne))return{routeId:t.routeId.trim(),paperVersion:t.paperVersion.trim(),page:n,text:r}}function Ie(e,t){if(typeof e=="string")return L(e);if(!e||typeof e!="object")return t===void 0?null:L(t);const n=e;if(typeof n.text!="string"||!Array.isArray(n.paperMentions))return t===void 0?null:L(t);const r=Pe(n.paperSelection);return r?{text:n.text,paperMentions:n.paperMentions,paperSelection:r}:{text:n.text,paperMentions:n.paperMentions}}function ie(e){return e?e instanceof Element?e:e.parentElement:null}function $(e,t){const n=ie(e);if(!n||!t.contains(n)||!n.closest(".textLayer, .reader-web-document"))return null;const r=n.closest(".pdf-page[data-page], .reader-web-document[data-page]");if(!r||!t.contains(r))return null;const a=Number(r.dataset.page);return!Number.isInteger(a)||a<1||a>ae?null:a}function ht(e){const{selection:t,pagesRoot:n,routeId:r,paperVersion:a,numPages:i}=e;if(!n||!t||t.rangeCount!==1)return t&&t.rangeCount>1?{ok:!1,error:E.crossPage}:{ok:!1,error:null};const s=t.getRangeAt(0);if(s.collapsed)return{ok:!1,error:null};const o=$(s.startContainer,n),u=$(s.endContainer,n),d=ie(s.commonAncestorContainer);if(!d||!n.contains(d))return{ok:!1,error:E.outside};if(o===null||u===null)return{ok:!1,error:E.outside};if(o!==u)return{ok:!1,error:E.crossPage};if(i&&(o<1||o>i))return{ok:!1,error:E.crossPage};const p=t.toString(),l=se(p);return l?l.length>re||oe(l)>ne?{ok:!1,error:E.tooLarge}:{ok:!0,selection:{routeId:r,paperVersion:a,page:o,text:l}}:{ok:!1,error:E.crossPage}}const Ne=10,Me=3;function B(e,t){const r=e.slice(0,t).lastIndexOf("@");if(r<0)return null;const a=r>0?e[r-1]:"";if(a&&/[\p{L}\p{M}\p{N}_@]/u.test(a))return null;const i=e.slice(r+1,t);return/[\n\r@]/.test(i)?null:{start:r,end:t,query:i}}function K(e,t,n){let r=0;for(;ro.end<=r?[o]:o.start>=i?[{...o,start:o.start+s,end:o.end+s}]:[])}function pt({draft:e,onChange:t,enabled:n,textareaRef:r}){var q;const a=`chat-paper-picker-${f.useId().replace(/:/g,"")}`,i=`${a}-option`,[s,o]=f.useState(null),[u,d]=f.useState(""),[p,l]=f.useState(0),[O,k]=f.useState(""),P=f.useRef(new Set);f.useEffect(()=>{n||o(null)},[n]),f.useEffect(()=>{const c=window.setTimeout(()=>d((s==null?void 0:s.query.trim())??""),150);return()=>window.clearTimeout(c)},[s==null?void 0:s.query]);const R=te({queryKey:["chat-paper-mention-search",u.toLowerCase()],queryFn:({signal:c})=>be.search(u,1,10,"hybrid",c),enabled:n&&!!s&&u.length>=1,staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}),_=f.useMemo(()=>{var c;return((c=R.data)==null?void 0:c.results)??[]},[(q=R.data)==null?void 0:q.results]);f.useEffect(()=>l(0),[u]),f.useEffect(()=>{var c;(c=document.getElementById(`${i}-${p}`))==null||c.scrollIntoView({block:"nearest"})},[p,i]);const _e=f.useCallback(c=>{var w;if(!n){o(null);return}const g=c??((w=r.current)==null?void 0:w.selectionStart)??e.text.length;if(e.paperMentions.some(b=>g>b.start&&g<=b.end)){o(null);return}o(B(e.text,g))},[e.paperMentions,e.text,n,r]),we=f.useCallback((c,g)=>{var A;const w=K(e.text,c,e.paperMentions),b=V(e,c,w);t(b);const T=g??((A=r.current)==null?void 0:A.selectionStart)??c.length;n&&!w.some(D=>T>D.start&&T<=D.end)?o(B(c,T)):o(null)},[e,n,t,r]),j=f.useCallback(c=>{if(!s)return!1;const g=c.arxiv_id||c.id,w=new Set(e.paperMentions.map(x=>x.route_id));if(e.paperMentions.length>=Ne)return k("A message can contain at most 10 paper mentions."),!1;if(!w.has(g)&&w.size>=Me)return k("A message can attach at most 3 distinct papers."),!1;const b=c.title,T=e.text.slice(s.end),A=T.length===0,D=e.text.slice(0,s.start)+b+(A?" ":"")+T,Se=K(e.text,D,e.paperMentions),H={key:crypto.randomUUID(),route_id:g,title:c.title,source:c.source==="external"?"external":"arxiv",start:s.start,end:s.start+b.length};return t(V(e,D,[...Se,H].sort((x,I)=>x.start-I.start))),o(null),k(""),window.requestAnimationFrame(()=>{var I,U;const x=H.end+(A||T.startsWith(" ")?1:0);(I=r.current)==null||I.focus(),(U=r.current)==null||U.setSelectionRange(x,x)}),P.current.has(g)||(P.current.add(g),m.prewarmPaperContext(g).catch(()=>{})),!0},[s,e,t,r]),ve=f.useCallback(c=>!s||c.nativeEvent.isComposing?!1:c.key==="Tab"?(o(null),!1):c.key==="Escape"?(c.preventDefault(),o(null),!0):c.key==="ArrowDown"||c.key==="ArrowUp"?(c.preventDefault(),_.length&&l(g=>c.key==="ArrowDown"?(g+1)%_.length:(g-1+_.length)%_.length),!0):c.key==="Home"&&_.length?(c.preventDefault(),l(0),!0):c.key==="End"&&_.length?(c.preventDefault(),l(_.length-1),!0):c.key==="Enter"&&!c.shiftKey?(c.preventDefault(),_[p]?j(_[p]):R.isFetching||o(null),!0):!1,[s,p,_,R.isFetching,j]);return{open:!!s,query:(s==null?void 0:s.query)??"",results:_,activeIndex:p,loading:R.isFetching,error:R.isError,message:O,pickerId:a,optionIdPrefix:i,updateText:we,refresh:_e,select:j,keyDown:ve,close:()=>o(null)}}const y=(e,t)=>new Promise(n=>{const r=setTimeout(a,e);function a(){t==null||t.removeEventListener("abort",a),clearTimeout(r),n()}t==null||t.addEventListener("abort",a)}),v=e=>({arxiv_id:null,source:"arxiv",source_url:null,thumbnail_url:null,authors:[],published:null,conference:null,citation_count:null,tasks:[],methods:[],repositories:[],project_pages:[],...e}),S={name:"Object Detection",slug:"object-detection"},C={name:"Real-Time Object Detection",slug:"real-time-object-detection"},Ye={"2502.12524":{route_id:"2502.12524",title:"YOLOv12: Attention-Centric Real-Time Object Detectors",content:"Enhancing the network architecture of the YOLO framework has been crucial for a long time. This work introduces an attention-centric YOLO framework, namely YOLOv12, built around area attention and residual efficient layer aggregation networks (R-ELAN). YOLOv12-N reaches 40.6 mAP at 1.64 ms on a T4 GPU, closing the gap to attention-based detectors without the usual latency penalty and surpassing YOLOv10/YOLOv11 by +1.2–1.6 mAP at matched latency.",content_truncated:!1,metadata:v({arxiv_id:"2502.12524",authors:[{name:"Y. Tian"},{name:"Q. Ye"},{name:"D. Doermann"}],published:"2025-02-18",citation_count:412,tasks:[S,C],methods:[{name:"Area Attention",slug:"area-attention"}],repositories:[{url:"https://github.com/sunsmarterjie/yolov12",stars:18700}]})},"2407.17140":{route_id:"2407.17140",title:"RT-DETRv2: Improved Baseline with Bag-of-Freebies for Real-Time Detection",content:"RT-DETRv2 improves the real-time DETR baseline with selective multi-scale feature extraction, a discrete sampling operator to ease deployment, and training-only 'bag-of-freebies' that add no inference cost. RT-DETRv2-R18/R50/R101 reach 47.9 / 53.4 / 54.3 mAP on COCO at 217 / 108 / 74 FPS on T4 TensorRT FP16, remaining NMS-free end to end.",content_truncated:!1,metadata:v({arxiv_id:"2407.17140",authors:[{name:"W. Lv"},{name:"Y. Zhao"},{name:"J. Chang"}],published:"2024-07-24",citation_count:268,tasks:[S,C],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2410.13842":{route_id:"2410.13842",title:"D-FINE: Redefining Regression as Fine-grained Distribution Refinement",content:"D-FINE reformulates bounding-box regression in DETR-style detectors as iterative refinement of probability distributions (FDR) and adds a localization self-distillation scheme (GO-LSD). D-FINE-L reaches 54.0 mAP at ~9 ms and D-FINE-X 55.8 mAP on COCO while staying real-time on modern GPUs, dominating RT-DETRv2 and YOLOv10 on the accuracy–latency Pareto front.",content_truncated:!1,metadata:v({arxiv_id:"2410.13842",authors:[{name:"Y. Peng"},{name:"H. Li"},{name:"P. Wu"}],published:"2024-10-17",conference:"ICLR 2025",citation_count:187,tasks:[S,C],methods:[{name:"Knowledge Distillation",slug:"knowledge-distillation"}],repositories:[{url:"https://github.com/Peterande/D-FINE",stars:12100}]})},"2406.03459":{route_id:"2406.03459",title:"LW-DETR: A Transformer Replacement to YOLO for Real-Time Detection",content:"LW-DETR pairs a plain ViT encoder with a lightweight DETR decoder and shows the combination outperforms YOLOv8 and YOLO-NAS at comparable latency, arguing transformer detectors are viable even at the fast end of the accuracy–latency curve. Uses multi-level feature aggregation, window-attention interleaving, and IoU-aware classification.",content_truncated:!1,metadata:v({arxiv_id:"2406.03459",authors:[{name:"Q. Chen"},{name:"X. Su"},{name:"X. Zhang"}],published:"2024-06-05",citation_count:94,tasks:[S,C],methods:[{name:"Vision Transformer",slug:"vision-transformer"}],repositories:[{url:"https://github.com/Atten4Vis/LW-DETR",stars:5200}]})},"2304.08069":{route_id:"2304.08069",title:"DETRs Beat YOLOs on Real-time Object Detection",content:"RT-DETR is the first real-time end-to-end object detector, built on an efficient hybrid encoder that decouples intra-scale interaction and cross-scale fusion, plus IoU-aware query selection. RT-DETR-R50 achieves 53.1 mAP at 108 FPS on COCO, beating comparably sized YOLO detectors in both speed and accuracy while eliminating NMS entirely; its Figure 1 accuracy–latency plot became the reference for later real-time detectors.",content_truncated:!1,metadata:v({arxiv_id:"2304.08069",authors:[{name:"Y. Zhao"},{name:"W. Lv"},{name:"S. Xu"}],published:"2023-04-17",conference:"CVPR 2024",citation_count:2310,tasks:[S,C],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2405.14458":{route_id:"2405.14458",title:"YOLOv10: Real-Time End-to-End Object Detection",content:"YOLOv10 removes NMS from the YOLO pipeline via consistent dual assignments during training and applies a holistic efficiency–accuracy driven design across the architecture. YOLOv10-S is 1.8x faster than RT-DETR-R18 at similar COCO accuracy; the family spans 46.3–54.4 mAP with substantially lower end-to-end latency than prior YOLOs because post-processing disappears.",content_truncated:!1,metadata:v({arxiv_id:"2405.14458",authors:[{name:"A. Wang"},{name:"H. Chen"},{name:"L. Liu"}],published:"2024-05-23",conference:"NeurIPS 2024",citation_count:1650,tasks:[S,C],methods:[{name:"NMS-free Training",slug:"nms-free-training"}],repositories:[{url:"https://github.com/THU-MIG/yolov10",stars:44200}]})},"2401.17270":{route_id:"2401.17270",title:"YOLO-World: Real-Time Open-Vocabulary Object Detection",content:"YOLO-World extends the YOLO paradigm to open-vocabulary detection through vision-language modeling with a re-parameterizable vision-language path aggregation network (RepVL-PAN) and region-text contrastive pretraining. It detects categories never seen at training time while running at 35+ FPS, and its prompt-then-detect deployment re-parameterizes text embeddings for zero runtime text-encoder cost.",content_truncated:!1,metadata:v({arxiv_id:"2401.17270",authors:[{name:"T. Cheng"},{name:"L. Song"},{name:"Y. Ge"}],published:"2024-01-30",conference:"CVPR 2024",citation_count:890,tasks:[{name:"Open-Vocabulary Object Detection",slug:"open-vocabulary-object-detection"},S],methods:[{name:"Contrastive Learning",slug:"contrastive-learning"}],repositories:[{url:"https://github.com/AILab-CVC/YOLO-World",stars:16800}]})},158342:{route_id:"158342",title:"Ultralytics YOLO: real-time detection framework and model zoo",content:"Official Ultralytics framework release covering YOLO11 and YOLOv12 deployment: pretrained COCO checkpoints from nano to x-large, TensorRT/ONNX/CoreML export paths, and reproducible latency benchmarks on T4, Jetson Orin, and CPU targets. Widely used as the practical baseline for real-time detection deployments.",content_truncated:!1,metadata:v({source:"external",source_url:"https://docs.ultralytics.com/models/",authors:[{name:"Ultralytics"}],published:"2025-01-02",tasks:[S,C],repositories:[{url:"https://github.com/ultralytics/ultralytics",stars:46e3}],project_pages:[{url:"https://docs.ultralytics.com"}]})}},ce=e=>e.map(t=>Ye[t]),G=ce(["2502.12524","2407.17140","2410.13842","2406.03459","2304.08069","2405.14458","2401.17270","158342"]),z=ce(["2410.13842","2502.12524","2407.17140","2405.14458","2304.08069"]),X="The user wants the current state-of-the-art for real-time object detection. That's a moving target split across two lineages — the YOLO family (fast CNN one-stage detectors) and the DETR family (transformer, end-to-end, NMS-free). I should ground the answer in recent papers benchmarked on COCO with reported latency or FPS, not just accuracy. Let me start with a broad hybrid search, see which papers surface, then run a second, narrower query to pin down the head-to-head COCO mAP vs latency trade-offs before I write anything.",Q="Good — both lineages are well represented. YOLOv12, YOLOv10 and RT-DETRv2 / D-FINE keep coming up. To actually rank them I need the accuracy-vs-latency numbers side by side on the same COCO val2017 protocol, so let me narrow the query to the benchmark comparison specifically.",J=`There isn't a single winner — real-time object detection in 2026 is a two-horse race between the [YOLO family](paper:2502.12524) (fast one-stage CNNs) and the end-to-end [DETR family](paper:2304.08069) (NMS-free transformers). Which one is “SOTA” depends entirely on where you sit on the accuracy-vs-latency curve. +`).replace(/\u00a0/g," ").replace(/[^\S\n]+/g," ").trim()}function lt(e){return`${e.routeId}\0${e.paperVersion}\0${e.page}\0${e.text}`}function ut(e){return{route_id:e.routeId,paper_version:e.paperVersion,page:e.page,text:e.text}}function L(e="",t){return t?{text:e,paperMentions:[],paperSelection:t}:{text:e,paperMentions:[]}}function V(e,t,n){return e.paperSelection?{text:t,paperMentions:n,paperSelection:e.paperSelection}:{text:t,paperMentions:n}}function Pe(e){if(!e||typeof e!="object")return;const t=e;if(typeof t.routeId!="string"||!t.routeId.trim()||typeof t.paperVersion!="string"||!t.paperVersion.trim())return;const n=t.page;if(typeof n!="number"||!Number.isInteger(n)||n<1||n>ae||typeof t.text!="string")return;const r=se(t.text);if(r&&!(r.length>re)&&!(oe(r)>ne))return{routeId:t.routeId.trim(),paperVersion:t.paperVersion.trim(),page:n,text:r}}function Ie(e,t){if(typeof e=="string")return L(e);if(!e||typeof e!="object")return t===void 0?null:L(t);const n=e;if(typeof n.text!="string"||!Array.isArray(n.paperMentions))return t===void 0?null:L(t);const r=Pe(n.paperSelection);return r?{text:n.text,paperMentions:n.paperMentions,paperSelection:r}:{text:n.text,paperMentions:n.paperMentions}}function ie(e){return e?e instanceof Element?e:e.parentElement:null}function $(e,t){const n=ie(e);if(!n||!t.contains(n)||!n.closest(".textLayer, .reader-web-document"))return null;const r=n.closest(".pdf-page[data-page], .reader-web-document[data-page]");if(!r||!t.contains(r))return null;const a=Number(r.dataset.page);return!Number.isInteger(a)||a<1||a>ae?null:a}function dt(e){const{selection:t,pagesRoot:n,routeId:r,paperVersion:a,numPages:i}=e;if(!n||!t||t.rangeCount!==1)return t&&t.rangeCount>1?{ok:!1,error:E.crossPage}:{ok:!1,error:null};const s=t.getRangeAt(0);if(s.collapsed)return{ok:!1,error:null};const o=$(s.startContainer,n),u=$(s.endContainer,n),d=ie(s.commonAncestorContainer);if(!d||!n.contains(d))return{ok:!1,error:E.outside};if(o===null||u===null)return{ok:!1,error:E.outside};if(o!==u)return{ok:!1,error:E.crossPage};if(i&&(o<1||o>i))return{ok:!1,error:E.crossPage};const p=t.toString(),l=se(p);return l?l.length>re||oe(l)>ne?{ok:!1,error:E.tooLarge}:{ok:!0,selection:{routeId:r,paperVersion:a,page:o,text:l}}:{ok:!1,error:E.crossPage}}const Ne=10,Me=3;function B(e,t){const r=e.slice(0,t).lastIndexOf("@");if(r<0)return null;const a=r>0?e[r-1]:"";if(a&&/[\p{L}\p{M}\p{N}_@]/u.test(a))return null;const i=e.slice(r+1,t);return/[\n\r@]/.test(i)?null:{start:r,end:t,query:i}}function K(e,t,n){let r=0;for(;ro.end<=r?[o]:o.start>=i?[{...o,start:o.start+s,end:o.end+s}]:[])}function ht({draft:e,onChange:t,enabled:n,textareaRef:r}){var q;const a=`chat-paper-picker-${f.useId().replace(/:/g,"")}`,i=`${a}-option`,[s,o]=f.useState(null),[u,d]=f.useState(""),[p,l]=f.useState(0),[O,k]=f.useState(""),P=f.useRef(new Set);f.useEffect(()=>{n||o(null)},[n]),f.useEffect(()=>{const c=window.setTimeout(()=>d((s==null?void 0:s.query.trim())??""),150);return()=>window.clearTimeout(c)},[s==null?void 0:s.query]);const R=ee({queryKey:["chat-paper-mention-search",u.toLowerCase()],queryFn:({signal:c})=>be.search(u,1,10,"hybrid",c),enabled:n&&!!s&&u.length>=1,staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}),_=f.useMemo(()=>{var c;return((c=R.data)==null?void 0:c.results)??[]},[(q=R.data)==null?void 0:q.results]);f.useEffect(()=>l(0),[u]),f.useEffect(()=>{var c;(c=document.getElementById(`${i}-${p}`))==null||c.scrollIntoView({block:"nearest"})},[p,i]);const _e=f.useCallback(c=>{var w;if(!n){o(null);return}const g=c??((w=r.current)==null?void 0:w.selectionStart)??e.text.length;if(e.paperMentions.some(b=>g>b.start&&g<=b.end)){o(null);return}o(B(e.text,g))},[e.paperMentions,e.text,n,r]),we=f.useCallback((c,g)=>{var A;const w=K(e.text,c,e.paperMentions),b=V(e,c,w);t(b);const T=g??((A=r.current)==null?void 0:A.selectionStart)??c.length;n&&!w.some(D=>T>D.start&&T<=D.end)?o(B(c,T)):o(null)},[e,n,t,r]),j=f.useCallback(c=>{if(!s)return!1;const g=c.arxiv_id||c.id,w=new Set(e.paperMentions.map(x=>x.route_id));if(e.paperMentions.length>=Ne)return k("A message can contain at most 10 paper mentions."),!1;if(!w.has(g)&&w.size>=Me)return k("A message can attach at most 3 distinct papers."),!1;const b=c.title,T=e.text.slice(s.end),A=T.length===0,D=e.text.slice(0,s.start)+b+(A?" ":"")+T,Se=K(e.text,D,e.paperMentions),H={key:crypto.randomUUID(),route_id:g,title:c.title,source:c.source==="external"?"external":"arxiv",start:s.start,end:s.start+b.length};return t(V(e,D,[...Se,H].sort((x,I)=>x.start-I.start))),o(null),k(""),window.requestAnimationFrame(()=>{var I,U;const x=H.end+(A||T.startsWith(" ")?1:0);(I=r.current)==null||I.focus(),(U=r.current)==null||U.setSelectionRange(x,x)}),P.current.has(g)||(P.current.add(g),m.prewarmPaperContext(g).catch(()=>{})),!0},[s,e,t,r]),ve=f.useCallback(c=>!s||c.nativeEvent.isComposing?!1:c.key==="Tab"?(o(null),!1):c.key==="Escape"?(c.preventDefault(),o(null),!0):c.key==="ArrowDown"||c.key==="ArrowUp"?(c.preventDefault(),_.length&&l(g=>c.key==="ArrowDown"?(g+1)%_.length:(g-1+_.length)%_.length),!0):c.key==="Home"&&_.length?(c.preventDefault(),l(0),!0):c.key==="End"&&_.length?(c.preventDefault(),l(_.length-1),!0):c.key==="Enter"&&!c.shiftKey?(c.preventDefault(),_[p]?j(_[p]):R.isFetching||o(null),!0):!1,[s,p,_,R.isFetching,j]);return{open:!!s,query:(s==null?void 0:s.query)??"",results:_,activeIndex:p,loading:R.isFetching,error:R.isError,message:O,pickerId:a,optionIdPrefix:i,updateText:we,refresh:_e,select:j,keyDown:ve,close:()=>o(null)}}const y=(e,t)=>new Promise(n=>{const r=setTimeout(a,e);function a(){t==null||t.removeEventListener("abort",a),clearTimeout(r),n()}t==null||t.addEventListener("abort",a)}),v=e=>({arxiv_id:null,source:"arxiv",source_url:null,thumbnail_url:null,authors:[],published:null,conference:null,citation_count:null,tasks:[],methods:[],repositories:[],project_pages:[],...e}),S={name:"Object Detection",slug:"object-detection"},C={name:"Real-Time Object Detection",slug:"real-time-object-detection"},Ye={"2502.12524":{route_id:"2502.12524",title:"YOLOv12: Attention-Centric Real-Time Object Detectors",content:"Enhancing the network architecture of the YOLO framework has been crucial for a long time. This work introduces an attention-centric YOLO framework, namely YOLOv12, built around area attention and residual efficient layer aggregation networks (R-ELAN). YOLOv12-N reaches 40.6 mAP at 1.64 ms on a T4 GPU, closing the gap to attention-based detectors without the usual latency penalty and surpassing YOLOv10/YOLOv11 by +1.2–1.6 mAP at matched latency.",content_truncated:!1,metadata:v({arxiv_id:"2502.12524",authors:[{name:"Y. Tian"},{name:"Q. Ye"},{name:"D. Doermann"}],published:"2025-02-18",citation_count:412,tasks:[S,C],methods:[{name:"Area Attention",slug:"area-attention"}],repositories:[{url:"https://github.com/sunsmarterjie/yolov12",stars:18700}]})},"2407.17140":{route_id:"2407.17140",title:"RT-DETRv2: Improved Baseline with Bag-of-Freebies for Real-Time Detection",content:"RT-DETRv2 improves the real-time DETR baseline with selective multi-scale feature extraction, a discrete sampling operator to ease deployment, and training-only 'bag-of-freebies' that add no inference cost. RT-DETRv2-R18/R50/R101 reach 47.9 / 53.4 / 54.3 mAP on COCO at 217 / 108 / 74 FPS on T4 TensorRT FP16, remaining NMS-free end to end.",content_truncated:!1,metadata:v({arxiv_id:"2407.17140",authors:[{name:"W. Lv"},{name:"Y. Zhao"},{name:"J. Chang"}],published:"2024-07-24",citation_count:268,tasks:[S,C],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2410.13842":{route_id:"2410.13842",title:"D-FINE: Redefining Regression as Fine-grained Distribution Refinement",content:"D-FINE reformulates bounding-box regression in DETR-style detectors as iterative refinement of probability distributions (FDR) and adds a localization self-distillation scheme (GO-LSD). D-FINE-L reaches 54.0 mAP at ~9 ms and D-FINE-X 55.8 mAP on COCO while staying real-time on modern GPUs, dominating RT-DETRv2 and YOLOv10 on the accuracy–latency Pareto front.",content_truncated:!1,metadata:v({arxiv_id:"2410.13842",authors:[{name:"Y. Peng"},{name:"H. Li"},{name:"P. Wu"}],published:"2024-10-17",conference:"ICLR 2025",citation_count:187,tasks:[S,C],methods:[{name:"Knowledge Distillation",slug:"knowledge-distillation"}],repositories:[{url:"https://github.com/Peterande/D-FINE",stars:12100}]})},"2406.03459":{route_id:"2406.03459",title:"LW-DETR: A Transformer Replacement to YOLO for Real-Time Detection",content:"LW-DETR pairs a plain ViT encoder with a lightweight DETR decoder and shows the combination outperforms YOLOv8 and YOLO-NAS at comparable latency, arguing transformer detectors are viable even at the fast end of the accuracy–latency curve. Uses multi-level feature aggregation, window-attention interleaving, and IoU-aware classification.",content_truncated:!1,metadata:v({arxiv_id:"2406.03459",authors:[{name:"Q. Chen"},{name:"X. Su"},{name:"X. Zhang"}],published:"2024-06-05",citation_count:94,tasks:[S,C],methods:[{name:"Vision Transformer",slug:"vision-transformer"}],repositories:[{url:"https://github.com/Atten4Vis/LW-DETR",stars:5200}]})},"2304.08069":{route_id:"2304.08069",title:"DETRs Beat YOLOs on Real-time Object Detection",content:"RT-DETR is the first real-time end-to-end object detector, built on an efficient hybrid encoder that decouples intra-scale interaction and cross-scale fusion, plus IoU-aware query selection. RT-DETR-R50 achieves 53.1 mAP at 108 FPS on COCO, beating comparably sized YOLO detectors in both speed and accuracy while eliminating NMS entirely; its Figure 1 accuracy–latency plot became the reference for later real-time detectors.",content_truncated:!1,metadata:v({arxiv_id:"2304.08069",authors:[{name:"Y. Zhao"},{name:"W. Lv"},{name:"S. Xu"}],published:"2023-04-17",conference:"CVPR 2024",citation_count:2310,tasks:[S,C],methods:[{name:"DETR",slug:"detr"}],repositories:[{url:"https://github.com/lyuwenyu/RT-DETR",stars:9400}]})},"2405.14458":{route_id:"2405.14458",title:"YOLOv10: Real-Time End-to-End Object Detection",content:"YOLOv10 removes NMS from the YOLO pipeline via consistent dual assignments during training and applies a holistic efficiency–accuracy driven design across the architecture. YOLOv10-S is 1.8x faster than RT-DETR-R18 at similar COCO accuracy; the family spans 46.3–54.4 mAP with substantially lower end-to-end latency than prior YOLOs because post-processing disappears.",content_truncated:!1,metadata:v({arxiv_id:"2405.14458",authors:[{name:"A. Wang"},{name:"H. Chen"},{name:"L. Liu"}],published:"2024-05-23",conference:"NeurIPS 2024",citation_count:1650,tasks:[S,C],methods:[{name:"NMS-free Training",slug:"nms-free-training"}],repositories:[{url:"https://github.com/THU-MIG/yolov10",stars:44200}]})},"2401.17270":{route_id:"2401.17270",title:"YOLO-World: Real-Time Open-Vocabulary Object Detection",content:"YOLO-World extends the YOLO paradigm to open-vocabulary detection through vision-language modeling with a re-parameterizable vision-language path aggregation network (RepVL-PAN) and region-text contrastive pretraining. It detects categories never seen at training time while running at 35+ FPS, and its prompt-then-detect deployment re-parameterizes text embeddings for zero runtime text-encoder cost.",content_truncated:!1,metadata:v({arxiv_id:"2401.17270",authors:[{name:"T. Cheng"},{name:"L. Song"},{name:"Y. Ge"}],published:"2024-01-30",conference:"CVPR 2024",citation_count:890,tasks:[{name:"Open-Vocabulary Object Detection",slug:"open-vocabulary-object-detection"},S],methods:[{name:"Contrastive Learning",slug:"contrastive-learning"}],repositories:[{url:"https://github.com/AILab-CVC/YOLO-World",stars:16800}]})},158342:{route_id:"158342",title:"Ultralytics YOLO: real-time detection framework and model zoo",content:"Official Ultralytics framework release covering YOLO11 and YOLOv12 deployment: pretrained COCO checkpoints from nano to x-large, TensorRT/ONNX/CoreML export paths, and reproducible latency benchmarks on T4, Jetson Orin, and CPU targets. Widely used as the practical baseline for real-time detection deployments.",content_truncated:!1,metadata:v({source:"external",source_url:"https://docs.ultralytics.com/models/",authors:[{name:"Ultralytics"}],published:"2025-01-02",tasks:[S,C],repositories:[{url:"https://github.com/ultralytics/ultralytics",stars:46e3}],project_pages:[{url:"https://docs.ultralytics.com"}]})}},ce=e=>e.map(t=>Ye[t]),G=ce(["2502.12524","2407.17140","2410.13842","2406.03459","2304.08069","2405.14458","2401.17270","158342"]),z=ce(["2410.13842","2502.12524","2407.17140","2405.14458","2304.08069"]),X="The user wants the current state-of-the-art for real-time object detection. That's a moving target split across two lineages — the YOLO family (fast CNN one-stage detectors) and the DETR family (transformer, end-to-end, NMS-free). I should ground the answer in recent papers benchmarked on COCO with reported latency or FPS, not just accuracy. Let me start with a broad hybrid search, see which papers surface, then run a second, narrower query to pin down the head-to-head COCO mAP vs latency trade-offs before I write anything.",Q="Good — both lineages are well represented. YOLOv12, YOLOv10 and RT-DETRv2 / D-FINE keep coming up. To actually rank them I need the accuracy-vs-latency numbers side by side on the same COCO val2017 protocol, so let me narrow the query to the benchmark comparison specifically.",J=`There isn't a single winner — real-time object detection in 2026 is a two-horse race between the [YOLO family](paper:2502.12524) (fast one-stage CNNs) and the end-to-end [DETR family](paper:2304.08069) (NMS-free transformers). Which one is “SOTA” depends entirely on where you sit on the accuracy-vs-latency curve. **At the fast / edge end**, [YOLOv12](paper:2502.12524) is the current leader. Its area-attention design pushes attention into the YOLO backbone without the usual latency hit — YOLOv12-N reaches 40.6 mAP at ~1.6 ms on a T4, roughly +1.5 mAP over [YOLOv10](paper:2405.14458) at matched speed. [YOLOv10](paper:2405.14458) is still very relevant because it made the YOLO head NMS-free, cutting real end-to-end latency. **At the high-accuracy end**, the transformer detectors win. [D-FINE](paper:2410.13842) currently holds the accuracy-latency Pareto front, reporting 55.8 mAP by reformulating box regression as fine-grained distribution refinement with self-distillation. It builds on [RT-DETRv2](paper:2407.17140), which hardened the [original RT-DETR](paper:2304.08069) recipe (the paper that first showed DETRs beating YOLOs in real time) with training-only “bag-of-freebies” that add no inference cost. -**My recommendation:** for edge or high-FPS deployment, start with [YOLOv12](paper:2502.12524) — the [Ultralytics framework](paper:158342) has ready-made checkpoints and export paths. If you have GPU headroom and want maximum accuracy while staying real-time, use [D-FINE](paper:2410.13842) or [RT-DETRv2](paper:2407.17140). And if you need open-vocabulary detection rather than fixed COCO classes, [YOLO-World](paper:2401.17270) is the one to look at.`,je=["How do these compare on edge devices like Jetson?","Show me open-vocabulary detectors","What about small-object detection?"];async function*Fe(e,t){const n=()=>(t==null?void 0:t.aborted)===!0,r=e.trim().slice(0,90)||"state-of-the-art real-time object detection";if(yield{type:"stream_start",request_id:"req_mock",session_id:null},await y(350,t),!n()){yield{type:"reasoning_start"};for(let a=0;a{const t=String("0").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"},ft=()=>!0;class F extends Error{constructor(t,n,r,a){super(t),this.code=n,this.status=r,this.retryAfterSeconds=a,this.name="ChatStreamError"}}class Z extends Error{constructor(t="The assistant stream was interrupted."){super(t),this.name="ChatTransportError"}}function mt(e,t){if(ue())try{m.reportLatency(e,t).catch(()=>{})}catch{}}function gt(e,t={}){return ue()?We(e,t):Fe(e.message,t.signal)}function yt(e,t={}){return qe(e,t)}async function*We(e,t){try{const n=await m.stream(e,t.signal);yield*he(n,t)}catch(n){throw de(n)}}async function*qe(e,t){try{const n=await m.resumeStream(e,t.signal,t.afterSequence);yield*he(n,t)}catch(n){throw de(n)}}function de(e){return e instanceof F||e instanceof Z?e:e instanceof SyntaxError?new F("The assistant returned an invalid stream event.","invalid_stream_event"):new Z(e instanceof Error?e.message:"The assistant stream was interrupted.")}function He(e){let t=null,n="message";const r=[];for(const a of e.split(` +**My recommendation:** for edge or high-FPS deployment, start with [YOLOv12](paper:2502.12524) — the [Ultralytics framework](paper:158342) has ready-made checkpoints and export paths. If you have GPU headroom and want maximum accuracy while staying real-time, use [D-FINE](paper:2410.13842) or [RT-DETRv2](paper:2407.17140). And if you need open-vocabulary detection rather than fixed COCO classes, [YOLO-World](paper:2401.17270) is the one to look at.`,je=["How do these compare on edge devices like Jetson?","Show me open-vocabulary detectors","What about small-object detection?"];async function*Fe(e,t){const n=()=>(t==null?void 0:t.aborted)===!0,r=e.trim().slice(0,90)||"state-of-the-art real-time object detection";if(yield{type:"stream_start",request_id:"req_mock",session_id:null},await y(350,t),!n()){yield{type:"reasoning_start"};for(let a=0;a{const t=String("0").trim().toLowerCase();return t==="1"||t==="true"||t==="yes"},pt=()=>!0;class F extends Error{constructor(t,n,r,a){super(t),this.code=n,this.status=r,this.retryAfterSeconds=a,this.name="ChatStreamError"}}class Z extends Error{constructor(t="The assistant stream was interrupted."){super(t),this.name="ChatTransportError"}}function ft(e,t){if(ue())try{m.reportLatency(e,t).catch(()=>{})}catch{}}function mt(e,t={}){return ue()?We(e,t):Fe(e.message,t.signal)}function gt(e,t={}){return qe(e,t)}async function*We(e,t){try{const n=await m.stream(e,t.signal);yield*he(n,t)}catch(n){throw de(n)}}async function*qe(e,t){try{const n=await m.resumeStream(e,t.signal,t.afterSequence);yield*he(n,t)}catch(n){throw de(n)}}function de(e){return e instanceof F||e instanceof Z?e:e instanceof SyntaxError?new F("The assistant returned an invalid stream event.","invalid_stream_event"):new Z(e instanceof Error?e.message:"The assistant stream was interrupted.")}function He(e){let t=null,n="message";const r=[];for(const a of e.split(` `))if(a.startsWith("id:")){const i=a.slice(3).trim();/^[1-9]\d*$/.test(i)&&(t=Number(i))}else a.startsWith("event:")?n=a.slice(6).trimStart():a.startsWith("data:")&&r.push(a.slice(5).trimStart());return{sequence:t,event:n,data:r.join(` -`)}}async function*he(e,t){var s;if(!e.ok||!e.body){const o=e.ok?null:new ee(e,await e.text());o&&Oe(o);const u=o==null?void 0:o.detail,d=typeof u=="object"&&u!==null?u:null,p=e.status===403&&!u,l=Number(e.headers.get("Retry-After")),O=Number.isFinite(l)&&l>=0?Math.min(300,Math.ceil(l)):void 0;throw new F(p?"Chat on staging is limited to approved Hugging Face users. Sign in with an approved account and try again.":(o==null?void 0:o.message)||`Chat stream failed (${e.status})`,d&&"code"in d&&typeof d.code=="string"?d.code:p?"staging_access_required":void 0,e.status,O)}const n=e.body.getReader(),r=new TextDecoder;let a="",i=t.afterSequence&&t.afterSequence>0?t.afterSequence:0;try{for(;;){const{done:o,value:u}=await n.read();if(o)break;a+=r.decode(u,{stream:!0});let d;for(;(d=a.indexOf(` +`)}}async function*he(e,t){var s;if(!e.ok||!e.body){const o=e.ok?null:new te(e,await e.text());o&&Oe(o);const u=o==null?void 0:o.detail,d=typeof u=="object"&&u!==null?u:null,p=e.status===403&&!u,l=Number(e.headers.get("Retry-After")),O=Number.isFinite(l)&&l>=0?Math.min(300,Math.ceil(l)):void 0;throw new F(p?"Chat on staging is limited to approved Hugging Face users. Sign in with an approved account and try again.":(o==null?void 0:o.message)||`Chat stream failed (${e.status})`,d&&"code"in d&&typeof d.code=="string"?d.code:p?"staging_access_required":void 0,e.status,O)}const n=e.body.getReader(),r=new TextDecoder;let a="",i=t.afterSequence&&t.afterSequence>0?t.afterSequence:0;try{for(;;){const{done:o,value:u}=await n.read();if(o)break;a+=r.decode(u,{stream:!0});let d;for(;(d=a.indexOf(` -`))!==-1;){const p=a.slice(0,d);a=a.slice(d+2);const l=He(p);if(!l.data||l.data==="[DONE]"||l.sequence!==null&&l.sequence<=i)continue;const O=JSON.parse(l.data);l.sequence!==null&&(i=l.sequence,(s=t.onSequence)==null||s.call(t,l.sequence)),yield O}}}finally{n.releaseLock()}}const W="pwc:chat-oauth-draft",N="pwc:chat-oauth-model",M="pwc:chat-oauth-auto-send",Ue="pwc:chat-oauth-attempted",Y="pwc:chat-reasoning-effort";function _t(e,t,n={}){const r=typeof e=="string"?e:e.text,a=r.length-r.trimStart().length,i=r.trim();if(!i)return;const s=a+i.length,o=typeof e=="string"?[]:e.paperMentions.filter(d=>d.start>=a&&d.end<=s).map(d=>({...d,start:d.start-a,end:d.end-a})),u={text:i,paperMentions:o,...typeof e!="string"&&e.paperSelection?{paperSelection:e.paperSelection}:{}};sessionStorage.setItem(W,u.paperMentions.length||u.paperSelection?JSON.stringify(u):i),n.autoSend===!1?sessionStorage.removeItem(M):sessionStorage.setItem(M,"1"),t?sessionStorage.setItem(N,t):sessionStorage.removeItem(N),sessionStorage.setItem(Y,n.reasoningEffort??le)}function wt(){var r;if(typeof window>"u"||sessionStorage.getItem(M)!=="1")return null;const e=(r=sessionStorage.getItem(W))==null?void 0:r.trim();if(!e)return null;let t=L(e);try{t=Ie(JSON.parse(e),e)??L(e)}catch{}const n=t.text.trim();return n?{prompt:n,draft:{...t,text:n},model:sessionStorage.getItem(N),reasoningEffort:["low","medium","high","max"].includes(sessionStorage.getItem(Y)??"")?sessionStorage.getItem(Y):"low"}:null}function vt(){sessionStorage.removeItem(W),sessionStorage.removeItem(N),sessionStorage.removeItem(M),sessionStorage.removeItem(Ue),sessionStorage.removeItem(Y)}const pe="gpt-5.6-luna@openai",Ve="deepseek-ai/DeepSeek-V4-Flash-0731",$e="openai/gpt-5.6-luna",fe="deepseek-ai/DeepSeek-V4.1-Flash-1017";function St(e,t){var n;return((n=e.find(r=>r.id===t))==null?void 0:n.provider)??(t===$e?"openrouter":t===pe?"openai":"huggingface")}function Ot(e,t){const n=e.find(r=>r.id===t);return n?n.sponsored===!0:t===fe}const bt=[{id:pe,label:"GPT-6 Luna",provider:"openai"},{id:fe,label:"DeepSeek V4.1 Flash",provider:"huggingface",sponsored:!0}],Tt=[{id:Ve,label:"DeepSeek V4 Flash",provider:"huggingface"},{id:"moonshotai/Kimi-K3",label:"Kimi K3",provider:"huggingface"},{id:"gpt-5.6-luna@openrouter",label:"GPT-5.6 Luna",provider:"openrouter"},{id:"gpt-5.6-luna@openai",label:"GPT-6 Luna (Direct)",provider:"openai"}];class Be extends Error{constructor(t,n){super(t),this.status=n}}async function Et(){const e=[];let t=null;do{const n=await m.listSessions(t);e.push(...n.items),t=n.next_cursor}while(t&&e.length<100);return e}function Ct(e,t=le){return m.createSession(e,t)}function Rt(e){return m.getSession(e)}function xt(e,t){return m.updateSession(e,t)}function kt(e){return m.removeSession(e)}function At(){return m.archiveOldChats()}function Dt(){return m.archiveOldestChats()}function Lt(e){return m.cancelSession(e)}function Pt(e){return m.createOrRefreshShare(e)}async function It(e){try{return await m.getSharedChat(e)}catch(t){throw t instanceof ee?new Be(t.message,t.status):t}}async function Nt(){return m.getModels()}function me(e,t){return e.display_blocks.length===0&&e.content?[{kind:"answer",text:e.content,done:!0}]:ge(e.display_blocks,t)}function ge(e,t){const n=e.map(r=>r.kind==="reasoning"?{...r,active:!1,open:!1}:r.kind==="tool"?{...r,status:r.status==="running"?"error":r.status,open:t&&(r.status==="error"||r.status==="denied"||r.status==="running")}:r.kind==="app"?{...r,schema_version:1,result:r.result??{content:[],structuredContent:{},isError:!1},csp:r.csp??{},permissions:r.permissions??{clipboardWrite:!0},height:r.height||525,public_fork:!!r.public_fork}:r.kind==="artifact"?{...r}:{...r,done:!0});return n.filter((r,a)=>{const i=n[a-1];return!(r.kind==="reasoning"&&(i==null?void 0:i.kind)==="reasoning"&&r.text===i.text)})}function ye(e){if(e!=null&&e.text)return{routeId:e.route_id,paperVersion:e.paper_version,page:e.page,text:e.text}}function Mt(e){const t=r=>r==="hf_inference_billing_exhausted"?"Hugging Face could not bill this request. Your included credits may be exhausted; enable or review pay-as-you-go billing in Settings.":r==="hf_inference_credential_expired"?"Your Hugging Face Inference Providers authorization is missing or expired. Re-sign in with Hugging Face to continue.":r==="provider_rate_limit"?"The selected model is temporarily rate-limited. Try again shortly.":r==="provider_timeout"?"The model provider timed out. Try again shortly.":r==="openrouter_monthly_budget_exhausted"?"The remaining shared Papers With Code OpenRouter allowance was not enough to continue this response.":r==="openrouter_staging_funding_disabled"?"Shared staging credits have ended because chat is now live on paperswithcode.co. Continue there with your included monthly allowance.":r==="openrouter_unavailable"?"OpenRouter is currently unavailable. However, you can still bring your own key in Settings.":r==="openrouter_byok_credential_invalid"?"Your OpenRouter API key is no longer valid. Reconnect it in Settings, then try again.":r==="openrouter_byok_billing_error"?"Your OpenRouter key is connected, but OpenRouter rejected billing for the account behind it. A key spending limit is not an account credit balance. Add credits or enable pay-as-you-go in OpenRouter, then try again.":r==="openrouter_byok_rate_limit"?"Your OpenRouter API key is temporarily rate-limited.":r==="openai_budget_exhausted"?"The Papers With Code direct OpenAI allowance is exhausted. Select another model or try again later.":r==="context_too_large"?"This conversation is too large for the selected model. Start a new chat or shorten the context.":["provider_error","provider_unavailable"].includes(r??"")?"The model provider failed before completing the response. You can edit and retry your question.":r==="persistence_error"?"The response could not be saved. You can edit and retry your question.":r==="transcript_mirror_error"?"The conversation could not be saved. Please try again in a new chat.":r==="external_worker_lost"?"The assistant worker lost contact before the response could be saved. You can edit and retry your question.":"The response did not complete. You can edit and retry your question.",n=r=>r==null||["cancelled","interrupted","stopped"].includes(r);return e.messages.flatMap(r=>{if(r.role==="assistant")return[{id:r.id,role:"assistant",blocks:me(r,!0),followups:r.followups,citations:r.citations,finishReason:r.finish_reason??void 0,streaming:!1}];const a={id:r.id,role:"user",text:r.content,paperMentions:(r.paper_mentions??[]).map(s=>({...s,key:s.occurrence_id})),paperSelection:ye(r.paper_selection),revision:r.revision,status:r.status,error:r.status==="complete"?void 0:r.error_code||r.status};if(!["error","interrupted"].includes(r.status))return[a];const i=r.status==="interrupted"&&n(r.error_code);return[a,{id:`${r.id}-${r.status==="interrupted"?"interrupted":"error"}`,role:"assistant",blocks:ge(r.display_blocks,!0),streaming:!1,finishReason:i?"stopped":void 0,error:i?void 0:t(r.error_code),errorCode:i?void 0:r.error_code??void 0}]})}function Yt(e){return e.messages.map(t=>t.role==="user"?{id:t.id,role:"user",text:t.content,paperMentions:(t.paper_mentions??[]).map(n=>({...n,key:n.occurrence_id})),paperSelection:ye(t.paper_selection)}:{id:t.id,role:"assistant",blocks:me(t,!1),citations:t.citations,finishReason:t.finish_reason??void 0,error:t.error??void 0,streaming:!1})}function jt(e){const t=Date.now(),n=new Date().setHours(0,0,0,0),r=[{label:"Today",items:[]},{label:"Previous 7 Days",items:[]},{label:"Previous 30 Days",items:[]},{label:"Older",items:[]}];for(const a of[...e].sort((i,s)=>Date.parse(s.updated_at)-Date.parse(i.updated_at))){const i=Date.parse(a.updated_at),s=t-i;i>=n?r[0].items.push(a):s<7*864e5?r[1].items.push(a):s<30*864e5?r[2].items.push(a):r[3].items.push(a)}return r.filter(a=>a.items.length>0)}export{Ze as $,tt as A,ft as B,Be as C,pe as D,Rt as E,Mt as F,Et as G,wt as H,Tt as I,bt as J,St as K,Ot as L,W as M,N,Y as O,ot as P,M as Q,Ue as R,Te as S,at as T,vt as U,Nt as V,Ie as W,xt as X,kt as Y,ht as Z,ut as _,it as a,Je as a0,et as a1,st as b,lt as c,Ct as d,Qe as e,ue as f,It as g,rt as h,ct as i,nt as j,jt as k,Pt as l,Dt as m,At as n,Z as o,Yt as p,_t as q,mt as r,yt as s,F as t,pt as u,L as v,le as w,Lt as x,dt as y,gt as z}; +`))!==-1;){const p=a.slice(0,d);a=a.slice(d+2);const l=He(p);if(!l.data||l.data==="[DONE]"||l.sequence!==null&&l.sequence<=i)continue;const O=JSON.parse(l.data);l.sequence!==null&&(i=l.sequence,(s=t.onSequence)==null||s.call(t,l.sequence)),yield O}}}finally{n.releaseLock()}}const W="pwc:chat-oauth-draft",N="pwc:chat-oauth-model",M="pwc:chat-oauth-auto-send",Ue="pwc:chat-oauth-attempted",Y="pwc:chat-reasoning-effort";function yt(e,t,n={}){const r=typeof e=="string"?e:e.text,a=r.length-r.trimStart().length,i=r.trim();if(!i)return;const s=a+i.length,o=typeof e=="string"?[]:e.paperMentions.filter(d=>d.start>=a&&d.end<=s).map(d=>({...d,start:d.start-a,end:d.end-a})),u={text:i,paperMentions:o,...typeof e!="string"&&e.paperSelection?{paperSelection:e.paperSelection}:{}};sessionStorage.setItem(W,u.paperMentions.length||u.paperSelection?JSON.stringify(u):i),n.autoSend===!1?sessionStorage.removeItem(M):sessionStorage.setItem(M,"1"),t?sessionStorage.setItem(N,t):sessionStorage.removeItem(N),sessionStorage.setItem(Y,n.reasoningEffort??le)}function _t(){var r;if(typeof window>"u"||sessionStorage.getItem(M)!=="1")return null;const e=(r=sessionStorage.getItem(W))==null?void 0:r.trim();if(!e)return null;let t=L(e);try{t=Ie(JSON.parse(e),e)??L(e)}catch{}const n=t.text.trim();return n?{prompt:n,draft:{...t,text:n},model:sessionStorage.getItem(N),reasoningEffort:["low","medium","high","max"].includes(sessionStorage.getItem(Y)??"")?sessionStorage.getItem(Y):"low"}:null}function wt(){sessionStorage.removeItem(W),sessionStorage.removeItem(N),sessionStorage.removeItem(M),sessionStorage.removeItem(Ue),sessionStorage.removeItem(Y)}const pe="gpt-5.6-luna@openai",Ve="deepseek-ai/DeepSeek-V4-Flash-0731",$e="openai/gpt-5.6-luna",fe="deepseek-ai/DeepSeek-V4.1-Flash-1017";function vt(e,t){var n;return((n=e.find(r=>r.id===t))==null?void 0:n.provider)??(t===$e?"openrouter":t===pe?"openai":"huggingface")}function St(e,t){const n=e.find(r=>r.id===t);return n?n.sponsored===!0:t===fe}const Ot=[{id:pe,label:"GPT-6 Luna",provider:"openai"},{id:fe,label:"DeepSeek V4.1 Flash",provider:"huggingface",sponsored:!0}],bt=[{id:Ve,label:"DeepSeek V4 Flash",provider:"huggingface"},{id:"moonshotai/Kimi-K3",label:"Kimi K3",provider:"huggingface"},{id:"gpt-5.6-luna@openrouter",label:"GPT-5.6 Luna",provider:"openrouter"},{id:"gpt-5.6-luna@openai",label:"GPT-6 Luna (Direct)",provider:"openai"}];class Be extends Error{constructor(t,n){super(t),this.status=n}}async function Tt(){const e=[];let t=null;do{const n=await m.listSessions(t);e.push(...n.items),t=n.next_cursor}while(t&&e.length<100);return e}function Et(e,t=le){return m.createSession(e,t)}function Ct(e){return m.getSession(e)}function Rt(e,t){return m.updateSession(e,t)}function xt(e){return m.removeSession(e)}function kt(){return m.archiveOldChats()}function At(){return m.archiveOldestChats()}function Dt(e){return m.cancelSession(e)}function Lt(e){return m.createOrRefreshShare(e)}async function Pt(e){try{return await m.getSharedChat(e)}catch(t){throw t instanceof te?new Be(t.message,t.status):t}}async function It(){return m.getModels()}function me(e,t){return e.display_blocks.length===0&&e.content?[{kind:"answer",text:e.content,done:!0}]:ge(e.display_blocks,t)}function ge(e,t){const n=e.map(r=>r.kind==="reasoning"?{...r,active:!1,open:!1}:r.kind==="tool"?{...r,status:r.status==="running"?"error":r.status,open:t&&(r.status==="error"||r.status==="denied"||r.status==="running")}:r.kind==="app"?{...r,schema_version:1,result:r.result??{content:[],structuredContent:{},isError:!1},csp:r.csp??{},permissions:r.permissions??{clipboardWrite:!0},height:r.height||525,public_fork:!!r.public_fork}:r.kind==="artifact"?{...r}:{...r,done:!0});return n.filter((r,a)=>{const i=n[a-1];return!(r.kind==="reasoning"&&(i==null?void 0:i.kind)==="reasoning"&&r.text===i.text)})}function ye(e){if(e!=null&&e.text)return{routeId:e.route_id,paperVersion:e.paper_version,page:e.page,text:e.text}}function Nt(e){const t=r=>r==="hf_inference_billing_exhausted"?"Hugging Face could not bill this request. Your included credits may be exhausted; enable or review pay-as-you-go billing in Settings.":r==="hf_inference_credential_expired"?"Your Hugging Face Inference Providers authorization is missing or expired. Re-sign in with Hugging Face to continue.":r==="provider_rate_limit"?"The selected model is temporarily rate-limited. Try again shortly.":r==="provider_timeout"?"The model provider timed out. Try again shortly.":r==="openrouter_monthly_budget_exhausted"?"The remaining shared Papers With Code OpenRouter allowance was not enough to continue this response.":r==="openrouter_staging_funding_disabled"?"Shared staging credits have ended because chat is now live on paperswithcode.co. Continue there with your included monthly allowance.":r==="openrouter_unavailable"?"OpenRouter is currently unavailable. However, you can still bring your own key in Settings.":r==="openrouter_byok_credential_invalid"?"Your OpenRouter API key is no longer valid. Reconnect it in Settings, then try again.":r==="openrouter_byok_billing_error"?"Your OpenRouter key is connected, but OpenRouter rejected billing for the account behind it. A key spending limit is not an account credit balance. Add credits or enable pay-as-you-go in OpenRouter, then try again.":r==="openrouter_byok_rate_limit"?"Your OpenRouter API key is temporarily rate-limited.":r==="openai_budget_exhausted"?"The Papers With Code direct OpenAI allowance is exhausted. Select another model or try again later.":r==="context_too_large"?"This conversation is too large for the selected model. Start a new chat or shorten the context.":["provider_error","provider_unavailable"].includes(r??"")?"The model provider failed before completing the response. You can edit and retry your question.":r==="persistence_error"?"The response could not be saved. You can edit and retry your question.":r==="transcript_mirror_error"?"The conversation could not be saved. Please try again in a new chat.":r==="external_worker_lost"?"The assistant worker lost contact before the response could be saved. You can edit and retry your question.":"The response did not complete. You can edit and retry your question.",n=r=>r==null||["cancelled","interrupted","stopped"].includes(r);return e.messages.flatMap(r=>{if(r.role==="assistant")return[{id:r.id,role:"assistant",blocks:me(r,!0),followups:r.followups,citations:r.citations,finishReason:r.finish_reason??void 0,streaming:!1}];const a={id:r.id,role:"user",text:r.content,paperMentions:(r.paper_mentions??[]).map(s=>({...s,key:s.occurrence_id})),paperSelection:ye(r.paper_selection),revision:r.revision,status:r.status,error:r.status==="complete"?void 0:r.error_code||r.status};if(!["error","interrupted"].includes(r.status))return[a];const i=r.status==="interrupted"&&n(r.error_code);return[a,{id:`${r.id}-${r.status==="interrupted"?"interrupted":"error"}`,role:"assistant",blocks:ge(r.display_blocks,!0),streaming:!1,finishReason:i?"stopped":void 0,error:i?void 0:t(r.error_code),errorCode:i?void 0:r.error_code??void 0}]})}function Mt(e){return e.messages.map(t=>t.role==="user"?{id:t.id,role:"user",text:t.content,paperMentions:(t.paper_mentions??[]).map(n=>({...n,key:n.occurrence_id})),paperSelection:ye(t.paper_selection)}:{id:t.id,role:"assistant",blocks:me(t,!1),citations:t.citations,finishReason:t.finish_reason??void 0,error:t.error??void 0,streaming:!1})}function Yt(e){const t=Date.now(),n=new Date().setHours(0,0,0,0),r=[{label:"Today",items:[]},{label:"Previous 7 Days",items:[]},{label:"Previous 30 Days",items:[]},{label:"Older",items:[]}];for(const a of[...e].sort((i,s)=>Date.parse(s.updated_at)-Date.parse(i.updated_at))){const i=Date.parse(a.updated_at),s=t-i;i>=n?r[0].items.push(a):s<7*864e5?r[1].items.push(a):s<30*864e5?r[2].items.push(a):r[3].items.push(a)}return r.filter(a=>a.items.length>0)}export{Je as $,et as A,pt as B,Be as C,pe as D,Ct as E,Nt as F,Tt as G,_t as H,bt as I,Ot as J,vt as K,St as L,W as M,N,Y as O,at as P,M as Q,Ue as R,Te as S,nt as T,wt as U,It as V,Ie as W,Rt as X,xt as Y,dt as Z,lt as _,st as a,Qe as a0,Ze as a1,ot as b,ct as c,Et as d,Xe as e,ue as f,Pt as g,tt as h,it as i,rt as j,Yt as k,Lt as l,At as m,kt as n,Z as o,Mt as p,yt as q,ft as r,gt as s,F as t,ht as u,L as v,le as w,Dt as x,ut as y,mt as z}; diff --git a/assets/chevron-up-Cpt5JLeI.js b/assets/chevron-up-DYSYRyvz.js similarity index 74% rename from assets/chevron-up-Cpt5JLeI.js rename to assets/chevron-up-DYSYRyvz.js index af0fb73ca33f013191d5e4a4f879a8e99c1fe9da..4b76e66518ea0db72969e3920c04e80e11ce5057 100644 --- a/assets/chevron-up-Cpt5JLeI.js +++ b/assets/chevron-up-DYSYRyvz.js @@ -1,11 +1,11 @@ -import{n as o}from"./index-CbgxfyGU.js";/** +import{s as o}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const e=o("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const n=o("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const r=o("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);export{r as C,e as a}; + */const r=o("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);export{r as C,n as a}; diff --git a/assets/circle-check-Bci9ZTu9.js b/assets/circle-check-GGlu5UCV.js similarity index 87% rename from assets/circle-check-Bci9ZTu9.js rename to assets/circle-check-GGlu5UCV.js index 4b804d90610068940b1510f2298a55c67cbc3444..21de91c199ce0dfca6e7b026156dab6f50681af4 100644 --- a/assets/circle-check-Bci9ZTu9.js +++ b/assets/circle-check-GGlu5UCV.js @@ -1,4 +1,4 @@ -import{n as c}from"./index-CbgxfyGU.js";/** +import{s as c}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/codex-Bl7j51l-.js b/assets/codex-DFj4KHqP.js similarity index 95% rename from assets/codex-Bl7j51l-.js rename to assets/codex-DFj4KHqP.js index 640cd22c0035b3a25ba6fc87ae2c0c6e5bc4a4f3..6e47b913c6a949944e5f305ddbd3452974580487 100644 --- a/assets/codex-Bl7j51l-.js +++ b/assets/codex-DFj4KHqP.js @@ -1 +1 @@ -import{a6 as i,a0 as c}from"./index-CbgxfyGU.js";const u="No paper text was available yet. This job starts again automatically within an hour of the paper's Markdown being extracted.",r="/admin/codex-curation/jobs";class n{constructor(e){this.request=e}startPaperJob(e,t){return this.request(`/admin/codex-${e}/jobs`,{method:"POST",body:JSON.stringify({paper_id:t})})}getPaperJob(e,t){return this.request(`/admin/codex-${e}/jobs/${t}`)}cancelPaperJob(e,t){return this.request(`/admin/codex-${e}/jobs/${t}`,{method:"DELETE"})}listJobs(e=100,t={}){const a=new URLSearchParams({limit:String(e)});return Object.entries(t).forEach(([o,s])=>{s&&a.set(o,s)}),this.request(`${r}?${a}`,{cache:"no-store"})}retryJob(e){return this.request(`${r}/${e}/retry`,{method:"POST"})}cancelJob(e){return this.request(`${r}/${e}`,{method:"DELETE"})}async retryTrace(e){await this.request(`${r}/${e}/retry-trace`,{method:"POST"})}async setScheduler(e){await this.request(`${r}/scheduler/${e}`,{method:"POST"})}async promoteBenchmarkCandidate(e,t){await this.request(`${r}/benchmark-candidates/${e}/promote`,{method:"POST",body:JSON.stringify(t)})}async rollbackBenchmarkCandidate(e){await this.request(`${r}/benchmark-candidates/${e}/rollback`,{method:"POST"})}traceUrl(e){return c(`/api/v1${r}/${e}/trace`)}}const m=new n(i);export{u as A,m as c}; +import{ac as i,a6 as c}from"./index-DyXq7-Tg.js";const u="No paper text was available yet. This job starts again automatically within an hour of the paper's Markdown being extracted.",r="/admin/codex-curation/jobs";class n{constructor(e){this.request=e}startPaperJob(e,t){return this.request(`/admin/codex-${e}/jobs`,{method:"POST",body:JSON.stringify({paper_id:t})})}getPaperJob(e,t){return this.request(`/admin/codex-${e}/jobs/${t}`)}cancelPaperJob(e,t){return this.request(`/admin/codex-${e}/jobs/${t}`,{method:"DELETE"})}listJobs(e=100,t={}){const a=new URLSearchParams({limit:String(e)});return Object.entries(t).forEach(([o,s])=>{s&&a.set(o,s)}),this.request(`${r}?${a}`,{cache:"no-store"})}retryJob(e){return this.request(`${r}/${e}/retry`,{method:"POST"})}cancelJob(e){return this.request(`${r}/${e}`,{method:"DELETE"})}async retryTrace(e){await this.request(`${r}/${e}/retry-trace`,{method:"POST"})}async setScheduler(e){await this.request(`${r}/scheduler/${e}`,{method:"POST"})}async promoteBenchmarkCandidate(e,t){await this.request(`${r}/benchmark-candidates/${e}/promote`,{method:"POST",body:JSON.stringify(t)})}async rollbackBenchmarkCandidate(e){await this.request(`${r}/benchmark-candidates/${e}/rollback`,{method:"POST"})}traceUrl(e){return c(`/api/v1${r}/${e}/trace`)}}const m=new n(i);export{u as A,m as c}; diff --git a/assets/copy-bzw7JVus.js b/assets/copy-CxR0OKx2.js similarity index 89% rename from assets/copy-bzw7JVus.js rename to assets/copy-CxR0OKx2.js index bd21172ed0e91cc11c0703b1d79b734a0074f746..9d0971f0de38b9f100bf5ac6c1beffb962f53885 100644 --- a/assets/copy-bzw7JVus.js +++ b/assets/copy-CxR0OKx2.js @@ -1,4 +1,4 @@ -import{n as e}from"./index-CbgxfyGU.js";/** +import{s as e}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/curation-C7Gmmp4z.js b/assets/curation-YeS7FBYf.js similarity index 96% rename from assets/curation-C7Gmmp4z.js rename to assets/curation-YeS7FBYf.js index d0ca352d0607684a0bcea77b01df48b329c9fd7e..16c9a899c953355b2efbe79167be4afe95115071 100644 --- a/assets/curation-C7Gmmp4z.js +++ b/assets/curation-YeS7FBYf.js @@ -1 +1 @@ -var f=Object.defineProperty;var w=(i,e,t)=>e in i?f(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var d=(i,e,t)=>w(i,typeof e!="symbol"?e+"":e,t);import{K as l,aX as g,a6 as v}from"./index-CbgxfyGU.js";const y={tasks:"tasks",methods:"methods",organizations:"organizations",repositories:"GitHub repositories",project_pages:"project pages",hf_artifacts:"Hugging Face artifacts",source_url:"source URL",x_threads:"X threads",evaluations:"evaluation results"};function _(i){return Object.prototype.hasOwnProperty.call(y,i)}const p="pwc:fresh-auth-edit",c="pwc:fresh-auth-mutation";function E(i){if(typeof window>"u")return;sessionStorage.setItem(p,i);const e=g("/api/v1/auth/hf/login");window.location.assign(`${e}?return_to=${encodeURIComponent(window.location.href)}`)}class S{constructor(e,t=E){d(this,"paperLoads",new Map);d(this,"evaluationLoads",new Map);this.request=e,this.recoverFreshAuth=t}primePaper(e,t=!1){t&&this.paperLoads.delete(e);let s=this.paperLoads.get(e);return s||(s=this.request(`/papers/${e}/curation-state`).catch(o=>{throw this.paperLoads.delete(e),o}),this.paperLoads.set(e,s)),s}primeEvaluations(e,t=!1){t&&this.evaluationLoads.delete(e);let s=this.evaluationLoads.get(e);return s||(s=this.request(`/evaluations/curation-state?paper_id=${e}`).catch(o=>{throw this.evaluationLoads.delete(e),o}),this.evaluationLoads.set(e,s)),s}async mutatePaper(e,t,s,o,a){const r=this.paperLoads.get(e);if(!r)throw new Error("The catalog version was not loaded when this editor opened. Close and reopen the editor.");const h=(await r).sections[t];if(!h)throw new Error(`Missing curation version for ${t}`);return this.mutate(t,o,s,h,a,`paper:${e}:${t}`)}async mutateEvaluations(e,t,s,o){const a=this.evaluationLoads.get(String(e));if(!a)throw new Error("The evaluation version was not loaded when this editor opened. Close and reopen the editor.");const r=(await a).version;return this.mutate("evaluations",s,t,r,o,`paper:${e}:evaluations`)}async mutate(e,t,s,o,a,r){const h=new Headers(a.headers);Object.entries(this.idempotencyHeaders(r,s,o)).forEach(([n,m])=>h.set(n,m));const u={...a,headers:h};try{const n=await this.request(t,u);return this.clearAttempt(u),n}catch(n){throw n instanceof l&&n.status===401&&n.code==="fresh_auth_required"?(this.saveFreshAuthMutation(e,t,s,u),this.recoverFreshAuth(e)):n instanceof l&&n.status===409&&(this.clearAttempt(u),typeof window<"u"&&window.dispatchEvent(new CustomEvent("pwc:catalog-conflict",{detail:{endpoint:t}}))),n}}freshAuthMutationDraft(){const e=sessionStorage.getItem(c);if(!e)return null;try{const t=JSON.parse(e);if(!t.endpoint.startsWith("/")||t.endpoint.startsWith("//")||!["POST","PUT","PATCH","DELETE"].includes(t.options.method))throw new Error("Invalid saved mutation draft");return t}catch{return sessionStorage.removeItem(c),null}}async resumeFreshAuthMutation(){const e=this.freshAuthMutationDraft();if(!e)throw new Error("No saved catalog edit is available.");const t=await this.request(e.endpoint,{method:e.options.method,body:e.options.body,headers:e.options.headers});return this.clearAttempt({headers:e.options.headers}),sessionStorage.removeItem(c),sessionStorage.removeItem(p),t}saveFreshAuthMutation(e,t,s,o){const a=Object.fromEntries(new Headers(o.headers).entries()),r=typeof o.body=="string"?o.body:void 0;sessionStorage.setItem(c,JSON.stringify({section:e,endpoint:t,payload:s,options:{method:(o.method??"POST").toUpperCase(),body:r,headers:a}}))}idempotencyHeaders(e,t,s){const o=`pwc:mutation:${e}:${JSON.stringify(t)}`,a=sessionStorage.getItem(o);if(a){const h=JSON.parse(a);return{"Idempotency-Key":h.key,"If-Match":h.version}}const r=crypto.randomUUID();return sessionStorage.setItem(o,JSON.stringify({key:r,version:s})),sessionStorage.setItem(`pwc:mutation-key:${r}`,o),{"Idempotency-Key":r,"If-Match":s}}clearAttempt(e){const t=new Headers(e.headers).get("Idempotency-Key");if(!t)return;const s=sessionStorage.getItem(`pwc:mutation-key:${t}`);s&&sessionStorage.removeItem(s),sessionStorage.removeItem(`pwc:mutation-key:${t}`),this.paperLoads.clear(),this.evaluationLoads.clear()}}const T=new S(v);export{p as F,y as P,_ as i,T as p}; +var f=Object.defineProperty;var w=(i,e,t)=>e in i?f(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var d=(i,e,t)=>w(i,typeof e!="symbol"?e+"":e,t);import{U as l,b2 as g,ac as v}from"./index-DyXq7-Tg.js";const y={tasks:"tasks",methods:"methods",organizations:"organizations",repositories:"GitHub repositories",project_pages:"project pages",hf_artifacts:"Hugging Face artifacts",source_url:"source URL",x_threads:"X threads",evaluations:"evaluation results"};function _(i){return Object.prototype.hasOwnProperty.call(y,i)}const p="pwc:fresh-auth-edit",c="pwc:fresh-auth-mutation";function E(i){if(typeof window>"u")return;sessionStorage.setItem(p,i);const e=g("/api/v1/auth/hf/login");window.location.assign(`${e}?return_to=${encodeURIComponent(window.location.href)}`)}class S{constructor(e,t=E){d(this,"paperLoads",new Map);d(this,"evaluationLoads",new Map);this.request=e,this.recoverFreshAuth=t}primePaper(e,t=!1){t&&this.paperLoads.delete(e);let s=this.paperLoads.get(e);return s||(s=this.request(`/papers/${e}/curation-state`).catch(o=>{throw this.paperLoads.delete(e),o}),this.paperLoads.set(e,s)),s}primeEvaluations(e,t=!1){t&&this.evaluationLoads.delete(e);let s=this.evaluationLoads.get(e);return s||(s=this.request(`/evaluations/curation-state?paper_id=${e}`).catch(o=>{throw this.evaluationLoads.delete(e),o}),this.evaluationLoads.set(e,s)),s}async mutatePaper(e,t,s,o,a){const r=this.paperLoads.get(e);if(!r)throw new Error("The catalog version was not loaded when this editor opened. Close and reopen the editor.");const h=(await r).sections[t];if(!h)throw new Error(`Missing curation version for ${t}`);return this.mutate(t,o,s,h,a,`paper:${e}:${t}`)}async mutateEvaluations(e,t,s,o){const a=this.evaluationLoads.get(String(e));if(!a)throw new Error("The evaluation version was not loaded when this editor opened. Close and reopen the editor.");const r=(await a).version;return this.mutate("evaluations",s,t,r,o,`paper:${e}:evaluations`)}async mutate(e,t,s,o,a,r){const h=new Headers(a.headers);Object.entries(this.idempotencyHeaders(r,s,o)).forEach(([n,m])=>h.set(n,m));const u={...a,headers:h};try{const n=await this.request(t,u);return this.clearAttempt(u),n}catch(n){throw n instanceof l&&n.status===401&&n.code==="fresh_auth_required"?(this.saveFreshAuthMutation(e,t,s,u),this.recoverFreshAuth(e)):n instanceof l&&n.status===409&&(this.clearAttempt(u),typeof window<"u"&&window.dispatchEvent(new CustomEvent("pwc:catalog-conflict",{detail:{endpoint:t}}))),n}}freshAuthMutationDraft(){const e=sessionStorage.getItem(c);if(!e)return null;try{const t=JSON.parse(e);if(!t.endpoint.startsWith("/")||t.endpoint.startsWith("//")||!["POST","PUT","PATCH","DELETE"].includes(t.options.method))throw new Error("Invalid saved mutation draft");return t}catch{return sessionStorage.removeItem(c),null}}async resumeFreshAuthMutation(){const e=this.freshAuthMutationDraft();if(!e)throw new Error("No saved catalog edit is available.");const t=await this.request(e.endpoint,{method:e.options.method,body:e.options.body,headers:e.options.headers});return this.clearAttempt({headers:e.options.headers}),sessionStorage.removeItem(c),sessionStorage.removeItem(p),t}saveFreshAuthMutation(e,t,s,o){const a=Object.fromEntries(new Headers(o.headers).entries()),r=typeof o.body=="string"?o.body:void 0;sessionStorage.setItem(c,JSON.stringify({section:e,endpoint:t,payload:s,options:{method:(o.method??"POST").toUpperCase(),body:r,headers:a}}))}idempotencyHeaders(e,t,s){const o=`pwc:mutation:${e}:${JSON.stringify(t)}`,a=sessionStorage.getItem(o);if(a){const h=JSON.parse(a);return{"Idempotency-Key":h.key,"If-Match":h.version}}const r=crypto.randomUUID();return sessionStorage.setItem(o,JSON.stringify({key:r,version:s})),sessionStorage.setItem(`pwc:mutation-key:${r}`,o),{"Idempotency-Key":r,"If-Match":s}}clearAttempt(e){const t=new Headers(e.headers).get("Idempotency-Key");if(!t)return;const s=sessionStorage.getItem(`pwc:mutation-key:${t}`);s&&sessionStorage.removeItem(s),sessionStorage.removeItem(`pwc:mutation-key:${t}`),this.paperLoads.clear(),this.evaluationLoads.clear()}}const T=new S(v);export{p as F,y as P,_ as i,T as p}; diff --git a/assets/database-CTvEb5JG.js b/assets/database-DflzbaZ5.js similarity index 89% rename from assets/database-CTvEb5JG.js rename to assets/database-DflzbaZ5.js index e60464fc5c4551ae3ded8905f414a2824e07237c..a95a8128a159bcf64a30e016ab49654ed11374b0 100644 --- a/assets/database-CTvEb5JG.js +++ b/assets/database-DflzbaZ5.js @@ -1,4 +1,4 @@ -import{n as e}from"./index-CbgxfyGU.js";/** +import{s as e}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/dialog-Cfp_d3CC.js b/assets/dialog-CfM0Uql2.js similarity index 93% rename from assets/dialog-Cfp_d3CC.js rename to assets/dialog-CfM0Uql2.js index 1896313f8e5223296f93ceeeaed740e28c31de89..d2e5cfb07dbae68d669a8ad967e3ffea04f8fdd9 100644 --- a/assets/dialog-Cfp_d3CC.js +++ b/assets/dialog-CfM0Uql2.js @@ -1 +1 @@ -import{aa as f,r as l,j as t,ab as p,ad as d,af as g,X as x,B as o,ac as n,ag as i,ah as r}from"./index-CbgxfyGU.js";const w=f,u=p,c=l.forwardRef(({className:a,...e},s)=>t.jsx(n,{ref:s,className:o("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...e}));c.displayName=n.displayName;const y=l.forwardRef(({className:a,children:e,...s},m)=>t.jsxs(u,{children:[t.jsx(c,{}),t.jsxs(d,{ref:m,className:o("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...s,children:[e,t.jsxs(g,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[t.jsx(x,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));y.displayName=d.displayName;const N=({className:a,...e})=>t.jsx("div",{className:o("flex flex-col space-y-1.5 text-center sm:text-left",a),...e});N.displayName="DialogHeader";const j=({className:a,...e})=>t.jsx("div",{className:o("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...e});j.displayName="DialogFooter";const D=l.forwardRef(({className:a,...e},s)=>t.jsx(i,{ref:s,className:o("text-lg font-semibold leading-none tracking-tight",a),...e}));D.displayName=i.displayName;const b=l.forwardRef(({className:a,...e},s)=>t.jsx(r,{ref:s,className:o("text-sm text-muted-foreground",a),...e}));b.displayName=r.displayName;export{w as D,y as a,D as b,N as c,b as d,j as e}; +import{ag as f,d as l,j as t,ah as p,aj as d,al as g,X as x,G as o,ai as n,am as i,an as r}from"./index-DyXq7-Tg.js";const w=f,u=p,c=l.forwardRef(({className:a,...e},s)=>t.jsx(n,{ref:s,className:o("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...e}));c.displayName=n.displayName;const y=l.forwardRef(({className:a,children:e,...s},m)=>t.jsxs(u,{children:[t.jsx(c,{}),t.jsxs(d,{ref:m,className:o("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...s,children:[e,t.jsxs(g,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[t.jsx(x,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));y.displayName=d.displayName;const N=({className:a,...e})=>t.jsx("div",{className:o("flex flex-col space-y-1.5 text-center sm:text-left",a),...e});N.displayName="DialogHeader";const j=({className:a,...e})=>t.jsx("div",{className:o("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...e});j.displayName="DialogFooter";const D=l.forwardRef(({className:a,...e},s)=>t.jsx(i,{ref:s,className:o("text-lg font-semibold leading-none tracking-tight",a),...e}));D.displayName=i.displayName;const b=l.forwardRef(({className:a,...e},s)=>t.jsx(r,{ref:s,className:o("text-sm text-muted-foreground",a),...e}));b.displayName=r.displayName;export{w as D,y as a,D as b,N as c,b as d,j as e}; diff --git a/assets/evaluationQueryInvalidation-BogLM1gw.js b/assets/evaluationQueryInvalidation-BogLM1gw.js deleted file mode 100644 index 84d39e5917d70a92b0da9e86a5b773dff5b8dbd4..0000000000000000000000000000000000000000 --- a/assets/evaluationQueryInvalidation-BogLM1gw.js +++ /dev/null @@ -1 +0,0 @@ -var D=i=>{throw TypeError(i)};var K=(i,e,t)=>e.has(i)||D("Cannot "+t);var c=(i,e,t)=>(K(i,e,"read from private field"),t?t.call(i):e.get(i)),m=(i,e,t)=>e.has(i)?D("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),l=(i,e,t,s)=>(K(i,e,"write to private field"),s?s.call(i,t):e.set(i,t),t),y=(i,e,t)=>(K(i,e,"access private method"),t);import{ax as N,ay as A,az as V,aA as X,f as Y,r as _,aB as Z}from"./index-CbgxfyGU.js";import{Q as T,a as W,b as ee,e as se,c as te,d as re,s as U,f as ae,g as ie}from"./useQuery-Bx9s5-D2.js";import{i as ne,a as oe}from"./queryInvalidation-Chlw4DEx.js";function j(i,e){const t=new Set(e);return i.filter(s=>!t.has(s))}function ue(i,e,t){const s=i.slice(0);return s[e]=t,s}var C,p,w,E,g,Q,x,M,I,P,h,H,L,G,q,$,z,F,ce=(F=class extends N{constructor(e,t,s){super();m(this,h);m(this,C);m(this,p);m(this,w);m(this,E);m(this,g);m(this,Q);m(this,x);m(this,M);m(this,I);m(this,P,[]);l(this,C,e),l(this,E,s),l(this,w,[]),l(this,g,[]),l(this,p,[]),this.setQueries(t)}onSubscribe(){this.listeners.size===1&&c(this,g).forEach(e=>{e.subscribe(t=>{y(this,h,$).call(this,e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,c(this,g).forEach(e=>{e.destroy()})}setQueries(e,t){l(this,w,e),l(this,E,t),A.batch(()=>{const s=c(this,g),a=y(this,h,q).call(this,c(this,w));a.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const r=a.map(u=>u.observer),o=r.map(u=>u.getCurrentResult()),d=s.length!==r.length,n=r.some((u,v)=>u!==s[v]),f=d||n,k=f?!0:o.some((u,v)=>{const R=c(this,p)[v];return!R||!V(u,R)});!f&&!k||(f&&(l(this,P,a),l(this,g,r)),l(this,p,o),this.hasListeners()&&(f&&(j(s,r).forEach(u=>{u.destroy()}),j(r,s).forEach(u=>{u.subscribe(v=>{y(this,h,$).call(this,u,v)})})),y(this,h,z).call(this)))})}getCurrentResult(){return c(this,p)}getQueries(){return c(this,g).map(e=>e.getCurrentQuery())}getObservers(){return c(this,g)}getOptimisticResult(e,t){const s=y(this,h,q).call(this,e),a=s.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),r=s.map(o=>o.defaultedQueryOptions.queryHash);return[a,o=>y(this,h,L).call(this,o??a,t,r),()=>y(this,h,H).call(this,a,s)]}},C=new WeakMap,p=new WeakMap,w=new WeakMap,E=new WeakMap,g=new WeakMap,Q=new WeakMap,x=new WeakMap,M=new WeakMap,I=new WeakMap,P=new WeakMap,h=new WeakSet,H=function(e,t){return t.map((s,a)=>{const r=e[a];return s.defaultedQueryOptions.notifyOnChangeProps?r:s.observer.trackResult(r,o=>{t.forEach(d=>{d.observer.trackProp(o)})})})},L=function(e,t,s){if(t){const a=c(this,I),r=s!==void 0&&a!==void 0&&(a.length!==s.length||s.some((o,d)=>o!==a[d]));return(!c(this,Q)||c(this,p)!==c(this,M)||r||t!==c(this,x))&&(l(this,x,t),l(this,M,c(this,p)),s!==void 0&&l(this,I,s),l(this,Q,X(c(this,Q),t(e)))),c(this,Q)}return e},G=function(){var e;return((e=c(this,E))==null?void 0:e.combine)!==void 0&&c(this,g).some((t,s)=>{var a;return t.options.suspense&&((a=c(this,p)[s])==null?void 0:a.data)===void 0})},q=function(e){const t=new Map;c(this,g).forEach(a=>{const r=a.options.queryHash;if(!r)return;const o=t.get(r);o?o.push(a):t.set(r,[a])});const s=[];return e.forEach(a=>{var n;const r=c(this,C).defaultQueryOptions(a),d=((n=t.get(r.queryHash))==null?void 0:n.shift())??new T(c(this,C),r);s.push({defaultedQueryOptions:r,observer:d})}),s},$=function(e,t){const s=c(this,g).indexOf(e);s!==-1&&(l(this,p,ue(c(this,p),s,t)),y(this,h,z).call(this))},z=function(){var e;if(this.hasListeners()){const t=y(this,h,H).call(this,c(this,p),c(this,P)),s=y(this,h,G).call(this),a=c(this,Q),r=s?a:y(this,h,L).call(this,t,(e=c(this,E))==null?void 0:e.combine);(s||a!==r)&&A.batch(()=>{this.listeners.forEach(o=>{o(c(this,p))})})}},F);function pe({queries:i,...e},t){const s=Y(),a=W(),r=ee(),o=_.useMemo(()=>i.map(b=>{const S=s.defaultQueryOptions(b);return S._optimisticResults=a?"isRestoring":"optimistic",S}),[i,s,a]);o.forEach(b=>{se(b);const S=s.getQueryCache().get(b.queryHash);te(b,r,S)}),re(r);const[d]=_.useState(()=>new ce(s,o,e)),[n,f,k]=d.getOptimisticResult(o,e.combine),u=!a&&e.subscribed!==!1;_.useSyncExternalStore(_.useCallback(b=>u?d.subscribe(A.batchCalls(b)):Z,[d,u]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),_.useEffect(()=>{d.setQueries(o,e)},[o,e,d]);const R=n.some((b,S)=>U(o[S],b))?n.flatMap((b,S)=>{const O=o[S];if(O&&U(O,b)){const J=new T(s,O);return ae(O,J,r)}return[]}):[];if(R.length>0)throw Promise.all(R);const B=n.find((b,S)=>{const O=o[S];return O&&ie({result:b,errorResetBoundary:r,throwOnError:O.throwOnError,query:s.getQueryCache().get(O.queryHash),suspense:O.suspense})});if(B!=null&&B.error)throw B.error;return f(k())}function be(i,e,t,s){const a=new Set(t.flatMap(r=>r.op==="create"?[]:[String(r.evaluation_id)]));return{paperId:i,arxivId:s,contexts:[...e.filter(r=>r.id!==void 0&&a.has(String(r.id))),...t.flatMap(r=>r.op==="delete"?[]:[r.data])]}}function ge(i,e){const t=new Set(e.contexts.flatMap(n=>n.dataset_id==null?[]:[String(n.dataset_id)])),s=new Set(e.contexts.flatMap(n=>n.task_id==null?[]:[String(n.task_id)])),a=new Set([e.paperId]),r=new Set;e.arxivId&&r.add(e.arxivId);const o=new Set(e.contexts.map(n=>`${n.task_id}:${n.dataset_id}`)),d=i.getQueryCache().findAll({predicate:n=>n.queryKey[0]==="dataset-evals"||n.queryKey[0]==="evaluations"&&n.queryKey[1]==="paper"});for(const n of d)for(const f of n.state.data??[])o.has(`${f.task_id}:${f.dataset_id}`)&&(a.add(String(f.paper_id)),f.paper_arxiv_id&&r.add(f.paper_arxiv_id));ne(i,[...a,...r]),oe(i),i.invalidateQueries({predicate:n=>n.queryKey[0]==="evaluations"&&n.queryKey[1]==="paper"&&a.has(String(n.queryKey[2]))}),i.invalidateQueries({predicate:n=>{const[f,k]=n.queryKey;switch(f){case"dataset-evals":case"dataset-tasks":return t.has(String(k));case"dataset":{const u=n.state.data;return t.has(String(k))||!!(u&&t.has(String(u.id)))}case"task-page":{const u=n.state.data;return s.has(String(k))||!!(u&&(s.has(String(u.task.id))||u.subtask_benchmarks.some(v=>s.has(String(v.subtask_id)))||u.benchmarks.some(v=>t.has(String(v.id)))||u.subtask_benchmarks.some(v=>v.benchmarks.some(R=>t.has(String(R.id))))))}case"task-benchmark-trends":{const u=n.state.data;return s.has(String(k))||!!(u&&s.has(String(u.task_id)))}default:return!1}}})}export{be as e,ge as r,pe as u}; diff --git a/assets/evaluationQueryInvalidation-Cm3s7Pfm.js b/assets/evaluationQueryInvalidation-Cm3s7Pfm.js new file mode 100644 index 0000000000000000000000000000000000000000..3a66179fbd3a1d2cb5d72de6337f753348c8627c --- /dev/null +++ b/assets/evaluationQueryInvalidation-Cm3s7Pfm.js @@ -0,0 +1 @@ +var F=a=>{throw TypeError(a)};var B=(a,e,t)=>e.has(a)||F("Cannot "+t);var u=(a,e,t)=>(B(a,e,"read from private field"),t?t.call(a):e.get(a)),v=(a,e,t)=>e.has(a)?F("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t),l=(a,e,t,s)=>(B(a,e,"write to private field"),s?s.call(a,t):e.set(a,t),t),g=(a,e,t)=>(B(a,e,"access private method"),t);import{aE as X,aF as H,aG as Y,aH as Z,aI as J,i as W,aJ as ee,aK as se,d as x,aL as te,aM as re,aN as ae,aO as ie,aP as U,aQ as ne,aR as oe,t as A,o as I}from"./index-DyXq7-Tg.js";import{i as ue,a as ce}from"./queryInvalidation-CfHeNeUY.js";function j(a,e){const t=new Set(e);return a.filter(s=>!t.has(s))}function de(a,e,t){const s=a.slice(0);return s[e]=t,s}var _,f,w,E,y,R,C,K,M,P,d,L,D,N,$,T,z,G,he=(G=class extends X{constructor(e,t,s){super();v(this,d);v(this,_);v(this,f);v(this,w);v(this,E);v(this,y);v(this,R);v(this,C);v(this,K);v(this,M);v(this,P,[]);l(this,_,e),l(this,E,s),l(this,w,[]),l(this,y,[]),l(this,f,[]),this.setQueries(t)}onSubscribe(){this.listeners.size===1&&u(this,y).forEach(e=>{e.subscribe(t=>{g(this,d,T).call(this,e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,u(this,y).forEach(e=>{e.destroy()})}setQueries(e,t){l(this,w,e),l(this,E,t),H.batch(()=>{const s=u(this,y),n=g(this,d,$).call(this,u(this,w));n.forEach(i=>i.observer.setOptions(i.defaultedQueryOptions));const r=n.map(i=>i.observer),o=r.map(i=>i.getCurrentResult()),h=s.length!==r.length,m=r.some((i,b)=>i!==s[b]),S=h||m,c=S?!0:o.some((i,b)=>{const k=u(this,f)[b];return!k||!Y(i,k)});!S&&!c||(S&&(l(this,P,n),l(this,y,r)),l(this,f,o),this.hasListeners()&&(S&&(j(s,r).forEach(i=>{i.destroy()}),j(r,s).forEach(i=>{i.subscribe(b=>{g(this,d,T).call(this,i,b)})})),g(this,d,z).call(this)))})}getCurrentResult(){return u(this,f)}getQueries(){return u(this,y).map(e=>e.getCurrentQuery())}getObservers(){return u(this,y)}getOptimisticResult(e,t){const s=g(this,d,$).call(this,e),n=s.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),r=s.map(o=>o.defaultedQueryOptions.queryHash);return[n,o=>g(this,d,D).call(this,o??n,t,r),()=>g(this,d,L).call(this,n,s)]}},_=new WeakMap,f=new WeakMap,w=new WeakMap,E=new WeakMap,y=new WeakMap,R=new WeakMap,C=new WeakMap,K=new WeakMap,M=new WeakMap,P=new WeakMap,d=new WeakSet,L=function(e,t){return t.map((s,n)=>{const r=e[n];return s.defaultedQueryOptions.notifyOnChangeProps?r:s.observer.trackResult(r,o=>{t.forEach(h=>{h.observer.trackProp(o)})})})},D=function(e,t,s){if(t){const n=u(this,M),r=s!==void 0&&n!==void 0&&(n.length!==s.length||s.some((o,h)=>o!==n[h]));return(!u(this,R)||u(this,f)!==u(this,K)||r||t!==u(this,C))&&(l(this,C,t),l(this,K,u(this,f)),s!==void 0&&l(this,M,s),l(this,R,Z(u(this,R),t(e)))),u(this,R)}return e},N=function(){var e;return((e=u(this,E))==null?void 0:e.combine)!==void 0&&u(this,y).some((t,s)=>{var n;return t.options.suspense&&((n=u(this,f)[s])==null?void 0:n.data)===void 0})},$=function(e){const t=new Map;u(this,y).forEach(n=>{const r=n.options.queryHash;if(!r)return;const o=t.get(r);o?o.push(n):t.set(r,[n])});const s=[];return e.forEach(n=>{var m;const r=u(this,_).defaultQueryOptions(n),h=((m=t.get(r.queryHash))==null?void 0:m.shift())??new J(u(this,_),r);s.push({defaultedQueryOptions:r,observer:h})}),s},T=function(e,t){const s=u(this,y).indexOf(e);s!==-1&&(l(this,f,de(u(this,f),s,t)),g(this,d,z).call(this))},z=function(){var e;if(this.hasListeners()){const t=g(this,d,L).call(this,u(this,f),u(this,P)),s=g(this,d,N).call(this),n=u(this,R),r=s?n:g(this,d,D).call(this,t,(e=u(this,E))==null?void 0:e.combine);(s||n!==r)&&H.batch(()=>{this.listeners.forEach(o=>{o(u(this,f))})})}},G);function ye({queries:a,...e},t){const s=W(),n=ee(),r=se(),o=x.useMemo(()=>a.map(p=>{const Q=s.defaultQueryOptions(p);return Q._optimisticResults=n?"isRestoring":"optimistic",Q}),[a,s,n]);o.forEach(p=>{te(p);const Q=s.getQueryCache().get(p.queryHash);re(p,r,Q)}),ae(r);const[h]=x.useState(()=>new he(s,o,e)),[m,S,c]=h.getOptimisticResult(o,e.combine),i=!n&&e.subscribed!==!1;x.useSyncExternalStore(x.useCallback(p=>i?h.subscribe(H.batchCalls(p)):ie,[h,i]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),x.useEffect(()=>{h.setQueries(o,e)},[o,e,h]);const k=m.some((p,Q)=>U(o[Q],p))?m.flatMap((p,Q)=>{const O=o[Q];if(O&&U(O,p)){const V=new J(s,O);return ne(O,V,r)}return[]}):[];if(k.length>0)throw Promise.all(k);const q=m.find((p,Q)=>{const O=o[Q];return O&&oe({result:p,errorResetBoundary:r,throwOnError:O.throwOnError,query:s.getQueryCache().get(O.queryHash),suspense:O.suspense})});if(q!=null&&q.error)throw q.error;return S(c())}function be(a,e,t,s){const n=new Set(t.flatMap(r=>r.op==="create"?[]:[String(r.evaluation_id)]));return{paperId:a,arxivId:s,contexts:[...e.filter(r=>r.id!==void 0&&n.has(String(r.id))),...t.flatMap(r=>r.op==="delete"?[]:[r.data])]}}function ve(a,e){const t=new Set(e.contexts.flatMap(c=>c.dataset_id==null?[]:[String(c.dataset_id)])),s=new Set(e.contexts.flatMap(c=>c.task_id==null?[]:[String(c.task_id)])),n=new Set([e.paperId]),r=new Set;e.arxivId&&r.add(e.arxivId);const o=new Set(e.contexts.map(c=>`${c.task_id}:${c.dataset_id}`)),h=a.getQueryCache(),m=[...h.findAll({queryKey:A.byDatasetAll}),...h.findAll({queryKey:A.byPaperAll})];for(const c of m)for(const i of c.state.data??[])o.has(`${i.task_id}:${i.dataset_id}`)&&(n.add(String(i.paper_id)),i.paper_arxiv_id&&r.add(i.paper_arxiv_id));ue(a,[...n,...r]),ce(a),a.invalidateQueries({queryKey:A.byPaperAll,predicate:c=>n.has(String(c.queryKey[2]))});const S=c=>t.has(String(c.queryKey[1]));a.invalidateQueries({queryKey:A.byDatasetAll,predicate:S}),a.invalidateQueries({queryKey:I.datasetTasks,predicate:S}),a.invalidateQueries({queryKey:I.datasets,predicate:c=>{const i=c.state.data;return S(c)||!!(i&&t.has(String(i.id)))}}),a.invalidateQueries({queryKey:I.taskPage,predicate:c=>{const i=c.state.data;return s.has(String(c.queryKey[1]))||!!(i&&(s.has(String(i.task.id))||i.subtask_benchmarks.some(b=>s.has(String(b.subtask_id)))||i.benchmarks.some(b=>t.has(String(b.id)))||i.subtask_benchmarks.some(b=>b.benchmarks.some(k=>t.has(String(k.id))))))}}),a.invalidateQueries({queryKey:I.taskBenchmarkTrends,predicate:c=>{const i=c.state.data;return s.has(String(c.queryKey[1]))||!!(i&&s.has(String(i.task_id)))}})}export{be as e,ve as r,ye as u}; diff --git a/assets/external-link-DZIH4GGr.js b/assets/external-link-orY1Xz1I.js similarity index 89% rename from assets/external-link-DZIH4GGr.js rename to assets/external-link-orY1Xz1I.js index aa81f50f95b4197a3c3cc71725fd66f2bcb578c4..47cacba7194e4754d3a0bf6192da3275c5f940f2 100644 --- a/assets/external-link-DZIH4GGr.js +++ b/assets/external-link-orY1Xz1I.js @@ -1,4 +1,4 @@ -import{n as a}from"./index-CbgxfyGU.js";/** +import{s as a}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/file-text-BK_7Q2rV.js b/assets/file-text-dvKtHbmD.js similarity index 91% rename from assets/file-text-BK_7Q2rV.js rename to assets/file-text-dvKtHbmD.js index ae00d2329718618e394caaf846503ee08e8f1948..0e5d25282ed37811a214e9a99ba5e44c382e4835 100644 --- a/assets/file-text-BK_7Q2rV.js +++ b/assets/file-text-dvKtHbmD.js @@ -1,4 +1,4 @@ -import{n as e}from"./index-CbgxfyGU.js";/** +import{s as e}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/github-BYklgHDz.js b/assets/github-RNrgGHRT.js similarity index 92% rename from assets/github-BYklgHDz.js rename to assets/github-RNrgGHRT.js index 295ed7233ae5e400770eac2df622f5b6e8c1bad3..6d72a793c9eec484bb245bc72e65d0eee63e500d 100644 --- a/assets/github-BYklgHDz.js +++ b/assets/github-RNrgGHRT.js @@ -1,4 +1,4 @@ -import{n as c}from"./index-CbgxfyGU.js";/** +import{s as c}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/globe-B_laOt9Z.js b/assets/globe-BMJtRs4F.js similarity index 89% rename from assets/globe-B_laOt9Z.js rename to assets/globe-BMJtRs4F.js index 200290389d542b44ca8ce2da867cbb74cc668429..e3169cf9b5229758d187e40765235212e16a043d 100644 --- a/assets/globe-B_laOt9Z.js +++ b/assets/globe-BMJtRs4F.js @@ -1,4 +1,4 @@ -import{n as e}from"./index-CbgxfyGU.js";/** +import{s as e}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/hover-card-B45EJIn_.js b/assets/hover-card-B45EJIn_.js new file mode 100644 index 0000000000000000000000000000000000000000..97bb818e9993e43fe03c79319128110c5a52b44d --- /dev/null +++ b/assets/hover-card-B45EJIn_.js @@ -0,0 +1 @@ +import{d as n,A as M,j as c,ap as k,aq as I,z as U,D as l,ar as T,P as O,as as $,F as z,B,at as W,au as G,av as K,G as q}from"./index-DyXq7-Tg.js";var E,g="HoverCard",[y]=z(g,[T]),w=T(),[V,S]=y(g),N=e=>{const{__scopeHoverCard:o,children:r,open:s,defaultOpen:a,onOpenChange:i,openDelay:f=700,closeDelay:v=300}=e,d=w(o),C=n.useRef(0),u=n.useRef(0),h=n.useRef(!1),p=n.useRef(!1),[m,t]=M({prop:s,defaultProp:a??!1,onChange:i,caller:g}),x=n.useCallback(()=>{clearTimeout(u.current),C.current=window.setTimeout(()=>t(!0),f)},[f,t]),P=n.useCallback(()=>{clearTimeout(C.current),!h.current&&!p.current&&(u.current=window.setTimeout(()=>t(!1),v))},[v,t]),F=n.useCallback(()=>t(!1),[t]);return n.useEffect(()=>()=>{clearTimeout(C.current),clearTimeout(u.current)},[]),c.jsx(V,{scope:o,open:m,onOpenChange:t,onOpen:x,onClose:P,onDismiss:F,hasSelectionRef:h,isPointerDownOnContentRef:p,children:c.jsx(k,{...d,children:r})})};N.displayName=g;var _="HoverCardTrigger",D=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,...s}=e,a=S(_,r),i=w(r);return c.jsx(I,{asChild:!0,...i,children:c.jsx(U.a,{"data-state":a.open?"open":"closed",...s,ref:o,onPointerEnter:l(e.onPointerEnter,b(a.onOpen)),onPointerLeave:l(e.onPointerLeave,b(a.onClose)),onFocus:l(e.onFocus,a.onOpen),onBlur:l(e.onBlur,a.onClose),onTouchStart:l(e.onTouchStart,f=>f.preventDefault())})})});D.displayName=_;var H="HoverCardPortal",[J,Q]=y(H,{forceMount:void 0}),j=e=>{const{__scopeHoverCard:o,forceMount:r,children:s,container:a}=e,i=S(H,o);return c.jsx(J,{scope:o,forceMount:r,children:c.jsx(O,{present:r||i.open,children:c.jsx($,{asChild:!0,container:a,children:s})})})};j.displayName=H;var R="HoverCardContent",A=n.forwardRef((e,o)=>{const r=Q(R,e.__scopeHoverCard),{forceMount:s=r.forceMount,...a}=e,i=S(R,e.__scopeHoverCard);return c.jsx(O,{present:s||i.open,children:c.jsx(X,{"data-state":i.open?"open":"closed",...a,onPointerEnter:l(e.onPointerEnter,b(i.onOpen)),onPointerLeave:l(e.onPointerLeave,b(i.onClose)),ref:o})})});A.displayName=R;var X=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:f,...v}=e,d=S(R,r),C=w(r),u=n.useRef(null),h=B(o,u),[p,m]=n.useState(!1);return n.useEffect(()=>{if(p){const t=document.body;return E=t.style.userSelect||t.style.webkitUserSelect,t.style.userSelect="none",t.style.webkitUserSelect="none",()=>{t.style.userSelect=E,t.style.webkitUserSelect=E}}},[p]),n.useEffect(()=>{if(u.current){const t=()=>{m(!1),d.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var P;((P=document.getSelection())==null?void 0:P.toString())!==""&&(d.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",t),()=>{document.removeEventListener("pointerup",t),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!1}}},[d.isPointerDownOnContentRef,d.hasSelectionRef]),n.useEffect(()=>{u.current&&ee(u.current).forEach(x=>x.setAttribute("tabindex","-1"))}),c.jsx(W,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l(i,t=>{t.preventDefault()}),onDismiss:d.onDismiss,children:c.jsx(G,{...C,...v,onPointerDown:l(v.onPointerDown,t=>{t.currentTarget.contains(t.target)&&m(!0),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!0}),ref:h,style:{...v.style,userSelect:p?"text":void 0,WebkitUserSelect:p?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Y="HoverCardArrow",Z=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,...s}=e,a=w(r);return c.jsx(K,{...a,...s,ref:o})});Z.displayName=Y;function b(e){return o=>o.pointerType==="touch"?void 0:e()}function ee(e){const o=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)o.push(r.currentNode);return o}var te=N,oe=D,re=j,L=A;const se=te,ce=oe,ne=n.forwardRef(({className:e,align:o="center",sideOffset:r=4,...s},a)=>c.jsx(re,{children:c.jsx(L,{ref:a,align:o,sideOffset:r,className:q("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));ne.displayName=L.displayName;export{se as H,ce as a,ne as b}; diff --git a/assets/hover-card-ufez2uMo.js b/assets/hover-card-ufez2uMo.js deleted file mode 100644 index ecd904e9ef6cc7ffcb27d5a7092ab4d7db0dbb75..0000000000000000000000000000000000000000 --- a/assets/hover-card-ufez2uMo.js +++ /dev/null @@ -1 +0,0 @@ -import{r as n,w as M,j as c,aj as F,ak as I,v as U,y as l,al as T,P as y,am as $,A as B,x as W,an as z,ao as G,ap as K,B as V}from"./index-CbgxfyGU.js";var E,b="HoverCard",[O]=B(b,[T]),g=T(),[q,S]=O(b),N=e=>{const{__scopeHoverCard:o,children:r,open:s,defaultOpen:a,onOpenChange:i,openDelay:f=700,closeDelay:v=300}=e,d=g(o),C=n.useRef(0),u=n.useRef(0),h=n.useRef(!1),p=n.useRef(!1),[m,t]=M({prop:s,defaultProp:a??!1,onChange:i,caller:b}),x=n.useCallback(()=>{clearTimeout(u.current),C.current=window.setTimeout(()=>t(!0),f)},[f,t]),P=n.useCallback(()=>{clearTimeout(C.current),!h.current&&!p.current&&(u.current=window.setTimeout(()=>t(!1),v))},[v,t]),k=n.useCallback(()=>t(!1),[t]);return n.useEffect(()=>()=>{clearTimeout(C.current),clearTimeout(u.current)},[]),c.jsx(q,{scope:o,open:m,onOpenChange:t,onOpen:x,onClose:P,onDismiss:k,hasSelectionRef:h,isPointerDownOnContentRef:p,children:c.jsx(F,{...d,children:r})})};N.displayName=b;var _="HoverCardTrigger",D=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,...s}=e,a=S(_,r),i=g(r);return c.jsx(I,{asChild:!0,...i,children:c.jsx(U.a,{"data-state":a.open?"open":"closed",...s,ref:o,onPointerEnter:l(e.onPointerEnter,w(a.onOpen)),onPointerLeave:l(e.onPointerLeave,w(a.onClose)),onFocus:l(e.onFocus,a.onOpen),onBlur:l(e.onBlur,a.onClose),onTouchStart:l(e.onTouchStart,f=>f.preventDefault())})})});D.displayName=_;var H="HoverCardPortal",[J,Q]=O(H,{forceMount:void 0}),j=e=>{const{__scopeHoverCard:o,forceMount:r,children:s,container:a}=e,i=S(H,o);return c.jsx(J,{scope:o,forceMount:r,children:c.jsx(y,{present:r||i.open,children:c.jsx($,{asChild:!0,container:a,children:s})})})};j.displayName=H;var R="HoverCardContent",A=n.forwardRef((e,o)=>{const r=Q(R,e.__scopeHoverCard),{forceMount:s=r.forceMount,...a}=e,i=S(R,e.__scopeHoverCard);return c.jsx(y,{present:s||i.open,children:c.jsx(X,{"data-state":i.open?"open":"closed",...a,onPointerEnter:l(e.onPointerEnter,w(i.onOpen)),onPointerLeave:l(e.onPointerLeave,w(i.onClose)),ref:o})})});A.displayName=R;var X=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:f,...v}=e,d=S(R,r),C=g(r),u=n.useRef(null),h=W(o,u),[p,m]=n.useState(!1);return n.useEffect(()=>{if(p){const t=document.body;return E=t.style.userSelect||t.style.webkitUserSelect,t.style.userSelect="none",t.style.webkitUserSelect="none",()=>{t.style.userSelect=E,t.style.webkitUserSelect=E}}},[p]),n.useEffect(()=>{if(u.current){const t=()=>{m(!1),d.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var P;((P=document.getSelection())==null?void 0:P.toString())!==""&&(d.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",t),()=>{document.removeEventListener("pointerup",t),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!1}}},[d.isPointerDownOnContentRef,d.hasSelectionRef]),n.useEffect(()=>{u.current&&ee(u.current).forEach(x=>x.setAttribute("tabindex","-1"))}),c.jsx(z,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l(i,t=>{t.preventDefault()}),onDismiss:d.onDismiss,children:c.jsx(G,{...C,...v,onPointerDown:l(v.onPointerDown,t=>{t.currentTarget.contains(t.target)&&m(!0),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!0}),ref:h,style:{...v.style,userSelect:p?"text":void 0,WebkitUserSelect:p?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Y="HoverCardArrow",Z=n.forwardRef((e,o)=>{const{__scopeHoverCard:r,...s}=e,a=g(r);return c.jsx(K,{...a,...s,ref:o})});Z.displayName=Y;function w(e){return o=>o.pointerType==="touch"?void 0:e()}function ee(e){const o=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)o.push(r.currentNode);return o}var te=N,oe=D,re=j,L=A;const se=te,ce=oe,ne=n.forwardRef(({className:e,align:o="center",sideOffset:r=4,...s},a)=>c.jsx(re,{children:c.jsx(L,{ref:a,align:o,sideOffset:r,className:V("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));ne.displayName=L.displayName;export{se as H,ce as a,ne as b}; diff --git a/assets/index-BH3yOoza.js b/assets/index-2CvJmBVB.js similarity index 99% rename from assets/index-BH3yOoza.js rename to assets/index-2CvJmBVB.js index 61b5157ac1c8eca12b3045925bcde6d6a7d5a6cc..239b3ecf77ef679785bcd37cc12f4580e184c6fa 100644 --- a/assets/index-BH3yOoza.js +++ b/assets/index-2CvJmBVB.js @@ -1,4 +1,4 @@ -import{c as ce,v as _e,o as E,u as I,e as Z,g as O,i as W,j as Oe,t as fe,E as je,k as J,l as M,q as A,r as Be,w as qe,f as S,x as H,y as We,m as P,z as T,A as $e}from"./index-ZkEATkOr.js";function re(e,n){const t=String(e);if(typeof n!="string")throw new TypeError("Expected character");let i=0,o=t.indexOf(n);for(;o!==-1;)i++,o=t.indexOf(n,o+n.length);return i}function He(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ue(e,n,t){const o=ce((t||{}).ignore||[]),a=Ve(n);let r=-1;for(;++r0?{type:"text",value:y}:void 0),y===!1?p.lastIndex=v+1:(m!==v&&w.push({type:"text",value:s.value.slice(m,v)}),Array.isArray(y)?w.push(...y):y&&w.push(y),m=v+d[0].length,k=!0),!p.global)break;d=p.exec(s.value)}return k?(m?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let t=n[0],i=t.indexOf(")");const o=re(e,"(");let a=re(e,")");for(;i!==-1&&o>a;)e+=t.slice(0,i+1),t=t.slice(i+1),i=t.indexOf(")"),a++;return[e,t]}function he(e,n){const t=e.input.charCodeAt(e.index-1);return(e.index===0||I(t)||Z(t))&&(!n||t!==47)}me.peek=pt;function ot(){this.buffer()}function at(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ut(){this.buffer()}function st(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ct(e){const n=this.resume(),t=this.stack[this.stack.length-1];E(t.type==="footnoteReference"),t.identifier=O(this.sliceSerialize(e)).toLowerCase(),t.label=n}function ft(e){this.exit(e)}function ht(e){const n=this.resume(),t=this.stack[this.stack.length-1];E(t.type==="footnoteDefinition"),t.identifier=O(this.sliceSerialize(e)).toLowerCase(),t.label=n}function mt(e){this.exit(e)}function pt(){return"["}function me(e,n,t,i){const o=t.createTracker(i);let a=o.move("[^");const r=t.enter("footnoteReference"),u=t.enter("reference");return a+=o.move(t.safe(t.associationId(e),{after:"]",before:a})),u(),r(),a+=o.move("]"),a}function gt(){return{enter:{gfmFootnoteCallString:ot,gfmFootnoteCall:at,gfmFootnoteDefinitionLabelString:ut,gfmFootnoteDefinition:st},exit:{gfmFootnoteCallString:ct,gfmFootnoteCall:ft,gfmFootnoteDefinitionLabelString:ht,gfmFootnoteDefinition:mt}}}function kt(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:t,footnoteReference:me},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(i,o,a,r){const u=a.createTracker(r);let l=u.move("[^");const s=a.enter("footnoteDefinition"),h=a.enter("label");return l+=u.move(a.safe(a.associationId(i),{before:l,after:"]"})),h(),l+=u.move("]:"),i.children&&i.children.length>0&&(u.shift(4),l+=u.move((n?` +import{c as ce,v as _e,o as E,u as I,e as Z,g as O,i as W,j as Oe,t as fe,E as je,k as J,l as M,q as A,r as Be,w as qe,f as S,x as H,y as We,m as P,z as T,A as $e}from"./index-mCi_y_l3.js";function re(e,n){const t=String(e);if(typeof n!="string")throw new TypeError("Expected character");let i=0,o=t.indexOf(n);for(;o!==-1;)i++,o=t.indexOf(n,o+n.length);return i}function He(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ue(e,n,t){const o=ce((t||{}).ignore||[]),a=Ve(n);let r=-1;for(;++r0?{type:"text",value:y}:void 0),y===!1?p.lastIndex=v+1:(m!==v&&w.push({type:"text",value:s.value.slice(m,v)}),Array.isArray(y)?w.push(...y):y&&w.push(y),m=v+d[0].length,k=!0),!p.global)break;d=p.exec(s.value)}return k?(m?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let t=n[0],i=t.indexOf(")");const o=re(e,"(");let a=re(e,")");for(;i!==-1&&o>a;)e+=t.slice(0,i+1),t=t.slice(i+1),i=t.indexOf(")"),a++;return[e,t]}function he(e,n){const t=e.input.charCodeAt(e.index-1);return(e.index===0||I(t)||Z(t))&&(!n||t!==47)}me.peek=pt;function ot(){this.buffer()}function at(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ut(){this.buffer()}function st(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ct(e){const n=this.resume(),t=this.stack[this.stack.length-1];E(t.type==="footnoteReference"),t.identifier=O(this.sliceSerialize(e)).toLowerCase(),t.label=n}function ft(e){this.exit(e)}function ht(e){const n=this.resume(),t=this.stack[this.stack.length-1];E(t.type==="footnoteDefinition"),t.identifier=O(this.sliceSerialize(e)).toLowerCase(),t.label=n}function mt(e){this.exit(e)}function pt(){return"["}function me(e,n,t,i){const o=t.createTracker(i);let a=o.move("[^");const r=t.enter("footnoteReference"),u=t.enter("reference");return a+=o.move(t.safe(t.associationId(e),{after:"]",before:a})),u(),r(),a+=o.move("]"),a}function gt(){return{enter:{gfmFootnoteCallString:ot,gfmFootnoteCall:at,gfmFootnoteDefinitionLabelString:ut,gfmFootnoteDefinition:st},exit:{gfmFootnoteCallString:ct,gfmFootnoteCall:ft,gfmFootnoteDefinitionLabelString:ht,gfmFootnoteDefinition:mt}}}function kt(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:t,footnoteReference:me},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(i,o,a,r){const u=a.createTracker(r);let l=u.move("[^");const s=a.enter("footnoteDefinition"),h=a.enter("label");return l+=u.move(a.safe(a.associationId(i),{before:l,after:"]"})),h(),l+=u.move("]:"),i.children&&i.children.length>0&&(u.shift(4),l+=u.move((n?` `:" ")+a.indentLines(a.containerFlow(i,u.current()),n?pe:bt))),s(),l}}function bt(e,n,t){return n===0?e:pe(e,n,t)}function pe(e,n,t){return(t?"":" ")+e}const xt=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ge.peek=vt;function wt(){return{canContainEols:["delete"],enter:{strikethrough:yt},exit:{strikethrough:Ct}}}function dt(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xt}],handlers:{delete:ge}}}function yt(e){this.enter({type:"delete",children:[]},e)}function Ct(e){this.exit(e)}function ge(e,n,t,i){const o=t.createTracker(i),a=t.enter("strikethrough");let r=o.move("~~");return r+=t.containerPhrasing(e,{...o.current(),before:r,after:"~"}),r+=o.move("~~"),a(),r}function vt(){return"~"}function At(e){return e.length}function Dt(e,n){const t=n||{},i=(t.align||[]).concat(),o=t.stringLength||At,a=[],r=[],u=[],l=[];let s=0,h=-1;for(;++hs&&(s=e[h].length);++kl[k])&&(l[k]=d)}b.push(w)}r[h]=b,u[h]=x}let c=-1;if(typeof i=="object"&&"length"in i)for(;++cl[c]&&(l[c]=w),g[c]=w),p[c]=d}r.splice(1,0,p),u.splice(1,0,g),h=-1;const m=[];for(;++h "),a.shift(2);const r=t.indentLines(t.containerFlow(e,a.current()),Lt);return o(),r}function Lt(e,n,t){return">"+(t?"":" ")+e}function Tt(e,n){return le(e,n.inConstruct,!0)&&!le(e,n.notInConstruct,!1)}function le(e,n,t){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return t;let i=-1;for(;++i(e.current.value!==r&&(e.current.previous=e.current.value,e.current.value=r),e.current.previous),[r])}export{o as u}; +import{d as u}from"./index-DyXq7-Tg.js";function o(r){const e=u.useRef({value:r,previous:r});return u.useMemo(()=>(e.current.value!==r&&(e.current.previous=e.current.value,e.current.value=r),e.current.previous),[r])}export{o as u}; diff --git a/assets/index-CbgxfyGU.js b/assets/index-CbgxfyGU.js deleted file mode 100644 index 1cd418e9521794899089324456207cb1cfe4e83a..0000000000000000000000000000000000000000 --- a/assets/index-CbgxfyGU.js +++ /dev/null @@ -1,162 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AuthorizePaperEditView-D0e1jji8.js","assets/useQuery-Bx9s5-D2.js","assets/useMutation-P_trTy9i.js","assets/button-Bv9oZ-QU.js","assets/paperEdits-C5GTaRR8.js","assets/FollowingView-nVVViEvV.js","assets/FeedView-BR2dQQ-K.js","assets/sparkles-BqBXJPmy.js","assets/dialog-Cfp_d3CC.js","assets/catalog-DhK7_9-6.js","assets/research-DgpyzSy_.js","assets/transform-0Udg2p6b.js","assets/researchTopic-CteUev4M.js","assets/plus-UK0TEjgd.js","assets/arrow-right-DotD9yNb.js","assets/PaperFeed-DMvUfA47.js","assets/PaperCard-tdTC_dRN.js","assets/AuthorAvatar-CUJMmp_z.js","assets/AuthorAvatar-o5W6pl_W.css","assets/SotaBadges-C-sTR-EF.js","assets/colors-BkWRhvFI.js","assets/Icon-D-kA0Owz.js","assets/LatexTitle-Z-HGmZ-H.js","assets/paperQueryKeys-B8u1BWlI.js","assets/curation-C7Gmmp4z.js","assets/safeExternalHref-CkBrsh84.js","assets/popover-DKJYnYjk.js","assets/skeleton-HwvdxvSN.js","assets/useIntersectionObserver-CID9Kkak.js","assets/McpShowcase-CMLfdJM2.js","assets/AgentLogos-BBl9UNVD.js","assets/chatSessions-DwLUbLRo.js","assets/chat-DzTo2WUO.js","assets/usePapers-CJaWLZ3y.js","assets/useInfiniteQuery-BAc_4HO5.js","assets/alert-CFDDvdIM.js","assets/ChatView-DlSbJMKT.js","assets/ArtifactWorkspace-Cwix1Wp6.js","assets/hover-card-ufez2uMo.js","assets/CatalogEntityPreviewLink-Cvehtzvn.js","assets/github-BYklgHDz.js","assets/file-text-BK_7Q2rV.js","assets/PaperPreviewLink-DZDNIh1g.js","assets/index-ZkEATkOr.js","assets/index-BH3yOoza.js","assets/katex-DkKDou_j.js","assets/copy-bzw7JVus.js","assets/thumbs-up-CDCzGuPd.js","assets/arrow-left-Czeu3VzJ.js","assets/external-link-DZIH4GGr.js","assets/search-CLtAJGOp.js","assets/chevron-up-Cpt5JLeI.js","assets/ArtifactWorkspace-Lr_OJaUk.css","assets/katex-wklAmtGL.css","assets/share-2-hXe4dX_y.js","assets/openrouter-DiuY1sPP.js","assets/queryOptions-C9woPjwX.js","assets/SharedChatView-DO_TTtXn.js","assets/PapersListView-DhkGuTns.js","assets/useDebounce-DkuI5tkx.js","assets/apiErrors-BZ5h1Kmb.js","assets/frameworks-DDA0P4Tf.js","assets/PaperDetailView-F3D4F2PU.js","assets/ExternalSourceEvalBadge-npO6bZ8N.js","assets/ExternalSourceEvalBadge-CWUQ52cV.css","assets/paperReader-BIpQD5HO.js","assets/latexPlainText-DI8YEXVe.js","assets/evaluationQueryInvalidation-BogLM1gw.js","assets/queryInvalidation-Chlw4DEx.js","assets/input-B6pxtfPe.js","assets/searchable-select-DNdBIahG.js","assets/loader-circle-CWMja8Zn.js","assets/SignInToEditDialog-CNIcNqbK.js","assets/textarea-Bf06GTSH.js","assets/submissions-aWj7YtuZ.js","assets/database-CTvEb5JG.js","assets/badge-Klg-RRGs.js","assets/globe-B_laOt9Z.js","assets/index-CxPKwmVQ.js","assets/codex-Bl7j51l-.js","assets/savedPapersAuth-DsQUuWa_.js","assets/organizationNames-BVKzYEBp.js","assets/PaperDetailView-CUWCgV3F.css","assets/PaperReaderView-9hbbSNRK.js","assets/MarkdownText-Bj-G_S-B.js","assets/TagsIndexView-jyuGT4BB.js","assets/slug-BpH-Nkvz.js","assets/triangle-alert-U7T_j3JE.js","assets/trending-up-B3K5RlyX.js","assets/moon-BVv5zopc.js","assets/trophy-BQwEH3L7.js","assets/activity-dcKMRXBy.js","assets/AreaSection-NWvfO4Sb.js","assets/TaxonomySuggestionTile-DIw_GKfA.js","assets/useHashScrollOnReady-DgB3XFQL.js","assets/areas-Dvi8w2dp.js","assets/TagBrowseView-CRgLg1ki.js","assets/ResearchFollowButton-D2BXlDtQ.js","assets/BenchmarkTrendSparkline-C135_NtS.js","assets/NotFound-DtzwOULp.js","assets/MethodsIndexView-DYp0dUSa.js","assets/FrameworksIndexView-CQtYg5mA.js","assets/TrendsView-DhWigqns.js","assets/ConferencesIndexView-Cw6IrAk5.js","assets/deadlines-BH32v7D1.js","assets/AiDeadlinesView-BhXjtcbF.js","assets/switch-BSZohE4x.js","assets/ConferenceDetailView-i-HB-ysc.js","assets/conferenceListings-BnmhBx-_.js","assets/ConferenceTaskView-BZBMXZD8.js","assets/OrganizationsIndexView-Bd4D8teF.js","assets/OrganizationsIndexView-CJnrfIkP.css","assets/OrganizationDetailView-BD-vOirQ.js","assets/OrganizationContributionGraph-ah6EPb13.js","assets/AuthorDetailView-BpcSKHs1.js","assets/MethodDetailView-CEUGGyVV.js","assets/BenchmarkDetailView-BGwBE1Ld.js","assets/BenchmarkDetailView-CXxK75GR.css","assets/SavedPapersView-CewIlVsw.js","assets/SettingsView-C0A-yv3U.js","assets/PrivacyView-CodFIqUq.js","assets/ApiDocsView-hjoHKqpf.js","assets/ApiDocsView-DPuMdYvY.css","assets/McpView-BrXaRo4V.js","assets/McpView-EGeqkP46.css","assets/SubmitView-C6p4dpHt.js","assets/CronDashboard-CC1lPV3k.js","assets/CronDashboard-B3Xofwvu.js","assets/CronDashboard-DwChfW9h.css","assets/refresh-cw-Cps6nypW.js","assets/circle-check-Bci9ZTu9.js","assets/AutonomousOperations-CzJGtkdV.js","assets/SubmissionsDashboard-eKjMsSf9.js","assets/SubmissionsDashboard-BTmvDoLW.css","assets/UserProfileView-gm0usnRn.js","assets/RateLimitsView-C9bDo_Dq.js","assets/AstraForRoboticsView-pQ4cp5_V.js","assets/AstraForRoboticsView-C_lTF_XB.css","assets/SearchOverlay-LaDVSpVs.js","assets/StagingAccessRequestView-DgeEeE2r.js"])))=>i.map(i=>d[i]); -var rk=Object.defineProperty;var zg=t=>{throw TypeError(t)};var ik=(t,e,n)=>e in t?rk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var wr=(t,e,n)=>ik(t,typeof e!="symbol"?e+"":e,n),hd=(t,e,n)=>e.has(t)||zg("Cannot "+n);var A=(t,e,n)=>(hd(t,e,"read from private field"),n?n.call(t):e.get(t)),le=(t,e,n)=>e.has(t)?zg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),ee=(t,e,n,r)=>(hd(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),nt=(t,e,n)=>(hd(t,e,"access private method"),n);var al=(t,e,n,r)=>({set _(i){ee(t,e,i,n)},get _(){return A(t,e,r)}});function sk(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var c3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function k0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var P0={exports:{}},Cc={},R0={exports:{}},ae={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Qa=Symbol.for("react.element"),ok=Symbol.for("react.portal"),ak=Symbol.for("react.fragment"),lk=Symbol.for("react.strict_mode"),uk=Symbol.for("react.profiler"),ck=Symbol.for("react.provider"),dk=Symbol.for("react.context"),fk=Symbol.for("react.forward_ref"),hk=Symbol.for("react.suspense"),pk=Symbol.for("react.memo"),vk=Symbol.for("react.lazy"),Ug=Symbol.iterator;function gk(t){return t===null||typeof t!="object"?null:(t=Ug&&t[Ug]||t["@@iterator"],typeof t=="function"?t:null)}var T0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I0=Object.assign,O0={};function po(t,e,n){this.props=t,this.context=e,this.refs=O0,this.updater=n||T0}po.prototype.isReactComponent={};po.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};po.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function M0(){}M0.prototype=po.prototype;function Dp(t,e,n){this.props=t,this.context=e,this.refs=O0,this.updater=n||T0}var zp=Dp.prototype=new M0;zp.constructor=Dp;I0(zp,po.prototype);zp.isPureReactComponent=!0;var Vg=Array.isArray,A0=Object.prototype.hasOwnProperty,Up={current:null},N0={key:!0,ref:!0,__self:!0,__source:!0};function $0(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)A0.call(e,r)&&!N0.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,Z=I[G];if(0>>1;Gi(_e,B))Sei(ze,_e)?(I[G]=ze,I[Se]=B,G=Se):(I[G]=_e,I[ce]=B,G=ce);else if(Sei(ze,B))I[G]=ze,I[Se]=B,G=Se;else break e}}return M}function i(I,M){var B=I.sortIndex-M.sortIndex;return B!==0?B:I.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,d=null,f=3,_=!1,m=!1,p=!1,y=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(I){for(var M=n(u);M!==null;){if(M.callback===null)r(u);else if(M.startTime<=I)r(u),M.sortIndex=M.expirationTime,e(l,M);else break;M=n(u)}}function b(I){if(p=!1,x(I),!m)if(n(l)!==null)m=!0,q(E);else{var M=n(u);M!==null&&K(b,M.startTime-I)}}function E(I,M){m=!1,p&&(p=!1,h(C),C=-1),_=!0;var B=f;try{for(x(M),d=n(l);d!==null&&(!(d.expirationTime>M)||I&&!$());){var G=d.callback;if(typeof G=="function"){d.callback=null,f=d.priorityLevel;var Z=G(d.expirationTime<=M);M=t.unstable_now(),typeof Z=="function"?d.callback=Z:d===n(l)&&r(l),x(M)}else r(l);d=n(l)}if(d!==null)var se=!0;else{var ce=n(u);ce!==null&&K(b,ce.startTime-M),se=!1}return se}finally{d=null,f=B,_=!1}}var S=!1,k=null,C=-1,R=5,P=-1;function $(){return!(t.unstable_now()-PI||125G?(I.sortIndex=B,e(u,I),n(l)===null&&I===n(u)&&(p?(h(C),C=-1):p=!0,K(b,B-G))):(I.sortIndex=Z,e(l,I),m||_||(m=!0,q(E))),I},t.unstable_shouldYield=$,t.unstable_wrapCallback=function(I){var M=f;return function(){var B=f;f=M;try{return I.apply(this,arguments)}finally{f=B}}}})(z0);D0.exports=z0;var Pk=D0.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Rk=g,Wt=Pk;function z(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zf=Object.prototype.hasOwnProperty,Tk=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,qg={},Hg={};function Ik(t){return zf.call(Hg,t)?!0:zf.call(qg,t)?!1:Tk.test(t)?Hg[t]=!0:(qg[t]=!0,!1)}function Ok(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Mk(t,e,n,r){if(e===null||typeof e>"u"||Ok(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function St(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var ot={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){ot[t]=new St(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];ot[e]=new St(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){ot[t]=new St(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){ot[t]=new St(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){ot[t]=new St(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){ot[t]=new St(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){ot[t]=new St(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){ot[t]=new St(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){ot[t]=new St(t,5,!1,t.toLowerCase(),null,!1,!1)});var Bp=/[\-:]([a-z])/g;function qp(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Bp,qp);ot[e]=new St(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Bp,qp);ot[e]=new St(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Bp,qp);ot[e]=new St(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){ot[t]=new St(t,1,!1,t.toLowerCase(),null,!1,!1)});ot.xlinkHref=new St("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){ot[t]=new St(t,1,!1,t.toLowerCase(),null,!0,!0)});function Hp(t,e,n,r){var i=ot.hasOwnProperty(e)?ot[e]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{gd=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Vo(t):""}function Ak(t){switch(t.tag){case 5:return Vo(t.type);case 16:return Vo("Lazy");case 13:return Vo("Suspense");case 19:return Vo("SuspenseList");case 0:case 2:case 15:return t=md(t.type,!1),t;case 11:return t=md(t.type.render,!1),t;case 1:return t=md(t.type,!0),t;default:return""}}function qf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ds:return"Fragment";case cs:return"Portal";case Uf:return"Profiler";case Wp:return"StrictMode";case Vf:return"Suspense";case Bf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case B0:return(t.displayName||"Context")+".Consumer";case V0:return(t._context.displayName||"Context")+".Provider";case Gp:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Kp:return e=t.displayName||null,e!==null?e:qf(t.type)||"Memo";case Tr:e=t._payload,t=t._init;try{return qf(t(e))}catch{}}return null}function Nk(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return qf(e);case 8:return e===Wp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Xr(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function H0(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function $k(t){var e=H0(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function cl(t){t._valueTracker||(t._valueTracker=$k(t))}function W0(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=H0(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function gu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Hf(t,e){var n=e.checked;return De({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Gg(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Xr(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function G0(t,e){e=e.checked,e!=null&&Hp(t,"checked",e,!1)}function Wf(t,e){G0(t,e);var n=Xr(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Gf(t,e.type,n):e.hasOwnProperty("defaultValue")&&Gf(t,e.type,Xr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Kg(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Gf(t,e,n){(e!=="number"||gu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Bo=Array.isArray;function Cs(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=dl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function pa(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Xo={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Fk=["Webkit","ms","Moz","O"];Object.keys(Xo).forEach(function(t){Fk.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Xo[e]=Xo[t]})});function X0(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Xo.hasOwnProperty(t)&&Xo[t]?(""+e).trim():e+"px"}function J0(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=X0(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var Lk=De({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Yf(t,e){if(e){if(Lk[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(z(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(z(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(z(61))}if(e.style!=null&&typeof e.style!="object")throw Error(z(62))}}function Xf(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Jf=null;function Qp(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Zf=null,ks=null,Ps=null;function Xg(t){if(t=Ja(t)){if(typeof Zf!="function")throw Error(z(280));var e=t.stateNode;e&&(e=Oc(e),Zf(t.stateNode,t.type,e))}}function Z0(t){ks?Ps?Ps.push(t):Ps=[t]:ks=t}function ew(){if(ks){var t=ks,e=Ps;if(Ps=ks=null,Xg(t),e)for(t=0;t>>=0,t===0?32:31-(Kk(t)/Qk|0)|0}var fl=64,hl=4194304;function qo(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function wu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=qo(a):(s&=o,s!==0&&(r=qo(s)))}else o=n&~i,o!==0?r=qo(o):s!==0&&(r=qo(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Ya(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-_n(e),t[e]=n}function Zk(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Zo),om=" ",am=!1;function ww(t,e){switch(t){case"keyup":return PP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xw(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var fs=!1;function TP(t,e){switch(t){case"compositionend":return xw(e);case"keypress":return e.which!==32?null:(am=!0,om);case"textInput":return t=e.data,t===om&&am?null:t;default:return null}}function IP(t,e){if(fs)return t==="compositionend"||!rv&&ww(t,e)?(t=yw(),Ql=ev=Dr=null,fs=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=dm(n)}}function Cw(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Cw(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function kw(){for(var t=window,e=gu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=gu(t.document)}return e}function iv(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function DP(t){var e=kw(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Cw(n.ownerDocument.documentElement,n)){if(r!==null&&iv(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=fm(n,s);var o=fm(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,hs=null,sh=null,ta=null,oh=!1;function hm(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;oh||hs==null||hs!==gu(r)||(r=hs,"selectionStart"in r&&iv(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ta&&wa(ta,r)||(ta=r,r=Eu(sh,"onSelect"),0gs||(t.current=fh[gs],fh[gs]=null,gs--)}function ke(t,e){gs++,fh[gs]=t.current,t.current=e}var Jr={},vt=ii(Jr),At=ii(!1),$i=Jr;function Ys(t,e){var n=t.type.contextTypes;if(!n)return Jr;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Nt(t){return t=t.childContextTypes,t!=null}function Cu(){Me(At),Me(vt)}function wm(t,e,n){if(vt.current!==Jr)throw Error(z(168));ke(vt,e),ke(At,n)}function $w(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(z(108,Nk(t)||"Unknown",i));return De({},n,r)}function ku(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Jr,$i=vt.current,ke(vt,t),ke(At,At.current),!0}function xm(t,e,n){var r=t.stateNode;if(!r)throw Error(z(169));n?(t=$w(t,e,$i),r.__reactInternalMemoizedMergedChildContext=t,Me(At),Me(vt),ke(vt,t)):Me(At),ke(At,n)}var Jn=null,Mc=!1,Od=!1;function Fw(t){Jn===null?Jn=[t]:Jn.push(t)}function XP(t){Mc=!0,Fw(t)}function si(){if(!Od&&Jn!==null){Od=!0;var t=0,e=ye;try{var n=Jn;for(ye=1;t>=o,i-=o,ir=1<<32-_n(e)+i|n<C?(R=k,k=null):R=k.sibling;var P=f(h,k,x[C],b);if(P===null){k===null&&(k=R);break}t&&k&&P.alternate===null&&e(h,k),v=s(P,v,C),S===null?E=P:S.sibling=P,S=P,k=R}if(C===x.length)return n(h,k),$e&&hi(h,C),E;if(k===null){for(;CC?(R=k,k=null):R=k.sibling;var $=f(h,k,P.value,b);if($===null){k===null&&(k=R);break}t&&k&&$.alternate===null&&e(h,k),v=s($,v,C),S===null?E=$:S.sibling=$,S=$,k=R}if(P.done)return n(h,k),$e&&hi(h,C),E;if(k===null){for(;!P.done;C++,P=x.next())P=d(h,P.value,b),P!==null&&(v=s(P,v,C),S===null?E=P:S.sibling=P,S=P);return $e&&hi(h,C),E}for(k=r(h,k);!P.done;C++,P=x.next())P=_(k,h,C,P.value,b),P!==null&&(t&&P.alternate!==null&&k.delete(P.key===null?C:P.key),v=s(P,v,C),S===null?E=P:S.sibling=P,S=P);return t&&k.forEach(function(O){return e(h,O)}),$e&&hi(h,C),E}function y(h,v,x,b){if(typeof x=="object"&&x!==null&&x.type===ds&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case ul:e:{for(var E=x.key,S=v;S!==null;){if(S.key===E){if(E=x.type,E===ds){if(S.tag===7){n(h,S.sibling),v=i(S,x.props.children),v.return=h,h=v;break e}}else if(S.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Tr&&Sm(E)===S.type){n(h,S.sibling),v=i(S,x.props),v.ref=Ro(h,S,x),v.return=h,h=v;break e}n(h,S);break}else e(h,S);S=S.sibling}x.type===ds?(v=Mi(x.props.children,h.mode,b,x.key),v.return=h,h=v):(b=ru(x.type,x.key,x.props,null,h.mode,b),b.ref=Ro(h,v,x),b.return=h,h=b)}return o(h);case cs:e:{for(S=x.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(h,v.sibling),v=i(v,x.children||[]),v.return=h,h=v;break e}else{n(h,v);break}else e(h,v);v=v.sibling}v=Dd(x,h.mode,b),v.return=h,h=v}return o(h);case Tr:return S=x._init,y(h,v,S(x._payload),b)}if(Bo(x))return m(h,v,x,b);if(Eo(x))return p(h,v,x,b);wl(h,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,v!==null&&v.tag===6?(n(h,v.sibling),v=i(v,x),v.return=h,h=v):(n(h,v),v=jd(x,h.mode,b),v.return=h,h=v),o(h)):n(h,v)}return y}var Js=zw(!0),Uw=zw(!1),Tu=ii(null),Iu=null,_s=null,lv=null;function uv(){lv=_s=Iu=null}function cv(t){var e=Tu.current;Me(Tu),t._currentValue=e}function vh(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Ts(t,e){Iu=t,lv=_s=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ot=!0),t.firstContext=null)}function rn(t){var e=t._currentValue;if(lv!==t)if(t={context:t,memoizedValue:e,next:null},_s===null){if(Iu===null)throw Error(z(308));_s=t,Iu.dependencies={lanes:0,firstContext:t}}else _s=_s.next=t;return e}var wi=null;function dv(t){wi===null?wi=[t]:wi.push(t)}function Vw(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,dv(e)):(n.next=i.next,i.next=n),e.interleaved=n,cr(t,r)}function cr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Ir=!1;function fv(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bw(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function ar(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Wr(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,fe&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,cr(t,n)}return i=r.interleaved,i===null?(e.next=e,dv(r)):(e.next=i.next,i.next=e),r.interleaved=e,cr(t,n)}function Xl(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Xp(t,n)}}function Cm(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Ou(t,e,n,r){var i=t.updateQueue;Ir=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;o=0,c=u=l=null,a=s;do{var f=a.lane,_=a.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:_,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=t,p=a;switch(f=e,_=n,p.tag){case 1:if(m=p.payload,typeof m=="function"){d=m.call(_,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=p.payload,f=typeof m=="function"?m.call(_,d,f):m,f==null)break e;d=De({},d,f);break e;case 2:Ir=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else _={eventTime:_,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=_,l=d):c=c.next=_,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(c===null&&(l=d),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);ji|=o,t.lanes=o,t.memoizedState=d}}function km(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Ad.transition;Ad.transition={};try{t(!1),e()}finally{ye=n,Ad.transition=r}}function ox(){return sn().memoizedState}function tR(t,e,n){var r=Kr(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ax(t))lx(e,n);else if(n=Vw(t,e,n,r),n!==null){var i=bt();wn(n,t,r,i),ux(n,e,r)}}function nR(t,e,n){var r=Kr(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ax(t))lx(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,xn(a,o)){var l=e.interleaved;l===null?(i.next=i,dv(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=Vw(t,e,i,r),n!==null&&(i=bt(),wn(n,t,r,i),ux(n,e,r))}}function ax(t){var e=t.alternate;return t===Le||e!==null&&e===Le}function lx(t,e){na=Au=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function ux(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Xp(t,n)}}var Nu={readContext:rn,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useInsertionEffect:lt,useLayoutEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useMutableSource:lt,useSyncExternalStore:lt,useId:lt,unstable_isNewReconciler:!1},rR={readContext:rn,useCallback:function(t,e){return Tn().memoizedState=[t,e===void 0?null:e],t},useContext:rn,useEffect:Rm,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Zl(4194308,4,tx.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Zl(4194308,4,t,e)},useInsertionEffect:function(t,e){return Zl(4,2,t,e)},useMemo:function(t,e){var n=Tn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Tn();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=tR.bind(null,Le,t),[r.memoizedState,t]},useRef:function(t){var e=Tn();return t={current:t},e.memoizedState=t},useState:Pm,useDebugValue:wv,useDeferredValue:function(t){return Tn().memoizedState=t},useTransition:function(){var t=Pm(!1),e=t[0];return t=eR.bind(null,t[1]),Tn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Le,i=Tn();if($e){if(n===void 0)throw Error(z(407));n=n()}else{if(n=e(),tt===null)throw Error(z(349));Li&30||Gw(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,Rm(Qw.bind(null,r,s,t),[t]),r.flags|=2048,Ra(9,Kw.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=Tn(),e=tt.identifierPrefix;if($e){var n=sr,r=ir;n=(r&~(1<<32-_n(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=ka++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[$n]=e,t[Ea]=r,_x(t,e,!1,!1),e.stateNode=t;e:{switch(o=Xf(n,r),n){case"dialog":Te("cancel",t),Te("close",t),i=r;break;case"iframe":case"object":case"embed":Te("load",t),i=r;break;case"video":case"audio":for(i=0;ito&&(e.flags|=128,r=!0,To(s,!1),e.lanes=4194304)}else{if(!r)if(t=Mu(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),To(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!$e)return ut(e),null}else 2*We()-s.renderingStartTime>to&&n!==1073741824&&(e.flags|=128,r=!0,To(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=We(),e.sibling=null,n=Fe.current,ke(Fe,r?n&1|2:n&1),e):(ut(e),null);case 22:case 23:return kv(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Lt&1073741824&&(ut(e),e.subtreeFlags&6&&(e.flags|=8192)):ut(e),null;case 24:return null;case 25:return null}throw Error(z(156,e.tag))}function dR(t,e){switch(ov(e),e.tag){case 1:return Nt(e.type)&&Cu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Zs(),Me(At),Me(vt),vv(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return pv(e),null;case 13:if(Me(Fe),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(z(340));Xs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Me(Fe),null;case 4:return Zs(),null;case 10:return cv(e.type._context),null;case 22:case 23:return kv(),null;case 24:return null;default:return null}}var bl=!1,ht=!1,fR=typeof WeakSet=="function"?WeakSet:Set,W=null;function ws(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Be(t,e,r)}else n.current=null}function Sh(t,e,n){try{n()}catch(r){Be(t,e,r)}}var Dm=!1;function hR(t,e){if(ah=xu,t=kw(),iv(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,d=t,f=null;t:for(;;){for(var _;d!==n||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(_=d.firstChild)!==null;)f=d,d=_;for(;;){if(d===t)break t;if(f===n&&++u===i&&(a=o),f===s&&++c===r&&(l=o),(_=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=_}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(lh={focusedElem:t,selectionRange:n},xu=!1,W=e;W!==null;)if(e=W,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,W=t;else for(;W!==null;){e=W;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var p=m.memoizedProps,y=m.memoizedState,h=e.stateNode,v=h.getSnapshotBeforeUpdate(e.elementType===e.type?p:dn(e.type,p),y);h.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var x=e.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(z(163))}}catch(b){Be(e,e.return,b)}if(t=e.sibling,t!==null){t.return=e.return,W=t;break}W=e.return}return m=Dm,Dm=!1,m}function ra(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Sh(e,n,s)}i=i.next}while(i!==r)}}function $c(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Ch(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function bx(t){var e=t.alternate;e!==null&&(t.alternate=null,bx(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[$n],delete e[Ea],delete e[dh],delete e[QP],delete e[YP])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Ex(t){return t.tag===5||t.tag===3||t.tag===4}function zm(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Ex(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function kh(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Su));else if(r!==4&&(t=t.child,t!==null))for(kh(t,e,n),t=t.sibling;t!==null;)kh(t,e,n),t=t.sibling}function Ph(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Ph(t,e,n),t=t.sibling;t!==null;)Ph(t,e,n),t=t.sibling}var rt=null,vn=!1;function xr(t,e,n){for(n=n.child;n!==null;)Sx(t,e,n),n=n.sibling}function Sx(t,e,n){if(Dn&&typeof Dn.onCommitFiberUnmount=="function")try{Dn.onCommitFiberUnmount(Pc,n)}catch{}switch(n.tag){case 5:ht||ws(n,e);case 6:var r=rt,i=vn;rt=null,xr(t,e,n),rt=r,vn=i,rt!==null&&(vn?(t=rt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):rt.removeChild(n.stateNode));break;case 18:rt!==null&&(vn?(t=rt,n=n.stateNode,t.nodeType===8?Id(t.parentNode,n):t.nodeType===1&&Id(t,n),ya(t)):Id(rt,n.stateNode));break;case 4:r=rt,i=vn,rt=n.stateNode.containerInfo,vn=!0,xr(t,e,n),rt=r,vn=i;break;case 0:case 11:case 14:case 15:if(!ht&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Sh(n,e,o),i=i.next}while(i!==r)}xr(t,e,n);break;case 1:if(!ht&&(ws(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Be(n,e,a)}xr(t,e,n);break;case 21:xr(t,e,n);break;case 22:n.mode&1?(ht=(r=ht)||n.memoizedState!==null,xr(t,e,n),ht=r):xr(t,e,n);break;default:xr(t,e,n)}}function Um(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new fR),e.forEach(function(r){var i=bR.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function un(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=We()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*vR(r/1960))-r,10t?16:t,zr===null)var r=!1;else{if(t=zr,zr=null,Lu=0,fe&6)throw Error(z(331));var i=fe;for(fe|=4,W=t.current;W!==null;){var s=W,o=s.child;if(W.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lWe()-Sv?Oi(t,0):Ev|=n),$t(t,e)}function Mx(t,e){e===0&&(t.mode&1?(e=hl,hl<<=1,!(hl&130023424)&&(hl=4194304)):e=1);var n=bt();t=cr(t,e),t!==null&&(Ya(t,e,n),$t(t,n))}function xR(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Mx(t,n)}function bR(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(z(314))}r!==null&&r.delete(e),Mx(t,n)}var Ax;Ax=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||At.current)Ot=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ot=!1,uR(t,e,n);Ot=!!(t.flags&131072)}else Ot=!1,$e&&e.flags&1048576&&Lw(e,Ru,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;eu(t,e),t=e.pendingProps;var i=Ys(e,vt.current);Ts(e,n),i=mv(null,e,r,t,i,n);var s=yv();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Nt(r)?(s=!0,ku(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,fv(e),i.updater=Nc,e.stateNode=i,i._reactInternals=e,mh(e,r,t,n),e=wh(null,e,r,!0,s,n)):(e.tag=0,$e&&s&&sv(e),yt(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(eu(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=SR(r),t=dn(r,t),i){case 0:e=_h(null,e,r,t,n);break e;case 1:e=Fm(null,e,r,t,n);break e;case 11:e=Nm(null,e,r,t,n);break e;case 14:e=$m(null,e,r,dn(r.type,t),n);break e}throw Error(z(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:dn(r,i),_h(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:dn(r,i),Fm(t,e,r,i,n);case 3:e:{if(gx(e),t===null)throw Error(z(387));r=e.pendingProps,s=e.memoizedState,i=s.element,Bw(t,e),Ou(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=eo(Error(z(423)),e),e=Lm(t,e,r,n,i);break e}else if(r!==i){i=eo(Error(z(424)),e),e=Lm(t,e,r,n,i);break e}else for(Ut=Hr(e.stateNode.containerInfo.firstChild),Bt=e,$e=!0,gn=null,n=Uw(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Xs(),r===i){e=dr(t,e,n);break e}yt(t,e,r,n)}e=e.child}return e;case 5:return qw(e),t===null&&ph(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,uh(r,i)?o=null:s!==null&&uh(r,s)&&(e.flags|=32),vx(t,e),yt(t,e,o,n),e.child;case 6:return t===null&&ph(e),null;case 13:return mx(t,e,n);case 4:return hv(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Js(e,null,r,n):yt(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:dn(r,i),Nm(t,e,r,i,n);case 7:return yt(t,e,e.pendingProps,n),e.child;case 8:return yt(t,e,e.pendingProps.children,n),e.child;case 12:return yt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,ke(Tu,r._currentValue),r._currentValue=o,s!==null)if(xn(s.value,o)){if(s.children===i.children&&!At.current){e=dr(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=ar(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),vh(s.return,n,e),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(z(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),vh(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}yt(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Ts(e,n),i=rn(i),r=r(i),e.flags|=1,yt(t,e,r,n),e.child;case 14:return r=e.type,i=dn(r,e.pendingProps),i=dn(r.type,i),$m(t,e,r,i,n);case 15:return hx(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:dn(r,i),eu(t,e),e.tag=1,Nt(r)?(t=!0,ku(e)):t=!1,Ts(e,n),cx(e,r,i),mh(e,r,i,n),wh(null,e,r,!0,t,n);case 19:return yx(t,e,n);case 22:return px(t,e,n)}throw Error(z(156,e.tag))};function Nx(t,e){return aw(t,e)}function ER(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zt(t,e,n,r){return new ER(t,e,n,r)}function Rv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function SR(t){if(typeof t=="function")return Rv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Gp)return 11;if(t===Kp)return 14}return 2}function Qr(t,e){var n=t.alternate;return n===null?(n=Zt(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function ru(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")Rv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case ds:return Mi(n.children,i,s,e);case Wp:o=8,i|=8;break;case Uf:return t=Zt(12,n,e,i|2),t.elementType=Uf,t.lanes=s,t;case Vf:return t=Zt(13,n,e,i),t.elementType=Vf,t.lanes=s,t;case Bf:return t=Zt(19,n,e,i),t.elementType=Bf,t.lanes=s,t;case q0:return Lc(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case V0:o=10;break e;case B0:o=9;break e;case Gp:o=11;break e;case Kp:o=14;break e;case Tr:o=16,r=null;break e}throw Error(z(130,t==null?t:typeof t,""))}return e=Zt(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function Mi(t,e,n,r){return t=Zt(7,t,r,e),t.lanes=n,t}function Lc(t,e,n,r){return t=Zt(22,t,r,e),t.elementType=q0,t.lanes=n,t.stateNode={isHidden:!1},t}function jd(t,e,n){return t=Zt(6,t,null,e),t.lanes=n,t}function Dd(t,e,n){return e=Zt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function CR(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_d(0),this.expirationTimes=_d(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_d(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Tv(t,e,n,r,i,s,o,a,l){return t=new CR(t,e,n,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Zt(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},fv(s),t}function kR(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(jx)}catch(t){console.error(t)}}jx(),j0.exports=Gt;var el=j0.exports;const OR=k0(el);var Dx,Qm=el;Dx=Qm.createRoot,Qm.hydrateRoot;var zu=["light","dark"],Av="(prefers-color-scheme: dark)",MR=typeof window>"u",Nv=g.createContext(void 0),AR={setTheme:t=>{},themes:[]},d3=()=>{var t;return(t=g.useContext(Nv))!=null?t:AR},NR=t=>g.useContext(Nv)?t.children:g.createElement(FR,{...t}),$R=["light","dark"],FR=({forcedTheme:t,disableTransitionOnChange:e=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:i="theme",themes:s=$R,defaultTheme:o=n?"system":"light",attribute:a="data-theme",value:l,children:u,nonce:c})=>{let[d,f]=g.useState(()=>Ym(i,o)),[_,m]=g.useState(()=>Ym(i)),p=l?Object.values(l):s,y=g.useCallback(b=>{let E=b;if(!E)return;b==="system"&&n&&(E=Xm());let S=l?l[E]:E,k=e?jR():null,C=document.documentElement;if(a==="class"?(C.classList.remove(...p),S&&C.classList.add(S)):S?C.setAttribute(a,S):C.removeAttribute(a),r){let R=zu.includes(o)?o:null,P=zu.includes(E)?E:R;C.style.colorScheme=P}k==null||k()},[]),h=g.useCallback(b=>{let E=typeof b=="function"?b(b):b;f(E);try{localStorage.setItem(i,E)}catch{}},[t]),v=g.useCallback(b=>{let E=Xm(b);m(E),d==="system"&&n&&!t&&y("system")},[d,t]);g.useEffect(()=>{let b=window.matchMedia(Av);return b.addListener(v),v(b),()=>b.removeListener(v)},[v]),g.useEffect(()=>{let b=E=>{if(E.key!==i)return;let S=E.newValue||o;h(S)};return window.addEventListener("storage",b),()=>window.removeEventListener("storage",b)},[h]),g.useEffect(()=>{y(t??d)},[t,d]);let x=g.useMemo(()=>({theme:d,setTheme:h,forcedTheme:t,resolvedTheme:d==="system"?_:d,themes:n?[...s,"system"]:s,systemTheme:n?_:void 0}),[d,h,t,_,n,s]);return g.createElement(Nv.Provider,{value:x},g.createElement(LR,{forcedTheme:t,disableTransitionOnChange:e,enableSystem:n,enableColorScheme:r,storageKey:i,themes:s,defaultTheme:o,attribute:a,value:l,children:u,attrs:p,nonce:c}),u)},LR=g.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:s,value:o,attrs:a,nonce:l})=>{let u=s==="system",c=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(m=>`'${m}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=i?zu.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(m,p=!1,y=!0)=>{let h=o?o[m]:m,v=p?m+"|| ''":`'${h}'`,x="";return i&&y&&!p&&zu.includes(m)&&(x+=`d.style.colorScheme = '${m}';`),n==="class"?p||h?x+=`c.add(${v})`:x+="null":h&&(x+=`d[s](n,${v})`),x},_=t?`!function(){${c}${f(t)}}()`:r?`!function(){try{${c}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${Av}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}${u?"":"else{"+f(s,!1,!1)+"}"}${d}}catch(e){}}()`:`!function(){try{${c}var e=localStorage.getItem('${e}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}else{${f(s,!1,!1)};}${d}}catch(t){}}();`;return g.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:_}})}),Ym=(t,e)=>{if(MR)return;let n;try{n=localStorage.getItem(t)||void 0}catch{}return n||e},jR=()=>{let t=document.createElement("style");return t.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},Xm=t=>(t||(t=window.matchMedia(Av)),t.matches?"dark":"light"),T=typeof window<"u"?window:void 0,pt=typeof globalThis<"u"?globalThis:T,xt=pt==null?void 0:pt.navigator,j=pt==null?void 0:pt.document,Ie=pt==null?void 0:pt.location,$v=pt==null?void 0:pt.fetch,Mh=pt!=null&&pt.XMLHttpRequest&&"withCredentials"in new pt.XMLHttpRequest?pt.XMLHttpRequest:void 0,Jm=pt==null?void 0:pt.AbortController,DR=pt==null?void 0:pt.CompressionStream,Rt=xt==null?void 0:xt.userAgent;function zx(){return!(!T||T.navigator.onLine===!1)}var Oo=typeof globalThis<"u"?globalThis:T;Oo&&typeof self>"u"&&(Oo.self=Oo),Oo&&typeof File>"u"&&(Oo.File=function(){});var Q=T??{},we={DEBUG:!1,LIB_VERSION:"0.5.1",LIB_NAME:"browser-common"};function Zm(t,e,n,r,i,s,o){try{var a=t[s](o),l=a.value}catch(u){return void n(u)}a.done?e(l):Promise.resolve(l).then(r,i)}function be(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function o(l){Zm(s,r,i,o,a,"next",l)}function a(l){Zm(s,r,i,o,a,"throw",l)}o(void 0)})}}function N(){return N=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},N.apply(null,arguments)}function Ux(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var ey=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function ty(t){return typeof t=="string"||t}function ny(t){return typeof t=="string"?t:void 0}var Mo,zR=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Xn=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),ry=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),UR=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],VR=["token"],Vx="NativeGzipValidationError",Ah=t=>t.length>=2&&t[0]===31&&t[1]===139,iy=(t,e)=>t===ry.GZipJS||e===ry.GZipJS||e==="gzip",sy=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError",Cl=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=Vx,e},BR=function(){var t=be(function*(e,n){18>e.size&&Cl("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());Ah(r)&&r[2]===8||Cl("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(o=>{for(var a=(()=>{if(Mo)return Mo;Mo=[];for(var c=0;256>c;c++){for(var d=c,f=0;8>f;f++)d=1&d?3988292384^d>>>1:d>>>1;Mo[c]=d>>>0}return Mo})(),l=4294967295,u=0;o.length>u;u++)l=a[255&(l^o[u])]^l>>>8;return(4294967295^l)>>>0})(n)&&Cl("invalid-crc");var s=n.length>>>0;i.getUint32(4,!0)!==s&&Cl("invalid-size")});return function(e,n){return t.apply(this,arguments)}}();function Nh(){return Nh=be(function*(t,e,n){e===void 0&&(e=!0);try{var r=new TextEncoder().encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),o=s.write(r).then(()=>s.close()).catch(function(){var u=be(function*(c){try{yield s.abort(c)}catch{}throw c});return function(c){return u.apply(this,arguments)}}()),a=new Response(i.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield BR(l,r),l}catch(u){if(n!=null&&n.rethrow)throw u;return e&&console.error("Failed to gzip compress data",u),null}}),Nh.apply(this,arguments)}var qR=20,Bx=1e3,HR=1e4,WR="[Circular]",$h="[Truncated]",Vc="[Unserializable]",GR="[Function]";function Os(t){for(var e="",n=0;t.length>n;n++){var r=t.charCodeAt(n);if(55296>r||r>56319)e+=56320>r||r>57343?t[n]:"�";else{var i=t.charCodeAt(n+1);56320>i||i>57343?e+="�":(e+=t[n]+t[n+1],n++)}}return e}var KR=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],oy=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return KR.concat(e).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})};function Y(t,e){return t.indexOf(e)!==-1}var Bc=function(t){return t.trim()},Fh=function(t){return t.replace(/^\$/,"")};function qx(t){var e,n=[];return(e=JSON.stringify(t,function(r,i){if(typeof i=="bigint")return i.toString();if(typeof i!="function"&&typeof i!="symbol"){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&typeof i=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(i))return"[Circular]";n.push(i)}return i}}))!==null&&e!==void 0?e:"null"}var Hx=Object.prototype,Wx=Hx.hasOwnProperty,qc=Hx.toString,X=Array.isArray||function(t){return qc.call(t)==="[object Array]"},ft=t=>typeof t=="function",xe=t=>t===Object(t)&&!X(t),yn=t=>{if(xe(t)){for(var e in t)if(Wx.call(t,e))return!1;return!0}return!1},F=t=>t===void 0,ue=t=>qc.call(t)=="[object String]",Uu=t=>ue(t)&&t.trim().length===0,et=t=>t===null,te=t=>F(t)||et(t),qe=t=>qc.call(t)=="[object Number]"&&t==t,Gn=t=>qe(t)&&t>0,It=t=>qc.call(t)==="[object Boolean]",QR=t=>t instanceof FormData,YR=t=>Y(UR,t),XR=t=>Y(VR,t);function Gx(t){return t===null||typeof t!="object"}function Vu(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Kx(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Qx(t,Error)}}function Fv(t){return typeof Event<"u"&&Qx(t,Event)}function Qx(t,e){try{return t instanceof e}catch{return!1}}var JR=[!0,"true",1,"1","yes"],zd=t=>Y(JR,t),ZR=[!1,"false",0,"0","no"];function Ln(t,e,n,r,i){return e>n&&(r.warn("min cannot be greater than max."),e=n),qe(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),Ln(i||n,e,n,r))}class eT{constructor(e){this.k={},this.S=e.S,this.C=Ln(e.bucketSize,0,100,e.I),this.R=Ln(e.refillRate,0,this.C,e.I),this.A=Ln(e.refillInterval,0,864e5,e.I)}O(e,n){var r=Math.floor((n-e.lastAccess)/this.A);r>0&&(e.tokens=Math.min(e.tokens+r*this.R,this.C),e.lastAccess=e.lastAccess+r*this.A)}consumeRateLimit(e){var n,r=Date.now(),i=String(e),s=this.k[i];return s?this.O(s,r):this.k[i]=s={tokens:this.C,lastAccess:r},s.tokens===0||(s.tokens--,s.tokens===0&&((n=this.S)==null||n.call(this,e)),s.tokens===0)}stop(){this.k={}}}var qt="Mobile",Bu="iOS",or="Android",no="Tablet",Yx=or+" "+no,Xx="iPad",Jx="Apple",Zx=Jx+" Watch",oa="Safari",ro="BlackBerry",eb="Samsung",tb=eb+"Browser",nb=eb+" Internet",Ai="Chrome",tT=Ai+" OS",rb=Ai+" "+Bu,Lv="Internet Explorer",ib=Lv+" "+qt,jv="Opera",nT=jv+" Mini",Dv="Edge",sb="Microsoft "+Dv,Ms="Firefox",ob=Ms+" "+Bu,Ia="Nintendo",Oa="PlayStation",As="Xbox",ab=or+" "+qt,lb=qt+" "+oa,Wo="Windows",Lh=Wo+" Phone",ay="Nokia",jh="Ouya",ub="Generic",rT=ub+" "+qt.toLowerCase(),cb=ub+" "+no.toLowerCase(),Dh="Konqueror",db="Oculus Browser",qu="Vivaldi",fb="Yandex",Hu="Whale",zh="DuckDuckGo",hb="Pale Moon",Wu="Waterfox",aa="Brave",pb="Google Search App",Ne="(\\d+(\\.\\d+)?)",Ud=new RegExp("Version/"+Ne),iT=new RegExp(As,"i"),sT=new RegExp(Oa+" \\w+","i"),oT=new RegExp(Ia+" \\w+","i"),zv=new RegExp(ro+"|PlayBook|BB10","i"),aT={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},vb=function(t,e,n,r){e=e||"";var i=function(s){return s!=null&&s.brave?aa:null}(n);return i||(r!=null&&r.detectGoogleSearchApp&&Y(t,"GSA/")?pb:Y(t," OPR/")&&Y(t,"Mini")?nT:Y(t," OPR/")?jv:zv.test(t)?ro:Y(t,"IE"+qt)||Y(t,"WPDesktop")?ib:Y(t,"OculusBrowser")?db:Y(t,tb)?nb:Y(t,Dv)||Y(t,"Edg/")?sb:Y(t,qu+"/")?qu:Y(t,"YaBrowser/")?fb:Y(t,Hu+"/")?Hu:Y(t,zh+"/")||Y(t,"Ddg/")?zh:Y(t,"FBIOS")?"Facebook "+qt:Y(t,"UCWEB")||Y(t,"UCBrowser")?"UC Browser":Y(t,"CriOS")?rb:Y(t,"CrMo")||Y(t,Ai)?Ai:Y(t,or)&&Y(t,oa)?ab:Y(t,"FxiOS")?ob:Y(t.toLowerCase(),Dh.toLowerCase())?Dh:Y(t,aa+"/")?aa:((s,o)=>o&&Y(o,Jx)||function(a){return Y(a,oa)&&!Y(a,Ai)&&!Y(a,or)}(s))(t,e)?Y(t,qt)?lb:oa:Y(t,"PaleMoon/")?hb:Y(t,Wu+"/")?Wu:Y(t,Ms)?Ms:Y(t,"MSIE")||Y(t,"Trident/")?Lv:Y(t,"Gecko")?Ms:"")},lT={[ib]:[new RegExp("rv:"+Ne)],[sb]:[new RegExp(Dv+"?\\/"+Ne)],[Ai]:[new RegExp("("+Ai+"|CrMo)\\/"+Ne)],[rb]:[new RegExp("CriOS\\/"+Ne)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ne)],[oa]:[Ud],[lb]:[Ud],[jv]:[new RegExp("(Opera|OPR)\\/"+Ne)],[Ms]:[new RegExp(Ms+"\\/"+Ne)],[ob]:[new RegExp("FxiOS\\/"+Ne)],[Dh]:[new RegExp("Konqueror[:/]?"+Ne,"i")],[ro]:[new RegExp(ro+" "+Ne),Ud],[ab]:[new RegExp("android\\s"+Ne,"i")],[nb]:[new RegExp(tb+"\\/"+Ne)],[db]:[new RegExp("OculusBrowser\\/"+Ne)],[qu]:[new RegExp(qu+"\\/"+Ne)],[fb]:[new RegExp("YaBrowser\\/"+Ne)],[Hu]:[new RegExp(Hu+"\\/"+Ne)],[aa]:[new RegExp(aa+"\\/"+Ne)],[zh]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ne)],[hb]:[new RegExp("PaleMoon\\/"+Ne)],[Wu]:[new RegExp(Wu+"\\/"+Ne)],[pb]:[new RegExp("GSA\\/"+Ne)],[Lv]:[new RegExp("(rv:|MSIE )"+Ne)],Mozilla:[new RegExp("rv:"+Ne)]},uT=function(t,e,n,r){var i=vb(t,e,n,r),s=lT[i];if(F(s))return null;for(var o=0;s.length>o;o++){var a=t.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},ly=[[new RegExp(As+"; "+As+" (.*?)[);]","i"),t=>[As,t&&t[1]||""]],[new RegExp(Ia,"i"),[Ia,""]],[new RegExp(Oa,"i"),[Oa,""]],[zv,[ro,""]],[new RegExp(Wo,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Lh,""];if(new RegExp(qt).test(e)&&!/IEMobile\b/.test(e))return[Wo+" "+qt,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=aT[n[1]]||"";return/arm/i.test(e)&&(r="RT"),[Wo,r]}return[Wo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Bu,[t[3],t[4],t[5]||"0"].join(".")]:[Bu,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=F(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+or+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+or+")","i"),t=>t&&t[2]?[or,[t[2],t[3],t[4]||"0"].join(".")]:[or,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[tT,""]],[/Linux|debian/i,["Linux",""]]],uy=function(t){return oT.test(t)?Ia:sT.test(t)?Oa:iT.test(t)?As:new RegExp(jh,"i").test(t)?jh:new RegExp("("+Lh+"|WPDesktop)","i").test(t)?Lh:/iPad/.test(t)?Xx:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Zx:zv.test(t)?ro:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(ay,"i").test(t)?ay:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(qt).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?or:Yx:new RegExp("(pda|"+qt+")","i").test(t)?rT:new RegExp(no,"i").test(t)&&!new RegExp(no+" pc","i").test(t)?cb:""},cT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function cy(t,e){return typeof(n=t)=="string"&&cT.test(n)?t:e();var n}function Zr(t){return t&&t.split("#")[0]}function Uv(t,e){var n=setTimeout(t,e);return n!=null&&n.unref&&(n==null||n.unref()),n}function dy(t,e,n){return gb.apply(this,arguments)}function gb(){return(gb=be(function*(t,e,n){var r;try{return yield Promise.race([t,new Promise((i,s)=>{r=Uv(()=>{try{n==null||n(),i()}catch(o){s(o)}},e)})])}finally{clearTimeout(r)}})).apply(this,arguments)}var mb={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},dT=mb.info,fy=9223372036854776e3,fT={}.propertyIsEnumerable;function Gu(t,e){try{return yb(t,e,{ancestors:new WeakSet,remainingNodes:HR},0)}catch{return[]}}function Vv(t,e,n,r){if(0>=n.remainingNodes)return{stringValue:$h};if(n.remainingNodes--,It(t))return{boolValue:t};if(typeof t=="number"){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};var i=BigInt(t).toString();return t>=fy||-fy>t?(e==null||e.debug("Attribute "+i+" is outside the int64 range; encoding it as a string"),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if(typeof t=="string")return{stringValue:Os(t)};if(typeof t=="function")return{stringValue:GR};if(typeof t=="symbol")return{stringValue:String(t)};if(typeof t=="object"&&t!==null){if(n.ancestors.has(t))return{stringValue:WR};if(r>=qR)return{stringValue:$h};if(t instanceof Date){var s=t.getTime(),o=Number.isFinite(s)?t.toISOString():String(t);return{stringValue:typeof o=="string"?Os(o):String(o)}}n.ancestors.add(t);try{try{var a=t.toJSON;if(typeof a=="function")return Vv(a.call(t),e,n,r+1)}catch{}return X(t)?{arrayValue:{values:hT(t,e,n,r+1)}}:{kvlistValue:{values:yb(t,e,n,r+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:Os(String(t))}}function hT(t,e,n,r){for(var i=[],s=Math.min(t.length,Bx),o=0;s>o&&n.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(te(a))continue;i.push(Vv(a,e,n,r))}catch{i.push({stringValue:Vc})}return t.length>o&&i.push({stringValue:$h}),i}function yb(t,e,n,r){var i=[];for(var s in t)if(fT.call(t,s)){if(i.length>=Bx||0>=n.remainingNodes){e==null||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[s];if(et(o)||F(o))continue;i.push({key:Os(s),value:Vv(o,e,n,r)})}catch{i.push({key:Os(s),value:{stringValue:Vc}})}}return i}function pT(t){try{return Os(String(t))}catch{return Vc}}function vT(t,e,n){var r=mb[t.level||"info"]||dT,i=r.text,s=r.number,o=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),te(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),te(e.lastActivityTimestamp)||(a.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);var l=N({},a),u=t.attributes;if(u){var c=[];try{c=Object.keys(u)}catch{c=[]}for(var d of c){var f=void 0;try{f=u[d]}catch{f=Vc}Object.defineProperty(l,d,{value:f,enumerable:!0,writable:!0,configurable:!0})}}var _={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:s,severityText:i,body:{stringValue:pT(t.body)},attributes:Gu(l,n)};return t.trace_id&&(_.traceId=t.trace_id),t.span_id&&(_.spanId=t.span_id),F(t.trace_flags)||(_.flags=t.trace_flags),_}function _b(t,e,n){return N({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":n})}function wb(t,e,n,r){return{resourceLogs:[{resource:{attributes:Gu(e)},scopeLogs:[{scope:{name:n,version:r},logRecords:t}]}]}}let gT=class{constructor(t,e,n,r,i,s,o){var a;s===void 0&&(s=()=>Promise.resolve()),this._instance=t,this.qi=e,this.I=n,this.rn=r,this.nn=i,this.sn=s,this.an=o,this.ln=null,this.un=0,this.hn=0,this.dn=0,this.vn=0,this.cn=!1,this.fn=e.maxBufferSize,this.pn=Math.max((a=e.maxQueueSize)!==null&&a!==void 0?a:e.maxBufferSize,e.maxBufferSize),this.gn=e.flushIntervalMs,this.mn=e.maxBatchRecordsPerPost,this.yn=e.rateCapWindowMs,this.bn=e.maxLogsPerInterval}reset(){this._n(),this.ln=null,this.dn=0,this.vn=0,this.cn=!1,this.un=0,this.hn=0,this.mn=this.qi.maxBatchRecordsPerPost}onReconnect(){this.hn=0,this.wn()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&t!=null&&t.body){var e=this.kn(t);if(e!==null)if(e.body){if(this.Sn()){var n={record:vT(e,this.rn(),this.I)};this.nn(()=>this.xn(n))}}else this.I.info("Log was rejected in beforeSend function")}}kn(t){var e=this.qi.beforeSend;if(!e)return t;var n=X(e)?e:[e],r=t;for(var i of n)try{var s=i(r);if(!s)return this.I.info("Log was rejected in beforeSend function"),null;r=s}catch(o){return this.I.error("Error in beforeSend function for log:",o),null}return r}Sn(){if(this.bn===void 0)return!0;var t=Date.now(),e=t-this.dn;return this.yn>e&&e>=0||(this.dn=t,this.vn=0,this.cn=!1),this.bn>this.vn?(this.vn++,!0):(this.cn||(this.I.warn("captureLog dropping logs: exceeded "+this.bn+" logs per "+this.yn+"ms"),this.cn=!0),!1)}flush(){var t=this;return be(function*(){if(!t._instance.isDisabled)return t.ln||(t.ln=t.Cn().finally(()=>{t.ln=null})),t.ln})()}Cn(){var t=this;return be(function*(){var e;t._n();var n=(e=t._instance.getPersistedProperty(Xn.LogsQueue))!==null&&e!==void 0?e:[];if(n.length!==0)for(var r=n.length,i=0;n.length>0&&r>i;){var s,o;t.un=0;var a=Math.min(n.length,t.mn),l=n.slice(0,a),u=wb(l.map(d=>d.record),t.Tn(),(s=t.an)!==null&&s!==void 0?s:t._instance.getLibraryId(),t._instance.getLibraryVersion()),c=yield t._instance.Mn(u);if(c.kind==="too-large"&&l.length>1)t.mn=Math.max(1,Math.floor(l.length/2)),t.I.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.mn);else if(c.kind==="retry-later"||(c.kind==="too-large"?t.I.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):c.kind==="ok"&&t.qi.maxBatchRecordsPerPost>t.mn&&(t.mn=Math.min(t.qi.maxBatchRecordsPerPost,t.mn+1)),yield t.En(l.length),n=(o=t._instance.getPersistedProperty(Xn.LogsQueue))!==null&&o!==void 0?o:[],i+=l.length,c.kind==="fatal"))throw c.error}})()}En(t){var e=this;return be(function*(){var n,r=Math.max(0,t-e.un),i=(n=e._instance.getPersistedProperty(Xn.LogsQueue))!==null&&n!==void 0?n:[];e._instance.setPersistedProperty(Xn.LogsQueue,i.slice(r)),yield e.sn()})()}Tn(){return _b(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(t){var e;if(!this._instance.optedOut){var n=(e=this._instance.getPersistedProperty(Xn.LogsQueue))!==null&&e!==void 0?e:[];this.pn>n.length||(n.shift(),this.un++,this.I.info("Logs queue is full, dropping oldest record.")),n.push(t),this._instance.setPersistedProperty(Xn.LogsQueue,n),this.fn>n.length?this.In():this.wn()}}In(t){t===void 0&&(t=this.gn),this.Rn||(this.Rn=Uv(()=>{this.Rn=void 0,this.wn()},t))}Pn(){var t=Math.min(Math.max(0,this.hn-1),6);return this.gn*Math.pow(2,t)}An(){var t=this._instance.getPersistedProperty(Xn.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return be(function*(){e._n();var n=e.flush().catch(()=>{});t!==void 0?yield dy(n,t):yield n})()}flushWithTimeout(t){var e=this;return be(function*(){var n=e.flush();yield dy(n,t,()=>{n.catch(()=>{})})})()}wn(){this.flush().then(()=>{this.hn=0},t=>{this.hn++,this.I.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.An()&&this.In(this.Pn())})}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}};var Vd=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function hy(t){return String(t)+"000000"}function py(t,e,n,r){var i="";return r&&(i=Object.keys(r).sort().map(s=>JSON.stringify(s)+":"+JSON.stringify(r[s])).join(",")),t+"\0"+e+"\0"+(n??"")+"\0"+i}let mT=class{constructor(t,e,n){this._instance=t,this.qi=e,this.I=n,this.Fn=new Map,this.ln=null,this.On=!1,this.Ln=new Map,this.$n=new Set,this.Dn=0}count(t,e,n){e===void 0&&(e=1),this.Nn({name:t,type:"count",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(t,e,n){this.Nn({name:t,type:"gauge",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(t,e,n){this.Nn({name:t,type:"histogram",value:e,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var t=this,e=this.ln,n=function(){var i=be(function*(){e&&(yield e.catch(()=>{})),yield t.qn()});return function(){return i.apply(this,arguments)}}(),r=n().finally(()=>{this.ln===r&&(this.ln=null)});return this.ln=r,r}drainWindow(){if(this.Fn.size===0)return null;var t=this.Fn;return this.Fn=new Map,this.On=!1,this.Ln=new Map,this.$n=new Set,this.jn(t)}reset(){this.Dn++,this._n(),this.Fn=new Map,this.ln=null,this.On=!1,this.Ln=new Map,this.$n=new Set}Nn(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.kn(t);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.I.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var n,r;try{n=e.attributes?N({},e.attributes):void 0,r=py(e.type,e.name,e.unit,n)}catch(o){return void this.I.warn("Dropping metric '"+e.name+"': attributes could not be serialized",o)}var i=this.Fn.get(r);if(!i){if(!this.Bn())return;i={name:e.name,type:e.type,unit:e.unit,attributes:n,windowStartMs:Date.now()},this.Fn.set(r,i)}var s=this.Ln.get(e.name);s===void 0?this.Ln.set(e.name,e.type):s===e.type||this.$n.has(e.name)||(this.$n.add(e.name),this.I.warn("Metric name '"+e.name+"' is already used as a "+s+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Hn(i,e.value),this.In()}else this.I.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}Bn(){return this.qi.maxSeriesPerFlush>this.Fn.size||(this.On||(this.On=!0,this.I.warn("Metric series cap reached ("+this.qi.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Hn(t,e){var n;switch(t.type){case"count":t.total=((n=t.total)!==null&&n!==void 0?n:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Vd.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[function(i,s){for(var o=0;s.length>o;o++)if(s[o]>=i)return o;return s.length}(e,Vd)]+=1}}kn(t){var e=this.qi.beforeSend;if(!e)return t;var n=X(e)?e:[e],r=t;for(var i of n)try{var s=i(r);if(!s)return this.I.info("Metric was rejected in beforeSend function"),null;r=s}catch(o){return this.I.error("Error in beforeSend function for metric:",o),null}return r}In(){this.Rn||(this.Rn=Uv(()=>{this.Rn=void 0,this.flush().catch(t=>{this.I.error("Metrics flush failed:",t)})},this.qi.flushIntervalMs))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}qn(){var t=this;return be(function*(){if(t.Fn.size!==0){var e=t.Fn;t.Fn=new Map,t.On=!1,t.Ln=new Map,t.$n=new Set;var n=t.Dn,r=yield t._instance.Un(t.jn(e));if(n===t.Dn)switch(r.kind){case"ok":return;case"retry-later":return t.zn(e),void t.In();case"too-large":return void t.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.I.error("Failed to send metrics batch:",r.error)}}})()}jn(t){return e=this.Wn(t),n=function(s,o,a){return N({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":o,"telemetry.sdk.version":a})}(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Gu(n)},scopeMetrics:[{scope:{name:r,version:i},metrics:e}]}]};var e,n,r,i}Wn(t){var e=hy(Date.now()),n=new Map;for(var r of t.values()){var i,s=py(r.type,r.name,r.unit,void 0),o=n.get(s);o||(o=N({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},n.set(s,o));var a=Gu((i=r.attributes)!==null&&i!==void 0?i:{},this.I),l=hy(r.windowStartMs);if(r.type==="count"){var u,c={attributes:a,startTimeUnixNano:l,timeUnixNano:e,asDouble:(u=r.total)!==null&&u!==void 0?u:0};o.sum.dataPoints.push(c)}else if(r.type==="gauge"){var d,f={attributes:a,timeUnixNano:e,asDouble:(d=r.last)!==null&&d!==void 0?d:0};o.gauge.dataPoints.push(f)}else r.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:e,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:Vd})}return Array.from(n.values())}zn(t){var e,n;for(var r of t){var i=r[0],s=r[1],o=this.Fn.get(i);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,s.windowStartMs),o.type){case"count":o.total=((e=o.total)!==null&&e!==void 0?e:0)+((n=s.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(s.hist)if(o.hist){o.hist.count+=s.hist.count,o.hist.sum+=s.hist.sum,o.hist.min=Math.min(o.hist.min,s.hist.min),o.hist.max=Math.max(o.hist.max,s.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else o.hist=s.hist}else this.Bn()&&this.Fn.set(i,s)}}};var kl,vy,Bd;function yT(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return Bd&&n.length===vy||(vy=n.length,Bd=n.reduce((r,i)=>{kl||(kl={});var s=kl[i];if(s)r[s[0]]=s[1];else for(var o=t(i),a=o.length-1;a>=0;a--){var l=o[a],u=l==null?void 0:l.filename,c=e[i];if(u&&c){r[u]=c,kl[i]=[u,c];break}}return r},{})),Bd}}class _T{constructor(e,n,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=n,this.modifiers=r}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,n,0).apply(e),s=this.buildParsingContext(n),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var n=this;return be(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&X(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,i;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),N({},e,{cause:r,stack:i})}applyChunkIds(e,n){return e.map(r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return be(function*(){var r=e;for(var i of n.modifiers)r=yield i(r);return r})()}convertToExceptionList(e,n){var r,i,s,o={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(i=n.handled)===null||i===void 0||i,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,N({},n,{handled:!0}))),a}buildParsingContext(e){var n;return{chunkIdMap:yT(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var i=(s,o)=>{if(4>=o){var a=this.buildCoercingContext(e,n,o);return this.applyCoercers(s,a)}};return N({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:s=>i(s,r),next:s=>i(s,r+1)})}}var io="?";function Uh(t,e,n,r,i){var s={platform:t,filename:e,function:n===""?io:n,in_app:!(e!=null&&e.startsWith("webkit-masked-url://"))&&e!==""};return F(r)||(s.lineno=r),F(i)||(s.colno=i),s}var xb=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:io,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},wT=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,xT=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,bT=/\((\S*)(?::(\d+))(?::(\d+))\)/,ET=(t,e)=>{var n=wT.exec(t);if(n)return Uh(e,n[1],io,+n[2],+n[3]);var r=xT.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){var i=bT.exec(r[2]);i&&(r[2]=i[1],r[3]=i[2],r[4]=i[3])}var s=xb(r[1]||io,r[2]);return Uh(e,s[1],s[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},ST=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,CT=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,kT=(t,e)=>{var n=ST.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=CT.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var i=n[3],s=n[1]||io,o=xb(s,i);return Uh(e,i=o[1],s=o[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},gy=/\(error: (.*)\)/;class PT{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=ue(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return Vu(e,"DOMException")}isDOMError(e){return Vu(e,"DOMError")}}class RT{match(e){return Kx(e)}coerce(e,n){var r,i=this.getStack(e),s=i===void 0;return{type:this.getType(e),value:this.getMessage(e,n),stack:i??((r=n.syntheticException)==null?void 0:r.stack),cause:e.cause?n.next(e.cause):void 0,synthetic:s}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class TT{constructor(){}match(e){return!!Vu(e,"ErrorEvent")&&(e.error!=null||this.fi(e))}coerce(e,n){var r;if(e.error!=null)return n.apply(e.error);var i=n.apply(e.message);return N({},i,{stack:(r=this.pi(e))!==null&&r!==void 0?r:i.stack,synthetic:!0})}fi(e){return ue(e.message)&&e.message.length>0}pi(e){var n,r,i=e,s=(n=i.lineno)!==null&&n!==void 0?n:0,o=(r=i.colno)!==null&&r!==void 0?r:0;if(ue(i.filename)&&i.filename.length!==0&&s!==0)return`Error - at `+i.filename+":"+s+":"+o}}var IT=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class OT{match(e){return typeof e=="string"}coerce(e,n){var r,i=this.getInfos(e),s=i[0],o=i[1];return{type:s??"Error",value:o??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,i=e.match(IT);return i&&(n=i[1],r=i[2]),[n,r]}}var MT=["fatal","error","warning","log","info","debug"];function bb(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(e>=i.length)return r===n.length?i:i.length>e?i.slice(0,e)+"...":i}return""}class AT{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,i,s=this.getErrorPropertyFromObject(e);return s?n.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=this.getStack(e))!==null&&r!==void 0?r:(i=n.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Fv(e))return e.constructor.name;var n="name"in e?e.name:void 0;return ue(n)&&!Uu(n)?n:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+bb(e)}isSeverityLevel(e){return ue(e)&&!Uu(e)&&MT.indexOf(e)>=0}getStack(e){try{return ue(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:ue(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var r=e[n];if(Kx(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class NT{match(e){return Fv(e)}coerce(e,n){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+bb(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class $T{match(e){return Gx(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class FT{match(e){return Vu(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Fv(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var r,i=this.getUnhandledRejectionReason(e);return Gx(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var Ku="$message",Qu="$timestamp",LT=new Set([Ku,Qu]),qd={enabled:!0,max_bytes:32768};function Yu(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:qd.enabled,max_bytes:DT(t.max_bytes,qd.max_bytes)}:N({},qd)}class jT{constructor(e){this.Vn=[],this.Gn=0,this.qi=Yu(e)}setConfig(e){this.qi=Yu(e),this.Zn()}add(e){var n=function(i){var s;try{s=qx(i)}catch{return}try{var o=JSON.parse(s);if(!xe(o))return;var a=o,l=a[Ku],u=a[Qu];return!ue(l)||l.trim().length===0||!ue(u)&&!qe(u)?void 0:{step:a,json:s}}catch{return}}(e);if(n){var r=function(i){if(typeof TextEncoder<"u")return new TextEncoder().encode(i).length;for(var s=encodeURIComponent(i),o=0,a=0;s.length>a;a++)s[a]==="%"?(o+=1,a+=2):o+=1;return o}(n.json);r>this.qi.max_bytes||(this.Vn.push({step:n.step,bytes:r}),this.Gn+=r,this.Zn())}}getAttachable(){return this.Vn.map(e=>e.step)}clear(){this.Vn=[],this.Gn=0}size(){return this.Vn.length}Zn(){for(;this.Gn>this.qi.max_bytes&&this.Vn.length>0;){var e=this.Vn.shift();e&&(this.Gn-=e.bytes)}}}function DT(t,e){if(!qe(t)||t===1/0||t===-1/0)return e;var n=Math.floor(t);return 0>n?e:n}var Eb=function(t,e){var n=(e===void 0?{}:e).debugEnabled,r={F(i){if(T&&(we.DEBUG||T.POSTHOG_DEBUG||n)&&!F(T.console)&&T.console){for(var s=("__rrweb_original__"in T.console[i])?T.console[i].__rrweb_original__:T.console[i],o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];s(t,...a)}},debug(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.F("debug",...s)},info(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.F("log",...s)},warn(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.F("warn",...s)},error(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.F("error",...s)},critical(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];console.error(t,...s)},uninitializedWarning(i){r.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>Eb(t+" "+i,s)};return r},D=Eb("[PostHog.js]"),Pe=D.createLogger,zT=Pe("[ExternalScriptsLoader]"),Xu=t=>{var e=j==null?void 0:j.querySelectorAll("script");if(e){for(var n=0;e.length>n;n++)if(e[n].src===t||e[n].getAttribute("src")===t)return e[n]}},vi=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return zT.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=Xu(e);if(r){if(r.__posthog_loading_callback_fired)return n();var i=r.__posthog_loading_error;return i?n(i):(r.addEventListener("load",o=>{r.__posthog_loading_callback_fired=!0,n(void 0,o)}),void r.addEventListener("error",o=>{r.__posthog_loading_error=o,n(o)}))}var s=()=>{if(!j)return n("document not found");if(Xu(e))return vi(t,e,n);var o=j.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=e,o.onload=u=>{o.__posthog_loading_callback_fired=!0,n(void 0,u)},o.onerror=u=>{o.__posthog_loading_error=u,n(u)},t.config.prepare_external_dependency_script&&(o=t.config.prepare_external_dependency_script(o)),!o)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")j.head.appendChild(o);else{var a,l=j.querySelectorAll("body > script");l.length>0?(a=l[0].parentNode)==null||a.insertBefore(o,l[0]):j.body.appendChild(o)}};j!=null&&j.body?s():j==null||j.addEventListener("DOMContentLoaded",s)},Hd={},my=(t,e)=>{var n="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var r=3e5;n=n+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",n)};Q.__PosthogExtensions__=Q.__PosthogExtensions__||{},Q.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e!=="remote-config"){var r=t.config.strict_script_versioning;if(r){var i=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),s=Hd[i];if(r==="fallback"&&s){if(Xu(s))return void vi(t,s,n);delete Hd[i]}vi(t,i,r==="fallback"?(a,l)=>{if(a)if(typeof a=="string")n(a);else{var u,c=my(t,e);Hd[i]=c;var d=Xu(i);d==null||(u=d.parentNode)==null||u.removeChild(d),vi(t,c,n)}else n(void 0,l)}:n)}else vi(t,my(t,e),n)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");vi(t,o,n)}},Q.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);vi(t,r,n)};we.DEBUG=!1,we.LIB_VERSION="1.418.16",we.LIB_NAME="web";var Sb="$people_distinct_id",mt="distinct_id",Ma="$device_id",Wd="$device_model",bs="__alias",Go="__timers",Vh="$autocapture_disabled_server_side",Bh="$heatmaps_enabled_server_side",qh="$exception_capture_enabled_server_side",Hh="$error_tracking_suppression_rules",Wh="$error_tracking_capture_extension_exceptions",Gh="$web_vitals_enabled_server_side",Bv="$dead_clicks_enabled_server_side",qv="$product_tours_enabled_server_side",Kh="$web_vitals_allowed_metrics",bi="$session_recording_remote_config",Cb="$replay_sample_rate",kb="$replay_override_sampling",Pb="$replay_override_linked_flag",Rb="$replay_override_url_trigger",Tb="$replay_override_event_trigger",Es="$sesid",Hv="$session_is_sampled",Zn="$enabled_feature_flags",Ei="$active_feature_flags",iu="$early_access_features",Aa="$feature_flag_details",Si="$feature_flag_payloads",Ns="$feature_flag_request_id",Ju="$minimal_flag_called_events",Pn="$override_feature_flags",gi="$override_feature_flag_payloads",fn="$stored_person_properties",Nn="$stored_group_properties",Ib="$groups",Qh="$surveys",Zu="$surveys_loaded_at",Yh="$surveys_activated",su="$surveys_activated_session",ou="$surveys_activated_timestamps",Ko="ph_product_tours",tr="$flag_call_reported",Qo="$flag_call_reported_session_id",$s="$feature_flag_errors",Ni="$feature_flag_evaluated_at",ie="$user_state",Xh="$client_session_props",Jh="$capture_rate_limit",Zh="$initial_campaign_params",ep="$initial_referrer_info",ec="$initial_person_info",tc="$epp",Zi="$posthog_cookieless",Ob="$cookieless_mode",Mb="$sdk_debug_extensions_init_method",Ab="$sdk_debug_extensions_init_time_ms",tp="$sdk_debug_recording_script_not_loaded",Wv="PostHog loadExternalDependency extension not found.",mi="on_reject",nr="always",Ve="anonymous",it="identified",np="identified_only",nc="visibilitychange",rc="beforeunload",ls="$pageview",Gd="$pageleave",Kd="$identify",yy="$groupidentify";function Pl(t,e){X(t)&&t.forEach(e)}function he(t,e){if(!te(t))if(X(t))t.forEach(e);else if(QR(t))t.forEach((r,i)=>e(r,i));else for(var n in t)Wx.call(t,n)&&e(t[n],n)}var ge=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];for(var i of n)for(var s in i)i[s]!==void 0&&(t[s]=i[s]);return t};function au(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var _y=function(t){try{return t()}catch{return}},UT=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.apply(this,n)}catch(i){D.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),D.critical(i)}}},Gv=function(t){var e={};return he(t,function(n,r){(ue(n)&&n.length>0||qe(n))&&(e[r]=n)}),e},VT=["herokuapp.com","vercel.app","netlify.app"];function BT(t){var e=t==null?void 0:t.hostname;if(!ue(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of VT)if(n===r)return!1;return!0}function Ce(t,e,n,r){var i=r??{},s=i.capture,o=i.passive;t==null||t.addEventListener(e,n,{capture:s!==void 0&&s,passive:o===void 0||o})}function rp(t){return t.name==="ph_toolbar_internal"}var Nb=t=>{if(j){try{for(var e=t+"=",n=j.cookie.split(";").filter(s=>s.length),r=0;n.length>r;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return qe(t)&&isFinite(t)&&Math.floor(t)===t});class ic{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||0>e||0>n||0>r||0>i||e>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/256,s[5]=e,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new ic(s)}toString(){for(var e="",n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new ic(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class qT{generate(){var e=this.generateOrAbort();if(!F(e))return e;this.Rr=0;var n=this.generateOrAbort();if(F(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var e=Date.now();if(e>this.Rr)this.Rr=e,this.Ar();else{if(this.Rr>=e+1e4)return;this.Lr++,this.Lr>4398046511103&&(this.Rr++,this.Ar())}return ic.fromFieldsV7(this.Rr,Math.trunc(this.Lr/Math.pow(2,30)),this.Lr&Math.pow(2,30)-1,this.Or.nextUint32())}Ar(){this.Lr=1024*this.Or.nextUint32()+(1023&this.Or.nextUint32())}constructor(){this.Rr=0,this.Lr=0,this.Or=new HT}}var wy,$b=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};T&&!F(T.crypto)&&crypto.getRandomValues&&($b=t=>crypto.getRandomValues(t));class HT{nextUint32(){return this.ft.length>this.Fr||($b(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var In=()=>WT().toString(),WT=()=>(wy||(wy=new qT)).generate(),Ao="",GT=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,He={Dr:()=>!!j,jr(t){D.error("cookieStore error: "+t)},Pr:Nb,Br(t){var e;try{e=JSON.parse(He.Pr(t))||{}}catch{}return e},Nr(t,e,n,r,i){if(!j)return!1;try{var s="",o="",a=function(c,d){if(d){var f=function(m,p){if(p===void 0&&(p=j),Ao)return Ao;if(!p||["localhost","127.0.0.1"].includes(m))return"";for(var y=m.split("."),h=Math.min(y.length,8),v="dmn_chk_"+In();!Ao&&h--;){var x=y.slice(h).join("."),b=v+"=1;domain=."+x+";path=/";p.cookie=b+";max-age=3",p.cookie.includes(v)&&(p.cookie=b+";max-age=0",Ao=x)}return Ao}(c);if(!f){var _=(m=>{var p=m.match(GT);return p?p[0]:""})(c);_!==f&&D.info("Warning: cookie subdomain discovery mismatch",_,f),f=_}return f?"; domain=."+f:""}return""}(j.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),s="; expires="+l.toUTCString()}i&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&D.warn("cookieStore warning: large cookie, len="+u.length),j.cookie=u,!0}catch{return!1}},qr(t,e){if(j!=null&&j.cookie)try{He.Nr(t,"",-1,e)}catch{return}}},Qd=null,pe={Dr(){if(!et(Qd))return Qd;var t=!0;if(F(T))t=!1;else try{var e="__mplssupport__";pe.Nr(e,"xyz"),pe.Pr(e)!=='"xyz"'&&(t=!1),pe.qr(e)}catch{t=!1}return t||D.error("localStorage unsupported; falling back to cookie store"),Qd=t,t},jr(t){D.error("localStorage error: "+t)},Pr(t){try{return T==null?void 0:T.localStorage.getItem(t)}catch(e){pe.jr(e)}return null},Br(t){try{return JSON.parse(pe.Pr(t))||{}}catch{}return null},Nr(t,e){try{return T==null||T.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){pe.jr(n)}return!1},qr(t){try{T==null||T.localStorage.removeItem(t)}catch(e){pe.jr(e)}}},Yd=[fn,Ei,Zn,Aa,Si,Ns,Ni,$s,tr],yi=[Ma,mt,Es,Hv,tc,ec,ie],sc=t=>t+"_cpm",KT=["__proto__","constructor","prototype"],Xd=t=>{if(!xe(t))return{};var e={};return Object.keys(t).forEach(n=>{KT.indexOf(n)===-1&&(e[n]=t[n])}),e},Jd=function(t,e){e===void 0&&(e=[]);var n={};return[...yi,...e].forEach(r=>{var i=t[r];F(i)||et(i)||i===""||(n[r]=i)}),n},Fb=t=>{for(var e=5381,n=2166136261,r=0;t.length>r;r++){var i=t.charCodeAt(r);e=33*e^i,n=Math.imul(n^i,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(n>>>0).toString(36)},xy=(t,e)=>({p:e,f:Fb(JSON.stringify(t))}),by=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var n=He.Br(sc(t)),r=(n==null?void 0:n.f)===Fb(e)&&X(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},Zd=(t,e)=>e+"|"+(He.Pr(sc(t))||""),Rl={},QT={Dr:()=>!0,jr(t){D.error("memoryStorage error: "+t)},Pr:t=>Rl[t]||null,Br:t=>Rl[t]||null,Nr:(t,e)=>(Rl[t]=e,!0),qr(t){delete Rl[t]}},li=null,me={Dr(){if(!et(li))return li;if(li=!0,F(T))li=!1;else try{var t="__support__";me.Nr(t,"xyz"),me.Pr(t)!=='"xyz"'&&(li=!1),me.qr(t)}catch{li=!1}return li},jr(t){D.error("sessionStorage error: ",t)},Pr(t){try{return T==null?void 0:T.sessionStorage.getItem(t)}catch(e){me.jr(e)}return null},Br(t){try{return JSON.parse(me.Pr(t))||null}catch{}return null},Nr(t,e){try{return T==null||T.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){me.jr(n)}return!1},qr(t){try{T==null||T.sessionStorage.removeItem(t)}catch(e){me.jr(e)}}};class YT{constructor(e){this._instance=e}get qi(){return this._instance.config}get consent(){return this.cs()?0:this.fs}isOptedOut(){return this.qi.cookieless_mode===nr||this.isRejected()||this.consent===-1&&this.qi.cookieless_mode===mi}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qi.opt_out_capturing_by_default}optInOut(e){this.ps.Nr(this.gs,e?1:0,this.qi.cookie_expiration,this.qi.cross_subdomain_cookie,this.qi.secure_cookie)}reset(){this.ps.qr(this.gs,this.qi.cross_subdomain_cookie)}get gs(){var e=this._instance.config,n=e.token,r=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(r?r+n:"__ph_opt_in_out_"+n)}get fs(){var e=this.ps.Pr(this.gs);return zd(e)?1:Y(ZR,e)?0:-1}get ps(){var e=this.qi.opt_out_capturing_persistence_type,n=e==="localStorage"?pe:He;if(!this.ys||this.ys!==n){this.ys=n;var r=e==="localStorage"?He:pe;r.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(zd(r.Pr(this.gs))),r.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[xt==null?void 0:xt.doNotTrack,xt==null?void 0:xt.msDoNotTrack,Q.doNotTrack].some(e=>zd(e))}}function Lb(t,e){var n,r=t==null||(n=t.config)==null?void 0:n.get_current_url;if(!ft(r))return e;try{var i=r(e);return ue(i)&&i?i:e}catch(s){return D.error("Error in get_current_url, falling back to window.location.href",s),e}}var jb="__POSTHOG_TOOLBAR__",XT=1,JT=3,ZT=11;function Ey(t){return t instanceof Element&&(t.id===jb||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function ei(t){return!!t&&t.nodeType===XT}function Vt(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Db(t){return!!t&&t.nodeType===JT}function zb(t){return!!t&&t.nodeType===ZT&&ei(t.host)}var Ub=1e3;function Kv(t){return t?Bc(t).split(/\s+/):[]}function Sy(t,e){var n=function(r){var i,s=T==null||(i=T.location)==null?void 0:i.href;return F(s)?void 0:Lb(r,s)}(e);return!!(n&&t&&t.some(r=>n.match(r)))}function oc(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Kv(e)}function Vb(t){return te(t)?null:Bc(t).split(/(\s+)/).filter(e=>la(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Na(t){var e="";return op(t)&&!Gb(t)&&t.childNodes&&t.childNodes.length&&he(t.childNodes,function(n){var r;Db(n)&&n.textContent&&(e+=(r=Vb(n.textContent))!==null&&r!==void 0?r:"")}),Bc(e)}function ip(t){var e;return F(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var Qv=["a","button","form","input","select","textarea","label"];function sp(t,e){if(F(e))return!0;var n,r=function(s){if(e.some(o=>function(a,l){var u=a.matches||a.matchesSelector||a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.oMatchesSelector;try{return!!u&&u.call(a,l)}catch{return!1}}(s,o)))return{v:!0}};for(var i of t)if(n=r(i))return n.v;return!1}function Bb(t){var e=t.parentNode;return!(!e||!ei(e))&&e}var eI=[".ph-no-autocapture","[data-ph-no-autocapture]"],qb=["next","previous","prev",">","<"],tI=[...qb,"+","-","−","–"],Cy=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,ky=[".ph-no-rageclick",".ph-no-capture"],nI=["","text","search","email","password","url","tel","number"];function Hb(t,e){if(!T||Yv(t))return!1;var n,r,i,s,o;if(It(e)?(n=!!e&&ky,r=void 0,i=!1):(n=(s=e==null?void 0:e.css_selector_ignorelist)!==null&&s!==void 0?s:ky,r=e==null?void 0:e.content_ignorelist,i=(o=e==null?void 0:e.ignore_text_selection)!==null&&o!==void 0&&o),n===!1||i&&function(l){return!(!l||!ei(l))&&(!!Vt(l,"textarea")||(Vt(l,"input")?Y(nI,(l.getAttribute("type")||"").toLowerCase()):function(u){if(u.isContentEditable)return!0;var c=u.getAttribute==null?void 0:u.getAttribute("contenteditable");return c==="true"||c===""}(l)))}(t))return!1;var a=Wb(t,!1).targetElementList;return!function(l,u){if(l===!1||F(l))return!1;var c;if(l===!0)c=qb;else{if(!X(l))return!1;if(l.length>10)return D.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=l.map(d=>d.toLowerCase())}return u.some(d=>{var f=d.safeText,_=d.ariaLabel;return c.some(m=>Cy(f,m)||Cy(_,m))})}(r,a.map(l=>{var u;return{safeText:Na(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))==null?void 0:u.toLowerCase().trim())||""}}))&&!sp(a,n)}var Yv=t=>!t||Vt(t,"html")||!ei(t),Wb=(t,e)=>{if(!T||Yv(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],i=t;i.parentNode&&!Vt(i,"body");)if(zb(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=Bb(i);if(!s)break;if(e||Qv.indexOf(s.tagName.toLowerCase())>-1)n=!0;else try{var o=T.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(s),i=s}return{parentIsUsefulElement:n,targetElementList:r}};function op(t){for(var e=new Set,n=0,r=t;r.parentNode&&!Vt(r,"body");r=r.parentNode){if(n++>=Ub||e.has(r))return!1;e.add(r);var i=oc(r);if(Y(i,"ph-sensitive")||Y(i,"ph-no-capture"))return!1}if(Y(oc(t),"ph-include"))return!0;var s=t.type||"";if(ue(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!ue(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Gb(t){return!!(Vt(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Vt(t,"select")||Vt(t,"textarea")||t.getAttribute("contenteditable")==="true")}var Py=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Ry=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,rI=[16,15,14,13],iI=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Ty=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Iy=/[0-9A-Za-z_]/;function sI(t){for(var e=0,n=!1,r=t.length-1;r>=0;r--){var i=t.charCodeAt(r)-48;n&&(i*=2)>9&&(i-=9),e+=i,n=!n}return e%10==0}function la(t,e){if(e===void 0&&(e=!0),te(t))return!1;if(ue(t)){t=Bc(t);var n=e?Py.test((t||"").replace(/[- ]/g,"")):function(i){var s;for(Ry.lastIndex=0;s=Ry.exec(i);){var o=s[2];if(o)for(var a=o.replace(/[- ]/g,""),l=0;a.length>l;l++)for(var u of rI){var c=l+u;if(a.length>=c){var d=a.slice(l,c);if(Py.test(d)&&sI(d))return!0}}}return!1}(t);if(n)return!1;var r=e?iI.test(t):function(i){var s;for(Ty.lastIndex=0;s=Ty.exec(i);){var o=s[1],a=s[3];if(!(o&&a&&Iy.test(o)&&Iy.test(a)))return!0}return!1}(t);if(r)return!1}return!0}function Oy(t){var e=Na(t);return la(e=(e+" "+Kb(t)).trim())?e:""}function Kb(t){var e="";return t&&t.childNodes&&t.childNodes.length&&he(t.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var i=Na(n);e=(e+" "+i).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Kb(n)).trim())}catch(s){D.error("[AutoCapture]",s)}}),e}function My(t){return t.replace(/"|\\"/g,'\\"')}function oI(t){var e=t.attr__class;if(e)return X(e)?e:Kv(e)}var Tl=Pe("[Dead Clicks]"),aI=()=>!0,lI=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(Bv)),r=t.instance.config.capture_dead_clicks;return It(r)?r:!!xe(r)||n};class Ay{get lazyLoadedDeadClicksAutocapture(){return this.bs}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var n=e.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[Bv]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._s(()=>{this.ws()}):this.stop()}_s(e){var n,r;(n=Q.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?e():(r=Q.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Tl.error("failed to load script",i):e()})}ws(){var e;if(j){if(!this.bs&&(e=Q.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=xe(this.instance.config.capture_dead_clicks)?N({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.bs=Q.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.bs.start(j),Tl.info("starting...")}}else Tl.error("`document` not found. Cannot start.")}stop(){this.bs&&(this.bs.stop(),this.bs=void 0,Tl.info("stopping..."))}}var ef=Pe("[SegmentIntegration]"),Qb="posthog-js";function Yb(t,e){var n=e===void 0?{}:e,r=n.organization,i=n.projectId,s=n.prefix,o=n.severityAllowList,a=o===void 0?["error"]:o,l=n.sendExceptionsToPostHog,u=l===void 0||l;return c=>{var d,f,_,m,p;if(a!=="*"&&!a.includes(c.level)||!t.__loaded)return c;c.tags||(c.tags={});var y=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());c.tags["PostHog Person URL"]=y,t.sessionRecordingStarted()&&(c.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var h,v=((d=c.exception)==null?void 0:d.values)||[],x=v.map(E=>N({},E,{stacktrace:E.stacktrace?N({},E.stacktrace,{type:"raw",frames:(E.stacktrace.frames||[]).map(S=>N({},S,{platform:"web:javascript"}))}):void 0})),b={$exception_message:((f=v[0])==null?void 0:f.value)||c.message,$exception_type:(_=v[0])==null?void 0:_.type,$exception_level:c.level,$exception_list:x,$sentry_event_id:c.event_id,$sentry_exception:c.exception,$sentry_exception_message:((m=v[0])==null?void 0:m.value)||c.message,$sentry_exception_type:(p=v[0])==null?void 0:p.type,$sentry_tags:c.tags};return r&&i&&(b.$sentry_url=(s||"https://sentry.io/organizations/")+r+"/issues/?project="+i+"&query="+c.event_id),u&&((h=t.exceptions)==null||h.sendExceptionEvent(b)),c}}class uI{constructor(e,n,r,i,s,o){this.name=Qb,this.setupOnce=function(a){a(Yb(e,{organization:n,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}}class Ny{constructor(e){this.ks=(n,r,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(D.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.Ss=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.xs()}xs(){var e;this.Cs=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.ks)}destroy(){var e;(e=this.Cs)==null||e.call(this),this.Cs=void 0}doPageView(e,n){var r,i=this.Ts(e,n);return this.Ss={pathname:(r=T==null?void 0:T.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.Ts(e,(n=this.Ss)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Ss)==null?void 0:e.pageViewId}}Ts(e,n){var r=this.Ss;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var o=s.maxScrollHeight,a=s.lastScrollY,l=s.maxScrollY,u=s.maxContentHeight,c=s.lastContentY,d=s.maxContentY;if(!(F(o)||F(a)||F(l)||F(u)||F(c)||F(d))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),d=Math.ceil(d);var f=o>1?Ln(a/o,0,1,D):1,_=o>1?Ln(l/o,0,1,D):1,m=u>1?Ln(c/u,0,1,D):1,p=u>1?Ln(d/u,0,1,D):1;i=ge(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:_,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:m,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:p})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var tf=["flags","surveys"],cI={[Sb]:{exposure:"hidden"},[bs]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Go]:{exposure:"hidden"},[Vh]:{exposure:"event"},[Bh]:{exposure:"hidden"},[qh]:{exposure:"event"},[Hh]:{exposure:"hidden"},[Wh]:{exposure:"event"},[Gh]:{exposure:"event"},[Bv]:{exposure:"event"},[qv]:{exposure:"hidden"},[Kh]:{exposure:"event"},[bi]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Es]:{exposure:"hidden"},[Hv]:{exposure:"event"},[Cb]:{exposure:"event",shouldSkipFromEventProperties:t=>et(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Zn]:{exposure:"hidden",storageGroup:"flags"},[Ei]:{exposure:"hidden",storageGroup:"flags"},[iu]:{exposure:"hidden"},[Aa]:{exposure:"hidden",storageGroup:"flags"},[Si]:{exposure:"hidden",storageGroup:"flags"},[Ns]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ju]:{exposure:"hidden",storageGroup:"flags"},[Pn]:{exposure:"hidden"},[gi]:{exposure:"hidden"},[fn]:{exposure:"hidden"},[Nn]:{exposure:"hidden"},[Qh]:{exposure:"hidden",storageGroup:"surveys"},[Zu]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Yh]:{exposure:"event"},[su]:{exposure:"hidden"},[ou]:{exposure:"hidden"},[Ko]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[tr]:{exposure:"hidden"},[Qo]:{exposure:"hidden"},[Ib]:{exposure:"event"},[$s]:{exposure:"hidden"},[Ni]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ie]:{exposure:"hidden"},[Xh]:{exposure:"hidden"},[Jh]:{exposure:"hidden"},[Zh]:{exposure:"hidden"},[ep]:{exposure:"hidden"},[ec]:{exposure:"hidden"},[tc]:{exposure:"hidden"},[kb]:{exposure:"event"},[Pb]:{exposure:"event"},[Rb]:{exposure:"event"},[Tb]:{exposure:"event"},[Mb]:{exposure:"event"},[Ab]:{exposure:"event"},[tp]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},dI=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Rn=t=>{var e=cI[t];if(e)return e;for(var n of dI){var r=n[1];if(t.indexOf(n[0])===0)return r}},Ss=(t,e)=>{try{return JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e)}catch{return qx(t)}},so=t=>{var e=j==null?void 0:j.createElement("a");return F(e)?null:(e.href=t,e)},oo=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;r.length>i;i++){var s=r[i].split("=");if(s[0]===e){n=s;break}}if(!X(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{D.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},$a=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),i=r[1],s=(r[0]||"").split("?"),o=s[1],a=s[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");X(d)&&(e.includes(d[0])?u.push(d[0]+"="+n):u.push(l[c]))}var f=a;return o!=null&&(f+="?"+u.join("&")),i!=null&&(f+="#"+i),f},ac=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},Xb=(t,e)=>t>=e&&zx(),Jb=(t,e,n,r)=>{if(t===0){if(zx()){var i=e+1;return i===n&&r(),i}return e}return 0},Il="https?://(.*)",ao=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],fI=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ao],Fa="",hI=["li_fat_id"];function Zb(t,e,n){if(!j)return{};var r,i=e?[...ao,...n||[]]:[],s=eE($a(j.URL,i,Fa),t),o=(r={},he(hI,function(a){var l=Nb(a);r[a]=l||null}),r);return ge(o,s)}function eE(t,e){var n=fI.concat(e||[]),r={};return he(n,function(i){var s=oo(t,i);r[i]=s||null}),r}function tE(t){var e=function(s){return s?s.search(Il+"google.([^/?]*)")===0?"google":s.search(Il+"bing.com")===0?"bing":s.search(Il+"yahoo.com")===0?"yahoo":s.search(Il+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!et(e)){r.$search_engine=e;var i=j?oo(j.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function $y(){return navigator.language||navigator.userLanguage}var lc="$direct";function nE(){return(j==null?void 0:j.referrer)||lc}function rE(t,e,n){n===void 0&&(n=!1);var r=t?[...ao,...e||[]]:[],i=n?Zr(Ie==null?void 0:Ie.href):Ie==null?void 0:Ie.href,s=i==null?void 0:i.substring(0,1e3);return{r:nE().substring(0,1e3),u:s?$a(s,r,Fa):void 0}}function iE(t,e){var n;e===void 0&&(e=!1);var r=t.r,i=t.u,s=e?Zr(i):i,o={$referrer:r,$referring_domain:r==null?void 0:r==lc?lc:(n=so(r))==null?void 0:n.host};if(s){o.$current_url=s;var a=so(s);o.$host=a==null?void 0:a.host,o.$pathname=a==null?void 0:a.pathname;var l=eE(s);ge(o,l)}if(r){var u=tE(r);ge(o,u)}return o}function sE(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function pI(){try{return new Date().getTimezoneOffset()}catch{return}}var vI={flags:Ni,surveys:Zu},gI=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ol=t=>t+"_cookie_identity_change_pending",br="main",Fy=(t,e)=>{he(t,(n,r)=>{var i=Rn(r);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,r)||delete t[r]})};class nf{constructor(e,n,r){if(r===void 0&&(r=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=e,this.As=r,this.props={},this.Fs=void 0,this.Os=(s=>{var o="";return s.token&&(o=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+o+"_posthog"})(e),this.ps=this.Ls(e),this.Is=this.$s(e),this.load(),e.debug&&D.info("Persistence loaded",e.persistence,N({},this.props)),this.update_config(e,e,n),this.save(),T){var i=()=>this.flush();Ce(T,"beforeunload",i,{capture:!1}),Ce(T,"pagehide",i,{capture:!1})}}Ds(){var e,n=(e=this.qi)==null?void 0:e.persistence_save_debounce_ms;return qe(n)&&n>0?n:0}Ns(e){if(this.qi.cookieWinsOnConflict&&this.qi.persistence.toLowerCase()==="localstorage+cookie")if(e)try{var n=Jd(e,this.qi.cookie_persisted_properties||[]),r=xy(n,this.qi.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(r),s=He.Pr(this.Os)||void 0;s&&Zd(this.Os,s)===i&&(this.qs=i,this.js=s)}catch{}else try{var o=He.Pr(this.Os)||void 0;this.qs=o?Zd(this.Os,o):void 0,this.js=o}catch{}}syncCookieProperties(){return this.Bs(this.qi)}Bs(e,n){if(n===void 0&&(n=!1),this.Hs&&!n||this.Ps||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;var r;try{r=He.Pr(this.Os)||void 0}catch{}if(!r||r===this.js)return!1;var i,s=Zd(this.Os,r);try{i=Xd(JSON.parse(r))}catch{return!1}if((He.Pr(this.Os)||void 0)!==r)return!1;this.qs=s,this.js=r;var o=by(this.Os,r),a=[...yi,...o.properties],l={};if(Object.keys(i).forEach(p=>{var y=i[p];(F(y)||et(y)||y===""||p===ie&&y!==Ve&&y!==it)&&(l[p]=!0,delete i[p])}),yn(i))return!1;var u=mt in i||i[ie]===Ve||i[ie]===it,c=this.props[mt],d=this.props[ie],f=ge({},this.props);[...yi,...e.cookie_persisted_properties||[]].forEach(p=>{if(a.indexOf(p)!==-1&&!(p in i)&&!l[p]&&(u||p!==mt&&p!==ie)){var y=f[p];!o.isValid&&yi.indexOf(p)!==-1&&(y===!1||y===0)||delete f[p]}}),this.props=ge(f,i),!u||ie in i||ie in this.props||this.Us(ie,Ve);var _=this.props[mt],m=this.props[ie];return!u||_===c&&m===d||(this.Rs=!0,me.Nr(Ol(this.Os),!0),this.zs(fn),this.zs(Ei),this.zs(Zn),this.zs(Aa),this.zs(Si),this.zs(Ns),this.zs(Ni),this.zs($s),this.zs(tr),m===Ve&&(d===it||i[ie]===Ve||!F(c)&&_!==c)&&(Fy(this.props,i),this.zs(Nn)),m===it?this.props.$user_id=_:delete this.props.$user_id,this.zs(bs)),!0}consumeCookieIdentityChange(){var e=Ol(this.Os),n=this.Rs||!!me.Pr(e);return this.Rs=!1,n&&me.qr(e),n}Ws(e){return e===void 0&&(e=!1),!(this.Ps||this.Hs&&!e||!this.qi.cookieWinsOnConflict||this.qi.persistence.toLowerCase()!=="localstorage+cookie"||(this.Ps=!0,0))}Vs(){this.Ps&&(F(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[br],this.Zs(!0))}Qs(e){if(e===void 0&&(e=!0),this.Ps)try{e?this.Vs():F(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Ls(e){gI.indexOf(e.persistence.toLowerCase())===-1&&(D.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n,r=function(o,a){o===void 0&&(o=[]),a===void 0&&(a=!1);var l=[...yi,...o];return N({},pe,{Br(u){try{var c,d={};try{c=He.Pr(u)||void 0,d=c?Xd(JSON.parse(c)):{}}catch{}var f,_=JSON.parse(pe.Pr(u)||"{}");if(a){var m=by(u,c),p=[...yi,...m.properties],y={};Object.keys(d).forEach(E=>{var S=d[E];et(S)||S===""||E===ie&&S!==Ve&&S!==it||(y[E]=S)});var h=mt in y||y[ie]===Ve||y[ie]===it;if(Object.keys(y).length>0){var v,x=_[mt],b=(v=_[ie])!==null&&v!==void 0?v:Ve;l.forEach(E=>{if(p.indexOf(E)!==-1&&!(E in d)&&(h||E!==mt&&E!==ie)){var S=_[E];!m.isValid&&yi.indexOf(E)!==-1&&(S===!1||S===0)||delete _[E]}}),!h||ie in d||ie in _||(_[ie]=Ve),!h||(mt in y?y[mt]:_[mt])===x&&(ie in y?y[ie]:_[ie])===b||(Yd.forEach(E=>delete _[E]),y[ie]===it&&mt in y?_.$user_id=y[mt]:delete _.$user_id,y[ie]!==it&&(delete _[Ib],delete _[Nn]),delete _.__alias)}f=ge(_,y)}else f=ge(d,_);return pe.Nr(u,f),f}catch{}return null},Nr(u,c,d,f,_,m){var p=pe.Nr(u,c,void 0,void 0,m);try{var y=Jd(c,o);if(Object.keys(y).length){if(a){var h=sc(u),v=xy(y,o);if(He.Nr(h,v,d,f,_,m),He.Pr(h)!==JSON.stringify(v)){He.qr(h,f);var x=Jd(c);return He.Nr(u,x,d,f,_,m),p}}He.Nr(u,y,d,f,_,m)}}catch(b){pe.jr(b)}return p},qr(u,c){try{T==null||T.localStorage.removeItem(u),He.qr(u,c),He.qr(sc(u),c)}catch(d){pe.jr(d)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),i=!1,s=e.persistence.toLowerCase();return s==="localstorage"&&pe.Dr()?(n=pe,i=!0):s==="localstorage+cookie"&&r.Dr()?(n=r,i=!0):s==="sessionstorage"&&me.Dr()?n=me:s==="memory"?n=QT:s==="cookie"?n=He:r.Dr()?(n=r,i=!0):n=He,this.Es=i,n}Js(e){return this.Os+"__"+e}$s(e){return this.Es&&!!e.split_storage}properties(){var e={};return he(this.props,(n,r)=>{var i=Rn(r);if(!i||i.exposure==="event"){if(i!=null&&i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(n))return;e[r]=n}}),e}load(e){if(e===void 0&&(e=!1),!this.Hs||e){var n=this.qi.cookieWinsOnConflict&&this.qi.persistence.toLowerCase()==="localstorage+cookie",r=n?pe.Br(this.Os):null,i={};if(n)try{he(i=Xd(He.Br(this.Os)),(m,p)=>{(F(m)||et(m)||m==="")&&delete i[p]})}catch{}var s=this.ps.Br(this.Os);if(s&&(this.props=ge({},s)),this.Is&&this.Ks(),n&&s){var o,a,l=r==null?void 0:r[mt],u=(o=r==null?void 0:r[ie])!==null&&o!==void 0?o:Ve,c=s[mt],d=(a=s[ie])!==null&&a!==void 0?a:Ve;if(c!==l||d!==u){this.Rs=!0,me.Nr(Ol(this.Os),!0);var f=ge({},this.props);Yd.forEach(m=>delete f[m]),d===Ve&&(u===it||i[ie]===Ve||!F(l)&&c!==l)&&(Fy(f,i),delete f[Nn]),this.props=f;var _=new Set;Yd.forEach(m=>{var p,y=(p=Rn(m))==null?void 0:p.storageGroup;y&&_.add(y)}),_.forEach(m=>{var p={};he(this.props,(y,h)=>{var v;((v=Rn(h))==null?void 0:v.storageGroup)===m&&(p[h]=y)}),yn(p)?(pe.qr(this.Js(m)),this.Ms[m]={}):pe.Nr(this.Js(m),p)&&(this.Ms[m]={persisted:!0,fingerprint:this.Ys(p,m)})})}}me.Pr(Ol(this.Os))&&(this.Rs=!0)}}Ks(){for(var e of tf){var n=pe.Br(this.Js(e));if(n&&!yn(n)){var r=this.Xs(e);r.persisted=!0,this.ta(e)||(r.fingerprint=this.Ys(n,e)),this.ea(e,n)||ge(this.props,n)}}}ta(e){return Object.keys(this.props).some(n=>{var r;return((r=Rn(n))==null?void 0:r.storageGroup)===e})}ea(e,n){var r=vI[e];if(!r)return!1;var i=n[r],s=this.props[r];return qe(i)&&qe(s)&&s>i}refreshKey(e){var n;if(!this.Hs){var r=this.Is?(n=Rn(e))==null?void 0:n.storageGroup:void 0,i=r?pe.Br(this.Js(r)):this.ps.Br(this.Os);if(i&&e in i)this.Us(e,i[e]);else{if(r){var s=this.ps.Br(this.Os);if(s&&e in s)return void this.Us(e,s[e])}this.zs(e)}}}save(){if(!this.Hs){var e=this.Ds();e>0?F(this.Gs)&&(this.Gs=setTimeout(()=>{this.Gs=void 0,this.Zs()},e)):this.Zs()}}flush(){F(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0,this.Zs())}Zs(e){e===void 0&&(e=!1),this.Hs||this.Ps&&!e||(e||this.syncCookieProperties(),this.Is?this.ia():this.ra(this.ps,this.Os,this.props,br)&&this.Ns(this.props))}ia(){var e=this.na(),n=e.main,r=e.groups;for(var i of(this.ra(this.ps,this.Os,n,br)&&this.Ns(n),tf)){var s,o=r[i];(!yn(o)||(s=this.Ms[i])!=null&&s.persisted)&&this.ra(pe,this.Js(i),o,i)}}na(){var e={},n={flags:{},surveys:{}};return he(this.props,(r,i)=>{var s,o=(s=Rn(i))==null?void 0:s.storageGroup;o?n[o][i]=r:e[i]=r}),{main:e,groups:n}}Ys(e,n){if(n===br)return JSON.stringify(e)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var r={};return he(e,(i,s)=>{var o;r[s]=(o=Rn(s))!=null&&o.volatile?"__volatile__":i}),JSON.stringify(r)}ra(e,n,r,i){var s,o=this.Xs(i);if(i!==br&&!o.dirty&&!F(o.fingerprint))return!1;try{if((s=this.Ys(r,i))===o.fingerprint)return o.dirty=!1,!1}catch{s=void 0}return e.Nr(n,r,this.sa,this.aa,this.oa,this.qi.debug)?(o.dirty=!1,i!==br&&(o.persisted=!0),F(s)||(o.fingerprint=s),!0):(this.qi.debug&&D.warn('failed to persist storage entry "'+n+'"; will retry on next save'),!1)}remove(e){var n=(e===void 0?{}:e).keepGroupEntries,r=n!==void 0&&n;if(F(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Os,!1),this.ps.qr(this.Os,!0),!r&&this.As)for(var i of tf)pe.qr(this.Js(i));r?delete this.Ms[br]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(e,n,r){if(xe(e)){this.syncCookieProperties(),F(n)&&(n="None"),this.sa=F(r)?this.la:r;var i=!1;if(he(e,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.Us(o,s),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(xe(e)){this.syncCookieProperties(),this.sa=F(n)?this.la:n;var r=!1;if(he(e,(i,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==i||xe(i)||X(i))&&(this.Us(s,i),r=!0)}),r)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var n=typeof e=="string"?[e]:e,r=!1;for(var i of n)i in this.props&&(this.zs(i),r=!0);r&&this.save()}update_campaign_params(){var e=j==null?void 0:j.URL;if(e!==this.Fs){var n=Zb(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);yn(Gv(n))||this.register(n),this.Fs=e}}update_search_keyword(){var e;this.register((e=j==null?void 0:j.referrer)?tE(e):{})}update_referrer_info(){var e;this.register_once({$referrer:nE(),$referring_domain:j!=null&&j.referrer&&((e=so(j.referrer))==null?void 0:e.host)||lc},void 0)}set_initial_person_info(){this.props[Zh]||this.props[ep]||this.register_once({[ec]:rE(this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties,this.qi.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};he([ep,Zh],i=>{var s=this.props[i];s&&he(s,function(o,a){e["$initial_"+Fh(a)]=o})});var n=this.props[ec];if(n){var r=function(i,s){s===void 0&&(s=!1);var o=iE(i,s),a={};return he(o,function(l,u){a["$initial_"+Fh(u)]=l}),a}(n,this.qi.disable_capture_url_hashes);ge(e,r)}return e}safe_merge(e){return he(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){var i=e.persistence!==n.persistence,s=!((p,y)=>{if(p.length!==y.length)return!1;var h=[...p].sort(),v=[...y].sort();return h.every((x,b)=>x===v[b])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),o=i||s,a=e.cookieWinsOnConflict!==n.cookieWinsOnConflict,l=e.disable_persistence||!!r,u=!!this.Hs&&!l;l||this.Bs(n,u),this.qi=e,!l&&(i||s||a)&&(this.qs=void 0,this.js=void 0,this.Bs(N({},e,{cookie_persisted_properties:n.cookie_persisted_properties}),u));var c=o||a?this.Ls(e):this.ps,d=this.$s(e),f=o||d!==this.Is,_=!l&&(f||e.cross_subdomain_cookie!==this.aa||e.secure_cookie!==this.oa)&&this.Ws(u);try{if(this.la=this.sa=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),f){var m=this.props;this.clear(),this.ps=c,this.Is=d,this.props=m,this.save()}else a&&(this.ps=c,l||(delete this.Ms[br],this.Zs()))}finally{_&&this.Qs()}}set_disabled(e){this.Hs=e,this.Hs?this.remove():this.save()}set_cross_subdomain(e){e!==this.aa&&(this.aa=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.oa&&(this.oa=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){var r=this.props[Go]||{};r[e]=n,this.Us(Go,r),this.save()}remove_event_timer(e){var n=this.props[Go]||{},r=n[e];return F(r)||(delete n[e],this.Us(Go,n),this.save()),r}get_property(e){return this.props[e]}set_property(e,n){this.Us(e,n),this.save()}Us(e,n){var r;this.props[e]=n,(r=Rn(e))!=null&&r.volatile||this.ua(e)}zs(e){delete this.props[e],this.ua(e)}ua(e){var n,r=(n=Rn(e))==null?void 0:n.storageGroup;r&&(this.Xs(r).dirty=!0)}Xs(e){return this.Ms[e]||(this.Ms[e]={})}}function Ml(t){var e=!0;return{dispose(){if(e){e=!1;var n=t();n&&ft(n.then)&&n.then(void 0,()=>{})}}}}var _t={GZipJS:"gzip-js",Base64:"base64"},No={Activation:"events",Cancellation:"cancelEvents"},rf={Popover:"popover",API:"api",Widget:"widget"},rr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},sf={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ap={Popover:"popover",Inline:"inline"},mI={SHOWN:"product tour shown"},Ly={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},jy=Pe("[RateLimiter]");class yI{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(i=>{jy.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void jy.warn('could not rate limit - continuing. Error: "'+(i==null?void 0:i.message)+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,r,i;e===void 0&&(e=!1);var s=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,a=new Date().getTime(),l=(n=(r=this.instance.persistence)==null?void 0:r.get_property(Jh))!==null&&n!==void 0?n:{tokens:s,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>s&&(l.tokens=s);var u=1>l.tokens;if(u||e||(l.tokens=Math.max(0,l.tokens-1)),u&&!e){var c=(qe(l.dropped)?l.dropped:0)+1;l.dropped=c,!this.lastEventRateLimited&&this.ha(c)&&(l.dropped=0)}return this.lastEventRateLimited=u,(i=this.instance.persistence)==null||i.set_property(Jh,l),{isRateLimited:u,remainingTokens:l.tokens}}da(e){var n=this.instance.config.property_denylist;return!X(n)||!n.includes(e)}va(){var e;if(this.da("$current_url")&&this.da("$pathname")&&Ie!=null&&Ie.pathname)return""+((e=Ie.origin)!==null&&e!==void 0?e:"")+Ie.pathname}ha(e){var n,r,i=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,o=this.va(),a=this.da("$session_id")?(n=(r=this.instance).get_session_id)==null?void 0:n.call(r):void 0,l=[e+" event(s) dropped since the last warning",o?"triggered on "+o:void 0,a?"session "+a:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+l+". Config is set to "+s+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()e(this.remoteConfig)):e()}fa(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return Er.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance.ma())return void Er.warn("Remote config is disabled. Falling back to local config.");this.ca(e=>{if(!e)return Er.info("No config found after loading remote JS config. Falling back to JSON."),void this.fa(n=>{this.pa(n.json,n),this.ga()});this.pa(e),this.ga()})}catch(e){Er.error("Error loading remote config",e),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance.ma()&&j&&j.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}ga(){var e;if(!this.ya){var n=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;n!==0&&(this.ya=setInterval(()=>{this.refresh()},n))}}pa(e,n){!e&&n&&(n.statusCode===0?n.error||Er.warn("Failed to fetch remote config from PostHog."):Er.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(e?{ok:!0,config:e}:{ok:!1})}catch(i){Er.error("Error applying remote config",i)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded()}catch(i){Er.error("Error loading feature flags",i)}}}var tn=Uint8Array,Mt=Uint16Array,lo=Uint32Array,Xv=new tn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Jv=new tn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Dy=new tn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),aE=function(t,e){for(var n=new Mt(31),r=0;31>r;++r)n[r]=e+=1<r;++r)for(var s=n[r];n[r+1]>s;++s)i[s]=s-n[r]<<5|r;return[n,i]},lE=aE(Xv,2),lp=lE[1];lE[0][28]=258,lp[258]=28;for(var zy=aE(Jv,0)[1],uE=new Mt(32768),Oe=0;32768>Oe;++Oe){var es=(43690&Oe)>>>1|(21845&Oe)<<1;uE[Oe]=((65280&(es=(61680&(es=(52428&es)>>>2|(13107&es)<<2))>>>4|(3855&es)<<4))>>>8|(255&es)<<8)>>>1}var ua=function(t,e,n){for(var r=t.length,i=0,s=new Mt(e);r>i;++i)++s[t[i]-1];var o,a=new Mt(e);for(i=0;e>i;++i)a[i]=a[i-1]+s[i-1]<<1;for(o=new Mt(r),i=0;r>i;++i)o[i]=uE[a[t[i]-1]++]>>>15-t[i];return o},zi=new tn(288);for(Oe=0;144>Oe;++Oe)zi[Oe]=8;for(Oe=144;256>Oe;++Oe)zi[Oe]=9;for(Oe=256;280>Oe;++Oe)zi[Oe]=7;for(Oe=280;288>Oe;++Oe)zi[Oe]=8;var uc=new tn(32);for(Oe=0;32>Oe;++Oe)uc[Oe]=5;var _I=ua(zi,9),wI=ua(uc,5),cE=function(t){return(t/8>>0)+(7&t&&1)},dE=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof Mt?Mt:t instanceof lo?lo:tn)(n-e);return r.set(t.subarray(e,n)),r},qn=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8},$o=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},of=function(t,e){for(var n=[],r=0;t.length>r;++r)t[r]&&n.push({s:r,f:t[r]});var i=n.length,s=n.slice();if(!i)return[new tn(0),0];if(i==1){var o=new tn(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(E,S){return E.f-S.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],u=0,c=1,d=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=i-1;)a=n[n[d].f>n[u].f?u++:d++],l=n[u!=c&&n[d].f>n[u].f?u++:d++],n[c++]={s:-1,f:a.f+l.f,l:a,r:l};var f=s[0].s;for(r=1;i>r;++r)s[r].s>f&&(f=s[r].s);var _=new Mt(f+1),m=up(n[c-1],_,0);if(m>e){r=0;var p=0,y=m-e,h=1<r;++r){var v=s[r].s;if(e>=_[v])break;p+=h-(1<>>=y;p>0;){var x=s[r].s;e>_[x]?p-=1<=0&&p;--r){var b=s[r].s;_[b]==e&&(--_[b],++p)}m=e}return[new tn(_),m]},up=function(t,e,n){return t.s==-1?Math.max(up(t.l,e,n+1),up(t.r,e,n+1)):e[t.s]=n},Uy=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Mt(++e),r=0,i=t[0],s=1,o=function(l){n[r++]=l},a=1;e>=a;++a)if(t[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=t[a]}return[n.subarray(0,r),e]},Fo=function(t,e){for(var n=0,r=0;e.length>r;++r)n+=t[r]*e[r];return n},cp=function(t,e,n){var r=n.length,i=cE(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;r>s;++s)t[i+s+4]=n[s];return 8*(i+4+r)},Vy=function(t,e,n,r,i,s,o,a,l,u,c){qn(e,c++,n),++i[256];for(var d=of(i,15),f=d[0],_=d[1],m=of(s,15),p=m[0],y=m[1],h=Uy(f),v=h[0],x=h[1],b=Uy(p),E=b[0],S=b[1],k=new Mt(19),C=0;v.length>C;++C)k[31&v[C]]++;for(C=0;E.length>C;++C)k[31&E[C]]++;for(var R=of(k,7),P=R[0],$=R[1],O=19;O>4&&!P[Dy[O-1]];--O);var U,L,H,q,K=u+5<<3,I=Fo(i,zi)+Fo(s,uc)+o,M=Fo(i,f)+Fo(s,p)+o+14+3*O+Fo(k,P)+(2*k[16]+3*k[17]+7*k[18]);if(I>=K&&M>=K)return cp(e,c,t.subarray(l,l+u));if(qn(e,c,1+(I>M)),c+=2,I>M){U=ua(f,_),L=f,H=ua(p,y),q=p;var B=ua(P,$);for(qn(e,c,x-257),qn(e,c+5,S-1),qn(e,c+10,O-4),c+=14,C=0;O>C;++C)qn(e,c+3*C,P[Dy[C]]);c+=3*O;for(var G=[v,E],Z=0;2>Z;++Z){var se=G[Z];for(C=0;se.length>C;++C)qn(e,c,B[ce=31&se[C]]),c+=P[ce],ce>15&&(qn(e,c,se[C]>>>5&127),c+=se[C]>>>12)}}else U=_I,L=zi,H=wI,q=uc;for(C=0;a>C;++C)if(r[C]>255){var ce;$o(e,c,U[257+(ce=r[C]>>>18&31)]),c+=L[ce+257],ce>7&&(qn(e,c,r[C]>>>23&31),c+=Xv[ce]);var _e=31&r[C];$o(e,c,H[_e]),c+=q[_e],_e>3&&($o(e,c,r[C]>>>5&8191),c+=Jv[_e])}else $o(e,c,U[r[C]]),c+=L[r[C]];return $o(e,c,U[256]),c+L[256]},xI=new lo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),bI=function(){for(var t=new lo(256),e=0;256>e;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),af=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function EI(t,e){e===void 0&&(e={});var n=function(){var d=4294967295;return{p(f){for(var _=d,m=0;f.length>m;++m)_=bI[255&_^f[m]]^_>>>8;d=_},d(){return 4294967295^d}}}(),r=t.length;n.p(t);var i,s,o,a,l,u=(a=10+((i=e).filename&&i.filename.length+1||0),l=8,function(d,f,_,m,p,y){var h=d.length,v=new tn(m+h+5*(1+Math.floor(h/7e3))+p),x=v.subarray(m,v.length-p),b=0;if(!f||8>h)for(var E=0;h>=E;E+=65535){var S=E+65535;h>S?b=cp(x,b,d.subarray(E,S)):(x[E]=!0,b=cp(x,b,d.subarray(E,h)))}else{for(var k=xI[f-1],C=k>>>13,R=8191&k,P=(1<<_)-1,$=new Mt(32768),O=new Mt(P+1),U=Math.ceil(_/3),L=2*U,H=function(fd){return(d[fd]^d[fd+1]<E;++E){var ce=H(E),_e=32767&E,Se=O[ce];if($[_e]=Se,O[ce]=_e,E>=Z){var ze=h-E;if((M>7e3||G>24576)&&ze>423){b=Vy(d,x,0,q,K,I,B,G,se,E-se,b),G=M=B=0,se=E;for(var ve=0;286>ve;++ve)K[ve]=0;for(ve=0;30>ve;++ve)I[ve]=0}var Ae=2,kt=0,yr=R,gt=_e-Se&32767;if(ze>2&&ce==H(E-gt))for(var Ge=Math.min(C,ze)-1,ai=Math.min(32767,E),Yi=Math.min(258,ze);ai>=gt&&--yr&&_e!=Se;){if(d[E+Ae]==d[E+Ae-gt]){for(var Pt=0;Yi>Pt&&d[E+Pt]==d[E+Pt-gt];++Pt);if(Pt>Ae){if(Ae=Pt,kt=gt,Pt>Ge)break;var Xi=Math.min(gt,Pt-2),_r=0;for(ve=0;Xi>ve;++ve){var ln=E-gt+ve+32768&32767,bo=ln-$[ln]+32768&32767;bo>_r&&(_r=bo,Se=ln)}}}gt+=(_e=Se)-(Se=$[_e])+32768&32767}if(kt){q[G++]=268435456|lp[Ae]<<18|zy[kt];var jg=31&lp[Ae],Dg=31&zy[kt];B+=Xv[jg]+Jv[Dg],++K[257+jg],++I[Dg],Z=E+Ae,++M}else q[G++]=d[E],++K[d[E]]}}b=Vy(d,x,!0,q,K,I,B,G,se,E-se,b)}return dE(v,0,m+cE(b)+p)}(s=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,l)),c=u.length;return function(d,f){var _=f.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>f.level?4:f.level==9?2:0,d[9]=3,f.mtime!=0&&af(d,4,Math.floor(new Date(f.mtime||Date.now())/1e3)),_){d[3]=8;for(var m=0;_.length>=m;++m)d[m+10]=_.charCodeAt(m)}}(u,e),af(u,c-8,n.d()),af(u,c-4,r),u}var SI=!!Mh||!!$v,fE="text/plain",lu=!1,hE=(t,e)=>{var n=t.split("#"),r=n[1],i=n[0].split("?"),s=i[0],o=i[1];if(!o)return t;var a=o.split("&").filter(l=>l.split("=")[0]!==e).join("&");return s+(a?"?"+a:"")+(r?"#"+r:"")},tl=function(t,e,n){var r;n===void 0&&(n=!0);var i=t.split("?"),s=i[0],o=i[1],a=N({},e),l=(r=o==null?void 0:o.split("&").map(c=>{var d,f=c.split("="),_=f[0],m=n&&(d=a[_])!==null&&d!==void 0?d:f[1];return delete a[_],_+"="+m}))!==null&&r!==void 0?r:[],u=function(c,d){var f,_;d===void 0&&(d="&");var m=[];return he(c,function(p,y){F(p)||F(y)||y==="undefined"||(f=encodeURIComponent((h=>h instanceof File)(p)?p.name:p.toString()),_=encodeURIComponent(y),m[m.length]=_+"="+f)}),m.join(d)}(a);return u&&l.push(u),l.length>0?s+"?"+l.join("&"):s},lf=t=>{if(t.ba)return t.ba;var e=t.data,n=t.compression;if(e){if(n===_t.GZipJS){var r=EI(function(a,l){var u=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new tn(a.length+(a.length>>>1)),d=0,f=function(y){c[d++]=y},_=0;u>_;++_){if(d+5>c.length){var m=new tn(d+8+(u-_<<1));m.set(c),c=m}var p=a.charCodeAt(_);128>p?f(p):2048>p?(f(192|p>>>6),f(128|63&p)):p>55295&&57344>p?(f(240|(p=65536+(1047552&p)|1023&a.charCodeAt(++_))>>>18),f(128|p>>>12&63),f(128|p>>>6&63),f(128|63&p)):(f(224|p>>>12),f(128|p>>>6&63),f(128|63&p))}return dE(c,0,d)}(Ss(e)),{mtime:0});return{contentType:fE,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===_t.Base64){var i=function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(l,u)=>String.fromCharCode(parseInt(u,16))))}(Ss(e)),s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Ss(a)))(i);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=Ss(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},pE=t=>{var e,n,r=()=>t.transport==="sendBeacon"?{url:tl(t.url,{compression:_t.Base64}),encodedBody:lf(N({},t,{compression:_t.Base64,ba:void 0}))}:{url:hE(t.url,"compression"),encodedBody:lf(N({},t,{compression:void 0,ba:void 0}))};try{e=lf(t)}catch(i){if(iy(t.compression,oo(t.url,"compression")))return D.error("Failed to gzip request body, sending uncompressed payload",i),r();throw i}return e&&iy(t.compression,oo(t.url,"compression"))&&!((n=e.body)instanceof ArrayBuffer?Ah(new Uint8Array(n)):ArrayBuffer.isView(n)&&Ah(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(lu=!0,r()):{url:t.url,encodedBody:e}},vE=t=>{try{return pE(t)}catch(e){return D.error(e),void(t.callback==null||t.callback({statusCode:0,error:e}))}},CI=function(){var t=be(function*(e){var n=Ss(e.data),r=yield function(s,o,a){return Nh.apply(this,arguments)}(n,we.DEBUG,{rethrow:!0});if(!r)return e;var i=yield r.arrayBuffer();return N({},e,{ba:{contentType:fE,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),kI=/Failed to fetch|NetworkError|Load failed/i,gE=t=>(t==null?void 0:t.name)==="TypeError"&&kI.test((t==null?void 0:t.message)||""),mE=t=>{var e=vE(t);if(e){var n=e.url,r=e.encodedBody,i=r??{},s=i.contentType,o=i.body,a=i.estimatedSize,l=new Headers;he(t.headers,function(m,p){l.append(p,m)}),s&&l.append("Content-Type",s);var u=null,c=!1;if(Jm){var d=new Jm;u={signal:d.signal,timeout:setTimeout(()=>{var m,p;c=!0,d.abort((m=t.timeout,(p=new Error("PostHog request timed out"+(m?" after "+m+"ms":""))).name="AbortError",p))},t.timeout)}}var f=m=>{c&&(m==null?void 0:m.name)==="AbortError"||gE(m)?D.warn(m):D.error(m),t.callback==null||t.callback({statusCode:0,error:m})};try{var _;$v(n,N({method:(t==null?void 0:t.method)||"GET",headers:l,keepalive:t.method==="POST"&&!t._a&&52428.8>(a||0),body:o,signal:(_=u)==null?void 0:_.signal},t.fetchOptions)).then(m=>m.text().then(p=>{var y={statusCode:m.status,text:p};if(m.status===200)try{y.json=JSON.parse(p)}catch(h){D.error(h)}t.callback==null||t.callback(y)})).catch(f).finally(()=>u?clearTimeout(u.timeout):null)}catch(m){u&&clearTimeout(u.timeout),f(m)}}},dp=t=>{try{var e,n=pE(t),r=n.url,i=n.encodedBody,s=i??{},o=s.body,a=s.estimatedSize;if(!o)return;var l=o instanceof Blob?o:new Blob([o],{type:s.contentType});if(xt.sendBeacon(r,l))return;var u=X(t.data)?t.data:(e=t.data)==null?void 0:e.batch;if(X(u)&&u.length>1&&(a??0)>16384){var c=Math.ceil(u.length/2),d=f=>X(t.data)?f:N({},t.data,{batch:f});return dp(N({},t,{data:d(u.slice(0,c))})),void dp(N({},t,{data:d(u.slice(c))}))}D.warn("Beacon of ~"+(a??0)+" bytes was rejected by the browser, falling back to fetch"),mE(N({},t,{_a:!0}))}catch(f){D.warn("Beacon send failed",f)}},By=(t,e,n,r)=>{var i=r==="query"?e==="POST"?"sent_at":"_":void 0;return tl(n===_t.GZipJS?hE(t,"compression"):t,N({},i?{[i]:Date.now().toString()}:{},n===_t.GZipJS?{}:{compression:n}))},uu=[];$v&&uu.push({transport:"fetch",method:mE}),Mh&&uu.push({transport:"XHR",method(t){var e=vE(t);if(e){var n=new Mh,r=e.encodedBody;n.open(t.method||"GET",e.url,!0);var i=r??{},s=i.contentType,o=i.body;he(t.headers,function(a,l){n.setRequestHeader(l,a)}),s&&n.setRequestHeader("Content-Type",s),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var a={statusCode:n.status,text:n.responseText};if(n.status===200)try{a.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(a)}},n.send(o)}}}),xt!=null&&xt.sendBeacon&&uu.push({transport:"sendBeacon",method:dp});var fp=3e3;class PI{constructor(e,n){this.wa=!0,this.ka=[],this.Sa=Ln((n==null?void 0:n.flush_interval_ms)||fp,250,5e3,D.createLogger("flush interval"),fp),this.xa=e}enqueue(e){this.ka.push(e),this.Ca||this.Ta()}unload(){this.Ma();var e=this.ka.length>0?this.Ea():{},n=Object.values(e);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Ia(N({},r,{transport:"sendBeacon"}))})}enable(){this.wa=!1,this.Ta()}Ta(){var e=this;this.wa||(this.Ca=setTimeout(()=>{if(this.Ma(),this.ka.length>0){var n=this.Ea(),r=function(){var s=n[i],o=new Date().getTime();s.data&&X(s.data)&&he(s.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Ia(s)};for(var i in n)r()}},this.Sa))}Ia(e){try{this.xa(e)}catch(n){D.error(n)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var e={};return he(this.ka,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;F(e[s])&&(e[s]=N({},i,{data:[]})),(r=e[s].data)==null||r.push(i.data)}),this.ka=[],e}}var RI=["retriesPerformedSoFar"];class TI{constructor(e){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=e,this.ka=[],this.Aa=!0,!F(T)&&"onLine"in T.navigator&&(this.Aa=T.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.Oa()},this.La=()=>{this.Aa=!1},Ce(T,"online",this.Fa),Ce(T,"offline",this.La))}get length(){return this.ka.length}retriableRequest(e){var n=e.retriesPerformedSoFar,r=Ux(e,RI);Gn(n)&&(r.url=tl(r.url,{retry_count:n})),this._instance._send_request(N({},r,{callback:i=>{if(i.statusCode!==200&&(400>i.statusCode||i.statusCode>=500)){if((i.statusCode===0?3:10)>(n??0))return void this.xn(N({retriesPerformedSoFar:n},r));i.statusCode===0&&D.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}r.callback==null||r.callback(i)}}))}xn(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=Math.random()-.5;return Math.ceil(u+c*(u-l))}(n),i=Date.now()+r;this.ka.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),D.warn(s),this.Ra||(this.Ra=!0,this.$a())}$a(){if(this.Da&&clearTimeout(this.Da),this.ka.length===0)return this.Ra=!1,void(this.Da=void 0);this.Da=setTimeout(()=>{this.Aa&&this.ka.length>0&&this.Oa(),this.$a()},this.Pa)}Oa(){var e=Date.now(),n=[],r=this.ka.filter(s=>e>s.retryAt||(n.push(s),!1));if(this.ka=n,r.length>0)for(var i of r)this.retriableRequest(i.requestOptions)}unload(){for(var e of(this.Da&&(clearTimeout(this.Da),this.Da=void 0),this.Ra=!1,F(T)||(this.Fa&&(T.removeEventListener("online",this.Fa),this.Fa=void 0),this.La&&(T.removeEventListener("offline",this.La),this.La=void 0)),this.ka)){var n=e.requestOptions;try{this._instance._send_request(N({},n,{transport:"sendBeacon"}))}catch(r){D.error(r)}}this.ka=[]}}class II{constructor(e){this.Na=()=>{var n,r,i,s;this.qa||(this.qa={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+((o==null?void 0:o.clientHeight)||0),c=(o==null?void 0:o.scrollHeight)||0;this.qa.lastScrollY=Math.ceil(a),this.qa.maxScrollY=Math.max(a,(n=this.qa.maxScrollY)!==null&&n!==void 0?n:0),this.qa.maxScrollHeight=Math.max(l,(r=this.qa.maxScrollHeight)!==null&&r!==void 0?r:0),this.qa.lastContentY=u,this.qa.maxContentY=Math.max(u,(i=this.qa.maxContentY)!==null&&i!==void 0?i:0),this.qa.maxContentHeight=Math.max(c,(s=this.qa.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get ja(){return this._instance.config.scroll_root_selector}getContext(){return this.qa}resetContext(){var e=this.qa;return setTimeout(this.Na,0),e}startMeasuringScrollPosition(){Ce(T,"scroll",this.Na,{capture:!0}),Ce(T,"scrollend",this.Na,{capture:!0}),Ce(T,"resize",this.Na)}scrollElement(){if(!this.ja)return T==null?void 0:T.document.documentElement;var e=X(this.ja)?this.ja:[this.ja];for(var n of e){var r=T==null?void 0:T.document.querySelector(n);if(r)return r}}Ba(e){var n=e==="y"?"scrollTop":"scrollLeft";if(this.ja){var r=this.scrollElement();return r&&r[n]||0}return T?e==="y"?T.scrollY||T.pageYOffset||T.document.documentElement.scrollTop||0:T.scrollX||T.pageXOffset||T.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var OI=t=>rE(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties,t==null?void 0:t.config.disable_capture_url_hashes);class qy{constructor(e,n,r,i){this.ot=s=>{var o=this.Ha();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.Ua(this._instance)};this.za.register({[Xh]:a})}},this._instance=e,this.Wa=n,this.za=r,this.Ua=i||OI,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[Xh]}getSetOnceProps(){var e,n=(e=this.Ha())==null?void 0:e.props;return n?"r"in n?iE(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return he(Gv(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Fh(r)]=n}),e}}class cc{on(e,n){return this.Va[e]||(this.Va[e]=[]),this.Va[e].push(n),()=>{this.Va[e]=this.Va[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.Va[e]||[])r(n);for(var i of this.Va["*"]||[])i(e,n)}constructor(){this.Va={}}}var ts=Pe("[SessionId]"),Hy=864e5;class Wy{on(e,n){return this.Ga.on(e,n)}constructor(e,n,r){var i;if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new cc,this.Xa=(l,u)=>!(!Gn(l)||!Gn(u))&&Math.abs(l-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===nr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qi=e.config,this.za=e.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.eo=void 0,this._sessionActivityTimestamp=null,this.io=n||In,this.ro=r||In;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*Ln(this.qi.session_idle_timeout_seconds||1800,60,36e3,ts.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.no(),this.so="ph_"+s+"_window_id",this.ao="ph_"+s+"_primary_window_exists",this.oo()){var o=me.Br(this.so),a=me.Br(this.ao);o&&!a?this.st=o:me.qr(this.so),me.Nr(this.ao,!0)}(i=this.qi.bootstrap)!=null&&i.sessionID&&this.setBootstrapSessionId(this.qi.bootstrap.sessionID),this.lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return F(this.Ja)&&(this.Ja=[]),this.Ja.push(e),this._e&&e(this._e,this.st),()=>{this.Ja=this.Ja.filter(n=>n!==e)}}oo(){return this.qi.persistence!=="memory"&&!this.za.Hs&&me.Dr()}uo(e){e!==this.st&&(this.st=e,this.oo()&&me.Nr(this.so,e))}ho(){return this.st?this.st:this.oo()?me.Br(this.so):null}do(e){var n=this.Za;return!et(n)&&!et(e)&&5e3>Math.abs(e-n)}vo(e,n,r){var i=n!==this._sessionActivityTimestamp,s=!(e!==this._e||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this._e=e,s&&!i||s&&this.do(n)||(this.Za=n,this.za.register({[Es]:[n,e,r]}))}co(){var e,n=(e=this.qi)==null?void 0:e.persistence_save_debounce_ms;return Gn(n)&&n>0}fo(){this.co()?this.za.refreshKey(Es):(this.za.flush(),this.za.load())}po(){var e;if(!et(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var n=this.mo();n[1]===this._e&&n[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[Es]:[this._sessionActivityTimestamp,(e=this._e)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var e=this.mo()[0],n=Gn(e)?e:0,r=Gn(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}bo(e){return this.fo(),this.Xa(e,this.yo())}mo(){var e=this.za.props[Es];return X(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Za=null,this.eo=void 0,clearTimeout(this._o),this._o=void 0,this.vo(null,null,null)}setBootstrapSessionId(e,n){n===void 0&&(n=!1);var r=function(i,s){s===void 0&&(s=new Date().getTime());try{var o=(a=>{var l=a.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})(i);return o>s+6e4?void ts.error("Bootstrap sessionID cannot be in the future"):o}catch(a){return void ts.error("Invalid sessionID in bootstrap",a)}}(e);return!F(r)&&(n?this.eo={sessionId:e,sessionStartTimestamp:r}:this.vo(e,new Date().getTime(),r),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&T&&(T.removeEventListener(rc,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&me.qr(this.ao)},Ce(T,rc,this.Ka,{capture:!1})}checkAndGetSessionAndWindowId(e,n,r){if(e===void 0&&(e=!1),n===void 0&&(n=null),r===void 0&&(r=!1),this.qi.cookieless_mode===nr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=n||new Date().getTime(),s=this._e;if(r)this.Qa=i;else if(et(this.Qa)||this.Qa>i||i-this.Qa>=1e3){var o,a;(o=(a=this.za).syncCookieProperties)==null||o.call(a),this.Qa=i}var l=this.mo(),u=l[1],c=l[2],d=!F(s)&&u!==s,f=this.yo(),_=this.ho(),m=this.eo,p=!!m&&(m.sessionStartTimestamp>i+6e4||i-m.sessionStartTimestamp>Hy),y=m?p:Gn(c)&&Math.abs(i-c)>Hy,h=!1,v=d,x=!u||!!m,b=u,E=!x&&!e&&this.Xa(i,f);if(E){(E=this.bo(i))||ts.info("cross-tab refresh kept the session alive",{sessionId:u});var S=this.mo();u=S[1],c=S[2]}if(x||E||y){v=!1;var k=m&&!p;u=k?m.sessionId:this.io(),_=this.ro(),ts.info("new session ID assigned",{sessionId:u,windowId:_,bootstrapped:!!k,changeReason:{noSessionId:x,activityTimeout:E,sessionPastMaximumLength:y}}),c=k?m.sessionStartTimestamp:i,this.eo=void 0,h=!0}else _||(_=this.ro(),h=!0),(v=v||u!==b)&&(ts.info("adopted cross-tab session id",{sessionId:u,windowId:_}),h=!0);var C=Gn(f)&&e&&!y?f:i,R=Gn(c)?c:new Date().getTime();this.uo(_),this.vo(u,C,R),e||this.no();var P={noSessionId:x,activityTimeout:E,sessionPastMaximumLength:y,crossTabAdoption:v};return h&&this.Ja.forEach($=>$(u,_,P)),{sessionId:u,windowId:_,sessionStartTimestamp:R,changeReason:h?P:void 0,lastActivityTimestamp:f}}no(){this.Ya||(clearTimeout(this._o),this._o=setTimeout(()=>{if(!this.Ya)if(this.bo(new Date().getTime())){var e=this._e;this.resetSessionId(),this.Ga.emit("forcedIdleReset",{idleSessionId:e})}else this.no()},1.1*this.sessionTimeoutMs))}}var yE=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&oy(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>oy(i==null?void 0:i.brand,e)))return!0}catch{}return!!t.webdriver};function _E(){return(_E=be(function*(){var t=xt==null?void 0:xt.userAgentData;if(t!=null&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),n=e==null?void 0:e.model;return ue(n)&&n.length>0?n:void 0}catch(r){return void D.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}})).apply(this,arguments)}var dc=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function uf(t,e,n){return Ss({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var wE={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>dc(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!dc(n,r))),icontains:(t,e)=>e.map(Al).some(n=>t.map(Al).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(Al).every(n=>t.map(Al).every(r=>!n.includes(r))),gt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(i=>r>parseFloat(i))}),lt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(i=>rt.toLowerCase();function xE(t,e){return!t||Object.entries(t).every(n=>{var r=n[1],i=e==null?void 0:e[n[0]];if(F(i)||et(i))return!1;var s=[String(i)],o=wE[r.operator];return!!o&&o(r.values,s)})}var hp="custom",Gy="i.posthog.com",MI=/^\/static\//,AI=["/s/","/e/","/i/"];class NI{constructor(e){this.wo={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+Gy,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.wo[this.apiHost]||(this.wo[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":hp),this.wo[this.apiHost]}ko(e){if(MI.test(e)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}So(e){var n=so(e);return n?n.protocol+"//"+n.host+n.pathname:void 0}xo(e,n,r){if(e==="ui")return r;var i=r,s=this.instance.config.rewriteRequestPath;if(s){var o,a=((o=so(r))==null?void 0:o.href)||r;i=s(new URL(a)).toString()}if(s&&e==="api"&&AI.some(f=>n.indexOf(f)===0)){var l=this.So(i);if(l){var u,c=this.apiHost,d=this.Co;((u=d)==null?void 0:u.apiHost)===c&&d.rewriteRequestPath===s||(d={apiHost:c,rewriteRequestPath:s,urls:new Set},this.Co=d),d.urls.add(l)}}return i}isIngestionEndpoint(e){var n=this.Co,r=this.So(e);return(n==null?void 0:n.apiHost)===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&n.urls.has(r)}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.xo(e,n,this.uiHost+n);if(e==="flags")return this.xo(e,n,this.flagsApiHost+n);if(e==="assets"){var r=this.ko(n);if(r)return this.xo(e,n,""+r+n)}if(this.region===hp)return this.xo(e,n,this.apiHost+n);var i=Gy+n;switch(e){case"assets":return this.xo(e,n,"https://"+this.region+"-assets."+i);case"api":return this.xo(e,n,"https://"+this.region+"."+i)}}}function bE(t){var e;return!((e=t.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var de=Pe("[Surveys]"),EE="seenSurvey_",SE=t=>{try{var e=(n=>((r,i)=>""+EE+function(s){return s.current_iteration&&s.current_iteration>0?s.id+"_"+s.current_iteration:s.id}(i))(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(n){de.error("Failed to persist survey seen state",n)}},$I=[rf.Popover,rf.Widget,rf.API],FI={ignoreConditions:!1,ignoreDelay:!1,displayType:ap.Popover},LI=Pe("[PostHog ExternalIntegrations]"),jI={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class DI{constructor(e){this._instance=e}_s(e,n){var r;(r=Q.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,i=>{if(i)return LI.error("failed to load script",i);n()})}startIfEnabledOrStop(){var e=this,n=function(){var s,o,a,l=r[0],u=r[1];!u||(s=Q.__PosthogExtensions__)!=null&&(s=s.integrations)!=null&&s[l]||e._s(jI[l],()=>{var c;(c=Q.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[l])==null||c.start(e._instance)}),!u&&(o=Q.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[l]&&((a=Q.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[l])==null||a.stop())};for(var r of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;n()}}}class zI{constructor(e,n){this.I=e,this.ns=n,this.To=new Map,this.Xn=!1}add(e){var n=this;return be(function*(){if(n.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.To.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');n.To.set(e.name,e);try{var r=e.setup(n.ns);r&&(yield r)}catch(s){var i=n.To.get(e.name)===e;i&&n.To.delete(e.name),n.I.error('Failed to set up browser extension "'+e.name+'"',s),i&&n.Mo(e)}})()}dispose(){if(!this.Xn){this.Xn=!0;var e=Array.from(this.To.values()).reverse();for(var n of(this.To.clear(),e))this.Mo(n)}}Mo(e){try{var n=e.dispose==null?void 0:e.dispose();n&&ft(n.then)&&n.then(void 0,r=>{this.I.error('Failed to dispose browser extension "'+e.name+'"',r)})}catch(r){this.I.error('Failed to dispose browser extension "'+e.name+'"',r)}}}class UI{constructor(e){this._instance=e}initialize(){}get(e){var n=this._instance.persistence;if(typeof e=="string")return n==null?void 0:n.get_property(e);var r={};for(var i of e){var s=n==null?void 0:n.get_property(i);F(s)||(r[i]=s)}return r}set(e,n){var r;(r=this._instance.persistence)==null||r.register(typeof e=="string"?{[e]:n}:e)}remove(e){var n;(n=this._instance.persistence)==null||n.unregister(e)}}var Ky="extensionsRemoteConfig";class VI{constructor(e){this.Xn=!1,this.instance=e,this.I=D,this.Eo=e.Io,this.kv=new UI(e),this.onEvent=n=>Ml(this.instance.on("eventCaptured",r=>{try{n({event:r.event,properties:r.properties})}catch(i){this.I.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=n=>{if(this.Xn)return Ml(()=>{});var r=s=>{try{n(s)}catch(o){this.I.error("Browser extension remote config listener failed",o)}},i=this.instance.Ro.on(Ky,r);return this.Eo&&r(this.Eo),Ml(i)},this.Po=new zI(D.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property(Ma))!==null&&e!==void 0?e:this.distinctId}get deviceId(){var e=this.instance.get_property(Ma);return typeof e=="string"?e:void 0}get library(){return{name:we.LIB_NAME,version:we.LIB_VERSION}}get initialPersonProperties(){var e,n;return(e=(n=this.instance.persistence)==null?void 0:n.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,n,r,i,s=(e=this.instance.sessionManager)==null?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=s==null?void 0:s.sessionId)!==null&&n!==void 0?n:"",windowId:(r=s==null?void 0:s.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(i=s==null?void 0:s.sessionStartTimestamp)!==null&&i!==void 0?i:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(e){return this.Po.add(e)}capture(e,n,r){var i=this;return be(function*(){r?i.instance.capture(e,n,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):i.instance.capture(e,n)})()}registerDynamicEventProperties(e){return Ml(this.instance.Ao(e))}handleRemoteConfig(e){this.Xn||(this.Eo=e,this.instance.Ro.emit(Ky,e))}sendRequest(e,n){var r=this;return be(function*(){var i;n===void 0&&(n={});var s=r.instance.requestRouter.endpointFor((i=n.target)!==null&&i!==void 0?i:"api",e),o={method:n.method,url:n.query?tl(s,n.query):s,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(r.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,r.instance._send_request(o)})})()}dispose(){this.Xn||(this.Xn=!0,this.Po.dispose())}}var ca={},cf=0,da=()=>{},Qy='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Lo="Surveys module not available",Yy="sanitize_properties is deprecated. Use before_send instead",CE="Invalid value for property_denylist config: ",BI=["token","distinct_id",Ob],us="posthog",kE=!SI&&(Rt==null?void 0:Rt.indexOf("MSIE"))===-1&&(Rt==null?void 0:Rt.indexOf("Mozilla"))===-1,df=t=>{var e;return N({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:BT(j==null?void 0:j.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:da,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Ie&&ue(Ie==null?void 0:Ie.search)&&Ie.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(T==null||(e=T.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){D.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:np,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:fp},error_tracking:{},_onCapture:da},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:tI,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(t))},qI=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Xy=t=>{var e={};for(var n of qI){var r=n[0],i=n[1];F(t[r])||(e[i]=t[r])}var s=ge({},e,t),o=t.__preview_external_dependency_versioned_paths;return F(o)||(F(t.strict_script_versioning)&&(s.strict_script_versioning=!!o),ue(o)&&F(t.asset_host)&&(s.asset_host=o)),X(t.property_blacklist)&&(F(t.property_denylist)?s.property_denylist=t.property_blacklist:X(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:D.error(CE+t.property_denylist)),s};class HI{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(e){D.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Dt{Oo(e,n){if(e){var r=this.To.indexOf(e);r!==-1&&this.To.splice(r,1)}return this.To.push(n),n.initialize==null||n.initialize(),n}Lo(){return this.config.cookieless_mode===nr||this.config.cookieless_mode===mi&&this.consent.isRejected()}$o(){if(!this.Lo()&&this.get_distinct_id()===Zi){var e=this.persistence;if(e){this.Do()||e.load(!0);var n=this.get_distinct_id();if(!n||n===Zi){var r=this.config.get_device_id(In());this.register({distinct_id:r,$device_id:r}),e.set_property(ie,Ve)}this.No()}}}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new HI,this.qo=!1,this.version=we.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new cc,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=df(),this.SentryIntegration=uI,this.sentryIntegration=r=>function(i,s){var o=Yb(i,s);return{name:Qb,processEvent:a=>o(a)}}(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Uo=!1,this.zo=null,this.Wo=null,this.Vo=null,this.scrollManager=new II(this),this.pageViewManager=new Ny(this),this.rateLimiter=new yI(this),this.requestRouter=new NI(this),this.consent=new YT(this),this.externalIntegrations=new DI(this);var n=(e=Dt.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,i,s)=>{var o=ue(r)?{[r]:i}:r;this.setPersonProperties(o),s==null||s({})},set_once:(r,i,s)=>{var o=ue(r)?{[r]:i}:r;this.setPersonProperties(void 0,o),s==null||s({})}},this.on("eventCaptured",r=>D.info('send "'+(r==null?void 0:r.event)+'"',r))}init(e,n,r){if(r&&r!==us){var i,s=(i=ca[r])!==null&&i!==void 0?i:new Dt;return s._init(e,n,r),ca[r]=s,ca[us][r]=s,s}return this._init(e,n,r)}_init(e,n,r){var i,s;n===void 0&&(n={});var o,a=ue(e)?e.trim():"";if(!a)return D.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return a!==((o=this.config)==null?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=df(n.defaults),n.debug=this.Go(n.debug),this.Zo=n,this.Qo=[],n.person_profiles?this.Wo=n.person_profiles:n.process_person&&(this.Wo=n.process_person);var l=df(n.defaults),u=Xy(n),c=ge({},l,u,{name:r,token:a});xe(l.rageclick)&&xe(u.rageclick)&&(c.rageclick=ge({},l.rageclick,u.rageclick)),xe(l.session_recording)&&xe(u.session_recording)&&(c.session_recording=ge({},l.session_recording,u.session_recording)),this.set_config(c),this.config.on_xhr_error&&D.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:_t.GZipJS;var d=this.Do();if(this.persistence=new nf(this.config,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new nf(N({},this.config,{persistence:"sessionStorage"}),d,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!d&&me.Dr()){var f=me.Br(this.Bo);X(f)&&f.forEach(S=>{ue(S)&&this.jo.add(S)})}else me.qr(this.Bo);var _=N({},this.persistence.props),m=N({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Jo=new PI(S=>this.Ko(S),this.config.request_queue_config),this.Yo=new TI(this),this.__request_queue=[];var p=this.Lo();if(p||(this.sessionManager=new Wy(this),this.sessionPropsManager=new qy(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((S,k,C)=>{(C!=null&&C.activityTimeout||C!=null&&C.sessionPastMaximumLength||C!=null&&C.crossTabAdoption)&&this.Xo()})),this.tl(),this.config.__preview_deferred_init_extensions?(D.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.el(p)},0)):(D.info("Initializing extensions synchronously"),this.el(p)),we.DEBUG=we.DEBUG||this.config.debug,we.DEBUG&&D.info("Starting in debug mode",{this:this,config:n,thisC:N({},this.config),p:_,s:m}),!this.config.identity_distinct_id||(i=n.bootstrap)!=null&&i.distinctID||(n.bootstrap=N({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var y=n.bootstrap.distinctID,h=this.get_distinct_id(),v=this.persistence.get_property(ie);if(n.bootstrap.isIdentifiedID&&h!=null&&h!==y&&v===Ve)this.identify(y);else if(n.bootstrap.isIdentifiedID&&h!=null&&h!==y&&v===it)D.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var x=this.config.get_device_id(In()),b=n.bootstrap.isIdentifiedID?x:y;this.persistence.set_property(ie,n.bootstrap.isIdentifiedID?it:Ve),this.register({distinct_id:y,$device_id:b})}}if(p)this.register_once({distinct_id:Zi,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(In());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(ie,Ve)}return Ce(T,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?function(S,k){var C=S.config.segment;if(!C)return k();(function(R,P){var $=R.config.segment;if(!$)return P();var O=L=>{var H=()=>L.anonymousId()||In();R.config.get_device_id=H,L.id()&&(R.register({distinct_id:L.id(),$device_id:H()}),R.persistence.set_property(ie,it)),P()},U=$.user();"then"in U&&ft(U.then)?U.then(O):O(U)})(S,()=>{C.register((R=>{typeof Promise<"u"&&Promise.resolve||ef.warn("This browser does not have Promise support, and can not use the segment integration");var P=($,O)=>{if(!O)return $;$.event.userId||$.event.anonymousId===R.get_distinct_id()||(ef.info("No userId set, resetting PostHog"),R.reset()),$.event.userId&&$.event.userId!==R.get_distinct_id()&&(ef.info("UserId set, identifying with PostHog"),R.identify($.event.userId));var U=R.calculateEventProperties(O,$.event.properties);return $.event.properties=Object.assign({},U,$.event.properties),$};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:$=>P($,$.event.event),page:$=>P($,ls),identify:$=>P($,Kd),screen:$=>P($,"$screen")}})(S)).then(()=>{k()})})}(this,()=>this.il()):this.il(),ft(this.config._onCapture)&&this.config._onCapture!==da&&(D.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",S=>this.config._onCapture(S.event,S))),this.config.ip&&D.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return _E.apply(this,arguments)}().then(S=>{S&&this.register({[Wd]:S})}).catch(da),this}rl(e){var n=e;return ue(n.name)&&ft(n.setup)}nl(e,n){this.rl(e)?n.push(()=>{this.sl().add(e).catch(da)}):this.To.push(e)}tl(){var e,n,r,i,s,o,a=(e=(n=this.config.__extensionClasses)==null?void 0:n.featureFlags)!==null&&e!==void 0?e:(r=Dt.__defaultExtensionClasses)==null?void 0:r.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||((i=this.al)==null||i.call(this),this.al=void 0,this.featureFlags=new a(this)),ft(this.featureFlags.onReloading)&&ft(this.featureFlags.setup)?this.al||(this.al=this.featureFlags.onReloading(()=>{this.Ro.emit("featureFlagsReloading",!0)}),this.sl().add(this.featureFlags)):(s=(o=this.featureFlags).initialize)==null||s.call(o))}el(e){var n,r,i,s,o,a,l,u=performance.now(),c=N({},Dt.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.exceptions&&this.To.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new c.exceptions(this)),c.historyAutocapture&&this.To.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.To.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this.To.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this.To.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.nl(this.autocapture=new c.autocapture(this),d),c.surveys&&this.nl(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new c.surveys(this),d),c.logs&&this.To.push(this.logs=(i=this.logs)!==null&&i!==void 0?i:new c.logs(this)),c.metrics&&this.To.push(this.metrics=(s=this.metrics)!==null&&s!==void 0?s:new c.metrics(this)),c.conversations&&this.To.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new c.conversations(this)),c.productTours&&this.To.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.To.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.To.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,lI)),c.toolbar&&this.To.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new c.toolbar(this)),c.experiments&&this.To.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new c.experiments(this)),this.To.forEach(f=>{f.initialize&&d.push(()=>{f.initialize==null||f.initialize()})}),d.push(()=>{if(this.ol){var f=this.ol;this.ol=void 0,this.To.forEach(_=>_.onRemoteConfig==null?void 0:_.onRemoteConfig(f))}}),this.ll(d,u)}ll(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.ll(e,n)},0);var r=e.shift();if(r)try{r()}catch(s){D.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-n);this.register_for_session({[Mb]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ab]:i}),this.config.__preview_deferred_init_extensions&&D.info("PostHog extensions initialized ("+i+"ms)")}pa(e){var n;if(!j||!j.body)return D.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.pa(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.ol=e),this.Io=e,this.compression=void 0,e.ok){var r,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=Y(i.supportedCompression,_t.GZipJS)?_t.GZipJS:Y(i.supportedCompression,_t.Base64)?_t.Base64:void 0),(r=i.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:np}),(n=this.ul)==null||n.handleRemoteConfig(e),this.To.forEach(s=>s.onRemoteConfig==null?void 0:s.onRemoteConfig(e))}il(){try{this.config.loaded(this)}catch(r){D.critical("`loaded` function failed",r)}if(this.hl(),this.config.internal_or_test_user_hostname&&Ie!=null&&Ie.hostname){var e=Ie.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Lo())&&this.dl()},1),this.vl=new oE(this),this.vl.load()}hl(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Jo)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Pl(this.__request_queue,e=>this.Ko(e)),this.__request_queue=[],this.hl()}_handle_unload(){var e,n,r,i,s;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.cl()&&this.capture(Gd),(r=this.logs)==null||r.flushLogs("sendBeacon"),(i=this.Jo)==null||i.unload(),(s=this.Yo)==null||s.unload()):this.cl()&&this.capture(Gd,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?kE?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=N({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(F(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,o=N({},n);o.timeout=o.timeout||6e4;var a,l,u,c,d,f=(r=o.transport)!==null&&r!==void 0?r:"fetch";f==="sendBeacon"&&F(o.compression)&&o.data&&(o.compression=_t.Base64),o.method==="POST"&&o.data&&(o.timestampMode==="capture-body"?o.data={api_key:(l=(d=(c=(X(a=o.data)?a:[a]).map(y=>N({},y,y.timestamp instanceof Date&&!isNaN(y.timestamp.getTime())?{timestamp:y.timestamp.toISOString()}:{})))[0])==null||(u=d.properties)==null?void 0:u.token)!==null&&l!==void 0?l:d==null?void 0:d.token,batch:c,sent_at:new Date().toISOString()}:o.timestampMode==="body"&&(o.data=function(y,h){return h===void 0&&(h=new Date().toISOString()),X(y)?y.map(v=>N({},v,{sent_at:h})):N({},y,{sent_at:h})}(o.data))),o.url=By(o.url,o.method,o.compression,o.timestampMode);var _=uu.filter(y=>!o.disableTransport||!y.transport||!o.disableTransport.includes(y.transport)),m=(i=(s=function(y,h){for(var v=0;y.length>v;v++)if(y[v].transport===f)return y[v]}(_))==null?void 0:s.method)!==null&&i!==void 0?i:_[0].method;if(!m)throw new Error("No available transport method");var p=y=>{try{m(y)}catch(h){gE(h)?D.warn(h):D.error(h),o.callback==null||o.callback({statusCode:0,error:h})}};f!=="sendBeacon"&&o.data&&o.compression===_t.GZipJS&&DR&&typeof Promise<"u"&&!lu?CI(o).then(y=>{p(y)}).catch(y=>{if(sy(y))return lu=!0,void p(N({},o,{compression:void 0,url:By(n.url,n.method,void 0,n.timestampMode)}));(h=>{if(!h||typeof h!="object")return!1;var v="name"in h?String(h.name):"";return sy(h)||v===Vx})(y)&&(lu=!0),p(o)}):m(o)})(N({},e,{callback:n=>{var r,i;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(i=this.config).on_request_error)==null||r.call(i,n),e.callback==null||e.callback(n)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Ko(e){this.Yo?this.Yo.retriableRequest(e):this._send_request(e)}_execute_array(e){cf++;try{var n,r=[],i=[],s=[];Pl(e,a=>{if(a)if(X(n=a[0]))s.push(a);else if(ft(a))try{a.call(this)}catch(l){D.error("Error executing queued PostHog call",a,l)}else X(a)&&n==="alias"?r.push(a):X(a)&&n.indexOf("capture")!==-1&&ft(this[n])?s.push(a):i.push(a)});var o=function(a,l){Pl(a,function(u){try{if(X(u[0])){var c=l;he(u,function(d){c=c[d[0]].apply(c,d.slice(1))})}else l[u[0]].apply(l,u.slice(1))}catch(d){D.error("Error executing queued PostHog call",u,d)}})};o(r,this),o(i,this),o(s,this)}finally{cf--}}push(e){if(cf>0&&X(e)&&ue(e[0])){var n=Dt.prototype[e[0]];ft(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,r){var i,s,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!F(e)&&ue(e)){this.$o();var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){n!=null&&n.$current_url&&!ue(n==null?void 0:n.$current_url)&&(D.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||r!=null&&r.fl||D.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var d=new Date,f=(r==null?void 0:r.timestamp)||d,_=cy(r==null?void 0:r.uuid,In),m={uuid:_,event:e,properties:this.calculateEventProperties(e,n||{},f,_)};e===ls&&this.config.__preview_capture_bot_pageviews&&u&&(m.event="$bot_pageview",m.properties.$browser_type="bot"),c&&(m.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens);var p=e==="$feature_flag_called"&&m.properties.$feature_flag_has_experiment===!1&&this.get_property(Ju)===!0;r!=null&&r.$set&&!p&&(m.$set=r==null?void 0:r.$set);var y=r==null?void 0:r.$unset;y&&(m.$unset=y);var h,v,x,b=p?void 0:this.pl(r==null?void 0:r.$set_once,e!==yy,e===Kd);if(b&&(m.$set_once=b),r!=null&&r._noTruncate||(s=this.config.properties_string_max_length,o=m,a=O=>ue(O)?O.slice(0,s):O,l=new Set,m=function O(U,L){if(U!==Object(U))return a?a(U):U;if(!l.has(U)){var H;if(l.add(U),X(U))H=[],Pl(U,K=>{H.push(O(K))});else{var q={};he(U,(K,I)=>{l.has(K)||(q[I]=O(K))}),H=q}return H}}(o)),m.timestamp=f,F(r==null?void 0:r.timestamp)||(m.properties.$event_time_override_provided=!0,m.properties.$event_time_override_system_time=d),p&&(m.properties=function(O,U){U===void 0&&(U=[]);var L={},H=q=>{O[q]!==void 0&&(L[q]=O[q])};return zR.forEach(H),U.forEach(H),L}(m.properties,BI)),e===rr.DISMISSED||e===rr.SENT){var E=n==null?void 0:n[sf.SURVEY_ID],S=n==null?void 0:n[sf.SURVEY_ITERATION];SE({id:E,current_iteration:S}),m.$set=N({},m.$set,{[(h={id:E,current_iteration:S},v=e===rr.SENT?"responded":"dismissed",x="$survey_"+v+"/"+h.id,h.current_iteration&&h.current_iteration>0&&(x="$survey_"+v+"/"+h.id+"/"+h.current_iteration),x)]:!0})}else e===rr.SHOWN&&(m.$set=N({},m.$set,{[sf.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===mI.SHOWN){var k=n==null?void 0:n[Ly.TOUR_TYPE];k&&(m.$set=N({},m.$set,{[Ly.TOUR_LAST_SEEN_DATE+"/"+k]:new Date().toISOString()}))}var C=N({},m.properties.$set,m.$set);if(yn(C)||this.setPersonPropertiesForFlags(C),!te(this.config.before_send)){var R=this.kn(m);if(!R)return;(m=R).uuid=cy(m.uuid,In)}this.Ro.emit("eventCaptured",m);var P=(i=r==null?void 0:r._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),$={method:"POST",url:P,data:m,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(P)?"body":"capture-body",batchKey:r==null?void 0:r._batchKey,transport:r==null?void 0:r.transport};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Ko($):this.Jo.enqueue($),m}D.critical("This capture call is ignored due to client rate limiting.")}}else D.error("No event name provided to posthog.capture")}else D.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}sl(){var e;return(e=this.ul)!==null&&e!==void 0?e:this.ul=new VI(this)}Ao(e){this.Ho.push(e);var n=!0;return()=>{if(n){n=!1;var r=this.Ho.indexOf(e);r!==-1&&this.Ho.splice(r,1)}}}gl(e){var n,r,i;return e===void 0&&(e=!0),!((n=this.persistence)==null||!n.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(ie)===Ve&&((i=this.sessionPersistence)==null||i.clear(),this.jo.clear(),this.ml()),(r=this.featureFlags)==null||r.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,n,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.gl();var o=s?void 0:this.persistence.remove_event_timer(e),a=N({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Lo()&&(a[Ob]=!0),e==="$snapshot"){var l=N({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!ue(a.distinct_id)&&!qe(a.distinct_id)||Uu(a.distinct_id))&&D.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=function(E,S,k,C){var R,P,$,O;if(C===void 0&&(C=!1),!Rt)return{};var U,L=E?[...ao,...S||[]]:[],H=function(Yi){for(var Pt=0;ly.length>Pt;Pt++){var Xi=ly[Pt],_r=Xi[1],ln=Xi[0].exec(Yi),bo=ln&&(ft(_r)?_r(ln,Yi):_r);if(bo)return bo}return["",""]}(Rt),q=H[0],K=H[1],I=(U=typeof navigator<"u"?navigator:void 0)!=null&&U.brave?{brave:!0}:{},M={};F(k)||(M.detectGoogleSearchApp=k);var B={},G=(R=navigator)==null||(R=R.userAgentData)==null?void 0:R.platform,Z=(P=navigator)==null?void 0:P.maxTouchPoints,se=T==null||($=T.screen)==null?void 0:$.width,ce=T==null||(O=T.screen)==null?void 0:O.height,_e=T==null?void 0:T.devicePixelRatio;F(G)||(B.userAgentDataPlatform=G),F(Z)||(B.maxTouchPoints=Z),F(se)||(B.screenWidth=se),F(ce)||(B.screenHeight=ce),F(_e)||(B.devicePixelRatio=_e);var Se,ze,ve,Ae,kt,yr,gt,Ge,ai=ge(Gv({$os:q,$os_version:K,$browser:vb(Rt,navigator.vendor,I,M),$device:uy(Rt),$device_type:(ze=Rt,ve=B,Ge=uy(ze),Ge===Xx||Ge===Yx||Ge==="Kobo"||Ge==="Kindle Fire"||Ge===cb?no:Ge===Ia||Ge===As||Ge===Oa||Ge===jh?"Console":Ge===Zx?"Wearable":Ge?qt:(ve==null?void 0:ve.userAgentDataPlatform)==="Android"&&((Ae=ve==null?void 0:ve.maxTouchPoints)!==null&&Ae!==void 0?Ae:0)>0?600>Math.min((kt=ve==null?void 0:ve.screenWidth)!==null&&kt!==void 0?kt:0,(yr=ve==null?void 0:ve.screenHeight)!==null&&yr!==void 0?yr:0)/((gt=ve==null?void 0:ve.devicePixelRatio)!==null&>!==void 0?gt:1)?qt:no:"Desktop"),$timezone:sE(),$timezone_offset:pI()}),{$current_url:$a(C?Zr(Ie==null?void 0:Ie.href):Ie==null?void 0:Ie.href,L,Fa),$host:Ie==null?void 0:Ie.host,$pathname:Ie==null?void 0:Ie.pathname,$raw_user_agent:Rt.length>1e3?Rt.substring(0,997)+"...":Rt,$browser_version:uT(Rt,navigator.vendor,I,M),$browser_language:$y(),$browser_language_prefix:(Se=$y(),typeof Se=="string"?Se.split("-")[0]:void 0),$screen_height:T==null?void 0:T.screen.height,$screen_width:T==null?void 0:T.screen.width,$viewport_height:T==null?void 0:T.innerHeight,$viewport_width:T==null?void 0:T.innerWidth,$lib:we.LIB_NAME,$lib_version:we.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return we.SDK_DIST_CHANNEL&&(ai.$sdk_dist_channel=we.SDK_DIST_CHANNEL),ai}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var d=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime(),!0),f=d.windowId;a.$session_id=d.sessionId,a.$window_id=f}this.sessionPropsManager&&ge(a,this.sessionPropsManager.getSessionProps());try{var _;this.sessionRecording&&ge(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(_=this.Yo)==null?void 0:_.length}catch(E){a.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===hp&&(a.$lib_custom_api_host=this.config.api_host),u=e!==ls||s?e!==Gd||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=ge(a,u),e===ls&&j&&(a.title=j.title),!F(o)){var m=r.getTime()-o;a.$duration=parseFloat((m/1e3).toFixed(3))}Rt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var p=this.persistence.properties(),y=this.sessionPersistence.properties();he(["$referrer","$referring_domain"],E=>{E in p&&delete y[E]});var h={};if(this.Ho.length>0)for(var v of this.Ho.slice())try{ge(h,v())}catch(E){D.error("Failed to produce browser extension event properties",E)}(a=ge({},c,p,y,N({},h,a))).$is_identified=this._isIdentified(),X(this.config.property_denylist)?he(this.config.property_denylist,function(E){delete a[E]}):D.error(CE+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(D.error(Yy),a=x(a,e));var b=this.yl();return a.$process_person_profile=b,b&&!s&&this.bl("_calculate_event_properties"),a}pl(e,n,r){var i;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.yl()||this.qo&&!r)return e;var s=this.persistence.get_initial_props(),o=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),a=ge({},s,o||{},e||{}),l=this.config.sanitize_properties;return l&&(D.error(Yy),a=l(a,"$set_once")),n&&(this.qo=!0),yn(a)?void 0:a}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var i;(i=this.persistence)==null||i.register_once(e,n,r)}register_for_session(e){var n,r;(n=this.persistence)==null||n.syncCookieProperties(),this.gl(),(r=this.sessionPersistence)==null||r.register(e),Object.keys(e).forEach(i=>this.jo.add(i)),this.ml()}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e),this.jo.delete(e),this.ml()}_l(e,n){this.register({[e]:n})}Xo(){this.jo.forEach(e=>{var n;(n=this.sessionPersistence)==null||n.unregister(e)}),this.jo.clear(),this.ml()}ml(){var e;if(this.Bo)if(this.config.persistence==="memory"||(e=this.sessionPersistence)!=null&&e.Hs||!me.Dr())me.qr(this.Bo);else{var n=[];this.jo.forEach(r=>n.push(r)),n.length>0?me.Nr(this.Bo,n):me.qr(this.Bo)}}getFeatureFlag(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var r,i;return(r=(i=this.featureFlags)==null?void 0:i.isFeatureEnabled(e,n))!==null&&r!==void 0?r:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,r){var i;(i=this.featureFlags)==null||i.updateFlags(e,n,r)}updateEarlyAccessFeatureEnrollment(e,n,r){var i;(i=this.featureFlags)==null||i.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){var i;return n===void 0&&(n=!1),(i=this.featureFlags)==null?void 0:i.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.Ro.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Lo}),()=>{})}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:Lo})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:Lo})}renderSurvey(e,n){var r;(r=this.surveys)==null||r.renderSurvey(e,n)}displaySurvey(e,n){var r;n===void 0&&(n=FI),(r=this.surveys)==null||r.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:Lo}}canRenderSurveyAsync(e,n){var r,i;return n===void 0&&(n=!1),(r=(i=this.surveys)==null?void 0:i.canRenderSurveyAsync(e,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:Lo})}wl(e){return!e||Uu(e)?(D.critical("Unique user id has not been set in posthog.identify"),!1):e===Zi?(D.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(D.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,n,r){if(!this.__loaded||!this.persistence)return D.uninitializedWarning("posthog.identify");if(qe(e)&&(e=e.toString(),D.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.wl(e)&&this.bl("posthog.identify")){this.$o();var i=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,o=this.gl(!1),a=this.persistence.Ws(),l=!1;try{var u=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Ma)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),e!==u&&e!==this.get_property(bs)&&(this.unregister(bs),this.register({distinct_id:e}));var c,d=(this.persistence.get_property(ie)||Ve)===Ve,f=e!==u,_=!f&&d;if(f&&d)this.persistence.set_property(ie,it),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(Kd,{distinct_id:e,$anon_distinct_id:u},{$set:n||{},$set_once:r||{}}),this.Vo=uf(e,n,r),(c=this.featureFlags)==null||c.setAnonymousDistinctId(u);else if(_){this.persistence.set_property(ie,it);var m=n||{},p=r||{};this.setPersonPropertiesForFlags({$set:m,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:m,$set_once:p}),this.Vo=uf(e,n,r)}else(n||r)&&this.setPersonProperties(n,r);f||s||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(tr)):_&&(n||r)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.Qs(l)}}}setPersonProperties(e,n){if((e||n)&&this.bl("posthog.setPersonProperties")){var r=uf(this.get_distinct_id(),e,n);this.Vo!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Vo=r):D.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var n,r=(X(e)?e:[e]).filter(i=>ue(i)&&i.length>0);r.length!==0&&this.bl("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Vo=null)}group(e,n,r){var i;if(e&&n){(i=this.persistence)==null||i.syncCookieProperties(),this.gl();var s=this.getGroups(),o=s[e]!==n;if(o&&this.resetGroupPropertiesForFlags(e),this.register({$groups:N({},s,{[e]:n})}),o||r){var a={$group_type:e,$group_key:n};r&&(a.$group_set=r),this.capture(yy,a)}r&&this.setGroupPropertiesForFlags({[e]:r}),o&&!r&&this.reloadFeatureFlags()}else D.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e){var n;e===void 0&&(e=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),this.bl("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n=It(e)?e:e==null?void 0:e.resetDeviceID,r=It(e)||e==null?void 0:e.bootstrap;this.kl(n,!1,r)}kl(e,n,r){var i,s,o;if(n===void 0&&(n=!1),D.info("reset"),!this.__loaded)return D.uninitializedWarning("posthog.reset");var a=r==null?void 0:r.sessionID;this.config.bootstrap=r||((i=this.Zo)==null?void 0:i.bootstrap)||{},(s=this.featureFlags)==null||s.updateConfig==null||s.updateConfig(this.config,this.ma());var l=this.get_property(Ma),u=this.get_property(Wd),c=this.get_property(bi),d=this.is_capturing();this.consent.reset(),n||!d||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var f=(o=this.persistence)==null||o.Ws==null?void 0:o.Ws(),_=!1;try{var m,p,y,h,v,x,b,E,S,k,C,R,P,$;if((m=this.persistence)==null||m.clear(),(p=this.sessionPersistence)==null||p.clear(),this.jo.clear(),this.ml(),F(c)||(C=this.persistence)==null||C.register({[bi]:c}),(y=this.surveys)==null||y.reset(),(h=this.vl)==null||h.stop(),(v=this.featureFlags)==null||v.reset(),(x=this.conversations)==null||x.reset(),(b=this.logs)==null||b.reset(),(E=this.metrics)==null||E.reset(),(S=this.persistence)==null||S.set_property(ie,Ve),(k=this.sessionManager)==null||k.resetSessionId(),this.Vo=null,this.config.cookieless_mode===nr)this.register_once({distinct_id:Zi,$device_id:null},"");else{var O=this.config.get_device_id(In());this.register_once({distinct_id:O,$device_id:e?O:l},""),e||F(u)||this.register({[Wd]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),r&&(r.distinctID===void 0||this.Lo()||(($=this.persistence)==null||$.set_property(ie,r.isIdentifiedID?it:Ve),this.register({distinct_id:r.distinctID})),(R=this.featureFlags)==null||R.initialize(),!(F(a)||(P=this.sessionManager)!=null&&P.setBootstrapSessionId(a,!0)))){var U=N({},r);delete U.sessionID,this.config.bootstrap=U}delete this.config.identity_distinct_id,delete this.config.identity_hash,_=!0}finally{var L;f&&((L=this.persistence)==null||L.Qs==null||L.Qs(_))}this.reloadFeatureFlags()}shutdown(e){var n=this;return be(function*(){var r,i,s,o,a,l;if(n.__loaded){(r=n.vl)==null||r.stop(),n.sl().dispose(),(i=n.sessionRecording)==null||i.dispose(),(s=n.logs)==null||s.flushLogs("sendBeacon"),(o=n.metrics)==null||o.flush("sendBeacon"),(a=n.Jo)==null||a.unload(),(l=n.Yo)==null||l.unload();try{var u;(u=n.featureFlags)==null||u.destroy()}catch(c){D.error("Error while destroying feature flags",c)}}else D.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,n){var r;this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(r=this.conversations)==null||r.Sl()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.xl()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(e,n){return e===this.get_property(Sb)?(D.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(F(n)&&(n=this.get_distinct_id()),e!==n?(this._l(bs,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(D.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=N({},this.config);if(xe(e)){var r,i,s,o,a,l,u,c,d,f,_,m;ge(this.config,Xy(e));var p=this.Do();(r=this.persistence)==null||r.update_config(this.config,n,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new nf(N({},this.config,{persistence:"sessionStorage"}),p,!1);var y,h=this.Go(this.config.debug);It(h)&&(this.config.debug=h),It(this.config.debug)&&(this.config.debug?(we.DEBUG=!0,pe.Dr()&&pe.Nr("ph_debug",!0),D.info("set_config",{config:e,oldConfig:n,newConfig:N({},this.config)})):(we.DEBUG=!1,pe.Dr()&&pe.qr("ph_debug"))),(i=this.featureFlags)==null||i.updateConfig==null||i.updateConfig(this.config,this.ma()),(s=this.exceptionObserver)==null||s.onConfigChange(),(o=this.exceptions)==null||o.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(c=this.heatmaps)==null||c.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((y=this.historyAutocapture)==null||y.startIfEnabledOrStop()),(d=this.exceptionObserver)==null||d.startIfEnabledOrStop(),(f=this.deadClicksAutocapture)==null||f.startIfEnabledOrStop(),(_=this.surveys)==null||_.loadIfEnabled(),this.No(),(m=this.externalIntegrations)==null||m.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){we.LIB_NAME=e,we.LIB_VERSION=n}startSessionRecording(e){var n,r,i,s,o,a=e===!0,l={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),l.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),l.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),l.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),l.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(N({},i,n))}}addExceptionStep(e,n){var r;(r=this.exceptions)==null||r.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)==null||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)==null?void 0:n.logger)!==null&&e!==void 0?e:Dt.Cl}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:us;return n!==us&&(n=us+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(ie))===it||((n=this.sessionPersistence)==null?void 0:n.get_property(ie))===it}yl(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===np&&!this._isIdentified()&&yn(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[bs])&&((n=this.persistence)==null||(n=n.props)==null||!n[tc]))}cl(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yl()||this.bl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bl(e){return this.config.person_profiles==="never"?(D.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(tc,!0),!0)}Do(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==mi)}No(){var e,n,r,i,s=this.Do();return((e=this.persistence)==null?void 0:e.Hs)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.Hs)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s&&(this.jo.clear(),this.ml()),s}opt_in_capturing(e){var n;if(this.config.cookieless_mode!==nr){if(this.Lo()){var r,i,s,o,a;this.kl(!0,!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new Wy(this),this.pageViewManager=new Ny(this),this.persistence&&(this.sessionPropsManager=new qy(this,this.sessionManager,this.persistence));var l,u=(s=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&s!==void 0?s:(a=Dt.__defaultExtensionClasses)==null?void 0:a.sessionRecording;u&&(this.sessionRecording=this.Oo(this.sessionRecording,new u(this)),this.Io&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.Io)))}var c,d;this.consent.optInOut(!0),this.No(),this.hl(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==mi&&((c=this.surveys)==null||c.loadIfEnabled()),(F(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((d=e==null?void 0:e.captureEventName)!==null&&d!==void 0?d:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else D.warn(Qy)}opt_out_capturing(){var e,n,r;this.config.cookieless_mode!==nr?(this.config.cookieless_mode===mi&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===mi&&(this.register({distinct_id:Zi,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):D.warn(Qy)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===nr||(this.config.cookieless_mode===mi?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.No()}_is_bot(){return xt?yE(xt,this.config.custom_blocked_useragents):void 0}dl(){j&&(j.visibilityState==="visible"?this.Uo||(this.Uo=!0,this.capture(ls,{title:j.title},{send_instantly:!0}),this.zo&&(j.removeEventListener(nc,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),Ce(j,nc,this.zo)))}debug(e){e===!1?(T==null||T.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(T==null||T.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}ma(){var e=this.Zo||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(D.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(n,r,i,s,o){var a=r in n&&!te(n[r]),l=i in n&&!te(n[i]);return a?n[r]:!!l&&(o&&o.warn("Config field '"+i+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),n[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,D)}kn(e){var n;if(te(this.config.before_send))return e;var r=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(XR),i=X(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var o of i)try{if(s=o(s),te(s)){var a="Event '"+e.event+"' was rejected in beforeSend function";return YR(e.event)?D.warn(a+". This can cause unexpected behavior."):D.info(a),null}s.properties&&!yn(s.properties)||D.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(u){return D.error("Error in beforeSend function for event '"+e.event+"':",u),null}for(var l of r)if(s.properties&&te(s.properties[l]))return D.warn("Event '"+e.event+"' had its '"+l+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var e;return(e=this.pageViewManager.Ss)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}Go(e){var n=It(e)&&!e,r=pe.Dr()&&pe.Pr("ph_debug")==="true";return!n&&(!!r||e)}}Dt.__defaultExtensionClasses={},Dt.Cl=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(var n=0;e.length>n;n++)t.prototype[e[n]]=UT(t.prototype[e[n]])}(Dt,["identify"]);class PE{constructor(e){this.disabled=e===!1;var n=xe(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)r-i.timestamp){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var ff="$copy_autocapture",Nl=Pe("[AutoCapture]");function hf(t,e){return e.length>t?e.slice(0,t)+"...":e}function WI(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!ei(e));return e}function GI(t,e){var n,r,i=e.e,s=e.maskAllElementAttributes,o=e.maskAllText,a=e.elementAttributeIgnoreList,l=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!ei(t))return{props:{}};for(var c=[t],d=new Set([t]),f=t;f.parentNode&&!Vt(f,"body")&&Ub>c.length;)if(zb(f.parentNode)){var _=f.parentNode.host;if(d.has(_))break;d.add(_),c.push(_),f=_}else{if(!ei(f.parentNode)||d.has(f.parentNode))break;d.add(f.parentNode),c.push(f.parentNode),f=f.parentNode}var m,p,y=[],h={},v=!1,x=!1;if(he(c,C=>{var R=op(C);if(Vt(C,"a")){var P=C.getAttribute("href");v=!!(R&&P&&la(P))&&(u?Zr(P):P)}Y(oc(C),"ph-no-capture")&&(x=!0),y.push(function(O,U,L,H,q){q===void 0&&(q=!1);var K=O.tagName.toLowerCase(),I={tag_name:K};Qv.indexOf(K)>-1&&!L&&(I.$el_text=K.toLowerCase()==="a"||K.toLowerCase()==="button"?hf(1024,Oy(O)):hf(1024,Na(O)));var M=oc(O);M.length>0&&(I.classes=M.filter(function(se){return se!==""})),he(O.attributes,function(se){var ce;if((!Gb(O)||["name","id","class","aria-label"].indexOf(se.name)!==-1)&&(H==null||!H.includes(se.name))&&!U&&la(se.value)&&(!ue(ce=se.name)||ce.substring(0,10)!=="_ngcontent"&&ce.substring(0,7)!=="_nghost")){var _e=se.value;se.name==="class"&&(_e=Kv(_e).join(" ")),I["attr__"+se.name]=hf(1024,se.name==="href"&&q?Zr(_e):_e)}});for(var B=1,G=1,Z=O;Z=WI(Z);)B++,Z.tagName===O.tagName&&G++;return I.nth_child=B,I.nth_of_type=G,I}(C,s,o,a,u));var $=function(O){if(!op(O))return{};var U={};return he(O.attributes,function(L){if(L.name&&L.name.indexOf("data-ph-capture-attribute")===0){var H=L.name.replace("data-ph-capture-attribute-",""),q=L.value;H&&q&&la(q)&&(U[H]=q)}}),U}(C);ge(h,$)}),x)return{props:{},explicitNoCapture:x};if(o||(y[0].$el_text=Vt(t,"a")||Vt(t,"button")?Oy(t):Na(t)),v){var b,E;y[0].attr__href=v;var S=(b=so(v))==null?void 0:b.host,k=T==null||(E=T.location)==null?void 0:E.host;S&&k&&S!==k&&(m=v)}return{props:ge({$event_type:i.type,$ce_version:1},l?{}:{$elements:y},{$elements_chain:(p=y,function(C){return C.map(R=>{var P,$,O="";if(R.tag_name&&(O+=R.tag_name),R.attr_class)for(var U of(R.attr_class.sort(),R.attr_class))O+="."+U.replace(/"/g,"");var L=N({},R.text?{text:R.text}:{},{"nth-child":(P=R.nth_child)!==null&&P!==void 0?P:0,"nth-of-type":($=R.nth_of_type)!==null&&$!==void 0?$:0},R.href?{href:R.href}:{},R.attr_id?{attr_id:R.attr_id}:{},R.attributes),H={};return au(L).sort((q,K)=>q[0].localeCompare(K[0])).forEach(q=>{var K=q[1];return H[My(q[0].toString())]=My(K.toString())}),(O+=":")+au(H).map(q=>q[0]+'="'+q[1]+'"').join("")}).join(";")}(function(C){return C.map(R=>{var P,$,O={text:(P=R.$el_text)==null?void 0:P.slice(0,400),tag_name:R.tag_name,href:($=R.attr__href)==null?void 0:$.slice(0,2048),attr_class:oI(R),attr_id:R.attr__id,nth_child:R.nth_child,nth_of_type:R.nth_of_type,attributes:{}};return au(R).filter(U=>U[0].indexOf("attr__")===0).forEach(U=>O.attributes[U[0]]=U[1]),O})}(p)))},(n=y[0])!=null&&n.$el_text?{$el_text:(r=y[0])==null?void 0:r.$el_text}:{},m&&i.type==="click"?{$external_click_url:m}:{},h)}}class KI{constructor(e){this.name="autocapture",this.Qn=!1,this.Jn=null,this.Kn=!1,this.Yn=!1,this.qi={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Xn=!1,this.ts=e,this.ts.refresh(this.qi),this.rageclicks=new PE(this.qi.rageclick),this.es=null}setup(e){this.rs(),this.ns=e;var n=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Xn?n.dispose():(this.ss=n,this.startIfEnabled())}dispose(){var e;this.Xn||(this.Xn=!0,this.ns=void 0,(e=this.ss)==null||e.dispose(),this.ss=void 0,this.os())}ls(){return this.ts.refresh(this.qi),this.qi}rs(){var e,n;return this.ls(),this.qi.url_allowlist=(e=this.qi.url_allowlist)==null?void 0:e.map(r=>new RegExp(r)),this.qi.url_ignorelist=(n=this.qi.url_ignorelist)==null?void 0:n.map(r=>new RegExp(r)),this.qi}us(){if(this.isBrowserSupported()){if(T&&j){var e=this.hs=r=>{r=r||(T==null?void 0:T.event);try{this.ds(r)}catch(i){Nl.error("Failed to capture event",i)}};if(Ce(j,"submit",e,{capture:!0}),Ce(j,"change",e,{capture:!0}),Ce(j,"click",e,{capture:!0}),this.ls().capture_copied_text){var n=this.vs=r=>{r=r||(T==null?void 0:T.event);try{this.ds(r,ff)}catch(i){Nl.error("Failed to capture copy/cut event",i)}};Ce(j,"copy",n,{capture:!0}),Ce(j,"cut",n,{capture:!0})}}}else Nl.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(j==null||j.removeEventListener("submit",this.hs,!0),j==null||j.removeEventListener("change",this.hs,!0),j==null||j.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(j==null||j.removeEventListener("copy",this.vs,!0),j==null||j.removeEventListener("cut",this.vs,!0),this.vs=void 0),this.Qn=!1}startIfEnabled(){!this.Xn&&this.ns&&this.isEnabled&&!this.Qn&&(this.us(),this.Qn=!0)}onRemoteConfig(e){if(!this.Xn)if(this.Kn=!0,e.ok){var n=e.config;n.elementsChainAsString&&(this.Yn=n.elementsChainAsString);var r,i=n.autocapture_opt_out;It(i)&&((r=this.ns)==null||r.kv.set(Vh,i),this.Jn=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.es=e}getElementSelectors(e){var n,r=[];return(n=this.es)==null||n.forEach(i=>{var s=j==null?void 0:j.querySelectorAll(i);s==null||s.forEach(o=>{e===o&&r.push(i)})}),r}get isEnabled(){var e,n;if(this.Xn)return!1;var r=(e=this.ns)==null?void 0:e.kv.get(Vh),i=this.Jn,s=this.ls(),o=s.remoteRequestsDisabled&&!this.Kn;if(et(i)&&!It(r)&&!o)return!1;var a=(n=this.Jn)!==null&&n!==void 0?n:!!r;return!!s.enabled&&!a}ds(e,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r=ip(e);Db(r)&&(r=r.parentNode||null);var i,s=this.rs();n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&s.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Hb(r,s.rageclick)&&this.ds(e,"$rageclick");var o=n===ff;if(r&&function(m,p,y,h,v,x){var b;if(!T||Yv(m)||y!=null&&y.url_allowlist&&!Sy(y.url_allowlist,x)||y!=null&&y.url_ignorelist&&Sy(y.url_ignorelist,x))return!1;if(y!=null&&y.dom_event_allowlist){var E=y.dom_event_allowlist;if(E&&!E.some($=>p.type===$))return!1}var S=Wb(m,h),k=S.parentIsUsefulElement,C=S.targetElementList;if(!function($,O){var U=O==null?void 0:O.element_allowlist;if(F(U))return!0;var L,H=function(K){if(U.some(I=>K.tagName.toLowerCase()===I))return{v:!0}};for(var q of $)if(L=H(q))return L.v;return!1}(C,y)||!sp(C,y==null?void 0:y.css_selector_allowlist)||sp(C,(b=y==null?void 0:y.css_selector_ignorelist)!==null&&b!==void 0?b:eI))return!1;try{var R=T.getComputedStyle(m);if(R&&R.getPropertyValue("cursor")==="pointer"&&p.type==="click")return!0}catch{}var P=m.tagName.toLowerCase();switch(P){case"html":return!1;case"form":return(v||["submit"]).indexOf(p.type)>=0;case"input":case"select":case"textarea":return(v||["change","click"]).indexOf(p.type)>=0;default:return k?(v||["click"]).indexOf(p.type)>=0:(v||["click"]).indexOf(p.type)>=0&&(Qv.indexOf(P)>-1||m.getAttribute("contenteditable")==="true")}}(r,e,s,o,o?["copy","cut"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var a,l=GI(r,{e,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this.Yn,disableCaptureUrlHashes:s.disableCaptureUrlHashes}),u=l.props;if(l.explicitNoCapture)return!1;var c=this.getElementSelectors(r);if(c&&c.length>0&&(u.$element_selectors=c),n===ff){var d,f=Vb(T==null||(d=T.getSelection())==null?void 0:d.toString()),_=e.type||"clipboard";if(!f)return!1;u.$selected_content=f,u.$copy_type=_}return(a=this.ns)==null||a.capture(n,u).catch(m=>Nl.error("Failed to capture event",m)),!0}}}isBrowserSupported(){return ft(j==null?void 0:j.querySelectorAll)}}class QI{constructor(e){this._instance=e}refresh(e){var n=this._instance.config,r=xe(n.autocapture)?n.autocapture:void 0;e.enabled=!!n.autocapture,e.rageclick=n.rageclick,e.maskAllElementAttributes=n.mask_all_element_attributes,e.maskAllText=n.mask_all_text,e.disableCaptureUrlHashes=n.disable_capture_url_hashes,e.getCurrentUrl=n.get_current_url,e.remoteRequestsDisabled=this._instance.ma(),e.url_allowlist=r==null?void 0:r.url_allowlist,e.url_ignorelist=r==null?void 0:r.url_ignorelist,e.dom_event_allowlist=r==null?void 0:r.dom_event_allowlist,e.element_allowlist=r==null?void 0:r.element_allowlist,e.css_selector_allowlist=r==null?void 0:r.css_selector_allowlist,e.css_selector_ignorelist=r==null?void 0:r.css_selector_ignorelist,e.element_attribute_ignorelist=r==null?void 0:r.element_attribute_ignorelist,e.capture_copied_text=r==null?void 0:r.capture_copied_text}}var jo=Pe("[ExceptionAutocapture]"),Jy=()=>{},YI=Pe("[TracingHeaders]"),ui=Pe("[Web Vitals]"),Zy=9e5,e_="disabled",t_="lazy_loading",Do="awaiting_config",$l="missing_config";Pe("[SessionRecording]"),Pe("[SessionRecording]");var pp="[SessionRecording]",Hn=Pe(pp),XI=Pe("[Heatmaps]");function pf(t){return xe(t)&&"clientX"in t&&"clientY"in t&&qe(t.clientX)&&qe(t.clientY)}var Fl=Pe("[Product Tours]"),vf=t=>{var e;return!t.config.disable_product_tours&&!((e=t.persistence)==null||!e.get_property(qv))},JI=["$set_once","$set"],kn=Pe("[SiteApps]"),n_="Error while initializing PostHog app with config id ",RE=(t,e)=>t!=null&&t.then?t.then(e):e(t),ns="SDK is not enabled or survey functionality is not yet loaded",r_="Disabled. Not loading surveys.";class ZI{constructor(e,n){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Tl=!1,this.Ml=[],this.El=null,this.Il=null,this.Xn=!1,this.Rl=new Set,this.onRemoteConfig=r=>{if(!this.Xn&&!this.qi.disableSurveys){if(!r.ok)return de.warn("Remote config unavailable. Not loading surveys.");var i=r.config.surveys;if(te(i))return de.warn("Flags not loaded yet. Not loading surveys.");this.Pl=It(i)?i:i.length>0,de.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=e,this.Al=n}setup(e){if(!this.Xn)return this.Fl=e,RE(e.kv.initialize(),()=>{if(this.Fl===e&&!this.Xn){this.Fl=void 0,this.ns=e;var n=e.onRemoteConfig(this.onRemoteConfig);this.Xn?n.dispose():(this.ss=n,this.loadIfEnabled())}})}dispose(){var e,n,r;this.Xn||(this.Xn=!0,this.Fl=void 0,this.ns=void 0,(e=this.ss)==null||e.dispose(),this.ss=void 0,(n=this._surveyEventReceiver)==null||n.dispose(),this._surveyEventReceiver=null,(r=this._surveyManager)==null||r.dispose==null||r.dispose(),this._surveyManager=null,this.Ml=[],this.El=null,this.Rl.forEach(i=>clearTimeout(i)),this.Rl.clear())}get qi(){return this.ts.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var n=[],r=0;rlocalStorage.removeItem(s))}catch{}}loadIfEnabled(){if(!this.Xn&&this.ns){var e=this.qi;if(!this._surveyManager)if(this.Tl)de.info("Already initializing surveys, skipping...");else if(e.disableSurveys)de.info(r_);else if(e.cookielessMode&&this.ts.isOptedOut())de.info("Not loading surveys in cookieless mode without consent.");else{var n=this.ts.getExtensions();if(n){if(!F(this.Pl)||e.advancedEnableSurveys){var r=this.Pl||e.advancedEnableSurveys;this.Tl=!0;try{var i=n.generateSurveys;if(i)return this.Ol(i,r),void(this.Tl=!1);var s=n.loadExternalDependency;if(!s)return this.Ll(Wv),void(this.Tl=!1);s(o=>{try{if(this.Xn)return;var a=this.ts.getExtensions();o||a==null||!a.generateSurveys?this.Ll("Could not load surveys script",o):this.Ol(a.generateSurveys,r)}finally{this.Tl=!1}})}catch(o){throw this.Tl=!1,this.Ll("Error initializing surveys",o),o}}}else de.error("PostHog Extensions not found.")}}}Ol(e,n){this.Xn||(this._surveyManager=e(n),this._surveyEventReceiver=this.ts.createEventReceiver(),de.info("Surveys loaded successfully"),this.$l({isLoaded:!0}))}Ll(e,n){de.error(e,n),this.$l({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Ml.push(e),this._surveyManager&&this.$l({isLoaded:!0}),()=>{this.Ml=this.Ml.filter(n=>n!==e)}}getSurveys(e,n){var r;n===void 0&&(n=!1);var i=(r=this.ns)!==null&&r!==void 0?r:this.Al;if(i&&!this.Xn){if(this.qi.disableSurveys)return de.info(r_),e([]);var s=i.kv.get(Qh);if(s&&!n)return e(s,{isLoaded:!0}),void(this.Dl()&&this.getSurveys(()=>{},!0));if(this.El)this.El.then(l=>{this.Xn||e(l.surveys,l.context)}).catch(l=>de.error("Error in survey callback",l));else{var o=this.Nl("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.qi.requestTimeoutMs}).then(l=>{try{return this.ql(i,l)}catch(u){return de.error("Error processing surveys response",u),this.ql(i,{statusCode:0,error:u})}},l=>this.ql(i,{statusCode:0,error:l}));this.El=o;var a=()=>{this.El===o&&(this.El=null)};o.then(l=>{a(),this.Xn||e(l.surveys,l.context)},a).catch(l=>de.error("Error in survey callback",l))}}}Nl(e,n){var r=this.ns;return r?r.sendRequest(e,n):new Promise(i=>i({statusCode:0,error:new Error(ns)}))}ql(e,n){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:ns}};var r=n.statusCode;if(r!==200||!n.json){var i="Surveys API could not be loaded, status: "+r;return r!==0?de.error(i):n.error||de.warn(i),this.Il=Date.now(),{surveys:[],context:{isLoaded:!1,error:i}}}this.Il=null;var s,o=n.json.surveys||[],a=o.filter(l=>function(u){return!(!u.start_date||u.end_date)}(l)&&(bE(l)||function(u){var c;return!((c=u.conditions)==null||(c=c.actions)==null||(c=c.values)==null||!c.length)}(l)));return a.length>0&&((s=this._surveyEventReceiver)==null||s.register(a)),e.kv.set({[Qh]:o,[Zu]:Date.now()}),{surveys:o,context:{isLoaded:!0}}}Dl(){return this.jl()&&!this.El&&!this.Bl()}jl(){var e,n,r=(e=(n=this.ns)!==null&&n!==void 0?n:this.Al)==null?void 0:e.kv.get(Zu);return qe(r)&&Date.now()-r>3e5}Bl(){return qe(this.Il)&&3e5>Date.now()-this.Il}markSurveyAsSeen(e,n){var r,i={id:e,current_iteration:(r=n==null?void 0:n.iteration)!==null&&r!==void 0?r:null};SE(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}$l(e){for(var n of this.Ml)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(r){de.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!te(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);de.warn("init was not called")}Hl(e){var n=null;return this.getSurveys(r=>{var i;n=(i=r.find(s=>s.id===e))!==null&&i!==void 0?i:null}),n}Ul(e){if(te(this._surveyManager))return{eligible:!1,reason:ns};var n=typeof e=="string"?this.Hl(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}zl(e){if(te(this._surveyManager))return{eligible:!1,reason:ns};var n=typeof e=="string"?this.Hl(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(te(this._surveyManager))return de.warn("init was not called"),{visible:!1,disabledReason:ns};var n=this.zl(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return te(this._surveyManager)?(de.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ns})):new Promise(r=>{this.getSurveys(i=>{var s,o=(s=i.find(l=>l.id===e))!==null&&s!==void 0?s:null;if(o){var a=this.zl(o);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,r){var i;if(te(this._surveyManager))de.warn("init was not called");else{var s=typeof e=="string"?this.Hl(e):e;if(s!=null&&s.id)if($I.includes(s.type)){var o=j==null?void 0:j.querySelector(n);if(o)if((i=s.appearance)!=null&&i.surveyPopupDelaySeconds){de.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout(()=>{var l,u;this.Rl.delete(a),this.Xn||(de.info("Rendering survey "+s.id+" with delay of "+((l=s.appearance)==null?void 0:l.surveyPopupDelaySeconds)+" seconds"),(u=this._surveyManager)==null||u.renderSurvey(s,o,r),de.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.Rl.add(a)}else this._surveyManager.renderSurvey(s,o,r);else de.warn("Survey element not found")}else de.warn("Surveys of type "+s.type+" cannot be rendered in the app");else de.warn("Survey not found")}}displaySurvey(e,n){var r;if(te(this._surveyManager))de.warn("init was not called");else{var i=this.Hl(e);if(i){var s=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(s=N({},i,{appearance:N({},i.appearance,{surveyPopupDelaySeconds:0})})),n.displayType!==ap.Popover&&n.initialResponses&&de.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){var o=this.Ul(i);if(!o.eligible)return void de.warn("Survey is not eligible to be displayed: ",o.reason)}n.displayType!==ap.Inline?this._surveyManager.handlePopoverSurvey(s,n):this.renderSurvey(s,n.selector,n.properties)}else de.warn("Survey not found")}}cancelPendingSurvey(e){te(this._surveyManager)?de.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}function rs(t,e,n){if(te(t))return!1;switch(n){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class eO{constructor(e){this.Wl=new Set,this.Vl=new Set,this.Gl=new cc,this.Zl=(n,r)=>this.Ql(n,r)&&this.Jl(n,r)&&this.Kl(n,r)&&this.Yl(n,r),this.Ql=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=e}init(){var e,n;F((e=this._instance)==null?void 0:e._addCaptureHook)||(this.Xl=(n=this._instance)==null?void 0:n._addCaptureHook((r,i)=>{this.on(r,i)}))}dispose(){var e;(e=this.Xl)==null||e.call(this),this.Xl=void 0,this.Gl=new cc}register(e){var n,r;if(!F((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach(s=>{var o;this.Wl.add(s),(o=s.steps)==null||o.forEach(a=>{this.Vl.add((a==null?void 0:a.event)||"")})}),(r=this._instance)!=null&&r.autocapture)){var i=new Set;this.Wl.forEach(s=>{var o;(o=s.steps)==null||o.forEach(a=>{a!=null&&a.selector&&i.add(a.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this.Wl.clear(),this.Vl.clear(),this.register(e)}on(e,n){n!=null&&e.length!=0&&(this.Vl.has(e)||this.Vl.has(n.event))&&this.Wl.forEach(r=>{this.tu(n,r)&&this.Gl.emit("actionCaptured",r.name)})}eu(e){this.onAction("actionCaptured",n=>e(n))}tu(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Zl(e,r))return!0;return!1}onAction(e,n){return this.Gl.on(e,n)}Jl(e,n){if(n!=null&&n.url){var r,i=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!rs(i,n.url,n.url_matching||"contains"))return!1}return!0}Kl(e,n){return!!this.iu(e,n)&&!!this.ru(e,n)&&!!this.nu(e,n)}iu(e,n){var r;if(n==null||!n.href)return!0;var i=this.su(e);if(i.length>0)return i.some(a=>rs(a.href,n.href,n.href_matching||"exact"));var s,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&rs((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",n.href,n.href_matching||"exact")}ru(e,n){var r;if(n==null||!n.text)return!0;var i=this.su(e);if(i.length>0)return i.some(u=>rs(u.text,n.text,n.text_matching||"exact")||rs(u.$el_text,n.text,n.text_matching||"exact"));var s,o,a,l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(s=function(u){for(var c,d=[],f=/(?::|")text="(.*?)"/g;!te(c=f.exec(u));)d.includes(c[1])||d.push(c[1]);return d}(l),o=n.text,a=n.text_matching||"exact",s.some(u=>rs(u,o,a)))}nu(e,n){var r,i;if(n==null||!n.selector)return!0;var s=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(s!=null&&s.includes(n.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(n.selector_regex&&o)try{return new RegExp(n.selector_regex).test(o)}catch{return!1}return!1}su(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e==null?void 0:e.properties.$elements}Yl(e,n){return n==null||!n.properties||n.properties.length===0||xE(n.properties.reduce((r,i)=>{var s=X(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return r[i.key]={values:s,operator:i.operator||"exact"},r},{}),e==null?void 0:e.properties)}}class tO{constructor(e){var n;this.au=[],this._instance=e,this.ou=new Map,this.lu=new Map,this.uu=new Map,this.hu=(n=this._instance)==null||n.onSessionId==null?void 0:n.onSessionId(r=>this.du(r))}vu(e){return!1}cu(){return null}fu(e){}pu(){}gu(e,n){return!!e&&xE(e.propertyFilters,n==null?void 0:n.properties)}mu(e,n){var r=new Map;return e.forEach(i=>{var s;(s=i.conditions)==null||(s=s[n])==null||(s=s.values)==null||s.forEach(o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(i.id),r.set(o.name,a)}})}),r}yu(e,n,r){var i=(r===No.Activation?this.ou:this.lu).get(e),s=[];return this.bu(o=>{s=o.filter(a=>i==null?void 0:i.includes(a.id))}),s.filter(o=>{var a,l=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find(u=>u.name===e);return this.gu(l,n)})}register(e){this._u(e,!1)}replace(e){this._u(e,!0)}_u(e,n){var r;F((r=this._instance)==null?void 0:r._addCaptureHook)||(this.wu(e,n),this.ku(e,n))}ku(e,n){var r=e.filter(o=>{var a;return(a=o.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length});if(n&&this.uu.clear(),r.length!==0){this.Su||(this.Su=new eO(this._instance),this.Su.init(),this.Su.eu(o=>this.onAction(o)));var i=[];r.forEach(o=>{var a;(a=o.conditions)==null||(a=a.actions)==null||a.values.forEach(l=>{if(i.push(l),l.name){var u,c=(u=this.uu.get(l.name))!==null&&u!==void 0?u:[];c.includes(o.id)||c.push(o.id),this.uu.set(l.name,c)}})}),n?this.Su.replace(i):this.Su.register(i)}else{var s;n&&((s=this.Su)==null||s.replace([]))}}xu(e,n){n.forEach((r,i)=>{var s,o=(s=e.get(i))!==null&&s!==void 0?s:[];r.forEach(a=>{o.includes(a)||o.push(a)}),e.set(i,o)})}wu(e,n){var r,i,s=e.filter(u=>{var c,d;return((c=u.conditions)==null?void 0:c.events)&&((d=u.conditions)==null||(d=d.events)==null||(d=d.values)==null?void 0:d.length)>0}),o=e.filter(u=>{var c,d;return((c=u.conditions)==null?void 0:c.cancelEvents)&&((d=u.conditions)==null||(d=d.cancelEvents)==null||(d=d.values)==null?void 0:d.length)>0}),a=this.mu(e,No.Activation),l=this.mu(e,No.Cancellation);n?(this.ou=a,this.lu=l):(this.xu(this.ou,a),this.xu(this.lu,l)),(s.length!==0||o.length!==0)&&((r=this.Xl)!==null&&r!==void 0||(this.Xl=(i=this._instance)==null?void 0:i._addCaptureHook((u,c)=>{this.onEvent(u,c)})))}onEvent(e,n){var r,i,s=this.Cu(),o=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(i=n.properties)==null?void 0:i.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var a=this.Tu(e,o);if(a==="consume")return s.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.Mu([o]);if(a==="persist")return s.info("shown item promoted to persisted activation",{event:e,itemId:o}),this.Eu(o),void this.Iu([o])}if(this.lu.has(e)){var l=this.yu(e,n,No.Cancellation);l.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map(c=>c.id)}),this.Mu(l.map(c=>c.id)),l.forEach(c=>this.Ru(c.id)))}if(this.ou.has(e)){s.info("event name matched",{event:e,eventPayload:n,items:this.ou.get(e)});var u=this.yu(e,n,No.Activation);this.Pu(u.map(c=>c.id))}}onAction(e){this.uu.has(e)&&this.Pu(this.uu.get(e)||[])}Pu(e){var n;if(e.length!==0){var r=!((n=this._instance)==null||n.get_session_id==null||!n.get_session_id()),i=[];for(var s of e)r&&this.vu(s)?this.Eu(s)&&this.Au(s):i.push(s);i.length>0&&(this.au=[...new Set([...this.au,...i])]),this.Cu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Eu(e){this.au=this.au.filter(r=>r!==e);var n=this.Fu();return!n.includes(e)&&(this.Ou([...n,e]),this.Lu(),!0)}Mu(e){var n=new Set(e);this.au=this.au.filter(s=>!n.has(s));var r=this.$u(),i=r.filter(s=>!n.has(s));i.length!==r.length&&(this.Ou(i),i.length===0&&this.Du()),this.Iu(e)}Nu(){var e,n=this.cu();if(!n)return{};var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n];return r&&typeof r=="object"?r:{}}Au(e){if(this.cu()){var n=this.Nu();this.fu(N({},n,{[e]:Date.now()}))}}Iu(e){if(this.cu()){var n=this.Nu(),r={},i=!1;for(var s of Object.entries(n)){var o=s[0],a=s[1];e.includes(o)?i=!0:r[o]=a}i&&(yn(r)?this.pu():this.fu(r))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(e){if(this.Fu().includes(e)){var n=this.Nu()[e];return qe(n)?n:void 0}}$u(){var e,n=this.ju();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}Fu(){var e,n,r=this.$u();if(r.length===0)return[];var i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.Bu()],s=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return s&&i===s?r:[]}Lu(){var e,n=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();n&&this.Hu(n)}Du(){this.Uu()}du(e){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Bu()];if(r&&r!==e){var i=this.$u(),s=this.Nu();i.length>0&&(this.Ou([]),i.filter(o=>qe(s[o])).forEach(o=>this.Ru(o))),this.Du(),this.qu()}}getActivatedIds(){return[...new Set([...this.Fu(),...this.au])].filter(e=>!this.zu(e))}dispose(){var e,n,r;(e=this.hu)==null||e.call(this),this.hu=void 0,(n=this.Xl)==null||n.call(this),this.Xl=void 0,(r=this.Su)==null||r.dispose(),this.Su=void 0}reset(){this.au=[],this.$u().length>0&&this.Ou([]),this.Du(),this.qu()}getEventToItemsMap(){return this.ou}Wu(){return this.Su}}class nO extends tO{constructor(e){super(e)}ju(){return Yh}Bu(){return su}cu(){return ou}fu(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[ou]:e})}pu(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(ou)}vu(e){var n,r;this.bu(s=>{r=s.find(o=>o.id===e)});var i=(n=r)==null||(n=n.appearance)==null?void 0:n.surveyPopupDelaySeconds;return qe(i)&&i>0}Vu(){return rr.SHOWN}bu(e){var n;(n=this._instance)==null||n.getSurveys(e)}Ru(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}Cu(){return de}Ou(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Yh]:e})}Hu(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[su]:e})}Uu(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(su)}zu(){return!1}Tu(e,n){var r;this.bu(s=>{r=s.find(o=>o.id===n)});var i=!r||function(s){var o;return bE(s)&&!((o=s.conditions)==null||(o=o.events)==null||!o.repeatedActivation)||s.schedule==="always"}(r);return i?e===rr.SHOWN?"consume":"ignore":e===rr.SHOWN?"persist":e===rr.DISMISSED||e===rr.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class rO{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);var n={};for(var r of e){var i=this._instance.get_property(r);F(i)||(n[r]=i)}return n}set(e,n){this._instance.register(typeof e=="string"?{[e]:n}:e)}remove(e){typeof e!="string"?e.forEach(n=>this._instance.unregister(n)):this._instance.unregister(e)}}class iO{constructor(e){this._instance=e}get(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var e=Q==null?void 0:Q.__PosthogExtensions__;if(e){var n=e.generateSurveys,r=e.loadExternalDependency;return{generateSurveys:n?i=>n(this._instance,i):void 0,loadExternalDependency:r?i=>r(this._instance,"surveys",i):void 0}}}createEventReceiver(){return new nO(this._instance)}}var sO=T!=null&&T.location?ac(T.location.hash,"__posthog")||ac(location.hash,"state"):null,i_="_postHogToolbarParams",s_=Pe("[Toolbar]"),o_=Pe("[FeatureFlags]");class oO{constructor(e,n){n===void 0&&(n=!1),this.Gu=!1,this.update(e,n)}update(e,n){this.Zu=((r,i)=>{var s,o,a,l;return{bootstrap:{featureFlags:(s=r.bootstrap)==null?void 0:s.featureFlags,featureFlagPayloads:(o=r.bootstrap)==null?void 0:o.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!r.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!r.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!r.advanced_feature_flags_dedup_per_session,cacheTtlMs:r.feature_flag_cache_ttl_ms,requestTimeoutMs:r.feature_flag_request_timeout_ms,compression:r.disable_compression?"none":"base64",evaluationContexts:(a=(l=r.evaluation_contexts)!==null&&l!==void 0?l:r.evaluation_environments)!==null&&a!==void 0?a:[],flagKeys:X(r.flag_keys)?r.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.Gu||(o_.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),F(e.flag_keys)||X(e.flag_keys)||o_.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var a_=Pe("[FeatureFlags]"),ci=Pe("[FeatureFlags]",{debugEnabled:!0}),gf=`" failed. Feature flags didn't load in time.`,l_="connection_error",u_=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},c_=t=>{var e={};for(var n of au(t||{})){var r=n[1];r&&(e[n[0]]=r)}return e},cn=Pe("[Error tracking]"),aO=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],lO=["__firefox__","__gCrWeb"],d_="Refusing to render web experiment since the viewer is a likely bot",uO={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>dc(e,t),not_regex:(t,e)=>!dc(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class ct{get qi(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{ct.Qu("retrieved web experiments from the server"),n.Ju=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n.Ju&&(ct.Qu("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=n.Ju)==null||o.set(s.feature_flag_key,s));var a=n._instance.getFeatureFlag(s.feature_flag_key);ue(a)&&s.variants[a]&&n.Ku(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var u=s.variants[l];ct.Yu(u,n._instance)&&n.Ku(s.name,l,u.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(e){if(this._is_bot())ct.Qu(d_);else if(!this.qi.disable_web_experiments){if(te(this.Ju))return this.Ju=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ct.Qu("applying feature flags",e),e.forEach(n=>{var r;if(this.Ju&&(r=this.Ju)!=null&&r.has(n)){var i,s=this._instance.getFeatureFlag(n),o=(i=this.Ju)==null?void 0:i.get(n);s&&o!=null&&o.variants[s]&&this.Ku(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=ct.getWindowLocation();if(e!=null&&e.search){var n=oo(e==null?void 0:e.search,"__experiment_id"),r=oo(e==null?void 0:e.search,"__experiment_variant");n&&r&&(ct.Qu("previewing web experiments "+n+" && "+r),this.getWebExperiments(i=>{this.Xu(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this.qi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this.qi.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!n)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qi.token),method:"GET",timestampMode:"query",callback:s=>e(s.statusCode===200&&s.json&&s.json.experiments||[])})}Xu(e,n,r){var i=r.filter(s=>s.id===e);i&&i.length>0&&(ct.Qu("Previewing web experiment ["+i[0].name+"] with variant ["+n+"]"),this.Ku(i[0].name,n,i[0].variants[n].transforms))}static Yu(e,n){return!te(e.conditions)&&ct.th(e,n)&&ct.eh(e)}static th(e,n){var r;if(te(e.conditions)||te((r=e.conditions)==null?void 0:r.url))return!0;var i=ct.getWindowLocation();if(i){var s,o,a,l=Lb(n,i.href);return(s=e.conditions)==null||!s.url||uO[(o=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](e.conditions.url,l)}return!1}static getWindowLocation(){return T==null?void 0:T.location}static eh(e){var n;if(te(e.conditions)||te((n=e.conditions)==null?void 0:n.utm))return!0;var r=Zb();if(r.utm_source){var i,s,o,a,l,u,c,d,f=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,_=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,m=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,p=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==r.utm_term;return f&&m&&p&&_}return!1}static Qu(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;n>i;i++)r[i-1]=arguments[i];D.info("[WebExperiments] "+e,r)}Ku(e,n,r){this._is_bot()?ct.Qu(d_):n!=="control"?r.forEach(i=>{if(i.selector){var s;ct.Qu("applying transform of variant "+n+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o==null||o.forEach(a=>{var l=a;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)})}}):ct.Qu("Control variants leave the page unmodified.")}_is_bot(){return xt&&this._instance?yE(xt,this.qi.custom_blocked_useragents):void 0}}var Qt=Pe("[Conversations]"),di="Conversations not available yet.",f_="console",TE="__posthogHandledLogsRequestError",mf=(t,e)=>{var n=t instanceof Error?t:new Error(e);return n[TE]=!0,n},h_=t=>!!t&&typeof t=="object"&&t[TE]===!0,Hc={featureFlags:class{constructor(t){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=a_,this.rh={},this.nh={},this.sh=[],this.ah=!1,this.oh=!1,this.lh=0,this.uh=!1,this.hh=!1,this.dh=!1,this.fh=!1,this.ph=0,this.Tt=()=>{var e=this.gh();this.ph=0,e&&this.reloadFeatureFlags()},"get"in t?this.ts=t:(this.mh=new oO(t.config,t.ma()),this.ts=this.mh)}updateConfig(t,e){var n;(n=this.mh)==null||n.update(t,e)}setup(t){return this.Fl=t,this.I=t.logger.createLogger("[FeatureFlags]"),RE(t.kv.initialize(),()=>{this.Fl===t&&(this.Fl=void 0,this.ns=t,this.yh(t))})}yh(t){if(this.ns===t)return T&&Ce(T,"online",this.Tt),this.bh=t.registerDynamicEventProperties(()=>this._h()?this.rh:this.nh),this.wh(),this.initialize()}destroy(){T==null||T.removeEventListener("online",this.Tt)}dispose(){var t;this.lh++,this.hh=!1,this.Fl=void 0,this.ns&&(this.kh(),(t=this.bh)==null||t.dispose(),this.bh=void 0,this.sh=[],T==null||T.removeEventListener("online",this.Tt),this.ns=void 0)}get qi(){return this.ts.get()}Sh(t){var e;return(e=this.ns)==null?void 0:e.kv.get(t)}Nr(t){this.xh(()=>{var e;return(e=this.ns)==null?void 0:e.kv.set(t)})}qr(t){this.xh(()=>{var e;return(e=this.ns)==null?void 0:e.kv.remove(t)})}xh(t){try{t()}catch(e){this.I.error("Failed to update feature flag persistence",e)}}wh(){var t={};for(var e of[Ei,Si,Ns,Pn]){var n=this.Sh(e);F(n)||(t[e]=n)}this.rh=t;var r=N({},t),i=this.Sh(Zn);if(i)for(var s of Object.entries(i))r["$feature/"+s[0]]=s[1];this.nh=r}_h(){var t=this.qi.cacheTtlMs;if(!t||0>=t)return!1;var e=this.Sh(Ni);return typeof e!="number"||Date.now()-e>t}Ch(){return!!this._h()&&(this.fh||this.oh||(this.fh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Th(){var t=this.qi.evaluationContexts;return t!=null&&t.length?t.filter(e=>{var n=e&&typeof e=="string"&&e.trim().length>0;return n||this.I.error("Invalid evaluation context found:",e,"Expected non-empty string"),n}):[]}Mh(){var t=this.qi.flagKeys;if(!F(t))return t.filter(e=>{var n=e&&typeof e=="string"&&e.trim().length>0;return n||this.I.error("Invalid flag key found:",e,"Expected non-empty string"),n})}initialize(){var t,e,n=this.qi,r=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(r).length){var i,s,o=(i=(s=n.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(r).filter(u=>!!r[u]).reduce((u,c)=>(u[c]=r[c]||!1,u),{}),l=Object.keys(o).filter(u=>a[u]).reduce((u,c)=>(u[c]=o[c],u),{});return this.Eh({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,n){var r,i,s=n!=null&&n.merge&&(r=this.Sh(Zn))!==null&&r!==void 0?r:{},o=n!=null&&n.merge&&(i=this.Sh(Si))!==null&&i!==void 0?i:{},a=N({},s,t),l=N({},o,e),u={};for(var c of Object.entries(a)){var d=c[0],f=c[1];u[d]={key:d,enabled:ty(f),variant:ny(f),reason:void 0,metadata:F(l==null?void 0:l[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}}}this.Eh({flags:u})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Sh(Aa),e=this.Sh(Pn),n=this.Sh(gi);if(!n&&!e)return t||{};var r=ge({},t||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var s of i){var o,a,l=r[s],u=e==null?void 0:e[s],c=F(u)?(o=l==null?void 0:l.enabled)!==null&&o!==void 0&&o:!!u,d=F(u)?l==null?void 0:l.variant:typeof u=="string"?u:void 0,f=n==null?void 0:n[s],_=N({},l,{enabled:c,variant:c?d??(l==null?void 0:l.variant):void 0});c!==(l==null?void 0:l.enabled)&&(_.original_enabled=l==null?void 0:l.enabled),d!==(l==null?void 0:l.variant)&&(_.original_variant=l==null?void 0:l.variant),f&&(_.metadata=N({},l==null?void 0:l.metadata,{payload:f,original_payload:l==null||(a=l.metadata)==null?void 0:a.payload})),r[s]=_}return this.ih||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:r}),this.ih=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(n=>{var r=t[n];return{key:n,enabled:ty(r),variant:ny(r),payload:ey(e[n])}})}getFlagVariants(){var t=this.Sh(Zn),e=this.Sh(Pn);if(!e)return t||{};for(var n=ge({},t||{}),r=Object.keys(e),i=0;r.length>i;i++)n[r[i]]=e[r[i]];return this.ih||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.ih=!0),n}getFlagPayloads(){var t=this.Sh(Si),e=this.Sh(gi);if(!e)return t||{};for(var n=ge({},t||{}),r=Object.keys(e),i=0;r.length>i;i++)n[r[i]]=e[r[i]];return this.ih||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.ih=!0),n}reloadFeatureFlags(){this.uh||this.qi.featureFlagsDisabled||this.gh()||this.Ih||(this.sh.slice().forEach(t=>{try{t()}catch(e){this.I.error("Error while running feature flags reloading callback",e)}}),this.Ih=setTimeout(()=>{this.Rh()},5))}kh(){clearTimeout(this.Ih),this.Ih=void 0}onReloading(t){return this.sh.push(t),()=>{this.sh=this.sh.filter(e=>e!==t)}}ensureFlagsLoaded(){this.ah||this.oh||this.Ih||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.uh=t}resetFlagCallReported(){this.qr(tr)}Rh(t){this.kh();var e=this.ns;if(e&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!0;else{var n={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:N({},e.initialPersonProperties,this.Sh(fn)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Sh(Nn),timezone:sE()};F(e.deviceId)||(n.$device_id=e.deviceId),(t!=null&&t.disableFlags||this.qi.featureFlagsDisabled)&&(n.disable_flags=!0);var r=this.Th();r.length&&(n.evaluation_contexts=r);var i=this.Mh();F(i)||(n.flag_keys=i);var s=this.qi.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(s?"&only_evaluate_survey_feature_flags=true":""),a=this.lh;this.oh=!0;var l=()=>{this.hh&&(this.hh=!1,this.Rh())},u=c=>{this.oh=!1,a===this.lh&&(this.Nr({[$s]:[l_]}),this.I.error("Feature flag request failed",c)),l()};try{e.sendRequest(o,{target:"flags",method:"POST",body:n,compression:this.qi.compression==="base64"?_t.Base64:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then(c=>{var d,f,_=(d=c.json)!==null&&d!==void 0?d:{},m=c.statusCode!==200;if(this.oh=!1,a===this.lh){if(this.Ph(c.statusCode),m||this.hh||(this.$anon_distinct_id=void 0),!n.disable_flags||this.hh){this.dh=!m;var p=[];c.error?p.push(c.error instanceof Error&&c.error.name==="AbortError"?"timeout":c.error instanceof Error?l_:"unknown_error"):c.statusCode!==200&&p.push("api_error_"+c.statusCode),_.errorsWhileComputingFlags&&p.push("errors_while_computing_flags");var y=!((f=_.quotaLimited)==null||!f.includes("feature_flags"));y&&p.push("quota_limited"),this.Nr({[$s]:p}),y?this.I.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.Eh(_,m,{partialResponse:s}),l()}}else l()}).catch(u)}catch(c){u(c)}}}gh(){return Xb(this.ph,3)}Ph(t){this.ph=Jb(t,this.ph,3,()=>this.I.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e){var n;if(e===void 0&&(e={}),!e.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var r=this.getFeatureFlagResult(t,e);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else this.I.warn('getFeatureFlag for key "'+t+gf)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var n,r=this.getFlagVariants(),i=t in r,s=r[t],o=this.getFlagPayloads()[t],a=String(s),l=this.Sh(Ns)||void 0,u=this.Sh(Ni)||void 0,c=this.Sh(tr)||{};if(this.qi.deduplicateCallsPerSession){var d,f=(d=this.ns)==null?void 0:d.session.sessionId,_=this.Sh(Qo);f&&f!==_&&(c={},n=f)}if(e.send_event||!("send_event"in e))if(t in c&&c[t].includes(a))n&&this.Nr({[tr]:c,[Qo]:n});else{var m,p,y,h,v,x,b,E,S,k,C,R;X(c[t])?c[t].push(a):c[t]=[a],this.Nr(N({[tr]:c},n?{[Qo]:n}:{}));var P=this.getFeatureFlagDetails(t),$=[...(m=this.Sh($s))!==null&&m!==void 0?m:[]];F(s)&&$.push("flag_missing");var O={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:o??null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:(p=(y=this.qi.bootstrap)==null||(y=y.featureFlags)==null?void 0:y[t])!==null&&p!==void 0?p:null,$feature_flag_bootstrapped_payload:(h=(v=this.qi.bootstrap)==null||(v=v.featureFlagPayloads)==null?void 0:v[t])!==null&&h!==void 0?h:null,$used_bootstrap_value:!this.dh};F(P==null||(x=P.metadata)==null?void 0:x.has_experiment)||(O.$feature_flag_has_experiment=P.metadata.has_experiment),F(P==null||(b=P.metadata)==null?void 0:b.version)||(O.$feature_flag_version=P.metadata.version);var U,L=(E=P==null||(S=P.reason)==null?void 0:S.description)!==null&&E!==void 0?E:P==null||(k=P.reason)==null?void 0:k.code;L&&(O.$feature_flag_reason=L),P!=null&&(C=P.metadata)!=null&&C.id&&(O.$feature_flag_id=P.metadata.id),F(P==null?void 0:P.original_variant)&&F(P==null?void 0:P.original_enabled)||(O.$feature_flag_original_response=F(P.original_variant)?P.original_enabled:P.original_variant),P!=null&&(R=P.metadata)!=null&&R.original_payload&&(O.$feature_flag_original_payload=P==null||(U=P.metadata)==null?void 0:U.original_payload),$.length&&(O.$feature_flag_error=$.join(",")),this.Ah(O)}else n&&this.Nr({[tr]:c,[Qo]:n});if(i)return{key:t,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:ey(o)}}}else this.I.warn('getFeatureFlagResult for key "'+t+gf)}Ah(t){try{var e;(e=this.ns)==null||e.capture("$feature_flag_called",t).catch(n=>{this.I.error("Failed to capture feature flag call",n)})}catch(n){this.I.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(t,e){this.Fh(t,e)}Fh(t,e){var n=this;return be(function*(){var r=n.ns;if(r){var i={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},s=n.Th();s.length&&(i.evaluation_contexts=s);var o,a=n.Mh();F(a)||(i.flag_keys=a);try{var l,u=(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:i,compression:n.qi.compression==="base64"?_t.Base64:void 0,sentAt:"body",timeoutMs:n.qi.requestTimeoutMs})).json)==null?void 0:l.featureFlagPayloads;o=(u==null?void 0:u[t])||void 0}catch(c){return void n.I.error("Remote config feature flag request failed",c)}try{e(o)}catch(c){n.I.error("Remote config feature flag callback failed",c)}}})()}isFeatureEnabled(t,e){if(e===void 0&&(e={}),e.fresh&&!this.dh)return e.defaultValue;if(!(this.ah||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+gf),e.defaultValue;var n=this.getFeatureFlag(t,e);return F(n)?e.defaultValue:!!n}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,n){this.Eh(t,e,n)}Eh(t,e,n){if(this.ns){this.ah=!0;var r=function(i,s,o,a,l,u){s===void 0&&(s={}),o===void 0&&(o={}),a===void 0&&(a={}),u===void 0&&(u=a_);var c=((S,k)=>{var C=S.flags;return C?N({},S,{featureFlags:Object.fromEntries(Object.keys(C).map(R=>{var P;return[R,(P=C[R].variant)!==null&&P!==void 0?P:C[R].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(C).filter(R=>C[R].enabled).filter(R=>{var P;return(P=C[R].metadata)==null?void 0:P.payload}).map(R=>{var P;return[R,(P=C[R].metadata)==null?void 0:P.payload]}))}):(S.featureFlags&&k.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),S)})(i,u),d=c.flags,f=c.featureFlags,_=c.featureFlagPayloads;if(f){var m=i.requestId,p=i.evaluatedAt;if(X(f)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(f)for(var h=0;f.length>h;h++)y[f[h]]=!0;return{[Ei]:f,[Zn]:y,[Ju]:!1}}var v=f,x=_,b=d;if(l!=null&&l.partialResponse)v=N({},s,v),x=N({},o,x),b=N({},a,b);else if(i.errorsWhileComputingFlags)if(d){var E=new Set(Object.keys(d).filter(S=>{var k;return!((k=d[S])!=null&&k.failed)}));v=N({},s,Object.fromEntries(Object.entries(v).filter(S=>E.has(S[0])))),x=N({},o,Object.fromEntries(Object.entries(x||{}).filter(S=>E.has(S[0])))),b=N({},a,Object.fromEntries(Object.entries(b||{}).filter(S=>E.has(S[0]))))}else v=N({},s,v),x=N({},o,x),b=N({},a,b);return N({[Ei]:Object.keys(c_(v)),[Zn]:v||{},[Si]:x||{},[Aa]:b||{},[Ju]:i.minimalFlagCalledEvents===!0},m?{[Ns]:m}:{},p?{[Ni]:p}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.I);r&&this.Nr(r),e||(this.fh=!1),this.Oh(e)}}override(t,e){e===void 0&&(e=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Lh(t)}Lh(t){if(this.ns){if(t===!1)return this.qr([Pn,gi]),this.Oh(),void ci.info("All overrides cleared");if(X(t))return this.Nr({[Pn]:u_(t)}),this.Oh(),void ci.info("Flag overrides set",{flags:t});if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var e,n=t;this.ih=!!((e=n.suppressWarning)!==null&&e!==void 0&&e);var r={},i=n.flags,s=n.payloads;return i&&(r[Pn]=X(i)?u_(i):i),s&&(r[gi]=s),Object.keys(r).length&&this.Nr(r),i===!1&&s===!1?this.qr([Pn,gi]):i===!1?this.qr(Pn):s===!1&&this.qr(gi),this.Oh(),i===!1?ci.info("Flag overrides cleared"):i&&ci.info("Flag overrides set",{flags:i}),void(s===!1?ci.info("Payload overrides cleared"):s&&ci.info("Payload overrides set",{payloads:s}))}if(t&&typeof t=="object")return this.Nr({[Pn]:t}),this.Oh(),void ci.info("Flag overrides set",{flags:t});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ah){var e=this.$h(),n=e.flags,r=e.flagVariants;try{t(n,r)}catch(i){this.I.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var r=(this.Sh(iu)||[]).find(l=>l.flagKey===t),i={["$feature_enrollment/"+t]:e},s={$feature_flag:t,$feature_enrollment:e,$set:i};r&&(s.$early_access_feature_name=r.name),n&&(s.$feature_enrollment_stage=n);var o=N({},this.getFlagVariants(),{[t]:e});this.Nr({[Ei]:Object.keys(c_(o)),[Zn]:o,[fn]:N({},this.Sh(fn)||{},i)}),this.Oh();try{var a;(a=this.ns)==null||a.capture("$feature_enrollment_update",s).catch(l=>{this.I.error("Failed to capture early access feature enrollment",l)})}catch(l){this.I.error("Failed to capture early access feature enrollment",l)}}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var r=this.Sh(iu);!r||e?this.Dh(t,n):t(r)}Dh(t,e){var n=this;return be(function*(){var r=n.ns;if(r){var i,s=e?"&"+e.map(a=>"stage="+a).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+s,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;n.Nr({[iu]:i=o.json.earlyAccessFeatures})}catch(a){return void n.I.error("Early access feature request failed",a)}try{t(i)}catch(a){n.I.error("Early access feature callback failed",a)}}})()}$h(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(n=>e[n]),flagVariants:Object.keys(e).filter(n=>e[n]).reduce((n,r)=>(n[r]=e[r],n),{})}}Oh(t){this.wh();var e=this.$h(),n=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach(i=>{try{i(n,r,{errorsLoading:t})}catch(s){this.I.error("Error while running feature flags callback",s)}})}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0),this.Nh(t,e)}Nh(t,e){e===void 0&&(e=!0);var n=this.Sh(fn)||{},r=(t==null?void 0:t.$set)||(t!=null&&t.$set_once?{}:t),i=t==null?void 0:t.$set_once,s={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in n||(s[o]=i[o]));this.Nr({[fn]:N({},n,s,r)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=N({},this.Sh(fn)||{});t.forEach(r=>{delete n[r]}),this.Nr({[fn]:n}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){t===void 0&&(t=!0),this.qr(fn),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.Sh(Nn)||{},r=N({},n);for(var i of Object.keys(t))r[i]=N({},n[i],t[i]);this.Nr({[Nn]:r}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.Sh(Nn)||{};this.Nr({[Nn]:N({},e,{[t]:{}})})}else this.qr(Nn)}reset(){this.lh++,this.hh=!1,this.rh={},this.nh={},this.ah=!1,this.uh=!1,this.dh=!1,this.$anon_distinct_id=void 0,this.kh(),this.ih=!1,this.ph=0}}},cO={sessionRecording:class{get qi(){return this._instance.config}get za(){return this._instance.persistence}get started(){var t;return!((t=this.qh)==null||!t.isStarted)}get status(){var t,e;return this.jh===Do||this.jh===$l?this.jh:(t=(e=this.qh)==null?void 0:e.status)!==null&&t!==void 0?t:this.jh}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=e_,this.Bh=void 0,this.Hh=!1,this.kt=(()=>{var e;if(j==null||!j.visibilityState||j.visibilityState==="visible")return!0;var n=T==null||(e=T.performance)==null||e.getEntriesByType==null?void 0:e.getEntriesByType("visibility-state");return!(n!=null&&n.length)||n.some(r=>r.name==="visible")})(),this.It=()=>{var e;(j==null?void 0:j.visibilityState)==="visible"&&(this.kt=!0,(e=this.qh)==null||e.setDocumentWasEverVisible==null||e.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Hn.error("started without valid sessionManager"),new Error(pp+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===nr)throw new Error(pp+' cannot be used with cookieless_mode="always"');j!=null&&j.addEventListener&&Ce(j,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,j==null||j.removeEventListener==null||j.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var t,e=!((t=this._instance.get_property(bi))==null||!t.enabled),n=!this.qi.disable_session_recording,r=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return T&&e&&n&&!r}startIfEnabledOrStop(t){var e;if(!(this.Hh||this.Uh&&(e=this.qh)!=null&&e.isStarted)){var n=!F(Object.assign)&&!F(Array.from);this.Uh&&n?(this.zh(t),Hn.info("starting")):(this.jh=e_,this.stopRecording())}}zh(t){var e,n,r;this.Uh&&(this.jh!==Do&&this.jh!==$l&&(this.jh=t_),Q!=null&&(e=Q.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=Q.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Wh(t):(r=Q.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Vh,i=>{if(i)return this._instance.register_for_session({[tp]:!0}),Hn.error("could not load recorder",i);this.Wh(t)}))}stopRecording(){var t,e;(t=this.Bh)==null||t.call(this),this.Bh=void 0,(e=this.qh)==null||e.stop()}Gh(){var t,e;(t=this.Bh)==null||t.call(this),this.Bh=void 0,(e=this.qh)==null||e.discard()}Zh(){var t,e;(t=this.za)==null||t.unregister(Hv),(e=this.za)==null||e.unregister(Cb)}Qh(t,e){if(te(t))return null;var n,r=qe(t)?t:parseFloat(t);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Hn.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Jh(t){if(this.za){var e,n,r=this.za,i=()=>{var s,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.Qh((s=this.qi.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),l=this.Qh(o==null?void 0:o.sampleRate,"remote config sampleRate"),u=a??l;te(u)&&this.Zh();var c=o==null?void 0:o.minimumDurationMilliseconds;r.register({[bi]:N({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:N({capturePerformance:t.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:u,minimumDurationMilliseconds:F(c)?null:c,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers,version:o==null?void 0:o.version,triggerGroups:o==null?void 0:o.triggerGroups})})};i(),(e=this.Bh)==null||e.call(this),this.Bh=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(i)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.Jh(e),void this.Gh()):(this.Jh(e),void this.startIfEnabledOrStop()):(this.jh===Do&&(this.jh=$l,Hn.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var n;e===void 0&&(e="log"),(n=this.qh)!=null&&n.log?this.qh.log(t,e):Hn.warn("log called before recorder was ready")}get Vh(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(bi);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Kh(){var t,e=this._instance.get_property(bi);if(!e)return!1;try{t=typeof e=="object"?e:JSON.parse(e)}catch(n){return Hn.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!te(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Wh(t){var e,n,r;if(!this.Hh){if((e=Q.__PosthogExtensions__)==null||!e.initSessionRecording)return Hn.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[tp]:!0});var i;if(this.qh||(this.qh=(i=Q.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh())return this.jh===$l||this.jh===Do?void 0:(this.jh=Do,Hn.info("persisted remote config is stale, requesting fresh config before starting"),void new oE(this._instance).load());this.jh=t_,(n=(r=this.qh).setDocumentWasEverVisible)==null||n.call(r,this.kt),this.qh.start(t)}}onRRwebEmit(t){var e;(e=this.qh)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.qh||(e=this.za)==null||e.register({[Pb]:!0}),(t=this.qh)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.qh||(e=this.za)==null||e.register({[kb]:!0}),(t=this.qh)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.qh||(n=this.za)==null||n.register({[t==="url"?Rb:Tb]:!0}),(e=this.qh)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.qh)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.qh)==null||!n.tryAddCustomEvent(t,e))}}},dO={autocapture:class extends KI{constructor(t){super(new QI(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Yh=this.Xh()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.td();return!!(t.path||t.search||this.ed(t))}startIfEnabled(){this.isEnabled&&(D.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Yh=this.Xh(),this.startIfEnabled()}stop(){this.rd&&this.rd(),this.rd=void 0,this.nd&&this.nd(),this.nd=void 0,D.info("History API monitoring stopped")}monitorHistoryChanges(){T&&T.history&&(this.sd("pushState"),this.sd("replaceState"),this.ad(),this.ed()&&this.od())}sd(t){var e;if(T&&((e=T.history[t])==null||!e.__posthog_wrapped__)){var n=this;(function(r,i,s){try{if(!(i in r))return Jy;var o={next:r[i]},a=s(function(){for(var l=arguments.length,u=new Array(l),c=0;l>c;c++)u[c]=arguments[c];return o.next.apply(this,u)});return ft(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),r[i]=a,()=>{if(r[i]!==a)for(var l=r[i];ft(l)&&l.__posthog_layer__;){var u=l.__posthog_layer__;if(u.next===a)return void(u.next=o.next);l=u.next}else r[i]=o.next}}catch{return Jy}})(T.history,t,r=>function(i,s,o){r.call(this,i,s,o),n.ld(t)})}}Xh(){var t=T==null?void 0:T.location;if(t!=null&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}td(){var t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:xe(t)?t:{}}ed(t){return t===void 0&&(t=this.td()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}ud(t){var e=this.td(),n=this.Yh;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.ed(e)&&t.hash!==n.hash))}ld(t){try{var e=this.Xh();if(!e)return;this.ud(e)&&this._instance.capture(ls,{navigation_type:t}),this.Yh=e}catch(n){D.error("Error capturing "+t+" pageview",n)}}ad(){if(!this.rd){var t=()=>{this.ld("popstate")};Ce(T,"popstate",t),this.rd=()=>{T&&T.removeEventListener("popstate",t)}}}od(){if(!this.nd){var t=()=>{this.ld("hashchange")};Ce(T,"hashchange",t),this.nd=()=>{T&&T.removeEventListener("hashchange",t)}}}},heatmaps:class{get qi(){return this.instance.config}constructor(t){var e;this.hd=!1,this.Qn=!1,this.dd=null,this.instance=t,this.hd=!((e=this.instance.persistence)==null||!e.props[Bh]),this.rageclicks=new PE(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return xe(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(t=this.qi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return te(this.qi.capture_heatmaps)?te(this.qi.enable_heatmaps)?this.hd:this.qi.enable_heatmaps:this.qi.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Qn)return;XI.info("starting..."),this.vd(),this.It()}else{var t;clearInterval((t=this.dd)!==null&&t!==void 0?t:void 0),this.fd(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Bh]:n}),this.hd=n,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.ft;return this.ft=void 0,t}pd(t){pf(t.originalEvent)&&this.ki(t.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd=(j==null?void 0:j.visibilityState)==="visible"?setInterval(this.Oa.bind(this),this.flushIntervalMilliseconds):null}vd(){T&&j&&(this.gd=this.Oa.bind(this),Ce(T,rc,this.gd),this.md=t=>this.ki(t||(T==null?void 0:T.event)),Ce(j,"click",this.md,{capture:!0}),this.yd=t=>this.bd(t||(T==null?void 0:T.event)),Ce(j,"mousemove",this.yd,{capture:!0}),this._d=new Ay(this.instance,aI,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),Ce(j,nc,this.wd),this.Qn=!0)}fd(){var t;T&&j&&(this.gd&&T.removeEventListener(rc,this.gd),this.md&&j.removeEventListener("click",this.md,{capture:!0}),this.yd&&j.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&j.removeEventListener(nc,this.wd),clearTimeout(this.kd),(t=this._d)==null||t.stop(),this.Qn=!1)}Sd(t,e){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),s=function(o,a,l){for(var u=o;u&&ei(u)&&!Vt(u,"body");){if(u===l)return!1;var c=void 0;try{var d,f,_;c=(d=(f=(_=u.ownerDocument)==null?void 0:_.defaultView)!==null&&f!==void 0?f:T)==null?void 0:d.getComputedStyle(u).position}catch{return!1}if(Y(a,c))return!0;u=Bb(u)}return!1}(ip(t),["fixed","sticky"],i);return{x:t.clientX+(s?0:r),y:t.clientY+(s?0:n),target_fixed:s,type:e}}ki(t,e){var n;if(e===void 0&&(e="click"),!Ey(t.target)&&pf(t)){var r=this.Sd(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Hb(ip(t),this.instance.config.rageclick)&&this.Nn(N({},r,{type:"rageclick"})),this.Nn(r)}}bd(t){!Ey(t.target)&&pf(t)&&(clearTimeout(this.kd),this.kd=setTimeout(()=>{this.Nn(this.Sd(t,"mousemove"))},500))}Nn(t){if(T){var e=this.qi.disable_capture_url_hashes?Zr(T.location.href):T.location.href,n=this.qi.custom_personal_data_properties,r=this.qi.mask_personal_data_properties?[...ao,...n||[]]:[],i=$a(e,r,Fa);this.ft=this.ft||{},this.ft[i]||(this.ft[i]=[]),this.ft[i].push(t)}}Oa(){this.ft&&!yn(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ay,webVitalsAutocapture:class{constructor(t){var e;this.hd=!1,this.Qn=!1,this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.xd=()=>{clearTimeout(this.Cd),this.Cd=void 0,this.ft.metrics.length!==0&&(this._instance.capture("$web_vitals",N({$current_url:this.ft.url},this.ft.metrics.reduce((n,r)=>N({},n,{["$web_vitals_"+r.name+"_event"]:N({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Td=n=>{var r;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},te(n==null?void 0:n.name)||te(n==null?void 0:n.value))ui.error("Invalid metric received",n);else{var i=typeof n.navigationURL=="string"?n.navigationURL:void 0,s=this.Md(i);if(!F(s)){var o=qe(n.navigationId)||typeof n.navigationId=="string"?"navigation:"+n.navigationId:"url:"+s;if(!this.Ed||this.Ed>n.value){this.ft.navigationKey!==o&&(this.xd(),this.Cd=setTimeout(this.xd,this.flushToCaptureTimeoutMs)),F(this.ft.navigationKey)&&(this.ft.navigationKey=o,this.ft.url=s),this.ft.firstMetricTimestamp=F(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var a=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),l=N({},n,i?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});F(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.ft.metrics.push(l),this.ft.metrics.length===this.allowedMetrics.length&&this.xd()}else ui.error("Ignoring metric with value >= "+this.Ed,n)}}},this.Id=()=>{if(!this.Qn){var n,r,i,s,o=Q.__PosthogExtensions__,a=o==null?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(a==null?void 0:a[this.Rd])||(this.Rd==="web-vitals"&&F(a)?o==null?void 0:o.postHogWebVitalsCallbacks:void 0);if(F(l)||(n=l.onLCP,r=l.onCLS,i=l.onFCP,s=l.onINP),n&&r&&i&&s){var u={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf("LCP")>-1&&n(this.Td.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Td.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Td.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&s(this.Td.bind(this),u),this.Qn=!0}else ui.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.hd=!((e=this._instance.persistence)==null||!e.props[Gh]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=xe(this.Pd)?(t=this.Pd)==null?void 0:t.web_vitals_allowed_metrics:void 0;return te(n)?((e=this._instance.persistence)==null?void 0:e.props[Kh])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(xe(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=xe(this.Pd)?this.Pd.web_vitals_attribution:void 0;return t!=null&&t}get useSoftNavs(){var t=xe(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get Ed(){var t=xe(this.Pd)&&qe(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:Zy;return t>0&&6e4>=t?Zy:t}get isEnabled(){var t=Ie==null?void 0:Ie.protocol;if(t!=="http:"&&t!=="https:")return ui.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=xe(this.Pd)?this.Pd.web_vitals:It(this.Pd)?this.Pd:void 0;return It(e)?e:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(ui.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var n=xe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=xe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Gh]:n}),this._instance.persistence.register({[Kh]:r})),this.hd=n,this.startIfEnabled()}}}get Rd(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_s(t){var e=Q.__PosthogExtensions__,n=this.Rd,r=e==null?void 0:e.postHogWebVitalsCallbacksByFlavor;r!=null&&r[n]||n==="web-vitals"&&F(r)&&e!=null&&e.postHogWebVitalsCallbacks?t():e==null||e.loadExternalDependency==null||e.loadExternalDependency(this._instance,n,i=>{i?ui.error("failed to load script",i):t()})}Md(t){var e=t||(T==null?void 0:T.location.href);if(e){var n=this._instance.config.disable_capture_url_hashes?Zr(e):e,r=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...ao,...r||[]]:[];return $a(n,i,Fa)}ui.error("Could not determine current URL")}}},fO={exceptionObserver:class{constructor(t){var e;this.Id=()=>{var n;if(T&&this.isEnabled&&(n=Q.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=Q.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Q.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=Q.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=r(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=i(this.captureException.bind(this))),!this.Od&&this.qi.capture_console_errors&&(this.Od=s(this.captureException.bind(this)))}catch(o){jo.error("failed to start",o),this.Ld()}}},this._instance=t,this.$d=!((e=this._instance.persistence)==null||!e.props[qh]),this.oe=new eT(N({},function(n){var r,i,s,o;return n===void 0&&(n={}),{refillRate:(r=(i=n.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(s=(o=n.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:n.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10}}(this._instance.config.error_tracking),{refillInterval:1e4,I:jo})),this.qi=this.Dd(),this.startIfEnabledOrStop()}Dd(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return xe(t)?e=N({},e,t):(F(t)?this.$d:t)&&(e=N({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.qi.capture_console_errors||this.qi.capture_unhandled_errors||this.qi.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(jo.info("enabled"),this.Ld(),this._s(this.Id)):this.Ld()}_s(t){var e,n;(e=Q.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?t():(n=Q.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return jo.error("failed to load script",r);t()})}Ld(){var t,e,n;(t=this.Ad)==null||t.call(this),this.Ad=void 0,(e=this.Fd)==null||e.call(this),this.Fd=void 0,(n=this.Od)==null||n.call(this),this.Od=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.$d=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[qh]:this.$d}),this.qi=this.Dd(),this.startIfEnabledOrStop())}}onConfigChange(){this.qi=this.Dd()}captureException(t){var e,n,r,i=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.oe.consumeRateLimit(i)?jo.info("Skipping exception capture because of client rate limiting.",{exception:i}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.Nd=[],this.qd=new _T([new PT,new FT,new TT,new RT,new NT,new AT,new OT,new $T],function(r){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;i>o;o++)s[o-1]=arguments[o];return function(a,l){l===void 0&&(l=0);for(var u=[],c=a.split(` -`),d=l;c.length>d;d++){var f=c[d];if(1024>=f.length){var _=gy.test(f)?f.replace(gy,"$1"):f;if(!_.match(/\S*Error: /)){for(var m of s){var p=m(_,r);if(p){u.push(p);break}}if(u.length>=50)break}}}return function(y){if(!y.length)return[];var h=Array.from(y);return h.reverse(),h.slice(0,50).map(v=>{return N({},v,{filename:v.filename||(x=h,x[x.length-1]||{}).filename,function:v.function||io});var x})}(u)}}("web:javascript",ET,kT)),this._instance=t,this.Nd=(e=(n=this._instance.persistence)==null?void 0:n.get_property(Hh))!==null&&e!==void 0?e:[],this.jd=Yu(this.Bd()),this.Hd=new jT(this.jd)}onConfigChange(){this.jd=Yu(this.Bd()),this.Hd.setConfig(this.jd)}onRemoteConfig(t){var e,n,r;if(t.ok){var i=t.config;if("errorTracking"in i){var s=(e=(n=i.errorTracking)==null?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],o=(r=i.errorTracking)==null?void 0:r.captureExtensionExceptions;this.Nd=s,this._instance.persistence&&this._instance.persistence.register({[Hh]:this.Nd,[Wh]:o})}}}get Ud(){var t,e=!!this._instance.get_property(Wh),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.qd.buildFromUnknown(t,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}addExceptionStep(t,e){if(this.jd.enabled)try{if(!ue(t)||t.trim().length===0)return void cn.warn("Ignoring exception step because message must be a non-empty string");var n=function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(s).reduce((a,l)=>LT.has(l)?(o.push(l),a):(a[l]=s[l],a),{}),droppedKeys:o}}(this.zd(e)),r=n.sanitizedProperties,i=n.droppedKeys;i.length>0&&cn.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.Hd.add(N({[Ku]:t,[Qu]:new Date().toISOString()},r))}catch(s){cn.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Wd(e)){if(this.Vd(e))return this.Gd("Exception dropped: matched a suppression rule"),void cn.info("Skipping exception capture because a suppression rule matched");if(!this.Ud&&this.Zd(e))return this.Gd("Exception dropped: thrown by a browser extension"),void cn.info("Skipping exception capture because it was thrown by an extension");if(!this.Ud&&this.Qd(e))return this.Gd("Exception dropped: thrown by an injected browser script"),void cn.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jd(e))return this.Gd("Exception dropped: thrown by the PostHog SDK"),void cn.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.jd.enabled&&te(t.$exception_steps)?this.Kd(t):t,r=typeof(s=globalThis._posthogReleaseId)=="string"&&s.length>0?s:void 0;r&&(n.$release_id=r);try{var i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",fl:!0});return i&&this.Hd.clear(),i}catch(o){return cn.error("Failed to capture exception event. Dropping this exception.",o),void this.Hd.clear()}}catch(o){return void cn.error("Failed to process exception event. Ignoring this exception.",o)}var s}Kd(t){try{var e=this.Hd.getAttachable();return e.length===0?t:N({},t,{$exception_steps:e})}catch(n){return cn.error("Failed to read buffered exception steps. Capturing exception without steps.",n),t}}Gd(t){this.jd.enabled&&this.Hd.add({[Ku]:t,[Qu]:new Date().toISOString()})}zd(t){return xe(t)?N({},t):{}}Bd(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}Vd(t){if(t.length===0)return!1;try{var e=t.reduce((n,r)=>{var i=r.type,s=r.value;return ue(i)&&i.length>0&&n.$exception_types.push(i),ue(s)&&s.length>0&&n.$exception_values.push(s),n},{$exception_types:[],$exception_values:[]});return this.Nd.some(n=>{var r=n.values.map(i=>{var s=wE[i.operator],o=e[i.key];if(!s||!o)return!1;var a=X(i.value)?i.value:[i.value];return a.length>0&&s(a,o)});return n.type==="OR"?r.some(Boolean):r.every(Boolean)})}catch(n){return cn.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}Zd(t){return t.flatMap(e=>{var n,r;return(n=(r=e.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]}).some(e=>{var n=e.filename;return!!n&&aO.some(r=>n.startsWith(r))})}Qd(t){return t.some(e=>{var n=e.value;return ue(n)&&lO.some(r=>n.includes(r))})}Jd(t){if(t.length>0){var e,n,r,i,s=(e=(n=t[0].stacktrace)==null?void 0:n.frames)!==null&&e!==void 0?e:[],o=s[s.length-1];return(r=o==null||(i=o.filename)==null?void 0:i.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}Wd(t){return!te(t)&&X(t)}}},hO=N({productTours:class{get za(){return this._instance.persistence}constructor(t){this.Yd=null,this.Xd=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var n,r;if(this.za&&this.za.register({[qv]:!!e.productTours}),!vf(this._instance))return!this.Yd&&te((n=this.za)==null?void 0:n.props[Ko])||Fl.info("product tours disabled; stopping and clearing cached tours"),(r=this.Yd)==null||r.stop(),this.Yd=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Yd&&vf(this._instance)&&this._s(()=>this.tv())}_s(t){var e,n;(e=Q.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=Q.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",r=>{r?Fl.error("Could not load product tours script",r):t()})}tv(){var t;!this.Yd&&(t=Q.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.Yd=Q.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!X(this.Xd)||e){var n=this.za;if(n){var r=n.props[Ko];if(X(r)&&!e)return this.Xd=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(vf(this._instance)){var s=i.statusCode;if(s!==200||!i.json){var o="Product Tours API could not be loaded, status: "+s;return s===0?i.error||Fl.warn(o):Fl.error(o),void t([],{isLoaded:!1,error:o})}var a=X(i.json.product_tours)?i.json.product_tours:[];this.Xd=a,n&&n.register({[Ko]:a}),t(a,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Xd,{isLoaded:!0})}getActiveProductTours(t){te(this.Yd)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Yd.getActiveProductTours(t)}showProductTour(t){var e;(e=this.Yd)==null||e.showTourById(t)}previewTour(t){this.Yd?this.Yd.previewTour(t):this._s(()=>{var e;this.tv(),(e=this.Yd)==null||e.previewTour(t)})}dismissProductTour(){var t;(t=this.Yd)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.Yd)==null||t.nextStep()}previousStep(){var t;(t=this.Yd)==null||t.previousStep()}clearCache(){var t;this.Xd=null,(t=this.za)==null||t.unregister(Ko)}resetTour(t){var e;(e=this.Yd)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.Yd)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.Yd)==null||e.cancelPendingTour(t)}}},Hc),pO={siteApps:class{constructor(t){this.ev=0,this._instance=t,this.iv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}rv(t,e){if(e){var n=this.globalsForEvent(e);this.iv.push(n),this.iv.length>1e3&&(this.iv=this.iv.slice(10))}}get siteAppLoaders(){var t;return(t=Q._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.rv.bind(this));this.nv=()=>{t(),this.iv=[],this.nv=void 0}}}globalsForEvent(t){var e,n,r,i,s,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(c)){var f=d[0];l[f]={id:u[f],type:f,properties:d[1]}}var _=t.$set_once,m=t.$set;return{event:N({},Ux(t,JI),{properties:N({},t.properties,m?{$set:N({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},m)}:{},_?{$set_once:N({},(r=(i=t.properties)==null?void 0:i.$set_once)!==null&&r!==void 0?r:{},_)}:{}),elements_chain:(s=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}sv(t){var e,n=(e=t.tagName)==null?void 0:e.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(kn.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(kn.error("prepare_external_dependency_script returned null"),null):t}av(){var t,e,n,r,i,s,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=j==null?void 0:j.defaultView,u=l==null||(t=l.Node)==null?void 0:t.prototype;if(!l||!u)return()=>{};if(this.ev++,this.ov)return this.lv();var c=[],d=this,f=new WeakSet,_=(y,h,v)=>{if(y!=null&&y[h]){var x=y[h];y[h]=v(x),c.push(()=>{y[h]=x})}},m=y=>{if(f.has(y))return y;var h=d.sv(y);return h&&f.add(h),h},p=y=>y.map(h=>typeof h=="string"?h:m(h)).filter(h=>!et(h));return _(u,"appendChild",y=>function(h){var v=m(h);return v?y.call(this,v):h}),_(u,"insertBefore",y=>function(h,v){var x=m(h);return x?y.call(this,x,v):h}),_(u,"replaceChild",y=>function(h,v){var x=m(h);return x?y.call(this,x,v):v}),[(e=l.Element)==null?void 0:e.prototype,(n=l.Document)==null?void 0:n.prototype,(r=l.DocumentFragment)==null?void 0:r.prototype].forEach(y=>{_(y,"append",h=>function(){for(var v=arguments.length,x=new Array(v),b=0;v>b;b++)x[b]=arguments[b];return h.apply(this,p(x))}),_(y,"prepend",h=>function(){for(var v=arguments.length,x=new Array(v),b=0;v>b;b++)x[b]=arguments[b];return h.apply(this,p(x))})}),[(i=l.Element)==null?void 0:i.prototype,(s=l.CharacterData)==null?void 0:s.prototype,(o=l.DocumentType)==null?void 0:o.prototype].forEach(y=>{_(y,"before",h=>function(){for(var v=arguments.length,x=new Array(v),b=0;v>b;b++)x[b]=arguments[b];return h.apply(this,p(x))}),_(y,"after",h=>function(){for(var v=arguments.length,x=new Array(v),b=0;v>b;b++)x[b]=arguments[b];return h.apply(this,p(x))}),_(y,"replaceWith",h=>function(){for(var v=arguments.length,x=new Array(v),b=0;v>b;b++)x[b]=arguments[b];var E=p(x);return x.length&&!E.length?void 0:h.apply(this,E)})}),_((a=l.Element)==null?void 0:a.prototype,"insertAdjacentElement",y=>function(h,v){var x=m(v);return x?y.call(this,h,x):null}),this.ov=()=>{c.forEach(y=>y()),this.ov=void 0},this.lv()}lv(){var t=!1;return()=>{var e;t||(t=!0,this.ev--,this.ev===0&&((e=this.ov)==null||e.call(this)))}}uv(t,e){e===void 0&&(e=!0);var n=this.av();try{var r=t(n);return e&&n(),r}catch(i){throw n(),i}}setupSiteApp(t){var e=this.apps[t.id],n=()=>{var o;!e.errored&&this.iv.length&&(kn.info("Processing "+this.iv.length+" events for site app with id "+t.id),this.iv.forEach(a=>this.uv(()=>e.processEvent==null?void 0:e.processEvent(a))),e.processedBuffer=!0),Object.values(this.apps).every(a=>a.processedBuffer||a.errored)&&((o=this.nv)==null||o.call(this))},r=!1,i=o=>{e.errored=!o,e.loaded=!0,kn.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),r&&n()};try{var s=this.uv(o=>t.init({posthog:this._instance,callback(a){o(),i(a)}}),!1).processEvent;s&&(e.processEvent=s),r=!0}catch(o){kn.error(n_+t.id,o),i(!1)}if(r&&e.loaded)try{n()}catch(o){kn.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}hv(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}dv(t){var e=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t),r=function(s){try{e.uv(()=>s.processEvent==null?void 0:s.processEvent(n))}catch(o){kn.error("Error while processing event "+t.event+" for site app "+s.id,o)}};for(var i of Object.values(this.apps))r(i)}}onRemoteConfig(t){var e,n,r,i=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.hv(),void this._instance.on("eventCaptured",l=>this.dv(l))):void kn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.nv)==null||n.call(this),t.ok){var s=t.config;if((r=s.siteApps)!=null&&r.length)if(this.isEnabled){var o=function(){var l,u=a.id,c=a.url;Q["__$$ph_site_app_"+u]=i._instance,(l=Q.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(i._instance,c,d=>{if(d)return kn.error(n_+u,d)})};for(var a of s.siteApps)o()}else kn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},vO={tracingHeaders:class{constructor(t){this.vv=void 0,this.fv=void 0,this.pv=void 0,this.Id=()=>{var e,n,r=this.gv();r?(F(this.vv)&&(this.vv=(e=Q.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),F(this.fv)&&(this.fv=(n=Q.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Ld()},this._instance=t}initialize(){this.startIfEnabledOrStop()}_s(t){var e,n;(e=Q.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?t():(n=Q.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return YI.error("failed to load script",r);t()})}mv(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}gv(){var t=this.mv();return X(t)?(X(this.pv)?this.pv.splice(0,this.pv.length,...t):this.pv=[...t],t.length>0?this.pv:void 0):(X(this.pv)&&this.pv.splice(0),this.pv=t||void 0,this.pv)}Ld(){var t,e;(t=this.vv)==null||t.call(this),(e=this.fv)==null||e.call(this),this.vv=void 0,this.fv=void 0}startIfEnabledOrStop(){this.gv()?this._s(this.Id):this.Ld()}}},gO=N({surveys:class extends ZI{constructor(t){var e;super(new iO(t),{get projectToken(){return e.config.token},kv:new rO(e=t)}),this._instance=t}Nl(t,e){var n=e.query?tl(t,e.query):t;return new Promise(r=>{var i;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor((i=e.target)!==null&&i!==void 0?i:"api",n),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:r})})}}},Hc),mO={toolbar:class{constructor(t){this.instance=t}yv(t){Q.ph_toolbar_state=t}bv(){var t;return(t=Q.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,n){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),rp(this.instance.config)||!T||!j)return!1;t=t??T.location,n=n??T.history;try{if(!e){try{T.localStorage.setItem("test","test"),T.localStorage.removeItem("test")}catch{return!1}e=T==null?void 0:T.localStorage}var r,i=sO||ac(t.hash,"__posthog")||ac(t.hash,"state"),s=i?_y(()=>JSON.parse(atob(decodeURIComponent(i))))||_y(()=>JSON.parse(decodeURIComponent(i))):null;return s&&s.action==="ph_authorize"?((r=s).source="url",r&&Object.keys(r).length>0&&(s.desiredHash?t.hash=s.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(i_)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}_v(t){var e=Q.ph_load_toolbar||Q.ph_load_editor;!te(e)&&ft(e)?e(t,this.instance):s_.warn("No toolbar load function found")}loadToolbar(t){var e=!(j==null||!j.getElementById(jb));if(!T||e)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=N({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(T.localStorage.setItem(i_,JSON.stringify(N({},r,{source:void 0}))),this.bv()===2)this._v(r);else if(this.bv()===0){var i;this.yv(1),(i=Q.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"toolbar",s=>{if(s)return s_.error("[Toolbar] Failed to load",s),void this.yv(0);this.yv(2),this._v(r)}),Ce(T,"turbolinks:load",()=>{this.yv(0),this.loadToolbar(r)})}return!0}wv(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,n){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(t,e,n)}}},yO=N({experiments:ct},Hc),_O={conversations:class{constructor(t){this.Sv=void 0,this._conversationsManager=null,this.xv=!1,this.Me=null,this.Cv=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Tv=t.ok,t.ok)){var e=t.config.conversations;te(e)||(It(e)?this.Sv=e:(this.Sv=e.enabled,this.Me=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Sv=void 0,this.Me=null,this.Tv=void 0,this.Cv=!1}loadIfEnabled(){if(!(this._conversationsManager||this.xv||this._instance.config.disable_conversations||rp(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=Q==null?void 0:Q.__PosthogExtensions__;if(t&&!F(this.Sv)&&this.Sv)if(this.Me&&this.Me.token){this.xv=!0;try{var e=t.initConversations;if(e)return this.Mv(e),void(this.xv=!1);var n=t.loadExternalDependency;if(!n)return void this.Ev(Wv);n(this._instance,"conversations",r=>{r||!t.initConversations?this.Ev("Could not load conversations script",r):this.Mv(t.initConversations),this.xv=!1})}catch(r){this.Ev("Error initializing conversations",r),this.xv=!1}}else Qt.error("Conversations enabled but missing token in remote config.")}}Mv(t){if(this.Me)try{this._conversationsManager=t(this.Me,this._instance),this.Cv=!1,Qt.info("Conversations loaded successfully")}catch(e){this.Ev("Error completing conversations initialization",e)}else Qt.error("Cannot complete initialization: remote config is null")}Ev(t,e){Qt.error(t,e),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():Qt.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Sv===!0&&!et(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":rp(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Tv===!1?"remote_config_failed":F(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?te(this.Me)||!this.Me.token?"missing_token":Q!=null&&Q.__PosthogExtensions__?this.xv?"initializing":this.Cv?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var r=this;return be(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,n):(Qt.warn(di),null)})()}getMessages(t,e){var n=this;return be(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(Qt.warn(di),null)})()}markAsRead(t){var e=this;return be(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Qt.warn(di),null)})()}getTickets(t){var e=this;return be(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Qt.warn(di),null)})()}requestRestoreLink(t){var e=this;return be(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Qt.warn(di),null)})()}restoreFromToken(t){var e=this;return be(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Qt.warn(di),null)})()}restoreFromUrlToken(){var t=this;return be(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Qt.warn(di),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}Sl(){var t;(t=this._conversationsManager)==null||t.setIdentity()}xl(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},wO={logs:class{constructor(t){var e,n=this;this.Iv=!1,this.Rv=!1,this.I=Pe("[logs]"),this.Pv=N({},this.I,{error(){for(var r=arguments.length,i=new Array(r),s=0;r>s;s++)i[s]=arguments[s];i.some(h_)||n.I.error(...i)}}),this.ka=[],this.Av=[],this.ph=0,this.Fv=()=>{var r,i;this.ph=0,(r=this.Ov)==null||r.onReconnect(),(i=this.Lv)==null||i.onReconnect()},this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Iv=!0),T&&Ce(T,"online",this.Fv)}$v(t,e,n,r){var i,s=function(o,a){var l,u,c,d,f,_,m,p=(l=o==null?void 0:o.flushIntervalMs)!==null&&l!==void 0?l:3e3,y=(u=o==null?void 0:o.maxBufferSize)!==null&&u!==void 0?u:100,h=a!=null&&a.consoleCapture?void 0:(c=o==null?void 0:o.maxLogsPerInterval)!==null&&c!==void 0?c:1e3,v=F(h)?Math.max(y,2048):Math.max(y,h),x=o==null?void 0:o.resourceAttributes;return{serviceName:(d=(f=x==null?void 0:x["service.name"])!==null&&f!==void 0?f:o==null?void 0:o.serviceName)!==null&&d!==void 0?d:a==null?void 0:a.serviceNameDefault,serviceVersion:(_=x==null?void 0:x["service.version"])!==null&&_!==void 0?_:o==null?void 0:o.serviceVersion,environment:(m=x==null?void 0:x["deployment.environment"])!==null&&m!==void 0?m:o==null?void 0:o.environment,resourceAttributes:x,beforeSend:o==null?void 0:o.beforeSend,flushIntervalMs:p,maxBufferSize:y,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:p,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}((i=this._instance)==null||(i=i.config)==null?void 0:i.logs,n);return[new gT(this.Dv(t,e),s,this.Pv,()=>this.Nv(),o=>o(),void 0,r),s]}qv(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.Ov||this.jv!==e){var n;(n=this.Ov)==null||n.reset(),this.jv=e;var r=this.$v(()=>this.ka,i=>{this.ka=i});this.Ov=r[0],this.Bv=r[1]}return this.Ov}Hv(){var t,e=(t=this._instance)==null||(t=t.config)==null?void 0:t.logs;if(!this.Lv||this.Uv!==e){var n;(n=this.Lv)==null||n.reset(),this.Uv=e;var r=this.$v(()=>this.Av,i=>{this.Av=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},f_);this.Lv=r[0],this.zv=r[1]}return this.Lv}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var n=(e=t.config.logs)==null?void 0:e.captureConsoleLogs;!te(n)&&n&&(this.Iv=!0,this.loadIfEnabled())}}reset(){var t,e;this.ka=[],(t=this.Ov)==null||t.reset(),this.Av=[],(e=this.Lv)==null||e.reset(),this.ph=0}captureLog(t){this.qv().captureLog(t)}vi(t){this.Hv().captureLog(t)}get logger(){return this.Wv||(this.Wv={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Wv}flushLogs(t){t?this.Vv(t):(this.Ov&&this.Ov.flush().catch(e=>this.Gv(e)),this.Lv&&this.Lv.flush().catch(e=>this.Gv(e)))}Gv(t){h_(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Iv&&!this.Rv){var t=Q==null?void 0:Q.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",n=>{var r;n||(r=t.logs)==null||!r.initializeLogs?this.I.error("Could not load logs script",n):(t.logs.initializeLogs(this._instance),this.Rv=!0)}):this.I.error(Wv)}else this.I.error("PostHog Extensions not found.")}}Dv(t,e){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===Xn.LogsQueue?t():void 0,setPersistedProperty(r,i){var s;r===Xn.LogsQueue&&e((s=i)!==null&&s!==void 0?s:[])},Mn:r=>this.Mn(r),getLibraryId:()=>we.LIB_NAME,getLibraryVersion:()=>we.LIB_VERSION}}Mn(t){return new Promise(e=>{if(Xb(this.ph,3))e({kind:"fatal",error:mf(void 0,"logs endpoint is unreachable, dropping batch")});else{var n=!1,r=s=>{n||(n=!0,clearTimeout(i),e(s))},i=setTimeout(()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:mf(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Zv(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:s=>{var o=s.statusCode;if(this.Qv(o),o>=200&&300>o)r({kind:"ok"});else if(o===413)r({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)r({kind:"fatal",error:new Error("logs request failed with status "+o)});else{var a;o===0?(s.error||this.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:mf(s.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:(a=s.error)!==null&&a!==void 0?a:new Error("logs request failed with status "+o)})}}})}})}Qv(t){(t!==0||this._instance.__loaded)&&(this.ph=Jb(t,this.ph,3,()=>this.I.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Vv(t){this.ka.length>0&&this.Jv(t,this.ka,this.Bv,we.LIB_NAME,e=>{this.ka=e}),this.Av.length>0&&this.Jv(t,this.Av,this.zv,f_,e=>{this.Av=e})}Jv(t,e,n,r,i){if(e.length!==0){var s=e.map(a=>a.record);i([]);var o=wb(s,_b(n,we.LIB_NAME,we.LIB_VERSION),r,we.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zv(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Zv(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Nv(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,i=n.sessionStartTimestamp,s=n.lastActivityTimestamp;e.sessionId=n.sessionId,e.windowId=r,te(i)||(e.sessionStartTimestamp=i),te(s)||(e.lastActivityTimestamp=s)}if(Q!=null&&(t=Q.location)!=null&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Zr(Q.location.href):Q.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},xO={metrics:class{constructor(t){this.I=Pe("[metrics]"),this._instance=t}initialize(){}qv(){var t,e,n=(t=this._instance)==null||(t=t.config)==null?void 0:t.metrics;return this.Ov&&this.jv===n||((e=this.Ov)==null||e.reset(),this.jv=n,this.Ov=new mT(this.Dv(),function(r){var i,s,o,a,l,u=r==null?void 0:r.resourceAttributes;return{serviceName:(i=u==null?void 0:u["service.name"])!==null&&i!==void 0?i:r==null?void 0:r.serviceName,serviceVersion:(s=u==null?void 0:u["service.version"])!==null&&s!==void 0?s:r==null?void 0:r.serviceVersion,environment:(o=u==null?void 0:u["deployment.environment"])!==null&&o!==void 0?o:r==null?void 0:r.environment,resourceAttributes:u,beforeSend:r==null?void 0:r.beforeSend,flushIntervalMs:(a=r==null?void 0:r.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=r==null?void 0:r.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}}(n),this.I)),this.Ov}count(t,e,n){e===void 0&&(e=1),this.qv().count(t,e,n)}gauge(t,e,n){this.qv().gauge(t,e,n)}histogram(t,e,n){this.qv().histogram(t,e,n)}flush(t){if(!this.Ov)return Promise.resolve();if(t){var e=this.Ov.drainWindow();return e&&this.Un(e,t),Promise.resolve()}return this.Ov.flush().catch(n=>this.I.error("PostHog metrics flush failed:",n))}reset(){var t;(t=this.Ov)==null||t.reset()}Dv(){var t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Un:n=>e.Un(n),getLibraryId:()=>we.LIB_NAME,getLibraryVersion:()=>we.LIB_VERSION}}Un(t,e){return new Promise(n=>{var r=!1,i=o=>{r||(r=!0,clearTimeout(s),n(o))},s=setTimeout(()=>i({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(N({method:"POST",url:this.Kv(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(o){var a=o.statusCode;if(a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)i({kind:"fatal",error:new Error("metrics request failed with status "+a)});else{var l;i({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error("metrics request failed with status "+a)})}}}))})}Kv(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},bO=N({},Hc,cO,dO,fO,hO,pO,gO,vO,mO,yO,_O,wO,xO);Dt.__defaultExtensionClasses=N({},bO);var EO=function(){we.SDK_DIST_CHANNEL="npm";var t=ca[us]=new Dt;return function(){function e(){e.done||(e.done=!0,kE=!1,he(ca,function(n){n._dom_loaded()}))}j!=null&&j.addEventListener?j.readyState==="complete"?e():Ce(j,"DOMContentLoaded",e,{capture:!1}):T&&D.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}(),IE;function SO(t){IE=t}function CO(){return IE}var kO=g.createContext({get client(){return CO()},bootstrap:void 0}),yf=function(t){return typeof t=="function"},PO=function(t){return t===void 0},vp=function(t,e){return vp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},vp(t,e)};function RO(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");vp(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var cu=function(t){var e=Object.prototype.toString.call(t);return t instanceof Error||e==="[object Error]"||e==="[object Exception]"||e==="[object DOMException]"||e==="[object DOMError]"},TO=function(t,e){for(var n=new WeakSet,r=t;!n.has(r);){if(n.add(r),!cu(r.cause)){PO(r.cause)||(e.cause=r.cause),r.cause=e;return}r=r.cause}},IO=function(t,e){if(!e)return t;var n=new Error(cu(t)?t.message:"Primitive value captured as exception: ".concat(String(t)));return n.name="React ErrorBoundary ".concat(cu(t)?t.name:"Error"),n.stack=e,cu(t)?(TO(t,n),t):n},OO={componentStack:null,exceptionEvent:null,error:null},MO={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(t){RO(e,t);function e(n){var r=t.call(this,n)||this;return r.state=OO,r}return e.prototype.componentDidCatch=function(n,r){var i=this.props.additionalProperties,s;yf(i)?s=i(n,r):typeof i=="object"&&(s=i);var o=this.context.client,a=r.componentStack,l=o.captureException(IO(n,a),s);this.setState({error:n,componentStack:a??null,exceptionEvent:l})},e.prototype.render=function(){var n=this.props,r=n.children,i=n.fallback,s=this.state;if(s.componentStack==null)return yf(r)?r():r;var o=yf(i)?V.createElement(i,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):i;return V.isValidElement(o)?o:(console.warn(MO.INVALID_FALLBACK),V.createElement(V.Fragment,null))},e.contextType=kO,e})(V.Component);SO(EO);class OE extends V.Component{constructor(){super(...arguments);wr(this,"state",{failed:!1,resetKey:this.props.resetKey})}static getDerivedStateFromError(){return{failed:!0}}static getDerivedStateFromProps(n,r){return n.resetKey===r.resetKey?null:{failed:!1,resetKey:n.resetKey}}componentDidCatch(n){console.error("The application could not render",n)}render(){if(!this.state.failed)return this.props.children;const n=w.jsxs("div",{className:"page",role:"alert",children:[w.jsx("h1",{children:"This page could not load"}),w.jsx("p",{children:"The site may have been updated while this tab was open."}),w.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>window.location.reload(),children:"Reload page"})]});return this.props.resetKey===void 0?w.jsx("main",{children:n}):n}}const _f="pwc:chunk-reload-at",ME=6e4;function AO(t,e){if(!t)return!0;const n=Number(t);return!Number.isFinite(n)||e-n>=ME}function NO(){if(typeof window>"u")return()=>{};const t=n=>{const r=Date.now();AO(sessionStorage.getItem(_f),r)&&(n.preventDefault(),sessionStorage.setItem(_f,String(r)),window.location.reload())};window.addEventListener("vite:preloadError",t);const e=window.setTimeout(()=>sessionStorage.removeItem(_f),ME);return()=>{window.removeEventListener("vite:preloadError",t),window.clearTimeout(e)}}const $O="modulepreload",FO=function(t){return"/"+t},p_={},oe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=FO(l),l in p_)return;p_[l]=!0;const u=l.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${c}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":$O,u||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((f,_)=>{d.addEventListener("load",f),d.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};/** - * @remix-run/router v1.23.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function La(){return La=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Wc(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function DO(){return Math.random().toString(36).substr(2,8)}function g_(t,e){return{usr:t.state,key:t.key,idx:e}}function fc(t,e,n,r){return n===void 0&&(n=null),La({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Hi(e):e,{state:n,key:e&&e.key||r||DO()})}function ja(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Hi(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function AE(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a=Ur.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(La({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function d(){a=Ur.Pop;let y=c(),h=y==null?null:y-u;u=y,l&&l({action:a,location:p.location,delta:h})}function f(y,h){a=Ur.Push;let v=fc(p.location,y,h);n&&n(v,y),u=c()+1;let x=g_(v,u),b=p.createHref(v);try{o.pushState(x,"",b)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;i.location.assign(b)}s&&l&&l({action:a,location:p.location,delta:1})}function _(y,h){a=Ur.Replace;let v=fc(p.location,y,h);n&&n(v,y),u=c();let x=g_(v,u),b=p.createHref(v);o.replaceState(x,"",b),s&&l&&l({action:a,location:p.location,delta:0})}function m(y){let h=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof y=="string"?y:ja(y);return v=v.replace(/ $/,"%20"),je(h,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,h)}let p={get action(){return a},get location(){return t(i,o)},listen(y){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(v_,d),l=y,()=>{i.removeEventListener(v_,d),l=null}},createHref(y){return e(i,y)},createURL:m,encodeLocation(y){let h=m(y);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:f,replace:_,go(y){return o.go(y)}};return p}var m_;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(m_||(m_={}));function zO(t,e,n){return n===void 0&&(n="/"),UO(t,e,n)}function UO(t,e,n,r){let i=typeof e=="string"?Hi(e):e,s=uo(i.pathname||"/",n);if(s==null)return null;let o=NE(t);VO(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(je(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Yr([r,l.relativePath]),c=n.concat(l);s.children&&s.children.length>0&&(je(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),NE(s.children,e,c,u)),!(s.path==null&&!s.index)&&e.push({path:u,score:QO(u,s.index),routesMeta:c})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of $E(s.path))i(s,o,l)}),e}function $E(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=$E(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function VO(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:YO(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const BO=/^:[\w-]+$/,qO=3,HO=2,WO=1,GO=10,KO=-2,y_=t=>t==="*";function QO(t,e){let n=t.split("/"),r=n.length;return n.some(y_)&&(r+=KO),e&&(r+=HO),n.filter(i=>!y_(i)).reduce((i,s)=>i+(BO.test(s)?qO:s===""?WO:GO),r)}function YO(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function XO(t,e,n){let{routesMeta:r}=t,i={},s="/",o=[];for(let a=0;a{let{paramName:f,isOptional:_}=c;if(f==="*"){let p=a[d]||"";o=s.slice(0,s.length-p.length).replace(/(.)\/+$/,"$1")}const m=a[d];return _&&!m?u[f]=void 0:u[f]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:t}}function JO(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Wc(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function ZO(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Wc(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function uo(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const eM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tM=t=>eM.test(t);function nM(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Hi(t):t,s;if(n)if(tM(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Wc(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=__(n.substring(1),"/"):s=__(n,e)}else s=e;return{pathname:s,search:sM(r),hash:oM(i)}}function __(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function wf(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function rM(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Zv(t,e){let n=rM(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function eg(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Hi(t):(i=La({},t),je(!i.pathname||!i.pathname.includes("?"),wf("?","pathname","search",i)),je(!i.pathname||!i.pathname.includes("#"),wf("#","pathname","hash",i)),je(!i.search||!i.search.includes("#"),wf("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let d=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}a=d>=0?e[d]:"/"}let l=nM(i,a),u=o&&o!=="/"&&o.endsWith("/"),c=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Yr=t=>t.join("/").replace(/\/\/+/g,"/"),iM=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),sM=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,oM=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function aM(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const FE=["post","put","patch","delete"];new Set(FE);const lM=["get",...FE];new Set(lM);/** - * React Router v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Da(){return Da=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),g.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let d=eg(u,JSON.parse(o),s,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Yr([e,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[e,r,o,s,t])}const dM=g.createContext(null);function fM(t){let e=g.useContext(Vn).outlet;return e&&g.createElement(dM.Provider,{value:t},e)}function zE(){let{matches:t}=g.useContext(Vn),e=t[t.length-1];return e?e.params:{}}function Qc(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=g.useContext(vr),{matches:i}=g.useContext(Vn),{pathname:s}=an(),o=JSON.stringify(Zv(i,r.v7_relativeSplatPath));return g.useMemo(()=>eg(t,JSON.parse(o),s,n==="path"),[t,o,s,n])}function hM(t,e){return pM(t,e)}function pM(t,e,n,r){mo()||je(!1);let{navigator:i}=g.useContext(vr),{matches:s}=g.useContext(Vn),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=an(),c;if(e){var d;let y=typeof e=="string"?Hi(e):e;l==="/"||(d=y.pathname)!=null&&d.startsWith(l)||je(!1),c=y}else c=u;let f=c.pathname||"/",_=f;if(l!=="/"){let y=l.replace(/^\//,"").split("/");_="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let m=zO(t,{pathname:_}),p=_M(m&&m.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:Yr([l,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Yr([l,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),s,n,r);return e&&p?g.createElement(Kc.Provider,{value:{location:Da({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Ur.Pop}},p):p}function vM(){let t=EM(),e=aM(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},e),n?g.createElement("pre",{style:i},n):null,null)}const gM=g.createElement(vM,null);class mM extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?g.createElement(Vn.Provider,{value:this.props.routeContext},g.createElement(jE.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function yM(t){let{routeContext:e,match:n,children:r}=t,i=g.useContext(Gc);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),g.createElement(Vn.Provider,{value:e},r)}function _M(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var s;if(!n)return null;if(n.errors)t=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=(i=n)==null?void 0:i.errors;if(a!=null){let c=o.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);c>=0||je(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,d,f)=>{let _,m=!1,p=null,y=null;n&&(_=a&&d.route.id?a[d.route.id]:void 0,p=d.route.errorElement||gM,l&&(u<0&&f===0?(CM("route-fallback"),m=!0,y=null):u===f&&(m=!0,y=d.route.hydrateFallbackElement||null)));let h=e.concat(o.slice(0,f+1)),v=()=>{let x;return _?x=p:m?x=y:d.route.Component?x=g.createElement(d.route.Component,null):d.route.element?x=d.route.element:x=c,g.createElement(yM,{match:d,routeContext:{outlet:c,matches:h,isDataRoute:n!=null},children:x})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?g.createElement(mM,{location:n.location,revalidation:n.revalidation,component:p,error:_,children:v(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):v()},null)}var UE=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(UE||{}),VE=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(VE||{});function wM(t){let e=g.useContext(Gc);return e||je(!1),e}function xM(t){let e=g.useContext(LE);return e||je(!1),e}function bM(t){let e=g.useContext(Vn);return e||je(!1),e}function BE(t){let e=bM(),n=e.matches[e.matches.length-1];return n.route.id||je(!1),n.route.id}function EM(){var t;let e=g.useContext(jE),n=xM(),r=BE();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function SM(){let{router:t}=wM(UE.UseNavigateStable),e=BE(VE.UseNavigateStable),n=g.useRef(!1);return DE(()=>{n.current=!0}),g.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Da({fromRouteId:e},s)))},[t,e])}const w_={};function CM(t,e,n){w_[t]||(w_[t]=!0)}function qE(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function co(t){let{to:e,replace:n,state:r,relative:i}=t;mo()||je(!1);let{future:s,static:o}=g.useContext(vr),{matches:a}=g.useContext(Vn),{pathname:l}=an(),u=tg(),c=eg(e,Zv(a,s.v7_relativeSplatPath),l,i==="path"),d=JSON.stringify(c);return g.useEffect(()=>u(JSON.parse(d),{replace:n,state:r,relative:i}),[u,d,i,n,r]),null}function kM(t){return fM(t.context)}function ne(t){je(!1)}function HE(t){let{basename:e="/",children:n=null,location:r,navigationType:i=Ur.Pop,navigator:s,static:o=!1,future:a}=t;mo()&&je(!1);let l=e.replace(/^\/*/,"/"),u=g.useMemo(()=>({basename:l,navigator:s,static:o,future:Da({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof r=="string"&&(r=Hi(r));let{pathname:c="/",search:d="",hash:f="",state:_=null,key:m="default"}=r,p=g.useMemo(()=>{let y=uo(c,l);return y==null?null:{location:{pathname:y,search:d,hash:f,state:_,key:m},navigationType:i}},[l,c,d,f,_,m,i]);return p==null?null:g.createElement(vr.Provider,{value:u},g.createElement(Kc.Provider,{children:n,value:p}))}function PM(t){let{children:e,location:n}=t;return hM(mp(e),n)}new Promise(()=>{});function mp(t,e){e===void 0&&(e=[]);let n=[];return g.Children.forEach(t,(r,i)=>{if(!g.isValidElement(r))return;let s=[...e,i];if(r.type===g.Fragment){n.push.apply(n,mp(r.props.children,s));return}r.type!==ne&&je(!1),!r.props.index||!r.props.children||je(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=mp(r.props.children,s)),n.push(o)}),n}/** - * React Router DOM v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function hc(){return hc=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function RM(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function TM(t,e){return t.button===0&&(!e||e==="_self")&&!RM(t)}function yp(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function IM(t,e){let n=yp(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}const OM=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],MM=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],AM="6";try{window.__reactRouterVersion=AM}catch{}const NM=g.createContext({isTransitioning:!1}),$M="startTransition",pc=kc[$M];function FM(t){let{basename:e,children:n,future:r,window:i}=t,s=g.useRef();s.current==null&&(s.current=LO({window:i,v5Compat:!0}));let o=s.current,[a,l]=g.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=g.useCallback(d=>{u&&pc?pc(()=>l(d)):l(d)},[l,u]);return g.useLayoutEffect(()=>o.listen(c),[o,c]),g.useEffect(()=>qE(r),[r]),g.createElement(HE,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}function LM(t){let{basename:e,children:n,future:r,window:i}=t,s=g.useRef();s.current==null&&(s.current=jO({window:i,v5Compat:!0}));let o=s.current,[a,l]=g.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=g.useCallback(d=>{u&&pc?pc(()=>l(d)):l(d)},[l,u]);return g.useLayoutEffect(()=>o.listen(c),[o,c]),g.useEffect(()=>qE(r),[r]),g.createElement(HE,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const jM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",DM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mn=g.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:a,target:l,to:u,preventScrollReset:c,viewTransition:d}=e,f=WE(e,OM),{basename:_}=g.useContext(vr),m,p=!1;if(typeof u=="string"&&DM.test(u)&&(m=u,jM))try{let x=new URL(window.location.href),b=u.startsWith("//")?new URL(x.protocol+u):new URL(u),E=uo(b.pathname,_);b.origin===x.origin&&E!=null?u=E+b.search+b.hash:p=!0}catch{}let y=uM(u,{relative:i}),h=UM(u,{replace:o,state:a,target:l,preventScrollReset:c,relative:i,viewTransition:d});function v(x){r&&r(x),x.defaultPrevented||h(x)}return g.createElement("a",hc({},f,{href:m||y,onClick:p||s?r:v,ref:n,target:l}))}),is=g.forwardRef(function(e,n){let{"aria-current":r="page",caseSensitive:i=!1,className:s="",end:o=!1,style:a,to:l,viewTransition:u,children:c}=e,d=WE(e,MM),f=Qc(l,{relative:d.relative}),_=an(),m=g.useContext(LE),{navigator:p,basename:y}=g.useContext(vr),h=m!=null&&VM(f)&&u===!0,v=p.encodeLocation?p.encodeLocation(f).pathname:f.pathname,x=_.pathname,b=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;i||(x=x.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&y&&(b=uo(b,y)||b);const E=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let S=x===v||!o&&x.startsWith(v)&&x.charAt(E)==="/",k=b!=null&&(b===v||!o&&b.startsWith(v)&&b.charAt(v.length)==="/"),C={isActive:S,isPending:k,isTransitioning:h},R=S?r:void 0,P;typeof s=="function"?P=s(C):P=[s,S?"active":null,k?"pending":null,h?"transitioning":null].filter(Boolean).join(" ");let $=typeof a=="function"?a(C):a;return g.createElement(mn,hc({},d,{"aria-current":R,className:P,ref:n,style:$,to:l,viewTransition:u}),typeof c=="function"?c(C):c)});var _p;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(_p||(_p={}));var x_;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(x_||(x_={}));function zM(t){let e=g.useContext(Gc);return e||je(!1),e}function UM(t,e){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:a}=e===void 0?{}:e,l=tg(),u=an(),c=Qc(t,{relative:o});return g.useCallback(d=>{if(TM(d,n)){d.preventDefault();let f=r!==void 0?r:ja(u)===ja(c);l(t,{replace:f,state:i,preventScrollReset:s,relative:o,viewTransition:a})}},[u,l,c,r,i,n,t,s,o,a])}function f3(t){let e=g.useRef(yp(t)),n=g.useRef(!1),r=an(),i=g.useMemo(()=>IM(r.search,n.current?null:e.current),[r.search]),s=tg(),o=g.useCallback((a,l)=>{const u=yp(typeof a=="function"?a(i):a);n.current=!0,s("?"+u,l)},[s,i]);return[i,o]}function VM(t,e){e===void 0&&(e={});let n=g.useContext(NM);n==null&&je(!1);let{basename:r}=zM(_p.useViewTransitionState),i=Qc(t,{relative:e.relative});if(!n.isTransitioning)return!1;let s=uo(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=uo(n.nextLocation.pathname,r)||n.nextLocation.pathname;return gp(i.pathname,o)!=null||gp(i.pathname,s)!=null}var Yc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ci,Ar,zs,m0,BM=(m0=class extends Yc{constructor(){super();le(this,Ci);le(this,Ar);le(this,zs);ee(this,zs,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){A(this,Ar)||this.setEventListener(A(this,zs))}onUnsubscribe(){var e;this.hasListeners()||((e=A(this,Ar))==null||e.call(this),ee(this,Ar,void 0))}setEventListener(e){var n;ee(this,zs,e),(n=A(this,Ar))==null||n.call(this),ee(this,Ar,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){A(this,Ci)!==e&&(ee(this,Ci,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof A(this,Ci)=="boolean"?A(this,Ci):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ci=new WeakMap,Ar=new WeakMap,zs=new WeakMap,m0),GE=new BM,qM={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Nr,jp,y0,HM=(y0=class{constructor(){le(this,Nr,qM);le(this,jp,!1)}setTimeoutProvider(t){ee(this,Nr,t)}setTimeout(t,e){return A(this,Nr).setTimeout(t,e)}clearTimeout(t){A(this,Nr).clearTimeout(t)}setInterval(t,e){return A(this,Nr).setInterval(t,e)}clearInterval(t){A(this,Nr).clearInterval(t)}},Nr=new WeakMap,jp=new WeakMap,y0),wp=new HM;function WM(t){setTimeout(t,0)}var GM=typeof window>"u"||"Deno"in globalThis;function hn(){}function KM(t,e){return typeof t=="function"?t(e):t}function QM(t){return typeof t=="number"&&t>=0&&t!==1/0}function YM(t,e){return Math.max(t+(e||0)-Date.now(),0)}function xp(t,e){return typeof t=="function"?t(e):t}function XM(t,e){return typeof t=="function"?t(e):t}function b_(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==ng(o,e.options))return!1}else if(!Ua(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function E_(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(za(e.options.mutationKey)!==za(s))return!1}else if(!Ua(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function ng(t,e){return((e==null?void 0:e.queryKeyHashFn)||za)(t)}function za(t){return JSON.stringify(t,(e,n)=>bp(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Ua(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Ua(t[n],e[n])):!1}var JM=Object.prototype.hasOwnProperty;function KE(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=S_(t)&&S_(e);if(!r&&!(bp(t)&&bp(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let u=0;for(let c=0;c{wp.setTimeout(e,t)})}function eA(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?KE(t,e):e}function tA(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function nA(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var rg=Symbol();function QE(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===rg?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function p3(t,e){return typeof t=="function"?t(...e):!!t}function rA(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var YE=(()=>{let t=()=>GM;return{isServer(){return t()},setIsServer(e){t=e}}})();function iA(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var sA=WM;function oA(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=sA;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var wt=oA(),Us,$r,Vs,_0,aA=(_0=class extends Yc{constructor(){super();le(this,Us,!0);le(this,$r);le(this,Vs);ee(this,Vs,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){A(this,$r)||this.setEventListener(A(this,Vs))}onUnsubscribe(){var e;this.hasListeners()||((e=A(this,$r))==null||e.call(this),ee(this,$r,void 0))}setEventListener(e){var n;ee(this,Vs,e),(n=A(this,$r))==null||n.call(this),ee(this,$r,e(this.setOnline.bind(this)))}setOnline(e){A(this,Us)!==e&&(ee(this,Us,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return A(this,Us)}},Us=new WeakMap,$r=new WeakMap,Vs=new WeakMap,_0),vc=new aA;function lA(t){return Math.min(1e3*2**t,3e4)}function XE(t){return(t??"online")==="online"?vc.isOnline():!0}var Ep=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function JE(t){let e=!1,n=0,r;const i=iA(),s=()=>i.status!=="pending",o=p=>{var y;if(!s()){const h=new Ep(p);f(h),(y=t.onCancel)==null||y.call(t,h)}},a=()=>{e=!0},l=()=>{e=!1},u=()=>GE.isFocused()&&(t.networkMode==="always"||vc.isOnline())&&t.canRun(),c=()=>XE(t.networkMode)&&t.canRun(),d=p=>{s()||(r==null||r(),i.resolve(p))},f=p=>{s()||(r==null||r(),i.reject(p))},_=()=>new Promise(p=>{var y;r=h=>{(s()||u())&&p(h)},(y=t.onPause)==null||y.call(t)}).then(()=>{var p;r=void 0,s()||(p=t.onContinue)==null||p.call(t)}),m=()=>{if(s())return;let p;const y=n===0?t.initialPromise:void 0;try{p=y??t.fn()}catch(h){p=Promise.reject(h)}Promise.resolve(p).then(d).catch(h=>{var S;if(s())return;const v=t.retry??(YE.isServer()?0:3),x=t.retryDelay??lA,b=typeof x=="function"?x(n,h):x,E=v===!0||typeof v=="number"&&nu()?void 0:_()).then(()=>{e?f(h):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?m():_().then(m),i)}}var ki,w0,ZE=(w0=class{constructor(){le(this,ki)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),QM(this.gcTime)&&ee(this,ki,wp.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(YE.isServer()?1/0:5*60*1e3))}clearGcTimeout(){A(this,ki)!==void 0&&(wp.clearTimeout(A(this,ki)),ee(this,ki,void 0))}},ki=new WeakMap,w0);function uA(t){return{onFetch:(e,n)=>{var c,d,f,_,m;const r=e.options,i=(f=(d=(c=e.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,s=((_=e.state.data)==null?void 0:_.pages)||[],o=((m=e.state.data)==null?void 0:m.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let p=!1;const y=x=>{rA(x,()=>e.signal,()=>p=!0)},h=QE(e.options,e.fetchOptions),v=async(x,b,E)=>{if(p)return Promise.reject(e.signal.reason);if(b==null&&x.pages.length)return Promise.resolve(x);const k=(()=>{const $={client:e.client,queryKey:e.queryKey,pageParam:b,direction:E?"backward":"forward",meta:e.options.meta};return y($),$})(),C=await h(k),{maxPages:R}=e.options,P=E?nA:tA;return{pages:P(x.pages,C,R),pageParams:P(x.pageParams,b,R)}};if(i&&s.length){const x=i==="backward",b=x?eS:Sp,E={pages:s,pageParams:o},S=b(r,E);a=await v(E,S,x)}else{const x=t??s.length;do{const b=l===0?o[0]??r.initialPageParam:Sp(r,a);if(l>0&&b==null)break;a=await v(a,b),l++}while(l{var p,y;return(y=(p=e.options).persister)==null?void 0:y.call(p,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function Sp(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function eS(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}function v3(t,e){return e?Sp(t,e)!=null:!1}function g3(t,e){return!e||!t.getPreviousPageParam?!1:eS(t,e)!=null}var Bs,Pi,qs,Yt,Ri,Je,Wa,Ti,jt,tS,Kn,x0,cA=(x0=class extends ZE{constructor(e){super();le(this,jt);le(this,Bs);le(this,Pi);le(this,qs);le(this,Yt);le(this,Ri);le(this,Je);le(this,Wa);le(this,Ti);ee(this,Ti,!1),ee(this,Wa,e.defaultOptions),this.setOptions(e.options),this.observers=[],ee(this,Ri,e.client),ee(this,Yt,A(this,Ri).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,ee(this,Pi,P_(this.options)),this.state=e.state??A(this,Pi),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return A(this,Bs)}get promise(){var e;return(e=A(this,Je))==null?void 0:e.promise}setOptions(e){if(this.options={...A(this,Wa),...e},e!=null&&e._type&&ee(this,Bs,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=P_(this.options);n.data!==void 0&&(this.setState(k_(n.data,n.dataUpdatedAt)),ee(this,Pi,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&A(this,Yt).remove(this)}setData(e,n){const r=eA(this.state.data,e,this.options);return nt(this,jt,Kn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){nt(this,jt,Kn).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=A(this,Je))==null?void 0:r.promise;return(i=A(this,Je))==null||i.cancel(e),n?n.then(hn).catch(hn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return A(this,Pi)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>XM(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rg||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>xp(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!YM(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=A(this,Je))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=A(this,Je))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),A(this,Yt).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(A(this,Je)&&(A(this,Ti)||nt(this,jt,tS).call(this)?A(this,Je).cancel({revert:!0}):A(this,Je).cancelRetry()),this.scheduleGc()),A(this,Yt).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||nt(this,jt,Kn).call(this,{type:"invalidate"})}async fetch(e,n){var u,c,d,f,_,m,p,y,h,v,x;if(this.state.fetchStatus!=="idle"&&((u=A(this,Je))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(A(this,Je))return A(this,Je).continueRetry(),A(this,Je).promise}if(e&&this.setOptions(e),!this.options.queryFn){const b=this.observers.find(E=>E.options.queryFn);b&&this.setOptions(b.options)}const r=new AbortController,i=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(ee(this,Ti,!0),r.signal)})},s=()=>{const b=QE(this.options,n),S=(()=>{const k={client:A(this,Ri),queryKey:this.queryKey,meta:this.meta};return i(k),k})();return ee(this,Ti,!1),this.options.persister?this.options.persister(b,S,this):b(S)},a=(()=>{const b={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:A(this,Ri),state:this.state,fetchFn:s};return i(b),b})(),l=A(this,Bs)==="infinite"?uA(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),ee(this,qs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&nt(this,jt,Kn).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),ee(this,Je,JE({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:b=>{b instanceof Ep&&b.revert&&this.setState({...A(this,qs),fetchStatus:"idle"}),r.abort()},onFail:(b,E)=>{nt(this,jt,Kn).call(this,{type:"failed",failureCount:b,error:E})},onPause:()=>{nt(this,jt,Kn).call(this,{type:"pause"})},onContinue:()=>{nt(this,jt,Kn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const b=await A(this,Je).start();if(b===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(b),(_=(f=A(this,Yt).config).onSuccess)==null||_.call(f,b,this),(p=(m=A(this,Yt).config).onSettled)==null||p.call(m,b,this.state.error,this),b}catch(b){if(b instanceof Ep){if(b.silent)return A(this,Je).promise;if(b.revert){if(this.state.data===void 0)throw b;return this.state.data}}throw nt(this,jt,Kn).call(this,{type:"error",error:b}),(h=(y=A(this,Yt).config).onError)==null||h.call(y,b,this),(x=(v=A(this,Yt).config).onSettled)==null||x.call(v,this.state.data,b,this),b}finally{this.scheduleGc()}}},Bs=new WeakMap,Pi=new WeakMap,qs=new WeakMap,Yt=new WeakMap,Ri=new WeakMap,Je=new WeakMap,Wa=new WeakMap,Ti=new WeakMap,jt=new WeakSet,tS=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Kn=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...dA(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...k_(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ee(this,qs,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),wt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),A(this,Yt).notify({query:this,type:"updated",action:e})})},x0);function dA(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:XE(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function k_(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function P_(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ga,On,dt,Ii,Mn,Pr,b0,fA=(b0=class extends ZE{constructor(e){super();le(this,Mn);le(this,Ga);le(this,On);le(this,dt);le(this,Ii);ee(this,Ga,e.client),this.mutationId=e.mutationId,ee(this,dt,e.mutationCache),ee(this,On,[]),this.state=e.state||hA(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){A(this,On).includes(e)||(A(this,On).push(e),this.clearGcTimeout(),A(this,dt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){ee(this,On,A(this,On).filter(n=>n!==e)),this.scheduleGc(),A(this,dt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){A(this,On).length||(this.state.status==="pending"?this.scheduleGc():A(this,dt).remove(this))}continue(){var e;return((e=A(this,Ii))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,u,c,d,f,_,m,p,y,h,v,x,b,E,S,k;const n=()=>{nt(this,Mn,Pr).call(this,{type:"continue"})},r={client:A(this,Ga),meta:this.options.meta,mutationKey:this.options.mutationKey};ee(this,Ii,JE({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(C,R)=>{nt(this,Mn,Pr).call(this,{type:"failed",failureCount:C,error:R})},onPause:()=>{nt(this,Mn,Pr).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>A(this,dt).canRun(this)}));const i=this.state.status==="pending",s=!A(this,Ii).canStart();try{if(i)n();else{nt(this,Mn,Pr).call(this,{type:"pending",variables:e,isPaused:s}),A(this,dt).config.onMutate&&await A(this,dt).config.onMutate(e,this,r);const R=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));R!==this.state.context&&nt(this,Mn,Pr).call(this,{type:"pending",context:R,variables:e,isPaused:s})}const C=await A(this,Ii).start();return await((u=(l=A(this,dt).config).onSuccess)==null?void 0:u.call(l,C,e,this.state.context,this,r)),await((d=(c=this.options).onSuccess)==null?void 0:d.call(c,C,e,this.state.context,r)),await((_=(f=A(this,dt).config).onSettled)==null?void 0:_.call(f,C,null,this.state.variables,this.state.context,this,r)),await((p=(m=this.options).onSettled)==null?void 0:p.call(m,C,null,e,this.state.context,r)),nt(this,Mn,Pr).call(this,{type:"success",data:C}),C}catch(C){try{await((h=(y=A(this,dt).config).onError)==null?void 0:h.call(y,C,e,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((x=(v=this.options).onError)==null?void 0:x.call(v,C,e,this.state.context,r))}catch(R){Promise.reject(R)}try{await((E=(b=A(this,dt).config).onSettled)==null?void 0:E.call(b,void 0,C,this.state.variables,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((k=(S=this.options).onSettled)==null?void 0:k.call(S,void 0,C,e,this.state.context,r))}catch(R){Promise.reject(R)}throw nt(this,Mn,Pr).call(this,{type:"error",error:C}),C}finally{A(this,dt).runNext(this)}}},Ga=new WeakMap,On=new WeakMap,dt=new WeakMap,Ii=new WeakMap,Mn=new WeakSet,Pr=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),wt.batch(()=>{A(this,On).forEach(r=>{r.onMutationUpdate(e)}),A(this,dt).notify({mutation:this,type:"updated",action:e})})},b0);function hA(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var er,pn,Ka,E0,pA=(E0=class extends Yc{constructor(e={}){super();le(this,er);le(this,pn);le(this,Ka);this.config=e,ee(this,er,new Set),ee(this,pn,new Map),ee(this,Ka,0)}build(e,n,r){const i=new fA({client:e,mutationCache:this,mutationId:++al(this,Ka)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){A(this,er).add(e);const n=Ll(e);if(typeof n=="string"){const r=A(this,pn).get(n);r?r.push(e):A(this,pn).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(A(this,er).delete(e)){const n=Ll(e);if(typeof n=="string"){const r=A(this,pn).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&A(this,pn).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Ll(e);if(typeof n=="string"){const r=A(this,pn).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=Ll(e);if(typeof n=="string"){const i=(r=A(this,pn).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){wt.batch(()=>{A(this,er).forEach(e=>{this.notify({type:"removed",mutation:e})}),A(this,er).clear(),A(this,pn).clear()})}getAll(){return Array.from(A(this,er))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>E_(n,r))}findAll(e={}){return this.getAll().filter(n=>E_(e,n))}notify(e){wt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return wt.batch(()=>Promise.all(e.map(n=>n.continue().catch(hn))))}},er=new WeakMap,pn=new WeakMap,Ka=new WeakMap,E0);function Ll(t){var e;return(e=t.options.scope)==null?void 0:e.id}var An,S0,vA=(S0=class extends Yc{constructor(e={}){super();le(this,An);this.config=e,ee(this,An,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??ng(i,n);let o=this.get(s);return o||(o=new cA({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){A(this,An).has(e.queryHash)||(A(this,An).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=A(this,An).get(e.queryHash);n&&(e.destroy(),n===e&&A(this,An).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){wt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return A(this,An).get(e)}getAll(){return[...A(this,An).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>b_(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>b_(e,r)):n}notify(e){wt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){wt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){wt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},An=new WeakMap,S0),Ue,Fr,Lr,Hs,Ws,jr,Gs,Ks,C0,gA=(C0=class{constructor(t={}){le(this,Ue);le(this,Fr);le(this,Lr);le(this,Hs);le(this,Ws);le(this,jr);le(this,Gs);le(this,Ks);ee(this,Ue,t.queryCache||new vA),ee(this,Fr,t.mutationCache||new pA),ee(this,Lr,t.defaultOptions||{}),ee(this,Hs,new Map),ee(this,Ws,new Map),ee(this,jr,0)}mount(){al(this,jr)._++,A(this,jr)===1&&(ee(this,Gs,GE.subscribe(async t=>{t&&(await this.resumePausedMutations(),A(this,Ue).onFocus())})),ee(this,Ks,vc.subscribe(async t=>{t&&(await this.resumePausedMutations(),A(this,Ue).onOnline())})))}unmount(){var t,e;al(this,jr)._--,A(this,jr)===0&&((t=A(this,Gs))==null||t.call(this),ee(this,Gs,void 0),(e=A(this,Ks))==null||e.call(this),ee(this,Ks,void 0))}isFetching(t){return A(this,Ue).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return A(this,Fr).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=A(this,Ue).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=A(this,Ue).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(xp(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return A(this,Ue).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=A(this,Ue).get(r.queryHash),s=i==null?void 0:i.state.data,o=KM(e,s);if(o!==void 0)return A(this,Ue).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return wt.batch(()=>A(this,Ue).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=A(this,Ue).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=A(this,Ue);wt.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=A(this,Ue);return wt.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=wt.batch(()=>A(this,Ue).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(hn).catch(hn)}invalidateQueries(t,e={}){return wt.batch(()=>(A(this,Ue).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=wt.batch(()=>A(this,Ue).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(hn)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(hn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=A(this,Ue).build(this,e);return n.isStaleByTime(xp(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(hn).catch(hn)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(hn).catch(hn)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return vc.isOnline()?A(this,Fr).resumePausedMutations():Promise.resolve()}getQueryCache(){return A(this,Ue)}getMutationCache(){return A(this,Fr)}getDefaultOptions(){return A(this,Lr)}setDefaultOptions(t){ee(this,Lr,t)}setQueryDefaults(t,e){A(this,Hs).set(za(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...A(this,Hs).values()],n={};return e.forEach(r=>{Ua(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){A(this,Ws).set(za(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...A(this,Ws).values()],n={};return e.forEach(r=>{Ua(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...A(this,Lr).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=ng(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===rg&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...A(this,Lr).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){A(this,Ue).clear(),A(this,Fr).clear()}},Ue=new WeakMap,Fr=new WeakMap,Lr=new WeakMap,Hs=new WeakMap,Ws=new WeakMap,jr=new WeakMap,Gs=new WeakMap,Ks=new WeakMap,C0),nS=g.createContext(void 0),mA=t=>{const e=g.useContext(nS);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},yA=({client:t,children:e})=>(g.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),w.jsx(nS.Provider,{value:t,children:e}));function J(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function R_(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function oi(...t){return e=>{let n=!1;const r=t.map(i=>{const s=R_(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i{const{children:o,...a}=s,l=g.useMemo(()=>a,Object.values(a));return w.jsx(n.Provider,{value:l,children:o})};r.displayName=t+"Provider";function i(s){const o=g.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,i]}function Wi(t,e=[]){let n=[];function r(s,o){const a=g.createContext(o),l=n.length;n=[...n,o];const u=d=>{var h;const{scope:f,children:_,...m}=d,p=((h=f==null?void 0:f[t])==null?void 0:h[l])||a,y=g.useMemo(()=>m,Object.values(m));return w.jsx(p.Provider,{value:y,children:_})};u.displayName=s+"Provider";function c(d,f){var p;const _=((p=f==null?void 0:f[t])==null?void 0:p[l])||a,m=g.useContext(_);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,c]}const i=()=>{const s=n.map(o=>g.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return g.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,wA(i,...e)]}function wA(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:u})=>{const d=l(s)[`__scope${u}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var on=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},xA=kc[" useId ".trim().toString()]||(()=>{}),bA=0;function Fs(t){const[e,n]=g.useState(xA());return on(()=>{n(r=>r??String(bA++))},[t]),e?`radix-${e}`:""}var EA=kc[" useInsertionEffect ".trim().toString()]||on;function Xc({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=SA({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const c=g.useRef(t!==void 0);g.useEffect(()=>{const d=c.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=a},[a,r])}const u=g.useCallback(c=>{var d;if(a){const f=CA(c)?c(t):c;f!==t&&((d=o.current)==null||d.call(o,f))}else s(c)},[a,t,s,o]);return[l,u]}function SA({defaultProp:t,onChange:e}){const[n,r]=g.useState(t),i=g.useRef(n),s=g.useRef(e);return EA(()=>{s.current=e},[e]),g.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function CA(t){return typeof t=="function"}function kA(t){const e=PA(t),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(TA);if(l){const u=l.props.children,c=a.map(d=>d===l?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:d);return w.jsx(e,{...o,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,c):null})}return w.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function PA(t){const e=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=OA(i),a=IA(s,i.props);return i.type!==g.Fragment&&(a.ref=r?oi(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var RA=Symbol("radix.slottable");function TA(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===RA}function IA(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function OA(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var MA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ee=MA.reduce((t,e)=>{const n=kA(`Primitive.${e}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function ig(t,e){t&&el.flushSync(()=>t.dispatchEvent(e))}function Ft(t){const e=g.useRef(t);return g.useEffect(()=>{e.current=t}),g.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function AA(t,e=globalThis==null?void 0:globalThis.document){const n=Ft(t);g.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var NA="DismissableLayer",Cp="dismissableLayer.update",$A="dismissableLayer.pointerDownOutside",FA="dismissableLayer.focusOutside",T_,rS=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jc=g.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,u=g.useContext(rS),[c,d]=g.useState(null),f=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,_]=g.useState({}),m=Xe(e,k=>d(k)),p=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),h=p.indexOf(y),v=c?p.indexOf(c):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,b=v>=h,E=jA(k=>{const C=k.target,R=[...u.branches].some(P=>P.contains(C));!b||R||(i==null||i(k),o==null||o(k),k.defaultPrevented||a==null||a())},f),S=DA(k=>{const C=k.target;[...u.branches].some(P=>P.contains(C))||(s==null||s(k),o==null||o(k),k.defaultPrevented||a==null||a())},f);return AA(k=>{v===u.layers.size-1&&(r==null||r(k),!k.defaultPrevented&&a&&(k.preventDefault(),a()))},f),g.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(T_=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),I_(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=T_)}},[c,f,n,u]),g.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),I_())},[c,u]),g.useEffect(()=>{const k=()=>_({});return document.addEventListener(Cp,k),()=>document.removeEventListener(Cp,k)},[]),w.jsx(Ee.div,{...l,ref:m,style:{pointerEvents:x?b?"auto":"none":void 0,...t.style},onFocusCapture:J(t.onFocusCapture,S.onFocusCapture),onBlurCapture:J(t.onBlurCapture,S.onBlurCapture),onPointerDownCapture:J(t.onPointerDownCapture,E.onPointerDownCapture)})});Jc.displayName=NA;var LA="DismissableLayerBranch",iS=g.forwardRef((t,e)=>{const n=g.useContext(rS),r=g.useRef(null),i=Xe(e,r);return g.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),w.jsx(Ee.div,{...t,ref:i})});iS.displayName=LA;function jA(t,e=globalThis==null?void 0:globalThis.document){const n=Ft(t),r=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){sS($A,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function DA(t,e=globalThis==null?void 0:globalThis.document){const n=Ft(t),r=g.useRef(!1);return g.useEffect(()=>{const i=s=>{s.target&&!r.current&&sS(FA,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function I_(){const t=new CustomEvent(Cp);document.dispatchEvent(t)}function sS(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?ig(i,s):i.dispatchEvent(s)}var zA=Jc,UA=iS,xf="focusScope.autoFocusOnMount",bf="focusScope.autoFocusOnUnmount",O_={bubbles:!1,cancelable:!0},VA="FocusScope",sg=g.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=g.useState(null),u=Ft(i),c=Ft(s),d=g.useRef(null),f=Xe(e,p=>l(p)),_=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let p=function(x){if(_.paused||!a)return;const b=x.target;a.contains(b)?d.current=b:Rr(d.current,{select:!0})},y=function(x){if(_.paused||!a)return;const b=x.relatedTarget;b!==null&&(a.contains(b)||Rr(d.current,{select:!0}))},h=function(x){if(document.activeElement===document.body)for(const E of x)E.removedNodes.length>0&&Rr(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const v=new MutationObserver(h);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),v.disconnect()}}},[r,a,_.paused]),g.useEffect(()=>{if(a){A_.add(_);const p=document.activeElement;if(!a.contains(p)){const h=new CustomEvent(xf,O_);a.addEventListener(xf,u),a.dispatchEvent(h),h.defaultPrevented||(BA(KA(oS(a)),{select:!0}),document.activeElement===p&&Rr(a))}return()=>{a.removeEventListener(xf,u),setTimeout(()=>{const h=new CustomEvent(bf,O_);a.addEventListener(bf,c),a.dispatchEvent(h),h.defaultPrevented||Rr(p??document.body,{select:!0}),a.removeEventListener(bf,c),A_.remove(_)},0)}}},[a,u,c,_]);const m=g.useCallback(p=>{if(!n&&!r||_.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,h=document.activeElement;if(y&&h){const v=p.currentTarget,[x,b]=qA(v);x&&b?!p.shiftKey&&h===b?(p.preventDefault(),n&&Rr(x,{select:!0})):p.shiftKey&&h===x&&(p.preventDefault(),n&&Rr(b,{select:!0})):h===v&&p.preventDefault()}},[n,r,_.paused]);return w.jsx(Ee.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});sg.displayName=VA;function BA(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Rr(r,{select:e}),document.activeElement!==n)return}function qA(t){const e=oS(t),n=M_(e,t),r=M_(e.reverse(),t);return[n,r]}function oS(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function M_(t,e){for(const n of t)if(!HA(n,{upTo:e}))return n}function HA(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function WA(t){return t instanceof HTMLInputElement&&"select"in t}function Rr(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&WA(t)&&e&&t.select()}}var A_=GA();function GA(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=N_(t,e),t.unshift(e)},remove(e){var n;t=N_(t,e),(n=t[0])==null||n.resume()}}}function N_(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function KA(t){return t.filter(e=>e.tagName!=="A")}var QA="Portal",Zc=g.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=g.useState(!1);on(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?OR.createPortal(w.jsx(Ee.div,{...r,ref:e}),o):null});Zc.displayName=QA;function YA(t,e){return g.useReducer((n,r)=>e[n][r]??n,t)}var gr=t=>{const{present:e,children:n}=t,r=XA(e),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=Xe(r.ref,JA(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:s}):null};gr.displayName="Presence";function XA(t){const[e,n]=g.useState(),r=g.useRef(null),i=g.useRef(t),s=g.useRef("none"),o=t?"mounted":"unmounted",[a,l]=YA(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=jl(r.current);s.current=a==="mounted"?u:"none"},[a]),on(()=>{const u=r.current,c=i.current;if(c!==t){const f=s.current,_=jl(u);t?l("MOUNT"):_==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&f!==_?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),on(()=>{if(e){let u;const c=e.ownerDocument.defaultView??window,d=_=>{const p=jl(r.current).includes(CSS.escape(_.animationName));if(_.target===e&&p&&(l("ANIMATION_END"),!i.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",u=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=_=>{_.target===e&&(s.current=jl(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(u),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function jl(t){return(t==null?void 0:t.animationName)||"none"}function JA(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Ef=0;function aS(){g.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??$_()),document.body.insertAdjacentElement("beforeend",t[1]??$_()),Ef++,()=>{Ef===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Ef--}},[])}function $_(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Fn=function(){return Fn=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return vN;var e=gN(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},yN=dS(),Ls="data-scroll-locked",_N=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),` - .`.concat(eN,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(a,"px ").concat(r,`; - } - body[`).concat(Ls,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(i,`px; - padding-top: `).concat(s,`px; - padding-right: `).concat(o,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(a,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(du,` { - right: `).concat(a,"px ").concat(r,`; - } - - .`).concat(fu,` { - margin-right: `).concat(a,"px ").concat(r,`; - } - - .`).concat(du," .").concat(du,` { - right: 0 `).concat(r,`; - } - - .`).concat(fu," .").concat(fu,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Ls,`] { - `).concat(tN,": ").concat(a,`px; - } -`)},L_=function(){var t=parseInt(document.body.getAttribute(Ls)||"0",10);return isFinite(t)?t:0},wN=function(){g.useEffect(function(){return document.body.setAttribute(Ls,(L_()+1).toString()),function(){var t=L_()-1;t<=0?document.body.removeAttribute(Ls):document.body.setAttribute(Ls,t.toString())}},[])},xN=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;wN();var s=g.useMemo(function(){return mN(i)},[i]);return g.createElement(yN,{styles:_N(s,!e,i,n?"":"!important")})},kp=!1;if(typeof window<"u")try{var Dl=Object.defineProperty({},"passive",{get:function(){return kp=!0,!0}});window.addEventListener("test",Dl,Dl),window.removeEventListener("test",Dl,Dl)}catch{kp=!1}var ss=kp?{passive:!1}:!1,bN=function(t){return t.tagName==="TEXTAREA"},fS=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!bN(t)&&n[e]==="visible")},EN=function(t){return fS(t,"overflowY")},SN=function(t){return fS(t,"overflowX")},j_=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=hS(t,r);if(i){var s=pS(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},CN=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},kN=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},hS=function(t,e){return t==="v"?EN(e):SN(e)},pS=function(t,e){return t==="v"?CN(e):kN(e)},PN=function(t,e){return t==="h"&&e==="rtl"?-1:1},RN=function(t,e,n,r,i){var s=PN(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),u=!1,c=o>0,d=0,f=0;do{if(!a)break;var _=pS(t,a),m=_[0],p=_[1],y=_[2],h=p-y-s*m;(m||h)&&hS(t,a)&&(d+=h,f+=m);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(c&&Math.abs(d)<1||!c&&Math.abs(f)<1)&&(u=!0),u},zl=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},D_=function(t){return[t.deltaX,t.deltaY]},z_=function(t){return t&&"current"in t?t.current:t},TN=function(t,e){return t[0]===e[0]&&t[1]===e[1]},IN=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},ON=0,os=[];function MN(t){var e=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(ON++)[0],s=g.useState(dS)[0],o=g.useRef(t);g.useEffect(function(){o.current=t},[t]),g.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var p=ZA([t.lockRef.current],(t.shards||[]).map(z_),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=g.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var h=zl(p),v=n.current,x="deltaX"in p?p.deltaX:v[0]-h[0],b="deltaY"in p?p.deltaY:v[1]-h[1],E,S=p.target,k=Math.abs(x)>Math.abs(b)?"h":"v";if("touches"in p&&k==="h"&&S.type==="range")return!1;var C=window.getSelection(),R=C&&C.anchorNode,P=R?R===S||R.contains(S):!1;if(P)return!1;var $=j_(k,S);if(!$)return!0;if($?E=k:(E=k==="v"?"h":"v",$=j_(k,S)),!$)return!1;if(!r.current&&"changedTouches"in p&&(x||b)&&(r.current=E),!E)return!0;var O=r.current||E;return RN(O,y,p,O==="h"?x:b)},[]),l=g.useCallback(function(p){var y=p;if(!(!os.length||os[os.length-1]!==s)){var h="deltaY"in y?D_(y):zl(y),v=e.current.filter(function(E){return E.name===y.type&&(E.target===y.target||y.target===E.shadowParent)&&TN(E.delta,h)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(z_).filter(Boolean).filter(function(E){return E.contains(y.target)}),b=x.length>0?a(y,x[0]):!o.current.noIsolation;b&&y.cancelable&&y.preventDefault()}}},[]),u=g.useCallback(function(p,y,h,v){var x={name:p,delta:y,target:h,should:v,shadowParent:AN(h)};e.current.push(x),setTimeout(function(){e.current=e.current.filter(function(b){return b!==x})},1)},[]),c=g.useCallback(function(p){n.current=zl(p),r.current=void 0},[]),d=g.useCallback(function(p){u(p.type,D_(p),p.target,a(p,t.lockRef.current))},[]),f=g.useCallback(function(p){u(p.type,zl(p),p.target,a(p,t.lockRef.current))},[]);g.useEffect(function(){return os.push(s),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,ss),document.addEventListener("touchmove",l,ss),document.addEventListener("touchstart",c,ss),function(){os=os.filter(function(p){return p!==s}),document.removeEventListener("wheel",l,ss),document.removeEventListener("touchmove",l,ss),document.removeEventListener("touchstart",c,ss)}},[]);var _=t.removeScrollBar,m=t.inert;return g.createElement(g.Fragment,null,m?g.createElement(s,{styles:IN(i)}):null,_?g.createElement(xN,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function AN(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const NN=lN(cS,MN);var og=g.forwardRef(function(t,e){return g.createElement(ed,Fn({},t,{ref:e,sideCar:NN}))});og.classNames=ed.classNames;var $N=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},as=new WeakMap,Ul=new WeakMap,Vl={},Pf=0,vS=function(t){return t&&(t.host||vS(t.parentNode))},FN=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=vS(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},LN=function(t,e,n,r){var i=FN(e,Array.isArray(t)?t:[t]);Vl[n]||(Vl[n]=new WeakMap);var s=Vl[n],o=[],a=new Set,l=new Set(i),u=function(d){!d||a.has(d)||(a.add(d),u(d.parentNode))};i.forEach(u);var c=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))c(f);else try{var _=f.getAttribute(r),m=_!==null&&_!=="false",p=(as.get(f)||0)+1,y=(s.get(f)||0)+1;as.set(f,p),s.set(f,y),o.push(f),p===1&&m&&Ul.set(f,!0),y===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}catch(h){console.error("aria-hidden: cannot operate on ",f,h)}})};return c(e),a.clear(),Pf++,function(){o.forEach(function(d){var f=as.get(d)-1,_=s.get(d)-1;as.set(d,f),s.set(d,_),f||(Ul.has(d)||d.removeAttribute(r),Ul.delete(d)),_||d.removeAttribute(n)}),Pf--,Pf||(as=new WeakMap,as=new WeakMap,Ul=new WeakMap,Vl={})}},gS=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=$N(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),LN(r,i,n,"aria-hidden")):function(){return null}};function jN(t){const e=DN(t),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(UN);if(l){const u=l.props.children,c=a.map(d=>d===l?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:d);return w.jsx(e,{...o,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,c):null})}return w.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function DN(t){const e=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=BN(i),a=VN(s,i.props);return i.type!==g.Fragment&&(a.ref=r?oi(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var zN=Symbol("radix.slottable");function UN(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===zN}function VN(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function BN(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var td="Dialog",[mS]=Wi(td),[qN,Sn]=mS(td),yS=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=g.useRef(null),l=g.useRef(null),[u,c]=Xc({prop:r,defaultProp:i??!1,onChange:s,caller:td});return w.jsx(qN,{scope:e,triggerRef:a,contentRef:l,contentId:Fs(),titleId:Fs(),descriptionId:Fs(),open:u,onOpenChange:c,onOpenToggle:g.useCallback(()=>c(d=>!d),[c]),modal:o,children:n})};yS.displayName=td;var _S="DialogTrigger",wS=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Sn(_S,n),s=Xe(e,i.triggerRef);return w.jsx(Ee.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ug(i.open),...r,ref:s,onClick:J(t.onClick,i.onOpenToggle)})});wS.displayName=_S;var ag="DialogPortal",[HN,xS]=mS(ag,{forceMount:void 0}),bS=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Sn(ag,e);return w.jsx(HN,{scope:e,forceMount:n,children:g.Children.map(r,o=>w.jsx(gr,{present:n||s.open,children:w.jsx(Zc,{asChild:!0,container:i,children:o})}))})};bS.displayName=ag;var gc="DialogOverlay",ES=g.forwardRef((t,e)=>{const n=xS(gc,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Sn(gc,t.__scopeDialog);return s.modal?w.jsx(gr,{present:r||s.open,children:w.jsx(GN,{...i,ref:e})}):null});ES.displayName=gc;var WN=jN("DialogOverlay.RemoveScroll"),GN=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Sn(gc,n);return w.jsx(og,{as:WN,allowPinchZoom:!0,shards:[i.contentRef],children:w.jsx(Ee.div,{"data-state":ug(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Ui="DialogContent",SS=g.forwardRef((t,e)=>{const n=xS(Ui,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Sn(Ui,t.__scopeDialog);return w.jsx(gr,{present:r||s.open,children:s.modal?w.jsx(KN,{...i,ref:e}):w.jsx(QN,{...i,ref:e})})});SS.displayName=Ui;var KN=g.forwardRef((t,e)=>{const n=Sn(Ui,t.__scopeDialog),r=g.useRef(null),i=Xe(e,n.contentRef,r);return g.useEffect(()=>{const s=r.current;if(s)return gS(s)},[]),w.jsx(CS,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:J(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:J(t.onFocusOutside,s=>s.preventDefault())})}),QN=g.forwardRef((t,e)=>{const n=Sn(Ui,t.__scopeDialog),r=g.useRef(!1),i=g.useRef(!1);return w.jsx(CS,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,u;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),CS=g.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Sn(Ui,n),l=g.useRef(null),u=Xe(e,l);return aS(),w.jsxs(w.Fragment,{children:[w.jsx(sg,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:w.jsx(Jc,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ug(a.open),...o,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),w.jsxs(w.Fragment,{children:[w.jsx(YN,{titleId:a.titleId}),w.jsx(JN,{contentRef:l,descriptionId:a.descriptionId})]})]})}),lg="DialogTitle",kS=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Sn(lg,n);return w.jsx(Ee.h2,{id:i.titleId,...r,ref:e})});kS.displayName=lg;var PS="DialogDescription",RS=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Sn(PS,n);return w.jsx(Ee.p,{id:i.descriptionId,...r,ref:e})});RS.displayName=PS;var TS="DialogClose",IS=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Sn(TS,n);return w.jsx(Ee.button,{type:"button",...r,ref:e,onClick:J(t.onClick,()=>i.onOpenChange(!1))})});IS.displayName=TS;function ug(t){return t?"open":"closed"}var OS="DialogTitleWarning",[m3,MS]=_A(OS,{contentName:Ui,titleName:lg,docsSlug:"dialog"}),YN=({titleId:t})=>{const e=MS(OS),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return g.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},XN="DialogDescriptionWarning",JN=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${MS(XN).contentName}}.`;return g.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},ZN=yS,e$=wS,t$=bS,n$=ES,r$=SS,i$=kS,y3=RS,s$=IS;const U_=t=>t.endsWith("/")?t.slice(0,-1):t;function Gi(t){return["1","true","yes"].includes(String(t??"").trim().toLowerCase())}function cg(){const t="https://paperswithcode.co".trim();if(!t)return"";try{const e=t.startsWith("http")?new URL(t):new URL(t,typeof window<"u"?window.location.origin:"http://localhost");return U_(e.origin)}catch{return U_(t)}}function o$(t){const e=t.startsWith("/")?t:`/${t}`,n=cg();return n?`${n}${e}`:e}function dg(t){const e=t.startsWith("/")?t:`/${t}`;return o$(e)}function AS(t,e={}){const n=dg("/api/v1/auth/hf/login"),i=new URL(n,window.location.origin).origin===window.location.origin?t:new URL(t,window.location.origin).toString(),s=new URLSearchParams({return_to:i});return e.authorizeInference&&s.set("authorize_inference","true"),e.collectEmail&&s.set("collect_email","true"),e.authorizeBucket&&s.set("authorize_bucket","true"),e.bucketCreate&&s.set("bucket_create","true"),`${n}?${s.toString()}`}function a$(){return dg("/admin-dashboard")}function _3(t){if(!t)return null;if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("//"))return t;if(t.startsWith("/")){const e=cg();return e?`${e}${t}`:t}return t}function yo(){return Gi("1")}function Va(){return Gi("0")}const l$="https://paperswithcode.co/chat";function u$(){return yo()&&!Va()}function c$(){return Gi(void 0)}function w3(){return Va()&&Gi(void 0)}function x3(){return Gi("0")}function b3(){return Gi("0")}function E3(){return typeof window<"u"&&window.location.hostname==="staging.paperswithcode.co"}function d$(){return Gi("1")}const f$="/hf-logo.svg?v=20260513b",V_=({size:t=14})=>w.jsx("img",{src:f$,alt:"",width:Math.round(t*95/88),height:t,"aria-hidden":"true",draggable:!1,style:{display:"block"}});function S3(t,e=!1){return AS(t,{authorizeInference:e})}const NS=({returnTo:t,compact:e=!1,label:n="Sign in",authorizeInference:r=!1,collectEmail:i=!1})=>{if(yo())return null;const s=()=>{window.location.href=AS(t,{authorizeInference:r,collectEmail:i})};return e?w.jsx("button",{type:"button",className:"icon-btn","aria-label":"Sign in with Hugging Face",title:"Sign in with Hugging Face",onClick:s,children:w.jsx(V_,{size:16})}):w.jsxs("button",{type:"button",className:"hf-signin-btn",onClick:s,"aria-label":"Sign in with Hugging Face",children:[w.jsx(V_,{size:18}),w.jsx("span",{children:n})]})};function h$(t,e=[]){let n=[];function r(s,o){const a=g.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const u=d=>{var h;const{scope:f,children:_,...m}=d,p=((h=f==null?void 0:f[t])==null?void 0:h[l])||a,y=g.useMemo(()=>m,Object.values(m));return w.jsx(p.Provider,{value:y,children:_})};u.displayName=s+"Provider";function c(d,f){var p;const _=((p=f==null?void 0:f[t])==null?void 0:p[l])||a,m=g.useContext(_);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,c]}const i=()=>{const s=n.map(o=>g.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return g.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,p$(i,...e)]}function p$(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:u})=>{const d=l(s)[`__scope${u}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var v$=Symbol.for("react.lazy"),mc=kc[" use ".trim().toString()];function g$(t){return typeof t=="object"&&t!==null&&"then"in t}function $S(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===v$&&"_payload"in t&&g$(t._payload)}function FS(t){const e=m$(t),n=g.forwardRef((r,i)=>{let{children:s,...o}=r;$S(s)&&typeof mc=="function"&&(s=mc(s._payload));const a=g.Children.toArray(s),l=a.find(_$);if(l){const u=l.props.children,c=a.map(d=>d===l?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:d);return w.jsx(e,{...o,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,c):null})}return w.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var C3=FS("Slot");function m$(t){const e=g.forwardRef((n,r)=>{let{children:i,...s}=n;if($S(i)&&typeof mc=="function"&&(i=mc(i._payload)),g.isValidElement(i)){const o=x$(i),a=w$(s,i.props);return i.type!==g.Fragment&&(a.ref=r?oi(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var y$=Symbol("radix.slottable");function _$(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===y$}function w$(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function x$(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var b$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fg=b$.reduce((t,e)=>{const n=FS(`Primitive.${e}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),LS={exports:{}},jS={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var fo=g;function E$(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var S$=typeof Object.is=="function"?Object.is:E$,C$=fo.useState,k$=fo.useEffect,P$=fo.useLayoutEffect,R$=fo.useDebugValue;function T$(t,e){var n=e(),r=C$({inst:{value:n,getSnapshot:e}}),i=r[0].inst,s=r[1];return P$(function(){i.value=n,i.getSnapshot=e,Rf(i)&&s({inst:i})},[t,n,e]),k$(function(){return Rf(i)&&s({inst:i}),t(function(){Rf(i)&&s({inst:i})})},[t]),R$(n),n}function Rf(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!S$(t,n)}catch{return!0}}function I$(t,e){return e()}var O$=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?I$:T$;jS.useSyncExternalStore=fo.useSyncExternalStore!==void 0?fo.useSyncExternalStore:O$;LS.exports=jS;var M$=LS.exports;function A$(){return M$.useSyncExternalStore(N$,()=>!0,()=>!1)}function N$(){return()=>{}}var hg="Avatar",[$$]=h$(hg),[F$,DS]=$$(hg),zS=g.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[i,s]=g.useState("idle");return w.jsx(F$,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:w.jsx(fg.span,{...r,ref:e})})});zS.displayName=hg;var US="AvatarImage",VS=g.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...s}=t,o=DS(US,n),a=L$(r,s),l=Ft(u=>{i(u),o.onImageLoadingStatusChange(u)});return on(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?w.jsx(fg.img,{...s,ref:e,src:r}):null});VS.displayName=US;var BS="AvatarFallback",qS=g.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...i}=t,s=DS(BS,n),[o,a]=g.useState(r===void 0);return g.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),o&&s.imageLoadingStatus!=="loaded"?w.jsx(fg.span,{...i,ref:e}):null});qS.displayName=BS;function B_(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function L$(t,{referrerPolicy:e,crossOrigin:n}){const r=A$(),i=g.useRef(null),s=r?(i.current||(i.current=new window.Image),i.current):null,[o,a]=g.useState(()=>B_(s,t));return on(()=>{a(B_(s,t))},[s,t]),on(()=>{const l=d=>()=>{a(d)};if(!s)return;const u=l("loaded"),c=l("error");return s.addEventListener("load",u),s.addEventListener("error",c),e&&(s.referrerPolicy=e),typeof n=="string"&&(s.crossOrigin=n),()=>{s.removeEventListener("load",u),s.removeEventListener("error",c)}},[s,n,e]),o}var HS=zS,WS=VS,GS=qS;function KS(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=z$(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(pg);return a[0]===""&&a.length!==1&&a.shift(),YS(a,e)||D$(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},YS=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?YS(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(pg);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},q_=/^\[(.+)\]$/,D$=t=>{if(q_.test(t)){const e=q_.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},z$=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return V$(Object.entries(t.classGroups),n).forEach(([s,o])=>{Pp(o,r,s,e)}),r},Pp=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:H_(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(U$(i)){Pp(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{Pp(o,H_(e,s),n,r)})})},H_=(t,e)=>{let n=t;return e.split(pg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},U$=t=>t.isThemeGetter,V$=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[n,i]}):t,B$=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},XS="!",q$=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=a=>{const l=[];let u=0,c=0,d;for(let y=0;yc?d-c:void 0;return{modifiers:l,hasImportantModifier:_,baseClassName:m,maybePostfixModifierPosition:p}};return n?a=>n({className:a,parseClassName:o}):o},H$=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},W$=t=>({cache:B$(t.cacheSize),parseClassName:q$(t),...j$(t)}),G$=/\s+/,K$=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(G$);let a="";for(let l=o.length-1;l>=0;l-=1){const u=o[l],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:_}=n(u);let m=!!_,p=r(m?f.substring(0,_):f);if(!p){if(!m){a=u+(a.length>0?" "+a:a);continue}if(p=r(f),!p){a=u+(a.length>0?" "+a:a);continue}m=!1}const y=H$(c).join(":"),h=d?y+XS:y,v=h+p;if(s.includes(v))continue;s.push(v);const x=i(p,m);for(let b=0;b0?" "+a:a)}return a};function Q$(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rd(c),t());return n=W$(u),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const u=r(l);if(u)return u;const c=K$(l,n);return i(l,c),c}return function(){return s(Q$.apply(null,arguments))}}const Re=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},ZS=/^\[(?:([a-z-]+):)?(.+)\]$/i,X$=/^\d+\/\d+$/,J$=new Set(["px","full","screen"]),Z$=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,eF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,nF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wn=t=>js(t)||J$.has(t)||X$.test(t),Sr=t=>_o(t,"length",dF),js=t=>!!t&&!Number.isNaN(Number(t)),Tf=t=>_o(t,"number",js),zo=t=>!!t&&Number.isInteger(Number(t)),iF=t=>t.endsWith("%")&&js(t.slice(0,-1)),re=t=>ZS.test(t),Cr=t=>Z$.test(t),sF=new Set(["length","size","percentage"]),oF=t=>_o(t,sF,e1),aF=t=>_o(t,"position",e1),lF=new Set(["image","url"]),uF=t=>_o(t,lF,hF),cF=t=>_o(t,"",fF),Uo=()=>!0,_o=(t,e,n)=>{const r=ZS.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},dF=t=>eF.test(t)&&!tF.test(t),e1=()=>!1,fF=t=>nF.test(t),hF=t=>rF.test(t),pF=()=>{const t=Re("colors"),e=Re("spacing"),n=Re("blur"),r=Re("brightness"),i=Re("borderColor"),s=Re("borderRadius"),o=Re("borderSpacing"),a=Re("borderWidth"),l=Re("contrast"),u=Re("grayscale"),c=Re("hueRotate"),d=Re("invert"),f=Re("gap"),_=Re("gradientColorStops"),m=Re("gradientColorStopPositions"),p=Re("inset"),y=Re("margin"),h=Re("opacity"),v=Re("padding"),x=Re("saturate"),b=Re("scale"),E=Re("sepia"),S=Re("skew"),k=Re("space"),C=Re("translate"),R=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",re,e],O=()=>[re,e],U=()=>["",Wn,Sr],L=()=>["auto",js,re],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>["start","end","center","between","around","evenly","stretch"],M=()=>["","0",re],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>[js,re];return{cacheSize:500,separator:":",theme:{colors:[Uo],spacing:[Wn,Sr],blur:["none","",Cr,re],brightness:G(),borderColor:[t],borderRadius:["none","","full",Cr,re],borderSpacing:O(),borderWidth:U(),contrast:G(),grayscale:M(),hueRotate:G(),invert:M(),gap:O(),gradientColorStops:[t],gradientColorStopPositions:[iF,Sr],inset:$(),margin:$(),opacity:G(),padding:O(),saturate:G(),scale:G(),sepia:M(),skew:G(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",re]}],container:["container"],columns:[{columns:[Cr]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),re]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",zo,re]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",re]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",zo,re]}],"grid-cols":[{"grid-cols":[Uo]}],"col-start-end":[{col:["auto",{span:["full",zo,re]},re]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Uo]}],"row-start-end":[{row:["auto",{span:[zo,re]},re]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",re]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",re]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...I()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...I(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...I(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",re,e]}],"min-w":[{"min-w":[re,e,"min","max","fit"]}],"max-w":[{"max-w":[re,e,"none","full","min","max","fit","prose",{screen:[Cr]},Cr]}],h:[{h:[re,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[re,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[re,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[re,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Cr,Sr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Tf]}],"font-family":[{font:[Uo]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",re]}],"line-clamp":[{"line-clamp":["none",js,Tf]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Wn,re]}],"list-image":[{"list-image":["none",re]}],"list-style-type":[{list:["none","disc","decimal",re]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[h]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Wn,Sr]}],"underline-offset":[{"underline-offset":["auto",Wn,re]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[h]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),aF]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",oF]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},uF]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[_]}],"gradient-via":[{via:[_]}],"gradient-to":[{to:[_]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[h]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[h]}],"divide-style":[{divide:q()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[Wn,re]}],"outline-w":[{outline:[Wn,Sr]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[h]}],"ring-offset-w":[{"ring-offset":[Wn,Sr]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Cr,cF]}],"shadow-color":[{shadow:[Uo]}],opacity:[{opacity:[h]}],"mix-blend":[{"mix-blend":[...K(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":K()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Cr,re]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[x]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[h]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",re]}],duration:[{duration:G()}],ease:[{ease:["linear","in","out","in-out",re]}],delay:[{delay:G()}],animate:[{animate:["none","spin","ping","pulse","bounce",re]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[zo,re]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",re]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",re]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",re]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Wn,Sr,Tf]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},vF=Y$(pF);function at(...t){return vF(QS(t))}function k3(t){return t.replace(/v\d+$/i,"")}function P3(t){const e=t.trim(),n=e.match(/^(\d{4})-(\d{4,5})(v\d+)?$/);if(n)return`${n[1]}.${n[2]}`;const r=e.match(/^(\d{4}\.\d{4,5})(v\d+)$/);return r?r[1]:e}function R3(t){if(t==null||t==="")return"—";const e=typeof t=="string"?parseFloat(t):t;return Number.isFinite(e)?Math.abs(e)>=100?Bl(e,0):Math.abs(e)>=10?Bl(e,1):Math.abs(e)<1?Bl(e,3):Bl(e,2):String(t)}function Bl(t,e){const n=String(Math.abs(t));if(n.includes("e"))return t.toFixed(e);const r=+`${Math.round(+`${n}e${e}`)}e-${e}`;return(t<0?-r:r).toFixed(e)}const t1=g.forwardRef(({className:t,...e},n)=>w.jsx(HS,{ref:n,className:at("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));t1.displayName=HS.displayName;const n1=g.forwardRef(({className:t,...e},n)=>w.jsx(WS,{ref:n,className:at("aspect-square h-full w-full",t),...e}));n1.displayName=WS.displayName;const r1=g.forwardRef(({className:t,...e},n)=>w.jsx(GS,{ref:n,className:at("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));r1.displayName=GS.displayName;function W_(t){const e=gF(t),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(yF);if(l){const u=l.props.children,c=a.map(d=>d===l?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:d);return w.jsx(e,{...o,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,c):null})}return w.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function gF(t){const e=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=wF(i),a=_F(s,i.props);return i.type!==g.Fragment&&(a.ref=r?oi(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var mF=Symbol("radix.slottable");function yF(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===mF}function _F(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function wF(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function vg(t){const e=t+"CollectionProvider",[n,r]=Wi(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:y,children:h}=p,v=V.useRef(null),x=V.useRef(new Map).current;return w.jsx(i,{scope:y,itemMap:x,collectionRef:v,children:h})};o.displayName=e;const a=t+"CollectionSlot",l=W_(a),u=V.forwardRef((p,y)=>{const{scope:h,children:v}=p,x=s(a,h),b=Xe(y,x.collectionRef);return w.jsx(l,{ref:b,children:v})});u.displayName=a;const c=t+"CollectionItemSlot",d="data-radix-collection-item",f=W_(c),_=V.forwardRef((p,y)=>{const{scope:h,children:v,...x}=p,b=V.useRef(null),E=Xe(y,b),S=s(c,h);return V.useEffect(()=>(S.itemMap.set(b,{ref:b,...x}),()=>void S.itemMap.delete(b))),w.jsx(f,{[d]:"",ref:E,children:v})});_.displayName=c;function m(p){const y=s(t+"CollectionConsumer",p);return V.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((S,k)=>x.indexOf(S.ref.current)-x.indexOf(k.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:u,ItemSlot:_},m,r]}var xF=g.createContext(void 0);function i1(t){const e=g.useContext(xF);return t||e||"ltr"}const bF=["top","right","bottom","left"],ti=Math.min,zt=Math.max,yc=Math.round,ql=Math.floor,Un=t=>({x:t,y:t}),EF={left:"right",right:"left",bottom:"top",top:"bottom"};function Rp(t,e,n){return zt(t,ti(e,n))}function fr(t,e){return typeof t=="function"?t(e):t}function hr(t){return t.split("-")[0]}function wo(t){return t.split("-")[1]}function gg(t){return t==="x"?"y":"x"}function mg(t){return t==="y"?"height":"width"}function jn(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function yg(t){return gg(jn(t))}function SF(t,e,n){n===void 0&&(n=!1);const r=wo(t),i=yg(t),s=mg(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=_c(o)),[o,_c(o)]}function CF(t){const e=_c(t);return[Tp(t),e,Tp(e)]}function Tp(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const G_=["left","right"],K_=["right","left"],kF=["top","bottom"],PF=["bottom","top"];function RF(t,e,n){switch(t){case"top":case"bottom":return n?e?K_:G_:e?G_:K_;case"left":case"right":return e?kF:PF;default:return[]}}function TF(t,e,n,r){const i=wo(t);let s=RF(hr(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Tp)))),s}function _c(t){const e=hr(t);return EF[e]+t.slice(e.length)}function IF(t){return{top:0,right:0,bottom:0,left:0,...t}}function s1(t){return typeof t!="number"?IF(t):{top:t,right:t,bottom:t,left:t}}function wc(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function Q_(t,e,n){let{reference:r,floating:i}=t;const s=jn(e),o=yg(e),a=mg(o),l=hr(e),u=s==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let _;switch(l){case"top":_={x:c,y:r.y-i.height};break;case"bottom":_={x:c,y:r.y+r.height};break;case"right":_={x:r.x+r.width,y:d};break;case"left":_={x:r.x-i.width,y:d};break;default:_={x:r.x,y:r.y}}switch(wo(e)){case"start":_[o]-=f*(n&&u?-1:1);break;case"end":_[o]+=f*(n&&u?-1:1);break}return _}async function OF(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:_=0}=fr(e,t),m=s1(_),y=a[f?d==="floating"?"reference":"floating":d],h=wc(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),v=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},E=wc(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:l}):v);return{top:(h.top-E.top+m.top)/b.y,bottom:(E.bottom-h.bottom+m.bottom)/b.y,left:(h.left-E.left+m.left)/b.x,right:(E.right-h.right+m.right)/b.x}}const MF=50,AF=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:OF},l=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:d}=Q_(u,r,l),f=r,_=0;const m={};for(let p=0;p({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:u,padding:c=0}=fr(t,e)||{};if(u==null)return{};const d=s1(c),f={x:n,y:r},_=yg(i),m=mg(_),p=await o.getDimensions(u),y=_==="y",h=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",b=s.reference[m]+s.reference[_]-f[_]-s.floating[m],E=f[_]-s.reference[_],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let k=S?S[x]:0;(!k||!await(o.isElement==null?void 0:o.isElement(S)))&&(k=a.floating[x]||s.floating[m]);const C=b/2-E/2,R=k/2-p[m]/2-1,P=ti(d[h],R),$=ti(d[v],R),O=P,U=k-p[m]-$,L=k/2-p[m]/2+C,H=Rp(O,L,U),q=!l.arrow&&wo(i)!=null&&L!==H&&s.reference[m]/2-(LL<=0)){var $,O;const L=((($=s.flip)==null?void 0:$.index)||0)+1,H=k[L];if(H&&(!(d==="alignment"?v!==jn(H):!1)||P.every(I=>jn(I.placement)===v?I.overflows[0]>0:!0)))return{data:{index:L,overflows:P},reset:{placement:H}};let q=(O=P.filter(K=>K.overflows[0]<=0).sort((K,I)=>K.overflows[1]-I.overflows[1])[0])==null?void 0:O.placement;if(!q)switch(_){case"bestFit":{var U;const K=(U=P.filter(I=>{if(S){const M=jn(I.placement);return M===v||M==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(M=>M>0).reduce((M,B)=>M+B,0)]).sort((I,M)=>I[1]-M[1])[0])==null?void 0:U[0];K&&(q=K);break}case"initialPlacement":q=a;break}if(i!==q)return{reset:{placement:q}}}return{}}}};function Y_(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function X_(t){return bF.some(e=>t[e]>=0)}const FF=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=fr(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=Y_(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:X_(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=Y_(o,n.floating);return{data:{escapedOffsets:a,escaped:X_(a)}}}default:return{}}}}},o1=new Set(["left","top"]);async function LF(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=hr(n),a=wo(n),l=jn(n)==="y",u=o1.has(o)?-1:1,c=s&&l?-1:1,d=fr(e,t);let{mainAxis:f,crossAxis:_,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(_=a==="end"?m*-1:m),l?{x:_*c,y:f*u}:{x:f*u,y:_*c}}const jF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await LF(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},DF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:h=>{let{x:v,y:x}=h;return{x:v,y:x}}},...u}=fr(t,e),c={x:n,y:r},d=await s.detectOverflow(e,u),f=jn(hr(i)),_=gg(f);let m=c[_],p=c[f];if(o){const h=_==="y"?"top":"left",v=_==="y"?"bottom":"right",x=m+d[h],b=m-d[v];m=Rp(x,m,b)}if(a){const h=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=p+d[h],b=p-d[v];p=Rp(x,p,b)}const y=l.fn({...e,[_]:m,[f]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[_]:o,[f]:a}}}}}},zF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=fr(t,e),c={x:n,y:r},d=jn(i),f=gg(d);let _=c[f],m=c[d];const p=fr(a,e),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const x=f==="y"?"height":"width",b=s.reference[f]-s.floating[x]+y.mainAxis,E=s.reference[f]+s.reference[x]-y.mainAxis;_E&&(_=E)}if(u){var h,v;const x=f==="y"?"width":"height",b=o1.has(hr(i)),E=s.reference[d]-s.floating[x]+(b&&((h=o.offset)==null?void 0:h[d])||0)+(b?0:y.crossAxis),S=s.reference[d]+s.reference[x]+(b?0:((v=o.offset)==null?void 0:v[d])||0)-(b?y.crossAxis:0);mS&&(m=S)}return{[f]:_,[d]:m}}}},UF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...u}=fr(t,e),c=await o.detectOverflow(e,u),d=hr(i),f=wo(i),_=jn(i)==="y",{width:m,height:p}=s.floating;let y,h;d==="top"||d==="bottom"?(y=d,h=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(h=d,y=f==="end"?"top":"bottom");const v=p-c.top-c.bottom,x=m-c.left-c.right,b=ti(p-c[y],v),E=ti(m-c[h],x),S=!e.middlewareData.shift;let k=b,C=E;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(C=x),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(k=v),S&&!f){const P=zt(c.left,0),$=zt(c.right,0),O=zt(c.top,0),U=zt(c.bottom,0);_?C=m-2*(P!==0||$!==0?P+$:zt(c.left,c.right)):k=p-2*(O!==0||U!==0?O+U:zt(c.top,c.bottom))}await l({...e,availableWidth:C,availableHeight:k});const R=await o.getDimensions(a.floating);return m!==R.width||p!==R.height?{reset:{rects:!0}}:{}}}};function nd(){return typeof window<"u"}function xo(t){return a1(t)?(t.nodeName||"").toLowerCase():"#document"}function Ht(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Bn(t){var e;return(e=(a1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function a1(t){return nd()?t instanceof Node||t instanceof Ht(t).Node:!1}function bn(t){return nd()?t instanceof Element||t instanceof Ht(t).Element:!1}function mr(t){return nd()?t instanceof HTMLElement||t instanceof Ht(t).HTMLElement:!1}function J_(t){return!nd()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ht(t).ShadowRoot}function nl(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=En(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function VF(t){return/^(table|td|th)$/.test(xo(t))}function rd(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const BF=/transform|translate|scale|rotate|perspective|filter/,qF=/paint|layout|strict|content/,fi=t=>!!t&&t!=="none";let If;function _g(t){const e=bn(t)?En(t):t;return fi(e.transform)||fi(e.translate)||fi(e.scale)||fi(e.rotate)||fi(e.perspective)||!wg()&&(fi(e.backdropFilter)||fi(e.filter))||BF.test(e.willChange||"")||qF.test(e.contain||"")}function HF(t){let e=ni(t);for(;mr(e)&&!ho(e);){if(_g(e))return e;if(rd(e))return null;e=ni(e)}return null}function wg(){return If==null&&(If=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),If}function ho(t){return/^(html|body|#document)$/.test(xo(t))}function En(t){return Ht(t).getComputedStyle(t)}function id(t){return bn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ni(t){if(xo(t)==="html")return t;const e=t.assignedSlot||t.parentNode||J_(t)&&t.host||Bn(t);return J_(e)?e.host:e}function l1(t){const e=ni(t);return ho(e)?t.ownerDocument?t.ownerDocument.body:t.body:mr(e)&&nl(e)?e:l1(e)}function Ba(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=l1(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=Ht(i);if(s){const a=Ip(o);return e.concat(o,o.visualViewport||[],nl(i)?i:[],a&&n?Ba(a):[])}else return e.concat(i,Ba(i,[],n))}function Ip(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function u1(t){const e=En(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=mr(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=yc(n)!==s||yc(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function xg(t){return bn(t)?t:t.contextElement}function Ds(t){const e=xg(t);if(!mr(e))return Un(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=u1(e);let o=(s?yc(n.width):n.width)/r,a=(s?yc(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const WF=Un(0);function c1(t){const e=Ht(t);return!wg()||!e.visualViewport?WF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function GF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ht(t)?!1:e}function Vi(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=xg(t);let o=Un(1);e&&(r?bn(r)&&(o=Ds(r)):o=Ds(t));const a=GF(s,n,r)?c1(s):Un(0);let l=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,c=i.width/o.x,d=i.height/o.y;if(s){const f=Ht(s),_=r&&bn(r)?Ht(r):r;let m=f,p=Ip(m);for(;p&&r&&_!==m;){const y=Ds(p),h=p.getBoundingClientRect(),v=En(p),x=h.left+(p.clientLeft+parseFloat(v.paddingLeft))*y.x,b=h.top+(p.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,u*=y.y,c*=y.x,d*=y.y,l+=x,u+=b,m=Ht(p),p=Ip(m)}}return wc({width:c,height:d,x:l,y:u})}function sd(t,e){const n=id(t).scrollLeft;return e?e.left+n:Vi(Bn(t)).left+n}function d1(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-sd(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function KF(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Bn(r),a=e?rd(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=Un(1);const c=Un(0),d=mr(r);if((d||!d&&!s)&&((xo(r)!=="body"||nl(o))&&(l=id(r)),d)){const _=Vi(r);u=Ds(r),c.x=_.x+r.clientLeft,c.y=_.y+r.clientTop}const f=o&&!d&&!s?d1(o,l):Un(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+f.x,y:n.y*u.y-l.scrollTop*u.y+c.y+f.y}}function QF(t){return Array.from(t.getClientRects())}function YF(t){const e=Bn(t),n=id(t),r=t.ownerDocument.body,i=zt(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=zt(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+sd(t);const a=-n.scrollTop;return En(r).direction==="rtl"&&(o+=zt(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Z_=25;function XF(t,e){const n=Ht(t),r=Bn(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=wg();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const u=sd(r);if(u<=0){const c=r.ownerDocument,d=c.body,f=getComputedStyle(d),_=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-_);m<=Z_&&(s-=m)}else u<=Z_&&(s+=u);return{width:s,height:o,x:a,y:l}}function JF(t,e){const n=Vi(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=mr(t)?Ds(t):Un(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,u=r*s.y;return{width:o,height:a,x:l,y:u}}function e0(t,e,n){let r;if(e==="viewport")r=XF(t,n);else if(e==="document")r=YF(Bn(t));else if(bn(e))r=JF(e,n);else{const i=c1(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return wc(r)}function f1(t,e){const n=ni(t);return n===e||!bn(n)||ho(n)?!1:En(n).position==="fixed"||f1(n,e)}function ZF(t,e){const n=e.get(t);if(n)return n;let r=Ba(t,[],!1).filter(a=>bn(a)&&xo(a)!=="body"),i=null;const s=En(t).position==="fixed";let o=s?ni(t):t;for(;bn(o)&&!ho(o);){const a=En(o),l=_g(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||nl(o)&&!l&&f1(t,o))?r=r.filter(c=>c!==o):i=a,o=ni(o)}return e.set(t,r),r}function eL(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?rd(e)?[]:ZF(e,this._c):[].concat(n),r],a=e0(e,o[0],i);let l=a.top,u=a.right,c=a.bottom,d=a.left;for(let f=1;f{o(!1,1e-7)},1e3)}k===1&&!p1(u,t.getBoundingClientRect())&&o(),b=!1}try{n=new IntersectionObserver(E,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(E,x)}n.observe(t)}return o(!0),s}function aL(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=xg(t),c=i||s?[...u?Ba(u):[],...e?Ba(e):[]]:[];c.forEach(h=>{i&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const d=u&&a?oL(u,n):null;let f=-1,_=null;o&&(_=new ResizeObserver(h=>{let[v]=h;v&&v.target===u&&_&&e&&(_.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=_)==null||x.observe(e)})),n()}),u&&!l&&_.observe(u),e&&_.observe(e));let m,p=l?Vi(t):null;l&&y();function y(){const h=Vi(t);p&&!p1(p,h)&&n(),p=h,m=requestAnimationFrame(y)}return n(),()=>{var h;c.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),d==null||d(),(h=_)==null||h.disconnect(),_=null,l&&cancelAnimationFrame(m)}}const lL=jF,uL=DF,cL=$F,dL=UF,fL=FF,n0=NF,hL=zF,pL=(t,e,n)=>{const r=new Map,i={platform:sL,...n},s={...i.platform,_c:r};return AF(t,e,{...i,platform:s})};var vL=typeof document<"u",gL=function(){},hu=vL?g.useLayoutEffect:gL;function xc(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!xc(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!xc(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function v1(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function r0(t,e){const n=v1(t);return Math.round(e*n)/n}function Mf(t){const e=g.useRef(t);return hu(()=>{e.current=t}),e}function mL(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:u}=t,[c,d]=g.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,_]=g.useState(r);xc(f,r)||_(r);const[m,p]=g.useState(null),[y,h]=g.useState(null),v=g.useCallback(I=>{I!==S.current&&(S.current=I,p(I))},[]),x=g.useCallback(I=>{I!==k.current&&(k.current=I,h(I))},[]),b=s||m,E=o||y,S=g.useRef(null),k=g.useRef(null),C=g.useRef(c),R=l!=null,P=Mf(l),$=Mf(i),O=Mf(u),U=g.useCallback(()=>{if(!S.current||!k.current)return;const I={placement:e,strategy:n,middleware:f};$.current&&(I.platform=$.current),pL(S.current,k.current,I).then(M=>{const B={...M,isPositioned:O.current!==!1};L.current&&!xc(C.current,B)&&(C.current=B,el.flushSync(()=>{d(B)}))})},[f,e,n,$,O]);hu(()=>{u===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(I=>({...I,isPositioned:!1})))},[u]);const L=g.useRef(!1);hu(()=>(L.current=!0,()=>{L.current=!1}),[]),hu(()=>{if(b&&(S.current=b),E&&(k.current=E),b&&E){if(P.current)return P.current(b,E,U);U()}},[b,E,U,P,R]);const H=g.useMemo(()=>({reference:S,floating:k,setReference:v,setFloating:x}),[v,x]),q=g.useMemo(()=>({reference:b,floating:E}),[b,E]),K=g.useMemo(()=>{const I={position:n,left:0,top:0};if(!q.floating)return I;const M=r0(q.floating,c.x),B=r0(q.floating,c.y);return a?{...I,transform:"translate("+M+"px, "+B+"px)",...v1(q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:B}},[n,a,q.floating,c.x,c.y]);return g.useMemo(()=>({...c,update:U,refs:H,elements:q,floatingStyles:K}),[c,U,H,q,K])}const yL=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?n0({element:r.current,padding:i}).fn(n):{}:r?n0({element:r,padding:i}).fn(n):{}}}},_L=(t,e)=>{const n=lL(t);return{name:n.name,fn:n.fn,options:[t,e]}},wL=(t,e)=>{const n=uL(t);return{name:n.name,fn:n.fn,options:[t,e]}},xL=(t,e)=>({fn:hL(t).fn,options:[t,e]}),bL=(t,e)=>{const n=cL(t);return{name:n.name,fn:n.fn,options:[t,e]}},EL=(t,e)=>{const n=dL(t);return{name:n.name,fn:n.fn,options:[t,e]}},SL=(t,e)=>{const n=fL(t);return{name:n.name,fn:n.fn,options:[t,e]}},CL=(t,e)=>{const n=yL(t);return{name:n.name,fn:n.fn,options:[t,e]}};var kL="Arrow",g1=g.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return w.jsx(Ee.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});g1.displayName=kL;var PL=g1;function RL(t){const[e,n]=g.useState(void 0);return on(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;o=u.inlineSize,a=u.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var bg="Popper",[m1,y1]=Wi(bg),[TL,_1]=m1(bg),w1=t=>{const{__scopePopper:e,children:n}=t,[r,i]=g.useState(null);return w.jsx(TL,{scope:e,anchor:r,onAnchorChange:i,children:n})};w1.displayName=bg;var x1="PopperAnchor",b1=g.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=_1(x1,n),o=g.useRef(null),a=Xe(e,o),l=g.useRef(null);return g.useEffect(()=>{const u=l.current;l.current=(r==null?void 0:r.current)||o.current,u!==l.current&&s.onAnchorChange(l.current)}),r?null:w.jsx(Ee.div,{...i,ref:a})});b1.displayName=x1;var Eg="PopperContent",[IL,OL]=m1(Eg),E1=g.forwardRef((t,e)=>{var ze,ve,Ae,kt,yr,gt;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:_="optimized",onPlaced:m,...p}=t,y=_1(Eg,n),[h,v]=g.useState(null),x=Xe(e,Ge=>v(Ge)),[b,E]=g.useState(null),S=RL(b),k=(S==null?void 0:S.width)??0,C=(S==null?void 0:S.height)??0,R=r+(s!=="center"?"-"+s:""),P=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},$=Array.isArray(u)?u:[u],O=$.length>0,U={padding:P,boundary:$.filter(AL),altBoundary:O},{refs:L,floatingStyles:H,placement:q,isPositioned:K,middlewareData:I}=mL({strategy:"fixed",placement:R,whileElementsMounted:(...Ge)=>aL(...Ge,{animationFrame:_==="always"}),elements:{reference:y.anchor},middleware:[_L({mainAxis:i+C,alignmentAxis:o}),l&&wL({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?xL():void 0,...U}),l&&bL({...U}),EL({...U,apply:({elements:Ge,rects:ai,availableWidth:Yi,availableHeight:Pt})=>{const{width:Xi,height:_r}=ai.reference,ln=Ge.floating.style;ln.setProperty("--radix-popper-available-width",`${Yi}px`),ln.setProperty("--radix-popper-available-height",`${Pt}px`),ln.setProperty("--radix-popper-anchor-width",`${Xi}px`),ln.setProperty("--radix-popper-anchor-height",`${_r}px`)}}),b&&CL({element:b,padding:a}),NL({arrowWidth:k,arrowHeight:C}),f&&SL({strategy:"referenceHidden",...U})]}),[M,B]=k1(q),G=Ft(m);on(()=>{K&&(G==null||G())},[K,G]);const Z=(ze=I.arrow)==null?void 0:ze.x,se=(ve=I.arrow)==null?void 0:ve.y,ce=((Ae=I.arrow)==null?void 0:Ae.centerOffset)!==0,[_e,Se]=g.useState();return on(()=>{h&&Se(window.getComputedStyle(h).zIndex)},[h]),w.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:K?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:_e,"--radix-popper-transform-origin":[(kt=I.transformOrigin)==null?void 0:kt.x,(yr=I.transformOrigin)==null?void 0:yr.y].join(" "),...((gt=I.hide)==null?void 0:gt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:w.jsx(IL,{scope:n,placedSide:M,onArrowChange:E,arrowX:Z,arrowY:se,shouldHideArrow:ce,children:w.jsx(Ee.div,{"data-side":M,"data-align":B,...p,ref:x,style:{...p.style,animation:K?void 0:"none"}})})})});E1.displayName=Eg;var S1="PopperArrow",ML={top:"bottom",right:"left",bottom:"top",left:"right"},C1=g.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=OL(S1,r),o=ML[s.placedSide];return w.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:w.jsx(PL,{...i,ref:n,style:{...i.style,display:"block"}})})});C1.displayName=S1;function AL(t){return t!==null}var NL=t=>({name:"transformOrigin",options:t,fn(e){var y,h,v;const{placement:n,rects:r,middlewareData:i}=e,o=((y=i.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[u,c]=k1(n),d={start:"0%",center:"50%",end:"100%"}[c],f=(((h=i.arrow)==null?void 0:h.x)??0)+a/2,_=(((v=i.arrow)==null?void 0:v.y)??0)+l/2;let m="",p="";return u==="bottom"?(m=o?d:`${f}px`,p=`${-l}px`):u==="top"?(m=o?d:`${f}px`,p=`${r.floating.height+l}px`):u==="right"?(m=`${-l}px`,p=o?d:`${_}px`):u==="left"&&(m=`${r.floating.width+l}px`,p=o?d:`${_}px`),{data:{x:m,y:p}}}});function k1(t){const[e,n="center"]=t.split("-");return[e,n]}var $L=w1,FL=b1,LL=E1,jL=C1,Af="rovingFocusGroup.onEntryFocus",DL={bubbles:!1,cancelable:!0},rl="RovingFocusGroup",[Op,P1,zL]=vg(rl),[UL,R1]=Wi(rl,[zL]),[VL,BL]=UL(rl),T1=g.forwardRef((t,e)=>w.jsx(Op.Provider,{scope:t.__scopeRovingFocusGroup,children:w.jsx(Op.Slot,{scope:t.__scopeRovingFocusGroup,children:w.jsx(qL,{...t,ref:e})})}));T1.displayName=rl;var qL=g.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:c=!1,...d}=t,f=g.useRef(null),_=Xe(e,f),m=i1(s),[p,y]=Xc({prop:o,defaultProp:a??null,onChange:l,caller:rl}),[h,v]=g.useState(!1),x=Ft(u),b=P1(n),E=g.useRef(!1),[S,k]=g.useState(0);return g.useEffect(()=>{const C=f.current;if(C)return C.addEventListener(Af,x),()=>C.removeEventListener(Af,x)},[x]),w.jsx(VL,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:p,onItemFocus:g.useCallback(C=>y(C),[y]),onItemShiftTab:g.useCallback(()=>v(!0),[]),onFocusableItemAdd:g.useCallback(()=>k(C=>C+1),[]),onFocusableItemRemove:g.useCallback(()=>k(C=>C-1),[]),children:w.jsx(Ee.div,{tabIndex:h||S===0?-1:0,"data-orientation":r,...d,ref:_,style:{outline:"none",...t.style},onMouseDown:J(t.onMouseDown,()=>{E.current=!0}),onFocus:J(t.onFocus,C=>{const R=!E.current;if(C.target===C.currentTarget&&R&&!h){const P=new CustomEvent(Af,DL);if(C.currentTarget.dispatchEvent(P),!P.defaultPrevented){const $=b().filter(q=>q.focusable),O=$.find(q=>q.active),U=$.find(q=>q.id===p),H=[O,U,...$].filter(Boolean).map(q=>q.ref.current);M1(H,c)}}E.current=!1}),onBlur:J(t.onBlur,()=>v(!1))})})}),I1="RovingFocusGroupItem",O1=g.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=t,l=Fs(),u=s||l,c=BL(I1,n),d=c.currentTabStopId===u,f=P1(n),{onFocusableItemAdd:_,onFocusableItemRemove:m,currentTabStopId:p}=c;return g.useEffect(()=>{if(r)return _(),()=>m()},[r,_,m]),w.jsx(Op.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:w.jsx(Ee.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...a,ref:e,onMouseDown:J(t.onMouseDown,y=>{r?c.onItemFocus(u):y.preventDefault()}),onFocus:J(t.onFocus,()=>c.onItemFocus(u)),onKeyDown:J(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){c.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const h=GL(y,c.orientation,c.dir);if(h!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let x=f().filter(b=>b.focusable).map(b=>b.ref.current);if(h==="last")x.reverse();else if(h==="prev"||h==="next"){h==="prev"&&x.reverse();const b=x.indexOf(y.currentTarget);x=c.loop?KL(x,b+1):x.slice(b+1)}setTimeout(()=>M1(x))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:p!=null}):o})})});O1.displayName=I1;var HL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function WL(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function GL(t,e,n){const r=WL(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return HL[r]}function M1(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function KL(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var QL=T1,YL=O1;function XL(t){const e=JL(t),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(ej);if(l){const u=l.props.children,c=a.map(d=>d===l?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:d);return w.jsx(e,{...o,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,c):null})}return w.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}function JL(t){const e=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=nj(i),a=tj(s,i.props);return i.type!==g.Fragment&&(a.ref=r?oi(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var ZL=Symbol("radix.slottable");function ej(t){return g.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===ZL}function tj(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function nj(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Mp=["Enter"," "],rj=["ArrowDown","PageUp","Home"],A1=["ArrowUp","PageDown","End"],ij=[...rj,...A1],sj={ltr:[...Mp,"ArrowRight"],rtl:[...Mp,"ArrowLeft"]},oj={ltr:["ArrowLeft"],rtl:["ArrowRight"]},il="Menu",[qa,aj,lj]=vg(il),[Ki,N1]=Wi(il,[lj,y1,R1]),od=y1(),$1=R1(),[uj,Qi]=Ki(il),[cj,sl]=Ki(il),F1=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,a=od(e),[l,u]=g.useState(null),c=g.useRef(!1),d=Ft(s),f=i1(i);return g.useEffect(()=>{const _=()=>{c.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>c.current=!1;return document.addEventListener("keydown",_,{capture:!0}),()=>{document.removeEventListener("keydown",_,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),w.jsx($L,{...a,children:w.jsx(uj,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:u,children:w.jsx(cj,{scope:e,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:o,children:r})})})};F1.displayName=il;var dj="MenuAnchor",Sg=g.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=od(n);return w.jsx(FL,{...i,...r,ref:e})});Sg.displayName=dj;var Cg="MenuPortal",[fj,L1]=Ki(Cg,{forceMount:void 0}),j1=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=Qi(Cg,e);return w.jsx(fj,{scope:e,forceMount:n,children:w.jsx(gr,{present:n||s.open,children:w.jsx(Zc,{asChild:!0,container:i,children:r})})})};j1.displayName=Cg;var nn="MenuContent",[hj,kg]=Ki(nn),D1=g.forwardRef((t,e)=>{const n=L1(nn,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=Qi(nn,t.__scopeMenu),o=sl(nn,t.__scopeMenu);return w.jsx(qa.Provider,{scope:t.__scopeMenu,children:w.jsx(gr,{present:r||s.open,children:w.jsx(qa.Slot,{scope:t.__scopeMenu,children:o.modal?w.jsx(pj,{...i,ref:e}):w.jsx(vj,{...i,ref:e})})})})}),pj=g.forwardRef((t,e)=>{const n=Qi(nn,t.__scopeMenu),r=g.useRef(null),i=Xe(e,r);return g.useEffect(()=>{const s=r.current;if(s)return gS(s)},[]),w.jsx(Pg,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),vj=g.forwardRef((t,e)=>{const n=Qi(nn,t.__scopeMenu);return w.jsx(Pg,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),gj=XL("MenuContent.ScrollLock"),Pg=g.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:_,disableOutsideScroll:m,...p}=t,y=Qi(nn,n),h=sl(nn,n),v=od(n),x=$1(n),b=aj(n),[E,S]=g.useState(null),k=g.useRef(null),C=Xe(e,k,y.onContentChange),R=g.useRef(0),P=g.useRef(""),$=g.useRef(0),O=g.useRef(null),U=g.useRef("right"),L=g.useRef(0),H=m?og:g.Fragment,q=m?{as:gj,allowPinchZoom:!0}:void 0,K=M=>{var ze,ve;const B=P.current+M,G=b().filter(Ae=>!Ae.disabled),Z=document.activeElement,se=(ze=G.find(Ae=>Ae.ref.current===Z))==null?void 0:ze.textValue,ce=G.map(Ae=>Ae.textValue),_e=Rj(ce,B,se),Se=(ve=G.find(Ae=>Ae.textValue===_e))==null?void 0:ve.ref.current;(function Ae(kt){P.current=kt,window.clearTimeout(R.current),kt!==""&&(R.current=window.setTimeout(()=>Ae(""),1e3))})(B),Se&&setTimeout(()=>Se.focus())};g.useEffect(()=>()=>window.clearTimeout(R.current),[]),aS();const I=g.useCallback(M=>{var G,Z;return U.current===((G=O.current)==null?void 0:G.side)&&Ij(M,(Z=O.current)==null?void 0:Z.area)},[]);return w.jsx(hj,{scope:n,searchRef:P,onItemEnter:g.useCallback(M=>{I(M)&&M.preventDefault()},[I]),onItemLeave:g.useCallback(M=>{var B;I(M)||((B=k.current)==null||B.focus(),S(null))},[I]),onTriggerLeave:g.useCallback(M=>{I(M)&&M.preventDefault()},[I]),pointerGraceTimerRef:$,onPointerGraceIntentChange:g.useCallback(M=>{O.current=M},[]),children:w.jsx(H,{...q,children:w.jsx(sg,{asChild:!0,trapped:i,onMountAutoFocus:J(s,M=>{var B;M.preventDefault(),(B=k.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:w.jsx(Jc,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:_,children:w.jsx(QL,{asChild:!0,...x,dir:h.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:S,onEntryFocus:J(l,M=>{h.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:w.jsx(LL,{role:"menu","aria-orientation":"vertical","data-state":tC(y.open),"data-radix-menu-content":"",dir:h.dir,...v,...p,ref:C,style:{outline:"none",...p.style},onKeyDown:J(p.onKeyDown,M=>{const G=M.target.closest("[data-radix-menu-content]")===M.currentTarget,Z=M.ctrlKey||M.altKey||M.metaKey,se=M.key.length===1;G&&(M.key==="Tab"&&M.preventDefault(),!Z&&se&&K(M.key));const ce=k.current;if(M.target!==ce||!ij.includes(M.key))return;M.preventDefault();const Se=b().filter(ze=>!ze.disabled).map(ze=>ze.ref.current);A1.includes(M.key)&&Se.reverse(),kj(Se)}),onBlur:J(t.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(R.current),P.current="")}),onPointerMove:J(t.onPointerMove,Ha(M=>{const B=M.target,G=L.current!==M.clientX;if(M.currentTarget.contains(B)&&G){const Z=M.clientX>L.current?"right":"left";U.current=Z,L.current=M.clientX}}))})})})})})})});D1.displayName=nn;var mj="MenuGroup",Rg=g.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return w.jsx(Ee.div,{role:"group",...r,ref:e})});Rg.displayName=mj;var yj="MenuLabel",z1=g.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return w.jsx(Ee.div,{...r,ref:e})});z1.displayName=yj;var bc="MenuItem",i0="menu.itemSelect",ad=g.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=g.useRef(null),o=sl(bc,t.__scopeMenu),a=kg(bc,t.__scopeMenu),l=Xe(e,s),u=g.useRef(!1),c=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(i0,{bubbles:!0,cancelable:!0});d.addEventListener(i0,_=>r==null?void 0:r(_),{once:!0}),ig(d,f),f.defaultPrevented?u.current=!1:o.onClose()}};return w.jsx(U1,{...i,ref:l,disabled:n,onClick:J(t.onClick,c),onPointerDown:d=>{var f;(f=t.onPointerDown)==null||f.call(t,d),u.current=!0},onPointerUp:J(t.onPointerUp,d=>{var f;u.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:J(t.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||Mp.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});ad.displayName=bc;var U1=g.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=kg(bc,n),a=$1(n),l=g.useRef(null),u=Xe(e,l),[c,d]=g.useState(!1),[f,_]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&_((m.textContent??"").trim())},[s.children]),w.jsx(qa.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:w.jsx(YL,{asChild:!0,...a,focusable:!r,children:w.jsx(Ee.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:J(t.onPointerMove,Ha(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(t.onPointerLeave,Ha(m=>o.onItemLeave(m))),onFocus:J(t.onFocus,()=>d(!0)),onBlur:J(t.onBlur,()=>d(!1))})})})}),_j="MenuCheckboxItem",V1=g.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return w.jsx(G1,{scope:t.__scopeMenu,checked:n,children:w.jsx(ad,{role:"menuitemcheckbox","aria-checked":Ec(n)?"mixed":n,...i,ref:e,"data-state":Ig(n),onSelect:J(i.onSelect,()=>r==null?void 0:r(Ec(n)?!0:!n),{checkForDefaultPrevented:!1})})})});V1.displayName=_j;var B1="MenuRadioGroup",[wj,xj]=Ki(B1,{value:void 0,onValueChange:()=>{}}),q1=g.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=Ft(r);return w.jsx(wj,{scope:t.__scopeMenu,value:n,onValueChange:s,children:w.jsx(Rg,{...i,ref:e})})});q1.displayName=B1;var H1="MenuRadioItem",W1=g.forwardRef((t,e)=>{const{value:n,...r}=t,i=xj(H1,t.__scopeMenu),s=n===i.value;return w.jsx(G1,{scope:t.__scopeMenu,checked:s,children:w.jsx(ad,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":Ig(s),onSelect:J(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});W1.displayName=H1;var Tg="MenuItemIndicator",[G1,bj]=Ki(Tg,{checked:!1}),K1=g.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=bj(Tg,n);return w.jsx(gr,{present:r||Ec(s.checked)||s.checked===!0,children:w.jsx(Ee.span,{...i,ref:e,"data-state":Ig(s.checked)})})});K1.displayName=Tg;var Ej="MenuSeparator",Q1=g.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return w.jsx(Ee.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});Q1.displayName=Ej;var Sj="MenuArrow",Y1=g.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=od(n);return w.jsx(jL,{...i,...r,ref:e})});Y1.displayName=Sj;var Cj="MenuSub",[T3,X1]=Ki(Cj),Yo="MenuSubTrigger",J1=g.forwardRef((t,e)=>{const n=Qi(Yo,t.__scopeMenu),r=sl(Yo,t.__scopeMenu),i=X1(Yo,t.__scopeMenu),s=kg(Yo,t.__scopeMenu),o=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,u={__scopeMenu:t.__scopeMenu},c=g.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return g.useEffect(()=>c,[c]),g.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),w.jsx(Sg,{asChild:!0,...u,children:w.jsx(U1,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":tC(n.open),...t,ref:oi(e,i.onTriggerChange),onClick:d=>{var f;(f=t.onClick)==null||f.call(t,d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(t.onPointerMove,Ha(d=>{s.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),c()},100))})),onPointerLeave:J(t.onPointerLeave,Ha(d=>{var _,m;c();const f=(_=n.content)==null?void 0:_.getBoundingClientRect();if(f){const p=(m=n.content)==null?void 0:m.dataset.side,y=p==="right",h=y?-5:5,v=f[y?"left":"right"],x=f[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:v,y:f.top},{x,y:f.top},{x,y:f.bottom},{x:v,y:f.bottom}],side:p}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:J(t.onKeyDown,d=>{var _;const f=s.searchRef.current!=="";t.disabled||f&&d.key===" "||sj[r.dir].includes(d.key)&&(n.onOpenChange(!0),(_=n.content)==null||_.focus(),d.preventDefault())})})})});J1.displayName=Yo;var Z1="MenuSubContent",eC=g.forwardRef((t,e)=>{const n=L1(nn,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=Qi(nn,t.__scopeMenu),o=sl(nn,t.__scopeMenu),a=X1(Z1,t.__scopeMenu),l=g.useRef(null),u=Xe(e,l);return w.jsx(qa.Provider,{scope:t.__scopeMenu,children:w.jsx(gr,{present:r||s.open,children:w.jsx(qa.Slot,{scope:t.__scopeMenu,children:w.jsx(Pg,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{var d;o.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:J(t.onFocusOutside,c=>{c.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:J(t.onEscapeKeyDown,c=>{o.onClose(),c.preventDefault()}),onKeyDown:J(t.onKeyDown,c=>{var _;const d=c.currentTarget.contains(c.target),f=oj[o.dir].includes(c.key);d&&f&&(s.onOpenChange(!1),(_=a.trigger)==null||_.focus(),c.preventDefault())})})})})})});eC.displayName=Z1;function tC(t){return t?"open":"closed"}function Ec(t){return t==="indeterminate"}function Ig(t){return Ec(t)?"indeterminate":t?"checked":"unchecked"}function kj(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Pj(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Rj(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=Pj(t,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==n));const l=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Tj(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;sr!=f>r&&n<(d-u)*(r-c)/(f-c)+u&&(i=!i)}return i}function Ij(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Tj(n,e)}function Ha(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Oj=F1,Mj=Sg,Aj=j1,Nj=D1,$j=Rg,Fj=z1,Lj=ad,jj=V1,Dj=q1,zj=W1,Uj=K1,Vj=Q1,Bj=Y1,qj=J1,Hj=eC,ld="DropdownMenu",[Wj]=Wi(ld,[N1]),Ct=N1(),[Gj,nC]=Wj(ld),rC=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,l=Ct(e),u=g.useRef(null),[c,d]=Xc({prop:i,defaultProp:s??!1,onChange:o,caller:ld});return w.jsx(Gj,{scope:e,triggerId:Fs(),triggerRef:u,contentId:Fs(),open:c,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:w.jsx(Oj,{...l,open:c,onOpenChange:d,dir:r,modal:a,children:n})})};rC.displayName=ld;var iC="DropdownMenuTrigger",sC=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=nC(iC,n),o=Ct(n);return w.jsx(Mj,{asChild:!0,...o,children:w.jsx(Ee.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:oi(e,s.triggerRef),onPointerDown:J(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:J(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});sC.displayName=iC;var Kj="DropdownMenuPortal",oC=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Ct(e);return w.jsx(Aj,{...r,...n})};oC.displayName=Kj;var aC="DropdownMenuContent",lC=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=nC(aC,n),s=Ct(n),o=g.useRef(!1);return w.jsx(Nj,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:J(t.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:J(t.onInteractOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,c=l.button===2||u;(!i.modal||c)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});lC.displayName=aC;var Qj="DropdownMenuGroup",Yj=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx($j,{...i,...r,ref:e})});Yj.displayName=Qj;var Xj="DropdownMenuLabel",uC=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx(Fj,{...i,...r,ref:e})});uC.displayName=Xj;var Jj="DropdownMenuItem",cC=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx(Lj,{...i,...r,ref:e})});cC.displayName=Jj;var Zj="DropdownMenuCheckboxItem",dC=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx(jj,{...i,...r,ref:e})});dC.displayName=Zj;var eD="DropdownMenuRadioGroup",tD=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx(Dj,{...i,...r,ref:e})});tD.displayName=eD;var nD="DropdownMenuRadioItem",fC=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx(zj,{...i,...r,ref:e})});fC.displayName=nD;var rD="DropdownMenuItemIndicator",hC=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx(Uj,{...i,...r,ref:e})});hC.displayName=rD;var iD="DropdownMenuSeparator",pC=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx(Vj,{...i,...r,ref:e})});pC.displayName=iD;var sD="DropdownMenuArrow",oD=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx(Bj,{...i,...r,ref:e})});oD.displayName=sD;var aD="DropdownMenuSubTrigger",vC=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx(qj,{...i,...r,ref:e})});vC.displayName=aD;var lD="DropdownMenuSubContent",gC=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Ct(n);return w.jsx(Hj,{...i,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gC.displayName=lD;var uD=rC,cD=sC,dD=oC,mC=lC,yC=uC,_C=cC,wC=dC,xC=fC,bC=hC,EC=pC,SC=vC,CC=gC;/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fD=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kC=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var hD={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pD=g.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>g.createElement("svg",{ref:l,...hD,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:kC("lucide",i),...a},[...o.map(([u,c])=>g.createElement(u,c)),...Array.isArray(s)?s:[s]]));/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ud=(t,e)=>{const n=g.forwardRef(({className:r,...i},s)=>g.createElement(pD,{ref:s,iconNode:e,className:kC(`lucide-${fD(t)}`,r),...i}));return n.displayName=`${t}`,n};/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vD=ud("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gD=ud("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mD=ud("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yD=ud("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),_D=uD,wD=cD,xD=g.forwardRef(({className:t,inset:e,children:n,...r},i)=>w.jsxs(SC,{ref:i,className:at("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",e&&"pl-8",t),...r,children:[n,w.jsx(gD,{className:"ml-auto h-4 w-4"})]}));xD.displayName=SC.displayName;const bD=g.forwardRef(({className:t,...e},n)=>w.jsx(CC,{ref:n,className:at("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));bD.displayName=CC.displayName;const PC=g.forwardRef(({className:t,sideOffset:e=4,...n},r)=>w.jsx(dD,{children:w.jsx(mC,{ref:r,sideOffset:e,className:at("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));PC.displayName=mC.displayName;const Qn=g.forwardRef(({className:t,inset:e,...n},r)=>w.jsx(_C,{ref:r,className:at("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e&&"pl-8",t),...n}));Qn.displayName=_C.displayName;const ED=g.forwardRef(({className:t,children:e,checked:n,...r},i)=>w.jsxs(wC,{ref:i,className:at("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),checked:n,...r,children:[w.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(bC,{children:w.jsx(vD,{className:"h-4 w-4"})})}),e]}));ED.displayName=wC.displayName;const SD=g.forwardRef(({className:t,children:e,...n},r)=>w.jsxs(xC,{ref:r,className:at("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...n,children:[w.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(bC,{children:w.jsx(mD,{className:"h-2 w-2 fill-current"})})}),e]}));SD.displayName=xC.displayName;const RC=g.forwardRef(({className:t,inset:e,...n},r)=>w.jsx(yC,{ref:r,className:at("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));RC.displayName=yC.displayName;const Ap=g.forwardRef(({className:t,...e},n)=>w.jsx(EC,{ref:n,className:at("-mx-1 my-1 h-px bg-muted",t),...e}));Ap.displayName=EC.displayName;function CD(t){const n=(t.name||t.username||"?").trim().split(/\s+/).filter(Boolean);return n.length===0?"?":n.length===1?n[0][0].toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()}const kD=({user:t,onLogout:e})=>w.jsxs(_D,{children:[w.jsx(wD,{asChild:!0,children:w.jsx("button",{type:"button",className:"user-avatar-btn","aria-label":`Account menu for ${t.username}`,children:w.jsxs(t1,{className:"h-8 w-8",children:[t.avatar_url&&w.jsx(n1,{src:t.avatar_url,alt:t.username}),w.jsx(r1,{className:"text-xs",children:CD(t)})]})})}),w.jsxs(PC,{align:"end",className:"w-56",children:[w.jsxs(RC,{className:"flex flex-col gap-0.5 py-2",children:[w.jsx("span",{className:"text-sm font-medium leading-tight",children:t.name||t.username}),w.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["@",t.username]}),t.is_admin&&w.jsx("span",{className:"mt-1 inline-flex w-fit items-center rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-amber-900",children:"Admin"}),t.role==="contributor"&&w.jsx("span",{className:"mt-1 inline-flex w-fit items-center rounded-full bg-blue-100 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-blue-900",children:"Contributor"})]}),w.jsx(Ap,{}),w.jsx(Qn,{asChild:!0,children:w.jsx("a",{href:`https://huggingface.co/${encodeURIComponent(t.username)}`,target:"_blank",rel:"noopener noreferrer",children:"Hugging Face profile"})}),w.jsx(Qn,{asChild:!0,children:w.jsx(mn,{to:"/frameworks",children:"Frameworks"})}),w.jsx(Qn,{asChild:!0,children:w.jsx(mn,{to:"/trends",children:"Trends"})}),t.is_admin&&w.jsxs(w.Fragment,{children:[w.jsx(Qn,{asChild:!0,children:w.jsx(mn,{to:"/admin-dashboard",children:"Admin dashboard"})}),w.jsx(Qn,{asChild:!0,children:w.jsx(mn,{to:"/submissions",children:"Review submissions"})})]}),w.jsx(Qn,{asChild:!0,children:w.jsx(mn,{to:`/${encodeURIComponent(t.username)}`,children:"My contributions"})}),w.jsx(Qn,{asChild:!0,children:w.jsx(mn,{to:"/settings",children:"Settings"})}),w.jsx(Ap,{}),w.jsx(Qn,{onSelect:n=>{n.preventDefault(),e()},children:"Log out"})]})]}),PD=!1;class cd extends Error{constructor(n,r){var i;super(`API request failed: ${n.status} ${n.statusText}`);wr(this,"status");wr(this,"statusText");wr(this,"response");wr(this,"detail");wr(this,"code");wr(this,"displayMessage");this.name="ApiError",this.status=n.status,this.statusText=n.statusText,this.response=r;try{if(this.detail=(i=JSON.parse(r))==null?void 0:i.detail,typeof this.detail=="string"&&(this.message=this.detail),Array.isArray(this.detail)){const s=this.detail[0];typeof s=="object"&&s!==null&&"msg"in s&&typeof s.msg=="string"&&(this.message=s.msg)}if(typeof this.detail=="object"&&this.detail!==null&&"code"in this.detail&&typeof this.detail.code=="string"&&(this.code=this.detail.code),typeof this.detail=="object"&&this.detail!==null&&"message"in this.detail&&typeof this.detail.message=="string"){const s="help"in this.detail&&typeof this.detail.help=="string"?` See ${this.detail.help} for help.`:"";this.message=`${this.detail.message}${s}`}}catch{this.detail=void 0,this.displayMessage=r||this.message;return}this.displayMessage=this.message}}function I3(t,e){return t instanceof cd?t.displayMessage||e:typeof t=="object"&&t!==null&&"message"in t&&typeof t.message=="string"&&t.message||e}class RD{constructor(e){this.baseUrl=e}async fetch(e,n){const r=`${this.baseUrl}${e}`;try{const{headers:i,...s}=n??{},a=(s.method??"GET").toUpperCase()==="GET"?"default":"no-store",l=new Headers(i);return typeof s.body=="string"&&!l.has("Content-Type")&&l.set("Content-Type","application/json"),await fetch(r,{...s,cache:s.cache??a,credentials:s.credentials??"include",headers:l})}catch(i){throw console.error(`[API] Request to ${r} failed:`,i),i}}async fetchOk(e,n){const r=await this.fetch(e,n);if(!r.ok){const i=new cd(r,await r.text());throw console.error("[API] Error response:",i.response),i}return r}async request(e,n){const r=await this.fetchOk(e,n);return r.status===204?void 0:await r.json()}}function TD(t){t instanceof cd&&t.status===401&&t.code!=="fresh_auth_required"&&t.code!=="saved_papers_bucket_authorization_required"&&typeof window<"u"&&window.dispatchEvent(new CustomEvent("pwc:auth-stale"))}async function TC(t){try{return await t()}catch(e){throw TD(e),e}}const Og=new RD(`${cg()}/api/v1`),ID=(t,e)=>Og.fetch(t,e),O3=(t,e)=>TC(()=>Og.fetchOk(t,e)),Sc=(t,e)=>TC(()=>Og.request(t,e));async function M3(t,e){try{return await Sc(t,e)}catch(n){if(n instanceof cd&&n.status===404)return null;throw n}}const s0={async getCurrentUser(){if(yo())return null;const t=await ID("/auth/me",{cache:"no-store"});return t.status===401||!t.ok?null:t.json()},async logout(){await Sc("/auth/logout",{method:"POST"})},async requestStagingAccess(){await Sc("/staging-access-request",{method:"POST"})}},Mg=V.createContext(null),o0="pwc:auth-stale",OD=({children:t})=>{const[e,n]=V.useState(null),[r,i]=V.useState(!0),s=mA(),o=V.useRef(null),a=V.useCallback(async()=>{i(!0);const c=await s0.getCurrentUser();n(c),i(!1)},[]),l=V.useCallback(async()=>{const c=dg("/api/v1/auth/logout");if(new URL(c,window.location.origin).origin!==window.location.origin){const d=document.createElement("form");d.method="POST",d.action=`${c}?return_to=${encodeURIComponent(window.location.href)}`,document.body.appendChild(d),d.submit();return}await s0.logout(),n(null)},[]);V.useEffect(()=>{a()},[a]),V.useEffect(()=>{},[e]),V.useEffect(()=>{o.current&&!e&&s.resetQueries(),o.current=e},[s,e]),V.useEffect(()=>{const c=()=>{n(null)};return window.addEventListener(o0,c),()=>window.removeEventListener(o0,c)},[]);const u=V.useMemo(()=>({user:e,isLoading:r,refresh:a,logout:l}),[e,r,a,l]);return w.jsx(Mg.Provider,{value:u,children:t})};function Ag(){const t=V.useContext(Mg);if(!t)throw new Error("useAuth must be used inside an ");return t}function A3(){return V.useContext(Mg)}const kr=({name:t,size:e=14})=>{const n={search:w.jsx("path",{d:"M11 11l3 3M7 12.5a5.5 5.5 0 110-11 5.5 5.5 0 010 11z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),bookmark:w.jsx("path",{d:"M4 2h8v12l-4-3-4 3V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),menu:w.jsx("path",{d:"M2 4h12M2 8h12M2 12h12",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),close:w.jsx("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),github:w.jsx("path",{fill:"currentColor",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})};return w.jsx("svg",{className:e===11?"icon-sm":"icon",viewBox:"0 0 16 16",width:e,height:e,children:n[t]})},a0="https://github.com/huggingface/paperswithcode-feedback/issues",l0="https://github.com/huggingface/paperswithcode",MD="https://paperswithcode.co/following",u0="pwc:announcement:following-feed:v1:dismissed",Nf=[{to:"/",label:"Trending",end:!0},{to:"/tasks",label:"Browse state-of-the-art",end:!1},{to:"/methods",label:"Methods",end:!1},{to:"/conferences",label:"Conferences",end:!1},{to:"/organizations",label:"Organizations",end:!1},{to:"/submit",label:"Submit",end:!1}],AD=()=>{if(typeof navigator>"u")return!1;const t=navigator.userAgentData,e=(t==null?void 0:t.platform)||navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/i.test(e)},ND=()=>{const[t,e]=V.useState(!1);return V.useEffect(()=>{e(AD())},[]),w.jsx("kbd",{children:t?"⌘K":"Ctrl K"})},$D=({onOpenSearch:t})=>{const[e,n]=V.useState(!1),[r,i]=V.useState(()=>localStorage.getItem(u0)!=="1"),s=V.useRef(null),o=V.useRef(null),a=()=>n(!1),{user:l,logout:u}=Ag(),c=an(),d=c.pathname.startsWith("/pdf/"),f=`${c.pathname}${c.search}`||"/",_=yo(),m=Va()?{to:"/chat",label:"Chat",end:!1,badge:"New"}:u$()?{to:"/chat",label:"Chat",end:!1,badge:"New",href:l$}:null,p=m?[Nf[0],m,...Nf.slice(1)]:Nf;return V.useLayoutEffect(()=>{var S;const y=s.current,h=o.current;if(!y||!h)return;let v=!1;const x=()=>{if(v)return;const k=y.querySelector(".nav-item.active"),C=(k==null?void 0:k.offsetWidth)??0;h.style.width=`${C}px`,h.style.transform=`translateX(${(k==null?void 0:k.offsetLeft)??0}px)`,h.style.opacity=C>0?"1":"0"};x();const b=window.requestAnimationFrame(()=>{h.classList.add("nav-indicator-ready")}),E=typeof ResizeObserver>"u"?null:new ResizeObserver(x);return E==null||E.observe(y),window.addEventListener("resize",x),(S=document.fonts)==null||S.ready.then(x),()=>{v=!0,window.cancelAnimationFrame(b),E==null||E.disconnect(),window.removeEventListener("resize",x)}},[c.pathname,p.length]),w.jsxs(ZN,{open:e,onOpenChange:n,children:[w.jsxs("header",{className:"app-header",children:[w.jsxs("div",{className:"app-header-inner",children:[w.jsxs(is,{to:"/",className:"brand",onClick:a,children:[w.jsx("span",{className:"brand-mark"}),w.jsxs("span",{className:"brand-name",children:["Papers ",w.jsx("em",{children:"With Code"})]})]}),w.jsxs("nav",{className:"nav",ref:s,children:[p.map(({to:y,label:h,end:v,badge:x,href:b})=>{const E=w.jsxs(w.Fragment,{children:[w.jsx("span",{children:h}),x&&w.jsx("span",{className:"nav-new-badge","aria-hidden":"true",children:x})]});return b?w.jsx("a",{href:b,target:"_blank",rel:"noreferrer",className:`nav-item${x?" nav-item-with-badge":""}`,children:E},y):w.jsx(is,{to:y,end:v,className:({isActive:S})=>`nav-item${x?" nav-item-with-badge":""}${S?" active":""}`,children:E},y)}),w.jsx("span",{ref:o,className:"nav-indicator","aria-hidden":"true"})]}),w.jsx("div",{className:"header-spacer"}),w.jsx("a",{className:"feedback-link header-feedback-link",href:a0,target:"_blank",rel:"noreferrer",children:"Submit feedback"}),w.jsx("a",{className:"icon-btn header-github-btn",href:l0,target:"_blank",rel:"noreferrer","aria-label":"GitHub repository",title:"GitHub repository",children:w.jsx(kr,{name:"github",size:14})}),w.jsxs("button",{className:"search-trigger","aria-label":"Search papers, authors, domains",onClick:t,children:[w.jsx(kr,{name:"search",size:13}),w.jsx("span",{children:"Search papers, authors, domains…"}),w.jsx(ND,{})]}),w.jsx("button",{className:"icon-btn mobile-search-btn","aria-label":"Search",onClick:t,children:w.jsx(kr,{name:"search",size:14})}),!_&&w.jsx(is,{to:"/saved",className:"icon-btn header-bookmark-btn","aria-label":"Saved papers",title:"Saved papers",children:w.jsx(kr,{name:"bookmark",size:13})}),_?null:l?w.jsx(kD,{user:l,onLogout:u}):w.jsx(NS,{returnTo:f}),w.jsx(e$,{asChild:!0,children:w.jsx("button",{className:"icon-btn mobile-menu-btn","aria-label":"Open menu",children:w.jsx(kr,{name:"menu",size:14})})})]}),!d&&r&&w.jsxs("div",{className:"site-announcement",role:"status",children:[w.jsx("span",{children:"New: "}),_?w.jsx("a",{href:MD,target:"_blank",rel:"noreferrer",children:"following feed"}):w.jsx(mn,{to:"/following",children:"following feed"}),w.jsx("span",{children:", follow your favorite tasks, benchmarks, authors or organizations"}),w.jsx("button",{type:"button",className:"site-announcement-close","aria-label":"Dismiss announcement",onClick:()=>{localStorage.setItem(u0,"1"),i(!1)},children:w.jsx(kr,{name:"close",size:11})})]})]}),w.jsx(t$,{children:w.jsx(n$,{className:"mobile-nav-drawer",children:w.jsxs(r$,{className:"mobile-nav-panel","aria-describedby":void 0,children:[w.jsx(i$,{className:"sr-only",children:"Navigation menu"}),w.jsx(s$,{className:"icon-btn mobile-nav-close","aria-label":"Close menu",children:w.jsx(kr,{name:"close",size:14})}),w.jsxs("button",{type:"button",className:"mobile-nav-link mobile-nav-search",onClick:()=>{a(),t()},children:[w.jsx(kr,{name:"search",size:14}),w.jsx("span",{children:"Search papers, authors, domains…"})]}),p.map(({to:y,label:h,end:v,badge:x,href:b})=>{const E=`mobile-nav-link${x?" mobile-nav-link-with-badge":""}`,S=w.jsxs(w.Fragment,{children:[w.jsx("span",{children:h}),x&&w.jsx("span",{className:"nav-new-badge","aria-hidden":"true",children:x})]});return b?w.jsx("a",{href:b,target:"_blank",rel:"noreferrer",className:E,onClick:a,children:S},y):w.jsx(is,{to:y,end:v,className:E,onClick:a,children:S},y)}),w.jsx("a",{className:"mobile-nav-link",href:a0,target:"_blank",rel:"noreferrer",onClick:a,children:"Submit feedback"}),w.jsx("a",{className:"mobile-nav-link",href:l0,target:"_blank",rel:"noreferrer",onClick:a,children:"GitHub"}),!_&&w.jsx(is,{to:"/saved",className:"mobile-nav-link",onClick:a,children:"Saved papers"}),!_&&(l==null?void 0:l.is_admin)&&w.jsx(is,{to:"/admin-dashboard",className:"mobile-nav-link",onClick:a,children:"Admin dashboard"})]})})})]})},FD=()=>{const{pathname:t}=an();return t==="/chat"||t.startsWith("/chat/")||t.startsWith("/pdf/")?null:w.jsx("footer",{className:"site-footer",children:w.jsxs("div",{className:"site-footer-inner",children:[w.jsxs("span",{children:["© ",new Date().getFullYear()," Hugging Face"]}),w.jsx(mn,{to:"/docs/api",children:"API"}),w.jsx(mn,{to:"/mcp",children:"MCP"}),w.jsx(mn,{to:"/privacy",children:"Privacy"}),w.jsx("a",{href:"https://github.com/huggingface/paperswithcode-feedback/issues",target:"_blank",rel:"noreferrer",children:"Feedback"})]})})},LD=1,jD=1e6;let $f=0;function DD(){return $f=($f+1)%Number.MAX_SAFE_INTEGER,$f.toString()}const Ff=new Map,c0=t=>{if(Ff.has(t))return;const e=setTimeout(()=>{Ff.delete(t),fa({type:"REMOVE_TOAST",toastId:t})},jD);Ff.set(t,e)},zD=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,LD)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?c0(n):t.toasts.forEach(r=>{c0(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},pu=[];let vu={toasts:[]};function fa(t){vu=zD(vu,t),pu.forEach(e=>{e(vu)})}function UD({...t}){const e=DD(),n=i=>fa({type:"UPDATE_TOAST",toast:{...i,id:e}}),r=()=>fa({type:"DISMISS_TOAST",toastId:e});return fa({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}function VD(){const[t,e]=g.useState(vu);return g.useEffect(()=>(pu.push(e),()=>{const n=pu.indexOf(e);n>-1&&pu.splice(n,1)}),[t]),{...t,toast:UD,dismiss:n=>fa({type:"DISMISS_TOAST",toastId:n})}}var BD=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),qD="VisuallyHidden",Ng=g.forwardRef((t,e)=>w.jsx(Ee.span,{...t,ref:e,style:{...BD,...t.style}}));Ng.displayName=qD;var $g="ToastProvider",[Fg,HD,WD]=vg("Toast"),[IC]=Wi("Toast",[WD]),[GD,dd]=IC($g),OC=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:s=50,children:o}=t,[a,l]=g.useState(null),[u,c]=g.useState(0),d=g.useRef(!1),f=g.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${$g}\`. Expected non-empty \`string\`.`),w.jsx(Fg.Provider,{scope:e,children:w.jsx(GD,{scope:e,label:n,duration:r,swipeDirection:i,swipeThreshold:s,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:g.useCallback(()=>c(_=>_+1),[]),onToastRemove:g.useCallback(()=>c(_=>_-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};OC.displayName=$g;var MC="ToastViewport",KD=["F8"],Np="toast.viewportPause",$p="toast.viewportResume",AC=g.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=KD,label:i="Notifications ({hotkey})",...s}=t,o=dd(MC,n),a=HD(n),l=g.useRef(null),u=g.useRef(null),c=g.useRef(null),d=g.useRef(null),f=Xe(e,d,o.onViewportChange),_=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),m=o.toastCount>0;g.useEffect(()=>{const y=h=>{var x;r.length!==0&&r.every(b=>h[b]||h.code===b)&&((x=d.current)==null||x.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),g.useEffect(()=>{const y=l.current,h=d.current;if(m&&y&&h){const v=()=>{if(!o.isClosePausedRef.current){const S=new CustomEvent(Np);h.dispatchEvent(S),o.isClosePausedRef.current=!0}},x=()=>{if(o.isClosePausedRef.current){const S=new CustomEvent($p);h.dispatchEvent(S),o.isClosePausedRef.current=!1}},b=S=>{!y.contains(S.relatedTarget)&&x()},E=()=>{y.contains(document.activeElement)||x()};return y.addEventListener("focusin",v),y.addEventListener("focusout",b),y.addEventListener("pointermove",v),y.addEventListener("pointerleave",E),window.addEventListener("blur",v),window.addEventListener("focus",x),()=>{y.removeEventListener("focusin",v),y.removeEventListener("focusout",b),y.removeEventListener("pointermove",v),y.removeEventListener("pointerleave",E),window.removeEventListener("blur",v),window.removeEventListener("focus",x)}}},[m,o.isClosePausedRef]);const p=g.useCallback(({tabbingDirection:y})=>{const v=a().map(x=>{const b=x.ref.current,E=[b,...a2(b)];return y==="forwards"?E:E.reverse()});return(y==="forwards"?v.reverse():v).flat()},[a]);return g.useEffect(()=>{const y=d.current;if(y){const h=v=>{var E,S,k;const x=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!x){const C=document.activeElement,R=v.shiftKey;if(v.target===y&&R){(E=u.current)==null||E.focus();return}const O=p({tabbingDirection:R?"backwards":"forwards"}),U=O.findIndex(L=>L===C);Lf(O.slice(U+1))?v.preventDefault():R?(S=u.current)==null||S.focus():(k=c.current)==null||k.focus()}};return y.addEventListener("keydown",h),()=>y.removeEventListener("keydown",h)}},[a,p]),w.jsxs(UA,{ref:l,role:"region","aria-label":i.replace("{hotkey}",_),tabIndex:-1,style:{pointerEvents:m?void 0:"none"},children:[m&&w.jsx(Fp,{ref:u,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"forwards"});Lf(y)}}),w.jsx(Fg.Slot,{scope:n,children:w.jsx(Ee.ol,{tabIndex:-1,...s,ref:f})}),m&&w.jsx(Fp,{ref:c,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"backwards"});Lf(y)}})]})});AC.displayName=MC;var NC="ToastFocusProxy",Fp=g.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=t,s=dd(NC,n);return w.jsx(Ng,{tabIndex:0,...i,ref:e,style:{position:"fixed"},onFocus:o=>{var u;const a=o.relatedTarget;!((u=s.viewport)!=null&&u.contains(a))&&r()}})});Fp.displayName=NC;var ol="Toast",QD="toast.swipeStart",YD="toast.swipeMove",XD="toast.swipeCancel",JD="toast.swipeEnd",$C=g.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:i,onOpenChange:s,...o}=t,[a,l]=Xc({prop:r,defaultProp:i??!0,onChange:s,caller:ol});return w.jsx(gr,{present:n||a,children:w.jsx(t2,{open:a,...o,ref:e,onClose:()=>l(!1),onPause:Ft(t.onPause),onResume:Ft(t.onResume),onSwipeStart:J(t.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:J(t.onSwipeMove,u=>{const{x:c,y:d}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${d}px`)}),onSwipeCancel:J(t.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:J(t.onSwipeEnd,u=>{const{x:c,y:d}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${d}px`),l(!1)})})})});$C.displayName=ol;var[ZD,e2]=IC(ol,{onClose(){}}),t2=g.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:i,open:s,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:c,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:_,...m}=t,p=dd(ol,n),[y,h]=g.useState(null),v=Xe(e,L=>h(L)),x=g.useRef(null),b=g.useRef(null),E=i||p.duration,S=g.useRef(0),k=g.useRef(E),C=g.useRef(0),{onToastAdd:R,onToastRemove:P}=p,$=Ft(()=>{var H;(y==null?void 0:y.contains(document.activeElement))&&((H=p.viewport)==null||H.focus()),o()}),O=g.useCallback(L=>{!L||L===1/0||(window.clearTimeout(C.current),S.current=new Date().getTime(),C.current=window.setTimeout($,L))},[$]);g.useEffect(()=>{const L=p.viewport;if(L){const H=()=>{O(k.current),u==null||u()},q=()=>{const K=new Date().getTime()-S.current;k.current=k.current-K,window.clearTimeout(C.current),l==null||l()};return L.addEventListener(Np,q),L.addEventListener($p,H),()=>{L.removeEventListener(Np,q),L.removeEventListener($p,H)}}},[p.viewport,E,l,u,O]),g.useEffect(()=>{s&&!p.isClosePausedRef.current&&O(E)},[s,E,p.isClosePausedRef,O]),g.useEffect(()=>(R(),()=>P()),[R,P]);const U=g.useMemo(()=>y?VC(y):null,[y]);return p.viewport?w.jsxs(w.Fragment,{children:[U&&w.jsx(n2,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:U}),w.jsx(ZD,{scope:n,onClose:$,children:el.createPortal(w.jsx(Fg.ItemSlot,{scope:n,children:w.jsx(zA,{asChild:!0,onEscapeKeyDown:J(a,()=>{p.isFocusedToastEscapeKeyDownRef.current||$(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:w.jsx(Ee.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":p.swipeDirection,...m,ref:v,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:J(t.onKeyDown,L=>{L.key==="Escape"&&(a==null||a(L.nativeEvent),L.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:J(t.onPointerDown,L=>{L.button===0&&(x.current={x:L.clientX,y:L.clientY})}),onPointerMove:J(t.onPointerMove,L=>{if(!x.current)return;const H=L.clientX-x.current.x,q=L.clientY-x.current.y,K=!!b.current,I=["left","right"].includes(p.swipeDirection),M=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,B=I?M(0,H):0,G=I?0:M(0,q),Z=L.pointerType==="touch"?10:2,se={x:B,y:G},ce={originalEvent:L,delta:se};K?(b.current=se,Hl(YD,d,ce,{discrete:!1})):d0(se,p.swipeDirection,Z)?(b.current=se,Hl(QD,c,ce,{discrete:!1}),L.target.setPointerCapture(L.pointerId)):(Math.abs(H)>Z||Math.abs(q)>Z)&&(x.current=null)}),onPointerUp:J(t.onPointerUp,L=>{const H=b.current,q=L.target;if(q.hasPointerCapture(L.pointerId)&&q.releasePointerCapture(L.pointerId),b.current=null,x.current=null,H){const K=L.currentTarget,I={originalEvent:L,delta:H};d0(H,p.swipeDirection,p.swipeThreshold)?Hl(JD,_,I,{discrete:!0}):Hl(XD,f,I,{discrete:!0}),K.addEventListener("click",M=>M.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),n2=t=>{const{__scopeToast:e,children:n,...r}=t,i=dd(ol,e),[s,o]=g.useState(!1),[a,l]=g.useState(!1);return s2(()=>o(!0)),g.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:w.jsx(Zc,{asChild:!0,children:w.jsx(Ng,{...r,children:s&&w.jsxs(w.Fragment,{children:[i.label," ",n]})})})},r2="ToastTitle",FC=g.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return w.jsx(Ee.div,{...r,ref:e})});FC.displayName=r2;var i2="ToastDescription",LC=g.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return w.jsx(Ee.div,{...r,ref:e})});LC.displayName=i2;var jC="ToastAction",DC=g.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?w.jsx(UC,{altText:n,asChild:!0,children:w.jsx(Lg,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${jC}\`. Expected non-empty \`string\`.`),null)});DC.displayName=jC;var zC="ToastClose",Lg=g.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,i=e2(zC,n);return w.jsx(UC,{asChild:!0,children:w.jsx(Ee.button,{type:"button",...r,ref:e,onClick:J(t.onClick,i.onClose)})})});Lg.displayName=zC;var UC=g.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...i}=t;return w.jsx(Ee.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...i,ref:e})});function VC(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),o2(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!i)if(s){const o=r.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(...VC(r))}}),e}function Hl(t,e,n,{discrete:r}){const i=n.originalEvent.currentTarget,s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?ig(i,s):i.dispatchEvent(s)}var d0=(t,e,n=0)=>{const r=Math.abs(t.x),i=Math.abs(t.y),s=r>i;return e==="left"||e==="right"?s&&r>n:!s&&i>n};function s2(t=()=>{}){const e=Ft(t);on(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function o2(t){return t.nodeType===t.ELEMENT_NODE}function a2(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Lf(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var l2=OC,BC=AC,qC=$C,HC=FC,WC=LC,GC=DC,KC=Lg;const f0=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,h0=QS,u2=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return h0(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(u=>{const c=n==null?void 0:n[u],d=s==null?void 0:s[u];if(c===null)return null;const f=f0(c)||f0(d);return i[u][f]}),a=n&&Object.entries(n).reduce((u,c)=>{let[d,f]=c;return f===void 0||(u[d]=f),u},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:f,..._}=c;return Object.entries(_).every(m=>{let[p,y]=m;return Array.isArray(y)?y.includes({...s,...a}[p]):{...s,...a}[p]===y})?[...u,d,f]:u},[]);return h0(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},c2=l2,QC=g.forwardRef(({className:t,...e},n)=>w.jsx(BC,{ref:n,className:at("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));QC.displayName=BC.displayName;const d2=u2("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-16 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),YC=g.forwardRef(({className:t,variant:e,...n},r)=>w.jsx(qC,{ref:r,className:at(d2({variant:e}),t),...n}));YC.displayName=qC.displayName;const f2=g.forwardRef(({className:t,...e},n)=>w.jsx(GC,{ref:n,className:at("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",t),...e}));f2.displayName=GC.displayName;const XC=g.forwardRef(({className:t,...e},n)=>w.jsx(KC,{ref:n,className:at("absolute right-2 top-2 inline-flex h-11 w-11 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring group-[.destructive]:text-destructive-foreground group-[.destructive]:hover:bg-destructive-foreground/10 group-[.destructive]:focus:ring-destructive-foreground",t),"aria-label":"Dismiss notification","toast-close":"",...e,children:w.jsx(yD,{className:"h-4 w-4"})}));XC.displayName=KC.displayName;const JC=g.forwardRef(({className:t,...e},n)=>w.jsx(HC,{ref:n,className:at("text-sm font-semibold",t),...e}));JC.displayName=HC.displayName;const ZC=g.forwardRef(({className:t,...e},n)=>w.jsx(WC,{ref:n,className:at("text-sm opacity-90",t),...e}));ZC.displayName=WC.displayName;function h2(){const{toasts:t}=VD();return w.jsxs(c2,{children:[t.map(function({id:e,title:n,description:r,action:i,...s}){return w.jsxs(YC,{...s,children:[w.jsxs("div",{className:"grid gap-1",children:[n&&w.jsx(JC,{children:n}),r&&w.jsx(ZC,{children:r})]}),i,w.jsx(XC,{})]},e)}),w.jsx(QC,{})]})}function p2(){const{pathname:t,hash:e}=an();g.useLayoutEffect(()=>{e||window.scrollTo({top:0,left:0,behavior:"instant"})},[t,e])}class v2{constructor(e){this.request=e}getPreferences(){return this.request("/me/preferences")}updatePreferences(e){return this.request("/me/preferences",{method:"PUT",body:JSON.stringify(e)})}getRateLimitPolicy(){return this.request("/rate-limits",{credentials:"omit"})}getBookmarkIds(){return this.request("/me/bookmarks/ids")}getBookmarks(){return this.request("/me/bookmarks")}addBookmark(e){return this.request(`/me/bookmarks/${e}`,{method:"POST"})}removeBookmark(e){return this.request(`/me/bookmarks/${e}`,{method:"DELETE"})}}const p0=new v2(Sc),jf={hide_closed_source_evals:!1},ek=V.createContext(null),g2=({children:t})=>{const{user:e}=Ag(),[n,r]=V.useState(jf),[i,s]=V.useState(!1);V.useEffect(()=>{let l=!1;if(!e){r(jf);return}return s(!0),p0.getPreferences().then(u=>{l||r(u)}).catch(()=>{l||r(jf)}).finally(()=>{l||s(!1)}),()=>{l=!0}},[e]);const o=V.useCallback(async l=>{const u={...n,hide_closed_source_evals:l};if(r(u),!!e)try{const c=await p0.updatePreferences(u);r(c)}catch{r(n)}},[n,e]),a=V.useMemo(()=>({preferences:n,canPersist:!!e,isLoading:i,setHideClosedSourceEvals:o}),[n,e,i,o]);return w.jsx(ek.Provider,{value:a,children:t})};function N3(){const t=V.useContext(ek);if(!t)throw new Error("usePreferences must be used inside a ");return t}const tk=d$(),m2=tk?LM:FM;if(!tk&&typeof window<"u"){const t=window.location.hash;t.startsWith("#/")&&!t.startsWith("#//")&&window.history.replaceState(null,"",t.slice(1))}const y2=V.lazy(()=>oe(()=>import("./AuthorizePaperEditView-D0e1jji8.js"),__vite__mapDeps([0,1,2,3,4]))),_2=V.lazy(()=>oe(()=>import("./FollowingView-nVVViEvV.js"),__vite__mapDeps([5,6,7,1,8,9,10,11,12,2,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))),v0=V.lazy(()=>oe(()=>import("./FeedView-BR2dQQ-K.js"),__vite__mapDeps([6,7,1,8,9,10,11,12,2,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))),w2=V.lazy(()=>oe(()=>import("./ChatView-DlSbJMKT.js"),__vite__mapDeps([36,1,37,31,32,23,24,38,39,9,40,41,42,43,44,45,2,46,47,48,49,13,50,51,17,18,52,53,29,30,54,55,56]))),x2=V.lazy(()=>oe(()=>import("./SharedChatView-DO_TTtXn.js"),__vite__mapDeps([57,1,37,31,32,23,24,38,39,9,40,41,42,43,44,45,2,46,47,48,49,13,50,51,17,18,52,53]))),b2=V.lazy(()=>oe(()=>import("./PapersListView-DhkGuTns.js"),__vite__mapDeps([58,19,20,11,21,15,16,17,18,22,23,24,25,26,27,28,9,33,1,34,59,35,60,61]))),E2=V.lazy(()=>oe(()=>import("./PaperDetailView-F3D4F2PU.js"),__vite__mapDeps([62,2,21,19,20,11,22,63,24,38,25,64,23,65,1,33,34,66,27,35,3,8,30,46,67,68,69,70,26,50,71,39,9,72,73,74,75,13,76,77,40,78,79,43,44,28,80,81,17,18,82]))),S2=V.lazy(()=>oe(()=>import("./PaperReaderView-9hbbSNRK.js"),__vite__mapDeps([83,1,37,31,32,23,24,38,39,9,40,41,42,43,44,45,2,46,47,48,49,13,50,51,17,18,52,53,84,65,25,33,34,36,29,30,54,55,56]))),C2=V.lazy(()=>oe(()=>import("./TagsIndexView-jyuGT4BB.js"),__vite__mapDeps([85,1,9,20,11,86,50,87,54,88,89,47,75,90,41,91,77,7,35,92,27,93,72,3,69,73,70,26,8,71,2,74,13,94,95]))),k2=V.lazy(()=>oe(()=>import("./TagBrowseView-CRgLg1ki.js"),__vite__mapDeps([96,97,1,2,10,13,19,20,11,15,16,17,18,21,22,23,24,25,26,27,28,14,98,84,42,43,44,45,38,53,9,60,61,86,33,34,35,99,90,40]))),P2=V.lazy(()=>oe(()=>import("./MethodsIndexView-DYp0dUSa.js"),__vite__mapDeps([100,1,9,95,86,35,92,27,93,72,3,69,73,70,26,8,50,71,2,74,13,94,88]))),R2=V.lazy(()=>oe(()=>import("./FrameworksIndexView-CQtYg5mA.js"),__vite__mapDeps([101,1,21,9,20,61]))),T2=V.lazy(()=>oe(()=>import("./TrendsView-DhWigqns.js"),__vite__mapDeps([102,1,35,27]))),I2=V.lazy(()=>oe(()=>import("./ConferencesIndexView-Cw6IrAk5.js"),__vite__mapDeps([103,1,9,104,35,92,27,93,72,3,69,73,70,26,8,50,71,2,74,13]))),O2=V.lazy(()=>oe(()=>import("./AiDeadlinesView-BhXjtcbF.js"),__vite__mapDeps([105,1,9,106,78,27,35,25,8,104]))),M2=V.lazy(()=>oe(()=>import("./ConferenceDetailView-i-HB-ysc.js"),__vite__mapDeps([107,1,92,27,84,42,43,44,45,38,23,24,2,53,9,60,95,20,108,104,11,35,25,99]))),A2=V.lazy(()=>oe(()=>import("./ConferenceTaskView-BZBMXZD8.js"),__vite__mapDeps([109,1,15,16,17,18,19,20,11,21,22,23,24,25,26,27,28,84,42,43,44,45,38,2,53,9,60,108,33,34,35,99]))),N2=V.lazy(()=>oe(()=>import("./OrganizationsIndexView-Bd4D8teF.js"),__vite__mapDeps([110,1,35,9,111]))),$2=V.lazy(()=>oe(()=>import("./OrganizationDetailView-BD-vOirQ.js"),__vite__mapDeps([112,97,1,2,10,13,84,42,43,44,45,38,23,24,53,113,27,9,15,16,17,18,19,20,11,21,22,25,26,28,35,70,3,8,50,71,33,34,60,81,99]))),F2=V.lazy(()=>oe(()=>import("./OrganizationDetailView-BD-vOirQ.js"),__vite__mapDeps([112,97,1,2,10,13,84,42,43,44,45,38,23,24,53,113,27,9,15,16,17,18,19,20,11,21,22,25,26,28,35,70,3,8,50,71,33,34,60,81,99]))),L2=V.lazy(()=>oe(()=>import("./AuthorDetailView-BpcSKHs1.js"),__vite__mapDeps([114,1,17,18,15,16,19,20,11,21,22,23,24,25,26,27,28,97,2,10,13,35,33,34,60,99]))),j2=V.lazy(()=>oe(()=>import("./MethodDetailView-CEUGGyVV.js"),__vite__mapDeps([115,97,1,2,10,13,23,24,19,20,11,15,16,17,18,21,22,25,26,27,28,84,42,43,44,45,38,53,9,60,86,33,34,35,99]))),D2=V.lazy(()=>oe(()=>import("./BenchmarkDetailView-BGwBE1Ld.js"),__vite__mapDeps([116,97,1,2,10,13,9,63,24,38,25,64,22,106,78,21,27,35,98,86,60,99,117]))),z2=V.lazy(()=>oe(()=>import("./SavedPapersView-CewIlVsw.js"),__vite__mapDeps([118,23,24,1,16,17,18,19,20,11,21,22,25,27,35,80]))),U2=V.lazy(()=>oe(()=>import("./SettingsView-C0A-yv3U.js"),__vite__mapDeps([119,1,2,10,106,78,12,7,14,90,32,66,55,49,89]))),V2=V.lazy(()=>oe(()=>import("./PrivacyView-CodFIqUq.js"),__vite__mapDeps([120,66]))),B2=V.lazy(()=>oe(()=>import("./ApiDocsView-hjoHKqpf.js"),__vite__mapDeps([121,1,43,122]))),q2=V.lazy(()=>oe(()=>import("./McpView-BrXaRo4V.js"),__vite__mapDeps([123,1,66,56,40,49,46,124]))),H2=V.lazy(()=>oe(()=>import("./SubmitView-C6p4dpHt.js"),__vite__mapDeps([125,2,35,3,69,73,23,24,68]))),W2=V.lazy(()=>oe(()=>import("./CronDashboard-CC1lPV3k.js"),__vite__mapDeps([126,1,2,127,128,76,3,51,75,88,91,41,87,49,129,71,130,79,34,4,9,32]))),G2=V.lazy(()=>oe(()=>import("./AutonomousOperations-CzJGtkdV.js"),__vite__mapDeps([131,1,2,127,128,76,3,69,91,48]))),K2=V.lazy(()=>oe(()=>import("./SubmissionsDashboard-eKjMsSf9.js"),__vite__mapDeps([132,67,1,68,23,24,2,34,9,25,74,129,71,130,133]))),Q2=V.lazy(()=>oe(()=>import("./UserProfileView-gm0usnRn.js"),__vite__mapDeps([134,1,113,27,9]))),Y2=V.lazy(()=>oe(()=>import("./RateLimitsView-C9bDo_Dq.js"),__vite__mapDeps([135,1]))),X2=V.lazy(()=>oe(()=>import("./AstraForRoboticsView-pQ4cp5_V.js"),__vite__mapDeps([136,15,16,17,18,19,20,11,21,22,23,24,25,26,27,28,35,33,1,34,66,137]))),Df=V.lazy(()=>oe(()=>import("./NotFound-DtzwOULp.js"),[])),J2=V.lazy(()=>oe(()=>import("./SearchOverlay-LaDVSpVs.js"),__vite__mapDeps([138,23,24,1,22,9,59,20,11]))),Z2=V.lazy(()=>oe(()=>import("./StagingAccessRequestView-DgeEeE2r.js"),__vite__mapDeps([139,130]))),nk=()=>w.jsxs("div",{className:"page","aria-busy":"true","aria-live":"polite",children:[w.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:24,width:"30%",marginBottom:24}}),w.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:64,width:"60%",marginBottom:32}}),w.jsxs("div",{className:"paper-list",style:{display:"grid",gap:16},children:[w.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}}),w.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}}),w.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}})]})]}),e3=new gA({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}}),t3=()=>{const{arxivId:t}=zE();return w.jsx(co,{to:t?`/paper/${t}`:"/papers",replace:!0})},n3=()=>{const{taskSlug:t}=zE();return w.jsx(co,{to:t?`/tasks/${t}`:"/tasks",replace:!0})},r3=({element:t})=>yo()?w.jsx(co,{to:"/",replace:!0}):w.jsx(w.Fragment,{children:t}),Lp=({element:t})=>{const{user:e,isLoading:n}=Ag(),r=an();return yo()?w.jsx(co,{to:"/",replace:!0}):n?w.jsx("div",{className:"page",children:w.jsx("div",{className:"submission-loading",children:w.jsx("span",{children:"Checking admin session..."})})}):e?e.is_admin?w.jsx(w.Fragment,{children:t}):w.jsx("div",{className:"page",children:w.jsxs("div",{className:"submission-empty submission-empty-warn",children:[w.jsx("h1",{children:"Admin access required"}),w.jsxs("p",{children:["Signed in as @",e.username,". This dashboard is limited to allowlisted admin accounts."]})]})}):w.jsx("div",{className:"page",children:w.jsxs("div",{className:"submission-empty submission-empty-warn",children:[w.jsx("h1",{children:"Sign in required"}),w.jsx("p",{children:"Sign in with an allowlisted Hugging Face admin account to view admin operations."}),w.jsx(NS,{returnTo:`${r.pathname}${r.search}`})]})})},i3=()=>{const t=a$(),e=typeof window<"u"&&new URL(t,window.location.origin).origin!==window.location.origin;return V.useEffect(()=>{e&&window.location.replace(t)},[t,e]),e?w.jsx("div",{className:"page",children:w.jsxs("div",{className:"submission-loading",children:[w.jsx("span",{children:"Opening the production admin dashboard..."}),w.jsx("a",{href:t,children:"Continue"})]})}):w.jsx(Lp,{element:w.jsx(W2,{})})},g0=({reader:t=!1})=>{const[e,n]=V.useState(!1),{pathname:r}=an();V.useEffect(()=>{const a=l=>{(l.metaKey||l.ctrlKey)&&l.key==="k"&&(l.preventDefault(),n(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);const i=w.jsx($D,{onOpenSearch:()=>n(!0)}),s=w.jsx(OE,{resetKey:r,children:w.jsx(V.Suspense,{fallback:w.jsx(nk,{}),children:w.jsx(kM,{})})}),o=e&&w.jsx(V.Suspense,{fallback:null,children:w.jsx(J2,{open:e,onClose:()=>n(!1)})});return t?w.jsxs("div",{className:"reader-route-shell",children:[i,w.jsx("div",{className:"reader-route-content",children:s}),o]}):w.jsxs(w.Fragment,{children:[i,w.jsx("main",{children:s}),w.jsx(FD,{}),o]})},s3=()=>(p2(),V.useLayoutEffect(()=>{var t;(t=document.getElementById("initial-discovery-footer"))==null||t.remove()},[]),w.jsxs(PM,{children:[w.jsx(ne,{path:"/request-access",element:w.jsx(V.Suspense,{fallback:w.jsx(nk,{}),children:w.jsx(Z2,{})})}),w.jsx(ne,{element:w.jsx(g0,{reader:!0}),children:w.jsx(ne,{path:"/pdf/:paperId",element:c$()?w.jsx(S2,{}):w.jsx(Df,{})})}),w.jsxs(ne,{element:w.jsx(g0,{}),children:[w.jsx(ne,{path:"/",element:w.jsx(v0,{})}),w.jsx(ne,{path:"/following",element:w.jsx(_2,{})}),w.jsx(ne,{path:"/x-trending",element:w.jsx(v0,{xTrending:!0})}),w.jsx(ne,{path:"/chat/:sessionId?",element:Va()?w.jsx(w2,{}):w.jsx(co,{to:"/",replace:!0})}),w.jsx(ne,{path:"/share/:shareId",element:Va()?w.jsx(x2,{}):w.jsx(Df,{})}),w.jsx(ne,{path:"/papers",element:w.jsx(b2,{})}),w.jsx(ne,{path:"/papers/:arxivId",element:w.jsx(t3,{})}),w.jsx(ne,{path:"/paper/:arxivId",element:w.jsx(E2,{})}),w.jsx(ne,{path:"/tasks",element:w.jsx(C2,{})}),w.jsx(ne,{path:"/tasks/:taskSlug",element:w.jsx(k2,{})}),w.jsx(ne,{path:"/task/:taskSlug",element:w.jsx(n3,{})}),w.jsx(ne,{path:"/methods",element:w.jsx(P2,{})}),w.jsx(ne,{path:"/methods/:methodSlug",element:w.jsx(j2,{})}),w.jsx(ne,{path:"/frameworks",element:w.jsx(R2,{})}),w.jsx(ne,{path:"/trends",element:w.jsx(T2,{})}),w.jsx(ne,{path:"/conferences",element:w.jsx(I2,{})}),w.jsx(ne,{path:"/ai-deadlines",element:w.jsx(O2,{})}),w.jsx(ne,{path:"/conferences/:confSlug",element:w.jsx(M2,{})}),w.jsx(ne,{path:"/conferences/:confSlug/:taskSlug",element:w.jsx(A2,{})}),w.jsx(ne,{path:"/organizations",element:w.jsx(N2,{})}),w.jsx(ne,{path:"/orgs/:orgSlug",element:w.jsx($2,{})}),w.jsx(ne,{path:"/orgs/:orgSlug/:taskSlug",element:w.jsx(F2,{})}),w.jsx(ne,{path:"/authors/:authorId",element:w.jsx(L2,{})}),w.jsx(ne,{path:"/benchmark/:datasetSlug",element:w.jsx(D2,{})}),w.jsx(ne,{path:"/authorize-paper-edit/:authorizationId",element:w.jsx(y2,{})}),w.jsx(ne,{path:"/submit",element:w.jsx(H2,{})}),w.jsx(ne,{path:"/saved",element:w.jsx(r3,{element:w.jsx(z2,{})})}),w.jsx(ne,{path:"/settings",element:w.jsx(U2,{})}),w.jsx(ne,{path:"/privacy",element:w.jsx(V2,{})}),w.jsx(ne,{path:"/docs/api",element:w.jsx(B2,{})}),w.jsx(ne,{path:"/mcp",element:w.jsx(q2,{})}),w.jsx(ne,{path:"/admin-dashboard",element:w.jsx(i3,{})}),w.jsx(ne,{path:"/autonomous-operations",element:w.jsx(Lp,{element:w.jsx(G2,{})})}),w.jsx(ne,{path:"/cron-dashboard",element:w.jsx(co,{to:"/admin-dashboard",replace:!0})}),w.jsx(ne,{path:"/submissions",element:w.jsx(Lp,{element:w.jsx(K2,{})})}),w.jsx(ne,{path:"/rate-limits",element:w.jsx(Y2,{})}),w.jsx(ne,{path:"/astra-for-robotics",element:w.jsx(X2,{})}),w.jsx(ne,{path:"/:username",element:w.jsx(Q2,{})}),w.jsx(ne,{path:"*",element:w.jsx(Df,{})})]})]})),o3=()=>w.jsx(yA,{client:e3,children:w.jsx(OD,{children:w.jsxs(g2,{children:[w.jsx(m2,{children:w.jsx(s3,{})}),w.jsx(h2,{}),!1]})})});NO();const a3=w.jsx(NR,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,storageKey:"pwc-theme",children:w.jsx(OE,{children:w.jsx(o3,{})})}),l3=Dx(document.getElementById("root"));l3.render(w.jsx(V.StrictMode,{children:a3}));export{k0 as $,Wi as A,at as B,vD as C,x3 as D,R3 as E,i1 as F,R1 as G,NS as H,YL as I,mD as J,cd as K,mn as L,V as M,p0 as N,c$ as O,gr as P,w3 as Q,QL as R,_D as S,f2 as T,wD as U,PC as V,Qn as W,yD as X,b3 as Y,_3 as Z,S3 as _,Ag as a,o$ as a0,oe as a1,QS as a2,gD as a3,el as a4,TD as a5,Sc as a6,FS as a7,u2 as a8,Fs as a9,KE as aA,hn as aB,za as aC,hA as aD,p3 as aE,iA as aF,XM as aG,xp as aH,YE as aI,QM as aJ,YM as aK,wp as aL,GE as aM,dA as aN,eA as aO,O3 as aP,M3 as aQ,gS as aR,og as aS,aS as aT,sg as aU,g3 as aV,v3 as aW,dg as aX,s0 as aY,ZN as aa,t$ as ab,n$ as ac,r$ as ad,oi as ae,s$ as af,i$ as ag,y3 as ah,co as ai,$L as aj,FL as ak,y1 as al,Zc as am,Jc as an,LL as ao,jL as ap,d3 as aq,c3 as ar,ID as as,C3 as at,t1 as au,n1 as av,r1 as aw,Yc as ax,wt as ay,h3 as az,an as b,tg as c,A3 as d,f3 as e,mA as f,Va as g,AS as h,yo as i,w as j,u$ as k,l$ as l,E3 as m,ud as n,P3 as o,VD as p,N3 as q,g as r,k3 as s,I3 as t,zE as u,Ee as v,Xc as w,Xe as x,J as y,RL as z}; diff --git a/assets/index-DyXq7-Tg.js b/assets/index-DyXq7-Tg.js new file mode 100644 index 0000000000000000000000000000000000000000..fcdfc7f90b3555b07faaa5d2d43ed3c78b8f58ce --- /dev/null +++ b/assets/index-DyXq7-Tg.js @@ -0,0 +1,162 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AuthorizePaperEditView-DNfre5z5.js","assets/useMutation-UWxBeqtn.js","assets/button-DZeAbOf2.js","assets/paperEdits-CIjFYfYE.js","assets/FollowingView-Ctbw54vk.js","assets/FeedView-tA68x8iy.js","assets/sparkles-CcIiUzzc.js","assets/dialog-CfM0Uql2.js","assets/catalog-CRar2olQ.js","assets/researchTopic-DbX0eko-.js","assets/transform-D46m70Qr.js","assets/plus-Yh42pKZz.js","assets/arrow-right-BzPanrWZ.js","assets/PaperFeed-EBt97iOL.js","assets/PaperCard-57p1OSGy.js","assets/AuthorAvatar-B-9xS2Wo.js","assets/AuthorAvatar-o5W6pl_W.css","assets/SotaBadges-vbLLOUtT.js","assets/colors-BkWRhvFI.js","assets/Icon-T4LYkEQj.js","assets/LatexTitle-Bkyz3jCs.js","assets/papers-Dh3ljlL0.js","assets/curation-YeS7FBYf.js","assets/safeExternalHref-CkBrsh84.js","assets/popover-CTBEUp7Y.js","assets/skeleton-C3IIzpSL.js","assets/useIntersectionObserver-D6_Iig9a.js","assets/McpShowcase-CLO4HLon.js","assets/AgentLogos-j-Qekw7T.js","assets/chatSessions-Ck_dyM0d.js","assets/chat-Ix1IrIwq.js","assets/usePapers-B0s20UcU.js","assets/useInfiniteQuery-BYh2zN-T.js","assets/alert-gbJBhAVE.js","assets/ChatView-D06zYumh.js","assets/ArtifactWorkspace-Ya79_F5k.js","assets/hover-card-B45EJIn_.js","assets/CatalogEntityPreviewLink-BktpwL3_.js","assets/github-RNrgGHRT.js","assets/file-text-dvKtHbmD.js","assets/PaperPreviewLink-CpCZSa8K.js","assets/index-mCi_y_l3.js","assets/index-2CvJmBVB.js","assets/katex-DkKDou_j.js","assets/copy-CxR0OKx2.js","assets/thumbs-up-CPLlGli7.js","assets/arrow-left-PA_b6law.js","assets/external-link-orY1Xz1I.js","assets/search-8ssWDP68.js","assets/chevron-up-DYSYRyvz.js","assets/ArtifactWorkspace-Lr_OJaUk.css","assets/katex-wklAmtGL.css","assets/share-2-fiavn5SS.js","assets/openrouter-o51Eagw8.js","assets/queryOptions-C9woPjwX.js","assets/SharedChatView-Cd2cL7B4.js","assets/PapersListView-BwwaBBb8.js","assets/useDebounce-B9jkN7LV.js","assets/apiErrors-BSvbQBb0.js","assets/frameworks-DDA0P4Tf.js","assets/PaperDetailView-BlSDULsI.js","assets/ExternalSourceEvalBadge-K3r45EmO.js","assets/ExternalSourceEvalBadge-CWUQ52cV.css","assets/paperReader-BIpQD5HO.js","assets/useDocumentTitle-DcxM2Zv_.js","assets/preferences-COzeOLyS.js","assets/account-cbblajck.js","assets/evaluationQueryInvalidation-Cm3s7Pfm.js","assets/queryInvalidation-CfHeNeUY.js","assets/input-DJqCAbs7.js","assets/searchable-select-DiDLwvbI.js","assets/loader-circle-C75KLEgx.js","assets/SignInToEditDialog-B-oWVno5.js","assets/textarea-DPixlM5U.js","assets/submissions-Cz_J-Ha2.js","assets/database-DflzbaZ5.js","assets/badge-e6t3GCyf.js","assets/globe-BMJtRs4F.js","assets/index-C041TDos.js","assets/codex-DFj4KHqP.js","assets/savedPapersAuth-TV7AiXOw.js","assets/organizationNames-BVKzYEBp.js","assets/PaperDetailView-CUWCgV3F.css","assets/PaperReaderView-C7GrMxPx.js","assets/MarkdownText-CUzPoC9Y.js","assets/TagsIndexView-BwVoxBoD.js","assets/slug-BpH-Nkvz.js","assets/triangle-alert-uZ3fXFkp.js","assets/trending-up-OM6wBVvQ.js","assets/moon-DMVsctTM.js","assets/trophy-BtgLmZ39.js","assets/activity-S-FQ6Anu.js","assets/AreaSection-BxnKzNK0.js","assets/TaxonomySuggestionTile-jIiLMp4q.js","assets/useHashScrollOnReady-D5UCCQuT.js","assets/areas-Dvi8w2dp.js","assets/TagBrowseView-DKVo9Mlp.js","assets/ResearchFollowButton-Dv316ClR.js","assets/BenchmarkTrendSparkline-DhXxdQ2D.js","assets/NotFound-DV_nwcxG.js","assets/MethodsIndexView-D_aKGLyJ.js","assets/FrameworksIndexView-CZmHXkeL.js","assets/TrendsView-DCijqOnv.js","assets/ConferencesIndexView-DJVYKUiz.js","assets/deadlines-BH32v7D1.js","assets/AiDeadlinesView--bEB1R4q.js","assets/switch-nfvTohnt.js","assets/ConferenceDetailView-DgDeLFoO.js","assets/conferenceListings-BnmhBx-_.js","assets/ConferenceTaskView-BvWfAecx.js","assets/OrganizationsIndexView-DpJistoL.js","assets/OrganizationsIndexView-CJnrfIkP.css","assets/OrganizationDetailView-DYOQ1Mwd.js","assets/OrganizationContributionGraph-DsoZR4EG.js","assets/AuthorDetailView-BykOxZh0.js","assets/MethodDetailView-5wFkSBs8.js","assets/BenchmarkDetailView-BObHaEFx.js","assets/BenchmarkDetailView-CXxK75GR.css","assets/SavedPapersView-B2fQDeYi.js","assets/SettingsView-BuCdwlbq.js","assets/PrivacyView-BQ3x7IFA.js","assets/ApiDocsView-DhYUFS5g.js","assets/ApiDocsView-DPuMdYvY.css","assets/McpView-DYa6GKrp.js","assets/McpView-EGeqkP46.css","assets/SubmitView-CDuD6xEz.js","assets/CronDashboard-kqcQ1rzf.js","assets/CronDashboard-qYV75PLc.js","assets/CronDashboard-DwChfW9h.css","assets/refresh-cw-DYXzpRir.js","assets/circle-check-GGlu5UCV.js","assets/AutonomousOperations-B4vSAvB8.js","assets/SubmissionsDashboard-CZ6QfHso.js","assets/SubmissionsDashboard-BTmvDoLW.css","assets/UserProfileView-BnW4I15t.js","assets/RateLimitsView-phVSVOy1.js","assets/AstraForRoboticsView-BZJ-P8S9.js","assets/AstraForRoboticsView-C_lTF_XB.css","assets/SearchOverlay-5zBt7fdP.js","assets/StagingAccessRequestView-CZz80h2x.js"])))=>i.map(i=>d[i]); +var Vk=Object.defineProperty;var ym=e=>{throw TypeError(e)};var Bk=(e,t,n)=>t in e?Vk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var kr=(e,t,n)=>Bk(e,typeof t!="symbol"?t+"":t,n),Nd=(e,t,n)=>t.has(e)||ym("Cannot "+n);var k=(e,t,n)=>(Nd(e,t,"read from private field"),n?n.call(e):t.get(e)),X=(e,t,n)=>t.has(e)?ym("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),H=(e,t,n,r)=>(Nd(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ue=(e,t,n)=>(Nd(e,t,"access private method"),n);var Tl=(e,t,n,r)=>({set _(i){H(e,t,i,n)},get _(){return k(e,t,r)}});function qk(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var nz=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function aw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lw={exports:{}},Gc={},uw={exports:{}},le={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var gl=Symbol.for("react.element"),Wk=Symbol.for("react.portal"),Hk=Symbol.for("react.fragment"),Gk=Symbol.for("react.strict_mode"),Kk=Symbol.for("react.profiler"),Qk=Symbol.for("react.provider"),Yk=Symbol.for("react.context"),Xk=Symbol.for("react.forward_ref"),Jk=Symbol.for("react.suspense"),Zk=Symbol.for("react.memo"),eP=Symbol.for("react.lazy"),_m=Symbol.iterator;function tP(e){return e===null||typeof e!="object"?null:(e=_m&&e[_m]||e["@@iterator"],typeof e=="function"?e:null)}var cw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},dw=Object.assign,fw={};function Oo(e,t,n){this.props=e,this.context=t,this.refs=fw,this.updater=n||cw}Oo.prototype.isReactComponent={};Oo.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Oo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function hw(){}hw.prototype=Oo.prototype;function gv(e,t,n){this.props=e,this.context=t,this.refs=fw,this.updater=n||cw}var mv=gv.prototype=new hw;mv.constructor=gv;dw(mv,Oo.prototype);mv.isPureReactComponent=!0;var wm=Array.isArray,pw=Object.prototype.hasOwnProperty,yv={current:null},vw={key:!0,ref:!0,__self:!0,__source:!0};function gw(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)pw.call(t,r)&&!vw.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,te=O[K];if(0>>1;Ki(be,V))Pei(Be,be)?(O[K]=Be,O[Pe]=V,K=Pe):(O[K]=be,O[de]=V,K=de);else if(Pei(Be,V))O[K]=Be,O[Pe]=V,K=Pe;else break e}}return A}function i(O,A){var V=O.sortIndex-A.sortIndex;return V!==0?V:O.id-A.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,d=null,f=3,m=!1,_=!1,p=!1,y=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(O){for(var A=n(u);A!==null;){if(A.callback===null)r(u);else if(A.startTime<=O)r(u),A.sortIndex=A.expirationTime,t(l,A);else break;A=n(u)}}function b(O){if(p=!1,x(O),!_)if(n(l)!==null)_=!0,B(E);else{var A=n(u);A!==null&&Q(b,A.startTime-O)}}function E(O,A){_=!1,p&&(p=!1,h(C),C=-1),m=!0;var V=f;try{for(x(A),d=n(l);d!==null&&(!(d.expirationTime>A)||O&&!N());){var K=d.callback;if(typeof K=="function"){d.callback=null,f=d.priorityLevel;var te=K(d.expirationTime<=A);A=e.unstable_now(),typeof te=="function"?d.callback=te:d===n(l)&&r(l),x(A)}else r(l);d=n(l)}if(d!==null)var oe=!0;else{var de=n(u);de!==null&&Q(b,de.startTime-A),oe=!1}return oe}finally{d=null,f=V,m=!1}}var S=!1,P=null,C=-1,T=5,R=-1;function N(){return!(e.unstable_now()-RO||125K?(O.sortIndex=V,t(u,O),n(l)===null&&O===n(u)&&(p?(h(C),C=-1):p=!0,Q(b,V-K))):(O.sortIndex=te,t(l,O),_||m||(_=!0,B(E))),O},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(O){var A=f;return function(){var V=f;f=A;try{return O.apply(this,arguments)}finally{f=V}}}})(xw);ww.exports=xw;var fP=ww.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var hP=g,Jt=fP;function U(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oh=Object.prototype.hasOwnProperty,pP=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,bm={},Em={};function vP(e){return oh.call(Em,e)?!0:oh.call(bm,e)?!1:pP.test(e)?Em[e]=!0:(bm[e]=!0,!1)}function gP(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function mP(e,t,n,r){if(t===null||typeof t>"u"||gP(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Pt(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var ut={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ut[e]=new Pt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ut[t]=new Pt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ut[e]=new Pt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ut[e]=new Pt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ut[e]=new Pt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ut[e]=new Pt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ut[e]=new Pt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ut[e]=new Pt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ut[e]=new Pt(e,5,!1,e.toLowerCase(),null,!1,!1)});var wv=/[\-:]([a-z])/g;function xv(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(wv,xv);ut[t]=new Pt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(wv,xv);ut[t]=new Pt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(wv,xv);ut[t]=new Pt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ut[e]=new Pt(e,1,!1,e.toLowerCase(),null,!1,!1)});ut.xlinkHref=new Pt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ut[e]=new Pt(e,1,!1,e.toLowerCase(),null,!0,!0)});function bv(e,t,n,r){var i=ut.hasOwnProperty(t)?ut[t]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` +`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{Ld=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?sa(e):""}function yP(e){switch(e.tag){case 5:return sa(e.type);case 16:return sa("Lazy");case 13:return sa("Suspense");case 19:return sa("SuspenseList");case 0:case 2:case 15:return e=jd(e.type,!1),e;case 11:return e=jd(e.type.render,!1),e;case 1:return e=jd(e.type,!0),e;default:return""}}function ch(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ss:return"Fragment";case Es:return"Portal";case ah:return"Profiler";case Ev:return"StrictMode";case lh:return"Suspense";case uh:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Sw:return(e.displayName||"Context")+".Consumer";case Ew:return(e._context.displayName||"Context")+".Provider";case Sv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Cv:return t=e.displayName||null,t!==null?t:ch(e.type)||"Memo";case $r:t=e._payload,e=e._init;try{return ch(e(t))}catch{}}return null}function _P(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ch(t);case 8:return t===Ev?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function oi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function kw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wP(e){var t=kw(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ml(e){e._valueTracker||(e._valueTracker=wP(e))}function Pw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=kw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Du(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function dh(e,t){var n=t.checked;return Ve({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Cm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=oi(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Rw(e,t){t=t.checked,t!=null&&bv(e,"checked",t,!1)}function fh(e,t){Rw(e,t);var n=oi(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?hh(e,t.type,n):t.hasOwnProperty("defaultValue")&&hh(e,t.type,oi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function km(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function hh(e,t,n){(t!=="number"||Du(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var oa=Array.isArray;function js(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Al.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ma(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var va={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xP=["Webkit","ms","Moz","O"];Object.keys(va).forEach(function(e){xP.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),va[t]=va[e]})});function Mw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||va.hasOwnProperty(e)&&va[e]?(""+t).trim():t+"px"}function Aw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Mw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var bP=Ve({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function gh(e,t){if(t){if(bP[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(U(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(U(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(U(61))}if(t.style!=null&&typeof t.style!="object")throw Error(U(62))}}function mh(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yh=null;function kv(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _h=null,Ds=null,zs=null;function Tm(e){if(e=_l(e)){if(typeof _h!="function")throw Error(U(280));var t=e.stateNode;t&&(t=Zc(t),_h(e.stateNode,e.type,t))}}function Nw(e){Ds?zs?zs.push(e):zs=[e]:Ds=e}function $w(){if(Ds){var e=Ds,t=zs;if(zs=Ds=null,Tm(e),t)for(e=0;e>>=0,e===0?32:31-(AP(e)/NP|0)|0}var Nl=64,$l=4194304;function aa(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Bu(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=aa(a):(s&=o,s!==0&&(r=aa(s)))}else o=n&~i,o!==0?r=aa(o):s!==0&&(r=aa(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function ml(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Sn(t),e[t]=n}function jP(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=ma),jm=" ",Dm=!1;function tx(e,t){switch(e){case"keyup":return fR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nx(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Cs=!1;function pR(e,t){switch(e){case"compositionend":return nx(t);case"keypress":return t.which!==32?null:(Dm=!0,jm);case"textInput":return e=t.data,e===jm&&Dm?null:e;default:return null}}function vR(e,t){if(Cs)return e==="compositionend"||!Nv&&tx(e,t)?(e=Zw(),yu=Ov=Gr=null,Cs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Bm(n)}}function ox(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ox(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ax(){for(var e=window,t=Du();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Du(e.document)}return t}function $v(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function SR(e){var t=ax(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ox(n.ownerDocument.documentElement,n)){if(r!==null&&$v(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=qm(n,s);var o=qm(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ks=null,Ch=null,_a=null,kh=!1;function Wm(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;kh||ks==null||ks!==Du(r)||(r=ks,"selectionStart"in r&&$v(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),_a&&ja(_a,r)||(_a=r,r=Hu(Ch,"onSelect"),0Ts||(e.current=Mh[Ts],Mh[Ts]=null,Ts--)}function Te(e,t){Ts++,Mh[Ts]=e.current,e.current=t}var ai={},yt=hi(ai),jt=hi(!1),Ki=ai;function po(e,t){var n=e.type.contextTypes;if(!n)return ai;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Dt(e){return e=e.childContextTypes,e!=null}function Ku(){$e(jt),$e(yt)}function Jm(e,t,n){if(yt.current!==ai)throw Error(U(168));Te(yt,t),Te(jt,n)}function gx(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(U(108,_P(e)||"Unknown",i));return Ve({},n,r)}function Qu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ai,Ki=yt.current,Te(yt,e),Te(jt,jt.current),!0}function Zm(e,t,n){var r=e.stateNode;if(!r)throw Error(U(169));n?(e=gx(e,t,Ki),r.__reactInternalMemoizedMergedChildContext=e,$e(jt),$e(yt),Te(yt,e)):$e(jt),Te(jt,n)}var rr=null,ed=!1,Jd=!1;function mx(e){rr===null?rr=[e]:rr.push(e)}function FR(e){ed=!0,mx(e)}function pi(){if(!Jd&&rr!==null){Jd=!0;var e=0,t=xe;try{var n=rr;for(xe=1;e>=o,i-=o,cr=1<<32-Sn(t)+i|n<C?(T=P,P=null):T=P.sibling;var R=f(h,P,x[C],b);if(R===null){P===null&&(P=T);break}e&&P&&R.alternate===null&&t(h,P),v=s(R,v,C),S===null?E=R:S.sibling=R,S=R,P=T}if(C===x.length)return n(h,P),je&&bi(h,C),E;if(P===null){for(;CC?(T=P,P=null):T=P.sibling;var N=f(h,P,R.value,b);if(N===null){P===null&&(P=T);break}e&&P&&N.alternate===null&&t(h,P),v=s(N,v,C),S===null?E=N:S.sibling=N,S=N,P=T}if(R.done)return n(h,P),je&&bi(h,C),E;if(P===null){for(;!R.done;C++,R=x.next())R=d(h,R.value,b),R!==null&&(v=s(R,v,C),S===null?E=R:S.sibling=R,S=R);return je&&bi(h,C),E}for(P=r(h,P);!R.done;C++,R=x.next())R=m(P,h,C,R.value,b),R!==null&&(e&&R.alternate!==null&&P.delete(R.key===null?C:R.key),v=s(R,v,C),S===null?E=R:S.sibling=R,S=R);return e&&P.forEach(function(M){return t(h,M)}),je&&bi(h,C),E}function y(h,v,x,b){if(typeof x=="object"&&x!==null&&x.type===Ss&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Ol:e:{for(var E=x.key,S=v;S!==null;){if(S.key===E){if(E=x.type,E===Ss){if(S.tag===7){n(h,S.sibling),v=i(S,x.props.children),v.return=h,h=v;break e}}else if(S.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===$r&&ny(E)===S.type){n(h,S.sibling),v=i(S,x.props),v.ref=Wo(h,S,x),v.return=h,h=v;break e}n(h,S);break}else t(h,S);S=S.sibling}x.type===Ss?(v=Wi(x.props.children,h.mode,b,x.key),v.return=h,h=v):(b=ku(x.type,x.key,x.props,null,h.mode,b),b.ref=Wo(h,v,x),b.return=h,h=b)}return o(h);case Es:e:{for(S=x.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(h,v.sibling),v=i(v,x.children||[]),v.return=h,h=v;break e}else{n(h,v);break}else t(h,v);v=v.sibling}v=af(x,h.mode,b),v.return=h,h=v}return o(h);case $r:return S=x._init,y(h,v,S(x._payload),b)}if(oa(x))return _(h,v,x,b);if(zo(x))return p(h,v,x,b);Vl(h,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,v!==null&&v.tag===6?(n(h,v.sibling),v=i(v,x),v.return=h,h=v):(n(h,v),v=of(x,h.mode,b),v.return=h,h=v),o(h)):n(h,v)}return y}var go=xx(!0),bx=xx(!1),Ju=hi(null),Zu=null,Ms=null,Dv=null;function zv(){Dv=Ms=Zu=null}function Uv(e){var t=Ju.current;$e(Ju),e._currentValue=t}function $h(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Vs(e,t){Zu=e,Dv=Ms=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ft=!0),e.firstContext=null)}function cn(e){var t=e._currentValue;if(Dv!==e)if(e={context:e,memoizedValue:t,next:null},Ms===null){if(Zu===null)throw Error(U(308));Ms=e,Zu.dependencies={lanes:0,firstContext:e}}else Ms=Ms.next=e;return t}var Ti=null;function Vv(e){Ti===null?Ti=[e]:Ti.push(e)}function Ex(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Vv(t)):(n.next=i.next,i.next=n),t.interleaved=n,gr(e,r)}function gr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Fr=!1;function Bv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Sx(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function hr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ei(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,pe&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,gr(e,n)}return i=r.interleaved,i===null?(t.next=t,Vv(r)):(t.next=i.next,i.next=t),r.interleaved=t,gr(e,n)}function wu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rv(e,n)}}function ry(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ec(e,t,n,r){var i=e.updateQueue;Fr=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;o=0,c=u=l=null,a=s;do{var f=a.lane,m=a.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var _=e,p=a;switch(f=t,m=n,p.tag){case 1:if(_=p.payload,typeof _=="function"){d=_.call(m,d,f);break e}d=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=p.payload,f=typeof _=="function"?_.call(m,d,f):_,f==null)break e;d=Ve({},d,f);break e;case 2:Fr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else m={eventTime:m,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=m,l=d):c=c.next=m,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(c===null&&(l=d),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Xi|=o,e.lanes=o,e.memoizedState=d}}function iy(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ef.transition;ef.transition={};try{e(!1),t()}finally{xe=n,ef.transition=r}}function Ux(){return dn().memoizedState}function zR(e,t,n){var r=ni(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Vx(e))Bx(t,n);else if(n=Ex(e,t,n,r),n!==null){var i=Ct();Cn(n,e,r,i),qx(n,t,r)}}function UR(e,t,n){var r=ni(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Vx(e))Bx(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,kn(a,o)){var l=t.interleaved;l===null?(i.next=i,Vv(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=Ex(e,t,i,r),n!==null&&(i=Ct(),Cn(n,e,r,i),qx(n,t,r))}}function Vx(e){var t=e.alternate;return e===ze||t!==null&&t===ze}function Bx(e,t){wa=nc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qx(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rv(e,n)}}var rc={readContext:cn,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useInsertionEffect:dt,useLayoutEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useMutableSource:dt,useSyncExternalStore:dt,useId:dt,unstable_isNewReconciler:!1},VR={readContext:cn,useCallback:function(e,t){return Nn().memoizedState=[e,t===void 0?null:t],e},useContext:cn,useEffect:oy,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,bu(4194308,4,Fx.bind(null,t,e),n)},useLayoutEffect:function(e,t){return bu(4194308,4,e,t)},useInsertionEffect:function(e,t){return bu(4,2,e,t)},useMemo:function(e,t){var n=Nn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Nn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=zR.bind(null,ze,e),[r.memoizedState,e]},useRef:function(e){var t=Nn();return e={current:e},t.memoizedState=e},useState:sy,useDebugValue:Xv,useDeferredValue:function(e){return Nn().memoizedState=e},useTransition:function(){var e=sy(!1),t=e[0];return e=DR.bind(null,e[1]),Nn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ze,i=Nn();if(je){if(n===void 0)throw Error(U(407));n=n()}else{if(n=t(),it===null)throw Error(U(349));Yi&30||Rx(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,oy(Ix.bind(null,r,s,e),[e]),r.flags|=2048,Ha(9,Tx.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Nn(),t=it.identifierPrefix;if(je){var n=dr,r=cr;n=(r&~(1<<32-Sn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=qa++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[zn]=t,e[Ua]=r,eb(e,t,!1,!1),t.stateNode=e;e:{switch(o=mh(n,r),n){case"dialog":Me("cancel",e),Me("close",e),i=r;break;case"iframe":case"object":case"embed":Me("load",e),i=r;break;case"video":case"audio":for(i=0;i_o&&(t.flags|=128,r=!0,Ho(s,!1),t.lanes=4194304)}else{if(!r)if(e=tc(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ho(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!je)return ft(t),null}else 2*Qe()-s.renderingStartTime>_o&&n!==1073741824&&(t.flags|=128,r=!0,Ho(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Qe(),t.sibling=null,n=De.current,Te(De,r?n&1|2:n&1),t):(ft(t),null);case 22:case 23:return rg(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Vt&1073741824&&(ft(t),t.subtreeFlags&6&&(t.flags|=8192)):ft(t),null;case 24:return null;case 25:return null}throw Error(U(156,t.tag))}function YR(e,t){switch(Lv(t),t.tag){case 1:return Dt(t.type)&&Ku(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return mo(),$e(jt),$e(yt),Hv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Wv(t),null;case 13:if($e(De),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(U(340));vo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $e(De),null;case 4:return mo(),null;case 10:return Uv(t.type._context),null;case 22:case 23:return rg(),null;case 24:return null;default:return null}}var ql=!1,gt=!1,XR=typeof WeakSet=="function"?WeakSet:Set,G=null;function As(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){He(e,t,r)}else n.current=null}function qh(e,t,n){try{n()}catch(r){He(e,t,r)}}var my=!1;function JR(e,t){if(Ph=qu,e=ax(),$v(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var m;d!==n||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(m=d.firstChild)!==null;)f=d,d=m;for(;;){if(d===e)break t;if(f===n&&++u===i&&(a=o),f===s&&++c===r&&(l=o),(m=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Rh={focusedElem:e,selectionRange:n},qu=!1,G=t;G!==null;)if(t=G,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var _=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(_!==null){var p=_.memoizedProps,y=_.memoizedState,h=t.stateNode,v=h.getSnapshotBeforeUpdate(t.elementType===t.type?p:mn(t.type,p),y);h.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(U(163))}}catch(b){He(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return _=my,my=!1,_}function xa(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&qh(t,n,s)}i=i.next}while(i!==r)}}function rd(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Wh(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function rb(e){var t=e.alternate;t!==null&&(e.alternate=null,rb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zn],delete t[Ua],delete t[Oh],delete t[NR],delete t[$R])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ib(e){return e.tag===5||e.tag===3||e.tag===4}function yy(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ib(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Hh(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Gu));else if(r!==4&&(e=e.child,e!==null))for(Hh(e,t,n),e=e.sibling;e!==null;)Hh(e,t,n),e=e.sibling}function Gh(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Gh(e,t,n),e=e.sibling;e!==null;)Gh(e,t,n),e=e.sibling}var st=null,wn=!1;function Pr(e,t,n){for(n=n.child;n!==null;)sb(e,t,n),n=n.sibling}function sb(e,t,n){if(qn&&typeof qn.onCommitFiberUnmount=="function")try{qn.onCommitFiberUnmount(Qc,n)}catch{}switch(n.tag){case 5:gt||As(n,t);case 6:var r=st,i=wn;st=null,Pr(e,t,n),st=r,wn=i,st!==null&&(wn?(e=st,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):st.removeChild(n.stateNode));break;case 18:st!==null&&(wn?(e=st,n=n.stateNode,e.nodeType===8?Xd(e.parentNode,n):e.nodeType===1&&Xd(e,n),Fa(e)):Xd(st,n.stateNode));break;case 4:r=st,i=wn,st=n.stateNode.containerInfo,wn=!0,Pr(e,t,n),st=r,wn=i;break;case 0:case 11:case 14:case 15:if(!gt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&qh(n,t,o),i=i.next}while(i!==r)}Pr(e,t,n);break;case 1:if(!gt&&(As(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){He(n,t,a)}Pr(e,t,n);break;case 21:Pr(e,t,n);break;case 22:n.mode&1?(gt=(r=gt)||n.memoizedState!==null,Pr(e,t,n),gt=r):Pr(e,t,n);break;default:Pr(e,t,n)}}function _y(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new XR),t.forEach(function(r){var i=aT.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function vn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Qe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*eT(r/1960))-r,10e?16:e,Kr===null)var r=!1;else{if(e=Kr,Kr=null,oc=0,pe&6)throw Error(U(331));var i=pe;for(pe|=4,G=e.current;G!==null;){var s=G,o=s.child;if(G.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lQe()-tg?qi(e,0):eg|=n),zt(e,t)}function hb(e,t){t===0&&(e.mode&1?(t=$l,$l<<=1,!($l&130023424)&&($l=4194304)):t=1);var n=Ct();e=gr(e,t),e!==null&&(ml(e,t,n),zt(e,n))}function oT(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),hb(e,n)}function aT(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(U(314))}r!==null&&r.delete(t),hb(e,n)}var pb;pb=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||jt.current)Ft=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ft=!1,KR(e,t,n);Ft=!!(e.flags&131072)}else Ft=!1,je&&t.flags&1048576&&yx(t,Xu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Eu(e,t),e=t.pendingProps;var i=po(t,yt.current);Vs(t,n),i=Kv(null,t,r,e,i,n);var s=Qv();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Dt(r)?(s=!0,Qu(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Bv(t),i.updater=nd,t.stateNode=i,i._reactInternals=t,Lh(t,r,e,n),t=zh(null,t,r,!0,s,n)):(t.tag=0,je&&s&&Fv(t),bt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Eu(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=uT(r),e=mn(r,e),i){case 0:t=Dh(null,t,r,e,n);break e;case 1:t=py(null,t,r,e,n);break e;case 11:t=fy(null,t,r,e,n);break e;case 14:t=hy(null,t,r,mn(r.type,e),n);break e}throw Error(U(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:mn(r,i),Dh(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:mn(r,i),py(e,t,r,i,n);case 3:e:{if(Xx(t),e===null)throw Error(U(387));r=t.pendingProps,s=t.memoizedState,i=s.element,Sx(e,t),ec(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=yo(Error(U(423)),t),t=vy(e,t,r,n,i);break e}else if(r!==i){i=yo(Error(U(424)),t),t=vy(e,t,r,n,i);break e}else for(Gt=Zr(t.stateNode.containerInfo.firstChild),Qt=t,je=!0,xn=null,n=bx(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vo(),r===i){t=mr(e,t,n);break e}bt(e,t,r,n)}t=t.child}return t;case 5:return Cx(t),e===null&&Nh(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Th(r,i)?o=null:s!==null&&Th(r,s)&&(t.flags|=32),Yx(e,t),bt(e,t,o,n),t.child;case 6:return e===null&&Nh(t),null;case 13:return Jx(e,t,n);case 4:return qv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=go(t,null,r,n):bt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:mn(r,i),fy(e,t,r,i,n);case 7:return bt(e,t,t.pendingProps,n),t.child;case 8:return bt(e,t,t.pendingProps.children,n),t.child;case 12:return bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Te(Ju,r._currentValue),r._currentValue=o,s!==null)if(kn(s.value,o)){if(s.children===i.children&&!jt.current){t=mr(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=hr(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),$h(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(U(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),$h(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}bt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Vs(t,n),i=cn(i),r=r(i),t.flags|=1,bt(e,t,r,n),t.child;case 14:return r=t.type,i=mn(r,t.pendingProps),i=mn(r.type,i),hy(e,t,r,i,n);case 15:return Kx(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:mn(r,i),Eu(e,t),t.tag=1,Dt(r)?(e=!0,Qu(t)):e=!1,Vs(t,n),Wx(t,r,i),Lh(t,r,i,n),zh(null,t,r,!0,e,n);case 19:return Zx(e,t,n);case 22:return Qx(e,t,n)}throw Error(U(156,t.tag))};function vb(e,t){return Vw(e,t)}function lT(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function on(e,t,n,r){return new lT(e,t,n,r)}function sg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function uT(e){if(typeof e=="function")return sg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Sv)return 11;if(e===Cv)return 14}return 2}function ri(e,t){var n=e.alternate;return n===null?(n=on(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ku(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")sg(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ss:return Wi(n.children,i,s,t);case Ev:o=8,i|=8;break;case ah:return e=on(12,n,t,i|2),e.elementType=ah,e.lanes=s,e;case lh:return e=on(13,n,t,i),e.elementType=lh,e.lanes=s,e;case uh:return e=on(19,n,t,i),e.elementType=uh,e.lanes=s,e;case Cw:return sd(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ew:o=10;break e;case Sw:o=9;break e;case Sv:o=11;break e;case Cv:o=14;break e;case $r:o=16,r=null;break e}throw Error(U(130,e==null?e:typeof e,""))}return t=on(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Wi(e,t,n,r){return e=on(7,e,r,t),e.lanes=n,e}function sd(e,t,n,r){return e=on(22,e,r,t),e.elementType=Cw,e.lanes=n,e.stateNode={isHidden:!1},e}function of(e,t,n){return e=on(6,e,null,t),e.lanes=n,e}function af(e,t,n){return t=on(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cT(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zd(0),this.expirationTimes=zd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zd(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function og(e,t,n,r,i,s,o,a,l){return e=new cT(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=on(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bv(s),e}function dT(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_b)}catch(e){console.error(e)}}_b(),_w.exports=Zt;var xl=_w.exports;const gT=aw(xl);var wb,Py=xl;wb=Py.createRoot,Py.hydrateRoot;var uc=["light","dark"],cg="(prefers-color-scheme: dark)",mT=typeof window>"u",dg=g.createContext(void 0),yT={setTheme:e=>{},themes:[]},rz=()=>{var e;return(e=g.useContext(dg))!=null?e:yT},_T=e=>g.useContext(dg)?e.children:g.createElement(xT,{...e}),wT=["light","dark"],xT=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:i="theme",themes:s=wT,defaultTheme:o=n?"system":"light",attribute:a="data-theme",value:l,children:u,nonce:c})=>{let[d,f]=g.useState(()=>Ry(i,o)),[m,_]=g.useState(()=>Ry(i)),p=l?Object.values(l):s,y=g.useCallback(b=>{let E=b;if(!E)return;b==="system"&&n&&(E=Ty());let S=l?l[E]:E,P=t?ET():null,C=document.documentElement;if(a==="class"?(C.classList.remove(...p),S&&C.classList.add(S)):S?C.setAttribute(a,S):C.removeAttribute(a),r){let T=uc.includes(o)?o:null,R=uc.includes(E)?E:T;C.style.colorScheme=R}P==null||P()},[]),h=g.useCallback(b=>{let E=typeof b=="function"?b(b):b;f(E);try{localStorage.setItem(i,E)}catch{}},[e]),v=g.useCallback(b=>{let E=Ty(b);_(E),d==="system"&&n&&!e&&y("system")},[d,e]);g.useEffect(()=>{let b=window.matchMedia(cg);return b.addListener(v),v(b),()=>b.removeListener(v)},[v]),g.useEffect(()=>{let b=E=>{if(E.key!==i)return;let S=E.newValue||o;h(S)};return window.addEventListener("storage",b),()=>window.removeEventListener("storage",b)},[h]),g.useEffect(()=>{y(e??d)},[e,d]);let x=g.useMemo(()=>({theme:d,setTheme:h,forcedTheme:e,resolvedTheme:d==="system"?m:d,themes:n?[...s,"system"]:s,systemTheme:n?m:void 0}),[d,h,e,m,n,s]);return g.createElement(dg.Provider,{value:x},g.createElement(bT,{forcedTheme:e,disableTransitionOnChange:t,enableSystem:n,enableColorScheme:r,storageKey:i,themes:s,defaultTheme:o,attribute:a,value:l,children:u,attrs:p,nonce:c}),u)},bT=g.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:s,value:o,attrs:a,nonce:l})=>{let u=s==="system",c=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(_=>`'${_}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=i?uc.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(_,p=!1,y=!0)=>{let h=o?o[_]:_,v=p?_+"|| ''":`'${h}'`,x="";return i&&y&&!p&&uc.includes(_)&&(x+=`d.style.colorScheme = '${_}';`),n==="class"?p||h?x+=`c.add(${v})`:x+="null":h&&(x+=`d[s](n,${v})`),x},m=e?`!function(){${c}${f(e)}}()`:r?`!function(){try{${c}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${cg}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}${u?"":"else{"+f(s,!1,!1)+"}"}${d}}catch(e){}}()`:`!function(){try{${c}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}else{${f(s,!1,!1)};}${d}}catch(t){}}();`;return g.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:m}})}),Ry=(e,t)=>{if(mT)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},ET=()=>{let e=document.createElement("style");return e.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},Ty=e=>(e||(e=window.matchMedia(cg)),e.matches?"dark":"light"),I=typeof window<"u"?window:void 0,mt=typeof globalThis<"u"?globalThis:I,St=mt==null?void 0:mt.navigator,j=mt==null?void 0:mt.document,Ae=mt==null?void 0:mt.location,fg=mt==null?void 0:mt.fetch,Jh=mt!=null&&mt.XMLHttpRequest&&"withCredentials"in new mt.XMLHttpRequest?mt.XMLHttpRequest:void 0,Iy=mt==null?void 0:mt.AbortController,ST=mt==null?void 0:mt.CompressionStream,Mt=St==null?void 0:St.userAgent;function xb(){return!(!I||I.navigator.onLine===!1)}var Ko=typeof globalThis<"u"?globalThis:I;Ko&&typeof self>"u"&&(Ko.self=Ko),Ko&&typeof File>"u"&&(Ko.File=function(){});var Y=I??{},Ee={DEBUG:!1,LIB_VERSION:"0.5.1",LIB_NAME:"browser-common"};function Oy(e,t,n,r,i,s,o){try{var a=e[s](o),l=a.value}catch(u){return void n(u)}a.done?t(l):Promise.resolve(l).then(r,i)}function Ce(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var s=e.apply(t,n);function o(l){Oy(s,r,i,o,a,"next",l)}function a(l){Oy(s,r,i,o,a,"throw",l)}o(void 0)})}}function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$.apply(null,arguments)}function bb(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var My=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Ay(e){return typeof e=="string"||e}function Ny(e){return typeof e=="string"?e:void 0}var Qo,CT=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],nr=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),$y=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),kT=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],PT=["token"],Eb="NativeGzipValidationError",Zh=e=>e.length>=2&&e[0]===31&&e[1]===139,Fy=(e,t)=>e===$y.GZipJS||t===$y.GZipJS||t==="gzip",Ly=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",Gl=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=Eb,t},RT=function(){var e=Ce(function*(t,n){18>t.size&&Gl("too-short");var r=new Uint8Array(yield t.slice(0,10).arrayBuffer());Zh(r)&&r[2]===8||Gl("invalid-header");var i=new DataView(yield t.slice(t.size-8).arrayBuffer());i.getUint32(0,!0)!==(o=>{for(var a=(()=>{if(Qo)return Qo;Qo=[];for(var c=0;256>c;c++){for(var d=c,f=0;8>f;f++)d=1&d?3988292384^d>>>1:d>>>1;Qo[c]=d>>>0}return Qo})(),l=4294967295,u=0;o.length>u;u++)l=a[255&(l^o[u])]^l>>>8;return(4294967295^l)>>>0})(n)&&Gl("invalid-crc");var s=n.length>>>0;i.getUint32(4,!0)!==s&&Gl("invalid-size")});return function(t,n){return e.apply(this,arguments)}}();function ep(){return ep=Ce(function*(e,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),o=s.write(r).then(()=>s.close()).catch(function(){var u=Ce(function*(c){try{yield s.abort(c)}catch{}throw c});return function(c){return u.apply(this,arguments)}}()),a=new Response(i.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield RT(l,r),l}catch(u){if(n!=null&&n.rethrow)throw u;return t&&console.error("Failed to gzip compress data",u),null}}),ep.apply(this,arguments)}var TT=20,Sb=1e3,IT=1e4,OT="[Circular]",tp="[Truncated]",cd="[Unserializable]",MT="[Function]";function qs(e){for(var t="",n=0;e.length>n;n++){var r=e.charCodeAt(n);if(55296>r||r>56319)t+=56320>r||r>57343?e[n]:"�";else{var i=e.charCodeAt(n+1);56320>i||i>57343?t+="�":(t+=e[n]+e[n+1],n++)}}return t}var AT=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],jy=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return AT.concat(t).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})};function J(e,t){return e.indexOf(t)!==-1}var dd=function(e){return e.trim()},np=function(e){return e.replace(/^\$/,"")};function Cb(e){var t,n=[];return(t=JSON.stringify(e,function(r,i){if(typeof i=="bigint")return i.toString();if(typeof i!="function"&&typeof i!="symbol"){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&typeof i=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(i))return"[Circular]";n.push(i)}return i}}))!==null&&t!==void 0?t:"null"}var kb=Object.prototype,Pb=kb.hasOwnProperty,fd=kb.toString,Z=Array.isArray||function(e){return fd.call(e)==="[object Array]"},vt=e=>typeof e=="function",Se=e=>e===Object(e)&&!Z(e),En=e=>{if(Se(e)){for(var t in e)if(Pb.call(e,t))return!1;return!0}return!1},L=e=>e===void 0,ce=e=>fd.call(e)=="[object String]",cc=e=>ce(e)&&e.trim().length===0,rt=e=>e===null,ne=e=>L(e)||rt(e),Ge=e=>fd.call(e)=="[object Number]"&&e==e,Jn=e=>Ge(e)&&e>0,$t=e=>fd.call(e)==="[object Boolean]",NT=e=>e instanceof FormData,$T=e=>J(kT,e),FT=e=>J(PT,e);function Rb(e){return e===null||typeof e!="object"}function dc(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Tb(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Ib(e,Error)}}function hg(e){return typeof Event<"u"&&Ib(e,Event)}function Ib(e,t){try{return e instanceof t}catch{return!1}}var LT=[!0,"true",1,"1","yes"],lf=e=>J(LT,e),jT=[!1,"false",0,"0","no"];function Vn(e,t,n,r,i){return t>n&&(r.warn("min cannot be greater than max."),t=n),Ge(e)?e>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),Vn(i||n,t,n,r))}class DT{constructor(t){this.k={},this.S=t.S,this.C=Vn(t.bucketSize,0,100,t.I),this.R=Vn(t.refillRate,0,this.C,t.I),this.A=Vn(t.refillInterval,0,864e5,t.I)}O(t,n){var r=Math.floor((n-t.lastAccess)/this.A);r>0&&(t.tokens=Math.min(t.tokens+r*this.R,this.C),t.lastAccess=t.lastAccess+r*this.A)}consumeRateLimit(t){var n,r=Date.now(),i=String(t),s=this.k[i];return s?this.O(s,r):this.k[i]=s={tokens:this.C,lastAccess:r},s.tokens===0||(s.tokens--,s.tokens===0&&((n=this.S)==null||n.call(this,t)),s.tokens===0)}stop(){this.k={}}}var Yt="Mobile",fc="iOS",fr="Android",wo="Tablet",Ob=fr+" "+wo,Mb="iPad",Ab="Apple",Nb=Ab+" Watch",Sa="Safari",xo="BlackBerry",$b="Samsung",Fb=$b+"Browser",Lb=$b+" Internet",Hi="Chrome",zT=Hi+" OS",jb=Hi+" "+fc,pg="Internet Explorer",Db=pg+" "+Yt,vg="Opera",UT=vg+" Mini",gg="Edge",zb="Microsoft "+gg,Ws="Firefox",Ub=Ws+" "+fc,Ka="Nintendo",Qa="PlayStation",Hs="Xbox",Vb=fr+" "+Yt,Bb=Yt+" "+Sa,ua="Windows",rp=ua+" Phone",Dy="Nokia",ip="Ouya",qb="Generic",VT=qb+" "+Yt.toLowerCase(),Wb=qb+" "+wo.toLowerCase(),sp="Konqueror",Hb="Oculus Browser",hc="Vivaldi",Gb="Yandex",pc="Whale",op="DuckDuckGo",Kb="Pale Moon",vc="Waterfox",Ca="Brave",Qb="Google Search App",Le="(\\d+(\\.\\d+)?)",uf=new RegExp("Version/"+Le),BT=new RegExp(Hs,"i"),qT=new RegExp(Qa+" \\w+","i"),WT=new RegExp(Ka+" \\w+","i"),mg=new RegExp(xo+"|PlayBook|BB10","i"),HT={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Yb=function(e,t,n,r){t=t||"";var i=function(s){return s!=null&&s.brave?Ca:null}(n);return i||(r!=null&&r.detectGoogleSearchApp&&J(e,"GSA/")?Qb:J(e," OPR/")&&J(e,"Mini")?UT:J(e," OPR/")?vg:mg.test(e)?xo:J(e,"IE"+Yt)||J(e,"WPDesktop")?Db:J(e,"OculusBrowser")?Hb:J(e,Fb)?Lb:J(e,gg)||J(e,"Edg/")?zb:J(e,hc+"/")?hc:J(e,"YaBrowser/")?Gb:J(e,pc+"/")?pc:J(e,op+"/")||J(e,"Ddg/")?op:J(e,"FBIOS")?"Facebook "+Yt:J(e,"UCWEB")||J(e,"UCBrowser")?"UC Browser":J(e,"CriOS")?jb:J(e,"CrMo")||J(e,Hi)?Hi:J(e,fr)&&J(e,Sa)?Vb:J(e,"FxiOS")?Ub:J(e.toLowerCase(),sp.toLowerCase())?sp:J(e,Ca+"/")?Ca:((s,o)=>o&&J(o,Ab)||function(a){return J(a,Sa)&&!J(a,Hi)&&!J(a,fr)}(s))(e,t)?J(e,Yt)?Bb:Sa:J(e,"PaleMoon/")?Kb:J(e,vc+"/")?vc:J(e,Ws)?Ws:J(e,"MSIE")||J(e,"Trident/")?pg:J(e,"Gecko")?Ws:"")},GT={[Db]:[new RegExp("rv:"+Le)],[zb]:[new RegExp(gg+"?\\/"+Le)],[Hi]:[new RegExp("("+Hi+"|CrMo)\\/"+Le)],[jb]:[new RegExp("CriOS\\/"+Le)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Le)],[Sa]:[uf],[Bb]:[uf],[vg]:[new RegExp("(Opera|OPR)\\/"+Le)],[Ws]:[new RegExp(Ws+"\\/"+Le)],[Ub]:[new RegExp("FxiOS\\/"+Le)],[sp]:[new RegExp("Konqueror[:/]?"+Le,"i")],[xo]:[new RegExp(xo+" "+Le),uf],[Vb]:[new RegExp("android\\s"+Le,"i")],[Lb]:[new RegExp(Fb+"\\/"+Le)],[Hb]:[new RegExp("OculusBrowser\\/"+Le)],[hc]:[new RegExp(hc+"\\/"+Le)],[Gb]:[new RegExp("YaBrowser\\/"+Le)],[pc]:[new RegExp(pc+"\\/"+Le)],[Ca]:[new RegExp(Ca+"\\/"+Le)],[op]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Le)],[Kb]:[new RegExp("PaleMoon\\/"+Le)],[vc]:[new RegExp(vc+"\\/"+Le)],[Qb]:[new RegExp("GSA\\/"+Le)],[pg]:[new RegExp("(rv:|MSIE )"+Le)],Mozilla:[new RegExp("rv:"+Le)]},KT=function(e,t,n,r){var i=Yb(e,t,n,r),s=GT[i];if(L(s))return null;for(var o=0;s.length>o;o++){var a=e.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},zy=[[new RegExp(Hs+"; "+Hs+" (.*?)[);]","i"),e=>[Hs,e&&e[1]||""]],[new RegExp(Ka,"i"),[Ka,""]],[new RegExp(Qa,"i"),[Qa,""]],[mg,[xo,""]],[new RegExp(ua,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[rp,""];if(new RegExp(Yt).test(t)&&!/IEMobile\b/.test(t))return[ua+" "+Yt,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=HT[n[1]]||"";return/arm/i.test(t)&&(r="RT"),[ua,r]}return[ua,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[fc,[e[3],e[4],e[5]||"0"].join(".")]:[fc,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=L(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+fr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+fr+")","i"),e=>e&&e[2]?[fr,[e[2],e[3],e[4]||"0"].join(".")]:[fr,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[zT,""]],[/Linux|debian/i,["Linux",""]]],Uy=function(e){return WT.test(e)?Ka:qT.test(e)?Qa:BT.test(e)?Hs:new RegExp(ip,"i").test(e)?ip:new RegExp("("+rp+"|WPDesktop)","i").test(e)?rp:/iPad/.test(e)?Mb:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Nb:mg.test(e)?xo:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Dy,"i").test(e)?Dy:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Yt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?fr:Ob:new RegExp("(pda|"+Yt+")","i").test(e)?VT:new RegExp(wo,"i").test(e)&&!new RegExp(wo+" pc","i").test(e)?Wb:""},QT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Vy(e,t){return typeof(n=e)=="string"&&QT.test(n)?e:t();var n}function li(e){return e&&e.split("#")[0]}function yg(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function By(e,t,n){return Xb.apply(this,arguments)}function Xb(){return(Xb=Ce(function*(e,t,n){var r;try{return yield Promise.race([e,new Promise((i,s)=>{r=yg(()=>{try{n==null||n(),i()}catch(o){s(o)}},t)})])}finally{clearTimeout(r)}})).apply(this,arguments)}var Jb={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},YT=Jb.info,qy=9223372036854776e3,XT={}.propertyIsEnumerable;function gc(e,t){try{return Zb(e,t,{ancestors:new WeakSet,remainingNodes:IT},0)}catch{return[]}}function _g(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:tp};if(n.remainingNodes--,$t(e))return{boolValue:e};if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};var i=BigInt(e).toString();return e>=qy||-qy>e?(t==null||t.debug("Attribute "+i+" is outside the int64 range; encoding it as a string"),{stringValue:i}):{intValue:i}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:qs(e)};if(typeof e=="function")return{stringValue:MT};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(n.ancestors.has(e))return{stringValue:OT};if(r>=TT)return{stringValue:tp};if(e instanceof Date){var s=e.getTime(),o=Number.isFinite(s)?e.toISOString():String(e);return{stringValue:typeof o=="string"?qs(o):String(o)}}n.ancestors.add(e);try{try{var a=e.toJSON;if(typeof a=="function")return _g(a.call(e),t,n,r+1)}catch{}return Z(e)?{arrayValue:{values:JT(e,t,n,r+1)}}:{kvlistValue:{values:Zb(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:qs(String(e))}}function JT(e,t,n,r){for(var i=[],s=Math.min(e.length,Sb),o=0;s>o&&n.remainingNodes>0;o++)try{var a=o in e?e[o]:void 0;if(ne(a))continue;i.push(_g(a,t,n,r))}catch{i.push({stringValue:cd})}return e.length>o&&i.push({stringValue:tp}),i}function Zb(e,t,n,r){var i=[];for(var s in e)if(XT.call(e,s)){if(i.length>=Sb||0>=n.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=e[s];if(rt(o)||L(o))continue;i.push({key:qs(s),value:_g(o,t,n,r)})}catch{i.push({key:qs(s),value:{stringValue:cd}})}}return i}function ZT(e){try{return qs(String(e))}catch{return cd}}function eI(e,t,n){var r=Jb[e.level||"info"]||YT,i=r.text,s=r.number,o=String(Date.now())+"000000",a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.windowId&&(a["window.id"]=t.windowId),ne(t.sessionStartTimestamp)||(a.sessionStartTimestamp=String(t.sessionStartTimestamp)),ne(t.lastActivityTimestamp)||(a.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var l=$({},a),u=e.attributes;if(u){var c=[];try{c=Object.keys(u)}catch{c=[]}for(var d of c){var f=void 0;try{f=u[d]}catch{f=cd}Object.defineProperty(l,d,{value:f,enumerable:!0,writable:!0,configurable:!0})}}var m={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:s,severityText:i,body:{stringValue:ZT(e.body)},attributes:gc(l,n)};return e.trace_id&&(m.traceId=e.trace_id),e.span_id&&(m.spanId=e.span_id),L(e.trace_flags)||(m.flags=e.trace_flags),m}function eE(e,t,n){return $({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function tE(e,t,n,r){return{resourceLogs:[{resource:{attributes:gc(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}let tI=class{constructor(e,t,n,r,i,s,o){var a;s===void 0&&(s=()=>Promise.resolve()),this._instance=e,this.qi=t,this.I=n,this.rn=r,this.nn=i,this.sn=s,this.an=o,this.ln=null,this.un=0,this.hn=0,this.dn=0,this.vn=0,this.cn=!1,this.fn=t.maxBufferSize,this.pn=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?a:t.maxBufferSize,t.maxBufferSize),this.gn=t.flushIntervalMs,this.mn=t.maxBatchRecordsPerPost,this.yn=t.rateCapWindowMs,this.bn=t.maxLogsPerInterval}reset(){this._n(),this.ln=null,this.dn=0,this.vn=0,this.cn=!1,this.un=0,this.hn=0,this.mn=this.qi.maxBatchRecordsPerPost}onReconnect(){this.hn=0,this.wn()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.kn(e);if(t!==null)if(t.body){if(this.Sn()){var n={record:eI(t,this.rn(),this.I)};this.nn(()=>this.xn(n))}}else this.I.info("Log was rejected in beforeSend function")}}kn(e){var t=this.qi.beforeSend;if(!t)return e;var n=Z(t)?t:[t],r=e;for(var i of n)try{var s=i(r);if(!s)return this.I.info("Log was rejected in beforeSend function"),null;r=s}catch(o){return this.I.error("Error in beforeSend function for log:",o),null}return r}Sn(){if(this.bn===void 0)return!0;var e=Date.now(),t=e-this.dn;return this.yn>t&&t>=0||(this.dn=e,this.vn=0,this.cn=!1),this.bn>this.vn?(this.vn++,!0):(this.cn||(this.I.warn("captureLog dropping logs: exceeded "+this.bn+" logs per "+this.yn+"ms"),this.cn=!0),!1)}flush(){var e=this;return Ce(function*(){if(!e._instance.isDisabled)return e.ln||(e.ln=e.Cn().finally(()=>{e.ln=null})),e.ln})()}Cn(){var e=this;return Ce(function*(){var t;e._n();var n=(t=e._instance.getPersistedProperty(nr.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var r=n.length,i=0;n.length>0&&r>i;){var s,o;e.un=0;var a=Math.min(n.length,e.mn),l=n.slice(0,a),u=tE(l.map(d=>d.record),e.Tn(),(s=e.an)!==null&&s!==void 0?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance.Mn(u);if(c.kind==="too-large"&&l.length>1)e.mn=Math.max(1,Math.floor(l.length/2)),e.I.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+e.mn);else if(c.kind==="retry-later"||(c.kind==="too-large"?e.I.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):c.kind==="ok"&&e.qi.maxBatchRecordsPerPost>e.mn&&(e.mn=Math.min(e.qi.maxBatchRecordsPerPost,e.mn+1)),yield e.En(l.length),n=(o=e._instance.getPersistedProperty(nr.LogsQueue))!==null&&o!==void 0?o:[],i+=l.length,c.kind==="fatal"))throw c.error}})()}En(e){var t=this;return Ce(function*(){var n,r=Math.max(0,e-t.un),i=(n=t._instance.getPersistedProperty(nr.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(nr.LogsQueue,i.slice(r)),yield t.sn()})()}Tn(){return eE(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(nr.LogsQueue))!==null&&t!==void 0?t:[];this.pn>n.length||(n.shift(),this.un++,this.I.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(nr.LogsQueue,n),this.fn>n.length?this.In():this.wn()}}In(e){e===void 0&&(e=this.gn),this.Rn||(this.Rn=yg(()=>{this.Rn=void 0,this.wn()},e))}Pn(){var e=Math.min(Math.max(0,this.hn-1),6);return this.gn*Math.pow(2,e)}An(){var e=this._instance.getPersistedProperty(nr.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Ce(function*(){t._n();var n=t.flush().catch(()=>{});e!==void 0?yield By(n,e):yield n})()}flushWithTimeout(e){var t=this;return Ce(function*(){var n=t.flush();yield By(n,e,()=>{n.catch(()=>{})})})()}wn(){this.flush().then(()=>{this.hn=0},e=>{this.hn++,this.I.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.An()&&this.In(this.Pn())})}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}};var cf=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Wy(e){return String(e)+"000000"}function Hy(e,t,n,r){var i="";return r&&(i=Object.keys(r).sort().map(s=>JSON.stringify(s)+":"+JSON.stringify(r[s])).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+i}let nI=class{constructor(e,t,n){this._instance=e,this.qi=t,this.I=n,this.Fn=new Map,this.ln=null,this.On=!1,this.Ln=new Map,this.$n=new Set,this.Dn=0}count(e,t,n){t===void 0&&(t=1),this.Nn({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Nn({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Nn({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.ln,n=function(){var i=Ce(function*(){t&&(yield t.catch(()=>{})),yield e.qn()});return function(){return i.apply(this,arguments)}}(),r=n().finally(()=>{this.ln===r&&(this.ln=null)});return this.ln=r,r}drainWindow(){if(this.Fn.size===0)return null;var e=this.Fn;return this.Fn=new Map,this.On=!1,this.Ln=new Map,this.$n=new Set,this.jn(e)}reset(){this.Dn++,this._n(),this.Fn=new Map,this.ln=null,this.On=!1,this.Ln=new Map,this.$n=new Set}Nn(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.kn(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.I.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,r;try{n=t.attributes?$({},t.attributes):void 0,r=Hy(t.type,t.name,t.unit,n)}catch(o){return void this.I.warn("Dropping metric '"+t.name+"': attributes could not be serialized",o)}var i=this.Fn.get(r);if(!i){if(!this.Bn())return;i={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Fn.set(r,i)}var s=this.Ln.get(t.name);s===void 0?this.Ln.set(t.name,t.type):s===t.type||this.$n.has(t.name)||(this.$n.add(t.name),this.I.warn("Metric name '"+t.name+"' is already used as a "+s+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Hn(i,t.value),this.In()}else this.I.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}Bn(){return this.qi.maxSeriesPerFlush>this.Fn.size||(this.On||(this.On=!0,this.I.warn("Metric series cap reached ("+this.qi.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Hn(e,t){var n;switch(e.type){case"count":e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(cf.length+1).fill(0)});var r=e.hist;r.count+=1,r.sum+=t,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.bucketCounts[function(i,s){for(var o=0;s.length>o;o++)if(s[o]>=i)return o;return s.length}(t,cf)]+=1}}kn(e){var t=this.qi.beforeSend;if(!t)return e;var n=Z(t)?t:[t],r=e;for(var i of n)try{var s=i(r);if(!s)return this.I.info("Metric was rejected in beforeSend function"),null;r=s}catch(o){return this.I.error("Error in beforeSend function for metric:",o),null}return r}In(){this.Rn||(this.Rn=yg(()=>{this.Rn=void 0,this.flush().catch(e=>{this.I.error("Metrics flush failed:",e)})},this.qi.flushIntervalMs))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}qn(){var e=this;return Ce(function*(){if(e.Fn.size!==0){var t=e.Fn;e.Fn=new Map,e.On=!1,e.Ln=new Map,e.$n=new Set;var n=e.Dn,r=yield e._instance.Un(e.jn(t));if(n===e.Dn)switch(r.kind){case"ok":return;case"retry-later":return e.zn(t),void e.In();case"too-large":return void e.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.I.error("Failed to send metrics batch:",r.error)}}})()}jn(e){return t=this.Wn(e),n=function(s,o,a){return $({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":o,"telemetry.sdk.version":a})}(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:gc(n)},scopeMetrics:[{scope:{name:r,version:i},metrics:t}]}]};var t,n,r,i}Wn(e){var t=Wy(Date.now()),n=new Map;for(var r of e.values()){var i,s=Hy(r.type,r.name,r.unit,void 0),o=n.get(s);o||(o=$({name:r.name},r.unit&&{unit:r.unit}),r.type==="count"?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type==="gauge"?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},n.set(s,o));var a=gc((i=r.attributes)!==null&&i!==void 0?i:{},this.I),l=Wy(r.windowStartMs);if(r.type==="count"){var u,c={attributes:a,startTimeUnixNano:l,timeUnixNano:t,asDouble:(u=r.total)!==null&&u!==void 0?u:0};o.sum.dataPoints.push(c)}else if(r.type==="gauge"){var d,f={attributes:a,timeUnixNano:t,asDouble:(d=r.last)!==null&&d!==void 0?d:0};o.gauge.dataPoints.push(f)}else r.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:cf})}return Array.from(n.values())}zn(e){var t,n;for(var r of e){var i=r[0],s=r[1],o=this.Fn.get(i);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,s.windowStartMs),o.type){case"count":o.total=((t=o.total)!==null&&t!==void 0?t:0)+((n=s.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(s.hist)if(o.hist){o.hist.count+=s.hist.count,o.hist.sum+=s.hist.sum,o.hist.min=Math.min(o.hist.min,s.hist.min),o.hist.max=Math.max(o.hist.max,s.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else o.hist=s.hist}else this.Bn()&&this.Fn.set(i,s)}}};var Kl,Gy,df;function rI(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return df&&n.length===Gy||(Gy=n.length,df=n.reduce((r,i)=>{Kl||(Kl={});var s=Kl[i];if(s)r[s[0]]=s[1];else for(var o=e(i),a=o.length-1;a>=0;a--){var l=o[a],u=l==null?void 0:l.filename,c=t[i];if(u&&c){r[u]=c,Kl[i]=[u,c];break}}return r},{})),df}}class iI{constructor(t,n,r){r===void 0&&(r=[]),this.coercers=t,this.stackParser=n,this.modifiers=r}buildFromUnknown(t,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,n,0).apply(t),s=this.buildParsingContext(n),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(t){var n=this;return Ce(function*(){for(var r of t)r.stacktrace&&r.stacktrace.frames&&Z(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return t})()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var r,i;return t.cause!=null&&(r=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(i=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),$({},t,{cause:r,stack:i})}applyChunkIds(t,n){return t.map(r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r))}applyCoercers(t,n){for(var r of this.coercers)if(r.match(t))return r.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return Ce(function*(){var r=t;for(var i of n.modifiers)r=yield i(r);return r})()}convertToExceptionList(t,n){var r,i,s,o={type:t.type,value:t.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(i=n.handled)===null||i===void 0||i,synthetic:(s=t.synthetic)!==null&&s!==void 0&&s}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return t.cause!=null&&a.push(...this.convertToExceptionList(t.cause,$({},n,{handled:!0}))),a}buildParsingContext(t){var n;return{chunkIdMap:rI(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,r){r===void 0&&(r=0);var i=(s,o)=>{if(4>=o){var a=this.buildCoercingContext(t,n,o);return this.applyCoercers(s,a)}};return $({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:t,apply:s=>i(s,r),next:s=>i(s,r+1)})}}var bo="?";function ap(e,t,n,r,i){var s={platform:e,filename:t,function:n===""?bo:n,in_app:!(t!=null&&t.startsWith("webkit-masked-url://"))&&t!==""};return L(r)||(s.lineno=r),L(i)||(s.colno=i),s}var nE=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:bo,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},sI=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,oI=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,aI=/\((\S*)(?::(\d+))(?::(\d+))\)/,lI=(e,t)=>{var n=sI.exec(e);if(n)return ap(t,n[1],bo,+n[2],+n[3]);var r=oI.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){var i=aI.exec(r[2]);i&&(r[2]=i[1],r[3]=i[2],r[4]=i[3])}var s=nE(r[1]||bo,r[2]);return ap(t,s[1],s[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},uI=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,cI=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,dI=(e,t)=>{var n=uI.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=cI.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var i=n[3],s=n[1]||bo,o=nE(s,i);return ap(t,i=o[1],s=o[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Ky=/\(error: (.*)\)/;class fI{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=ce(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return dc(t,"DOMException")}isDOMError(t){return dc(t,"DOMError")}}class hI{match(t){return Tb(t)}coerce(t,n){var r,i=this.getStack(t),s=i===void 0;return{type:this.getType(t),value:this.getMessage(t,n),stack:i??((r=n.syntheticException)==null?void 0:r.stack),cause:t.cause?n.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var r=t.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(t){return t.stacktrace||t.stack||void 0}}class pI{constructor(){}match(t){return!!dc(t,"ErrorEvent")&&(t.error!=null||this.fi(t))}coerce(t,n){var r;if(t.error!=null)return n.apply(t.error);var i=n.apply(t.message);return $({},i,{stack:(r=this.pi(t))!==null&&r!==void 0?r:i.stack,synthetic:!0})}fi(t){return ce(t.message)&&t.message.length>0}pi(t){var n,r,i=t,s=(n=i.lineno)!==null&&n!==void 0?n:0,o=(r=i.colno)!==null&&r!==void 0?r:0;if(ce(i.filename)&&i.filename.length!==0&&s!==0)return`Error + at `+i.filename+":"+s+":"+o}}var vI=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class gI{match(t){return typeof t=="string"}coerce(t,n){var r,i=this.getInfos(t),s=i[0],o=i[1];return{type:s??"Error",value:o??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,i=t.match(vI);return i&&(n=i[1],r=i[2]),[n,r]}}var mI=["fatal","error","warning","log","info","debug"];function rE(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(t>=i.length)return r===n.length?i:i.length>t?i.slice(0,t)+"...":i}return""}class yI{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,i,s=this.getErrorPropertyFromObject(t);return s?n.apply(s):{type:this.getType(t),value:this.getValue(t),stack:(r=this.getStack(t))!==null&&r!==void 0?r:(i=n.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(hg(t))return t.constructor.name;var n="name"in t?t.name:void 0;return ce(n)&&!cc(n)?n:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+rE(t)}isSeverityLevel(t){return ce(t)&&!cc(t)&&mI.indexOf(t)>=0}getStack(t){try{return ce(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:ce(t.stack)&&t.stack.length>0?t.stack:void 0}catch{return}}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var r=t[n];if(Tb(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class _I{match(t){return hg(t)}coerce(t,n){var r,i=t.constructor.name;return{type:i,value:i+" captured as exception with keys: "+rE(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class wI{match(t){return Rb(t)}coerce(t,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class xI{match(t){return dc(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!hg(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var r,i=this.getUnhandledRejectionReason(t);return Rb(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var mc="$message",yc="$timestamp",bI=new Set([mc,yc]),ff={enabled:!0,max_bytes:32768};function _c(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:ff.enabled,max_bytes:SI(e.max_bytes,ff.max_bytes)}:$({},ff)}class EI{constructor(t){this.Vn=[],this.Gn=0,this.qi=_c(t)}setConfig(t){this.qi=_c(t),this.Zn()}add(t){var n=function(i){var s;try{s=Cb(i)}catch{return}try{var o=JSON.parse(s);if(!Se(o))return;var a=o,l=a[mc],u=a[yc];return!ce(l)||l.trim().length===0||!ce(u)&&!Ge(u)?void 0:{step:a,json:s}}catch{return}}(t);if(n){var r=function(i){if(typeof TextEncoder<"u")return new TextEncoder().encode(i).length;for(var s=encodeURIComponent(i),o=0,a=0;s.length>a;a++)s[a]==="%"?(o+=1,a+=2):o+=1;return o}(n.json);r>this.qi.max_bytes||(this.Vn.push({step:n.step,bytes:r}),this.Gn+=r,this.Zn())}}getAttachable(){return this.Vn.map(t=>t.step)}clear(){this.Vn=[],this.Gn=0}size(){return this.Vn.length}Zn(){for(;this.Gn>this.qi.max_bytes&&this.Vn.length>0;){var t=this.Vn.shift();t&&(this.Gn-=t.bytes)}}}function SI(e,t){if(!Ge(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var iE=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={F(i){if(I&&(Ee.DEBUG||I.POSTHOG_DEBUG||n)&&!L(I.console)&&I.console){for(var s=("__rrweb_original__"in I.console[i])?I.console[i].__rrweb_original__:I.console[i],o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];s(e,...a)}},debug(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.F("debug",...s)},info(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.F("log",...s)},warn(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.F("warn",...s)},error(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.F("error",...s)},critical(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];console.error(e,...s)},uninitializedWarning(i){r.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>iE(e+" "+i,s)};return r},D=iE("[PostHog.js]"),Ie=D.createLogger,CI=Ie("[ExternalScriptsLoader]"),wc=e=>{var t=j==null?void 0:j.querySelectorAll("script");if(t){for(var n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute("src")===e)return t[n]}},Si=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return CI.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=wc(t);if(r){if(r.__posthog_loading_callback_fired)return n();var i=r.__posthog_loading_error;return i?n(i):(r.addEventListener("load",o=>{r.__posthog_loading_callback_fired=!0,n(void 0,o)}),void r.addEventListener("error",o=>{r.__posthog_loading_error=o,n(o)}))}var s=()=>{if(!j)return n("document not found");if(wc(t))return Si(e,t,n);var o=j.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=t,o.onload=u=>{o.__posthog_loading_callback_fired=!0,n(void 0,u)},o.onerror=u=>{o.__posthog_loading_error=u,n(u)},e.config.prepare_external_dependency_script&&(o=e.config.prepare_external_dependency_script(o)),!o)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")j.head.appendChild(o);else{var a,l=j.querySelectorAll("body > script");l.length>0?(a=l[0].parentNode)==null||a.insertBefore(o,l[0]):j.body.appendChild(o)}};j!=null&&j.body?s():j==null||j.addEventListener("DOMContentLoaded",s)},hf={},Qy=(e,t)=>{var n="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var r=3e5;n=n+"&t="+Math.floor(Date.now()/r)*r}return e.requestRouter.endpointFor("assets",n)};Y.__PosthogExtensions__=Y.__PosthogExtensions__||{},Y.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var r=e.config.strict_script_versioning;if(r){var i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js"),s=hf[i];if(r==="fallback"&&s){if(wc(s))return void Si(e,s,n);delete hf[i]}Si(e,i,r==="fallback"?(a,l)=>{if(a)if(typeof a=="string")n(a);else{var u,c=Qy(e,t);hf[i]=c;var d=wc(i);d==null||(u=d.parentNode)==null||u.removeChild(d),Si(e,c,n)}else n(void 0,l)}:n)}else Si(e,Qy(e,t),n)}else{var o=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Si(e,o,n)}},Y.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Si(e,r,n)};Ee.DEBUG=!1,Ee.LIB_VERSION="1.418.16",Ee.LIB_NAME="web";var sE="$people_distinct_id",wt="distinct_id",Ya="$device_id",pf="$device_model",$s="__alias",ca="__timers",lp="$autocapture_disabled_server_side",up="$heatmaps_enabled_server_side",cp="$exception_capture_enabled_server_side",dp="$error_tracking_suppression_rules",fp="$error_tracking_capture_extension_exceptions",hp="$web_vitals_enabled_server_side",wg="$dead_clicks_enabled_server_side",xg="$product_tours_enabled_server_side",pp="$web_vitals_allowed_metrics",Oi="$session_recording_remote_config",oE="$replay_sample_rate",aE="$replay_override_sampling",lE="$replay_override_linked_flag",uE="$replay_override_url_trigger",cE="$replay_override_event_trigger",Fs="$sesid",bg="$session_is_sampled",ir="$enabled_feature_flags",Mi="$active_feature_flags",Pu="$early_access_features",Xa="$feature_flag_details",Ai="$feature_flag_payloads",Gs="$feature_flag_request_id",xc="$minimal_flag_called_events",Mn="$override_feature_flags",Ci="$override_feature_flag_payloads",yn="$stored_person_properties",Dn="$stored_group_properties",dE="$groups",vp="$surveys",bc="$surveys_loaded_at",gp="$surveys_activated",Ru="$surveys_activated_session",Tu="$surveys_activated_timestamps",da="ph_product_tours",ar="$flag_call_reported",fa="$flag_call_reported_session_id",Ks="$feature_flag_errors",Gi="$feature_flag_evaluated_at",se="$user_state",mp="$client_session_props",yp="$capture_rate_limit",_p="$initial_campaign_params",wp="$initial_referrer_info",Ec="$initial_person_info",Sc="$epp",fs="$posthog_cookieless",fE="$cookieless_mode",hE="$sdk_debug_extensions_init_method",pE="$sdk_debug_extensions_init_time_ms",xp="$sdk_debug_recording_script_not_loaded",Eg="PostHog loadExternalDependency extension not found.",ki="on_reject",lr="always",We="anonymous",ot="identified",bp="identified_only",Cc="visibilitychange",kc="beforeunload",xs="$pageview",vf="$pageleave",gf="$identify",Yy="$groupidentify";function Ql(e,t){Z(e)&&e.forEach(t)}function ve(e,t){if(!ne(e))if(Z(e))e.forEach(t);else if(NT(e))e.forEach((r,i)=>t(r,i));else for(var n in e)Pb.call(e,n)&&t(e[n],n)}var _e=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var i of n)for(var s in i)i[s]!==void 0&&(e[s]=i[s]);return e};function Iu(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Xy=function(e){try{return e()}catch{return}},kI=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(i){D.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),D.critical(i)}}},Sg=function(e){var t={};return ve(e,function(n,r){(ce(n)&&n.length>0||Ge(n))&&(t[r]=n)}),t},PI=["herokuapp.com","vercel.app","netlify.app"];function RI(e){var t=e==null?void 0:e.hostname;if(!ce(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of PI)if(n===r)return!1;return!0}function Re(e,t,n,r){var i=r??{},s=i.capture,o=i.passive;e==null||e.addEventListener(t,n,{capture:s!==void 0&&s,passive:o===void 0||o})}function Ep(e){return e.name==="ph_toolbar_internal"}var vE=e=>{if(j){try{for(var t=e+"=",n=j.cookie.split(";").filter(s=>s.length),r=0;n.length>r;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ge(e)&&isFinite(e)&&Math.floor(e)===e});class Pc{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||0>t||0>n||0>r||0>i||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new Pc(s)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Pc(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class TI{generate(){var t=this.generateOrAbort();if(!L(t))return t;this.Rr=0;var n=this.generateOrAbort();if(L(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.Rr)this.Rr=t,this.Ar();else{if(this.Rr>=t+1e4)return;this.Lr++,this.Lr>4398046511103&&(this.Rr++,this.Ar())}return Pc.fromFieldsV7(this.Rr,Math.trunc(this.Lr/Math.pow(2,30)),this.Lr&Math.pow(2,30)-1,this.Or.nextUint32())}Ar(){this.Lr=1024*this.Or.nextUint32()+(1023&this.Or.nextUint32())}constructor(){this.Rr=0,this.Lr=0,this.Or=new II}}var Jy,gE=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};I&&!L(I.crypto)&&crypto.getRandomValues&&(gE=e=>crypto.getRandomValues(e));class II{nextUint32(){return this.ft.length>this.Fr||(gE(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var $n=()=>OI().toString(),OI=()=>(Jy||(Jy=new TI)).generate(),Yo="",MI=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Ke={Dr:()=>!!j,jr(e){D.error("cookieStore error: "+e)},Pr:vE,Br(e){var t;try{t=JSON.parse(Ke.Pr(e))||{}}catch{}return t},Nr(e,t,n,r,i){if(!j)return!1;try{var s="",o="",a=function(c,d){if(d){var f=function(_,p){if(p===void 0&&(p=j),Yo)return Yo;if(!p||["localhost","127.0.0.1"].includes(_))return"";for(var y=_.split("."),h=Math.min(y.length,8),v="dmn_chk_"+$n();!Yo&&h--;){var x=y.slice(h).join("."),b=v+"=1;domain=."+x+";path=/";p.cookie=b+";max-age=3",p.cookie.includes(v)&&(p.cookie=b+";max-age=0",Yo=x)}return Yo}(c);if(!f){var m=(_=>{var p=_.match(MI);return p?p[0]:""})(c);m!==f&&D.info("Warning: cookie subdomain discovery mismatch",m,f),f=m}return f?"; domain=."+f:""}return""}(j.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),s="; expires="+l.toUTCString()}i&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&D.warn("cookieStore warning: large cookie, len="+u.length),j.cookie=u,!0}catch{return!1}},qr(e,t){if(j!=null&&j.cookie)try{Ke.Nr(e,"",-1,t)}catch{return}}},mf=null,ge={Dr(){if(!rt(mf))return mf;var e=!0;if(L(I))e=!1;else try{var t="__mplssupport__";ge.Nr(t,"xyz"),ge.Pr(t)!=='"xyz"'&&(e=!1),ge.qr(t)}catch{e=!1}return e||D.error("localStorage unsupported; falling back to cookie store"),mf=e,e},jr(e){D.error("localStorage error: "+e)},Pr(e){try{return I==null?void 0:I.localStorage.getItem(e)}catch(t){ge.jr(t)}return null},Br(e){try{return JSON.parse(ge.Pr(e))||{}}catch{}return null},Nr(e,t){try{return I==null||I.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){ge.jr(n)}return!1},qr(e){try{I==null||I.localStorage.removeItem(e)}catch(t){ge.jr(t)}}},yf=[yn,Mi,ir,Xa,Ai,Gs,Gi,Ks,ar],Pi=[Ya,wt,Fs,bg,Sc,Ec,se],Rc=e=>e+"_cpm",AI=["__proto__","constructor","prototype"],_f=e=>{if(!Se(e))return{};var t={};return Object.keys(e).forEach(n=>{AI.indexOf(n)===-1&&(t[n]=e[n])}),t},wf=function(e,t){t===void 0&&(t=[]);var n={};return[...Pi,...t].forEach(r=>{var i=e[r];L(i)||rt(i)||i===""||(n[r]=i)}),n},mE=e=>{for(var t=5381,n=2166136261,r=0;e.length>r;r++){var i=e.charCodeAt(r);t=33*t^i,n=Math.imul(n^i,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(n>>>0).toString(36)},Zy=(e,t)=>({p:t,f:mE(JSON.stringify(e))}),e_=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var n=Ke.Br(Rc(e)),r=(n==null?void 0:n.f)===mE(t)&&Z(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},xf=(e,t)=>t+"|"+(Ke.Pr(Rc(e))||""),Yl={},NI={Dr:()=>!0,jr(e){D.error("memoryStorage error: "+e)},Pr:e=>Yl[e]||null,Br:e=>Yl[e]||null,Nr:(e,t)=>(Yl[e]=t,!0),qr(e){delete Yl[e]}},mi=null,we={Dr(){if(!rt(mi))return mi;if(mi=!0,L(I))mi=!1;else try{var e="__support__";we.Nr(e,"xyz"),we.Pr(e)!=='"xyz"'&&(mi=!1),we.qr(e)}catch{mi=!1}return mi},jr(e){D.error("sessionStorage error: ",e)},Pr(e){try{return I==null?void 0:I.sessionStorage.getItem(e)}catch(t){we.jr(t)}return null},Br(e){try{return JSON.parse(we.Pr(e))||null}catch{}return null},Nr(e,t){try{return I==null||I.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){we.jr(n)}return!1},qr(e){try{I==null||I.sessionStorage.removeItem(e)}catch(t){we.jr(t)}}};class $I{constructor(t){this._instance=t}get qi(){return this._instance.config}get consent(){return this.cs()?0:this.fs}isOptedOut(){return this.qi.cookieless_mode===lr||this.isRejected()||this.consent===-1&&this.qi.cookieless_mode===ki}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qi.opt_out_capturing_by_default}optInOut(t){this.ps.Nr(this.gs,t?1:0,this.qi.cookie_expiration,this.qi.cross_subdomain_cookie,this.qi.secure_cookie)}reset(){this.ps.qr(this.gs,this.qi.cross_subdomain_cookie)}get gs(){var t=this._instance.config,n=t.token,r=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(r?r+n:"__ph_opt_in_out_"+n)}get fs(){var t=this.ps.Pr(this.gs);return lf(t)?1:J(jT,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,n=t==="localStorage"?ge:Ke;if(!this.ys||this.ys!==n){this.ys=n;var r=t==="localStorage"?Ke:ge;r.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(lf(r.Pr(this.gs))),r.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[St==null?void 0:St.doNotTrack,St==null?void 0:St.msDoNotTrack,Y.doNotTrack].some(t=>lf(t))}}function yE(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!vt(r))return t;try{var i=r(t);return ce(i)&&i?i:t}catch(s){return D.error("Error in get_current_url, falling back to window.location.href",s),t}}var _E="__POSTHOG_TOOLBAR__",FI=1,LI=3,jI=11;function t_(e){return e instanceof Element&&(e.id===_E||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function ui(e){return!!e&&e.nodeType===FI}function Kt(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function wE(e){return!!e&&e.nodeType===LI}function xE(e){return!!e&&e.nodeType===jI&&ui(e.host)}var bE=1e3;function Cg(e){return e?dd(e).split(/\s+/):[]}function n_(e,t){var n=function(r){var i,s=I==null||(i=I.location)==null?void 0:i.href;return L(s)?void 0:yE(r,s)}(t);return!!(n&&e&&e.some(r=>n.match(r)))}function Tc(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Cg(t)}function EE(e){return ne(e)?null:dd(e).split(/(\s+)/).filter(t=>ka(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ja(e){var t="";return kp(e)&&!RE(e)&&e.childNodes&&e.childNodes.length&&ve(e.childNodes,function(n){var r;wE(n)&&n.textContent&&(t+=(r=EE(n.textContent))!==null&&r!==void 0?r:"")}),dd(t)}function Sp(e){var t;return L(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var kg=["a","button","form","input","select","textarea","label"];function Cp(e,t){if(L(t))return!0;var n,r=function(s){if(t.some(o=>function(a,l){var u=a.matches||a.matchesSelector||a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.oMatchesSelector;try{return!!u&&u.call(a,l)}catch{return!1}}(s,o)))return{v:!0}};for(var i of e)if(n=r(i))return n.v;return!1}function SE(e){var t=e.parentNode;return!(!t||!ui(t))&&t}var DI=[".ph-no-autocapture","[data-ph-no-autocapture]"],CE=["next","previous","prev",">","<"],zI=[...CE,"+","-","−","–"],r_=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,i_=[".ph-no-rageclick",".ph-no-capture"],UI=["","text","search","email","password","url","tel","number"];function kE(e,t){if(!I||Pg(e))return!1;var n,r,i,s,o;if($t(t)?(n=!!t&&i_,r=void 0,i=!1):(n=(s=t==null?void 0:t.css_selector_ignorelist)!==null&&s!==void 0?s:i_,r=t==null?void 0:t.content_ignorelist,i=(o=t==null?void 0:t.ignore_text_selection)!==null&&o!==void 0&&o),n===!1||i&&function(l){return!(!l||!ui(l))&&(!!Kt(l,"textarea")||(Kt(l,"input")?J(UI,(l.getAttribute("type")||"").toLowerCase()):function(u){if(u.isContentEditable)return!0;var c=u.getAttribute==null?void 0:u.getAttribute("contenteditable");return c==="true"||c===""}(l)))}(e))return!1;var a=PE(e,!1).targetElementList;return!function(l,u){if(l===!1||L(l))return!1;var c;if(l===!0)c=CE;else{if(!Z(l))return!1;if(l.length>10)return D.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=l.map(d=>d.toLowerCase())}return u.some(d=>{var f=d.safeText,m=d.ariaLabel;return c.some(_=>r_(f,_)||r_(m,_))})}(r,a.map(l=>{var u;return{safeText:Ja(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))==null?void 0:u.toLowerCase().trim())||""}}))&&!Cp(a,n)}var Pg=e=>!e||Kt(e,"html")||!ui(e),PE=(e,t)=>{if(!I||Pg(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],i=e;i.parentNode&&!Kt(i,"body");)if(xE(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=SE(i);if(!s)break;if(t||kg.indexOf(s.tagName.toLowerCase())>-1)n=!0;else try{var o=I.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}r.push(s),i=s}return{parentIsUsefulElement:n,targetElementList:r}};function kp(e){for(var t=new Set,n=0,r=e;r.parentNode&&!Kt(r,"body");r=r.parentNode){if(n++>=bE||t.has(r))return!1;t.add(r);var i=Tc(r);if(J(i,"ph-sensitive")||J(i,"ph-no-capture"))return!1}if(J(Tc(e),"ph-include"))return!0;var s=e.type||"";if(ce(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=e.name||e.id||"";return!ce(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function RE(e){return!!(Kt(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Kt(e,"select")||Kt(e,"textarea")||e.getAttribute("contenteditable")==="true")}var s_=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),o_=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,VI=[16,15,14,13],BI=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),a_=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),l_=/[0-9A-Za-z_]/;function qI(e){for(var t=0,n=!1,r=e.length-1;r>=0;r--){var i=e.charCodeAt(r)-48;n&&(i*=2)>9&&(i-=9),t+=i,n=!n}return t%10==0}function ka(e,t){if(t===void 0&&(t=!0),ne(e))return!1;if(ce(e)){e=dd(e);var n=t?s_.test((e||"").replace(/[- ]/g,"")):function(i){var s;for(o_.lastIndex=0;s=o_.exec(i);){var o=s[2];if(o)for(var a=o.replace(/[- ]/g,""),l=0;a.length>l;l++)for(var u of VI){var c=l+u;if(a.length>=c){var d=a.slice(l,c);if(s_.test(d)&&qI(d))return!0}}}return!1}(e);if(n)return!1;var r=t?BI.test(e):function(i){var s;for(a_.lastIndex=0;s=a_.exec(i);){var o=s[1],a=s[3];if(!(o&&a&&l_.test(o)&&l_.test(a)))return!0}return!1}(e);if(r)return!1}return!0}function u_(e){var t=Ja(e);return ka(t=(t+" "+TE(e)).trim())?t:""}function TE(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ve(e.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var i=Ja(n);t=(t+" "+i).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+TE(n)).trim())}catch(s){D.error("[AutoCapture]",s)}}),t}function c_(e){return e.replace(/"|\\"/g,'\\"')}function WI(e){var t=e.attr__class;if(t)return Z(t)?t:Cg(t)}var Xl=Ie("[Dead Clicks]"),HI=()=>!0,GI=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(wg)),r=e.instance.config.capture_dead_clicks;return $t(r)?r:!!Se(r)||n};class d_{get lazyLoadedDeadClicksAutocapture(){return this.bs}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[wg]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._s(()=>{this.ws()}):this.stop()}_s(t){var n,r;(n=Y.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(r=Y.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Xl.error("failed to load script",i):t()})}ws(){var t;if(j){if(!this.bs&&(t=Y.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Se(this.instance.config.capture_dead_clicks)?$({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.bs=Y.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.bs.start(j),Xl.info("starting...")}}else Xl.error("`document` not found. Cannot start.")}stop(){this.bs&&(this.bs.stop(),this.bs=void 0,Xl.info("stopping..."))}}var bf=Ie("[SegmentIntegration]"),IE="posthog-js";function OE(e,t){var n=t===void 0?{}:t,r=n.organization,i=n.projectId,s=n.prefix,o=n.severityAllowList,a=o===void 0?["error"]:o,l=n.sendExceptionsToPostHog,u=l===void 0||l;return c=>{var d,f,m,_,p;if(a!=="*"&&!a.includes(c.level)||!e.__loaded)return c;c.tags||(c.tags={});var y=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());c.tags["PostHog Person URL"]=y,e.sessionRecordingStarted()&&(c.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var h,v=((d=c.exception)==null?void 0:d.values)||[],x=v.map(E=>$({},E,{stacktrace:E.stacktrace?$({},E.stacktrace,{type:"raw",frames:(E.stacktrace.frames||[]).map(S=>$({},S,{platform:"web:javascript"}))}):void 0})),b={$exception_message:((f=v[0])==null?void 0:f.value)||c.message,$exception_type:(m=v[0])==null?void 0:m.type,$exception_level:c.level,$exception_list:x,$sentry_event_id:c.event_id,$sentry_exception:c.exception,$sentry_exception_message:((_=v[0])==null?void 0:_.value)||c.message,$sentry_exception_type:(p=v[0])==null?void 0:p.type,$sentry_tags:c.tags};return r&&i&&(b.$sentry_url=(s||"https://sentry.io/organizations/")+r+"/issues/?project="+i+"&query="+c.event_id),u&&((h=e.exceptions)==null||h.sendExceptionEvent(b)),c}}class KI{constructor(t,n,r,i,s,o){this.name=IE,this.setupOnce=function(a){a(OE(t,{organization:n,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}}class f_{constructor(t){this.ks=(n,r,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(D.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.Ss=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.xs()}xs(){var t;this.Cs=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.ks)}destroy(){var t;(t=this.Cs)==null||t.call(this),this.Cs=void 0}doPageView(t,n){var r,i=this.Ts(t,n);return this.Ss={pathname:(r=I==null?void 0:I.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),i}doPageLeave(t){var n;return this.Ts(t,(n=this.Ss)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.Ss)==null?void 0:t.pageViewId}}Ts(t,n){var r=this.Ss;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var o=s.maxScrollHeight,a=s.lastScrollY,l=s.maxScrollY,u=s.maxContentHeight,c=s.lastContentY,d=s.maxContentY;if(!(L(o)||L(a)||L(l)||L(u)||L(c)||L(d))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),d=Math.ceil(d);var f=o>1?Vn(a/o,0,1,D):1,m=o>1?Vn(l/o,0,1,D):1,_=u>1?Vn(c/u,0,1,D):1,p=u>1?Vn(d/u,0,1,D):1;i=_e(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:m,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:p})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),i}}var Ef=["flags","surveys"],QI={[sE]:{exposure:"hidden"},[$s]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[ca]:{exposure:"hidden"},[lp]:{exposure:"event"},[up]:{exposure:"hidden"},[cp]:{exposure:"event"},[dp]:{exposure:"hidden"},[fp]:{exposure:"event"},[hp]:{exposure:"event"},[wg]:{exposure:"event"},[xg]:{exposure:"hidden"},[pp]:{exposure:"event"},[Oi]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Fs]:{exposure:"hidden"},[bg]:{exposure:"event"},[oE]:{exposure:"event",shouldSkipFromEventProperties:e=>rt(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[ir]:{exposure:"hidden",storageGroup:"flags"},[Mi]:{exposure:"hidden",storageGroup:"flags"},[Pu]:{exposure:"hidden"},[Xa]:{exposure:"hidden",storageGroup:"flags"},[Ai]:{exposure:"hidden",storageGroup:"flags"},[Gs]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[xc]:{exposure:"hidden",storageGroup:"flags"},[Mn]:{exposure:"hidden"},[Ci]:{exposure:"hidden"},[yn]:{exposure:"hidden"},[Dn]:{exposure:"hidden"},[vp]:{exposure:"hidden",storageGroup:"surveys"},[bc]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[gp]:{exposure:"event"},[Ru]:{exposure:"hidden"},[Tu]:{exposure:"hidden"},[da]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[ar]:{exposure:"hidden"},[fa]:{exposure:"hidden"},[dE]:{exposure:"event"},[Ks]:{exposure:"hidden"},[Gi]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[se]:{exposure:"hidden"},[mp]:{exposure:"hidden"},[yp]:{exposure:"hidden"},[_p]:{exposure:"hidden"},[wp]:{exposure:"hidden"},[Ec]:{exposure:"hidden"},[Sc]:{exposure:"hidden"},[aE]:{exposure:"event"},[lE]:{exposure:"event"},[uE]:{exposure:"event"},[cE]:{exposure:"event"},[hE]:{exposure:"event"},[pE]:{exposure:"event"},[xp]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},YI=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],An=e=>{var t=QI[e];if(t)return t;for(var n of YI){var r=n[1];if(e.indexOf(n[0])===0)return r}},Ls=(e,t)=>{try{return JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString():r,t)}catch{return Cb(e)}},Eo=e=>{var t=j==null?void 0:j.createElement("a");return L(t)?null:(t.href=e,t)},So=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;r.length>i;i++){var s=r[i].split("=");if(s[0]===t){n=s;break}}if(!Z(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{D.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Za=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),i=r[1],s=(r[0]||"").split("?"),o=s[1],a=s[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");Z(d)&&(t.includes(d[0])?u.push(d[0]+"="+n):u.push(l[c]))}var f=a;return o!=null&&(f+="?"+u.join("&")),i!=null&&(f+="#"+i),f},Ic=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},ME=(e,t)=>e>=t&&xb(),AE=(e,t,n,r)=>{if(e===0){if(xb()){var i=t+1;return i===n&&r(),i}return t}return 0},Jl="https?://(.*)",Co=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],XI=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Co],el="",JI=["li_fat_id"];function NE(e,t,n){if(!j)return{};var r,i=t?[...Co,...n||[]]:[],s=$E(Za(j.URL,i,el),e),o=(r={},ve(JI,function(a){var l=vE(a);r[a]=l||null}),r);return _e(o,s)}function $E(e,t){var n=XI.concat(t||[]),r={};return ve(n,function(i){var s=So(e,i);r[i]=s||null}),r}function FE(e){var t=function(s){return s?s.search(Jl+"google.([^/?]*)")===0?"google":s.search(Jl+"bing.com")===0?"bing":s.search(Jl+"yahoo.com")===0?"yahoo":s.search(Jl+"duckduckgo.com")===0?"duckduckgo":null:null}(e),n=t!="yahoo"?"q":"p",r={};if(!rt(t)){r.$search_engine=t;var i=j?So(j.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function h_(){return navigator.language||navigator.userLanguage}var Oc="$direct";function LE(){return(j==null?void 0:j.referrer)||Oc}function jE(e,t,n){n===void 0&&(n=!1);var r=e?[...Co,...t||[]]:[],i=n?li(Ae==null?void 0:Ae.href):Ae==null?void 0:Ae.href,s=i==null?void 0:i.substring(0,1e3);return{r:LE().substring(0,1e3),u:s?Za(s,r,el):void 0}}function DE(e,t){var n;t===void 0&&(t=!1);var r=e.r,i=e.u,s=t?li(i):i,o={$referrer:r,$referring_domain:r==null?void 0:r==Oc?Oc:(n=Eo(r))==null?void 0:n.host};if(s){o.$current_url=s;var a=Eo(s);o.$host=a==null?void 0:a.host,o.$pathname=a==null?void 0:a.pathname;var l=$E(s);_e(o,l)}if(r){var u=FE(r);_e(o,u)}return o}function zE(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ZI(){try{return new Date().getTimezoneOffset()}catch{return}}var eO={flags:Gi,surveys:bc},tO=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Zl=e=>e+"_cookie_identity_change_pending",Rr="main",p_=(e,t)=>{ve(e,(n,r)=>{var i=An(r);i&&i.exposure!=="event"||{}.hasOwnProperty.call(t,r)||delete e[r]})};class Sf{constructor(t,n,r){if(r===void 0&&(r=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=t,this.As=r,this.props={},this.Fs=void 0,this.Os=(s=>{var o="";return s.token&&(o=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+o+"_posthog"})(t),this.ps=this.Ls(t),this.Is=this.$s(t),this.load(),t.debug&&D.info("Persistence loaded",t.persistence,$({},this.props)),this.update_config(t,t,n),this.save(),I){var i=()=>this.flush();Re(I,"beforeunload",i,{capture:!1}),Re(I,"pagehide",i,{capture:!1})}}Ds(){var t,n=(t=this.qi)==null?void 0:t.persistence_save_debounce_ms;return Ge(n)&&n>0?n:0}Ns(t){if(this.qi.cookieWinsOnConflict&&this.qi.persistence.toLowerCase()==="localstorage+cookie")if(t)try{var n=wf(t,this.qi.cookie_persisted_properties||[]),r=Zy(n,this.qi.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(r),s=Ke.Pr(this.Os)||void 0;s&&xf(this.Os,s)===i&&(this.qs=i,this.js=s)}catch{}else try{var o=Ke.Pr(this.Os)||void 0;this.qs=o?xf(this.Os,o):void 0,this.js=o}catch{}}syncCookieProperties(){return this.Bs(this.qi)}Bs(t,n){if(n===void 0&&(n=!1),this.Hs&&!n||this.Ps||!t.cookieWinsOnConflict||t.persistence.toLowerCase()!=="localstorage+cookie")return!1;var r;try{r=Ke.Pr(this.Os)||void 0}catch{}if(!r||r===this.js)return!1;var i,s=xf(this.Os,r);try{i=_f(JSON.parse(r))}catch{return!1}if((Ke.Pr(this.Os)||void 0)!==r)return!1;this.qs=s,this.js=r;var o=e_(this.Os,r),a=[...Pi,...o.properties],l={};if(Object.keys(i).forEach(p=>{var y=i[p];(L(y)||rt(y)||y===""||p===se&&y!==We&&y!==ot)&&(l[p]=!0,delete i[p])}),En(i))return!1;var u=wt in i||i[se]===We||i[se]===ot,c=this.props[wt],d=this.props[se],f=_e({},this.props);[...Pi,...t.cookie_persisted_properties||[]].forEach(p=>{if(a.indexOf(p)!==-1&&!(p in i)&&!l[p]&&(u||p!==wt&&p!==se)){var y=f[p];!o.isValid&&Pi.indexOf(p)!==-1&&(y===!1||y===0)||delete f[p]}}),this.props=_e(f,i),!u||se in i||se in this.props||this.Us(se,We);var m=this.props[wt],_=this.props[se];return!u||m===c&&_===d||(this.Rs=!0,we.Nr(Zl(this.Os),!0),this.zs(yn),this.zs(Mi),this.zs(ir),this.zs(Xa),this.zs(Ai),this.zs(Gs),this.zs(Gi),this.zs(Ks),this.zs(ar),_===We&&(d===ot||i[se]===We||!L(c)&&m!==c)&&(p_(this.props,i),this.zs(Dn)),_===ot?this.props.$user_id=m:delete this.props.$user_id,this.zs($s)),!0}consumeCookieIdentityChange(){var t=Zl(this.Os),n=this.Rs||!!we.Pr(t);return this.Rs=!1,n&&we.qr(t),n}Ws(t){return t===void 0&&(t=!1),!(this.Ps||this.Hs&&!t||!this.qi.cookieWinsOnConflict||this.qi.persistence.toLowerCase()!=="localstorage+cookie"||(this.Ps=!0,0))}Vs(){this.Ps&&(L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[Rr],this.Zs(!0))}Qs(t){if(t===void 0&&(t=!0),this.Ps)try{t?this.Vs():L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Ls(t){tO.indexOf(t.persistence.toLowerCase())===-1&&(D.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,r=function(o,a){o===void 0&&(o=[]),a===void 0&&(a=!1);var l=[...Pi,...o];return $({},ge,{Br(u){try{var c,d={};try{c=Ke.Pr(u)||void 0,d=c?_f(JSON.parse(c)):{}}catch{}var f,m=JSON.parse(ge.Pr(u)||"{}");if(a){var _=e_(u,c),p=[...Pi,..._.properties],y={};Object.keys(d).forEach(E=>{var S=d[E];rt(S)||S===""||E===se&&S!==We&&S!==ot||(y[E]=S)});var h=wt in y||y[se]===We||y[se]===ot;if(Object.keys(y).length>0){var v,x=m[wt],b=(v=m[se])!==null&&v!==void 0?v:We;l.forEach(E=>{if(p.indexOf(E)!==-1&&!(E in d)&&(h||E!==wt&&E!==se)){var S=m[E];!_.isValid&&Pi.indexOf(E)!==-1&&(S===!1||S===0)||delete m[E]}}),!h||se in d||se in m||(m[se]=We),!h||(wt in y?y[wt]:m[wt])===x&&(se in y?y[se]:m[se])===b||(yf.forEach(E=>delete m[E]),y[se]===ot&&wt in y?m.$user_id=y[wt]:delete m.$user_id,y[se]!==ot&&(delete m[dE],delete m[Dn]),delete m.__alias)}f=_e(m,y)}else f=_e(d,m);return ge.Nr(u,f),f}catch{}return null},Nr(u,c,d,f,m,_){var p=ge.Nr(u,c,void 0,void 0,_);try{var y=wf(c,o);if(Object.keys(y).length){if(a){var h=Rc(u),v=Zy(y,o);if(Ke.Nr(h,v,d,f,m,_),Ke.Pr(h)!==JSON.stringify(v)){Ke.qr(h,f);var x=wf(c);return Ke.Nr(u,x,d,f,m,_),p}}Ke.Nr(u,y,d,f,m,_)}}catch(b){ge.jr(b)}return p},qr(u,c){try{I==null||I.localStorage.removeItem(u),Ke.qr(u,c),Ke.qr(Rc(u),c)}catch(d){ge.jr(d)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),i=!1,s=t.persistence.toLowerCase();return s==="localstorage"&&ge.Dr()?(n=ge,i=!0):s==="localstorage+cookie"&&r.Dr()?(n=r,i=!0):s==="sessionstorage"&&we.Dr()?n=we:s==="memory"?n=NI:s==="cookie"?n=Ke:r.Dr()?(n=r,i=!0):n=Ke,this.Es=i,n}Js(t){return this.Os+"__"+t}$s(t){return this.Es&&!!t.split_storage}properties(){var t={};return ve(this.props,(n,r)=>{var i=An(r);if(!i||i.exposure==="event"){if(i!=null&&i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(n))return;t[r]=n}}),t}load(t){if(t===void 0&&(t=!1),!this.Hs||t){var n=this.qi.cookieWinsOnConflict&&this.qi.persistence.toLowerCase()==="localstorage+cookie",r=n?ge.Br(this.Os):null,i={};if(n)try{ve(i=_f(Ke.Br(this.Os)),(_,p)=>{(L(_)||rt(_)||_==="")&&delete i[p]})}catch{}var s=this.ps.Br(this.Os);if(s&&(this.props=_e({},s)),this.Is&&this.Ks(),n&&s){var o,a,l=r==null?void 0:r[wt],u=(o=r==null?void 0:r[se])!==null&&o!==void 0?o:We,c=s[wt],d=(a=s[se])!==null&&a!==void 0?a:We;if(c!==l||d!==u){this.Rs=!0,we.Nr(Zl(this.Os),!0);var f=_e({},this.props);yf.forEach(_=>delete f[_]),d===We&&(u===ot||i[se]===We||!L(l)&&c!==l)&&(p_(f,i),delete f[Dn]),this.props=f;var m=new Set;yf.forEach(_=>{var p,y=(p=An(_))==null?void 0:p.storageGroup;y&&m.add(y)}),m.forEach(_=>{var p={};ve(this.props,(y,h)=>{var v;((v=An(h))==null?void 0:v.storageGroup)===_&&(p[h]=y)}),En(p)?(ge.qr(this.Js(_)),this.Ms[_]={}):ge.Nr(this.Js(_),p)&&(this.Ms[_]={persisted:!0,fingerprint:this.Ys(p,_)})})}}we.Pr(Zl(this.Os))&&(this.Rs=!0)}}Ks(){for(var t of Ef){var n=ge.Br(this.Js(t));if(n&&!En(n)){var r=this.Xs(t);r.persisted=!0,this.ta(t)||(r.fingerprint=this.Ys(n,t)),this.ea(t,n)||_e(this.props,n)}}}ta(t){return Object.keys(this.props).some(n=>{var r;return((r=An(n))==null?void 0:r.storageGroup)===t})}ea(t,n){var r=eO[t];if(!r)return!1;var i=n[r],s=this.props[r];return Ge(i)&&Ge(s)&&s>i}refreshKey(t){var n;if(!this.Hs){var r=this.Is?(n=An(t))==null?void 0:n.storageGroup:void 0,i=r?ge.Br(this.Js(r)):this.ps.Br(this.Os);if(i&&t in i)this.Us(t,i[t]);else{if(r){var s=this.ps.Br(this.Os);if(s&&t in s)return void this.Us(t,s[t])}this.zs(t)}}}save(){if(!this.Hs){var t=this.Ds();t>0?L(this.Gs)&&(this.Gs=setTimeout(()=>{this.Gs=void 0,this.Zs()},t)):this.Zs()}}flush(){L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0,this.Zs())}Zs(t){t===void 0&&(t=!1),this.Hs||this.Ps&&!t||(t||this.syncCookieProperties(),this.Is?this.ia():this.ra(this.ps,this.Os,this.props,Rr)&&this.Ns(this.props))}ia(){var t=this.na(),n=t.main,r=t.groups;for(var i of(this.ra(this.ps,this.Os,n,Rr)&&this.Ns(n),Ef)){var s,o=r[i];(!En(o)||(s=this.Ms[i])!=null&&s.persisted)&&this.ra(ge,this.Js(i),o,i)}}na(){var t={},n={flags:{},surveys:{}};return ve(this.props,(r,i)=>{var s,o=(s=An(i))==null?void 0:s.storageGroup;o?n[o][i]=r:t[i]=r}),{main:t,groups:n}}Ys(t,n){if(n===Rr)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var r={};return ve(t,(i,s)=>{var o;r[s]=(o=An(s))!=null&&o.volatile?"__volatile__":i}),JSON.stringify(r)}ra(t,n,r,i){var s,o=this.Xs(i);if(i!==Rr&&!o.dirty&&!L(o.fingerprint))return!1;try{if((s=this.Ys(r,i))===o.fingerprint)return o.dirty=!1,!1}catch{s=void 0}return t.Nr(n,r,this.sa,this.aa,this.oa,this.qi.debug)?(o.dirty=!1,i!==Rr&&(o.persisted=!0),L(s)||(o.fingerprint=s),!0):(this.qi.debug&&D.warn('failed to persist storage entry "'+n+'"; will retry on next save'),!1)}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,r=n!==void 0&&n;if(L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Os,!1),this.ps.qr(this.Os,!0),!r&&this.As)for(var i of Ef)ge.qr(this.Js(i));r?delete this.Ms[Rr]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,n,r){if(Se(t)){this.syncCookieProperties(),L(n)&&(n="None"),this.sa=L(r)?this.la:r;var i=!1;if(ve(t,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.Us(o,s),i=!0)}),i)return this.save(),!0}return!1}register(t,n){if(Se(t)){this.syncCookieProperties(),this.sa=L(n)?this.la:n;var r=!1;if(ve(t,(i,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==i||Se(i)||Z(i))&&(this.Us(s,i),r=!0)}),r)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var n=typeof t=="string"?[t]:t,r=!1;for(var i of n)i in this.props&&(this.zs(i),r=!0);r&&this.save()}update_campaign_params(){var t=j==null?void 0:j.URL;if(t!==this.Fs){var n=NE(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);En(Sg(n))||this.register(n),this.Fs=t}}update_search_keyword(){var t;this.register((t=j==null?void 0:j.referrer)?FE(t):{})}update_referrer_info(){var t;this.register_once({$referrer:LE(),$referring_domain:j!=null&&j.referrer&&((t=Eo(j.referrer))==null?void 0:t.host)||Oc},void 0)}set_initial_person_info(){this.props[_p]||this.props[wp]||this.register_once({[Ec]:jE(this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties,this.qi.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};ve([wp,_p],i=>{var s=this.props[i];s&&ve(s,function(o,a){t["$initial_"+np(a)]=o})});var n=this.props[Ec];if(n){var r=function(i,s){s===void 0&&(s=!1);var o=DE(i,s),a={};return ve(o,function(l,u){a["$initial_"+np(u)]=l}),a}(n,this.qi.disable_capture_url_hashes);_e(t,r)}return t}safe_merge(t){return ve(this.props,function(n,r){r in t||(t[r]=n)}),t}update_config(t,n,r){var i=t.persistence!==n.persistence,s=!((p,y)=>{if(p.length!==y.length)return!1;var h=[...p].sort(),v=[...y].sort();return h.every((x,b)=>x===v[b])})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),o=i||s,a=t.cookieWinsOnConflict!==n.cookieWinsOnConflict,l=t.disable_persistence||!!r,u=!!this.Hs&&!l;l||this.Bs(n,u),this.qi=t,!l&&(i||s||a)&&(this.qs=void 0,this.js=void 0,this.Bs($({},t,{cookie_persisted_properties:n.cookie_persisted_properties}),u));var c=o||a?this.Ls(t):this.ps,d=this.$s(t),f=o||d!==this.Is,m=!l&&(f||t.cross_subdomain_cookie!==this.aa||t.secure_cookie!==this.oa)&&this.Ws(u);try{if(this.la=this.sa=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),f){var _=this.props;this.clear(),this.ps=c,this.Is=d,this.props=_,this.save()}else a&&(this.ps=c,l||(delete this.Ms[Rr],this.Zs()))}finally{m&&this.Qs()}}set_disabled(t){this.Hs=t,this.Hs?this.remove():this.save()}set_cross_subdomain(t){t!==this.aa&&(this.aa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var r=this.props[ca]||{};r[t]=n,this.Us(ca,r),this.save()}remove_event_timer(t){var n=this.props[ca]||{},r=n[t];return L(r)||(delete n[t],this.Us(ca,n),this.save()),r}get_property(t){return this.props[t]}set_property(t,n){this.Us(t,n),this.save()}Us(t,n){var r;this.props[t]=n,(r=An(t))!=null&&r.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var n,r=(n=An(t))==null?void 0:n.storageGroup;r&&(this.Xs(r).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function eu(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&vt(n.then)&&n.then(void 0,()=>{})}}}}var Et={GZipJS:"gzip-js",Base64:"base64"},Xo={Activation:"events",Cancellation:"cancelEvents"},Cf={Popover:"popover",API:"api",Widget:"widget"},ur={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},kf={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Pp={Popover:"popover",Inline:"inline"},nO={SHOWN:"product tour shown"},v_={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},g_=Ie("[RateLimiter]");class rO{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(i=>{g_.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void g_.warn('could not rate limit - continuing. Error: "'+(i==null?void 0:i.message)+'"',{text:r})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,r,i;t===void 0&&(t=!1);var s=this.captureEventsBurstLimit,o=this.captureEventsPerSecond,a=new Date().getTime(),l=(n=(r=this.instance.persistence)==null?void 0:r.get_property(yp))!==null&&n!==void 0?n:{tokens:s,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>s&&(l.tokens=s);var u=1>l.tokens;if(u||t||(l.tokens=Math.max(0,l.tokens-1)),u&&!t){var c=(Ge(l.dropped)?l.dropped:0)+1;l.dropped=c,!this.lastEventRateLimited&&this.ha(c)&&(l.dropped=0)}return this.lastEventRateLimited=u,(i=this.instance.persistence)==null||i.set_property(yp,l),{isRateLimited:u,remainingTokens:l.tokens}}da(t){var n=this.instance.config.property_denylist;return!Z(n)||!n.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&Ae!=null&&Ae.pathname)return""+((t=Ae.origin)!==null&&t!==void 0?t:"")+Ae.pathname}ha(t){var n,r,i=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,o=this.va(),a=this.da("$session_id")?(n=(r=this.instance).get_session_id)==null?void 0:n.call(r):void 0,l=[t+" event(s) dropped since the last warning",o?"triggered on "+o:void 0,a?"session "+a:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+l+". Config is set to "+s+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()t(this.remoteConfig)):t()}fa(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Tr.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance.ma())return void Tr.warn("Remote config is disabled. Falling back to local config.");this.ca(t=>{if(!t)return Tr.info("No config found after loading remote JS config. Falling back to JSON."),void this.fa(n=>{this.pa(n.json,n),this.ga()});this.pa(t),this.ga()})}catch(t){Tr.error("Error loading remote config",t),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance.ma()&&j&&j.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}ga(){var t;if(!this.ya){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.ya=setInterval(()=>{this.refresh()},n))}}pa(t,n){!t&&n&&(n.statusCode===0?n.error||Tr.warn("Failed to fetch remote config from PostHog."):Tr.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(t?{ok:!0,config:t}:{ok:!1})}catch(i){Tr.error("Error applying remote config",i)}if((t==null?void 0:t.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;(r=this._instance.featureFlags)==null||r.ensureFlagsLoaded()}catch(i){Tr.error("Error loading feature flags",i)}}}var ln=Uint8Array,Lt=Uint16Array,ko=Uint32Array,Rg=new ln([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Tg=new ln([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),m_=new ln([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),VE=function(e,t){for(var n=new Lt(31),r=0;31>r;++r)n[r]=t+=1<r;++r)for(var s=n[r];n[r+1]>s;++s)i[s]=s-n[r]<<5|r;return[n,i]},BE=VE(Rg,2),Rp=BE[1];BE[0][28]=258,Rp[258]=28;for(var y_=VE(Tg,0)[1],qE=new Lt(32768),Ne=0;32768>Ne;++Ne){var hs=(43690&Ne)>>>1|(21845&Ne)<<1;qE[Ne]=((65280&(hs=(61680&(hs=(52428&hs)>>>2|(13107&hs)<<2))>>>4|(3855&hs)<<4))>>>8|(255&hs)<<8)>>>1}var Pa=function(e,t,n){for(var r=e.length,i=0,s=new Lt(t);r>i;++i)++s[e[i]-1];var o,a=new Lt(t);for(i=0;t>i;++i)a[i]=a[i-1]+s[i-1]<<1;for(o=new Lt(r),i=0;r>i;++i)o[i]=qE[a[e[i]-1]++]>>>15-e[i];return o},Zi=new ln(288);for(Ne=0;144>Ne;++Ne)Zi[Ne]=8;for(Ne=144;256>Ne;++Ne)Zi[Ne]=9;for(Ne=256;280>Ne;++Ne)Zi[Ne]=7;for(Ne=280;288>Ne;++Ne)Zi[Ne]=8;var Mc=new ln(32);for(Ne=0;32>Ne;++Ne)Mc[Ne]=5;var iO=Pa(Zi,9),sO=Pa(Mc,5),WE=function(e){return(e/8>>0)+(7&e&&1)},HE=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Lt?Lt:e instanceof ko?ko:ln)(n-t);return r.set(e.subarray(t,n)),r},Qn=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},Jo=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Pf=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,s=n.slice();if(!i)return[new ln(0),0];if(i==1){var o=new ln(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(E,S){return E.f-S.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],u=0,c=1,d=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=i-1;)a=n[n[d].f>n[u].f?u++:d++],l=n[u!=c&&n[d].f>n[u].f?u++:d++],n[c++]={s:-1,f:a.f+l.f,l:a,r:l};var f=s[0].s;for(r=1;i>r;++r)s[r].s>f&&(f=s[r].s);var m=new Lt(f+1),_=Tp(n[c-1],m,0);if(_>t){r=0;var p=0,y=_-t,h=1<r;++r){var v=s[r].s;if(t>=m[v])break;p+=h-(1<<_-m[v]),m[v]=t}for(p>>>=y;p>0;){var x=s[r].s;t>m[x]?p-=1<=0&&p;--r){var b=s[r].s;m[b]==t&&(--m[b],++p)}_=t}return[new ln(m),_]},Tp=function(e,t,n){return e.s==-1?Math.max(Tp(e.l,t,n+1),Tp(e.r,t,n+1)):t[e.s]=n},__=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Lt(++t),r=0,i=e[0],s=1,o=function(l){n[r++]=l},a=1;t>=a;++a)if(e[a]==i&&a!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=e[a]}return[n.subarray(0,r),t]},Zo=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},Ip=function(e,t,n){var r=n.length,i=WE(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var s=0;r>s;++s)e[i+s+4]=n[s];return 8*(i+4+r)},w_=function(e,t,n,r,i,s,o,a,l,u,c){Qn(t,c++,n),++i[256];for(var d=Pf(i,15),f=d[0],m=d[1],_=Pf(s,15),p=_[0],y=_[1],h=__(f),v=h[0],x=h[1],b=__(p),E=b[0],S=b[1],P=new Lt(19),C=0;v.length>C;++C)P[31&v[C]]++;for(C=0;E.length>C;++C)P[31&E[C]]++;for(var T=Pf(P,7),R=T[0],N=T[1],M=19;M>4&&!R[m_[M-1]];--M);var z,F,W,B,Q=u+5<<3,O=Zo(i,Zi)+Zo(s,Mc)+o,A=Zo(i,f)+Zo(s,p)+o+14+3*M+Zo(P,R)+(2*P[16]+3*P[17]+7*P[18]);if(O>=Q&&A>=Q)return Ip(t,c,e.subarray(l,l+u));if(Qn(t,c,1+(O>A)),c+=2,O>A){z=Pa(f,m),F=f,W=Pa(p,y),B=p;var V=Pa(R,N);for(Qn(t,c,x-257),Qn(t,c+5,S-1),Qn(t,c+10,M-4),c+=14,C=0;M>C;++C)Qn(t,c+3*C,R[m_[C]]);c+=3*M;for(var K=[v,E],te=0;2>te;++te){var oe=K[te];for(C=0;oe.length>C;++C)Qn(t,c,V[de=31&oe[C]]),c+=R[de],de>15&&(Qn(t,c,oe[C]>>>5&127),c+=oe[C]>>>12)}}else z=iO,F=Zi,W=sO,B=Mc;for(C=0;a>C;++C)if(r[C]>255){var de;Jo(t,c,z[257+(de=r[C]>>>18&31)]),c+=F[de+257],de>7&&(Qn(t,c,r[C]>>>23&31),c+=Rg[de]);var be=31&r[C];Jo(t,c,W[be]),c+=B[be],be>3&&(Jo(t,c,r[C]>>>5&8191),c+=Tg[be])}else Jo(t,c,z[r[C]]),c+=F[r[C]];return Jo(t,c,z[256]),c+F[256]},oO=new ko([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),aO=function(){for(var e=new ko(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Rf=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function lO(e,t){t===void 0&&(t={});var n=function(){var d=4294967295;return{p(f){for(var m=d,_=0;f.length>_;++_)m=aO[255&m^f[_]]^m>>>8;d=m},d(){return 4294967295^d}}}(),r=e.length;n.p(e);var i,s,o,a,l,u=(a=10+((i=t).filename&&i.filename.length+1||0),l=8,function(d,f,m,_,p,y){var h=d.length,v=new ln(_+h+5*(1+Math.floor(h/7e3))+p),x=v.subarray(_,v.length-p),b=0;if(!f||8>h)for(var E=0;h>=E;E+=65535){var S=E+65535;h>S?b=Ip(x,b,d.subarray(E,S)):(x[E]=!0,b=Ip(x,b,d.subarray(E,h)))}else{for(var P=oO[f-1],C=P>>>13,T=8191&P,R=(1<E;++E){var de=W(E),be=32767&E,Pe=M[de];if(N[be]=Pe,M[de]=be,E>=te){var Be=h-E;if((A>7e3||K>24576)&&Be>423){b=w_(d,x,0,B,Q,O,V,K,oe,E-oe,b),K=A=V=0,oe=E;for(var ye=0;286>ye;++ye)Q[ye]=0;for(ye=0;30>ye;++ye)O[ye]=0}var Fe=2,Tt=0,Sr=T,_t=be-Pe&32767;if(Be>2&&de==W(E-_t))for(var Ye=Math.min(C,Be)-1,gi=Math.min(32767,E),us=Math.min(258,Be);gi>=_t&&--Sr&&be!=Pe;){if(d[E+Fe]==d[E+Fe-_t]){for(var It=0;us>It&&d[E+It]==d[E+It-_t];++It);if(It>Fe){if(Fe=It,Tt=_t,It>Ye)break;var cs=Math.min(_t,It-2),Cr=0;for(ye=0;cs>ye;++ye){var pn=E-_t+ye+32768&32767,Do=pn-N[pn]+32768&32767;Do>Cr&&(Cr=Do,Pe=pn)}}}_t+=(be=Pe)-(Pe=N[be])+32768&32767}if(Tt){B[K++]=268435456|Rp[Fe]<<18|y_[Tt];var gm=31&Rp[Fe],mm=31&y_[Tt];V+=Rg[gm]+Tg[mm],++Q[257+gm],++O[mm],te=E+Fe,++A}else B[K++]=d[E],++Q[d[E]]}}b=w_(d,x,!0,B,Q,O,V,K,oe,E-oe,b)}return HE(v,0,_+WE(b)+p)}(s=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,l)),c=u.length;return function(d,f){var m=f.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>f.level?4:f.level==9?2:0,d[9]=3,f.mtime!=0&&Rf(d,4,Math.floor(new Date(f.mtime||Date.now())/1e3)),m){d[3]=8;for(var _=0;m.length>=_;++_)d[_+10]=m.charCodeAt(_)}}(u,t),Rf(u,c-8,n.d()),Rf(u,c-4,r),u}var uO=!!Jh||!!fg,GE="text/plain",Ou=!1,KE=(e,t)=>{var n=e.split("#"),r=n[1],i=n[0].split("?"),s=i[0],o=i[1];if(!o)return e;var a=o.split("&").filter(l=>l.split("=")[0]!==t).join("&");return s+(a?"?"+a:"")+(r?"#"+r:"")},bl=function(e,t,n){var r;n===void 0&&(n=!0);var i=e.split("?"),s=i[0],o=i[1],a=$({},t),l=(r=o==null?void 0:o.split("&").map(c=>{var d,f=c.split("="),m=f[0],_=n&&(d=a[m])!==null&&d!==void 0?d:f[1];return delete a[m],m+"="+_}))!==null&&r!==void 0?r:[],u=function(c,d){var f,m;d===void 0&&(d="&");var _=[];return ve(c,function(p,y){L(p)||L(y)||y==="undefined"||(f=encodeURIComponent((h=>h instanceof File)(p)?p.name:p.toString()),m=encodeURIComponent(y),_[_.length]=m+"="+f)}),_.join(d)}(a);return u&&l.push(u),l.length>0?s+"?"+l.join("&"):s},Tf=e=>{if(e.ba)return e.ba;var t=e.data,n=e.compression;if(t){if(n===Et.GZipJS){var r=lO(function(a,l){var u=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new ln(a.length+(a.length>>>1)),d=0,f=function(y){c[d++]=y},m=0;u>m;++m){if(d+5>c.length){var _=new ln(d+8+(u-m<<1));_.set(c),c=_}var p=a.charCodeAt(m);128>p?f(p):2048>p?(f(192|p>>>6),f(128|63&p)):p>55295&&57344>p?(f(240|(p=65536+(1047552&p)|1023&a.charCodeAt(++m))>>>18),f(128|p>>>12&63),f(128|p>>>6&63),f(128|63&p)):(f(224|p>>>12),f(128|p>>>6&63),f(128|63&p))}return HE(c,0,d)}(Ls(t)),{mtime:0});return{contentType:GE,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Et.Base64){var i=function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(l,u)=>String.fromCharCode(parseInt(u,16))))}(Ls(t)),s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Ls(a)))(i);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=Ls(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},QE=e=>{var t,n,r=()=>e.transport==="sendBeacon"?{url:bl(e.url,{compression:Et.Base64}),encodedBody:Tf($({},e,{compression:Et.Base64,ba:void 0}))}:{url:KE(e.url,"compression"),encodedBody:Tf($({},e,{compression:void 0,ba:void 0}))};try{t=Tf(e)}catch(i){if(Fy(e.compression,So(e.url,"compression")))return D.error("Failed to gzip request body, sending uncompressed payload",i),r();throw i}return t&&Fy(e.compression,So(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Zh(new Uint8Array(n)):ArrayBuffer.isView(n)&&Zh(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Ou=!0,r()):{url:e.url,encodedBody:t}},YE=e=>{try{return QE(e)}catch(t){return D.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},cO=function(){var e=Ce(function*(t){var n=Ls(t.data),r=yield function(s,o,a){return ep.apply(this,arguments)}(n,Ee.DEBUG,{rethrow:!0});if(!r)return t;var i=yield r.arrayBuffer();return $({},t,{ba:{contentType:GE,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}}(),dO=/Failed to fetch|NetworkError|Load failed/i,XE=e=>(e==null?void 0:e.name)==="TypeError"&&dO.test((e==null?void 0:e.message)||""),JE=e=>{var t=YE(e);if(t){var n=t.url,r=t.encodedBody,i=r??{},s=i.contentType,o=i.body,a=i.estimatedSize,l=new Headers;ve(e.headers,function(_,p){l.append(p,_)}),s&&l.append("Content-Type",s);var u=null,c=!1;if(Iy){var d=new Iy;u={signal:d.signal,timeout:setTimeout(()=>{var _,p;c=!0,d.abort((_=e.timeout,(p=new Error("PostHog request timed out"+(_?" after "+_+"ms":""))).name="AbortError",p))},e.timeout)}}var f=_=>{c&&(_==null?void 0:_.name)==="AbortError"||XE(_)?D.warn(_):D.error(_),e.callback==null||e.callback({statusCode:0,error:_})};try{var m;fg(n,$({method:(e==null?void 0:e.method)||"GET",headers:l,keepalive:e.method==="POST"&&!e._a&&52428.8>(a||0),body:o,signal:(m=u)==null?void 0:m.signal},e.fetchOptions)).then(_=>_.text().then(p=>{var y={statusCode:_.status,text:p};if(_.status===200)try{y.json=JSON.parse(p)}catch(h){D.error(h)}e.callback==null||e.callback(y)})).catch(f).finally(()=>u?clearTimeout(u.timeout):null)}catch(_){u&&clearTimeout(u.timeout),f(_)}}},Op=e=>{try{var t,n=QE(e),r=n.url,i=n.encodedBody,s=i??{},o=s.body,a=s.estimatedSize;if(!o)return;var l=o instanceof Blob?o:new Blob([o],{type:s.contentType});if(St.sendBeacon(r,l))return;var u=Z(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(Z(u)&&u.length>1&&(a??0)>16384){var c=Math.ceil(u.length/2),d=f=>Z(e.data)?f:$({},e.data,{batch:f});return Op($({},e,{data:d(u.slice(0,c))})),void Op($({},e,{data:d(u.slice(c))}))}D.warn("Beacon of ~"+(a??0)+" bytes was rejected by the browser, falling back to fetch"),JE($({},e,{_a:!0}))}catch(f){D.warn("Beacon send failed",f)}},x_=(e,t,n,r)=>{var i=r==="query"?t==="POST"?"sent_at":"_":void 0;return bl(n===Et.GZipJS?KE(e,"compression"):e,$({},i?{[i]:Date.now().toString()}:{},n===Et.GZipJS?{}:{compression:n}))},Mu=[];fg&&Mu.push({transport:"fetch",method:JE}),Jh&&Mu.push({transport:"XHR",method(e){var t=YE(e);if(t){var n=new Jh,r=t.encodedBody;n.open(e.method||"GET",t.url,!0);var i=r??{},s=i.contentType,o=i.body;ve(e.headers,function(a,l){n.setRequestHeader(l,a)}),s&&n.setRequestHeader("Content-Type",s),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var a={statusCode:n.status,text:n.responseText};if(n.status===200)try{a.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(a)}},n.send(o)}}}),St!=null&&St.sendBeacon&&Mu.push({transport:"sendBeacon",method:Op});var Mp=3e3;class fO{constructor(t,n){this.wa=!0,this.ka=[],this.Sa=Vn((n==null?void 0:n.flush_interval_ms)||Mp,250,5e3,D.createLogger("flush interval"),Mp),this.xa=t}enqueue(t){this.ka.push(t),this.Ca||this.Ta()}unload(){this.Ma();var t=this.ka.length>0?this.Ea():{},n=Object.values(t);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Ia($({},r,{transport:"sendBeacon"}))})}enable(){this.wa=!1,this.Ta()}Ta(){var t=this;this.wa||(this.Ca=setTimeout(()=>{if(this.Ma(),this.ka.length>0){var n=this.Ea(),r=function(){var s=n[i],o=new Date().getTime();s.data&&Z(s.data)&&ve(s.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),t.Ia(s)};for(var i in n)r()}},this.Sa))}Ia(t){try{this.xa(t)}catch(n){D.error(n)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var t={};return ve(this.ka,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;L(t[s])&&(t[s]=$({},i,{data:[]})),(r=t[s].data)==null||r.push(i.data)}),this.ka=[],t}}var hO=["retriesPerformedSoFar"];class pO{constructor(t){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=t,this.ka=[],this.Aa=!0,!L(I)&&"onLine"in I.navigator&&(this.Aa=I.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.Oa()},this.La=()=>{this.Aa=!1},Re(I,"online",this.Fa),Re(I,"offline",this.La))}get length(){return this.ka.length}retriableRequest(t){var n=t.retriesPerformedSoFar,r=bb(t,hO);Jn(n)&&(r.url=bl(r.url,{retry_count:n})),this._instance._send_request($({},r,{callback:i=>{if(i.statusCode!==200&&(400>i.statusCode||i.statusCode>=500)){if((i.statusCode===0?3:10)>(n??0))return void this.xn($({retriesPerformedSoFar:n},r));i.statusCode===0&&D.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}r.callback==null||r.callback(i)}}))}xn(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=Math.random()-.5;return Math.ceil(u+c*(u-l))}(n),i=Date.now()+r;this.ka.push({retryAt:i,requestOptions:t});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),D.warn(s),this.Ra||(this.Ra=!0,this.$a())}$a(){if(this.Da&&clearTimeout(this.Da),this.ka.length===0)return this.Ra=!1,void(this.Da=void 0);this.Da=setTimeout(()=>{this.Aa&&this.ka.length>0&&this.Oa(),this.$a()},this.Pa)}Oa(){var t=Date.now(),n=[],r=this.ka.filter(s=>t>s.retryAt||(n.push(s),!1));if(this.ka=n,r.length>0)for(var i of r)this.retriableRequest(i.requestOptions)}unload(){for(var t of(this.Da&&(clearTimeout(this.Da),this.Da=void 0),this.Ra=!1,L(I)||(this.Fa&&(I.removeEventListener("online",this.Fa),this.Fa=void 0),this.La&&(I.removeEventListener("offline",this.La),this.La=void 0)),this.ka)){var n=t.requestOptions;try{this._instance._send_request($({},n,{transport:"sendBeacon"}))}catch(r){D.error(r)}}this.ka=[]}}class vO{constructor(t){this.Na=()=>{var n,r,i,s;this.qa||(this.qa={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+((o==null?void 0:o.clientHeight)||0),c=(o==null?void 0:o.scrollHeight)||0;this.qa.lastScrollY=Math.ceil(a),this.qa.maxScrollY=Math.max(a,(n=this.qa.maxScrollY)!==null&&n!==void 0?n:0),this.qa.maxScrollHeight=Math.max(l,(r=this.qa.maxScrollHeight)!==null&&r!==void 0?r:0),this.qa.lastContentY=u,this.qa.maxContentY=Math.max(u,(i=this.qa.maxContentY)!==null&&i!==void 0?i:0),this.qa.maxContentHeight=Math.max(c,(s=this.qa.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=t}get ja(){return this._instance.config.scroll_root_selector}getContext(){return this.qa}resetContext(){var t=this.qa;return setTimeout(this.Na,0),t}startMeasuringScrollPosition(){Re(I,"scroll",this.Na,{capture:!0}),Re(I,"scrollend",this.Na,{capture:!0}),Re(I,"resize",this.Na)}scrollElement(){if(!this.ja)return I==null?void 0:I.document.documentElement;var t=Z(this.ja)?this.ja:[this.ja];for(var n of t){var r=I==null?void 0:I.document.querySelector(n);if(r)return r}}Ba(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.ja){var r=this.scrollElement();return r&&r[n]||0}return I?t==="y"?I.scrollY||I.pageYOffset||I.document.documentElement.scrollTop||0:I.scrollX||I.pageXOffset||I.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var gO=e=>jE(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);class b_{constructor(t,n,r,i){this.ot=s=>{var o=this.Ha();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.Ua(this._instance)};this.za.register({[mp]:a})}},this._instance=t,this.Wa=n,this.za=r,this.Ua=i||gO,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[mp]}getSetOnceProps(){var t,n=(t=this.Ha())==null?void 0:t.props;return n?"r"in n?DE(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return ve(Sg(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+np(r)]=n}),t}}class Ac{on(t,n){return this.Va[t]||(this.Va[t]=[]),this.Va[t].push(n),()=>{this.Va[t]=this.Va[t].filter(r=>r!==n)}}emit(t,n){for(var r of this.Va[t]||[])r(n);for(var i of this.Va["*"]||[])i(t,n)}constructor(){this.Va={}}}var ps=Ie("[SessionId]"),E_=864e5;class S_{on(t,n){return this.Ga.on(t,n)}constructor(t,n,r){var i;if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new Ac,this.Xa=(l,u)=>!(!Jn(l)||!Jn(u))&&Math.abs(l-u)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===lr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qi=t.config,this.za=t.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.eo=void 0,this._sessionActivityTimestamp=null,this.io=n||$n,this.ro=r||$n;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*Vn(this.qi.session_idle_timeout_seconds||1800,60,36e3,ps.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.no(),this.so="ph_"+s+"_window_id",this.ao="ph_"+s+"_primary_window_exists",this.oo()){var o=we.Br(this.so),a=we.Br(this.ao);o&&!a?this.st=o:we.qr(this.so),we.Nr(this.ao,!0)}(i=this.qi.bootstrap)!=null&&i.sessionID&&this.setBootstrapSessionId(this.qi.bootstrap.sessionID),this.lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return L(this.Ja)&&(this.Ja=[]),this.Ja.push(t),this._e&&t(this._e,this.st),()=>{this.Ja=this.Ja.filter(n=>n!==t)}}oo(){return this.qi.persistence!=="memory"&&!this.za.Hs&&we.Dr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&we.Nr(this.so,t))}ho(){return this.st?this.st:this.oo()?we.Br(this.so):null}do(t){var n=this.Za;return!rt(n)&&!rt(t)&&5e3>Math.abs(t-n)}vo(t,n,r){var i=n!==this._sessionActivityTimestamp,s=!(t!==this._e||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this._e=t,s&&!i||s&&this.do(n)||(this.Za=n,this.za.register({[Fs]:[n,t,r]}))}co(){var t,n=(t=this.qi)==null?void 0:t.persistence_save_debounce_ms;return Jn(n)&&n>0}fo(){this.co()?this.za.refreshKey(Fs):(this.za.flush(),this.za.load())}po(){var t;if(!rt(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var n=this.mo();n[1]===this._e&&n[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[Fs]:[this._sessionActivityTimestamp,(t=this._e)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],n=Jn(t)?t:0,r=Jn(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,r)}bo(t){return this.fo(),this.Xa(t,this.yo())}mo(){var t=this.za.props[Fs];return Z(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Za=null,this.eo=void 0,clearTimeout(this._o),this._o=void 0,this.vo(null,null,null)}setBootstrapSessionId(t,n){n===void 0&&(n=!1);var r=function(i,s){s===void 0&&(s=new Date().getTime());try{var o=(a=>{var l=a.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})(i);return o>s+6e4?void ps.error("Bootstrap sessionID cannot be in the future"):o}catch(a){return void ps.error("Invalid sessionID in bootstrap",a)}}(t);return!L(r)&&(n?this.eo={sessionId:t,sessionStartTimestamp:r}:this.vo(t,new Date().getTime(),r),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&I&&(I.removeEventListener(kc,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&we.qr(this.ao)},Re(I,kc,this.Ka,{capture:!1})}checkAndGetSessionAndWindowId(t,n,r){if(t===void 0&&(t=!1),n===void 0&&(n=null),r===void 0&&(r=!1),this.qi.cookieless_mode===lr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=n||new Date().getTime(),s=this._e;if(r)this.Qa=i;else if(rt(this.Qa)||this.Qa>i||i-this.Qa>=1e3){var o,a;(o=(a=this.za).syncCookieProperties)==null||o.call(a),this.Qa=i}var l=this.mo(),u=l[1],c=l[2],d=!L(s)&&u!==s,f=this.yo(),m=this.ho(),_=this.eo,p=!!_&&(_.sessionStartTimestamp>i+6e4||i-_.sessionStartTimestamp>E_),y=_?p:Jn(c)&&Math.abs(i-c)>E_,h=!1,v=d,x=!u||!!_,b=u,E=!x&&!t&&this.Xa(i,f);if(E){(E=this.bo(i))||ps.info("cross-tab refresh kept the session alive",{sessionId:u});var S=this.mo();u=S[1],c=S[2]}if(x||E||y){v=!1;var P=_&&!p;u=P?_.sessionId:this.io(),m=this.ro(),ps.info("new session ID assigned",{sessionId:u,windowId:m,bootstrapped:!!P,changeReason:{noSessionId:x,activityTimeout:E,sessionPastMaximumLength:y}}),c=P?_.sessionStartTimestamp:i,this.eo=void 0,h=!0}else m||(m=this.ro(),h=!0),(v=v||u!==b)&&(ps.info("adopted cross-tab session id",{sessionId:u,windowId:m}),h=!0);var C=Jn(f)&&t&&!y?f:i,T=Jn(c)?c:new Date().getTime();this.uo(m),this.vo(u,C,T),t||this.no();var R={noSessionId:x,activityTimeout:E,sessionPastMaximumLength:y,crossTabAdoption:v};return h&&this.Ja.forEach(N=>N(u,m,R)),{sessionId:u,windowId:m,sessionStartTimestamp:T,changeReason:h?R:void 0,lastActivityTimestamp:f}}no(){this.Ya||(clearTimeout(this._o),this._o=setTimeout(()=>{if(!this.Ya)if(this.bo(new Date().getTime())){var t=this._e;this.resetSessionId(),this.Ga.emit("forcedIdleReset",{idleSessionId:t})}else this.no()},1.1*this.sessionTimeoutMs))}}var ZE=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&jy(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>jy(i==null?void 0:i.brand,t)))return!0}catch{}return!!e.webdriver};function eS(){return(eS=Ce(function*(){var e=St==null?void 0:St.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return ce(n)&&n.length>0?n:void 0}catch(r){return void D.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",r)}})).apply(this,arguments)}var Nc=function(e,t){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function If(e,t,n){return Ls({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var tS={exact:(e,t)=>t.some(n=>e.some(r=>n===r)),is_not:(e,t)=>t.every(n=>e.every(r=>n!==r)),regex:(e,t)=>t.some(n=>e.some(r=>Nc(n,r))),not_regex:(e,t)=>t.every(n=>e.every(r=>!Nc(n,r))),icontains:(e,t)=>t.map(tu).some(n=>e.map(tu).some(r=>n.includes(r))),not_icontains:(e,t)=>t.map(tu).every(n=>e.map(tu).every(r=>!n.includes(r))),gt:(e,t)=>t.some(n=>{var r=parseFloat(n);return!isNaN(r)&&e.some(i=>r>parseFloat(i))}),lt:(e,t)=>t.some(n=>{var r=parseFloat(n);return!isNaN(r)&&e.some(i=>re.toLowerCase();function nS(e,t){return!e||Object.entries(e).every(n=>{var r=n[1],i=t==null?void 0:t[n[0]];if(L(i)||rt(i))return!1;var s=[String(i)],o=tS[r.operator];return!!o&&o(r.values,s)})}var Ap="custom",C_="i.posthog.com",mO=/^\/static\//,yO=["/s/","/e/","/i/"];class _O{constructor(t){this.wo={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+C_,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.wo[this.apiHost]||(this.wo[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Ap),this.wo[this.apiHost]}ko(t){if(mO.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}So(t){var n=Eo(t);return n?n.protocol+"//"+n.host+n.pathname:void 0}xo(t,n,r){if(t==="ui")return r;var i=r,s=this.instance.config.rewriteRequestPath;if(s){var o,a=((o=Eo(r))==null?void 0:o.href)||r;i=s(new URL(a)).toString()}if(s&&t==="api"&&yO.some(f=>n.indexOf(f)===0)){var l=this.So(i);if(l){var u,c=this.apiHost,d=this.Co;((u=d)==null?void 0:u.apiHost)===c&&d.rewriteRequestPath===s||(d={apiHost:c,rewriteRequestPath:s,urls:new Set},this.Co=d),d.urls.add(l)}}return i}isIngestionEndpoint(t){var n=this.Co,r=this.So(t);return(n==null?void 0:n.apiHost)===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&n.urls.has(r)}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.xo(t,n,this.uiHost+n);if(t==="flags")return this.xo(t,n,this.flagsApiHost+n);if(t==="assets"){var r=this.ko(n);if(r)return this.xo(t,n,""+r+n)}if(this.region===Ap)return this.xo(t,n,this.apiHost+n);var i=C_+n;switch(t){case"assets":return this.xo(t,n,"https://"+this.region+"-assets."+i);case"api":return this.xo(t,n,"https://"+this.region+"."+i)}}}function rS(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var he=Ie("[Surveys]"),iS="seenSurvey_",sS=e=>{try{var t=(n=>((r,i)=>""+iS+function(s){return s.current_iteration&&s.current_iteration>0?s.id+"_"+s.current_iteration:s.id}(i))(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){he.error("Failed to persist survey seen state",n)}},wO=[Cf.Popover,Cf.Widget,Cf.API],xO={ignoreConditions:!1,ignoreDelay:!1,displayType:Pp.Popover},bO=Ie("[PostHog ExternalIntegrations]"),EO={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class SO{constructor(t){this._instance=t}_s(t,n){var r;(r=Y.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,i=>{if(i)return bO.error("failed to load script",i);n()})}startIfEnabledOrStop(){var t=this,n=function(){var s,o,a,l=r[0],u=r[1];!u||(s=Y.__PosthogExtensions__)!=null&&(s=s.integrations)!=null&&s[l]||t._s(EO[l],()=>{var c;(c=Y.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[l])==null||c.start(t._instance)}),!u&&(o=Y.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[l]&&((a=Y.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[l])==null||a.stop())};for(var r of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;n()}}}class CO{constructor(t,n){this.I=t,this.ns=n,this.To=new Map,this.Xn=!1}add(t){var n=this;return Ce(function*(){if(n.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');n.To.set(t.name,t);try{var r=t.setup(n.ns);r&&(yield r)}catch(s){var i=n.To.get(t.name)===t;i&&n.To.delete(t.name),n.I.error('Failed to set up browser extension "'+t.name+'"',s),i&&n.Mo(t)}})()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var n of(this.To.clear(),t))this.Mo(n)}}Mo(t){try{var n=t.dispose==null?void 0:t.dispose();n&&vt(n.then)&&n.then(void 0,r=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',r)})}catch(r){this.I.error('Failed to dispose browser extension "'+t.name+'"',r)}}}class kO{constructor(t){this._instance=t}initialize(){}get(t){var n=this._instance.persistence;if(typeof t=="string")return n==null?void 0:n.get_property(t);var r={};for(var i of t){var s=n==null?void 0:n.get_property(i);L(s)||(r[i]=s)}return r}set(t,n){var r;(r=this._instance.persistence)==null||r.register(typeof t=="string"?{[t]:n}:t)}remove(t){var n;(n=this._instance.persistence)==null||n.unregister(t)}}var k_="extensionsRemoteConfig";class PO{constructor(t){this.Xn=!1,this.instance=t,this.I=D,this.Eo=t.Io,this.kv=new kO(t),this.onEvent=n=>eu(this.instance.on("eventCaptured",r=>{try{n({event:r.event,properties:r.properties})}catch(i){this.I.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=n=>{if(this.Xn)return eu(()=>{});var r=s=>{try{n(s)}catch(o){this.I.error("Browser extension remote config listener failed",o)}},i=this.instance.Ro.on(k_,r);return this.Eo&&r(this.Eo),eu(i)},this.Po=new CO(D.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return(t=this.instance.get_property(Ya))!==null&&t!==void 0?t:this.distinctId}get deviceId(){var t=this.instance.get_property(Ya);return typeof t=="string"?t:void 0}get library(){return{name:Ee.LIB_NAME,version:Ee.LIB_VERSION}}get initialPersonProperties(){var t,n;return(t=(n=this.instance.persistence)==null?void 0:n.get_initial_props())!==null&&t!==void 0?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,n,r,i,s=(t=this.instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=s==null?void 0:s.sessionId)!==null&&n!==void 0?n:"",windowId:(r=s==null?void 0:s.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(i=s==null?void 0:s.sessionStartTimestamp)!==null&&i!==void 0?i:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.Po.add(t)}capture(t,n,r){var i=this;return Ce(function*(){r?i.instance.capture(t,n,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):i.instance.capture(t,n)})()}registerDynamicEventProperties(t){return eu(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(k_,t))}sendRequest(t,n){var r=this;return Ce(function*(){var i;n===void 0&&(n={});var s=r.instance.requestRouter.endpointFor((i=n.target)!==null&&i!==void 0?i:"api",t),o={method:n.method,url:n.query?bl(s,n.query):s,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(r.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,r.instance._send_request(o)})})()}dispose(){this.Xn||(this.Xn=!0,this.Po.dispose())}}var Ra={},Of=0,Ta=()=>{},P_='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ea="Surveys module not available",R_="sanitize_properties is deprecated. Use before_send instead",oS="Invalid value for property_denylist config: ",RO=["token","distinct_id",fE],bs="posthog",aS=!uO&&(Mt==null?void 0:Mt.indexOf("MSIE"))===-1&&(Mt==null?void 0:Mt.indexOf("Mozilla"))===-1,Mf=e=>{var t;return $({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:RI(j==null?void 0:j.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ta,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Ae&&ce(Ae==null?void 0:Ae.search)&&Ae.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(I==null||(t=I.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){D.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:bp,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Mp},error_tracking:{},_onCapture:Ta},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:zI,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(e))},TO=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],T_=e=>{var t={};for(var n of TO){var r=n[0],i=n[1];L(e[r])||(t[i]=e[r])}var s=_e({},t,e),o=e.__preview_external_dependency_versioned_paths;return L(o)||(L(e.strict_script_versioning)&&(s.strict_script_versioning=!!o),ce(o)&&L(e.asset_host)&&(s.asset_host=o)),Z(e.property_blacklist)&&(L(e.property_denylist)?s.property_denylist=e.property_blacklist:Z(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:D.error(oS+e.property_denylist)),s};class IO{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(t){D.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class qt{Oo(t,n){if(t){var r=this.To.indexOf(t);r!==-1&&this.To.splice(r,1)}return this.To.push(n),n.initialize==null||n.initialize(),n}Lo(){return this.config.cookieless_mode===lr||this.config.cookieless_mode===ki&&this.consent.isRejected()}$o(){if(!this.Lo()&&this.get_distinct_id()===fs){var t=this.persistence;if(t){this.Do()||t.load(!0);var n=this.get_distinct_id();if(!n||n===fs){var r=this.config.get_device_id($n());this.register({distinct_id:r,$device_id:r}),t.set_property(se,We)}this.No()}}}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new IO,this.qo=!1,this.version=Ee.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new Ac,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mf(),this.SentryIntegration=KI,this.sentryIntegration=r=>function(i,s){var o=OE(i,s);return{name:IE,processEvent:a=>o(a)}}(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Uo=!1,this.zo=null,this.Wo=null,this.Vo=null,this.scrollManager=new vO(this),this.pageViewManager=new f_(this),this.rateLimiter=new rO(this),this.requestRouter=new _O(this),this.consent=new $I(this),this.externalIntegrations=new SO(this);var n=(t=qt.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,i,s)=>{var o=ce(r)?{[r]:i}:r;this.setPersonProperties(o),s==null||s({})},set_once:(r,i,s)=>{var o=ce(r)?{[r]:i}:r;this.setPersonProperties(void 0,o),s==null||s({})}},this.on("eventCaptured",r=>D.info('send "'+(r==null?void 0:r.event)+'"',r))}init(t,n,r){if(r&&r!==bs){var i,s=(i=Ra[r])!==null&&i!==void 0?i:new qt;return s._init(t,n,r),Ra[r]=s,Ra[bs][r]=s,s}return this._init(t,n,r)}_init(t,n,r){var i,s;n===void 0&&(n={});var o,a=ce(t)?t.trim():"";if(!a)return D.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return a!==((o=this.config)==null?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Mf(n.defaults),n.debug=this.Go(n.debug),this.Zo=n,this.Qo=[],n.person_profiles?this.Wo=n.person_profiles:n.process_person&&(this.Wo=n.process_person);var l=Mf(n.defaults),u=T_(n),c=_e({},l,u,{name:r,token:a});Se(l.rageclick)&&Se(u.rageclick)&&(c.rageclick=_e({},l.rageclick,u.rageclick)),Se(l.session_recording)&&Se(u.session_recording)&&(c.session_recording=_e({},l.session_recording,u.session_recording)),this.set_config(c),this.config.on_xhr_error&&D.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Et.GZipJS;var d=this.Do();if(this.persistence=new Sf(this.config,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Sf($({},this.config,{persistence:"sessionStorage"}),d,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!d&&we.Dr()){var f=we.Br(this.Bo);Z(f)&&f.forEach(S=>{ce(S)&&this.jo.add(S)})}else we.qr(this.Bo);var m=$({},this.persistence.props),_=$({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Jo=new fO(S=>this.Ko(S),this.config.request_queue_config),this.Yo=new pO(this),this.__request_queue=[];var p=this.Lo();if(p||(this.sessionManager=new S_(this),this.sessionPropsManager=new b_(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((S,P,C)=>{(C!=null&&C.activityTimeout||C!=null&&C.sessionPastMaximumLength||C!=null&&C.crossTabAdoption)&&this.Xo()})),this.tl(),this.config.__preview_deferred_init_extensions?(D.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.el(p)},0)):(D.info("Initializing extensions synchronously"),this.el(p)),Ee.DEBUG=Ee.DEBUG||this.config.debug,Ee.DEBUG&&D.info("Starting in debug mode",{this:this,config:n,thisC:$({},this.config),p:m,s:_}),!this.config.identity_distinct_id||(i=n.bootstrap)!=null&&i.distinctID||(n.bootstrap=$({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var y=n.bootstrap.distinctID,h=this.get_distinct_id(),v=this.persistence.get_property(se);if(n.bootstrap.isIdentifiedID&&h!=null&&h!==y&&v===We)this.identify(y);else if(n.bootstrap.isIdentifiedID&&h!=null&&h!==y&&v===ot)D.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var x=this.config.get_device_id($n()),b=n.bootstrap.isIdentifiedID?x:y;this.persistence.set_property(se,n.bootstrap.isIdentifiedID?ot:We),this.register({distinct_id:y,$device_id:b})}}if(p)this.register_once({distinct_id:fs,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id($n());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(se,We)}return Re(I,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?function(S,P){var C=S.config.segment;if(!C)return P();(function(T,R){var N=T.config.segment;if(!N)return R();var M=F=>{var W=()=>F.anonymousId()||$n();T.config.get_device_id=W,F.id()&&(T.register({distinct_id:F.id(),$device_id:W()}),T.persistence.set_property(se,ot)),R()},z=N.user();"then"in z&&vt(z.then)?z.then(M):M(z)})(S,()=>{C.register((T=>{typeof Promise<"u"&&Promise.resolve||bf.warn("This browser does not have Promise support, and can not use the segment integration");var R=(N,M)=>{if(!M)return N;N.event.userId||N.event.anonymousId===T.get_distinct_id()||(bf.info("No userId set, resetting PostHog"),T.reset()),N.event.userId&&N.event.userId!==T.get_distinct_id()&&(bf.info("UserId set, identifying with PostHog"),T.identify(N.event.userId));var z=T.calculateEventProperties(M,N.event.properties);return N.event.properties=Object.assign({},z,N.event.properties),N};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:N=>R(N,N.event.event),page:N=>R(N,xs),identify:N=>R(N,gf),screen:N=>R(N,"$screen")}})(S)).then(()=>{P()})})}(this,()=>this.il()):this.il(),vt(this.config._onCapture)&&this.config._onCapture!==Ta&&(D.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",S=>this.config._onCapture(S.event,S))),this.config.ip&&D.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return eS.apply(this,arguments)}().then(S=>{S&&this.register({[pf]:S})}).catch(Ta),this}rl(t){var n=t;return ce(n.name)&&vt(n.setup)}nl(t,n){this.rl(t)?n.push(()=>{this.sl().add(t).catch(Ta)}):this.To.push(t)}tl(){var t,n,r,i,s,o,a=(t=(n=this.config.__extensionClasses)==null?void 0:n.featureFlags)!==null&&t!==void 0?t:(r=qt.__defaultExtensionClasses)==null?void 0:r.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||((i=this.al)==null||i.call(this),this.al=void 0,this.featureFlags=new a(this)),vt(this.featureFlags.onReloading)&&vt(this.featureFlags.setup)?this.al||(this.al=this.featureFlags.onReloading(()=>{this.Ro.emit("featureFlagsReloading",!0)}),this.sl().add(this.featureFlags)):(s=(o=this.featureFlags).initialize)==null||s.call(o))}el(t){var n,r,i,s,o,a,l,u=performance.now(),c=$({},qt.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.exceptions&&this.To.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new c.exceptions(this)),c.historyAutocapture&&this.To.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.To.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this.To.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!t&&this.To.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.nl(this.autocapture=new c.autocapture(this),d),c.surveys&&this.nl(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new c.surveys(this),d),c.logs&&this.To.push(this.logs=(i=this.logs)!==null&&i!==void 0?i:new c.logs(this)),c.metrics&&this.To.push(this.metrics=(s=this.metrics)!==null&&s!==void 0?s:new c.metrics(this)),c.conversations&&this.To.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new c.conversations(this)),c.productTours&&this.To.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.To.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.To.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,GI)),c.toolbar&&this.To.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new c.toolbar(this)),c.experiments&&this.To.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new c.experiments(this)),this.To.forEach(f=>{f.initialize&&d.push(()=>{f.initialize==null||f.initialize()})}),d.push(()=>{if(this.ol){var f=this.ol;this.ol=void 0,this.To.forEach(m=>m.onRemoteConfig==null?void 0:m.onRemoteConfig(f))}}),this.ll(d,u)}ll(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout(()=>{this.ll(t,n)},0);var r=t.shift();if(r)try{r()}catch(s){D.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-n);this.register_for_session({[hE]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[pE]:i}),this.config.__preview_deferred_init_extensions&&D.info("PostHog extensions initialized ("+i+"ms)")}pa(t){var n;if(!j||!j.body)return D.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.pa(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.ol=t),this.Io=t,this.compression=void 0,t.ok){var r,i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=J(i.supportedCompression,Et.GZipJS)?Et.GZipJS:J(i.supportedCompression,Et.Base64)?Et.Base64:void 0),(r=i.analytics)!=null&&r.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:bp}),(n=this.ul)==null||n.handleRemoteConfig(t),this.To.forEach(s=>s.onRemoteConfig==null?void 0:s.onRemoteConfig(t))}il(){try{this.config.loaded(this)}catch(r){D.critical("`loaded` function failed",r)}if(this.hl(),this.config.internal_or_test_user_hostname&&Ae!=null&&Ae.hostname){var t=Ae.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Lo())&&this.dl()},1),this.vl=new UE(this),this.vl.load()}hl(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Jo)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Ql(this.__request_queue,t=>this.Ko(t)),this.__request_queue=[],this.hl()}_handle_unload(){var t,n,r,i,s;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.cl()&&this.capture(vf),(r=this.logs)==null||r.flushLogs("sendBeacon"),(i=this.Jo)==null||i.unload(),(s=this.Yo)==null||s.unload()):this.cl()&&this.capture(vf,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?aS?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=$({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(L(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,o=$({},n);o.timeout=o.timeout||6e4;var a,l,u,c,d,f=(r=o.transport)!==null&&r!==void 0?r:"fetch";f==="sendBeacon"&&L(o.compression)&&o.data&&(o.compression=Et.Base64),o.method==="POST"&&o.data&&(o.timestampMode==="capture-body"?o.data={api_key:(l=(d=(c=(Z(a=o.data)?a:[a]).map(y=>$({},y,y.timestamp instanceof Date&&!isNaN(y.timestamp.getTime())?{timestamp:y.timestamp.toISOString()}:{})))[0])==null||(u=d.properties)==null?void 0:u.token)!==null&&l!==void 0?l:d==null?void 0:d.token,batch:c,sent_at:new Date().toISOString()}:o.timestampMode==="body"&&(o.data=function(y,h){return h===void 0&&(h=new Date().toISOString()),Z(y)?y.map(v=>$({},v,{sent_at:h})):$({},y,{sent_at:h})}(o.data))),o.url=x_(o.url,o.method,o.compression,o.timestampMode);var m=Mu.filter(y=>!o.disableTransport||!y.transport||!o.disableTransport.includes(y.transport)),_=(i=(s=function(y,h){for(var v=0;y.length>v;v++)if(y[v].transport===f)return y[v]}(m))==null?void 0:s.method)!==null&&i!==void 0?i:m[0].method;if(!_)throw new Error("No available transport method");var p=y=>{try{_(y)}catch(h){XE(h)?D.warn(h):D.error(h),o.callback==null||o.callback({statusCode:0,error:h})}};f!=="sendBeacon"&&o.data&&o.compression===Et.GZipJS&&ST&&typeof Promise<"u"&&!Ou?cO(o).then(y=>{p(y)}).catch(y=>{if(Ly(y))return Ou=!0,void p($({},o,{compression:void 0,url:x_(n.url,n.method,void 0,n.timestampMode)}));(h=>{if(!h||typeof h!="object")return!1;var v="name"in h?String(h.name):"";return Ly(h)||v===Eb})(y)&&(Ou=!0),p(o)}):_(o)})($({},t,{callback:n=>{var r,i;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(i=this.config).on_request_error)==null||r.call(i,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}Ko(t){this.Yo?this.Yo.retriableRequest(t):this._send_request(t)}_execute_array(t){Of++;try{var n,r=[],i=[],s=[];Ql(t,a=>{if(a)if(Z(n=a[0]))s.push(a);else if(vt(a))try{a.call(this)}catch(l){D.error("Error executing queued PostHog call",a,l)}else Z(a)&&n==="alias"?r.push(a):Z(a)&&n.indexOf("capture")!==-1&&vt(this[n])?s.push(a):i.push(a)});var o=function(a,l){Ql(a,function(u){try{if(Z(u[0])){var c=l;ve(u,function(d){c=c[d[0]].apply(c,d.slice(1))})}else l[u[0]].apply(l,u.slice(1))}catch(d){D.error("Error executing queued PostHog call",u,d)}})};o(r,this),o(i,this),o(s,this)}finally{Of--}}push(t){if(Of>0&&Z(t)&&ce(t[0])){var n=qt.prototype[t[0]];vt(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,r){var i,s,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!L(t)&&ce(t)){this.$o();var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){n!=null&&n.$current_url&&!ce(n==null?void 0:n.$current_url)&&(D.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||r!=null&&r.fl||D.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var d=new Date,f=(r==null?void 0:r.timestamp)||d,m=Vy(r==null?void 0:r.uuid,$n),_={uuid:m,event:t,properties:this.calculateEventProperties(t,n||{},f,m)};t===xs&&this.config.__preview_capture_bot_pageviews&&u&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),c&&(_.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens);var p=t==="$feature_flag_called"&&_.properties.$feature_flag_has_experiment===!1&&this.get_property(xc)===!0;r!=null&&r.$set&&!p&&(_.$set=r==null?void 0:r.$set);var y=r==null?void 0:r.$unset;y&&(_.$unset=y);var h,v,x,b=p?void 0:this.pl(r==null?void 0:r.$set_once,t!==Yy,t===gf);if(b&&(_.$set_once=b),r!=null&&r._noTruncate||(s=this.config.properties_string_max_length,o=_,a=M=>ce(M)?M.slice(0,s):M,l=new Set,_=function M(z,F){if(z!==Object(z))return a?a(z):z;if(!l.has(z)){var W;if(l.add(z),Z(z))W=[],Ql(z,Q=>{W.push(M(Q))});else{var B={};ve(z,(Q,O)=>{l.has(Q)||(B[O]=M(Q))}),W=B}return W}}(o)),_.timestamp=f,L(r==null?void 0:r.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=d),p&&(_.properties=function(M,z){z===void 0&&(z=[]);var F={},W=B=>{M[B]!==void 0&&(F[B]=M[B])};return CT.forEach(W),z.forEach(W),F}(_.properties,RO)),t===ur.DISMISSED||t===ur.SENT){var E=n==null?void 0:n[kf.SURVEY_ID],S=n==null?void 0:n[kf.SURVEY_ITERATION];sS({id:E,current_iteration:S}),_.$set=$({},_.$set,{[(h={id:E,current_iteration:S},v=t===ur.SENT?"responded":"dismissed",x="$survey_"+v+"/"+h.id,h.current_iteration&&h.current_iteration>0&&(x="$survey_"+v+"/"+h.id+"/"+h.current_iteration),x)]:!0})}else t===ur.SHOWN&&(_.$set=$({},_.$set,{[kf.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===nO.SHOWN){var P=n==null?void 0:n[v_.TOUR_TYPE];P&&(_.$set=$({},_.$set,{[v_.TOUR_LAST_SEEN_DATE+"/"+P]:new Date().toISOString()}))}var C=$({},_.properties.$set,_.$set);if(En(C)||this.setPersonPropertiesForFlags(C),!ne(this.config.before_send)){var T=this.kn(_);if(!T)return;(_=T).uuid=Vy(_.uuid,$n)}this.Ro.emit("eventCaptured",_);var R=(i=r==null?void 0:r._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),N={method:"POST",url:R,data:_,compression:"best-available",timestampMode:(r==null?void 0:r._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(R)?"body":"capture-body",batchKey:r==null?void 0:r._batchKey,transport:r==null?void 0:r.transport};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Ko(N):this.Jo.enqueue(N),_}D.critical("This capture call is ignored due to client rate limiting.")}}else D.error("No event name provided to posthog.capture")}else D.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}sl(){var t;return(t=this.ul)!==null&&t!==void 0?t:this.ul=new PO(this)}Ao(t){this.Ho.push(t);var n=!0;return()=>{if(n){n=!1;var r=this.Ho.indexOf(t);r!==-1&&this.Ho.splice(r,1)}}}gl(t){var n,r,i;return t===void 0&&(t=!0),!((n=this.persistence)==null||!n.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(se)===We&&((i=this.sessionPersistence)==null||i.clear(),this.jo.clear(),this.ml()),(r=this.featureFlags)==null||r.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,n,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.gl();var o=s?void 0:this.persistence.remove_event_timer(t),a=$({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Lo()&&(a[fE]=!0),t==="$snapshot"){var l=$({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!ce(a.distinct_id)&&!Ge(a.distinct_id)||cc(a.distinct_id))&&D.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=function(E,S,P,C){var T,R,N,M;if(C===void 0&&(C=!1),!Mt)return{};var z,F=E?[...Co,...S||[]]:[],W=function(us){for(var It=0;zy.length>It;It++){var cs=zy[It],Cr=cs[1],pn=cs[0].exec(us),Do=pn&&(vt(Cr)?Cr(pn,us):Cr);if(Do)return Do}return["",""]}(Mt),B=W[0],Q=W[1],O=(z=typeof navigator<"u"?navigator:void 0)!=null&&z.brave?{brave:!0}:{},A={};L(P)||(A.detectGoogleSearchApp=P);var V={},K=(T=navigator)==null||(T=T.userAgentData)==null?void 0:T.platform,te=(R=navigator)==null?void 0:R.maxTouchPoints,oe=I==null||(N=I.screen)==null?void 0:N.width,de=I==null||(M=I.screen)==null?void 0:M.height,be=I==null?void 0:I.devicePixelRatio;L(K)||(V.userAgentDataPlatform=K),L(te)||(V.maxTouchPoints=te),L(oe)||(V.screenWidth=oe),L(de)||(V.screenHeight=de),L(be)||(V.devicePixelRatio=be);var Pe,Be,ye,Fe,Tt,Sr,_t,Ye,gi=_e(Sg({$os:B,$os_version:Q,$browser:Yb(Mt,navigator.vendor,O,A),$device:Uy(Mt),$device_type:(Be=Mt,ye=V,Ye=Uy(Be),Ye===Mb||Ye===Ob||Ye==="Kobo"||Ye==="Kindle Fire"||Ye===Wb?wo:Ye===Ka||Ye===Hs||Ye===Qa||Ye===ip?"Console":Ye===Nb?"Wearable":Ye?Yt:(ye==null?void 0:ye.userAgentDataPlatform)==="Android"&&((Fe=ye==null?void 0:ye.maxTouchPoints)!==null&&Fe!==void 0?Fe:0)>0?600>Math.min((Tt=ye==null?void 0:ye.screenWidth)!==null&&Tt!==void 0?Tt:0,(Sr=ye==null?void 0:ye.screenHeight)!==null&&Sr!==void 0?Sr:0)/((_t=ye==null?void 0:ye.devicePixelRatio)!==null&&_t!==void 0?_t:1)?Yt:wo:"Desktop"),$timezone:zE(),$timezone_offset:ZI()}),{$current_url:Za(C?li(Ae==null?void 0:Ae.href):Ae==null?void 0:Ae.href,F,el),$host:Ae==null?void 0:Ae.host,$pathname:Ae==null?void 0:Ae.pathname,$raw_user_agent:Mt.length>1e3?Mt.substring(0,997)+"...":Mt,$browser_version:KT(Mt,navigator.vendor,O,A),$browser_language:h_(),$browser_language_prefix:(Pe=h_(),typeof Pe=="string"?Pe.split("-")[0]:void 0),$screen_height:I==null?void 0:I.screen.height,$screen_width:I==null?void 0:I.screen.width,$viewport_height:I==null?void 0:I.innerHeight,$viewport_width:I==null?void 0:I.innerWidth,$lib:Ee.LIB_NAME,$lib_version:Ee.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Ee.SDK_DIST_CHANNEL&&(gi.$sdk_dist_channel=Ee.SDK_DIST_CHANNEL),gi}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var d=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime(),!0),f=d.windowId;a.$session_id=d.sessionId,a.$window_id=f}this.sessionPropsManager&&_e(a,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&_e(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(m=this.Yo)==null?void 0:m.length}catch(E){a.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===Ap&&(a.$lib_custom_api_host=this.config.api_host),u=t!==xs||s?t!==vf||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=_e(a,u),t===xs&&j&&(a.title=j.title),!L(o)){var _=r.getTime()-o;a.$duration=parseFloat((_/1e3).toFixed(3))}Mt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var p=this.persistence.properties(),y=this.sessionPersistence.properties();ve(["$referrer","$referring_domain"],E=>{E in p&&delete y[E]});var h={};if(this.Ho.length>0)for(var v of this.Ho.slice())try{_e(h,v())}catch(E){D.error("Failed to produce browser extension event properties",E)}(a=_e({},c,p,y,$({},h,a))).$is_identified=this._isIdentified(),Z(this.config.property_denylist)?ve(this.config.property_denylist,function(E){delete a[E]}):D.error(oS+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(D.error(R_),a=x(a,t));var b=this.yl();return a.$process_person_profile=b,b&&!s&&this.bl("_calculate_event_properties"),a}pl(t,n,r){var i;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.yl()||this.qo&&!r)return t;var s=this.persistence.get_initial_props(),o=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),a=_e({},s,o||{},t||{}),l=this.config.sanitize_properties;return l&&(D.error(R_),a=l(a,"$set_once")),n&&(this.qo=!0),En(a)?void 0:a}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var i;(i=this.persistence)==null||i.register_once(t,n,r)}register_for_session(t){var n,r;(n=this.persistence)==null||n.syncCookieProperties(),this.gl(),(r=this.sessionPersistence)==null||r.register(t),Object.keys(t).forEach(i=>this.jo.add(i)),this.ml()}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t),this.jo.delete(t),this.ml()}_l(t,n){this.register({[t]:n})}Xo(){this.jo.forEach(t=>{var n;(n=this.sessionPersistence)==null||n.unregister(t)}),this.jo.clear(),this.ml()}ml(){var t;if(this.Bo)if(this.config.persistence==="memory"||(t=this.sessionPersistence)!=null&&t.Hs||!we.Dr())we.qr(this.Bo);else{var n=[];this.jo.forEach(r=>n.push(r)),n.length>0?we.Nr(this.Bo,n):we.qr(this.Bo)}}getFeatureFlag(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var r,i;return(r=(i=this.featureFlags)==null?void 0:i.isFeatureEnabled(t,n))!==null&&r!==void 0?r:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,r){var i;(i=this.featureFlags)==null||i.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var i;(i=this.featureFlags)==null||i.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){var i;return n===void 0&&(n=!1),(i=this.featureFlags)==null?void 0:i.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.Ro.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:ea}),()=>{})}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:ea})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:ea})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=xO),(r=this.surveys)==null||r.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:ea}}canRenderSurveyAsync(t,n){var r,i;return n===void 0&&(n=!1),(r=(i=this.surveys)==null?void 0:i.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:ea})}wl(t){return!t||cc(t)?(D.critical("Unique user id has not been set in posthog.identify"),!1):t===fs?(D.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(D.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,r){if(!this.__loaded||!this.persistence)return D.uninitializedWarning("posthog.identify");if(Ge(t)&&(t=t.toString(),D.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.wl(t)&&this.bl("posthog.identify")){this.$o();var i=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,o=this.gl(!1),a=this.persistence.Ws(),l=!1;try{var u=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Ya)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property($s)&&(this.unregister($s),this.register({distinct_id:t}));var c,d=(this.persistence.get_property(se)||We)===We,f=t!==u,m=!f&&d;if(f&&d)this.persistence.set_property(se,ot),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(gf,{distinct_id:t,$anon_distinct_id:u},{$set:n||{},$set_once:r||{}}),this.Vo=If(t,n,r),(c=this.featureFlags)==null||c.setAnonymousDistinctId(u);else if(m){this.persistence.set_property(se,ot);var _=n||{},p=r||{};this.setPersonPropertiesForFlags({$set:_,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:_,$set_once:p}),this.Vo=If(t,n,r)}else(n||r)&&this.setPersonProperties(n,r);f||s||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ar)):m&&(n||r)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.Qs(l)}}}setPersonProperties(t,n){if((t||n)&&this.bl("posthog.setPersonProperties")){var r=If(this.get_distinct_id(),t,n);this.Vo!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Vo=r):D.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,r=(Z(t)?t:[t]).filter(i=>ce(i)&&i.length>0);r.length!==0&&this.bl("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Vo=null)}group(t,n,r){var i;if(t&&n){(i=this.persistence)==null||i.syncCookieProperties(),this.gl();var s=this.getGroups(),o=s[t]!==n;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:$({},s,{[t]:n})}),o||r){var a={$group_type:t,$group_key:n};r&&(a.$group_set=r),this.capture(Yy,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else D.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),this.bl("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n=$t(t)?t:t==null?void 0:t.resetDeviceID,r=$t(t)||t==null?void 0:t.bootstrap;this.kl(n,!1,r)}kl(t,n,r){var i,s,o;if(n===void 0&&(n=!1),D.info("reset"),!this.__loaded)return D.uninitializedWarning("posthog.reset");var a=r==null?void 0:r.sessionID;this.config.bootstrap=r||((i=this.Zo)==null?void 0:i.bootstrap)||{},(s=this.featureFlags)==null||s.updateConfig==null||s.updateConfig(this.config,this.ma());var l=this.get_property(Ya),u=this.get_property(pf),c=this.get_property(Oi),d=this.is_capturing();this.consent.reset(),n||!d||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var f=(o=this.persistence)==null||o.Ws==null?void 0:o.Ws(),m=!1;try{var _,p,y,h,v,x,b,E,S,P,C,T,R,N;if((_=this.persistence)==null||_.clear(),(p=this.sessionPersistence)==null||p.clear(),this.jo.clear(),this.ml(),L(c)||(C=this.persistence)==null||C.register({[Oi]:c}),(y=this.surveys)==null||y.reset(),(h=this.vl)==null||h.stop(),(v=this.featureFlags)==null||v.reset(),(x=this.conversations)==null||x.reset(),(b=this.logs)==null||b.reset(),(E=this.metrics)==null||E.reset(),(S=this.persistence)==null||S.set_property(se,We),(P=this.sessionManager)==null||P.resetSessionId(),this.Vo=null,this.config.cookieless_mode===lr)this.register_once({distinct_id:fs,$device_id:null},"");else{var M=this.config.get_device_id($n());this.register_once({distinct_id:M,$device_id:t?M:l},""),t||L(u)||this.register({[pf]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),r&&(r.distinctID===void 0||this.Lo()||((N=this.persistence)==null||N.set_property(se,r.isIdentifiedID?ot:We),this.register({distinct_id:r.distinctID})),(T=this.featureFlags)==null||T.initialize(),!(L(a)||(R=this.sessionManager)!=null&&R.setBootstrapSessionId(a,!0)))){var z=$({},r);delete z.sessionID,this.config.bootstrap=z}delete this.config.identity_distinct_id,delete this.config.identity_hash,m=!0}finally{var F;f&&((F=this.persistence)==null||F.Qs==null||F.Qs(m))}this.reloadFeatureFlags()}shutdown(t){var n=this;return Ce(function*(){var r,i,s,o,a,l;if(n.__loaded){(r=n.vl)==null||r.stop(),n.sl().dispose(),(i=n.sessionRecording)==null||i.dispose(),(s=n.logs)==null||s.flushLogs("sendBeacon"),(o=n.metrics)==null||o.flush("sendBeacon"),(a=n.Jo)==null||a.unload(),(l=n.Yo)==null||l.unload();try{var u;(u=n.featureFlags)==null||u.destroy()}catch(c){D.error("Error while destroying feature flags",c)}}else D.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,n){var r;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(r=this.conversations)==null||r.Sl()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.xl()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var n=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&r){var s,o=(s=t.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(t,n){return t===this.get_property(sE)?(D.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(L(n)&&(n=this.get_distinct_id()),t!==n?(this._l($s,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(D.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=$({},this.config);if(Se(t)){var r,i,s,o,a,l,u,c,d,f,m,_;_e(this.config,T_(t));var p=this.Do();(r=this.persistence)==null||r.update_config(this.config,n,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Sf($({},this.config,{persistence:"sessionStorage"}),p,!1);var y,h=this.Go(this.config.debug);$t(h)&&(this.config.debug=h),$t(this.config.debug)&&(this.config.debug?(Ee.DEBUG=!0,ge.Dr()&&ge.Nr("ph_debug",!0),D.info("set_config",{config:t,oldConfig:n,newConfig:$({},this.config)})):(Ee.DEBUG=!1,ge.Dr()&&ge.qr("ph_debug"))),(i=this.featureFlags)==null||i.updateConfig==null||i.updateConfig(this.config,this.ma()),(s=this.exceptionObserver)==null||s.onConfigChange(),(o=this.exceptions)==null||o.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(u=this.autocapture)==null||u.startIfEnabled(),(c=this.heatmaps)==null||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((y=this.historyAutocapture)==null||y.startIfEnabledOrStop()),(d=this.exceptionObserver)==null||d.startIfEnabledOrStop(),(f=this.deadClicksAutocapture)==null||f.startIfEnabledOrStop(),(m=this.surveys)==null||m.loadIfEnabled(),this.No(),(_=this.externalIntegrations)==null||_.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Ee.LIB_NAME=t,Ee.LIB_VERSION=n}startSessionRecording(t){var n,r,i,s,o,a=t===!0,l={sampling:a||!(t==null||!t.sampling),linked_flag:a||!(t==null||!t.linked_flag),url_trigger:a||!(t==null||!t.url_trigger),event_trigger:a||!(t==null||!t.event_trigger)};Object.values(l).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),l.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),l.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),l.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),l.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent($({},i,n))}}addExceptionStep(t,n){var r;(r=this.exceptions)==null||r.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:qt.Cl}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:bs;return n!==bs&&(n=bs+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(se))===ot||((n=this.sessionPersistence)==null?void 0:n.get_property(se))===ot}yl(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===bp&&!this._isIdentified()&&En(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[$s])&&((n=this.persistence)==null||(n=n.props)==null||!n[Sc]))}cl(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yl()||this.bl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bl(t){return this.config.person_profiles==="never"?(D.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(Sc,!0),!0)}Do(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ki)}No(){var t,n,r,i,s=this.Do();return((t=this.persistence)==null?void 0:t.Hs)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.Hs)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s&&(this.jo.clear(),this.ml()),s}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==lr){if(this.Lo()){var r,i,s,o,a;this.kl(!0,!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new S_(this),this.pageViewManager=new f_(this),this.persistence&&(this.sessionPropsManager=new b_(this,this.sessionManager,this.persistence));var l,u=(s=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&s!==void 0?s:(a=qt.__defaultExtensionClasses)==null?void 0:a.sessionRecording;u&&(this.sessionRecording=this.Oo(this.sessionRecording,new u(this)),this.Io&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.Io)))}var c,d;this.consent.optInOut(!0),this.No(),this.hl(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==ki&&((c=this.surveys)==null||c.loadIfEnabled()),(L(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((d=t==null?void 0:t.captureEventName)!==null&&d!==void 0?d:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else D.warn(P_)}opt_out_capturing(){var t,n,r;this.config.cookieless_mode!==lr?(this.config.cookieless_mode===ki&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===ki&&(this.register({distinct_id:fs,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):D.warn(P_)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===lr||(this.config.cookieless_mode===ki?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.No()}_is_bot(){return St?ZE(St,this.config.custom_blocked_useragents):void 0}dl(){j&&(j.visibilityState==="visible"?this.Uo||(this.Uo=!0,this.capture(xs,{title:j.title},{send_instantly:!0}),this.zo&&(j.removeEventListener(Cc,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),Re(j,Cc,this.zo)))}debug(t){t===!1?(I==null||I.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(I==null||I.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}ma(){var t=this.Zo||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(D.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(n,r,i,s,o){var a=r in n&&!ne(n[r]),l=i in n&&!ne(n[i]);return a?n[r]:!!l&&(o&&o.warn("Config field '"+i+"' is deprecated. Please use '"+r+"' instead. The old field will be removed in a future major version."),n[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,D)}kn(t){var n;if(ne(this.config.before_send))return t;var r=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(FT),i=Z(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var o of i)try{if(s=o(s),ne(s)){var a="Event '"+t.event+"' was rejected in beforeSend function";return $T(t.event)?D.warn(a+". This can cause unexpected behavior."):D.info(a),null}s.properties&&!En(s.properties)||D.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(u){return D.error("Error in beforeSend function for event '"+t.event+"':",u),null}for(var l of r)if(s.properties&&ne(s.properties[l]))return D.warn("Event '"+t.event+"' had its '"+l+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return(t=this.pageViewManager.Ss)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}Go(t){var n=$t(t)&&!t,r=ge.Dr()&&ge.Pr("ph_debug")==="true";return!n&&(!!r||t)}}qt.__defaultExtensionClasses={},qt.Cl=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=kI(e.prototype[t[n]])}(qt,["identify"]);class lS{constructor(t){this.disabled=t===!1;var n=Se(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(t-i.x)+Math.abs(n-i.y)r-i.timestamp){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var Af="$copy_autocapture",nu=Ie("[AutoCapture]");function Nf(e,t){return t.length>e?t.slice(0,e)+"...":t}function OO(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!ui(t));return t}function MO(e,t){var n,r,i=t.e,s=t.maskAllElementAttributes,o=t.maskAllText,a=t.elementAttributeIgnoreList,l=t.elementsChainAsString,u=t.disableCaptureUrlHashes;if(!ui(e))return{props:{}};for(var c=[e],d=new Set([e]),f=e;f.parentNode&&!Kt(f,"body")&&bE>c.length;)if(xE(f.parentNode)){var m=f.parentNode.host;if(d.has(m))break;d.add(m),c.push(m),f=m}else{if(!ui(f.parentNode)||d.has(f.parentNode))break;d.add(f.parentNode),c.push(f.parentNode),f=f.parentNode}var _,p,y=[],h={},v=!1,x=!1;if(ve(c,C=>{var T=kp(C);if(Kt(C,"a")){var R=C.getAttribute("href");v=!!(T&&R&&ka(R))&&(u?li(R):R)}J(Tc(C),"ph-no-capture")&&(x=!0),y.push(function(M,z,F,W,B){B===void 0&&(B=!1);var Q=M.tagName.toLowerCase(),O={tag_name:Q};kg.indexOf(Q)>-1&&!F&&(O.$el_text=Q.toLowerCase()==="a"||Q.toLowerCase()==="button"?Nf(1024,u_(M)):Nf(1024,Ja(M)));var A=Tc(M);A.length>0&&(O.classes=A.filter(function(oe){return oe!==""})),ve(M.attributes,function(oe){var de;if((!RE(M)||["name","id","class","aria-label"].indexOf(oe.name)!==-1)&&(W==null||!W.includes(oe.name))&&!z&&ka(oe.value)&&(!ce(de=oe.name)||de.substring(0,10)!=="_ngcontent"&&de.substring(0,7)!=="_nghost")){var be=oe.value;oe.name==="class"&&(be=Cg(be).join(" ")),O["attr__"+oe.name]=Nf(1024,oe.name==="href"&&B?li(be):be)}});for(var V=1,K=1,te=M;te=OO(te);)V++,te.tagName===M.tagName&&K++;return O.nth_child=V,O.nth_of_type=K,O}(C,s,o,a,u));var N=function(M){if(!kp(M))return{};var z={};return ve(M.attributes,function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){var W=F.name.replace("data-ph-capture-attribute-",""),B=F.value;W&&B&&ka(B)&&(z[W]=B)}}),z}(C);_e(h,N)}),x)return{props:{},explicitNoCapture:x};if(o||(y[0].$el_text=Kt(e,"a")||Kt(e,"button")?u_(e):Ja(e)),v){var b,E;y[0].attr__href=v;var S=(b=Eo(v))==null?void 0:b.host,P=I==null||(E=I.location)==null?void 0:E.host;S&&P&&S!==P&&(_=v)}return{props:_e({$event_type:i.type,$ce_version:1},l?{}:{$elements:y},{$elements_chain:(p=y,function(C){return C.map(T=>{var R,N,M="";if(T.tag_name&&(M+=T.tag_name),T.attr_class)for(var z of(T.attr_class.sort(),T.attr_class))M+="."+z.replace(/"/g,"");var F=$({},T.text?{text:T.text}:{},{"nth-child":(R=T.nth_child)!==null&&R!==void 0?R:0,"nth-of-type":(N=T.nth_of_type)!==null&&N!==void 0?N:0},T.href?{href:T.href}:{},T.attr_id?{attr_id:T.attr_id}:{},T.attributes),W={};return Iu(F).sort((B,Q)=>B[0].localeCompare(Q[0])).forEach(B=>{var Q=B[1];return W[c_(B[0].toString())]=c_(Q.toString())}),(M+=":")+Iu(W).map(B=>B[0]+'="'+B[1]+'"').join("")}).join(";")}(function(C){return C.map(T=>{var R,N,M={text:(R=T.$el_text)==null?void 0:R.slice(0,400),tag_name:T.tag_name,href:(N=T.attr__href)==null?void 0:N.slice(0,2048),attr_class:WI(T),attr_id:T.attr__id,nth_child:T.nth_child,nth_of_type:T.nth_of_type,attributes:{}};return Iu(T).filter(z=>z[0].indexOf("attr__")===0).forEach(z=>M.attributes[z[0]]=z[1]),M})}(p)))},(n=y[0])!=null&&n.$el_text?{$el_text:(r=y[0])==null?void 0:r.$el_text}:{},_&&i.type==="click"?{$external_click_url:_}:{},h)}}class AO{constructor(t){this.name="autocapture",this.Qn=!1,this.Jn=null,this.Kn=!1,this.Yn=!1,this.qi={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Xn=!1,this.ts=t,this.ts.refresh(this.qi),this.rageclicks=new lS(this.qi.rageclick),this.es=null}setup(t){this.rs(),this.ns=t;var n=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Xn?n.dispose():(this.ss=n,this.startIfEnabled())}dispose(){var t;this.Xn||(this.Xn=!0,this.ns=void 0,(t=this.ss)==null||t.dispose(),this.ss=void 0,this.os())}ls(){return this.ts.refresh(this.qi),this.qi}rs(){var t,n;return this.ls(),this.qi.url_allowlist=(t=this.qi.url_allowlist)==null?void 0:t.map(r=>new RegExp(r)),this.qi.url_ignorelist=(n=this.qi.url_ignorelist)==null?void 0:n.map(r=>new RegExp(r)),this.qi}us(){if(this.isBrowserSupported()){if(I&&j){var t=this.hs=r=>{r=r||(I==null?void 0:I.event);try{this.ds(r)}catch(i){nu.error("Failed to capture event",i)}};if(Re(j,"submit",t,{capture:!0}),Re(j,"change",t,{capture:!0}),Re(j,"click",t,{capture:!0}),this.ls().capture_copied_text){var n=this.vs=r=>{r=r||(I==null?void 0:I.event);try{this.ds(r,Af)}catch(i){nu.error("Failed to capture copy/cut event",i)}};Re(j,"copy",n,{capture:!0}),Re(j,"cut",n,{capture:!0})}}}else nu.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(j==null||j.removeEventListener("submit",this.hs,!0),j==null||j.removeEventListener("change",this.hs,!0),j==null||j.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(j==null||j.removeEventListener("copy",this.vs,!0),j==null||j.removeEventListener("cut",this.vs,!0),this.vs=void 0),this.Qn=!1}startIfEnabled(){!this.Xn&&this.ns&&this.isEnabled&&!this.Qn&&(this.us(),this.Qn=!0)}onRemoteConfig(t){if(!this.Xn)if(this.Kn=!0,t.ok){var n=t.config;n.elementsChainAsString&&(this.Yn=n.elementsChainAsString);var r,i=n.autocapture_opt_out;$t(i)&&((r=this.ns)==null||r.kv.set(lp,i),this.Jn=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.es=t}getElementSelectors(t){var n,r=[];return(n=this.es)==null||n.forEach(i=>{var s=j==null?void 0:j.querySelectorAll(i);s==null||s.forEach(o=>{t===o&&r.push(i)})}),r}get isEnabled(){var t,n;if(this.Xn)return!1;var r=(t=this.ns)==null?void 0:t.kv.get(lp),i=this.Jn,s=this.ls(),o=s.remoteRequestsDisabled&&!this.Kn;if(rt(i)&&!$t(r)&&!o)return!1;var a=(n=this.Jn)!==null&&n!==void 0?n:!!r;return!!s.enabled&&!a}ds(t,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r=Sp(t);wE(r)&&(r=r.parentNode||null);var i,s=this.rs();n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&s.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&kE(r,s.rageclick)&&this.ds(t,"$rageclick");var o=n===Af;if(r&&function(_,p,y,h,v,x){var b;if(!I||Pg(_)||y!=null&&y.url_allowlist&&!n_(y.url_allowlist,x)||y!=null&&y.url_ignorelist&&n_(y.url_ignorelist,x))return!1;if(y!=null&&y.dom_event_allowlist){var E=y.dom_event_allowlist;if(E&&!E.some(N=>p.type===N))return!1}var S=PE(_,h),P=S.parentIsUsefulElement,C=S.targetElementList;if(!function(N,M){var z=M==null?void 0:M.element_allowlist;if(L(z))return!0;var F,W=function(Q){if(z.some(O=>Q.tagName.toLowerCase()===O))return{v:!0}};for(var B of N)if(F=W(B))return F.v;return!1}(C,y)||!Cp(C,y==null?void 0:y.css_selector_allowlist)||Cp(C,(b=y==null?void 0:y.css_selector_ignorelist)!==null&&b!==void 0?b:DI))return!1;try{var T=I.getComputedStyle(_);if(T&&T.getPropertyValue("cursor")==="pointer"&&p.type==="click")return!0}catch{}var R=_.tagName.toLowerCase();switch(R){case"html":return!1;case"form":return(v||["submit"]).indexOf(p.type)>=0;case"input":case"select":case"textarea":return(v||["change","click"]).indexOf(p.type)>=0;default:return P?(v||["click"]).indexOf(p.type)>=0:(v||["click"]).indexOf(p.type)>=0&&(kg.indexOf(R)>-1||_.getAttribute("contenteditable")==="true")}}(r,t,s,o,o?["copy","cut"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var a,l=MO(r,{e:t,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this.Yn,disableCaptureUrlHashes:s.disableCaptureUrlHashes}),u=l.props;if(l.explicitNoCapture)return!1;var c=this.getElementSelectors(r);if(c&&c.length>0&&(u.$element_selectors=c),n===Af){var d,f=EE(I==null||(d=I.getSelection())==null?void 0:d.toString()),m=t.type||"clipboard";if(!f)return!1;u.$selected_content=f,u.$copy_type=m}return(a=this.ns)==null||a.capture(n,u).catch(_=>nu.error("Failed to capture event",_)),!0}}}isBrowserSupported(){return vt(j==null?void 0:j.querySelectorAll)}}class NO{constructor(t){this._instance=t}refresh(t){var n=this._instance.config,r=Se(n.autocapture)?n.autocapture:void 0;t.enabled=!!n.autocapture,t.rageclick=n.rageclick,t.maskAllElementAttributes=n.mask_all_element_attributes,t.maskAllText=n.mask_all_text,t.disableCaptureUrlHashes=n.disable_capture_url_hashes,t.getCurrentUrl=n.get_current_url,t.remoteRequestsDisabled=this._instance.ma(),t.url_allowlist=r==null?void 0:r.url_allowlist,t.url_ignorelist=r==null?void 0:r.url_ignorelist,t.dom_event_allowlist=r==null?void 0:r.dom_event_allowlist,t.element_allowlist=r==null?void 0:r.element_allowlist,t.css_selector_allowlist=r==null?void 0:r.css_selector_allowlist,t.css_selector_ignorelist=r==null?void 0:r.css_selector_ignorelist,t.element_attribute_ignorelist=r==null?void 0:r.element_attribute_ignorelist,t.capture_copied_text=r==null?void 0:r.capture_copied_text}}var ta=Ie("[ExceptionAutocapture]"),I_=()=>{},$O=Ie("[TracingHeaders]"),yi=Ie("[Web Vitals]"),O_=9e5,M_="disabled",A_="lazy_loading",na="awaiting_config",ru="missing_config";Ie("[SessionRecording]"),Ie("[SessionRecording]");var Np="[SessionRecording]",Yn=Ie(Np),FO=Ie("[Heatmaps]");function $f(e){return Se(e)&&"clientX"in e&&"clientY"in e&&Ge(e.clientX)&&Ge(e.clientY)}var iu=Ie("[Product Tours]"),Ff=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(xg))},LO=["$set_once","$set"],On=Ie("[SiteApps]"),N_="Error while initializing PostHog app with config id ",uS=(e,t)=>e!=null&&e.then?e.then(t):t(e),vs="SDK is not enabled or survey functionality is not yet loaded",$_="Disabled. Not loading surveys.";class jO{constructor(t,n){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Tl=!1,this.Ml=[],this.El=null,this.Il=null,this.Xn=!1,this.Rl=new Set,this.onRemoteConfig=r=>{if(!this.Xn&&!this.qi.disableSurveys){if(!r.ok)return he.warn("Remote config unavailable. Not loading surveys.");var i=r.config.surveys;if(ne(i))return he.warn("Flags not loaded yet. Not loading surveys.");this.Pl=$t(i)?i:i.length>0,he.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=t,this.Al=n}setup(t){if(!this.Xn)return this.Fl=t,uS(t.kv.initialize(),()=>{if(this.Fl===t&&!this.Xn){this.Fl=void 0,this.ns=t;var n=t.onRemoteConfig(this.onRemoteConfig);this.Xn?n.dispose():(this.ss=n,this.loadIfEnabled())}})}dispose(){var t,n,r;this.Xn||(this.Xn=!0,this.Fl=void 0,this.ns=void 0,(t=this.ss)==null||t.dispose(),this.ss=void 0,(n=this._surveyEventReceiver)==null||n.dispose(),this._surveyEventReceiver=null,(r=this._surveyManager)==null||r.dispose==null||r.dispose(),this._surveyManager=null,this.Ml=[],this.El=null,this.Rl.forEach(i=>clearTimeout(i)),this.Rl.clear())}get qi(){return this.ts.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;(t=this._surveyEventReceiver)==null||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var n=[],r=0;rlocalStorage.removeItem(s))}catch{}}loadIfEnabled(){if(!this.Xn&&this.ns){var t=this.qi;if(!this._surveyManager)if(this.Tl)he.info("Already initializing surveys, skipping...");else if(t.disableSurveys)he.info($_);else if(t.cookielessMode&&this.ts.isOptedOut())he.info("Not loading surveys in cookieless mode without consent.");else{var n=this.ts.getExtensions();if(n){if(!L(this.Pl)||t.advancedEnableSurveys){var r=this.Pl||t.advancedEnableSurveys;this.Tl=!0;try{var i=n.generateSurveys;if(i)return this.Ol(i,r),void(this.Tl=!1);var s=n.loadExternalDependency;if(!s)return this.Ll(Eg),void(this.Tl=!1);s(o=>{try{if(this.Xn)return;var a=this.ts.getExtensions();o||a==null||!a.generateSurveys?this.Ll("Could not load surveys script",o):this.Ol(a.generateSurveys,r)}finally{this.Tl=!1}})}catch(o){throw this.Tl=!1,this.Ll("Error initializing surveys",o),o}}}else he.error("PostHog Extensions not found.")}}}Ol(t,n){this.Xn||(this._surveyManager=t(n),this._surveyEventReceiver=this.ts.createEventReceiver(),he.info("Surveys loaded successfully"),this.$l({isLoaded:!0}))}Ll(t,n){he.error(t,n),this.$l({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ml.push(t),this._surveyManager&&this.$l({isLoaded:!0}),()=>{this.Ml=this.Ml.filter(n=>n!==t)}}getSurveys(t,n){var r;n===void 0&&(n=!1);var i=(r=this.ns)!==null&&r!==void 0?r:this.Al;if(i&&!this.Xn){if(this.qi.disableSurveys)return he.info($_),t([]);var s=i.kv.get(vp);if(s&&!n)return t(s,{isLoaded:!0}),void(this.Dl()&&this.getSurveys(()=>{},!0));if(this.El)this.El.then(l=>{this.Xn||t(l.surveys,l.context)}).catch(l=>he.error("Error in survey callback",l));else{var o=this.Nl("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.qi.requestTimeoutMs}).then(l=>{try{return this.ql(i,l)}catch(u){return he.error("Error processing surveys response",u),this.ql(i,{statusCode:0,error:u})}},l=>this.ql(i,{statusCode:0,error:l}));this.El=o;var a=()=>{this.El===o&&(this.El=null)};o.then(l=>{a(),this.Xn||t(l.surveys,l.context)},a).catch(l=>he.error("Error in survey callback",l))}}}Nl(t,n){var r=this.ns;return r?r.sendRequest(t,n):new Promise(i=>i({statusCode:0,error:new Error(vs)}))}ql(t,n){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:vs}};var r=n.statusCode;if(r!==200||!n.json){var i="Surveys API could not be loaded, status: "+r;return r!==0?he.error(i):n.error||he.warn(i),this.Il=Date.now(),{surveys:[],context:{isLoaded:!1,error:i}}}this.Il=null;var s,o=n.json.surveys||[],a=o.filter(l=>function(u){return!(!u.start_date||u.end_date)}(l)&&(rS(l)||function(u){var c;return!((c=u.conditions)==null||(c=c.actions)==null||(c=c.values)==null||!c.length)}(l)));return a.length>0&&((s=this._surveyEventReceiver)==null||s.register(a)),t.kv.set({[vp]:o,[bc]:Date.now()}),{surveys:o,context:{isLoaded:!0}}}Dl(){return this.jl()&&!this.El&&!this.Bl()}jl(){var t,n,r=(t=(n=this.ns)!==null&&n!==void 0?n:this.Al)==null?void 0:t.kv.get(bc);return Ge(r)&&Date.now()-r>3e5}Bl(){return Ge(this.Il)&&3e5>Date.now()-this.Il}markSurveyAsSeen(t,n){var r,i={id:t,current_iteration:(r=n==null?void 0:n.iteration)!==null&&r!==void 0?r:null};sS(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}$l(t){for(var n of this.Ml)try{if(!t.isLoaded)return n([],t);this.getSurveys(n)}catch(r){he.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,n){if(n===void 0&&(n=!1),!ne(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,n);he.warn("init was not called")}Hl(t){var n=null;return this.getSurveys(r=>{var i;n=(i=r.find(s=>s.id===t))!==null&&i!==void 0?i:null}),n}Ul(t){if(ne(this._surveyManager))return{eligible:!1,reason:vs};var n=typeof t=="string"?this.Hl(t):t;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}zl(t){if(ne(this._surveyManager))return{eligible:!1,reason:vs};var n=typeof t=="string"?this.Hl(t):t;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(ne(this._surveyManager))return he.warn("init was not called"),{visible:!1,disabledReason:vs};var n=this.zl(t);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(t,n){return ne(this._surveyManager)?(he.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:vs})):new Promise(r=>{this.getSurveys(i=>{var s,o=(s=i.find(l=>l.id===t))!==null&&s!==void 0?s:null;if(o){var a=this.zl(o);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(t,n,r){var i;if(ne(this._surveyManager))he.warn("init was not called");else{var s=typeof t=="string"?this.Hl(t):t;if(s!=null&&s.id)if(wO.includes(s.type)){var o=j==null?void 0:j.querySelector(n);if(o)if((i=s.appearance)!=null&&i.surveyPopupDelaySeconds){he.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout(()=>{var l,u;this.Rl.delete(a),this.Xn||(he.info("Rendering survey "+s.id+" with delay of "+((l=s.appearance)==null?void 0:l.surveyPopupDelaySeconds)+" seconds"),(u=this._surveyManager)==null||u.renderSurvey(s,o,r),he.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.Rl.add(a)}else this._surveyManager.renderSurvey(s,o,r);else he.warn("Survey element not found")}else he.warn("Surveys of type "+s.type+" cannot be rendered in the app");else he.warn("Survey not found")}}displaySurvey(t,n){var r;if(ne(this._surveyManager))he.warn("init was not called");else{var i=this.Hl(t);if(i){var s=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(s=$({},i,{appearance:$({},i.appearance,{surveyPopupDelaySeconds:0})})),n.displayType!==Pp.Popover&&n.initialResponses&&he.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){var o=this.Ul(i);if(!o.eligible)return void he.warn("Survey is not eligible to be displayed: ",o.reason)}n.displayType!==Pp.Inline?this._surveyManager.handlePopoverSurvey(s,n):this.renderSurvey(s,n.selector,n.properties)}else he.warn("Survey not found")}}cancelPendingSurvey(t){ne(this._surveyManager)?he.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload==null||t.handlePageUnload()}}function gs(e,t,n){if(ne(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class DO{constructor(t){this.Wl=new Set,this.Vl=new Set,this.Gl=new Ac,this.Zl=(n,r)=>this.Ql(n,r)&&this.Jl(n,r)&&this.Kl(n,r)&&this.Yl(n,r),this.Ql=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=t}init(){var t,n;L((t=this._instance)==null?void 0:t._addCaptureHook)||(this.Xl=(n=this._instance)==null?void 0:n._addCaptureHook((r,i)=>{this.on(r,i)}))}dispose(){var t;(t=this.Xl)==null||t.call(this),this.Xl=void 0,this.Gl=new Ac}register(t){var n,r;if(!L((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach(s=>{var o;this.Wl.add(s),(o=s.steps)==null||o.forEach(a=>{this.Vl.add((a==null?void 0:a.event)||"")})}),(r=this._instance)!=null&&r.autocapture)){var i=new Set;this.Wl.forEach(s=>{var o;(o=s.steps)==null||o.forEach(a=>{a!=null&&a.selector&&i.add(a.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(t){this.Wl.clear(),this.Vl.clear(),this.register(t)}on(t,n){n!=null&&t.length!=0&&(this.Vl.has(t)||this.Vl.has(n.event))&&this.Wl.forEach(r=>{this.tu(n,r)&&this.Gl.emit("actionCaptured",r.name)})}eu(t){this.onAction("actionCaptured",n=>t(n))}tu(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Zl(t,r))return!0;return!1}onAction(t,n){return this.Gl.on(t,n)}Jl(t,n){if(n!=null&&n.url){var r,i=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!gs(i,n.url,n.url_matching||"contains"))return!1}return!0}Kl(t,n){return!!this.iu(t,n)&&!!this.ru(t,n)&&!!this.nu(t,n)}iu(t,n){var r;if(n==null||!n.href)return!0;var i=this.su(t);if(i.length>0)return i.some(a=>gs(a.href,n.href,n.href_matching||"exact"));var s,o=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!o&&gs((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",n.href,n.href_matching||"exact")}ru(t,n){var r;if(n==null||!n.text)return!0;var i=this.su(t);if(i.length>0)return i.some(u=>gs(u.text,n.text,n.text_matching||"exact")||gs(u.$el_text,n.text,n.text_matching||"exact"));var s,o,a,l=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(s=function(u){for(var c,d=[],f=/(?::|")text="(.*?)"/g;!ne(c=f.exec(u));)d.includes(c[1])||d.push(c[1]);return d}(l),o=n.text,a=n.text_matching||"exact",s.some(u=>gs(u,o,a)))}nu(t,n){var r,i;if(n==null||!n.selector)return!0;var s=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(s!=null&&s.includes(n.selector))return!0;var o=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";if(n.selector_regex&&o)try{return new RegExp(n.selector_regex).test(o)}catch{return!1}return!1}su(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}Yl(t,n){return n==null||!n.properties||n.properties.length===0||nS(n.properties.reduce((r,i)=>{var s=Z(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return r[i.key]={values:s,operator:i.operator||"exact"},r},{}),t==null?void 0:t.properties)}}class zO{constructor(t){var n;this.au=[],this._instance=t,this.ou=new Map,this.lu=new Map,this.uu=new Map,this.hu=(n=this._instance)==null||n.onSessionId==null?void 0:n.onSessionId(r=>this.du(r))}vu(t){return!1}cu(){return null}fu(t){}pu(){}gu(t,n){return!!t&&nS(t.propertyFilters,n==null?void 0:n.properties)}mu(t,n){var r=new Map;return t.forEach(i=>{var s;(s=i.conditions)==null||(s=s[n])==null||(s=s.values)==null||s.forEach(o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(i.id),r.set(o.name,a)}})}),r}yu(t,n,r){var i=(r===Xo.Activation?this.ou:this.lu).get(t),s=[];return this.bu(o=>{s=o.filter(a=>i==null?void 0:i.includes(a.id))}),s.filter(o=>{var a,l=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find(u=>u.name===t);return this.gu(l,n)})}register(t){this._u(t,!1)}replace(t){this._u(t,!0)}_u(t,n){var r;L((r=this._instance)==null?void 0:r._addCaptureHook)||(this.wu(t,n),this.ku(t,n))}ku(t,n){var r=t.filter(o=>{var a;return(a=o.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length});if(n&&this.uu.clear(),r.length!==0){this.Su||(this.Su=new DO(this._instance),this.Su.init(),this.Su.eu(o=>this.onAction(o)));var i=[];r.forEach(o=>{var a;(a=o.conditions)==null||(a=a.actions)==null||a.values.forEach(l=>{if(i.push(l),l.name){var u,c=(u=this.uu.get(l.name))!==null&&u!==void 0?u:[];c.includes(o.id)||c.push(o.id),this.uu.set(l.name,c)}})}),n?this.Su.replace(i):this.Su.register(i)}else{var s;n&&((s=this.Su)==null||s.replace([]))}}xu(t,n){n.forEach((r,i)=>{var s,o=(s=t.get(i))!==null&&s!==void 0?s:[];r.forEach(a=>{o.includes(a)||o.push(a)}),t.set(i,o)})}wu(t,n){var r,i,s=t.filter(u=>{var c,d;return((c=u.conditions)==null?void 0:c.events)&&((d=u.conditions)==null||(d=d.events)==null||(d=d.values)==null?void 0:d.length)>0}),o=t.filter(u=>{var c,d;return((c=u.conditions)==null?void 0:c.cancelEvents)&&((d=u.conditions)==null||(d=d.cancelEvents)==null||(d=d.values)==null?void 0:d.length)>0}),a=this.mu(t,Xo.Activation),l=this.mu(t,Xo.Cancellation);n?(this.ou=a,this.lu=l):(this.xu(this.ou,a),this.xu(this.lu,l)),(s.length!==0||o.length!==0)&&((r=this.Xl)!==null&&r!==void 0||(this.Xl=(i=this._instance)==null?void 0:i._addCaptureHook((u,c)=>{this.onEvent(u,c)})))}onEvent(t,n){var r,i,s=this.Cu(),o=(n==null||(r=n.properties)==null?void 0:r.$survey_id)||(n==null||(i=n.properties)==null?void 0:i.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var a=this.Tu(t,o);if(a==="consume")return s.info("event consumed activated item, removing it",{event:t,itemId:o}),void this.Mu([o]);if(a==="persist")return s.info("shown item promoted to persisted activation",{event:t,itemId:o}),this.Eu(o),void this.Iu([o])}if(this.lu.has(t)){var l=this.yu(t,n,Xo.Cancellation);l.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:l.map(c=>c.id)}),this.Mu(l.map(c=>c.id)),l.forEach(c=>this.Ru(c.id)))}if(this.ou.has(t)){s.info("event name matched",{event:t,eventPayload:n,items:this.ou.get(t)});var u=this.yu(t,n,Xo.Activation);this.Pu(u.map(c=>c.id))}}onAction(t){this.uu.has(t)&&this.Pu(this.uu.get(t)||[])}Pu(t){var n;if(t.length!==0){var r=!((n=this._instance)==null||n.get_session_id==null||!n.get_session_id()),i=[];for(var s of t)r&&this.vu(s)?this.Eu(s)&&this.Au(s):i.push(s);i.length>0&&(this.au=[...new Set([...this.au,...i])]),this.Cu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Eu(t){this.au=this.au.filter(r=>r!==t);var n=this.Fu();return!n.includes(t)&&(this.Ou([...n,t]),this.Lu(),!0)}Mu(t){var n=new Set(t);this.au=this.au.filter(s=>!n.has(s));var r=this.$u(),i=r.filter(s=>!n.has(s));i.length!==r.length&&(this.Ou(i),i.length===0&&this.Du()),this.Iu(t)}Nu(){var t,n=this.cu();if(!n)return{};var r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n];return r&&typeof r=="object"?r:{}}Au(t){if(this.cu()){var n=this.Nu();this.fu($({},n,{[t]:Date.now()}))}}Iu(t){if(this.cu()){var n=this.Nu(),r={},i=!1;for(var s of Object.entries(n)){var o=s[0],a=s[1];t.includes(o)?i=!0:r[o]=a}i&&(En(r)?this.pu():this.fu(r))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(t){if(this.Fu().includes(t)){var n=this.Nu()[t];return Ge(n)?n:void 0}}$u(){var t,n=this.ju();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}Fu(){var t,n,r=this.$u();if(r.length===0)return[];var i=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Bu()],s=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return s&&i===s?r:[]}Lu(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.Hu(n)}Du(){this.Uu()}du(t){var n,r=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this.Bu()];if(r&&r!==t){var i=this.$u(),s=this.Nu();i.length>0&&(this.Ou([]),i.filter(o=>Ge(s[o])).forEach(o=>this.Ru(o))),this.Du(),this.qu()}}getActivatedIds(){return[...new Set([...this.Fu(),...this.au])].filter(t=>!this.zu(t))}dispose(){var t,n,r;(t=this.hu)==null||t.call(this),this.hu=void 0,(n=this.Xl)==null||n.call(this),this.Xl=void 0,(r=this.Su)==null||r.dispose(),this.Su=void 0}reset(){this.au=[],this.$u().length>0&&this.Ou([]),this.Du(),this.qu()}getEventToItemsMap(){return this.ou}Wu(){return this.Su}}class UO extends zO{constructor(t){super(t)}ju(){return gp}Bu(){return Ru}cu(){return Tu}fu(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Tu]:t})}pu(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Tu)}vu(t){var n,r;this.bu(s=>{r=s.find(o=>o.id===t)});var i=(n=r)==null||(n=n.appearance)==null?void 0:n.surveyPopupDelaySeconds;return Ge(i)&&i>0}Vu(){return ur.SHOWN}bu(t){var n;(n=this._instance)==null||n.getSurveys(t)}Ru(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}Cu(){return he}Ou(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[gp]:t})}Hu(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Ru]:t})}Uu(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(Ru)}zu(){return!1}Tu(t,n){var r;this.bu(s=>{r=s.find(o=>o.id===n)});var i=!r||function(s){var o;return rS(s)&&!((o=s.conditions)==null||(o=o.events)==null||!o.repeatedActivation)||s.schedule==="always"}(r);return i?t===ur.SHOWN?"consume":"ignore":t===ur.SHOWN?"persist":t===ur.DISMISSED||t===ur.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class VO{constructor(t){this._instance=t}initialize(){}get(t){if(typeof t=="string")return this._instance.get_property(t);var n={};for(var r of t){var i=this._instance.get_property(r);L(i)||(n[r]=i)}return n}set(t,n){this._instance.register(typeof t=="string"?{[t]:n}:t)}remove(t){typeof t!="string"?t.forEach(n=>this._instance.unregister(n)):this._instance.unregister(t)}}class BO{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=Y==null?void 0:Y.__PosthogExtensions__;if(t){var n=t.generateSurveys,r=t.loadExternalDependency;return{generateSurveys:n?i=>n(this._instance,i):void 0,loadExternalDependency:r?i=>r(this._instance,"surveys",i):void 0}}}createEventReceiver(){return new UO(this._instance)}}var qO=I!=null&&I.location?Ic(I.location.hash,"__posthog")||Ic(location.hash,"state"):null,F_="_postHogToolbarParams",L_=Ie("[Toolbar]"),j_=Ie("[FeatureFlags]");class WO{constructor(t,n){n===void 0&&(n=!1),this.Gu=!1,this.update(t,n)}update(t,n){this.Zu=((r,i)=>{var s,o,a,l;return{bootstrap:{featureFlags:(s=r.bootstrap)==null?void 0:s.featureFlags,featureFlagPayloads:(o=r.bootstrap)==null?void 0:o.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!r.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!r.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!r.advanced_feature_flags_dedup_per_session,cacheTtlMs:r.feature_flag_cache_ttl_ms,requestTimeoutMs:r.feature_flag_request_timeout_ms,compression:r.disable_compression?"none":"base64",evaluationContexts:(a=(l=r.evaluation_contexts)!==null&&l!==void 0?l:r.evaluation_environments)!==null&&a!==void 0?a:[],flagKeys:Z(r.flag_keys)?r.flag_keys:void 0}})(t,n),!t.evaluation_environments||t.evaluation_contexts||this.Gu||(j_.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),L(t.flag_keys)||Z(t.flag_keys)||j_.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var D_=Ie("[FeatureFlags]"),_i=Ie("[FeatureFlags]",{debugEnabled:!0}),Lf=`" failed. Feature flags didn't load in time.`,z_="connection_error",U_=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},V_=e=>{var t={};for(var n of Iu(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},gn=Ie("[Error tracking]"),HO=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],GO=["__firefox__","__gCrWeb"],B_="Refusing to render web experiment since the viewer is a likely bot",KO={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Nc(t,e),not_regex:(e,t)=>!Nc(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class ht{get qi(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{ht.Qu("retrieved web experiments from the server"),n.Ju=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n.Ju&&(ht.Qu("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=n.Ju)==null||o.set(s.feature_flag_key,s));var a=n._instance.getFeatureFlag(s.feature_flag_key);ce(a)&&s.variants[a]&&n.Ku(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var u=s.variants[l];ht.Yu(u,n._instance)&&n.Ku(s.name,l,u.transforms)}})},r)},this._instance=t,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(t){if(this._is_bot())ht.Qu(B_);else if(!this.qi.disable_web_experiments){if(ne(this.Ju))return this.Ju=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ht.Qu("applying feature flags",t),t.forEach(n=>{var r;if(this.Ju&&(r=this.Ju)!=null&&r.has(n)){var i,s=this._instance.getFeatureFlag(n),o=(i=this.Ju)==null?void 0:i.get(n);s&&o!=null&&o.variants[s]&&this.Ku(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var t=ht.getWindowLocation();if(t!=null&&t.search){var n=So(t==null?void 0:t.search,"__experiment_id"),r=So(t==null?void 0:t.search,"__experiment_variant");n&&r&&(ht.Qu("previewing web experiments "+n+" && "+r),this.getWebExperiments(i=>{this.Xu(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this.qi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.qi.disable_web_experiments&&!r)return t([]);var i=this._instance.get_property("$web_experiments");if(i&&!n)return t(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qi.token),method:"GET",timestampMode:"query",callback:s=>t(s.statusCode===200&&s.json&&s.json.experiments||[])})}Xu(t,n,r){var i=r.filter(s=>s.id===t);i&&i.length>0&&(ht.Qu("Previewing web experiment ["+i[0].name+"] with variant ["+n+"]"),this.Ku(i[0].name,n,i[0].variants[n].transforms))}static Yu(t,n){return!ne(t.conditions)&&ht.th(t,n)&&ht.eh(t)}static th(t,n){var r;if(ne(t.conditions)||ne((r=t.conditions)==null?void 0:r.url))return!0;var i=ht.getWindowLocation();if(i){var s,o,a,l=yE(n,i.href);return(s=t.conditions)==null||!s.url||KO[(o=(a=t.conditions)==null?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,l)}return!1}static getWindowLocation(){return I==null?void 0:I.location}static eh(t){var n;if(ne(t.conditions)||ne((n=t.conditions)==null?void 0:n.utm))return!0;var r=NE();if(r.utm_source){var i,s,o,a,l,u,c,d,f=(i=t.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=t.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,m=(o=t.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=t.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,_=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=t.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,p=(c=t.conditions)==null||(c=c.utm)==null||!c.utm_term||((d=t.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==r.utm_term;return f&&_&&p&&m}return!1}static Qu(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;n>i;i++)r[i-1]=arguments[i];D.info("[WebExperiments] "+t,r)}Ku(t,n,r){this._is_bot()?ht.Qu(B_):n!=="control"?r.forEach(i=>{if(i.selector){var s;ht.Qu("applying transform of variant "+n+" for experiment "+t+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o==null||o.forEach(a=>{var l=a;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)})}}):ht.Qu("Control variants leave the page unmodified.")}_is_bot(){return St&&this._instance?ZE(St,this.qi.custom_blocked_useragents):void 0}}var tn=Ie("[Conversations]"),wi="Conversations not available yet.",q_="console",cS="__posthogHandledLogsRequestError",jf=(e,t)=>{var n=e instanceof Error?e:new Error(t);return n[cS]=!0,n},W_=e=>!!e&&typeof e=="object"&&e[cS]===!0,hd={featureFlags:class{constructor(e){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=D_,this.rh={},this.nh={},this.sh=[],this.ah=!1,this.oh=!1,this.lh=0,this.uh=!1,this.hh=!1,this.dh=!1,this.fh=!1,this.ph=0,this.Tt=()=>{var t=this.gh();this.ph=0,t&&this.reloadFeatureFlags()},"get"in e?this.ts=e:(this.mh=new WO(e.config,e.ma()),this.ts=this.mh)}updateConfig(e,t){var n;(n=this.mh)==null||n.update(e,t)}setup(e){return this.Fl=e,this.I=e.logger.createLogger("[FeatureFlags]"),uS(e.kv.initialize(),()=>{this.Fl===e&&(this.Fl=void 0,this.ns=e,this.yh(e))})}yh(e){if(this.ns===e)return I&&Re(I,"online",this.Tt),this.bh=e.registerDynamicEventProperties(()=>this._h()?this.rh:this.nh),this.wh(),this.initialize()}destroy(){I==null||I.removeEventListener("online",this.Tt)}dispose(){var e;this.lh++,this.hh=!1,this.Fl=void 0,this.ns&&(this.kh(),(e=this.bh)==null||e.dispose(),this.bh=void 0,this.sh=[],I==null||I.removeEventListener("online",this.Tt),this.ns=void 0)}get qi(){return this.ts.get()}Sh(e){var t;return(t=this.ns)==null?void 0:t.kv.get(e)}Nr(e){this.xh(()=>{var t;return(t=this.ns)==null?void 0:t.kv.set(e)})}qr(e){this.xh(()=>{var t;return(t=this.ns)==null?void 0:t.kv.remove(e)})}xh(e){try{e()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}wh(){var e={};for(var t of[Mi,Ai,Gs,Mn]){var n=this.Sh(t);L(n)||(e[t]=n)}this.rh=e;var r=$({},e),i=this.Sh(ir);if(i)for(var s of Object.entries(i))r["$feature/"+s[0]]=s[1];this.nh=r}_h(){var e=this.qi.cacheTtlMs;if(!e||0>=e)return!1;var t=this.Sh(Gi);return typeof t!="number"||Date.now()-t>e}Ch(){return!!this._h()&&(this.fh||this.oh||(this.fh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Th(){var e=this.qi.evaluationContexts;return e!=null&&e.length?e.filter(t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.I.error("Invalid evaluation context found:",t,"Expected non-empty string"),n}):[]}Mh(){var e=this.qi.flagKeys;if(!L(e))return e.filter(t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||this.I.error("Invalid flag key found:",t,"Expected non-empty string"),n})}initialize(){var e,t,n=this.qi,r=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var i,s,o=(i=(s=n.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(r).filter(u=>!!r[u]).reduce((u,c)=>(u[c]=r[c]||!1,u),{}),l=Object.keys(o).filter(u=>a[u]).reduce((u,c)=>(u[c]=o[c],u),{});return this.Eh({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,n){var r,i,s=n!=null&&n.merge&&(r=this.Sh(ir))!==null&&r!==void 0?r:{},o=n!=null&&n.merge&&(i=this.Sh(Ai))!==null&&i!==void 0?i:{},a=$({},s,e),l=$({},o,t),u={};for(var c of Object.entries(a)){var d=c[0],f=c[1];u[d]={key:d,enabled:Ay(f),variant:Ny(f),reason:void 0,metadata:L(l==null?void 0:l[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}}}this.Eh({flags:u})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Sh(Xa),t=this.Sh(Mn),n=this.Sh(Ci);if(!n&&!t)return e||{};var r=_e({},e||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var s of i){var o,a,l=r[s],u=t==null?void 0:t[s],c=L(u)?(o=l==null?void 0:l.enabled)!==null&&o!==void 0&&o:!!u,d=L(u)?l==null?void 0:l.variant:typeof u=="string"?u:void 0,f=n==null?void 0:n[s],m=$({},l,{enabled:c,variant:c?d??(l==null?void 0:l.variant):void 0});c!==(l==null?void 0:l.enabled)&&(m.original_enabled=l==null?void 0:l.enabled),d!==(l==null?void 0:l.variant)&&(m.original_variant=l==null?void 0:l.variant),f&&(m.metadata=$({},l==null?void 0:l.metadata,{payload:f,original_payload:l==null||(a=l.metadata)==null?void 0:a.payload})),r[s]=m}return this.ih||(this.I.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ih=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(n=>{var r=e[n];return{key:n,enabled:Ay(r),variant:Ny(r),payload:My(t[n])}})}getFlagVariants(){var e=this.Sh(ir),t=this.Sh(Mn);if(!t)return e||{};for(var n=_e({},e||{}),r=Object.keys(t),i=0;r.length>i;i++)n[r[i]]=t[r[i]];return this.ih||(this.I.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ih=!0),n}getFlagPayloads(){var e=this.Sh(Ai),t=this.Sh(Ci);if(!t)return e||{};for(var n=_e({},e||{}),r=Object.keys(t),i=0;r.length>i;i++)n[r[i]]=t[r[i]];return this.ih||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ih=!0),n}reloadFeatureFlags(){this.uh||this.qi.featureFlagsDisabled||this.gh()||this.Ih||(this.sh.slice().forEach(e=>{try{e()}catch(t){this.I.error("Error while running feature flags reloading callback",t)}}),this.Ih=setTimeout(()=>{this.Rh()},5))}kh(){clearTimeout(this.Ih),this.Ih=void 0}onReloading(e){return this.sh.push(e),()=>{this.sh=this.sh.filter(t=>t!==e)}}ensureFlagsLoaded(){this.ah||this.oh||this.Ih||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.uh=e}resetFlagCallReported(){this.qr(ar)}Rh(e){this.kh();var t=this.ns;if(t&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!0;else{var n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:$({},t.initialPersonProperties,this.Sh(yn)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Sh(Dn),timezone:zE()};L(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.qi.featureFlagsDisabled)&&(n.disable_flags=!0);var r=this.Th();r.length&&(n.evaluation_contexts=r);var i=this.Mh();L(i)||(n.flag_keys=i);var s=this.qi.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(s?"&only_evaluate_survey_feature_flags=true":""),a=this.lh;this.oh=!0;var l=()=>{this.hh&&(this.hh=!1,this.Rh())},u=c=>{this.oh=!1,a===this.lh&&(this.Nr({[Ks]:[z_]}),this.I.error("Feature flag request failed",c)),l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:n,compression:this.qi.compression==="base64"?Et.Base64:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then(c=>{var d,f,m=(d=c.json)!==null&&d!==void 0?d:{},_=c.statusCode!==200;if(this.oh=!1,a===this.lh){if(this.Ph(c.statusCode),_||this.hh||(this.$anon_distinct_id=void 0),!n.disable_flags||this.hh){this.dh=!_;var p=[];c.error?p.push(c.error instanceof Error&&c.error.name==="AbortError"?"timeout":c.error instanceof Error?z_:"unknown_error"):c.statusCode!==200&&p.push("api_error_"+c.statusCode),m.errorsWhileComputingFlags&&p.push("errors_while_computing_flags");var y=!((f=m.quotaLimited)==null||!f.includes("feature_flags"));y&&p.push("quota_limited"),this.Nr({[Ks]:p}),y?this.I.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.Eh(m,_,{partialResponse:s}),l()}}else l()}).catch(u)}catch(c){u(c)}}}gh(){return ME(this.ph,3)}Ph(e){this.ph=AE(e,this.ph,3,()=>this.I.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var r=this.getFeatureFlagResult(e,t);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else this.I.warn('getFeatureFlag for key "'+e+Lf)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var n,r=this.getFlagVariants(),i=e in r,s=r[e],o=this.getFlagPayloads()[e],a=String(s),l=this.Sh(Gs)||void 0,u=this.Sh(Gi)||void 0,c=this.Sh(ar)||{};if(this.qi.deduplicateCallsPerSession){var d,f=(d=this.ns)==null?void 0:d.session.sessionId,m=this.Sh(fa);f&&f!==m&&(c={},n=f)}if(t.send_event||!("send_event"in t))if(e in c&&c[e].includes(a))n&&this.Nr({[ar]:c,[fa]:n});else{var _,p,y,h,v,x,b,E,S,P,C,T;Z(c[e])?c[e].push(a):c[e]=[a],this.Nr($({[ar]:c},n?{[fa]:n}:{}));var R=this.getFeatureFlagDetails(e),N=[...(_=this.Sh(Ks))!==null&&_!==void 0?_:[]];L(s)&&N.push("flag_missing");var M={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:o??null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:(p=(y=this.qi.bootstrap)==null||(y=y.featureFlags)==null?void 0:y[e])!==null&&p!==void 0?p:null,$feature_flag_bootstrapped_payload:(h=(v=this.qi.bootstrap)==null||(v=v.featureFlagPayloads)==null?void 0:v[e])!==null&&h!==void 0?h:null,$used_bootstrap_value:!this.dh};L(R==null||(x=R.metadata)==null?void 0:x.has_experiment)||(M.$feature_flag_has_experiment=R.metadata.has_experiment),L(R==null||(b=R.metadata)==null?void 0:b.version)||(M.$feature_flag_version=R.metadata.version);var z,F=(E=R==null||(S=R.reason)==null?void 0:S.description)!==null&&E!==void 0?E:R==null||(P=R.reason)==null?void 0:P.code;F&&(M.$feature_flag_reason=F),R!=null&&(C=R.metadata)!=null&&C.id&&(M.$feature_flag_id=R.metadata.id),L(R==null?void 0:R.original_variant)&&L(R==null?void 0:R.original_enabled)||(M.$feature_flag_original_response=L(R.original_variant)?R.original_enabled:R.original_variant),R!=null&&(T=R.metadata)!=null&&T.original_payload&&(M.$feature_flag_original_payload=R==null||(z=R.metadata)==null?void 0:z.original_payload),N.length&&(M.$feature_flag_error=N.join(",")),this.Ah(M)}else n&&this.Nr({[ar]:c,[fa]:n});if(i)return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:My(o)}}}else this.I.warn('getFeatureFlagResult for key "'+e+Lf)}Ah(e){try{var t;(t=this.ns)==null||t.capture("$feature_flag_called",e).catch(n=>{this.I.error("Failed to capture feature flag call",n)})}catch(n){this.I.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(e,t){this.Fh(e,t)}Fh(e,t){var n=this;return Ce(function*(){var r=n.ns;if(r){var i={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},s=n.Th();s.length&&(i.evaluation_contexts=s);var o,a=n.Mh();L(a)||(i.flag_keys=a);try{var l,u=(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:i,compression:n.qi.compression==="base64"?Et.Base64:void 0,sentAt:"body",timeoutMs:n.qi.requestTimeoutMs})).json)==null?void 0:l.featureFlagPayloads;o=(u==null?void 0:u[e])||void 0}catch(c){return void n.I.error("Remote config feature flag request failed",c)}try{t(o)}catch(c){n.I.error("Remote config feature flag callback failed",c)}}})()}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.dh)return t.defaultValue;if(!(this.ah||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+e+Lf),t.defaultValue;var n=this.getFeatureFlag(e,t);return L(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,n){this.Eh(e,t,n)}Eh(e,t,n){if(this.ns){this.ah=!0;var r=function(i,s,o,a,l,u){s===void 0&&(s={}),o===void 0&&(o={}),a===void 0&&(a={}),u===void 0&&(u=D_);var c=((S,P)=>{var C=S.flags;return C?$({},S,{featureFlags:Object.fromEntries(Object.keys(C).map(T=>{var R;return[T,(R=C[T].variant)!==null&&R!==void 0?R:C[T].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(C).filter(T=>C[T].enabled).filter(T=>{var R;return(R=C[T].metadata)==null?void 0:R.payload}).map(T=>{var R;return[T,(R=C[T].metadata)==null?void 0:R.payload]}))}):(S.featureFlags&&P.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),S)})(i,u),d=c.flags,f=c.featureFlags,m=c.featureFlagPayloads;if(f){var _=i.requestId,p=i.evaluatedAt;if(Z(f)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var y={};if(f)for(var h=0;f.length>h;h++)y[f[h]]=!0;return{[Mi]:f,[ir]:y,[xc]:!1}}var v=f,x=m,b=d;if(l!=null&&l.partialResponse)v=$({},s,v),x=$({},o,x),b=$({},a,b);else if(i.errorsWhileComputingFlags)if(d){var E=new Set(Object.keys(d).filter(S=>{var P;return!((P=d[S])!=null&&P.failed)}));v=$({},s,Object.fromEntries(Object.entries(v).filter(S=>E.has(S[0])))),x=$({},o,Object.fromEntries(Object.entries(x||{}).filter(S=>E.has(S[0])))),b=$({},a,Object.fromEntries(Object.entries(b||{}).filter(S=>E.has(S[0]))))}else v=$({},s,v),x=$({},o,x),b=$({},a,b);return $({[Mi]:Object.keys(V_(v)),[ir]:v||{},[Ai]:x||{},[Xa]:b||{},[xc]:i.minimalFlagCalledEvents===!0},_?{[Gs]:_}:{},p?{[Gi]:p}:{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.I);r&&this.Nr(r),t||(this.fh=!1),this.Oh(t)}}override(e,t){t===void 0&&(t=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Lh(e)}Lh(e){if(this.ns){if(e===!1)return this.qr([Mn,Ci]),this.Oh(),void _i.info("All overrides cleared");if(Z(e))return this.Nr({[Mn]:U_(e)}),this.Oh(),void _i.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;this.ih=!!((t=n.suppressWarning)!==null&&t!==void 0&&t);var r={},i=n.flags,s=n.payloads;return i&&(r[Mn]=Z(i)?U_(i):i),s&&(r[Ci]=s),Object.keys(r).length&&this.Nr(r),i===!1&&s===!1?this.qr([Mn,Ci]):i===!1?this.qr(Mn):s===!1&&this.qr(Ci),this.Oh(),i===!1?_i.info("Flag overrides cleared"):i&&_i.info("Flag overrides set",{flags:i}),void(s===!1?_i.info("Payload overrides cleared"):s&&_i.info("Payload overrides set",{payloads:s}))}if(e&&typeof e=="object")return this.Nr({[Mn]:e}),this.Oh(),void _i.info("Flag overrides set",{flags:e});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ah){var t=this.$h(),n=t.flags,r=t.flagVariants;try{e(n,r)}catch(i){this.I.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r=(this.Sh(Pu)||[]).find(l=>l.flagKey===e),i={["$feature_enrollment/"+e]:t},s={$feature_flag:e,$feature_enrollment:t,$set:i};r&&(s.$early_access_feature_name=r.name),n&&(s.$feature_enrollment_stage=n);var o=$({},this.getFlagVariants(),{[e]:t});this.Nr({[Mi]:Object.keys(V_(o)),[ir]:o,[yn]:$({},this.Sh(yn)||{},i)}),this.Oh();try{var a;(a=this.ns)==null||a.capture("$feature_enrollment_update",s).catch(l=>{this.I.error("Failed to capture early access feature enrollment",l)})}catch(l){this.I.error("Failed to capture early access feature enrollment",l)}}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.Sh(Pu);!r||t?this.Dh(e,n):e(r)}Dh(e,t){var n=this;return Ce(function*(){var r=n.ns;if(r){var i,s=t?"&"+t.map(a=>"stage="+a).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+s,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;n.Nr({[Pu]:i=o.json.earlyAccessFeatures})}catch(a){return void n.I.error("Early access feature request failed",a)}try{e(i)}catch(a){n.I.error("Early access feature callback failed",a)}}})()}$h(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(n=>t[n]),flagVariants:Object.keys(t).filter(n=>t[n]).reduce((n,r)=>(n[r]=t[r],n),{})}}Oh(e){this.wh();var t=this.$h(),n=t.flags,r=t.flagVariants;this.featureFlagEventHandlers.forEach(i=>{try{i(n,r,{errorsLoading:e})}catch(s){this.I.error("Error while running feature flags callback",s)}})}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.Nh(e,t)}Nh(e,t){t===void 0&&(t=!0);var n=this.Sh(yn)||{},r=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),i=e==null?void 0:e.$set_once,s={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in n||(s[o]=i[o]));this.Nr({[yn]:$({},n,s,r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=$({},this.Sh(yn)||{});e.forEach(r=>{delete n[r]}),this.Nr({[yn]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this.qr(yn),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Sh(Dn)||{},r=$({},n);for(var i of Object.keys(e))r[i]=$({},n[i],e[i]);this.Nr({[Dn]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Sh(Dn)||{};this.Nr({[Dn]:$({},t,{[e]:{}})})}else this.qr(Dn)}reset(){this.lh++,this.hh=!1,this.rh={},this.nh={},this.ah=!1,this.uh=!1,this.dh=!1,this.$anon_distinct_id=void 0,this.kh(),this.ih=!1,this.ph=0}}},QO={sessionRecording:class{get qi(){return this._instance.config}get za(){return this._instance.persistence}get started(){var e;return!((e=this.qh)==null||!e.isStarted)}get status(){var e,t;return this.jh===na||this.jh===ru?this.jh:(e=(t=this.qh)==null?void 0:t.status)!==null&&e!==void 0?e:this.jh}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=M_,this.Bh=void 0,this.Hh=!1,this.kt=(()=>{var t;if(j==null||!j.visibilityState||j.visibilityState==="visible")return!0;var n=I==null||(t=I.performance)==null||t.getEntriesByType==null?void 0:t.getEntriesByType("visibility-state");return!(n!=null&&n.length)||n.some(r=>r.name==="visible")})(),this.It=()=>{var t;(j==null?void 0:j.visibilityState)==="visible"&&(this.kt=!0,(t=this.qh)==null||t.setDocumentWasEverVisible==null||t.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Yn.error("started without valid sessionManager"),new Error(Np+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===lr)throw new Error(Np+' cannot be used with cookieless_mode="always"');j!=null&&j.addEventListener&&Re(j,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,j==null||j.removeEventListener==null||j.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var e,t=!((e=this._instance.get_property(Oi))==null||!e.enabled),n=!this.qi.disable_session_recording,r=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return I&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!(this.Hh||this.Uh&&(t=this.qh)!=null&&t.isStarted)){var n=!L(Object.assign)&&!L(Array.from);this.Uh&&n?(this.zh(e),Yn.info("starting")):(this.jh=M_,this.stopRecording())}}zh(e){var t,n,r;this.Uh&&(this.jh!==na&&this.jh!==ru&&(this.jh=A_),Y!=null&&(t=Y.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Y.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Wh(e):(r=Y.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Vh,i=>{if(i)return this._instance.register_for_session({[xp]:!0}),Yn.error("could not load recorder",i);this.Wh(e)}))}stopRecording(){var e,t;(e=this.Bh)==null||e.call(this),this.Bh=void 0,(t=this.qh)==null||t.stop()}Gh(){var e,t;(e=this.Bh)==null||e.call(this),this.Bh=void 0,(t=this.qh)==null||t.discard()}Zh(){var e,t;(e=this.za)==null||e.unregister(bg),(t=this.za)==null||t.unregister(oE)}Qh(e,t){if(ne(e))return null;var n,r=Ge(e)?e:parseFloat(e);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Yn.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}Jh(e){if(this.za){var t,n,r=this.za,i=()=>{var s,o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.Qh((s=this.qi.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),l=this.Qh(o==null?void 0:o.sampleRate,"remote config sampleRate"),u=a??l;ne(u)&&this.Zh();var c=o==null?void 0:o.minimumDurationMilliseconds;r.register({[Oi]:$({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:$({capturePerformance:e.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:u,minimumDurationMilliseconds:L(c)?null:c,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers,version:o==null?void 0:o.version,triggerGroups:o==null?void 0:o.triggerGroups})})};i(),(t=this.Bh)==null||t.call(this),this.Bh=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(i)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.Jh(t),void this.Gh()):(this.Jh(t),void this.startIfEnabledOrStop()):(this.jh===na&&(this.jh=ru,Yn.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.qh)!=null&&n.log?this.qh.log(e,t):Yn.warn("log called before recorder was ready")}get Vh(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Oi);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Kh(){var e,t=this._instance.get_property(Oi);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return Yn.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!ne(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}Wh(e){var t,n,r;if(!this.Hh){if((t=Y.__PosthogExtensions__)==null||!t.initSessionRecording)return Yn.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[xp]:!0});var i;if(this.qh||(this.qh=(i=Y.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh())return this.jh===ru||this.jh===na?void 0:(this.jh=na,Yn.info("persisted remote config is stale, requesting fresh config before starting"),void new UE(this._instance).load());this.jh=A_,(n=(r=this.qh).setDocumentWasEverVisible)==null||n.call(r,this.kt),this.qh.start(e)}}onRRwebEmit(e){var t;(t=this.qh)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.qh||(t=this.za)==null||t.register({[lE]:!0}),(e=this.qh)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.qh||(t=this.za)==null||t.register({[aE]:!0}),(e=this.qh)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.qh||(n=this.za)==null||n.register({[e==="url"?uE:cE]:!0}),(t=this.qh)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.qh)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.qh)==null||!n.tryAddCustomEvent(e,t))}}},YO={autocapture:class extends AO{constructor(e){super(new NO(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.Yh=this.Xh()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this.td();return!!(e.path||e.search||this.ed(e))}startIfEnabled(){this.isEnabled&&(D.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Yh=this.Xh(),this.startIfEnabled()}stop(){this.rd&&this.rd(),this.rd=void 0,this.nd&&this.nd(),this.nd=void 0,D.info("History API monitoring stopped")}monitorHistoryChanges(){I&&I.history&&(this.sd("pushState"),this.sd("replaceState"),this.ad(),this.ed()&&this.od())}sd(e){var t;if(I&&((t=I.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(r,i,s){try{if(!(i in r))return I_;var o={next:r[i]},a=s(function(){for(var l=arguments.length,u=new Array(l),c=0;l>c;c++)u[c]=arguments[c];return o.next.apply(this,u)});return vt(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),r[i]=a,()=>{if(r[i]!==a)for(var l=r[i];vt(l)&&l.__posthog_layer__;){var u=l.__posthog_layer__;if(u.next===a)return void(u.next=o.next);l=u.next}else r[i]=o.next}}catch{return I_}})(I.history,e,r=>function(i,s,o){r.call(this,i,s,o),n.ld(e)})}}Xh(){var e=I==null?void 0:I.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}td(){var e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:Se(e)?e:{}}ed(e){return e===void 0&&(e=this.td()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}ud(e){var t=this.td(),n=this.Yh;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.ed(t)&&e.hash!==n.hash))}ld(e){try{var t=this.Xh();if(!t)return;this.ud(t)&&this._instance.capture(xs,{navigation_type:e}),this.Yh=t}catch(n){D.error("Error capturing "+e+" pageview",n)}}ad(){if(!this.rd){var e=()=>{this.ld("popstate")};Re(I,"popstate",e),this.rd=()=>{I&&I.removeEventListener("popstate",e)}}}od(){if(!this.nd){var e=()=>{this.ld("hashchange")};Re(I,"hashchange",e),this.nd=()=>{I&&I.removeEventListener("hashchange",e)}}}},heatmaps:class{get qi(){return this.instance.config}constructor(e){var t;this.hd=!1,this.Qn=!1,this.dd=null,this.instance=e,this.hd=!((t=this.instance.persistence)==null||!t.props[up]),this.rageclicks=new lS(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Se(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(e=this.qi.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ne(this.qi.capture_heatmaps)?ne(this.qi.enable_heatmaps)?this.hd:this.qi.enable_heatmaps:this.qi.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Qn)return;FO.info("starting..."),this.vd(),this.It()}else{var e;clearInterval((e=this.dd)!==null&&e!==void 0?e:void 0),this.fd(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[up]:n}),this.hd=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.ft;return this.ft=void 0,e}pd(e){$f(e.originalEvent)&&this.ki(e.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd=(j==null?void 0:j.visibilityState)==="visible"?setInterval(this.Oa.bind(this),this.flushIntervalMilliseconds):null}vd(){I&&j&&(this.gd=this.Oa.bind(this),Re(I,kc,this.gd),this.md=e=>this.ki(e||(I==null?void 0:I.event)),Re(j,"click",this.md,{capture:!0}),this.yd=e=>this.bd(e||(I==null?void 0:I.event)),Re(j,"mousemove",this.yd,{capture:!0}),this._d=new d_(this.instance,HI,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),Re(j,Cc,this.wd),this.Qn=!0)}fd(){var e;I&&j&&(this.gd&&I.removeEventListener(kc,this.gd),this.md&&j.removeEventListener("click",this.md,{capture:!0}),this.yd&&j.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&j.removeEventListener(Cc,this.wd),clearTimeout(this.kd),(e=this._d)==null||e.stop(),this.Qn=!1)}Sd(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),s=function(o,a,l){for(var u=o;u&&ui(u)&&!Kt(u,"body");){if(u===l)return!1;var c=void 0;try{var d,f,m;c=(d=(f=(m=u.ownerDocument)==null?void 0:m.defaultView)!==null&&f!==void 0?f:I)==null?void 0:d.getComputedStyle(u).position}catch{return!1}if(J(a,c))return!0;u=SE(u)}return!1}(Sp(e),["fixed","sticky"],i);return{x:e.clientX+(s?0:r),y:e.clientY+(s?0:n),target_fixed:s,type:t}}ki(e,t){var n;if(t===void 0&&(t="click"),!t_(e.target)&&$f(e)){var r=this.Sd(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&kE(Sp(e),this.instance.config.rageclick)&&this.Nn($({},r,{type:"rageclick"})),this.Nn(r)}}bd(e){!t_(e.target)&&$f(e)&&(clearTimeout(this.kd),this.kd=setTimeout(()=>{this.Nn(this.Sd(e,"mousemove"))},500))}Nn(e){if(I){var t=this.qi.disable_capture_url_hashes?li(I.location.href):I.location.href,n=this.qi.custom_personal_data_properties,r=this.qi.mask_personal_data_properties?[...Co,...n||[]]:[],i=Za(t,r,el);this.ft=this.ft||{},this.ft[i]||(this.ft[i]=[]),this.ft[i].push(e)}}Oa(){this.ft&&!En(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:d_,webVitalsAutocapture:class{constructor(e){var t;this.hd=!1,this.Qn=!1,this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.xd=()=>{clearTimeout(this.Cd),this.Cd=void 0,this.ft.metrics.length!==0&&(this._instance.capture("$web_vitals",$({$current_url:this.ft.url},this.ft.metrics.reduce((n,r)=>$({},n,{["$web_vitals_"+r.name+"_event"]:$({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Td=n=>{var r;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},ne(n==null?void 0:n.name)||ne(n==null?void 0:n.value))yi.error("Invalid metric received",n);else{var i=typeof n.navigationURL=="string"?n.navigationURL:void 0,s=this.Md(i);if(!L(s)){var o=Ge(n.navigationId)||typeof n.navigationId=="string"?"navigation:"+n.navigationId:"url:"+s;if(!this.Ed||this.Ed>n.value){this.ft.navigationKey!==o&&(this.xd(),this.Cd=setTimeout(this.xd,this.flushToCaptureTimeoutMs)),L(this.ft.navigationKey)&&(this.ft.navigationKey=o,this.ft.url=s),this.ft.firstMetricTimestamp=L(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var a=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0),l=$({},n,i?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});L(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.ft.metrics.push(l),this.ft.metrics.length===this.allowedMetrics.length&&this.xd()}else yi.error("Ignoring metric with value >= "+this.Ed,n)}}},this.Id=()=>{if(!this.Qn){var n,r,i,s,o=Y.__PosthogExtensions__,a=o==null?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(a==null?void 0:a[this.Rd])||(this.Rd==="web-vitals"&&L(a)?o==null?void 0:o.postHogWebVitalsCallbacks:void 0);if(L(l)||(n=l.onLCP,r=l.onCLS,i=l.onFCP,s=l.onINP),n&&r&&i&&s){var u={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf("LCP")>-1&&n(this.Td.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Td.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Td.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&s(this.Td.bind(this),u),this.Qn=!0}else yi.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.hd=!((t=this._instance.persistence)==null||!t.props[hp]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=Se(this.Pd)?(e=this.Pd)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ne(n)?((t=this._instance.persistence)==null?void 0:t.props[pp])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Se(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Se(this.Pd)?this.Pd.web_vitals_attribution:void 0;return e!=null&&e}get useSoftNavs(){var e=Se(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Ed(){var e=Se(this.Pd)&&Ge(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:O_;return e>0&&6e4>=e?O_:e}get isEnabled(){var e=Ae==null?void 0:Ae.protocol;if(e!=="http:"&&e!=="https:")return yi.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Se(this.Pd)?this.Pd.web_vitals:$t(this.Pd)?this.Pd:void 0;return $t(t)?t:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(yi.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=Se(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=Se(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[hp]:n}),this._instance.persistence.register({[pp]:r})),this.hd=n,this.startIfEnabled()}}}get Rd(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_s(e){var t=Y.__PosthogExtensions__,n=this.Rd,r=t==null?void 0:t.postHogWebVitalsCallbacksByFlavor;r!=null&&r[n]||n==="web-vitals"&&L(r)&&t!=null&&t.postHogWebVitalsCallbacks?e():t==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,n,i=>{i?yi.error("failed to load script",i):e()})}Md(e){var t=e||(I==null?void 0:I.location.href);if(t){var n=this._instance.config.disable_capture_url_hashes?li(t):t,r=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Co,...r||[]]:[];return Za(n,i,el)}yi.error("Could not determine current URL")}}},XO={exceptionObserver:class{constructor(e){var t;this.Id=()=>{var n;if(I&&this.isEnabled&&(n=Y.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var r=Y.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Y.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=Y.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=r(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=i(this.captureException.bind(this))),!this.Od&&this.qi.capture_console_errors&&(this.Od=s(this.captureException.bind(this)))}catch(o){ta.error("failed to start",o),this.Ld()}}},this._instance=e,this.$d=!((t=this._instance.persistence)==null||!t.props[cp]),this.oe=new DT($({},function(n){var r,i,s,o;return n===void 0&&(n={}),{refillRate:(r=(i=n.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:n.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(s=(o=n.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:n.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10}}(this._instance.config.error_tracking),{refillInterval:1e4,I:ta})),this.qi=this.Dd(),this.startIfEnabledOrStop()}Dd(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Se(e)?t=$({},t,e):(L(e)?this.$d:e)&&(t=$({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qi.capture_console_errors||this.qi.capture_unhandled_errors||this.qi.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ta.info("enabled"),this.Ld(),this._s(this.Id)):this.Ld()}_s(e){var t,n;(t=Y.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Y.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return ta.error("failed to load script",r);e()})}Ld(){var e,t,n;(e=this.Ad)==null||e.call(this),this.Ad=void 0,(t=this.Fd)==null||t.call(this),this.Fd=void 0,(n=this.Od)==null||n.call(this),this.Od=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.$d=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[cp]:this.$d}),this.qi=this.Dd(),this.startIfEnabledOrStop())}}onConfigChange(){this.qi=this.Dd()}captureException(e){var t,n,r,i=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.oe.consumeRateLimit(i)?ta.info("Skipping exception capture because of client rate limiting.",{exception:i}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.Nd=[],this.qd=new iI([new fI,new xI,new pI,new hI,new _I,new yI,new gI,new wI],function(r){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;i>o;o++)s[o-1]=arguments[o];return function(a,l){l===void 0&&(l=0);for(var u=[],c=a.split(` +`),d=l;c.length>d;d++){var f=c[d];if(1024>=f.length){var m=Ky.test(f)?f.replace(Ky,"$1"):f;if(!m.match(/\S*Error: /)){for(var _ of s){var p=_(m,r);if(p){u.push(p);break}}if(u.length>=50)break}}}return function(y){if(!y.length)return[];var h=Array.from(y);return h.reverse(),h.slice(0,50).map(v=>{return $({},v,{filename:v.filename||(x=h,x[x.length-1]||{}).filename,function:v.function||bo});var x})}(u)}}("web:javascript",lI,dI)),this._instance=e,this.Nd=(t=(n=this._instance.persistence)==null?void 0:n.get_property(dp))!==null&&t!==void 0?t:[],this.jd=_c(this.Bd()),this.Hd=new EI(this.jd)}onConfigChange(){this.jd=_c(this.Bd()),this.Hd.setConfig(this.jd)}onRemoteConfig(e){var t,n,r;if(e.ok){var i=e.config;if("errorTracking"in i){var s=(t=(n=i.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],o=(r=i.errorTracking)==null?void 0:r.captureExtensionExceptions;this.Nd=s,this._instance.persistence&&this._instance.persistence.register({[dp]:this.Nd,[fp]:o})}}}get Ud(){var e,t=!!this._instance.get_property(fp),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.qd.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.jd.enabled)try{if(!ce(e)||e.trim().length===0)return void gn.warn("Ignoring exception step because message must be a non-empty string");var n=function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(s).reduce((a,l)=>bI.has(l)?(o.push(l),a):(a[l]=s[l],a),{}),droppedKeys:o}}(this.zd(t)),r=n.sanitizedProperties,i=n.droppedKeys;i.length>0&&gn.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.Hd.add($({[mc]:e,[yc]:new Date().toISOString()},r))}catch(s){gn.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Wd(t)){if(this.Vd(t))return this.Gd("Exception dropped: matched a suppression rule"),void gn.info("Skipping exception capture because a suppression rule matched");if(!this.Ud&&this.Zd(t))return this.Gd("Exception dropped: thrown by a browser extension"),void gn.info("Skipping exception capture because it was thrown by an extension");if(!this.Ud&&this.Qd(t))return this.Gd("Exception dropped: thrown by an injected browser script"),void gn.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jd(t))return this.Gd("Exception dropped: thrown by the PostHog SDK"),void gn.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.jd.enabled&&ne(e.$exception_steps)?this.Kd(e):e,r=typeof(s=globalThis._posthogReleaseId)=="string"&&s.length>0?s:void 0;r&&(n.$release_id=r);try{var i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",fl:!0});return i&&this.Hd.clear(),i}catch(o){return gn.error("Failed to capture exception event. Dropping this exception.",o),void this.Hd.clear()}}catch(o){return void gn.error("Failed to process exception event. Ignoring this exception.",o)}var s}Kd(e){try{var t=this.Hd.getAttachable();return t.length===0?e:$({},e,{$exception_steps:t})}catch(n){return gn.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}Gd(e){this.jd.enabled&&this.Hd.add({[mc]:e,[yc]:new Date().toISOString()})}zd(e){return Se(e)?$({},e):{}}Bd(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Vd(e){if(e.length===0)return!1;try{var t=e.reduce((n,r)=>{var i=r.type,s=r.value;return ce(i)&&i.length>0&&n.$exception_types.push(i),ce(s)&&s.length>0&&n.$exception_values.push(s),n},{$exception_types:[],$exception_values:[]});return this.Nd.some(n=>{var r=n.values.map(i=>{var s=tS[i.operator],o=t[i.key];if(!s||!o)return!1;var a=Z(i.value)?i.value:[i.value];return a.length>0&&s(a,o)});return n.type==="OR"?r.some(Boolean):r.every(Boolean)})}catch(n){return gn.warn("Failed to evaluate suppression rules. Capturing the exception.",n),!1}}Zd(e){return e.flatMap(t=>{var n,r;return(n=(r=t.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]}).some(t=>{var n=t.filename;return!!n&&HO.some(r=>n.startsWith(r))})}Qd(e){return e.some(t=>{var n=t.value;return ce(n)&&GO.some(r=>n.includes(r))})}Jd(e){if(e.length>0){var t,n,r,i,s=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],o=s[s.length-1];return(r=o==null||(i=o.filename)==null?void 0:i.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}Wd(e){return!ne(e)&&Z(e)}}},JO=$({productTours:class{get za(){return this._instance.persistence}constructor(e){this.Yd=null,this.Xd=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,r;if(this.za&&this.za.register({[xg]:!!t.productTours}),!Ff(this._instance))return!this.Yd&&ne((n=this.za)==null?void 0:n.props[da])||iu.info("product tours disabled; stopping and clearing cached tours"),(r=this.Yd)==null||r.stop(),this.Yd=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Yd&&Ff(this._instance)&&this._s(()=>this.tv())}_s(e){var t,n;(t=Y.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Y.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",r=>{r?iu.error("Could not load product tours script",r):e()})}tv(){var e;!this.Yd&&(e=Y.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Yd=Y.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Z(this.Xd)||t){var n=this.za;if(n){var r=n.props[da];if(Z(r)&&!t)return this.Xd=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(Ff(this._instance)){var s=i.statusCode;if(s!==200||!i.json){var o="Product Tours API could not be loaded, status: "+s;return s===0?i.error||iu.warn(o):iu.error(o),void e([],{isLoaded:!1,error:o})}var a=Z(i.json.product_tours)?i.json.product_tours:[];this.Xd=a,n&&n.register({[da]:a}),e(a,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Xd,{isLoaded:!0})}getActiveProductTours(e){ne(this.Yd)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Yd.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Yd)==null||t.showTourById(e)}previewTour(e){this.Yd?this.Yd.previewTour(e):this._s(()=>{var t;this.tv(),(t=this.Yd)==null||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Yd)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Yd)==null||e.nextStep()}previousStep(){var e;(e=this.Yd)==null||e.previousStep()}clearCache(){var e;this.Xd=null,(e=this.za)==null||e.unregister(da)}resetTour(e){var t;(t=this.Yd)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Yd)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Yd)==null||t.cancelPendingTour(e)}}},hd),ZO={siteApps:class{constructor(e){this.ev=0,this._instance=e,this.iv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}rv(e,t){if(t){var n=this.globalsForEvent(t);this.iv.push(n),this.iv.length>1e3&&(this.iv=this.iv.slice(10))}}get siteAppLoaders(){var e;return(e=Y._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.rv.bind(this));this.nv=()=>{e(),this.iv=[],this.nv=void 0}}}globalsForEvent(e){var t,n,r,i,s,o,a;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(c)){var f=d[0];l[f]={id:u[f],type:f,properties:d[1]}}var m=e.$set_once,_=e.$set;return{event:$({},bb(e,LO),{properties:$({},e.properties,_?{$set:$({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},m?{$set_once:$({},(r=(i=e.properties)==null?void 0:i.$set_once)!==null&&r!==void 0?r:{},m)}:{}),elements_chain:(s=(o=e.properties)==null?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=e.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}sv(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(On.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(On.error("prepare_external_dependency_script returned null"),null):e}av(){var e,t,n,r,i,s,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=j==null?void 0:j.defaultView,u=l==null||(e=l.Node)==null?void 0:e.prototype;if(!l||!u)return()=>{};if(this.ev++,this.ov)return this.lv();var c=[],d=this,f=new WeakSet,m=(y,h,v)=>{if(y!=null&&y[h]){var x=y[h];y[h]=v(x),c.push(()=>{y[h]=x})}},_=y=>{if(f.has(y))return y;var h=d.sv(y);return h&&f.add(h),h},p=y=>y.map(h=>typeof h=="string"?h:_(h)).filter(h=>!rt(h));return m(u,"appendChild",y=>function(h){var v=_(h);return v?y.call(this,v):h}),m(u,"insertBefore",y=>function(h,v){var x=_(h);return x?y.call(this,x,v):h}),m(u,"replaceChild",y=>function(h,v){var x=_(h);return x?y.call(this,x,v):v}),[(t=l.Element)==null?void 0:t.prototype,(n=l.Document)==null?void 0:n.prototype,(r=l.DocumentFragment)==null?void 0:r.prototype].forEach(y=>{m(y,"append",h=>function(){for(var v=arguments.length,x=new Array(v),b=0;v>b;b++)x[b]=arguments[b];return h.apply(this,p(x))}),m(y,"prepend",h=>function(){for(var v=arguments.length,x=new Array(v),b=0;v>b;b++)x[b]=arguments[b];return h.apply(this,p(x))})}),[(i=l.Element)==null?void 0:i.prototype,(s=l.CharacterData)==null?void 0:s.prototype,(o=l.DocumentType)==null?void 0:o.prototype].forEach(y=>{m(y,"before",h=>function(){for(var v=arguments.length,x=new Array(v),b=0;v>b;b++)x[b]=arguments[b];return h.apply(this,p(x))}),m(y,"after",h=>function(){for(var v=arguments.length,x=new Array(v),b=0;v>b;b++)x[b]=arguments[b];return h.apply(this,p(x))}),m(y,"replaceWith",h=>function(){for(var v=arguments.length,x=new Array(v),b=0;v>b;b++)x[b]=arguments[b];var E=p(x);return x.length&&!E.length?void 0:h.apply(this,E)})}),m((a=l.Element)==null?void 0:a.prototype,"insertAdjacentElement",y=>function(h,v){var x=_(v);return x?y.call(this,h,x):null}),this.ov=()=>{c.forEach(y=>y()),this.ov=void 0},this.lv()}lv(){var e=!1;return()=>{var t;e||(e=!0,this.ev--,this.ev===0&&((t=this.ov)==null||t.call(this)))}}uv(e,t){t===void 0&&(t=!0);var n=this.av();try{var r=e(n);return t&&n(),r}catch(i){throw n(),i}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var o;!t.errored&&this.iv.length&&(On.info("Processing "+this.iv.length+" events for site app with id "+e.id),this.iv.forEach(a=>this.uv(()=>t.processEvent==null?void 0:t.processEvent(a))),t.processedBuffer=!0),Object.values(this.apps).every(a=>a.processedBuffer||a.errored)&&((o=this.nv)==null||o.call(this))},r=!1,i=o=>{t.errored=!o,t.loaded=!0,On.info("Site app with id "+e.id+" "+(o?"loaded":"errored")),r&&n()};try{var s=this.uv(o=>e.init({posthog:this._instance,callback(a){o(),i(a)}}),!1).processEvent;s&&(t.processEvent=s),r=!0}catch(o){On.error(N_+e.id,o),i(!1)}if(r&&t.loaded)try{n()}catch(o){On.error("Error while processing buffered events PostHog app with config id "+e.id,o),t.errored=!0}}hv(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}dv(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(s){try{t.uv(()=>s.processEvent==null?void 0:s.processEvent(n))}catch(o){On.error("Error while processing event "+e.event+" for site app "+s.id,o)}};for(var i of Object.values(this.apps))r(i)}}onRemoteConfig(e){var t,n,r,i=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.hv(),void this._instance.on("eventCaptured",l=>this.dv(l))):void On.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.nv)==null||n.call(this),e.ok){var s=e.config;if((r=s.siteApps)!=null&&r.length)if(this.isEnabled){var o=function(){var l,u=a.id,c=a.url;Y["__$$ph_site_app_"+u]=i._instance,(l=Y.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(i._instance,c,d=>{if(d)return On.error(N_+u,d)})};for(var a of s.siteApps)o()}else On.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},eM={tracingHeaders:class{constructor(e){this.vv=void 0,this.fv=void 0,this.pv=void 0,this.Id=()=>{var t,n,r=this.gv();r?(L(this.vv)&&(this.vv=(t=Y.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),L(this.fv)&&(this.fv=(n=Y.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Ld()},this._instance=e}initialize(){this.startIfEnabledOrStop()}_s(e){var t,n;(t=Y.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Y.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return $O.error("failed to load script",r);e()})}mv(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}gv(){var e=this.mv();return Z(e)?(Z(this.pv)?this.pv.splice(0,this.pv.length,...e):this.pv=[...e],e.length>0?this.pv:void 0):(Z(this.pv)&&this.pv.splice(0),this.pv=e||void 0,this.pv)}Ld(){var e,t;(e=this.vv)==null||e.call(this),(t=this.fv)==null||t.call(this),this.vv=void 0,this.fv=void 0}startIfEnabledOrStop(){this.gv()?this._s(this.Id):this.Ld()}}},tM=$({surveys:class extends jO{constructor(e){var t;super(new BO(e),{get projectToken(){return t.config.token},kv:new VO(t=e)}),this._instance=e}Nl(e,t){var n=t.query?bl(e,t.query):e;return new Promise(r=>{var i;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((i=t.target)!==null&&i!==void 0?i:"api",n),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:r})})}}},hd),nM={toolbar:class{constructor(e){this.instance=e}yv(e){Y.ph_toolbar_state=e}bv(){var e;return(e=Y.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),Ep(this.instance.config)||!I||!j)return!1;e=e??I.location,n=n??I.history;try{if(!t){try{I.localStorage.setItem("test","test"),I.localStorage.removeItem("test")}catch{return!1}t=I==null?void 0:I.localStorage}var r,i=qO||Ic(e.hash,"__posthog")||Ic(e.hash,"state"),s=i?Xy(()=>JSON.parse(atob(decodeURIComponent(i))))||Xy(()=>JSON.parse(decodeURIComponent(i))):null;return s&&s.action==="ph_authorize"?((r=s).source="url",r&&Object.keys(r).length>0&&(s.desiredHash?e.hash=s.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(F_)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}_v(e){var t=Y.ph_load_toolbar||Y.ph_load_editor;!ne(t)&&vt(t)?t(e,this.instance):L_.warn("No toolbar load function found")}loadToolbar(e){var t=!(j==null||!j.getElementById(_E));if(!I||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=$({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(I.localStorage.setItem(F_,JSON.stringify($({},r,{source:void 0}))),this.bv()===2)this._v(r);else if(this.bv()===0){var i;this.yv(1),(i=Y.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"toolbar",s=>{if(s)return L_.error("[Toolbar] Failed to load",s),void this.yv(0);this.yv(2),this._v(r)}),Re(I,"turbolinks:load",()=>{this.yv(0),this.loadToolbar(r)})}return!0}wv(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},rM=$({experiments:ht},hd),iM={conversations:class{constructor(e){this.Sv=void 0,this._conversationsManager=null,this.xv=!1,this.Me=null,this.Cv=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this.Tv=e.ok,e.ok)){var t=e.config.conversations;ne(t)||($t(t)?this.Sv=t:(this.Sv=t.enabled,this.Me=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Sv=void 0,this.Me=null,this.Tv=void 0,this.Cv=!1}loadIfEnabled(){if(!(this._conversationsManager||this.xv||this._instance.config.disable_conversations||Ep(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Y==null?void 0:Y.__PosthogExtensions__;if(e&&!L(this.Sv)&&this.Sv)if(this.Me&&this.Me.token){this.xv=!0;try{var t=e.initConversations;if(t)return this.Mv(t),void(this.xv=!1);var n=e.loadExternalDependency;if(!n)return void this.Ev(Eg);n(this._instance,"conversations",r=>{r||!e.initConversations?this.Ev("Could not load conversations script",r):this.Mv(e.initConversations),this.xv=!1})}catch(r){this.Ev("Error initializing conversations",r),this.xv=!1}}else tn.error("Conversations enabled but missing token in remote config.")}}Mv(e){if(this.Me)try{this._conversationsManager=e(this.Me,this._instance),this.Cv=!1,tn.info("Conversations loaded successfully")}catch(t){this.Ev("Error completing conversations initialization",t)}else tn.error("Cannot complete initialization: remote config is null")}Ev(e,t){tn.error(e,t),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():tn.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Sv===!0&&!rt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Ep(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Tv===!1?"remote_config_failed":L(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?ne(this.Me)||!this.Me.token?"missing_token":Y!=null&&Y.__PosthogExtensions__?this.xv?"initializing":this.Cv?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var r=this;return Ce(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(tn.warn(wi),null)})()}getMessages(e,t){var n=this;return Ce(function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(tn.warn(wi),null)})()}markAsRead(e){var t=this;return Ce(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(tn.warn(wi),null)})()}getTickets(e){var t=this;return Ce(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(tn.warn(wi),null)})()}requestRestoreLink(e){var t=this;return Ce(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(tn.warn(wi),null)})()}restoreFromToken(e){var t=this;return Ce(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(tn.warn(wi),null)})()}restoreFromUrlToken(){var e=this;return Ce(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(tn.warn(wi),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Sl(){var e;(e=this._conversationsManager)==null||e.setIdentity()}xl(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},sM={logs:class{constructor(e){var t,n=this;this.Iv=!1,this.Rv=!1,this.I=Ie("[logs]"),this.Pv=$({},this.I,{error(){for(var r=arguments.length,i=new Array(r),s=0;r>s;s++)i[s]=arguments[s];i.some(W_)||n.I.error(...i)}}),this.ka=[],this.Av=[],this.ph=0,this.Fv=()=>{var r,i;this.ph=0,(r=this.Ov)==null||r.onReconnect(),(i=this.Lv)==null||i.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Iv=!0),I&&Re(I,"online",this.Fv)}$v(e,t,n,r){var i,s=function(o,a){var l,u,c,d,f,m,_,p=(l=o==null?void 0:o.flushIntervalMs)!==null&&l!==void 0?l:3e3,y=(u=o==null?void 0:o.maxBufferSize)!==null&&u!==void 0?u:100,h=a!=null&&a.consoleCapture?void 0:(c=o==null?void 0:o.maxLogsPerInterval)!==null&&c!==void 0?c:1e3,v=L(h)?Math.max(y,2048):Math.max(y,h),x=o==null?void 0:o.resourceAttributes;return{serviceName:(d=(f=x==null?void 0:x["service.name"])!==null&&f!==void 0?f:o==null?void 0:o.serviceName)!==null&&d!==void 0?d:a==null?void 0:a.serviceNameDefault,serviceVersion:(m=x==null?void 0:x["service.version"])!==null&&m!==void 0?m:o==null?void 0:o.serviceVersion,environment:(_=x==null?void 0:x["deployment.environment"])!==null&&_!==void 0?_:o==null?void 0:o.environment,resourceAttributes:x,beforeSend:o==null?void 0:o.beforeSend,flushIntervalMs:p,maxBufferSize:y,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:p,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}((i=this._instance)==null||(i=i.config)==null?void 0:i.logs,n);return[new tI(this.Dv(e,t),s,this.Pv,()=>this.Nv(),o=>o(),void 0,r),s]}qv(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.Ov||this.jv!==t){var n;(n=this.Ov)==null||n.reset(),this.jv=t;var r=this.$v(()=>this.ka,i=>{this.ka=i});this.Ov=r[0],this.Bv=r[1]}return this.Ov}Hv(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.Lv||this.Uv!==t){var n;(n=this.Lv)==null||n.reset(),this.Uv=t;var r=this.$v(()=>this.Av,i=>{this.Av=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},q_);this.Lv=r[0],this.zv=r[1]}return this.Lv}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var n=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!ne(n)&&n&&(this.Iv=!0,this.loadIfEnabled())}}reset(){var e,t;this.ka=[],(e=this.Ov)==null||e.reset(),this.Av=[],(t=this.Lv)==null||t.reset(),this.ph=0}captureLog(e){this.qv().captureLog(e)}vi(e){this.Hv().captureLog(e)}get logger(){return this.Wv||(this.Wv={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Wv}flushLogs(e){e?this.Vv(e):(this.Ov&&this.Ov.flush().catch(t=>this.Gv(t)),this.Lv&&this.Lv.flush().catch(t=>this.Gv(t)))}Gv(e){W_(e)||this.I.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Iv&&!this.Rv){var e=Y==null?void 0:Y.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",n=>{var r;n||(r=e.logs)==null||!r.initializeLogs?this.I.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.Rv=!0)}):this.I.error(Eg)}else this.I.error("PostHog Extensions not found.")}}Dv(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:r=>r===nr.LogsQueue?e():void 0,setPersistedProperty(r,i){var s;r===nr.LogsQueue&&t((s=i)!==null&&s!==void 0?s:[])},Mn:r=>this.Mn(r),getLibraryId:()=>Ee.LIB_NAME,getLibraryVersion:()=>Ee.LIB_VERSION}}Mn(e){return new Promise(t=>{if(ME(this.ph,3))t({kind:"fatal",error:jf(void 0,"logs endpoint is unreachable, dropping batch")});else{var n=!1,r=s=>{n||(n=!0,clearTimeout(i),t(s))},i=setTimeout(()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:jf(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Zv(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:s=>{var o=s.statusCode;if(this.Qv(o),o>=200&&300>o)r({kind:"ok"});else if(o===413)r({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)r({kind:"fatal",error:new Error("logs request failed with status "+o)});else{var a;o===0?(s.error||this.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:jf(s.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:(a=s.error)!==null&&a!==void 0?a:new Error("logs request failed with status "+o)})}}})}})}Qv(e){(e!==0||this._instance.__loaded)&&(this.ph=AE(e,this.ph,3,()=>this.I.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Vv(e){this.ka.length>0&&this.Jv(e,this.ka,this.Bv,Ee.LIB_NAME,t=>{this.ka=t}),this.Av.length>0&&this.Jv(e,this.Av,this.zv,q_,t=>{this.Av=t})}Jv(e,t,n,r,i){if(t.length!==0){var s=t.map(a=>a.record);i([]);var o=tE(s,eE(n,Ee.LIB_NAME,Ee.LIB_VERSION),r,Ee.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zv(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}Zv(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Nv(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,i=n.sessionStartTimestamp,s=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=r,ne(i)||(t.sessionStartTimestamp=i),ne(s)||(t.lastActivityTimestamp=s)}if(Y!=null&&(e=Y.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?li(Y.location.href):Y.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},oM={metrics:class{constructor(e){this.I=Ie("[metrics]"),this._instance=e}initialize(){}qv(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.Ov&&this.jv===n||((t=this.Ov)==null||t.reset(),this.jv=n,this.Ov=new nI(this.Dv(),function(r){var i,s,o,a,l,u=r==null?void 0:r.resourceAttributes;return{serviceName:(i=u==null?void 0:u["service.name"])!==null&&i!==void 0?i:r==null?void 0:r.serviceName,serviceVersion:(s=u==null?void 0:u["service.version"])!==null&&s!==void 0?s:r==null?void 0:r.serviceVersion,environment:(o=u==null?void 0:u["deployment.environment"])!==null&&o!==void 0?o:r==null?void 0:r.environment,resourceAttributes:u,beforeSend:r==null?void 0:r.beforeSend,flushIntervalMs:(a=r==null?void 0:r.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=r==null?void 0:r.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}}(n),this.I)),this.Ov}count(e,t,n){t===void 0&&(t=1),this.qv().count(e,t,n)}gauge(e,t,n){this.qv().gauge(e,t,n)}histogram(e,t,n){this.qv().histogram(e,t,n)}flush(e){if(!this.Ov)return Promise.resolve();if(e){var t=this.Ov.drainWindow();return t&&this.Un(t,e),Promise.resolve()}return this.Ov.flush().catch(n=>this.I.error("PostHog metrics flush failed:",n))}reset(){var e;(e=this.Ov)==null||e.reset()}Dv(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Un:n=>t.Un(n),getLibraryId:()=>Ee.LIB_NAME,getLibraryVersion:()=>Ee.LIB_VERSION}}Un(e,t){return new Promise(n=>{var r=!1,i=o=>{r||(r=!0,clearTimeout(s),n(o))},s=setTimeout(()=>i({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request($({method:"POST",url:this.Kv(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(o){var a=o.statusCode;if(a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)i({kind:"fatal",error:new Error("metrics request failed with status "+a)});else{var l;i({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error("metrics request failed with status "+a)})}}}))})}Kv(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},aM=$({},hd,QO,YO,XO,JO,ZO,tM,eM,nM,rM,iM,sM,oM);qt.__defaultExtensionClasses=$({},aM);var lM=function(){Ee.SDK_DIST_CHANNEL="npm";var e=Ra[bs]=new qt;return function(){function t(){t.done||(t.done=!0,aS=!1,ve(Ra,function(n){n._dom_loaded()}))}j!=null&&j.addEventListener?j.readyState==="complete"?t():Re(j,"DOMContentLoaded",t,{capture:!1}):I&&D.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}(),dS;function uM(e){dS=e}function cM(){return dS}var dM=g.createContext({get client(){return cM()},bootstrap:void 0}),Df=function(e){return typeof e=="function"},fM=function(e){return e===void 0},$p=function(e,t){return $p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},$p(e,t)};function hM(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");$p(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Au=function(e){var t=Object.prototype.toString.call(e);return e instanceof Error||t==="[object Error]"||t==="[object Exception]"||t==="[object DOMException]"||t==="[object DOMError]"},pM=function(e,t){for(var n=new WeakSet,r=e;!n.has(r);){if(n.add(r),!Au(r.cause)){fM(r.cause)||(t.cause=r.cause),r.cause=t;return}r=r.cause}},vM=function(e,t){if(!t)return e;var n=new Error(Au(e)?e.message:"Primitive value captured as exception: ".concat(String(e)));return n.name="React ErrorBoundary ".concat(Au(e)?e.name:"Error"),n.stack=t,Au(e)?(pM(e,n),e):n},gM={componentStack:null,exceptionEvent:null,error:null},mM={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){hM(t,e);function t(n){var r=e.call(this,n)||this;return r.state=gM,r}return t.prototype.componentDidCatch=function(n,r){var i=this.props.additionalProperties,s;Df(i)?s=i(n,r):typeof i=="object"&&(s=i);var o=this.context.client,a=r.componentStack,l=o.captureException(vM(n,a),s);this.setState({error:n,componentStack:a??null,exceptionEvent:l})},t.prototype.render=function(){var n=this.props,r=n.children,i=n.fallback,s=this.state;if(s.componentStack==null)return Df(r)?r():r;var o=Df(i)?q.createElement(i,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):i;return q.isValidElement(o)?o:(console.warn(mM.INVALID_FALLBACK),q.createElement(q.Fragment,null))},t.contextType=dM,t})(q.Component);uM(lM);class fS extends q.Component{constructor(){super(...arguments);kr(this,"state",{failed:!1,resetKey:this.props.resetKey})}static getDerivedStateFromError(){return{failed:!0}}static getDerivedStateFromProps(n,r){return n.resetKey===r.resetKey?null:{failed:!1,resetKey:n.resetKey}}componentDidCatch(n){console.error("The application could not render",n)}render(){if(!this.state.failed)return this.props.children;const n=w.jsxs("div",{className:"page",role:"alert",children:[w.jsx("h1",{children:"This page could not load"}),w.jsx("p",{children:"The site may have been updated while this tab was open."}),w.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>window.location.reload(),children:"Reload page"})]});return this.props.resetKey===void 0?w.jsx("main",{children:n}):n}}const zf="pwc:chunk-reload-at",hS=6e4;function yM(e,t){if(!e)return!0;const n=Number(e);return!Number.isFinite(n)||t-n>=hS}function _M(){if(typeof window>"u")return()=>{};const e=n=>{const r=Date.now();yM(sessionStorage.getItem(zf),r)&&(n.preventDefault(),sessionStorage.setItem(zf,String(r)),window.location.reload())};window.addEventListener("vite:preloadError",e);const t=window.setTimeout(()=>sessionStorage.removeItem(zf),hS);return()=>{window.removeEventListener("vite:preloadError",e),window.clearTimeout(t)}}const wM="modulepreload",xM=function(e){return"/"+e},H_={},ae=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=xM(l),l in H_)return;H_[l]=!0;const u=l.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${c}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":wM,u||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((f,m)=>{d.addEventListener("load",f),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})};/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function tl(){return tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function pd(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function SM(){return Math.random().toString(36).substr(2,8)}function K_(e,t){return{usr:e.state,key:e.key,idx:t}}function $c(e,t,n,r){return n===void 0&&(n=null),tl({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?is(t):t,{state:n,key:t&&t.key||r||SM()})}function nl(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function is(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function pS(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a=Qr.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(tl({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function d(){a=Qr.Pop;let y=c(),h=y==null?null:y-u;u=y,l&&l({action:a,location:p.location,delta:h})}function f(y,h){a=Qr.Push;let v=$c(p.location,y,h);n&&n(v,y),u=c()+1;let x=K_(v,u),b=p.createHref(v);try{o.pushState(x,"",b)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;i.location.assign(b)}s&&l&&l({action:a,location:p.location,delta:1})}function m(y,h){a=Qr.Replace;let v=$c(p.location,y,h);n&&n(v,y),u=c();let x=K_(v,u),b=p.createHref(v);o.replaceState(x,"",b),s&&l&&l({action:a,location:p.location,delta:0})}function _(y){let h=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof y=="string"?y:nl(y);return v=v.replace(/ $/,"%20"),Ue(h,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,h)}let p={get action(){return a},get location(){return e(i,o)},listen(y){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(G_,d),l=y,()=>{i.removeEventListener(G_,d),l=null}},createHref(y){return t(i,y)},createURL:_,encodeLocation(y){let h=_(y);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:f,replace:m,go(y){return o.go(y)}};return p}var Q_;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Q_||(Q_={}));function CM(e,t,n){return n===void 0&&(n="/"),kM(e,t,n)}function kM(e,t,n,r){let i=typeof t=="string"?is(t):t,s=Po(i.pathname||"/",n);if(s==null)return null;let o=vS(e);PM(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(Ue(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=ii([r,l.relativePath]),c=n.concat(l);s.children&&s.children.length>0&&(Ue(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),vS(s.children,t,c,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:NM(u,s.index),routesMeta:c})};return e.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of gS(s.path))i(s,o,l)}),t}function gS(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=gS(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function PM(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:$M(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const RM=/^:[\w-]+$/,TM=3,IM=2,OM=1,MM=10,AM=-2,Y_=e=>e==="*";function NM(e,t){let n=e.split("/"),r=n.length;return n.some(Y_)&&(r+=AM),t&&(r+=IM),n.filter(i=>!Y_(i)).reduce((i,s)=>i+(RM.test(s)?TM:s===""?OM:MM),r)}function $M(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function FM(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let a=0;a{let{paramName:f,isOptional:m}=c;if(f==="*"){let p=a[d]||"";o=s.slice(0,s.length-p.length).replace(/(.)\/+$/,"$1")}const _=a[d];return m&&!_?u[f]=void 0:u[f]=(_||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:e}}function LM(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),pd(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function jM(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return pd(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Po(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const DM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zM=e=>DM.test(e);function UM(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?is(e):e,s;if(n)if(zM(n))s=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),pd(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?s=X_(n.substring(1),"/"):s=X_(n,t)}else s=t;return{pathname:s,search:qM(r),hash:WM(i)}}function X_(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Uf(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function VM(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Ig(e,t){let n=VM(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Og(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=is(e):(i=tl({},e),Ue(!i.pathname||!i.pathname.includes("?"),Uf("?","pathname","search",i)),Ue(!i.pathname||!i.pathname.includes("#"),Uf("#","pathname","hash",i)),Ue(!i.search||!i.search.includes("#"),Uf("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let d=t.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}a=d>=0?t[d]:"/"}let l=UM(i,a),u=o&&o!=="/"&&o.endsWith("/"),c=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const ii=e=>e.join("/").replace(/\/\/+/g,"/"),BM=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),qM=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,WM=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function HM(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const mS=["post","put","patch","delete"];new Set(mS);const GM=["get",...mS];new Set(GM);/** + * React Router v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function rl(){return rl=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),g.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let d=Og(u,JSON.parse(o),s,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:ii([t,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[t,r,o,s,e])}const YM=g.createContext(null);function XM(e){let t=g.useContext(Gn).outlet;return t&&g.createElement(YM.Provider,{value:e},t)}function xS(){let{matches:e}=g.useContext(Gn),t=e[e.length-1];return t?t.params:{}}function md(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=g.useContext(xr),{matches:i}=g.useContext(Gn),{pathname:s}=hn(),o=JSON.stringify(Ig(i,r.v7_relativeSplatPath));return g.useMemo(()=>Og(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function JM(e,t){return ZM(e,t)}function ZM(e,t,n,r){No()||Ue(!1);let{navigator:i}=g.useContext(xr),{matches:s}=g.useContext(Gn),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=hn(),c;if(t){var d;let y=typeof t=="string"?is(t):t;l==="/"||(d=y.pathname)!=null&&d.startsWith(l)||Ue(!1),c=y}else c=u;let f=c.pathname||"/",m=f;if(l!=="/"){let y=l.replace(/^\//,"").split("/");m="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let _=CM(e,{pathname:m}),p=iA(_&&_.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:ii([l,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:ii([l,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),s,n,r);return t&&p?g.createElement(gd.Provider,{value:{location:rl({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Qr.Pop}},p):p}function eA(){let e=lA(),t=HM(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:i},n):null,null)}const tA=g.createElement(eA,null);class nA extends g.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?g.createElement(Gn.Provider,{value:this.props.routeContext},g.createElement(_S.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function rA(e){let{routeContext:t,match:n,children:r}=e,i=g.useContext(vd);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),g.createElement(Gn.Provider,{value:t},r)}function iA(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=(i=n)==null?void 0:i.errors;if(a!=null){let c=o.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);c>=0||Ue(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,d,f)=>{let m,_=!1,p=null,y=null;n&&(m=a&&d.route.id?a[d.route.id]:void 0,p=d.route.errorElement||tA,l&&(u<0&&f===0?(cA("route-fallback"),_=!0,y=null):u===f&&(_=!0,y=d.route.hydrateFallbackElement||null)));let h=t.concat(o.slice(0,f+1)),v=()=>{let x;return m?x=p:_?x=y:d.route.Component?x=g.createElement(d.route.Component,null):d.route.element?x=d.route.element:x=c,g.createElement(rA,{match:d,routeContext:{outlet:c,matches:h,isDataRoute:n!=null},children:x})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?g.createElement(nA,{location:n.location,revalidation:n.revalidation,component:p,error:m,children:v(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):v()},null)}var bS=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(bS||{}),ES=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(ES||{});function sA(e){let t=g.useContext(vd);return t||Ue(!1),t}function oA(e){let t=g.useContext(yS);return t||Ue(!1),t}function aA(e){let t=g.useContext(Gn);return t||Ue(!1),t}function SS(e){let t=aA(),n=t.matches[t.matches.length-1];return n.route.id||Ue(!1),n.route.id}function lA(){var e;let t=g.useContext(_S),n=oA(),r=SS();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function uA(){let{router:e}=sA(bS.UseNavigateStable),t=SS(ES.UseNavigateStable),n=g.useRef(!1);return wS(()=>{n.current=!0}),g.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,rl({fromRouteId:t},s)))},[e,t])}const J_={};function cA(e,t,n){J_[e]||(J_[e]=!0)}function CS(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Ro(e){let{to:t,replace:n,state:r,relative:i}=e;No()||Ue(!1);let{future:s,static:o}=g.useContext(xr),{matches:a}=g.useContext(Gn),{pathname:l}=hn(),u=Mg(),c=Og(t,Ig(a,s.v7_relativeSplatPath),l,i==="path"),d=JSON.stringify(c);return g.useEffect(()=>u(JSON.parse(d),{replace:n,state:r,relative:i}),[u,d,i,n,r]),null}function dA(e){return XM(e.context)}function re(e){Ue(!1)}function kS(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Qr.Pop,navigator:s,static:o=!1,future:a}=e;No()&&Ue(!1);let l=t.replace(/^\/*/,"/"),u=g.useMemo(()=>({basename:l,navigator:s,static:o,future:rl({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof r=="string"&&(r=is(r));let{pathname:c="/",search:d="",hash:f="",state:m=null,key:_="default"}=r,p=g.useMemo(()=>{let y=Po(c,l);return y==null?null:{location:{pathname:y,search:d,hash:f,state:m,key:_},navigationType:i}},[l,c,d,f,m,_,i]);return p==null?null:g.createElement(xr.Provider,{value:u},g.createElement(gd.Provider,{children:n,value:p}))}function fA(e){let{children:t,location:n}=e;return JM(Lp(t),n)}new Promise(()=>{});function Lp(e,t){t===void 0&&(t=[]);let n=[];return g.Children.forEach(e,(r,i)=>{if(!g.isValidElement(r))return;let s=[...t,i];if(r.type===g.Fragment){n.push.apply(n,Lp(r.props.children,s));return}r.type!==re&&Ue(!1),!r.props.index||!r.props.children||Ue(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Lp(r.props.children,s)),n.push(o)}),n}/** + * React Router DOM v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Fc(){return Fc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function hA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function pA(e,t){return e.button===0&&(!t||t==="_self")&&!hA(e)}function jp(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function vA(e,t){let n=jp(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const gA=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],mA=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],yA="6";try{window.__reactRouterVersion=yA}catch{}const _A=g.createContext({isTransitioning:!1}),wA="startTransition",Lc=Kc[wA];function xA(e){let{basename:t,children:n,future:r,window:i}=e,s=g.useRef();s.current==null&&(s.current=bM({window:i,v5Compat:!0}));let o=s.current,[a,l]=g.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=g.useCallback(d=>{u&&Lc?Lc(()=>l(d)):l(d)},[l,u]);return g.useLayoutEffect(()=>o.listen(c),[o,c]),g.useEffect(()=>CS(r),[r]),g.createElement(kS,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}function bA(e){let{basename:t,children:n,future:r,window:i}=e,s=g.useRef();s.current==null&&(s.current=EM({window:i,v5Compat:!0}));let o=s.current,[a,l]=g.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=g.useCallback(d=>{u&&Lc?Lc(()=>l(d)):l(d)},[l,u]);return g.useLayoutEffect(()=>o.listen(c),[o,c]),g.useEffect(()=>CS(r),[r]),g.createElement(kS,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const EA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",SA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bn=g.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:a,target:l,to:u,preventScrollReset:c,viewTransition:d}=t,f=PS(t,gA),{basename:m}=g.useContext(xr),_,p=!1;if(typeof u=="string"&&SA.test(u)&&(_=u,EA))try{let x=new URL(window.location.href),b=u.startsWith("//")?new URL(x.protocol+u):new URL(u),E=Po(b.pathname,m);b.origin===x.origin&&E!=null?u=E+b.search+b.hash:p=!0}catch{}let y=KM(u,{relative:i}),h=kA(u,{replace:o,state:a,target:l,preventScrollReset:c,relative:i,viewTransition:d});function v(x){r&&r(x),x.defaultPrevented||h(x)}return g.createElement("a",Fc({},f,{href:_||y,onClick:p||s?r:v,ref:n,target:l}))}),ms=g.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:i=!1,className:s="",end:o=!1,style:a,to:l,viewTransition:u,children:c}=t,d=PS(t,mA),f=md(l,{relative:d.relative}),m=hn(),_=g.useContext(yS),{navigator:p,basename:y}=g.useContext(xr),h=_!=null&&PA(f)&&u===!0,v=p.encodeLocation?p.encodeLocation(f).pathname:f.pathname,x=m.pathname,b=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;i||(x=x.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&y&&(b=Po(b,y)||b);const E=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let S=x===v||!o&&x.startsWith(v)&&x.charAt(E)==="/",P=b!=null&&(b===v||!o&&b.startsWith(v)&&b.charAt(v.length)==="/"),C={isActive:S,isPending:P,isTransitioning:h},T=S?r:void 0,R;typeof s=="function"?R=s(C):R=[s,S?"active":null,P?"pending":null,h?"transitioning":null].filter(Boolean).join(" ");let N=typeof a=="function"?a(C):a;return g.createElement(bn,Fc({},d,{"aria-current":T,className:R,ref:n,style:N,to:l,viewTransition:u}),typeof c=="function"?c(C):c)});var Dp;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Dp||(Dp={}));var Z_;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Z_||(Z_={}));function CA(e){let t=g.useContext(vd);return t||Ue(!1),t}function kA(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:a}=t===void 0?{}:t,l=Mg(),u=hn(),c=md(e,{relative:o});return g.useCallback(d=>{if(pA(d,n)){d.preventDefault();let f=r!==void 0?r:nl(u)===nl(c);l(e,{replace:f,state:i,preventScrollReset:s,relative:o,viewTransition:a})}},[u,l,c,r,i,n,e,s,o,a])}function iz(e){let t=g.useRef(jp(e)),n=g.useRef(!1),r=hn(),i=g.useMemo(()=>vA(r.search,n.current?null:t.current),[r.search]),s=Mg(),o=g.useCallback((a,l)=>{const u=jp(typeof a=="function"?a(i):a);n.current=!0,s("?"+u,l)},[s,i]);return[i,o]}function PA(e,t){t===void 0&&(t={});let n=g.useContext(_A);n==null&&Ue(!1);let{basename:r}=CA(Dp.useViewTransitionState),i=md(e,{relative:t.relative});if(!n.isTransitioning)return!1;let s=Po(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Po(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Fp(i.pathname,o)!=null||Fp(i.pathname,s)!=null}var El=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},$i,Dr,Zs,X0,RA=(X0=class extends El{constructor(){super();X(this,$i);X(this,Dr);X(this,Zs);H(this,Zs,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){k(this,Dr)||this.setEventListener(k(this,Zs))}onUnsubscribe(){var t;this.hasListeners()||((t=k(this,Dr))==null||t.call(this),H(this,Dr,void 0))}setEventListener(t){var n;H(this,Zs,t),(n=k(this,Dr))==null||n.call(this),H(this,Dr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){k(this,$i)!==t&&(H(this,$i,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof k(this,$i)=="boolean"?k(this,$i):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},$i=new WeakMap,Dr=new WeakMap,Zs=new WeakMap,X0),Ag=new RA,TA={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},zr,vv,J0,IA=(J0=class{constructor(){X(this,zr,TA);X(this,vv,!1)}setTimeoutProvider(e){H(this,zr,e)}setTimeout(e,t){return k(this,zr).setTimeout(e,t)}clearTimeout(e){k(this,zr).clearTimeout(e)}setInterval(e,t){return k(this,zr).setInterval(e,t)}clearInterval(e){k(this,zr).clearInterval(e)}},zr=new WeakMap,vv=new WeakMap,J0),Ni=new IA;function OA(e){setTimeout(e,0)}var MA=typeof window>"u"||"Deno"in globalThis;function At(){}function AA(e,t){return typeof e=="function"?e(t):e}function zp(e){return typeof e=="number"&&e>=0&&e!==1/0}function RS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function si(e,t){return typeof e=="function"?e(t):e}function Wt(e,t){return typeof e=="function"?e(t):e}function e0(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Ng(o,t.options))return!1}else if(!sl(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||s&&!s(t))}function t0(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(il(t.options.mutationKey)!==il(s))return!1}else if(!sl(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Ng(e,t){return((t==null?void 0:t.queryKeyHashFn)||il)(e)}function il(e){return JSON.stringify(e,(t,n)=>Vp(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function sl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>sl(e[n],t[n])):!1}var NA=Object.prototype.hasOwnProperty;function TS(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=n0(e)&&n0(t);if(!r&&!(Vp(e)&&Vp(t)))return t;const s=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,l=r?new Array(a):{};let u=0;for(let c=0;c{Ni.setTimeout(t,e)})}function Bp(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?TS(e,t):t}function FA(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function LA(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var $g=Symbol();function IS(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===$g?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function OS(e,t){return typeof e=="function"?e(...t):!!e}function jA(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var ol=(()=>{let e=()=>MA;return{isServer(){return e()},setIsServer(t){e=t}}})();function qp(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var DA=OA;function zA(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=DA;const s=a=>{t?e.push(a):i(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var at=zA(),eo,Ur,to,Z0,UA=(Z0=class extends El{constructor(){super();X(this,eo,!0);X(this,Ur);X(this,to);H(this,to,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){k(this,Ur)||this.setEventListener(k(this,to))}onUnsubscribe(){var t;this.hasListeners()||((t=k(this,Ur))==null||t.call(this),H(this,Ur,void 0))}setEventListener(t){var n;H(this,to,t),(n=k(this,Ur))==null||n.call(this),H(this,Ur,t(this.setOnline.bind(this)))}setOnline(t){k(this,eo)!==t&&(H(this,eo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return k(this,eo)}},eo=new WeakMap,Ur=new WeakMap,to=new WeakMap,Z0),jc=new UA;function VA(e){return Math.min(1e3*2**e,3e4)}function MS(e){return(e??"online")==="online"?jc.isOnline():!0}var Wp=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function AS(e){let t=!1,n=0,r;const i=qp(),s=()=>i.status!=="pending",o=p=>{var y;if(!s()){const h=new Wp(p);f(h),(y=e.onCancel)==null||y.call(e,h)}},a=()=>{t=!0},l=()=>{t=!1},u=()=>Ag.isFocused()&&(e.networkMode==="always"||jc.isOnline())&&e.canRun(),c=()=>MS(e.networkMode)&&e.canRun(),d=p=>{s()||(r==null||r(),i.resolve(p))},f=p=>{s()||(r==null||r(),i.reject(p))},m=()=>new Promise(p=>{var y;r=h=>{(s()||u())&&p(h)},(y=e.onPause)==null||y.call(e)}).then(()=>{var p;r=void 0,s()||(p=e.onContinue)==null||p.call(e)}),_=()=>{if(s())return;let p;const y=n===0?e.initialPromise:void 0;try{p=y??e.fn()}catch(h){p=Promise.reject(h)}Promise.resolve(p).then(d).catch(h=>{var S;if(s())return;const v=e.retry??(ol.isServer()?0:3),x=e.retryDelay??VA,b=typeof x=="function"?x(n,h):x,E=v===!0||typeof v=="number"&&nu()?void 0:m()).then(()=>{t?f(h):_()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?_():m().then(_),i)}}var Fi,ew,NS=(ew=class{constructor(){X(this,Fi)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zp(this.gcTime)&&H(this,Fi,Ni.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ol.isServer()?1/0:5*60*1e3))}clearGcTimeout(){k(this,Fi)!==void 0&&(Ni.clearTimeout(k(this,Fi)),H(this,Fi,void 0))}},Fi=new WeakMap,ew);function BA(e){return{onFetch:(t,n)=>{var c,d,f,m,_;const r=t.options,i=(f=(d=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,s=((m=t.state.data)==null?void 0:m.pages)||[],o=((_=t.state.data)==null?void 0:_.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let p=!1;const y=x=>{jA(x,()=>t.signal,()=>p=!0)},h=IS(t.options,t.fetchOptions),v=async(x,b,E)=>{if(p)return Promise.reject(t.signal.reason);if(b==null&&x.pages.length)return Promise.resolve(x);const P=(()=>{const N={client:t.client,queryKey:t.queryKey,pageParam:b,direction:E?"backward":"forward",meta:t.options.meta};return y(N),N})(),C=await h(P),{maxPages:T}=t.options,R=E?LA:FA;return{pages:R(x.pages,C,T),pageParams:R(x.pageParams,b,T)}};if(i&&s.length){const x=i==="backward",b=x?$S:Hp,E={pages:s,pageParams:o},S=b(r,E);a=await v(E,S,x)}else{const x=e??s.length;do{const b=l===0?o[0]??r.initialPageParam:Hp(r,a);if(l>0&&b==null)break;a=await v(a,b),l++}while(l{var p,y;return(y=(p=t.options).persister)==null?void 0:y.call(p,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Hp(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function $S(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function sz(e,t){return t?Hp(e,t)!=null:!1}function oz(e,t){return!t||!e.getPreviousPageParam?!1:$S(e,t)!=null}var no,Li,ro,nn,ji,tt,dl,Di,Bt,FS,Zn,tw,qA=(tw=class extends NS{constructor(t){super();X(this,Bt);X(this,no);X(this,Li);X(this,ro);X(this,nn);X(this,ji);X(this,tt);X(this,dl);X(this,Di);H(this,Di,!1),H(this,dl,t.defaultOptions),this.setOptions(t.options),this.observers=[],H(this,ji,t.client),H(this,nn,k(this,ji).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,H(this,Li,s0(this.options)),this.state=t.state??k(this,Li),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return k(this,no)}get promise(){var t;return(t=k(this,tt))==null?void 0:t.promise}setOptions(t){if(this.options={...k(this,dl),...t},t!=null&&t._type&&H(this,no,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=s0(this.options);n.data!==void 0&&(this.setState(i0(n.data,n.dataUpdatedAt)),H(this,Li,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&k(this,nn).remove(this)}setData(t,n){const r=Bp(this.state.data,t,this.options);return ue(this,Bt,Zn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){ue(this,Bt,Zn).call(this,{type:"setState",state:t})}cancel(t){var r,i;const n=(r=k(this,tt))==null?void 0:r.promise;return(i=k(this,tt))==null||i.cancel(t),n?n.then(At).catch(At):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return k(this,Li)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Wt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$g||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>si(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!RS(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=k(this,tt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=k(this,tt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),k(this,nn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(k(this,tt)&&(k(this,Di)||ue(this,Bt,FS).call(this)?k(this,tt).cancel({revert:!0}):k(this,tt).cancelRetry()),this.scheduleGc()),k(this,nn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ue(this,Bt,Zn).call(this,{type:"invalidate"})}async fetch(t,n){var u,c,d,f,m,_,p,y,h,v,x;if(this.state.fetchStatus!=="idle"&&((u=k(this,tt))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(k(this,tt))return k(this,tt).continueRetry(),k(this,tt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const b=this.observers.find(E=>E.options.queryFn);b&&this.setOptions(b.options)}const r=new AbortController,i=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(H(this,Di,!0),r.signal)})},s=()=>{const b=IS(this.options,n),S=(()=>{const P={client:k(this,ji),queryKey:this.queryKey,meta:this.meta};return i(P),P})();return H(this,Di,!1),this.options.persister?this.options.persister(b,S,this):b(S)},a=(()=>{const b={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:k(this,ji),state:this.state,fetchFn:s};return i(b),b})(),l=k(this,no)==="infinite"?BA(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),H(this,ro,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&ue(this,Bt,Zn).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),H(this,tt,AS({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:b=>{b instanceof Wp&&b.revert&&this.setState({...k(this,ro),fetchStatus:"idle"}),r.abort()},onFail:(b,E)=>{ue(this,Bt,Zn).call(this,{type:"failed",failureCount:b,error:E})},onPause:()=>{ue(this,Bt,Zn).call(this,{type:"pause"})},onContinue:()=>{ue(this,Bt,Zn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const b=await k(this,tt).start();if(b===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(b),(m=(f=k(this,nn).config).onSuccess)==null||m.call(f,b,this),(p=(_=k(this,nn).config).onSettled)==null||p.call(_,b,this.state.error,this),b}catch(b){if(b instanceof Wp){if(b.silent)return k(this,tt).promise;if(b.revert){if(this.state.data===void 0)throw b;return this.state.data}}throw ue(this,Bt,Zn).call(this,{type:"error",error:b}),(h=(y=k(this,nn).config).onError)==null||h.call(y,b,this),(x=(v=k(this,nn).config).onSettled)==null||x.call(v,this.state.data,b,this),b}finally{this.scheduleGc()}}},no=new WeakMap,Li=new WeakMap,ro=new WeakMap,nn=new WeakMap,ji=new WeakMap,tt=new WeakMap,dl=new WeakMap,Di=new WeakMap,Bt=new WeakSet,FS=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Zn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...LS(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...i0(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return H(this,ro,t.manual?i:void 0),i;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),at.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),k(this,nn).notify({query:this,type:"updated",action:t})})},tw);function LS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:MS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function i0(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function s0(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ot,fe,fl,xt,zi,io,sr,Vr,hl,so,oo,Ui,Vi,Br,ao,me,ha,Gp,Kp,Qp,Yp,Xp,Jp,Zp,jS,nw,WA=(nw=class extends El{constructor(t,n){super();X(this,me);X(this,Ot);X(this,fe);X(this,fl);X(this,xt);X(this,zi);X(this,io);X(this,sr);X(this,Vr);X(this,hl);X(this,so);X(this,oo);X(this,Ui);X(this,Vi);X(this,Br);X(this,ao,new Set);this.options=n,H(this,Ot,t),H(this,Vr,null),H(this,sr,qp()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(k(this,fe).addObserver(this),o0(k(this,fe),this.options)?ue(this,me,ha).call(this):this.updateResult(),ue(this,me,Yp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ev(k(this,fe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ev(k(this,fe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ue(this,me,Xp).call(this),ue(this,me,Jp).call(this),k(this,fe).removeObserver(this)}setOptions(t){const n=this.options,r=k(this,fe);if(this.options=k(this,Ot).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Wt(this.options.enabled,k(this,fe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ue(this,me,Zp).call(this),k(this,fe).setOptions(this.options),n._defaulted&&!Up(this.options,n)&&k(this,Ot).getQueryCache().notify({type:"observerOptionsUpdated",query:k(this,fe),observer:this});const i=this.hasListeners();i&&a0(k(this,fe),r,this.options,n)&&ue(this,me,ha).call(this),this.updateResult(),i&&(k(this,fe)!==r||Wt(this.options.enabled,k(this,fe))!==Wt(n.enabled,k(this,fe))||si(this.options.staleTime,k(this,fe))!==si(n.staleTime,k(this,fe)))&&ue(this,me,Gp).call(this);const s=ue(this,me,Kp).call(this);i&&(k(this,fe)!==r||Wt(this.options.enabled,k(this,fe))!==Wt(n.enabled,k(this,fe))||s!==k(this,Br))&&ue(this,me,Qp).call(this,s)}getOptimisticResult(t){const n=k(this,Ot).getQueryCache().build(k(this,Ot),t),r=this.createResult(n,t);return GA(this,r)&&(H(this,xt,r),H(this,io,this.options),H(this,zi,k(this,fe).state)),r}getCurrentResult(){return k(this,xt)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&k(this,sr).status==="pending"&&k(this,sr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){k(this,ao).add(t)}getCurrentQuery(){return k(this,fe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=k(this,Ot).defaultQueryOptions(t),r=k(this,Ot).getQueryCache().build(k(this,Ot),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ue(this,me,ha).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),k(this,xt)))}createResult(t,n){var T;const r=k(this,fe),i=this.options,s=k(this,xt),o=k(this,zi),a=k(this,io),u=t!==r?t.state:k(this,fl),{state:c}=t;let d={...c},f=!1,m;if(n._optimisticResults){const R=this.hasListeners(),N=!R&&o0(t,n),M=R&&a0(t,r,n,i);(N||M)&&(d={...d,...LS(c.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:_,errorUpdatedAt:p,status:y}=d;m=d.data;let h=!1;if(n.placeholderData!==void 0&&m===void 0&&y==="pending"){let R;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(R=s.data,h=!0):R=typeof n.placeholderData=="function"?n.placeholderData((T=k(this,oo))==null?void 0:T.state.data,k(this,oo)):n.placeholderData,R!==void 0&&(y="success",m=Bp(s==null?void 0:s.data,R,n),f=!0)}if(n.select&&m!==void 0&&!h)if(s&&m===(o==null?void 0:o.data)&&n.select===k(this,hl))m=k(this,so);else try{H(this,hl,n.select),m=n.select(m),m=Bp(s==null?void 0:s.data,m,n),H(this,so,m),H(this,Vr,null)}catch(R){H(this,Vr,R)}k(this,Vr)&&(_=k(this,Vr),m=k(this,so),p=Date.now(),y="error");const v=d.fetchStatus==="fetching",x=y==="pending",b=y==="error",E=x&&v,S=m!==void 0,C={status:y,fetchStatus:d.fetchStatus,isPending:x,isSuccess:y==="success",isError:b,isInitialLoading:E,isLoading:E,data:m,dataUpdatedAt:d.dataUpdatedAt,error:_,errorUpdatedAt:p,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:v,isRefetching:v&&!x,isLoadingError:b&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:b&&S,isStale:Fg(t,n),refetch:this.refetch,promise:k(this,sr),isEnabled:Wt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=C.data!==void 0,N=C.status==="error"&&!R,M=W=>{N?W.reject(C.error):R&&W.resolve(C.data)},z=()=>{const W=H(this,sr,C.promise=qp());M(W)},F=k(this,sr);switch(F.status){case"pending":t.queryHash===r.queryHash&&M(F);break;case"fulfilled":(N||C.data!==F.value)&&z();break;case"rejected":(!N||C.error!==F.reason)&&z();break}}return C}updateResult(){const t=k(this,xt),n=this.createResult(k(this,fe),this.options);if(H(this,zi,k(this,fe).state),H(this,io,this.options),k(this,zi).data!==void 0&&H(this,oo,k(this,fe)),Up(n,t))return;H(this,xt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!k(this,ao).size)return!0;const o=new Set(s??k(this,ao));return this.options.throwOnError&&o.add("error"),Object.keys(k(this,xt)).some(a=>{const l=a;return k(this,xt)[l]!==t[l]&&o.has(l)})};ue(this,me,jS).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ue(this,me,Yp).call(this)}},Ot=new WeakMap,fe=new WeakMap,fl=new WeakMap,xt=new WeakMap,zi=new WeakMap,io=new WeakMap,sr=new WeakMap,Vr=new WeakMap,hl=new WeakMap,so=new WeakMap,oo=new WeakMap,Ui=new WeakMap,Vi=new WeakMap,Br=new WeakMap,ao=new WeakMap,me=new WeakSet,ha=function(t){ue(this,me,Zp).call(this);let n=k(this,fe).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(At)),n},Gp=function(){ue(this,me,Xp).call(this);const t=si(this.options.staleTime,k(this,fe));if(ol.isServer()||k(this,xt).isStale||!zp(t))return;const r=RS(k(this,xt).dataUpdatedAt,t)+1;H(this,Ui,Ni.setTimeout(()=>{k(this,xt).isStale||this.updateResult()},r))},Kp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(k(this,fe)):this.options.refetchInterval)??!1},Qp=function(t){ue(this,me,Jp).call(this),H(this,Br,t),!(ol.isServer()||Wt(this.options.enabled,k(this,fe))===!1||!zp(k(this,Br))||k(this,Br)===0)&&H(this,Vi,Ni.setInterval(()=>{(this.options.refetchIntervalInBackground||Ag.isFocused())&&ue(this,me,ha).call(this)},k(this,Br)))},Yp=function(){ue(this,me,Gp).call(this),ue(this,me,Qp).call(this,ue(this,me,Kp).call(this))},Xp=function(){k(this,Ui)!==void 0&&(Ni.clearTimeout(k(this,Ui)),H(this,Ui,void 0))},Jp=function(){k(this,Vi)!==void 0&&(Ni.clearInterval(k(this,Vi)),H(this,Vi,void 0))},Zp=function(){const t=k(this,Ot).getQueryCache().build(k(this,Ot),this.options);if(t===k(this,fe))return;const n=k(this,fe);H(this,fe,t),H(this,fl,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},jS=function(t){at.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(k(this,xt))}),k(this,Ot).getQueryCache().notify({query:k(this,fe),type:"observerResultsUpdated"})})},nw);function HA(e,t){return Wt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Wt(t.retryOnMount,e)===!1)}function o0(e,t){return HA(e,t)||e.state.data!==void 0&&ev(e,t,t.refetchOnMount)}function ev(e,t,n){if(Wt(t.enabled,e)!==!1&&si(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Fg(e,t)}return!1}function a0(e,t,n,r){return(e!==t||Wt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Fg(e,n)}function Fg(e,t){return Wt(t.enabled,e)!==!1&&e.isStaleByTime(si(t.staleTime,e))}function GA(e,t){return!Up(e.getCurrentResult(),t)}var pl,Fn,pt,Bi,Ln,Ar,rw,KA=(rw=class extends NS{constructor(t){super();X(this,Ln);X(this,pl);X(this,Fn);X(this,pt);X(this,Bi);H(this,pl,t.client),this.mutationId=t.mutationId,H(this,pt,t.mutationCache),H(this,Fn,[]),this.state=t.state||QA(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){k(this,Fn).includes(t)||(k(this,Fn).push(t),this.clearGcTimeout(),k(this,pt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){H(this,Fn,k(this,Fn).filter(n=>n!==t)),this.scheduleGc(),k(this,pt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){k(this,Fn).length||(this.state.status==="pending"?this.scheduleGc():k(this,pt).remove(this))}continue(){var t;return((t=k(this,Bi))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,u,c,d,f,m,_,p,y,h,v,x,b,E,S,P;const n=()=>{ue(this,Ln,Ar).call(this,{type:"continue"})},r={client:k(this,pl),meta:this.options.meta,mutationKey:this.options.mutationKey};H(this,Bi,AS({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(C,T)=>{ue(this,Ln,Ar).call(this,{type:"failed",failureCount:C,error:T})},onPause:()=>{ue(this,Ln,Ar).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>k(this,pt).canRun(this)}));const i=this.state.status==="pending",s=!k(this,Bi).canStart();try{if(i)n();else{ue(this,Ln,Ar).call(this,{type:"pending",variables:t,isPaused:s}),k(this,pt).config.onMutate&&await k(this,pt).config.onMutate(t,this,r);const T=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));T!==this.state.context&&ue(this,Ln,Ar).call(this,{type:"pending",context:T,variables:t,isPaused:s})}const C=await k(this,Bi).start();return await((u=(l=k(this,pt).config).onSuccess)==null?void 0:u.call(l,C,t,this.state.context,this,r)),await((d=(c=this.options).onSuccess)==null?void 0:d.call(c,C,t,this.state.context,r)),await((m=(f=k(this,pt).config).onSettled)==null?void 0:m.call(f,C,null,this.state.variables,this.state.context,this,r)),await((p=(_=this.options).onSettled)==null?void 0:p.call(_,C,null,t,this.state.context,r)),ue(this,Ln,Ar).call(this,{type:"success",data:C}),C}catch(C){try{await((h=(y=k(this,pt).config).onError)==null?void 0:h.call(y,C,t,this.state.context,this,r))}catch(T){Promise.reject(T)}try{await((x=(v=this.options).onError)==null?void 0:x.call(v,C,t,this.state.context,r))}catch(T){Promise.reject(T)}try{await((E=(b=k(this,pt).config).onSettled)==null?void 0:E.call(b,void 0,C,this.state.variables,this.state.context,this,r))}catch(T){Promise.reject(T)}try{await((P=(S=this.options).onSettled)==null?void 0:P.call(S,void 0,C,t,this.state.context,r))}catch(T){Promise.reject(T)}throw ue(this,Ln,Ar).call(this,{type:"error",error:C}),C}finally{k(this,pt).runNext(this)}}},pl=new WeakMap,Fn=new WeakMap,pt=new WeakMap,Bi=new WeakMap,Ln=new WeakSet,Ar=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),at.batch(()=>{k(this,Fn).forEach(r=>{r.onMutationUpdate(t)}),k(this,pt).notify({mutation:this,type:"updated",action:t})})},rw);function QA(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var or,_n,vl,iw,YA=(iw=class extends El{constructor(t={}){super();X(this,or);X(this,_n);X(this,vl);this.config=t,H(this,or,new Set),H(this,_n,new Map),H(this,vl,0)}build(t,n,r){const i=new KA({client:t,mutationCache:this,mutationId:++Tl(this,vl)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){k(this,or).add(t);const n=su(t);if(typeof n=="string"){const r=k(this,_n).get(n);r?r.push(t):k(this,_n).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(k(this,or).delete(t)){const n=su(t);if(typeof n=="string"){const r=k(this,_n).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&k(this,_n).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=su(t);if(typeof n=="string"){const r=k(this,_n).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=su(t);if(typeof n=="string"){const i=(r=k(this,_n).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){at.batch(()=>{k(this,or).forEach(t=>{this.notify({type:"removed",mutation:t})}),k(this,or).clear(),k(this,_n).clear()})}getAll(){return Array.from(k(this,or))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>t0(n,r))}findAll(t={}){return this.getAll().filter(n=>t0(t,n))}notify(t){at.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return at.batch(()=>Promise.all(t.map(n=>n.continue().catch(At))))}},or=new WeakMap,_n=new WeakMap,vl=new WeakMap,iw);function su(e){var t;return(t=e.options.scope)==null?void 0:t.id}var jn,sw,XA=(sw=class extends El{constructor(t={}){super();X(this,jn);this.config=t,H(this,jn,new Map)}build(t,n,r){const i=n.queryKey,s=n.queryHash??Ng(i,n);let o=this.get(s);return o||(o=new qA({client:t,queryKey:i,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){k(this,jn).has(t.queryHash)||(k(this,jn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=k(this,jn).get(t.queryHash);n&&(t.destroy(),n===t&&k(this,jn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){at.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return k(this,jn).get(t)}getAll(){return[...k(this,jn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>e0(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>e0(t,r)):n}notify(t){at.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){at.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){at.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},jn=new WeakMap,sw),qe,qr,Wr,lo,uo,Hr,co,fo,ow,JA=(ow=class{constructor(e={}){X(this,qe);X(this,qr);X(this,Wr);X(this,lo);X(this,uo);X(this,Hr);X(this,co);X(this,fo);H(this,qe,e.queryCache||new XA),H(this,qr,e.mutationCache||new YA),H(this,Wr,e.defaultOptions||{}),H(this,lo,new Map),H(this,uo,new Map),H(this,Hr,0)}mount(){Tl(this,Hr)._++,k(this,Hr)===1&&(H(this,co,Ag.subscribe(async e=>{e&&(await this.resumePausedMutations(),k(this,qe).onFocus())})),H(this,fo,jc.subscribe(async e=>{e&&(await this.resumePausedMutations(),k(this,qe).onOnline())})))}unmount(){var e,t;Tl(this,Hr)._--,k(this,Hr)===0&&((e=k(this,co))==null||e.call(this),H(this,co,void 0),(t=k(this,fo))==null||t.call(this),H(this,fo,void 0))}isFetching(e){return k(this,qe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return k(this,qr).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=k(this,qe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=k(this,qe).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(si(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return k(this,qe).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=k(this,qe).get(r.queryHash),s=i==null?void 0:i.state.data,o=AA(t,s);if(o!==void 0)return k(this,qe).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return at.batch(()=>k(this,qe).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=k(this,qe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=k(this,qe);at.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=k(this,qe);return at.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=at.batch(()=>k(this,qe).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(At).catch(At)}invalidateQueries(e,t={}){return at.batch(()=>(k(this,qe).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=at.batch(()=>k(this,qe).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(At)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(At)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=k(this,qe).build(this,t);return n.isStaleByTime(si(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(At).catch(At)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(At).catch(At)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return jc.isOnline()?k(this,qr).resumePausedMutations():Promise.resolve()}getQueryCache(){return k(this,qe)}getMutationCache(){return k(this,qr)}getDefaultOptions(){return k(this,Wr)}setDefaultOptions(e){H(this,Wr,e)}setQueryDefaults(e,t){k(this,lo).set(il(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...k(this,lo).values()],n={};return t.forEach(r=>{sl(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){k(this,uo).set(il(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...k(this,uo).values()],n={};return t.forEach(r=>{sl(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...k(this,Wr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ng(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===$g&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...k(this,Wr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){k(this,qe).clear(),k(this,qr).clear()}},qe=new WeakMap,qr=new WeakMap,Wr=new WeakMap,lo=new WeakMap,uo=new WeakMap,Hr=new WeakMap,co=new WeakMap,fo=new WeakMap,ow),DS=g.createContext(void 0),zS=e=>{const t=g.useContext(DS);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ZA=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),w.jsx(DS.Provider,{value:e,children:t})),US=g.createContext(!1),eN=()=>g.useContext(US);US.Provider;function tN(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var nN=g.createContext(tN()),rN=()=>g.useContext(nN),iN=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?OS(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},sN=e=>{g.useEffect(()=>{e.clearReset()},[e])},oN=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||OS(n,[e.error,r])),aN=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},lN=(e,t)=>e.isLoading&&e.isFetching&&!t,uN=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,l0=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function cN(e,t,n){var f,m,_,p;const r=eN(),i=rN(),s=zS(),o=s.defaultQueryOptions(e);(m=(f=s.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||m.call(f,o);const a=s.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",aN(o),iN(o,i,a),sN(i);const l=!s.getQueryCache().get(o.queryHash),[u]=g.useState(()=>new t(s,o)),c=u.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(g.useSyncExternalStore(g.useCallback(y=>{const h=d?u.subscribe(at.batchCalls(y)):At;return u.updateResult(),h},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),g.useEffect(()=>{u.setOptions(o)},[o,u]),uN(o,c))throw l0(o,u,i);if(oN({result:c,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw c.error;if((p=(_=s.getDefaultOptions().queries)==null?void 0:_._experimental_afterQuery)==null||p.call(_,o,c),o.experimental_prefetchInRender&&!ol.isServer()&&lN(c,r)){const y=l?l0(o,u,i):a==null?void 0:a.promise;y==null||y.catch(At).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?c:u.trackResult(c)}function dN(e,t){return cN(e,WA)}function ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function u0(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function vi(...e){return t=>{let n=!1;const r=e.map(i=>{const s=u0(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i{const{children:o,...a}=s,l=g.useMemo(()=>a,Object.values(a));return w.jsx(n.Provider,{value:l,children:o})};r.displayName=e+"Provider";function i(s){const o=g.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,i]}function ss(e,t=[]){let n=[];function r(s,o){const a=g.createContext(o),l=n.length;n=[...n,o];const u=d=>{var h;const{scope:f,children:m,..._}=d,p=((h=f==null?void 0:f[e])==null?void 0:h[l])||a,y=g.useMemo(()=>_,Object.values(_));return w.jsx(p.Provider,{value:y,children:m})};u.displayName=s+"Provider";function c(d,f){var p;const m=((p=f==null?void 0:f[e])==null?void 0:p[l])||a,_=g.useContext(m);if(_)return _;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,c]}const i=()=>{const s=n.map(o=>g.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,hN(i,...t)]}function hN(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:u})=>{const d=l(s)[`__scope${u}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var fn=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},pN=Kc[" useId ".trim().toString()]||(()=>{}),vN=0;function Qs(e){const[t,n]=g.useState(pN());return fn(()=>{n(r=>r??String(vN++))},[e]),t?`radix-${t}`:""}var gN=Kc[" useInsertionEffect ".trim().toString()]||fn;function yd({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,s,o]=mN({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const c=g.useRef(e!==void 0);g.useEffect(()=>{const d=c.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=a},[a,r])}const u=g.useCallback(c=>{var d;if(a){const f=yN(c)?c(e):c;f!==e&&((d=o.current)==null||d.call(o,f))}else s(c)},[a,e,s,o]);return[l,u]}function mN({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),i=g.useRef(n),s=g.useRef(t);return gN(()=>{s.current=t},[t]),g.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function yN(e){return typeof e=="function"}function _N(e){const t=wN(e),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(bN);if(l){const u=l.props.children,c=a.map(d=>d===l?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:d);return w.jsx(t,{...o,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,c):null})}return w.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function wN(e){const t=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=SN(i),a=EN(s,i.props);return i.type!==g.Fragment&&(a.ref=r?vi(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var xN=Symbol("radix.slottable");function bN(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xN}function EN(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function SN(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var CN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=CN.reduce((e,t)=>{const n=_N(`Primitive.${t}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Lg(e,t){e&&xl.flushSync(()=>e.dispatchEvent(t))}function Ut(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function kN(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e);g.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var PN="DismissableLayer",tv="dismissableLayer.update",RN="dismissableLayer.pointerDownOutside",TN="dismissableLayer.focusOutside",c0,VS=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_d=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=e,u=g.useContext(VS),[c,d]=g.useState(null),f=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=g.useState({}),_=et(t,P=>d(P)),p=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),h=p.indexOf(y),v=c?p.indexOf(c):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,b=v>=h,E=ON(P=>{const C=P.target,T=[...u.branches].some(R=>R.contains(C));!b||T||(i==null||i(P),o==null||o(P),P.defaultPrevented||a==null||a())},f),S=MN(P=>{const C=P.target;[...u.branches].some(R=>R.contains(C))||(s==null||s(P),o==null||o(P),P.defaultPrevented||a==null||a())},f);return kN(P=>{v===u.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&a&&(P.preventDefault(),a()))},f),g.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(c0=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),d0(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=c0)}},[c,f,n,u]),g.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),d0())},[c,u]),g.useEffect(()=>{const P=()=>m({});return document.addEventListener(tv,P),()=>document.removeEventListener(tv,P)},[]),w.jsx(ke.div,{...l,ref:_,style:{pointerEvents:x?b?"auto":"none":void 0,...e.style},onFocusCapture:ee(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ee(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ee(e.onPointerDownCapture,E.onPointerDownCapture)})});_d.displayName=PN;var IN="DismissableLayerBranch",BS=g.forwardRef((e,t)=>{const n=g.useContext(VS),r=g.useRef(null),i=et(t,r);return g.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),w.jsx(ke.div,{...e,ref:i})});BS.displayName=IN;function ON(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e),r=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){qS(RN,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function MN(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e),r=g.useRef(!1);return g.useEffect(()=>{const i=s=>{s.target&&!r.current&&qS(TN,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function d0(){const e=new CustomEvent(tv);document.dispatchEvent(e)}function qS(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lg(i,s):i.dispatchEvent(s)}var AN=_d,NN=BS,Vf="focusScope.autoFocusOnMount",Bf="focusScope.autoFocusOnUnmount",f0={bubbles:!1,cancelable:!0},$N="FocusScope",jg=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,l]=g.useState(null),u=Ut(i),c=Ut(s),d=g.useRef(null),f=et(t,p=>l(p)),m=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let p=function(x){if(m.paused||!a)return;const b=x.target;a.contains(b)?d.current=b:Nr(d.current,{select:!0})},y=function(x){if(m.paused||!a)return;const b=x.relatedTarget;b!==null&&(a.contains(b)||Nr(d.current,{select:!0}))},h=function(x){if(document.activeElement===document.body)for(const E of x)E.removedNodes.length>0&&Nr(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const v=new MutationObserver(h);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),v.disconnect()}}},[r,a,m.paused]),g.useEffect(()=>{if(a){p0.add(m);const p=document.activeElement;if(!a.contains(p)){const h=new CustomEvent(Vf,f0);a.addEventListener(Vf,u),a.dispatchEvent(h),h.defaultPrevented||(FN(UN(WS(a)),{select:!0}),document.activeElement===p&&Nr(a))}return()=>{a.removeEventListener(Vf,u),setTimeout(()=>{const h=new CustomEvent(Bf,f0);a.addEventListener(Bf,c),a.dispatchEvent(h),h.defaultPrevented||Nr(p??document.body,{select:!0}),a.removeEventListener(Bf,c),p0.remove(m)},0)}}},[a,u,c,m]);const _=g.useCallback(p=>{if(!n&&!r||m.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,h=document.activeElement;if(y&&h){const v=p.currentTarget,[x,b]=LN(v);x&&b?!p.shiftKey&&h===b?(p.preventDefault(),n&&Nr(x,{select:!0})):p.shiftKey&&h===x&&(p.preventDefault(),n&&Nr(b,{select:!0})):h===v&&p.preventDefault()}},[n,r,m.paused]);return w.jsx(ke.div,{tabIndex:-1,...o,ref:f,onKeyDown:_})});jg.displayName=$N;function FN(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Nr(r,{select:t}),document.activeElement!==n)return}function LN(e){const t=WS(e),n=h0(t,e),r=h0(t.reverse(),e);return[n,r]}function WS(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function h0(e,t){for(const n of e)if(!jN(n,{upTo:t}))return n}function jN(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function DN(e){return e instanceof HTMLInputElement&&"select"in e}function Nr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&DN(e)&&t&&e.select()}}var p0=zN();function zN(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=v0(e,t),e.unshift(t)},remove(t){var n;e=v0(e,t),(n=e[0])==null||n.resume()}}}function v0(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function UN(e){return e.filter(t=>t.tagName!=="A")}var VN="Portal",wd=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,s]=g.useState(!1);fn(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?gT.createPortal(w.jsx(ke.div,{...r,ref:t}),o):null});wd.displayName=VN;function BN(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var br=e=>{const{present:t,children:n}=e,r=qN(t),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=et(r.ref,WN(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:s}):null};br.displayName="Presence";function qN(e){const[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),s=g.useRef("none"),o=e?"mounted":"unmounted",[a,l]=BN(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=ou(r.current);s.current=a==="mounted"?u:"none"},[a]),fn(()=>{const u=r.current,c=i.current;if(c!==e){const f=s.current,m=ou(u);e?l("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&f!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),fn(()=>{if(t){let u;const c=t.ownerDocument.defaultView??window,d=m=>{const p=ou(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&p&&(l("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},f=m=>{m.target===t&&(s.current=ou(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{c.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function ou(e){return(e==null?void 0:e.animationName)||"none"}function WN(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var qf=0;function HS(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??g0()),document.body.insertAdjacentElement("beforeend",e[1]??g0()),qf++,()=>{qf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),qf--}},[])}function g0(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Un=function(){return Un=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return l$;var t=u$(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},d$=YS(),Ys="data-scroll-locked",f$=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),` + .`.concat(GN,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(a,"px ").concat(r,`; + } + body[`).concat(Ys,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(i,`px; + padding-top: `).concat(s,`px; + padding-right: `).concat(o,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(a,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(Nu,` { + right: `).concat(a,"px ").concat(r,`; + } + + .`).concat($u,` { + margin-right: `).concat(a,"px ").concat(r,`; + } + + .`).concat(Nu," .").concat(Nu,` { + right: 0 `).concat(r,`; + } + + .`).concat($u," .").concat($u,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Ys,`] { + `).concat(KN,": ").concat(a,`px; + } +`)},y0=function(){var e=parseInt(document.body.getAttribute(Ys)||"0",10);return isFinite(e)?e:0},h$=function(){g.useEffect(function(){return document.body.setAttribute(Ys,(y0()+1).toString()),function(){var e=y0()-1;e<=0?document.body.removeAttribute(Ys):document.body.setAttribute(Ys,e.toString())}},[])},p$=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;h$();var s=g.useMemo(function(){return c$(i)},[i]);return g.createElement(d$,{styles:f$(s,!t,i,n?"":"!important")})},nv=!1;if(typeof window<"u")try{var au=Object.defineProperty({},"passive",{get:function(){return nv=!0,!0}});window.addEventListener("test",au,au),window.removeEventListener("test",au,au)}catch{nv=!1}var ys=nv?{passive:!1}:!1,v$=function(e){return e.tagName==="TEXTAREA"},XS=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!v$(e)&&n[t]==="visible")},g$=function(e){return XS(e,"overflowY")},m$=function(e){return XS(e,"overflowX")},_0=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=JS(e,r);if(i){var s=ZS(e,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},y$=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},_$=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},JS=function(e,t){return e==="v"?g$(t):m$(t)},ZS=function(e,t){return e==="v"?y$(t):_$(t)},w$=function(e,t){return e==="h"&&t==="rtl"?-1:1},x$=function(e,t,n,r,i){var s=w$(e,window.getComputedStyle(t).direction),o=s*r,a=n.target,l=t.contains(a),u=!1,c=o>0,d=0,f=0;do{if(!a)break;var m=ZS(e,a),_=m[0],p=m[1],y=m[2],h=p-y-s*_;(_||h)&&JS(e,a)&&(d+=h,f+=_);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(c&&Math.abs(d)<1||!c&&Math.abs(f)<1)&&(u=!0),u},lu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},w0=function(e){return[e.deltaX,e.deltaY]},x0=function(e){return e&&"current"in e?e.current:e},b$=function(e,t){return e[0]===t[0]&&e[1]===t[1]},E$=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},S$=0,_s=[];function C$(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(S$++)[0],s=g.useState(YS)[0],o=g.useRef(e);g.useEffect(function(){o.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var p=HN([e.lockRef.current],(e.shards||[]).map(x0),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var h=lu(p),v=n.current,x="deltaX"in p?p.deltaX:v[0]-h[0],b="deltaY"in p?p.deltaY:v[1]-h[1],E,S=p.target,P=Math.abs(x)>Math.abs(b)?"h":"v";if("touches"in p&&P==="h"&&S.type==="range")return!1;var C=window.getSelection(),T=C&&C.anchorNode,R=T?T===S||T.contains(S):!1;if(R)return!1;var N=_0(P,S);if(!N)return!0;if(N?E=P:(E=P==="v"?"h":"v",N=_0(P,S)),!N)return!1;if(!r.current&&"changedTouches"in p&&(x||b)&&(r.current=E),!E)return!0;var M=r.current||E;return x$(M,y,p,M==="h"?x:b)},[]),l=g.useCallback(function(p){var y=p;if(!(!_s.length||_s[_s.length-1]!==s)){var h="deltaY"in y?w0(y):lu(y),v=t.current.filter(function(E){return E.name===y.type&&(E.target===y.target||y.target===E.shadowParent)&&b$(E.delta,h)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(x0).filter(Boolean).filter(function(E){return E.contains(y.target)}),b=x.length>0?a(y,x[0]):!o.current.noIsolation;b&&y.cancelable&&y.preventDefault()}}},[]),u=g.useCallback(function(p,y,h,v){var x={name:p,delta:y,target:h,should:v,shadowParent:k$(h)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(b){return b!==x})},1)},[]),c=g.useCallback(function(p){n.current=lu(p),r.current=void 0},[]),d=g.useCallback(function(p){u(p.type,w0(p),p.target,a(p,e.lockRef.current))},[]),f=g.useCallback(function(p){u(p.type,lu(p),p.target,a(p,e.lockRef.current))},[]);g.useEffect(function(){return _s.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,ys),document.addEventListener("touchmove",l,ys),document.addEventListener("touchstart",c,ys),function(){_s=_s.filter(function(p){return p!==s}),document.removeEventListener("wheel",l,ys),document.removeEventListener("touchmove",l,ys),document.removeEventListener("touchstart",c,ys)}},[]);var m=e.removeScrollBar,_=e.inert;return g.createElement(g.Fragment,null,_?g.createElement(s,{styles:E$(i)}):null,m?g.createElement(p$,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function k$(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const P$=t$(QS,C$);var Dg=g.forwardRef(function(e,t){return g.createElement(xd,Un({},e,{ref:t,sideCar:P$}))});Dg.classNames=xd.classNames;var R$=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ws=new WeakMap,uu=new WeakMap,cu={},Kf=0,e1=function(e){return e&&(e.host||e1(e.parentNode))},T$=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=e1(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},I$=function(e,t,n,r){var i=T$(t,Array.isArray(e)?e:[e]);cu[n]||(cu[n]=new WeakMap);var s=cu[n],o=[],a=new Set,l=new Set(i),u=function(d){!d||a.has(d)||(a.add(d),u(d.parentNode))};i.forEach(u);var c=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))c(f);else try{var m=f.getAttribute(r),_=m!==null&&m!=="false",p=(ws.get(f)||0)+1,y=(s.get(f)||0)+1;ws.set(f,p),s.set(f,y),o.push(f),p===1&&_&&uu.set(f,!0),y===1&&f.setAttribute(n,"true"),_||f.setAttribute(r,"true")}catch(h){console.error("aria-hidden: cannot operate on ",f,h)}})};return c(t),a.clear(),Kf++,function(){o.forEach(function(d){var f=ws.get(d)-1,m=s.get(d)-1;ws.set(d,f),s.set(d,m),f||(uu.has(d)||d.removeAttribute(r),uu.delete(d)),m||d.removeAttribute(n)}),Kf--,Kf||(ws=new WeakMap,ws=new WeakMap,uu=new WeakMap,cu={})}},t1=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=R$(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),I$(r,i,n,"aria-hidden")):function(){return null}};function O$(e){const t=M$(e),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(N$);if(l){const u=l.props.children,c=a.map(d=>d===l?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:d);return w.jsx(t,{...o,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,c):null})}return w.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function M$(e){const t=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=F$(i),a=$$(s,i.props);return i.type!==g.Fragment&&(a.ref=r?vi(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var A$=Symbol("radix.slottable");function N$(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===A$}function $$(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function F$(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bd="Dialog",[n1]=ss(bd),[L$,Tn]=n1(bd),r1=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=e,a=g.useRef(null),l=g.useRef(null),[u,c]=yd({prop:r,defaultProp:i??!1,onChange:s,caller:bd});return w.jsx(L$,{scope:t,triggerRef:a,contentRef:l,contentId:Qs(),titleId:Qs(),descriptionId:Qs(),open:u,onOpenChange:c,onOpenToggle:g.useCallback(()=>c(d=>!d),[c]),modal:o,children:n})};r1.displayName=bd;var i1="DialogTrigger",s1=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Tn(i1,n),s=et(t,i.triggerRef);return w.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Vg(i.open),...r,ref:s,onClick:ee(e.onClick,i.onOpenToggle)})});s1.displayName=i1;var zg="DialogPortal",[j$,o1]=n1(zg,{forceMount:void 0}),a1=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,s=Tn(zg,t);return w.jsx(j$,{scope:t,forceMount:n,children:g.Children.map(r,o=>w.jsx(br,{present:n||s.open,children:w.jsx(wd,{asChild:!0,container:i,children:o})}))})};a1.displayName=zg;var Dc="DialogOverlay",l1=g.forwardRef((e,t)=>{const n=o1(Dc,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=Tn(Dc,e.__scopeDialog);return s.modal?w.jsx(br,{present:r||s.open,children:w.jsx(z$,{...i,ref:t})}):null});l1.displayName=Dc;var D$=O$("DialogOverlay.RemoveScroll"),z$=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Tn(Dc,n);return w.jsx(Dg,{as:D$,allowPinchZoom:!0,shards:[i.contentRef],children:w.jsx(ke.div,{"data-state":Vg(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),es="DialogContent",u1=g.forwardRef((e,t)=>{const n=o1(es,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=Tn(es,e.__scopeDialog);return w.jsx(br,{present:r||s.open,children:s.modal?w.jsx(U$,{...i,ref:t}):w.jsx(V$,{...i,ref:t})})});u1.displayName=es;var U$=g.forwardRef((e,t)=>{const n=Tn(es,e.__scopeDialog),r=g.useRef(null),i=et(t,n.contentRef,r);return g.useEffect(()=>{const s=r.current;if(s)return t1(s)},[]),w.jsx(c1,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault())})}),V$=g.forwardRef((e,t)=>{const n=Tn(es,e.__scopeDialog),r=g.useRef(!1),i=g.useRef(!1);return w.jsx(c1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),c1=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=e,a=Tn(es,n),l=g.useRef(null),u=et(t,l);return HS(),w.jsxs(w.Fragment,{children:[w.jsx(jg,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:w.jsx(_d,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Vg(a.open),...o,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),w.jsxs(w.Fragment,{children:[w.jsx(B$,{titleId:a.titleId}),w.jsx(W$,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Ug="DialogTitle",d1=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Tn(Ug,n);return w.jsx(ke.h2,{id:i.titleId,...r,ref:t})});d1.displayName=Ug;var f1="DialogDescription",h1=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Tn(f1,n);return w.jsx(ke.p,{id:i.descriptionId,...r,ref:t})});h1.displayName=f1;var p1="DialogClose",v1=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Tn(p1,n);return w.jsx(ke.button,{type:"button",...r,ref:t,onClick:ee(e.onClick,()=>i.onOpenChange(!1))})});v1.displayName=p1;function Vg(e){return e?"open":"closed"}var g1="DialogTitleWarning",[az,m1]=fN(g1,{contentName:es,titleName:Ug,docsSlug:"dialog"}),B$=({titleId:e})=>{const t=m1(g1),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},q$="DialogDescriptionWarning",W$=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${m1(q$).contentName}}.`;return g.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},H$=r1,G$=s1,K$=a1,Q$=l1,Y$=u1,X$=d1,lz=h1,J$=v1;const b0=e=>e.endsWith("/")?e.slice(0,-1):e;function os(e){return["1","true","yes"].includes(String(e??"").trim().toLowerCase())}function Bg(){const e="https://paperswithcode.co".trim();if(!e)return"";try{const t=e.startsWith("http")?new URL(e):new URL(e,typeof window<"u"?window.location.origin:"http://localhost");return b0(t.origin)}catch{return b0(e)}}function Z$(e){const t=e.startsWith("/")?e:`/${e}`,n=Bg();return n?`${n}${t}`:t}function qg(e){const t=e.startsWith("/")?e:`/${e}`;return Z$(t)}function y1(e,t={}){const n=qg("/api/v1/auth/hf/login"),i=new URL(n,window.location.origin).origin===window.location.origin?e:new URL(e,window.location.origin).toString(),s=new URLSearchParams({return_to:i});return t.authorizeInference&&s.set("authorize_inference","true"),t.collectEmail&&s.set("collect_email","true"),t.authorizeBucket&&s.set("authorize_bucket","true"),t.bucketCreate&&s.set("bucket_create","true"),`${n}?${s.toString()}`}function eF(){return qg("/admin-dashboard")}function uz(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("blob:")||e.startsWith("//"))return e;if(e.startsWith("/")){const t=Bg();return t?`${t}${e}`:e}return e}function $o(){return os("1")}function al(){return os("0")}const tF="https://paperswithcode.co/chat";function nF(){return $o()&&!al()}function rF(){return os(void 0)}function cz(){return al()&&os(void 0)}function dz(){return os("0")}function fz(){return os("0")}function hz(){return typeof window<"u"&&window.location.hostname==="staging.paperswithcode.co"}function iF(){return os("1")}const sF="/hf-logo.svg?v=20260513b",E0=({size:e=14})=>w.jsx("img",{src:sF,alt:"",width:Math.round(e*95/88),height:e,"aria-hidden":"true",draggable:!1,style:{display:"block"}});function pz(e,t=!1){return y1(e,{authorizeInference:t})}const _1=({returnTo:e,compact:t=!1,label:n="Sign in",authorizeInference:r=!1,collectEmail:i=!1})=>{if($o())return null;const s=()=>{window.location.href=y1(e,{authorizeInference:r,collectEmail:i})};return t?w.jsx("button",{type:"button",className:"icon-btn","aria-label":"Sign in with Hugging Face",title:"Sign in with Hugging Face",onClick:s,children:w.jsx(E0,{size:16})}):w.jsxs("button",{type:"button",className:"hf-signin-btn",onClick:s,"aria-label":"Sign in with Hugging Face",children:[w.jsx(E0,{size:18}),w.jsx("span",{children:n})]})};function oF(e,t=[]){let n=[];function r(s,o){const a=g.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const u=d=>{var h;const{scope:f,children:m,..._}=d,p=((h=f==null?void 0:f[e])==null?void 0:h[l])||a,y=g.useMemo(()=>_,Object.values(_));return w.jsx(p.Provider,{value:y,children:m})};u.displayName=s+"Provider";function c(d,f){var p;const m=((p=f==null?void 0:f[e])==null?void 0:p[l])||a,_=g.useContext(m);if(_)return _;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,c]}const i=()=>{const s=n.map(o=>g.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,aF(i,...t)]}function aF(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:u})=>{const d=l(s)[`__scope${u}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var lF=Symbol.for("react.lazy"),zc=Kc[" use ".trim().toString()];function uF(e){return typeof e=="object"&&e!==null&&"then"in e}function w1(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===lF&&"_payload"in e&&uF(e._payload)}function x1(e){const t=cF(e),n=g.forwardRef((r,i)=>{let{children:s,...o}=r;w1(s)&&typeof zc=="function"&&(s=zc(s._payload));const a=g.Children.toArray(s),l=a.find(fF);if(l){const u=l.props.children,c=a.map(d=>d===l?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:d);return w.jsx(t,{...o,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,c):null})}return w.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}var vz=x1("Slot");function cF(e){const t=g.forwardRef((n,r)=>{let{children:i,...s}=n;if(w1(i)&&typeof zc=="function"&&(i=zc(i._payload)),g.isValidElement(i)){const o=pF(i),a=hF(s,i.props);return i.type!==g.Fragment&&(a.ref=r?vi(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dF=Symbol("radix.slottable");function fF(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dF}function hF(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function pF(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wg=vF.reduce((e,t)=>{const n=x1(`Primitive.${t}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),b1={exports:{}},E1={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var To=g;function gF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var mF=typeof Object.is=="function"?Object.is:gF,yF=To.useState,_F=To.useEffect,wF=To.useLayoutEffect,xF=To.useDebugValue;function bF(e,t){var n=t(),r=yF({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return wF(function(){i.value=n,i.getSnapshot=t,Qf(i)&&s({inst:i})},[e,n,t]),_F(function(){return Qf(i)&&s({inst:i}),e(function(){Qf(i)&&s({inst:i})})},[e]),xF(n),n}function Qf(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!mF(e,n)}catch{return!0}}function EF(e,t){return t()}var SF=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?EF:bF;E1.useSyncExternalStore=To.useSyncExternalStore!==void 0?To.useSyncExternalStore:SF;b1.exports=E1;var CF=b1.exports;function kF(){return CF.useSyncExternalStore(PF,()=>!0,()=>!1)}function PF(){return()=>{}}var Hg="Avatar",[RF]=oF(Hg),[TF,S1]=RF(Hg),C1=g.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[i,s]=g.useState("idle");return w.jsx(TF,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:w.jsx(Wg.span,{...r,ref:t})})});C1.displayName=Hg;var k1="AvatarImage",P1=g.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...s}=e,o=S1(k1,n),a=IF(r,s),l=Ut(u=>{i(u),o.onImageLoadingStatusChange(u)});return fn(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?w.jsx(Wg.img,{...s,ref:t,src:r}):null});P1.displayName=k1;var R1="AvatarFallback",T1=g.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...i}=e,s=S1(R1,n),[o,a]=g.useState(r===void 0);return g.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),o&&s.imageLoadingStatus!=="loaded"?w.jsx(Wg.span,{...i,ref:t}):null});T1.displayName=R1;function S0(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function IF(e,{referrerPolicy:t,crossOrigin:n}){const r=kF(),i=g.useRef(null),s=r?(i.current||(i.current=new window.Image),i.current):null,[o,a]=g.useState(()=>S0(s,e));return fn(()=>{a(S0(s,e))},[s,e]),fn(()=>{const l=d=>()=>{a(d)};if(!s)return;const u=l("loaded"),c=l("error");return s.addEventListener("load",u),s.addEventListener("error",c),t&&(s.referrerPolicy=t),typeof n=="string"&&(s.crossOrigin=n),()=>{s.removeEventListener("load",u),s.removeEventListener("error",c)}},[s,n,t]),o}var I1=C1,O1=P1,M1=T1;function A1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=AF(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const a=o.split(Gg);return a[0]===""&&a.length!==1&&a.shift(),$1(a,t)||MF(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},$1=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?$1(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const s=e.join(Gg);return(o=t.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},C0=/^\[(.+)\]$/,MF=e=>{if(C0.test(e)){const t=C0.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},AF=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return $F(Object.entries(e.classGroups),n).forEach(([s,o])=>{rv(o,r,s,t)}),r},rv=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const s=i===""?t:k0(t,i);s.classGroupId=n;return}if(typeof i=="function"){if(NF(i)){rv(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{rv(o,k0(t,s),n,r)})})},k0=(e,t)=>{let n=e;return t.split(Gg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},NF=e=>e.isThemeGetter,$F=(e,t)=>t?e.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[t+o,a])):s);return[n,i]}):e,FF=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},F1="!",LF=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],s=t.length,o=a=>{const l=[];let u=0,c=0,d;for(let y=0;yc?d-c:void 0;return{modifiers:l,hasImportantModifier:m,baseClassName:_,maybePostfixModifierPosition:p}};return n?a=>n({className:a,parseClassName:o}):o},jF=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},DF=e=>({cache:FF(e.cacheSize),parseClassName:LF(e),...OF(e)}),zF=/\s+/,UF=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,s=[],o=e.trim().split(zF);let a="";for(let l=o.length-1;l>=0;l-=1){const u=o[l],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:m}=n(u);let _=!!m,p=r(_?f.substring(0,m):f);if(!p){if(!_){a=u+(a.length>0?" "+a:a);continue}if(p=r(f),!p){a=u+(a.length>0?" "+a:a);continue}_=!1}const y=jF(c).join(":"),h=d?y+F1:y,v=h+p;if(s.includes(v))continue;s.push(v);const x=i(p,_);for(let b=0;b0?" "+a:a)}return a};function VF(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rd(c),e());return n=DF(u),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const u=r(l);if(u)return u;const c=UF(l,n);return i(l,c),c}return function(){return s(VF.apply(null,arguments))}}const Oe=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},j1=/^\[(?:([a-z-]+):)?(.+)\]$/i,qF=/^\d+\/\d+$/,WF=new Set(["px","full","screen"]),HF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,GF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,KF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,QF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,YF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xn=e=>Xs(e)||WF.has(e)||qF.test(e),Ir=e=>Fo(e,"length",iL),Xs=e=>!!e&&!Number.isNaN(Number(e)),Yf=e=>Fo(e,"number",Xs),ra=e=>!!e&&Number.isInteger(Number(e)),XF=e=>e.endsWith("%")&&Xs(e.slice(0,-1)),ie=e=>j1.test(e),Or=e=>HF.test(e),JF=new Set(["length","size","percentage"]),ZF=e=>Fo(e,JF,D1),eL=e=>Fo(e,"position",D1),tL=new Set(["image","url"]),nL=e=>Fo(e,tL,oL),rL=e=>Fo(e,"",sL),ia=()=>!0,Fo=(e,t,n)=>{const r=j1.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},iL=e=>GF.test(e)&&!KF.test(e),D1=()=>!1,sL=e=>QF.test(e),oL=e=>YF.test(e),aL=()=>{const e=Oe("colors"),t=Oe("spacing"),n=Oe("blur"),r=Oe("brightness"),i=Oe("borderColor"),s=Oe("borderRadius"),o=Oe("borderSpacing"),a=Oe("borderWidth"),l=Oe("contrast"),u=Oe("grayscale"),c=Oe("hueRotate"),d=Oe("invert"),f=Oe("gap"),m=Oe("gradientColorStops"),_=Oe("gradientColorStopPositions"),p=Oe("inset"),y=Oe("margin"),h=Oe("opacity"),v=Oe("padding"),x=Oe("saturate"),b=Oe("scale"),E=Oe("sepia"),S=Oe("skew"),P=Oe("space"),C=Oe("translate"),T=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",ie,t],M=()=>[ie,t],z=()=>["",Xn,Ir],F=()=>["auto",Xs,ie],W=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",ie],V=()=>["auto","avoid","all","avoid-page","page","left","right","column"],K=()=>[Xs,ie];return{cacheSize:500,separator:":",theme:{colors:[ia],spacing:[Xn,Ir],blur:["none","",Or,ie],brightness:K(),borderColor:[e],borderRadius:["none","","full",Or,ie],borderSpacing:M(),borderWidth:z(),contrast:K(),grayscale:A(),hueRotate:K(),invert:A(),gap:M(),gradientColorStops:[e],gradientColorStopPositions:[XF,Ir],inset:N(),margin:N(),opacity:K(),padding:M(),saturate:K(),scale:K(),sepia:A(),skew:K(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",ie]}],container:["container"],columns:[{columns:[Or]}],"break-after":[{"break-after":V()}],"break-before":[{"break-before":V()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...W(),ie]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ra,ie]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ie]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",ra,ie]}],"grid-cols":[{"grid-cols":[ia]}],"col-start-end":[{col:["auto",{span:["full",ra,ie]},ie]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[ia]}],"row-start-end":[{row:["auto",{span:[ra,ie]},ie]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ie]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ie]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...O()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...O(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...O(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ie,t]}],"min-w":[{"min-w":[ie,t,"min","max","fit"]}],"max-w":[{"max-w":[ie,t,"none","full","min","max","fit","prose",{screen:[Or]},Or]}],h:[{h:[ie,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ie,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ie,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ie,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Or,Ir]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Yf]}],"font-family":[{font:[ia]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ie]}],"line-clamp":[{"line-clamp":["none",Xs,Yf]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Xn,ie]}],"list-image":[{"list-image":["none",ie]}],"list-style-type":[{list:["none","disc","decimal",ie]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[h]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Xn,Ir]}],"underline-offset":[{"underline-offset":["auto",Xn,ie]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ie]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[h]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...W(),eL]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ZF]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},nL]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[_]}],"gradient-via-pos":[{via:[_]}],"gradient-to-pos":[{to:[_]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[h]}],"border-style":[{border:[...B(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[h]}],"divide-style":[{divide:B()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...B()]}],"outline-offset":[{"outline-offset":[Xn,ie]}],"outline-w":[{outline:[Xn,Ir]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[h]}],"ring-offset-w":[{"ring-offset":[Xn,Ir]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Or,rL]}],"shadow-color":[{shadow:[ia]}],opacity:[{opacity:[h]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Or,ie]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[x]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[h]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ie]}],duration:[{duration:K()}],ease:[{ease:["linear","in","out","in-out",ie]}],delay:[{delay:K()}],animate:[{animate:["none","spin","ping","pulse","bounce",ie]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[ra,ie]}],"translate-x":[{"translate-x":[C]}],"translate-y":[{"translate-y":[C]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ie]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ie]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ie]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Xn,Ir,Yf]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},lL=BF(aL);function ct(...e){return lL(N1(e))}function gz(e){return e.replace(/v\d+$/i,"")}function mz(e){const t=e.trim(),n=t.match(/^(\d{4})-(\d{4,5})(v\d+)?$/);if(n)return`${n[1]}.${n[2]}`;const r=t.match(/^(\d{4}\.\d{4,5})(v\d+)$/);return r?r[1]:t}function yz(e){if(e==null||e==="")return"—";const t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.abs(t)>=100?du(t,0):Math.abs(t)>=10?du(t,1):Math.abs(t)<1?du(t,3):du(t,2):String(e)}function du(e,t){const n=String(Math.abs(e));if(n.includes("e"))return e.toFixed(t);const r=+`${Math.round(+`${n}e${t}`)}e-${t}`;return(e<0?-r:r).toFixed(t)}const z1=g.forwardRef(({className:e,...t},n)=>w.jsx(I1,{ref:n,className:ct("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));z1.displayName=I1.displayName;const U1=g.forwardRef(({className:e,...t},n)=>w.jsx(O1,{ref:n,className:ct("aspect-square h-full w-full",e),...t}));U1.displayName=O1.displayName;const V1=g.forwardRef(({className:e,...t},n)=>w.jsx(M1,{ref:n,className:ct("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));V1.displayName=M1.displayName;function P0(e){const t=uL(e),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(dL);if(l){const u=l.props.children,c=a.map(d=>d===l?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:d);return w.jsx(t,{...o,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,c):null})}return w.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function uL(e){const t=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=hL(i),a=fL(s,i.props);return i.type!==g.Fragment&&(a.ref=r?vi(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cL=Symbol("radix.slottable");function dL(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===cL}function fL(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function hL(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Kg(e){const t=e+"CollectionProvider",[n,r]=ss(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:y,children:h}=p,v=q.useRef(null),x=q.useRef(new Map).current;return w.jsx(i,{scope:y,itemMap:x,collectionRef:v,children:h})};o.displayName=t;const a=e+"CollectionSlot",l=P0(a),u=q.forwardRef((p,y)=>{const{scope:h,children:v}=p,x=s(a,h),b=et(y,x.collectionRef);return w.jsx(l,{ref:b,children:v})});u.displayName=a;const c=e+"CollectionItemSlot",d="data-radix-collection-item",f=P0(c),m=q.forwardRef((p,y)=>{const{scope:h,children:v,...x}=p,b=q.useRef(null),E=et(y,b),S=s(c,h);return q.useEffect(()=>(S.itemMap.set(b,{ref:b,...x}),()=>void S.itemMap.delete(b))),w.jsx(f,{[d]:"",ref:E,children:v})});m.displayName=c;function _(p){const y=s(e+"CollectionConsumer",p);return q.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((S,P)=>x.indexOf(S.ref.current)-x.indexOf(P.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:u,ItemSlot:m},_,r]}var pL=g.createContext(void 0);function B1(e){const t=g.useContext(pL);return e||t||"ltr"}const vL=["top","right","bottom","left"],ci=Math.min,Ht=Math.max,Uc=Math.round,fu=Math.floor,Hn=e=>({x:e,y:e}),gL={left:"right",right:"left",bottom:"top",top:"bottom"};function iv(e,t,n){return Ht(e,ci(t,n))}function yr(e,t){return typeof e=="function"?e(t):e}function _r(e){return e.split("-")[0]}function Lo(e){return e.split("-")[1]}function Qg(e){return e==="x"?"y":"x"}function Yg(e){return e==="y"?"height":"width"}function Bn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Xg(e){return Qg(Bn(e))}function mL(e,t,n){n===void 0&&(n=!1);const r=Lo(e),i=Xg(e),s=Yg(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Vc(o)),[o,Vc(o)]}function yL(e){const t=Vc(e);return[sv(e),t,sv(t)]}function sv(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const R0=["left","right"],T0=["right","left"],_L=["top","bottom"],wL=["bottom","top"];function xL(e,t,n){switch(e){case"top":case"bottom":return n?t?T0:R0:t?R0:T0;case"left":case"right":return t?_L:wL;default:return[]}}function bL(e,t,n,r){const i=Lo(e);let s=xL(_r(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(sv)))),s}function Vc(e){const t=_r(e);return gL[t]+e.slice(t.length)}function EL(e){return{top:0,right:0,bottom:0,left:0,...e}}function q1(e){return typeof e!="number"?EL(e):{top:e,right:e,bottom:e,left:e}}function Bc(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function I0(e,t,n){let{reference:r,floating:i}=e;const s=Bn(t),o=Xg(t),a=Yg(o),l=_r(t),u=s==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let m;switch(l){case"top":m={x:c,y:r.y-i.height};break;case"bottom":m={x:c,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-i.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Lo(t)){case"start":m[o]-=f*(n&&u?-1:1);break;case"end":m[o]+=f*(n&&u?-1:1);break}return m}async function SL(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:m=0}=yr(t,e),_=q1(m),y=a[f?d==="floating"?"reference":"floating":d],h=Bc(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),v=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),b=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},E=Bc(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:l}):v);return{top:(h.top-E.top+_.top)/b.y,bottom:(E.bottom-h.bottom+_.bottom)/b.y,left:(h.left-E.left+_.left)/b.x,right:(E.right-h.right+_.right)/b.x}}const CL=50,kL=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:SL},l=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:d}=I0(u,r,l),f=r,m=0;const _={};for(let p=0;p({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:u,padding:c=0}=yr(e,t)||{};if(u==null)return{};const d=q1(c),f={x:n,y:r},m=Xg(i),_=Yg(m),p=await o.getDimensions(u),y=m==="y",h=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",b=s.reference[_]+s.reference[m]-f[m]-s.floating[_],E=f[m]-s.reference[m],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let P=S?S[x]:0;(!P||!await(o.isElement==null?void 0:o.isElement(S)))&&(P=a.floating[x]||s.floating[_]);const C=b/2-E/2,T=P/2-p[_]/2-1,R=ci(d[h],T),N=ci(d[v],T),M=R,z=P-p[_]-N,F=P/2-p[_]/2+C,W=iv(M,F,z),B=!l.arrow&&Lo(i)!=null&&F!==W&&s.reference[_]/2-(FF<=0)){var N,M;const F=(((N=s.flip)==null?void 0:N.index)||0)+1,W=P[F];if(W&&(!(d==="alignment"?v!==Bn(W):!1)||R.every(O=>Bn(O.placement)===v?O.overflows[0]>0:!0)))return{data:{index:F,overflows:R},reset:{placement:W}};let B=(M=R.filter(Q=>Q.overflows[0]<=0).sort((Q,O)=>Q.overflows[1]-O.overflows[1])[0])==null?void 0:M.placement;if(!B)switch(m){case"bestFit":{var z;const Q=(z=R.filter(O=>{if(S){const A=Bn(O.placement);return A===v||A==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(A=>A>0).reduce((A,V)=>A+V,0)]).sort((O,A)=>O[1]-A[1])[0])==null?void 0:z[0];Q&&(B=Q);break}case"initialPlacement":B=a;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function O0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function M0(e){return vL.some(t=>e[t]>=0)}const TL=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=yr(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=O0(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:M0(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),a=O0(o,n.floating);return{data:{escapedOffsets:a,escaped:M0(a)}}}default:return{}}}}},W1=new Set(["left","top"]);async function IL(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=_r(n),a=Lo(n),l=Bn(n)==="y",u=W1.has(o)?-1:1,c=s&&l?-1:1,d=yr(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:_}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof _=="number"&&(m=a==="end"?_*-1:_),l?{x:m*c,y:f*u}:{x:f*u,y:m*c}}const OL=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await IL(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},ML=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:h=>{let{x:v,y:x}=h;return{x:v,y:x}}},...u}=yr(e,t),c={x:n,y:r},d=await s.detectOverflow(t,u),f=Bn(_r(i)),m=Qg(f);let _=c[m],p=c[f];if(o){const h=m==="y"?"top":"left",v=m==="y"?"bottom":"right",x=_+d[h],b=_-d[v];_=iv(x,_,b)}if(a){const h=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=p+d[h],b=p-d[v];p=iv(x,p,b)}const y=l.fn({...t,[m]:_,[f]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:o,[f]:a}}}}}},AL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=yr(e,t),c={x:n,y:r},d=Bn(i),f=Qg(d);let m=c[f],_=c[d];const p=yr(a,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const x=f==="y"?"height":"width",b=s.reference[f]-s.floating[x]+y.mainAxis,E=s.reference[f]+s.reference[x]-y.mainAxis;mE&&(m=E)}if(u){var h,v;const x=f==="y"?"width":"height",b=W1.has(_r(i)),E=s.reference[d]-s.floating[x]+(b&&((h=o.offset)==null?void 0:h[d])||0)+(b?0:y.crossAxis),S=s.reference[d]+s.reference[x]+(b?0:((v=o.offset)==null?void 0:v[d])||0)-(b?y.crossAxis:0);_S&&(_=S)}return{[f]:m,[d]:_}}}},NL=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:l=()=>{},...u}=yr(e,t),c=await o.detectOverflow(t,u),d=_r(i),f=Lo(i),m=Bn(i)==="y",{width:_,height:p}=s.floating;let y,h;d==="top"||d==="bottom"?(y=d,h=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(h=d,y=f==="end"?"top":"bottom");const v=p-c.top-c.bottom,x=_-c.left-c.right,b=ci(p-c[y],v),E=ci(_-c[h],x),S=!t.middlewareData.shift;let P=b,C=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(C=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=v),S&&!f){const R=Ht(c.left,0),N=Ht(c.right,0),M=Ht(c.top,0),z=Ht(c.bottom,0);m?C=_-2*(R!==0||N!==0?R+N:Ht(c.left,c.right)):P=p-2*(M!==0||z!==0?M+z:Ht(c.top,c.bottom))}await l({...t,availableWidth:C,availableHeight:P});const T=await o.getDimensions(a.floating);return _!==T.width||p!==T.height?{reset:{rects:!0}}:{}}}};function Ed(){return typeof window<"u"}function jo(e){return H1(e)?(e.nodeName||"").toLowerCase():"#document"}function Xt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Kn(e){var t;return(t=(H1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function H1(e){return Ed()?e instanceof Node||e instanceof Xt(e).Node:!1}function Pn(e){return Ed()?e instanceof Element||e instanceof Xt(e).Element:!1}function Er(e){return Ed()?e instanceof HTMLElement||e instanceof Xt(e).HTMLElement:!1}function A0(e){return!Ed()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Xt(e).ShadowRoot}function Sl(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Rn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function $L(e){return/^(table|td|th)$/.test(jo(e))}function Sd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const FL=/transform|translate|scale|rotate|perspective|filter/,LL=/paint|layout|strict|content/,xi=e=>!!e&&e!=="none";let Xf;function Jg(e){const t=Pn(e)?Rn(e):e;return xi(t.transform)||xi(t.translate)||xi(t.scale)||xi(t.rotate)||xi(t.perspective)||!Zg()&&(xi(t.backdropFilter)||xi(t.filter))||FL.test(t.willChange||"")||LL.test(t.contain||"")}function jL(e){let t=di(e);for(;Er(t)&&!Io(t);){if(Jg(t))return t;if(Sd(t))return null;t=di(t)}return null}function Zg(){return Xf==null&&(Xf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Xf}function Io(e){return/^(html|body|#document)$/.test(jo(e))}function Rn(e){return Xt(e).getComputedStyle(e)}function Cd(e){return Pn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function di(e){if(jo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||A0(e)&&e.host||Kn(e);return A0(t)?t.host:t}function G1(e){const t=di(e);return Io(t)?e.ownerDocument?e.ownerDocument.body:e.body:Er(t)&&Sl(t)?t:G1(t)}function ll(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=G1(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Xt(i);if(s){const a=ov(o);return t.concat(o,o.visualViewport||[],Sl(i)?i:[],a&&n?ll(a):[])}else return t.concat(i,ll(i,[],n))}function ov(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function K1(e){const t=Rn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Er(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=Uc(n)!==s||Uc(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function em(e){return Pn(e)?e:e.contextElement}function Js(e){const t=em(e);if(!Er(t))return Hn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=K1(t);let o=(s?Uc(n.width):n.width)/r,a=(s?Uc(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const DL=Hn(0);function Q1(e){const t=Xt(e);return!Zg()||!t.visualViewport?DL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zL(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Xt(e)?!1:t}function ts(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=em(e);let o=Hn(1);t&&(r?Pn(r)&&(o=Js(r)):o=Js(e));const a=zL(s,n,r)?Q1(s):Hn(0);let l=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,c=i.width/o.x,d=i.height/o.y;if(s){const f=Xt(s),m=r&&Pn(r)?Xt(r):r;let _=f,p=ov(_);for(;p&&r&&m!==_;){const y=Js(p),h=p.getBoundingClientRect(),v=Rn(p),x=h.left+(p.clientLeft+parseFloat(v.paddingLeft))*y.x,b=h.top+(p.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,u*=y.y,c*=y.x,d*=y.y,l+=x,u+=b,_=Xt(p),p=ov(_)}}return Bc({width:c,height:d,x:l,y:u})}function kd(e,t){const n=Cd(e).scrollLeft;return t?t.left+n:ts(Kn(e)).left+n}function Y1(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-kd(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function UL(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Kn(r),a=t?Sd(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=Hn(1);const c=Hn(0),d=Er(r);if((d||!d&&!s)&&((jo(r)!=="body"||Sl(o))&&(l=Cd(r)),d)){const m=ts(r);u=Js(r),c.x=m.x+r.clientLeft,c.y=m.y+r.clientTop}const f=o&&!d&&!s?Y1(o,l):Hn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+f.x,y:n.y*u.y-l.scrollTop*u.y+c.y+f.y}}function VL(e){return Array.from(e.getClientRects())}function BL(e){const t=Kn(e),n=Cd(e),r=e.ownerDocument.body,i=Ht(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ht(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+kd(e);const a=-n.scrollTop;return Rn(r).direction==="rtl"&&(o+=Ht(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const N0=25;function qL(e,t){const n=Xt(e),r=Kn(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=Zg();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const u=kd(r);if(u<=0){const c=r.ownerDocument,d=c.body,f=getComputedStyle(d),m=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,_=Math.abs(r.clientWidth-d.clientWidth-m);_<=N0&&(s-=_)}else u<=N0&&(s+=u);return{width:s,height:o,x:a,y:l}}function WL(e,t){const n=ts(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Er(e)?Js(e):Hn(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,u=r*s.y;return{width:o,height:a,x:l,y:u}}function $0(e,t,n){let r;if(t==="viewport")r=qL(e,n);else if(t==="document")r=BL(Kn(e));else if(Pn(t))r=WL(t,n);else{const i=Q1(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Bc(r)}function X1(e,t){const n=di(e);return n===t||!Pn(n)||Io(n)?!1:Rn(n).position==="fixed"||X1(n,t)}function HL(e,t){const n=t.get(e);if(n)return n;let r=ll(e,[],!1).filter(a=>Pn(a)&&jo(a)!=="body"),i=null;const s=Rn(e).position==="fixed";let o=s?di(e):e;for(;Pn(o)&&!Io(o);){const a=Rn(o),l=Jg(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Sl(o)&&!l&&X1(e,o))?r=r.filter(c=>c!==o):i=a,o=di(o)}return t.set(e,r),r}function GL(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?Sd(t)?[]:HL(t,this._c):[].concat(n),r],a=$0(t,o[0],i);let l=a.top,u=a.right,c=a.bottom,d=a.left;for(let f=1;f{o(!1,1e-7)},1e3)}P===1&&!Z1(u,e.getBoundingClientRect())&&o(),b=!1}try{n=new IntersectionObserver(E,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(E,x)}n.observe(e)}return o(!0),s}function ej(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=em(e),c=i||s?[...u?ll(u):[],...t?ll(t):[]]:[];c.forEach(h=>{i&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const d=u&&a?ZL(u,n):null;let f=-1,m=null;o&&(m=new ResizeObserver(h=>{let[v]=h;v&&v.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),n()}),u&&!l&&m.observe(u),t&&m.observe(t));let _,p=l?ts(e):null;l&&y();function y(){const h=ts(e);p&&!Z1(p,h)&&n(),p=h,_=requestAnimationFrame(y)}return n(),()=>{var h;c.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),d==null||d(),(h=m)==null||h.disconnect(),m=null,l&&cancelAnimationFrame(_)}}const tj=OL,nj=ML,rj=RL,ij=NL,sj=TL,L0=PL,oj=AL,aj=(e,t,n)=>{const r=new Map,i={platform:JL,...n},s={...i.platform,_c:r};return kL(e,t,{...i,platform:s})};var lj=typeof document<"u",uj=function(){},Fu=lj?g.useLayoutEffect:uj;function qc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!qc(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!qc(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function eC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function j0(e,t){const n=eC(e);return Math.round(t*n)/n}function Zf(e){const t=g.useRef(e);return Fu(()=>{t.current=e}),t}function cj(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[c,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=g.useState(r);qc(f,r)||m(r);const[_,p]=g.useState(null),[y,h]=g.useState(null),v=g.useCallback(O=>{O!==S.current&&(S.current=O,p(O))},[]),x=g.useCallback(O=>{O!==P.current&&(P.current=O,h(O))},[]),b=s||_,E=o||y,S=g.useRef(null),P=g.useRef(null),C=g.useRef(c),T=l!=null,R=Zf(l),N=Zf(i),M=Zf(u),z=g.useCallback(()=>{if(!S.current||!P.current)return;const O={placement:t,strategy:n,middleware:f};N.current&&(O.platform=N.current),aj(S.current,P.current,O).then(A=>{const V={...A,isPositioned:M.current!==!1};F.current&&!qc(C.current,V)&&(C.current=V,xl.flushSync(()=>{d(V)}))})},[f,t,n,N,M]);Fu(()=>{u===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(O=>({...O,isPositioned:!1})))},[u]);const F=g.useRef(!1);Fu(()=>(F.current=!0,()=>{F.current=!1}),[]),Fu(()=>{if(b&&(S.current=b),E&&(P.current=E),b&&E){if(R.current)return R.current(b,E,z);z()}},[b,E,z,R,T]);const W=g.useMemo(()=>({reference:S,floating:P,setReference:v,setFloating:x}),[v,x]),B=g.useMemo(()=>({reference:b,floating:E}),[b,E]),Q=g.useMemo(()=>{const O={position:n,left:0,top:0};if(!B.floating)return O;const A=j0(B.floating,c.x),V=j0(B.floating,c.y);return a?{...O,transform:"translate("+A+"px, "+V+"px)",...eC(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:A,top:V}},[n,a,B.floating,c.x,c.y]);return g.useMemo(()=>({...c,update:z,refs:W,elements:B,floatingStyles:Q}),[c,z,W,B,Q])}const dj=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?L0({element:r.current,padding:i}).fn(n):{}:r?L0({element:r,padding:i}).fn(n):{}}}},fj=(e,t)=>{const n=tj(e);return{name:n.name,fn:n.fn,options:[e,t]}},hj=(e,t)=>{const n=nj(e);return{name:n.name,fn:n.fn,options:[e,t]}},pj=(e,t)=>({fn:oj(e).fn,options:[e,t]}),vj=(e,t)=>{const n=rj(e);return{name:n.name,fn:n.fn,options:[e,t]}},gj=(e,t)=>{const n=ij(e);return{name:n.name,fn:n.fn,options:[e,t]}},mj=(e,t)=>{const n=sj(e);return{name:n.name,fn:n.fn,options:[e,t]}},yj=(e,t)=>{const n=dj(e);return{name:n.name,fn:n.fn,options:[e,t]}};var _j="Arrow",tC=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return w.jsx(ke.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});tC.displayName=_j;var wj=tC;function xj(e){const[t,n]=g.useState(void 0);return fn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;o=u.inlineSize,a=u.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var tm="Popper",[nC,rC]=ss(tm),[bj,iC]=nC(tm),sC=e=>{const{__scopePopper:t,children:n}=e,[r,i]=g.useState(null);return w.jsx(bj,{scope:t,anchor:r,onAnchorChange:i,children:n})};sC.displayName=tm;var oC="PopperAnchor",aC=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=iC(oC,n),o=g.useRef(null),a=et(t,o),l=g.useRef(null);return g.useEffect(()=>{const u=l.current;l.current=(r==null?void 0:r.current)||o.current,u!==l.current&&s.onAnchorChange(l.current)}),r?null:w.jsx(ke.div,{...i,ref:a})});aC.displayName=oC;var nm="PopperContent",[Ej,Sj]=nC(nm),lC=g.forwardRef((e,t)=>{var Be,ye,Fe,Tt,Sr,_t;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:m="optimized",onPlaced:_,...p}=e,y=iC(nm,n),[h,v]=g.useState(null),x=et(t,Ye=>v(Ye)),[b,E]=g.useState(null),S=xj(b),P=(S==null?void 0:S.width)??0,C=(S==null?void 0:S.height)??0,T=r+(s!=="center"?"-"+s:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(u)?u:[u],M=N.length>0,z={padding:R,boundary:N.filter(kj),altBoundary:M},{refs:F,floatingStyles:W,placement:B,isPositioned:Q,middlewareData:O}=cj({strategy:"fixed",placement:T,whileElementsMounted:(...Ye)=>ej(...Ye,{animationFrame:m==="always"}),elements:{reference:y.anchor},middleware:[fj({mainAxis:i+C,alignmentAxis:o}),l&&hj({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?pj():void 0,...z}),l&&vj({...z}),gj({...z,apply:({elements:Ye,rects:gi,availableWidth:us,availableHeight:It})=>{const{width:cs,height:Cr}=gi.reference,pn=Ye.floating.style;pn.setProperty("--radix-popper-available-width",`${us}px`),pn.setProperty("--radix-popper-available-height",`${It}px`),pn.setProperty("--radix-popper-anchor-width",`${cs}px`),pn.setProperty("--radix-popper-anchor-height",`${Cr}px`)}}),b&&yj({element:b,padding:a}),Pj({arrowWidth:P,arrowHeight:C}),f&&mj({strategy:"referenceHidden",...z})]}),[A,V]=dC(B),K=Ut(_);fn(()=>{Q&&(K==null||K())},[Q,K]);const te=(Be=O.arrow)==null?void 0:Be.x,oe=(ye=O.arrow)==null?void 0:ye.y,de=((Fe=O.arrow)==null?void 0:Fe.centerOffset)!==0,[be,Pe]=g.useState();return fn(()=>{h&&Pe(window.getComputedStyle(h).zIndex)},[h]),w.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:Q?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(Tt=O.transformOrigin)==null?void 0:Tt.x,(Sr=O.transformOrigin)==null?void 0:Sr.y].join(" "),...((_t=O.hide)==null?void 0:_t.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:w.jsx(Ej,{scope:n,placedSide:A,onArrowChange:E,arrowX:te,arrowY:oe,shouldHideArrow:de,children:w.jsx(ke.div,{"data-side":A,"data-align":V,...p,ref:x,style:{...p.style,animation:Q?void 0:"none"}})})})});lC.displayName=nm;var uC="PopperArrow",Cj={top:"bottom",right:"left",bottom:"top",left:"right"},cC=g.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=Sj(uC,r),o=Cj[s.placedSide];return w.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:w.jsx(wj,{...i,ref:n,style:{...i.style,display:"block"}})})});cC.displayName=uC;function kj(e){return e!==null}var Pj=e=>({name:"transformOrigin",options:e,fn(t){var y,h,v;const{placement:n,rects:r,middlewareData:i}=t,o=((y=i.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[u,c]=dC(n),d={start:"0%",center:"50%",end:"100%"}[c],f=(((h=i.arrow)==null?void 0:h.x)??0)+a/2,m=(((v=i.arrow)==null?void 0:v.y)??0)+l/2;let _="",p="";return u==="bottom"?(_=o?d:`${f}px`,p=`${-l}px`):u==="top"?(_=o?d:`${f}px`,p=`${r.floating.height+l}px`):u==="right"?(_=`${-l}px`,p=o?d:`${m}px`):u==="left"&&(_=`${r.floating.width+l}px`,p=o?d:`${m}px`),{data:{x:_,y:p}}}});function dC(e){const[t,n="center"]=e.split("-");return[t,n]}var Rj=sC,Tj=aC,Ij=lC,Oj=cC,eh="rovingFocusGroup.onEntryFocus",Mj={bubbles:!1,cancelable:!0},Cl="RovingFocusGroup",[av,fC,Aj]=Kg(Cl),[Nj,hC]=ss(Cl,[Aj]),[$j,Fj]=Nj(Cl),pC=g.forwardRef((e,t)=>w.jsx(av.Provider,{scope:e.__scopeRovingFocusGroup,children:w.jsx(av.Slot,{scope:e.__scopeRovingFocusGroup,children:w.jsx(Lj,{...e,ref:t})})}));pC.displayName=Cl;var Lj=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:c=!1,...d}=e,f=g.useRef(null),m=et(t,f),_=B1(s),[p,y]=yd({prop:o,defaultProp:a??null,onChange:l,caller:Cl}),[h,v]=g.useState(!1),x=Ut(u),b=fC(n),E=g.useRef(!1),[S,P]=g.useState(0);return g.useEffect(()=>{const C=f.current;if(C)return C.addEventListener(eh,x),()=>C.removeEventListener(eh,x)},[x]),w.jsx($j,{scope:n,orientation:r,dir:_,loop:i,currentTabStopId:p,onItemFocus:g.useCallback(C=>y(C),[y]),onItemShiftTab:g.useCallback(()=>v(!0),[]),onFocusableItemAdd:g.useCallback(()=>P(C=>C+1),[]),onFocusableItemRemove:g.useCallback(()=>P(C=>C-1),[]),children:w.jsx(ke.div,{tabIndex:h||S===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:ee(e.onMouseDown,()=>{E.current=!0}),onFocus:ee(e.onFocus,C=>{const T=!E.current;if(C.target===C.currentTarget&&T&&!h){const R=new CustomEvent(eh,Mj);if(C.currentTarget.dispatchEvent(R),!R.defaultPrevented){const N=b().filter(B=>B.focusable),M=N.find(B=>B.active),z=N.find(B=>B.id===p),W=[M,z,...N].filter(Boolean).map(B=>B.ref.current);mC(W,c)}}E.current=!1}),onBlur:ee(e.onBlur,()=>v(!1))})})}),vC="RovingFocusGroupItem",gC=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=e,l=Qs(),u=s||l,c=Fj(vC,n),d=c.currentTabStopId===u,f=fC(n),{onFocusableItemAdd:m,onFocusableItemRemove:_,currentTabStopId:p}=c;return g.useEffect(()=>{if(r)return m(),()=>_()},[r,m,_]),w.jsx(av.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:w.jsx(ke.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...a,ref:t,onMouseDown:ee(e.onMouseDown,y=>{r?c.onItemFocus(u):y.preventDefault()}),onFocus:ee(e.onFocus,()=>c.onItemFocus(u)),onKeyDown:ee(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){c.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const h=zj(y,c.orientation,c.dir);if(h!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let x=f().filter(b=>b.focusable).map(b=>b.ref.current);if(h==="last")x.reverse();else if(h==="prev"||h==="next"){h==="prev"&&x.reverse();const b=x.indexOf(y.currentTarget);x=c.loop?Uj(x,b+1):x.slice(b+1)}setTimeout(()=>mC(x))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:p!=null}):o})})});gC.displayName=vC;var jj={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dj(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zj(e,t,n){const r=Dj(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return jj[r]}function mC(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Uj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vj=pC,Bj=gC;function qj(e){const t=Wj(e),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(Gj);if(l){const u=l.props.children,c=a.map(d=>d===l?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:d);return w.jsx(t,{...o,ref:i,children:g.isValidElement(u)?g.cloneElement(u,void 0,c):null})}return w.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function Wj(e){const t=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=Qj(i),a=Kj(s,i.props);return i.type!==g.Fragment&&(a.ref=r?vi(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Hj=Symbol("radix.slottable");function Gj(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Hj}function Kj(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function Qj(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var lv=["Enter"," "],Yj=["ArrowDown","PageUp","Home"],yC=["ArrowUp","PageDown","End"],Xj=[...Yj,...yC],Jj={ltr:[...lv,"ArrowRight"],rtl:[...lv,"ArrowLeft"]},Zj={ltr:["ArrowLeft"],rtl:["ArrowRight"]},kl="Menu",[ul,eD,tD]=Kg(kl),[as,_C]=ss(kl,[tD,rC,hC]),Pd=rC(),wC=hC(),[nD,ls]=as(kl),[rD,Pl]=as(kl),xC=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=Pd(t),[l,u]=g.useState(null),c=g.useRef(!1),d=Ut(s),f=B1(i);return g.useEffect(()=>{const m=()=>{c.current=!0,document.addEventListener("pointerdown",_,{capture:!0,once:!0}),document.addEventListener("pointermove",_,{capture:!0,once:!0})},_=()=>c.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",_,{capture:!0}),document.removeEventListener("pointermove",_,{capture:!0})}},[]),w.jsx(Rj,{...a,children:w.jsx(nD,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:u,children:w.jsx(rD,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:o,children:r})})})};xC.displayName=kl;var iD="MenuAnchor",rm=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Pd(n);return w.jsx(Tj,{...i,...r,ref:t})});rm.displayName=iD;var im="MenuPortal",[sD,bC]=as(im,{forceMount:void 0}),EC=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=ls(im,t);return w.jsx(sD,{scope:t,forceMount:n,children:w.jsx(br,{present:n||s.open,children:w.jsx(wd,{asChild:!0,container:i,children:r})})})};EC.displayName=im;var un="MenuContent",[oD,sm]=as(un),SC=g.forwardRef((e,t)=>{const n=bC(un,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=ls(un,e.__scopeMenu),o=Pl(un,e.__scopeMenu);return w.jsx(ul.Provider,{scope:e.__scopeMenu,children:w.jsx(br,{present:r||s.open,children:w.jsx(ul.Slot,{scope:e.__scopeMenu,children:o.modal?w.jsx(aD,{...i,ref:t}):w.jsx(lD,{...i,ref:t})})})})}),aD=g.forwardRef((e,t)=>{const n=ls(un,e.__scopeMenu),r=g.useRef(null),i=et(t,r);return g.useEffect(()=>{const s=r.current;if(s)return t1(s)},[]),w.jsx(om,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),lD=g.forwardRef((e,t)=>{const n=ls(un,e.__scopeMenu);return w.jsx(om,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),uD=qj("MenuContent.ScrollLock"),om=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:m,disableOutsideScroll:_,...p}=e,y=ls(un,n),h=Pl(un,n),v=Pd(n),x=wC(n),b=eD(n),[E,S]=g.useState(null),P=g.useRef(null),C=et(t,P,y.onContentChange),T=g.useRef(0),R=g.useRef(""),N=g.useRef(0),M=g.useRef(null),z=g.useRef("right"),F=g.useRef(0),W=_?Dg:g.Fragment,B=_?{as:uD,allowPinchZoom:!0}:void 0,Q=A=>{var Be,ye;const V=R.current+A,K=b().filter(Fe=>!Fe.disabled),te=document.activeElement,oe=(Be=K.find(Fe=>Fe.ref.current===te))==null?void 0:Be.textValue,de=K.map(Fe=>Fe.textValue),be=xD(de,V,oe),Pe=(ye=K.find(Fe=>Fe.textValue===be))==null?void 0:ye.ref.current;(function Fe(Tt){R.current=Tt,window.clearTimeout(T.current),Tt!==""&&(T.current=window.setTimeout(()=>Fe(""),1e3))})(V),Pe&&setTimeout(()=>Pe.focus())};g.useEffect(()=>()=>window.clearTimeout(T.current),[]),HS();const O=g.useCallback(A=>{var K,te;return z.current===((K=M.current)==null?void 0:K.side)&&ED(A,(te=M.current)==null?void 0:te.area)},[]);return w.jsx(oD,{scope:n,searchRef:R,onItemEnter:g.useCallback(A=>{O(A)&&A.preventDefault()},[O]),onItemLeave:g.useCallback(A=>{var V;O(A)||((V=P.current)==null||V.focus(),S(null))},[O]),onTriggerLeave:g.useCallback(A=>{O(A)&&A.preventDefault()},[O]),pointerGraceTimerRef:N,onPointerGraceIntentChange:g.useCallback(A=>{M.current=A},[]),children:w.jsx(W,{...B,children:w.jsx(jg,{asChild:!0,trapped:i,onMountAutoFocus:ee(s,A=>{var V;A.preventDefault(),(V=P.current)==null||V.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:w.jsx(_d,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:m,children:w.jsx(Vj,{asChild:!0,...x,dir:h.dir,orientation:"vertical",loop:r,currentTabStopId:E,onCurrentTabStopIdChange:S,onEntryFocus:ee(l,A=>{h.isUsingKeyboardRef.current||A.preventDefault()}),preventScrollOnEntryFocus:!0,children:w.jsx(Ij,{role:"menu","aria-orientation":"vertical","data-state":zC(y.open),"data-radix-menu-content":"",dir:h.dir,...v,...p,ref:C,style:{outline:"none",...p.style},onKeyDown:ee(p.onKeyDown,A=>{const K=A.target.closest("[data-radix-menu-content]")===A.currentTarget,te=A.ctrlKey||A.altKey||A.metaKey,oe=A.key.length===1;K&&(A.key==="Tab"&&A.preventDefault(),!te&&oe&&Q(A.key));const de=P.current;if(A.target!==de||!Xj.includes(A.key))return;A.preventDefault();const Pe=b().filter(Be=>!Be.disabled).map(Be=>Be.ref.current);yC.includes(A.key)&&Pe.reverse(),_D(Pe)}),onBlur:ee(e.onBlur,A=>{A.currentTarget.contains(A.target)||(window.clearTimeout(T.current),R.current="")}),onPointerMove:ee(e.onPointerMove,cl(A=>{const V=A.target,K=F.current!==A.clientX;if(A.currentTarget.contains(V)&&K){const te=A.clientX>F.current?"right":"left";z.current=te,F.current=A.clientX}}))})})})})})})});SC.displayName=un;var cD="MenuGroup",am=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return w.jsx(ke.div,{role:"group",...r,ref:t})});am.displayName=cD;var dD="MenuLabel",CC=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return w.jsx(ke.div,{...r,ref:t})});CC.displayName=dD;var Wc="MenuItem",D0="menu.itemSelect",Rd=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=g.useRef(null),o=Pl(Wc,e.__scopeMenu),a=sm(Wc,e.__scopeMenu),l=et(t,s),u=g.useRef(!1),c=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(D0,{bubbles:!0,cancelable:!0});d.addEventListener(D0,m=>r==null?void 0:r(m),{once:!0}),Lg(d,f),f.defaultPrevented?u.current=!1:o.onClose()}};return w.jsx(kC,{...i,ref:l,disabled:n,onClick:ee(e.onClick,c),onPointerDown:d=>{var f;(f=e.onPointerDown)==null||f.call(e,d),u.current=!0},onPointerUp:ee(e.onPointerUp,d=>{var f;u.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:ee(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||lv.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Rd.displayName=Wc;var kC=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=sm(Wc,n),a=wC(n),l=g.useRef(null),u=et(t,l),[c,d]=g.useState(!1),[f,m]=g.useState("");return g.useEffect(()=>{const _=l.current;_&&m((_.textContent??"").trim())},[s.children]),w.jsx(ul.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:w.jsx(Bj,{asChild:!0,...a,focusable:!r,children:w.jsx(ke.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:ee(e.onPointerMove,cl(_=>{r?o.onItemLeave(_):(o.onItemEnter(_),_.defaultPrevented||_.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ee(e.onPointerLeave,cl(_=>o.onItemLeave(_))),onFocus:ee(e.onFocus,()=>d(!0)),onBlur:ee(e.onBlur,()=>d(!1))})})})}),fD="MenuCheckboxItem",PC=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return w.jsx(MC,{scope:e.__scopeMenu,checked:n,children:w.jsx(Rd,{role:"menuitemcheckbox","aria-checked":Hc(n)?"mixed":n,...i,ref:t,"data-state":um(n),onSelect:ee(i.onSelect,()=>r==null?void 0:r(Hc(n)?!0:!n),{checkForDefaultPrevented:!1})})})});PC.displayName=fD;var RC="MenuRadioGroup",[hD,pD]=as(RC,{value:void 0,onValueChange:()=>{}}),TC=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Ut(r);return w.jsx(hD,{scope:e.__scopeMenu,value:n,onValueChange:s,children:w.jsx(am,{...i,ref:t})})});TC.displayName=RC;var IC="MenuRadioItem",OC=g.forwardRef((e,t)=>{const{value:n,...r}=e,i=pD(IC,e.__scopeMenu),s=n===i.value;return w.jsx(MC,{scope:e.__scopeMenu,checked:s,children:w.jsx(Rd,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":um(s),onSelect:ee(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});OC.displayName=IC;var lm="MenuItemIndicator",[MC,vD]=as(lm,{checked:!1}),AC=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=vD(lm,n);return w.jsx(br,{present:r||Hc(s.checked)||s.checked===!0,children:w.jsx(ke.span,{...i,ref:t,"data-state":um(s.checked)})})});AC.displayName=lm;var gD="MenuSeparator",NC=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return w.jsx(ke.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});NC.displayName=gD;var mD="MenuArrow",$C=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Pd(n);return w.jsx(Oj,{...i,...r,ref:t})});$C.displayName=mD;var yD="MenuSub",[_z,FC]=as(yD),pa="MenuSubTrigger",LC=g.forwardRef((e,t)=>{const n=ls(pa,e.__scopeMenu),r=Pl(pa,e.__scopeMenu),i=FC(pa,e.__scopeMenu),s=sm(pa,e.__scopeMenu),o=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,u={__scopeMenu:e.__scopeMenu},c=g.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return g.useEffect(()=>c,[c]),g.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),w.jsx(rm,{asChild:!0,...u,children:w.jsx(kC,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":zC(n.open),...e,ref:vi(t,i.onTriggerChange),onClick:d=>{var f;(f=e.onClick)==null||f.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ee(e.onPointerMove,cl(d=>{s.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),c()},100))})),onPointerLeave:ee(e.onPointerLeave,cl(d=>{var m,_;c();const f=(m=n.content)==null?void 0:m.getBoundingClientRect();if(f){const p=(_=n.content)==null?void 0:_.dataset.side,y=p==="right",h=y?-5:5,v=f[y?"left":"right"],x=f[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:v,y:f.top},{x,y:f.top},{x,y:f.bottom},{x:v,y:f.bottom}],side:p}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ee(e.onKeyDown,d=>{var m;const f=s.searchRef.current!=="";e.disabled||f&&d.key===" "||Jj[r.dir].includes(d.key)&&(n.onOpenChange(!0),(m=n.content)==null||m.focus(),d.preventDefault())})})})});LC.displayName=pa;var jC="MenuSubContent",DC=g.forwardRef((e,t)=>{const n=bC(un,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=ls(un,e.__scopeMenu),o=Pl(un,e.__scopeMenu),a=FC(jC,e.__scopeMenu),l=g.useRef(null),u=et(t,l);return w.jsx(ul.Provider,{scope:e.__scopeMenu,children:w.jsx(br,{present:r||s.open,children:w.jsx(ul.Slot,{scope:e.__scopeMenu,children:w.jsx(om,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{var d;o.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:ee(e.onFocusOutside,c=>{c.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ee(e.onEscapeKeyDown,c=>{o.onClose(),c.preventDefault()}),onKeyDown:ee(e.onKeyDown,c=>{var m;const d=c.currentTarget.contains(c.target),f=Zj[o.dir].includes(c.key);d&&f&&(s.onOpenChange(!1),(m=a.trigger)==null||m.focus(),c.preventDefault())})})})})})});DC.displayName=jC;function zC(e){return e?"open":"closed"}function Hc(e){return e==="indeterminate"}function um(e){return Hc(e)?"indeterminate":e?"checked":"unchecked"}function _D(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function wD(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function xD(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=wD(e,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==n));const l=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function bD(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;sr!=f>r&&n<(d-u)*(r-c)/(f-c)+u&&(i=!i)}return i}function ED(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return bD(n,t)}function cl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var SD=xC,CD=rm,kD=EC,PD=SC,RD=am,TD=CC,ID=Rd,OD=PC,MD=TC,AD=OC,ND=AC,$D=NC,FD=$C,LD=LC,jD=DC,Td="DropdownMenu",[DD]=ss(Td,[_C]),Rt=_C(),[zD,UC]=DD(Td),VC=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=Rt(t),u=g.useRef(null),[c,d]=yd({prop:i,defaultProp:s??!1,onChange:o,caller:Td});return w.jsx(zD,{scope:t,triggerId:Qs(),triggerRef:u,contentId:Qs(),open:c,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:w.jsx(SD,{...l,open:c,onOpenChange:d,dir:r,modal:a,children:n})})};VC.displayName=Td;var BC="DropdownMenuTrigger",qC=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,s=UC(BC,n),o=Rt(n);return w.jsx(CD,{asChild:!0,...o,children:w.jsx(ke.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:vi(t,s.triggerRef),onPointerDown:ee(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:ee(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});qC.displayName=BC;var UD="DropdownMenuPortal",WC=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Rt(t);return w.jsx(kD,{...r,...n})};WC.displayName=UD;var HC="DropdownMenuContent",GC=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=UC(HC,n),s=Rt(n),o=g.useRef(!1);return w.jsx(PD,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:t,onCloseAutoFocus:ee(e.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:ee(e.onInteractOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,c=l.button===2||u;(!i.modal||c)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});GC.displayName=HC;var VD="DropdownMenuGroup",BD=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx(RD,{...i,...r,ref:t})});BD.displayName=VD;var qD="DropdownMenuLabel",KC=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx(TD,{...i,...r,ref:t})});KC.displayName=qD;var WD="DropdownMenuItem",QC=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx(ID,{...i,...r,ref:t})});QC.displayName=WD;var HD="DropdownMenuCheckboxItem",YC=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx(OD,{...i,...r,ref:t})});YC.displayName=HD;var GD="DropdownMenuRadioGroup",KD=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx(MD,{...i,...r,ref:t})});KD.displayName=GD;var QD="DropdownMenuRadioItem",XC=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx(AD,{...i,...r,ref:t})});XC.displayName=QD;var YD="DropdownMenuItemIndicator",JC=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx(ND,{...i,...r,ref:t})});JC.displayName=YD;var XD="DropdownMenuSeparator",ZC=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx($D,{...i,...r,ref:t})});ZC.displayName=XD;var JD="DropdownMenuArrow",ZD=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx(FD,{...i,...r,ref:t})});ZD.displayName=JD;var e2="DropdownMenuSubTrigger",ek=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx(LD,{...i,...r,ref:t})});ek.displayName=e2;var t2="DropdownMenuSubContent",tk=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rt(n);return w.jsx(jD,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tk.displayName=t2;var n2=VC,r2=qC,i2=WC,nk=GC,rk=KC,ik=QC,sk=YC,ok=XC,ak=JC,lk=ZC,uk=ek,ck=tk;/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const s2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dk=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var o2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const a2=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>g.createElement("svg",{ref:l,...o2,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:dk("lucide",i),...a},[...o.map(([u,c])=>g.createElement(u,c)),...Array.isArray(s)?s:[s]]));/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Id=(e,t)=>{const n=g.forwardRef(({className:r,...i},s)=>g.createElement(a2,{ref:s,iconNode:t,className:dk(`lucide-${s2(e)}`,r),...i}));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const l2=Id("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const u2=Id("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c2=Id("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d2=Id("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),f2=n2,h2=r2,p2=g.forwardRef(({className:e,inset:t,children:n,...r},i)=>w.jsxs(uk,{ref:i,className:ct("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...r,children:[n,w.jsx(u2,{className:"ml-auto h-4 w-4"})]}));p2.displayName=uk.displayName;const v2=g.forwardRef(({className:e,...t},n)=>w.jsx(ck,{ref:n,className:ct("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));v2.displayName=ck.displayName;const fk=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>w.jsx(i2,{children:w.jsx(nk,{ref:r,sideOffset:t,className:ct("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));fk.displayName=nk.displayName;const er=g.forwardRef(({className:e,inset:t,...n},r)=>w.jsx(ik,{ref:r,className:ct("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n}));er.displayName=ik.displayName;const g2=g.forwardRef(({className:e,children:t,checked:n,...r},i)=>w.jsxs(sk,{ref:i,className:ct("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:n,...r,children:[w.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(ak,{children:w.jsx(l2,{className:"h-4 w-4"})})}),t]}));g2.displayName=sk.displayName;const m2=g.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(ok,{ref:r,className:ct("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[w.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(ak,{children:w.jsx(c2,{className:"h-2 w-2 fill-current"})})}),t]}));m2.displayName=ok.displayName;const hk=g.forwardRef(({className:e,inset:t,...n},r)=>w.jsx(rk,{ref:r,className:ct("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));hk.displayName=rk.displayName;const uv=g.forwardRef(({className:e,...t},n)=>w.jsx(lk,{ref:n,className:ct("-mx-1 my-1 h-px bg-muted",e),...t}));uv.displayName=lk.displayName;function y2(e){const n=(e.name||e.username||"?").trim().split(/\s+/).filter(Boolean);return n.length===0?"?":n.length===1?n[0][0].toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()}const _2=({user:e,onLogout:t})=>w.jsxs(f2,{children:[w.jsx(h2,{asChild:!0,children:w.jsx("button",{type:"button",className:"user-avatar-btn","aria-label":`Account menu for ${e.username}`,children:w.jsxs(z1,{className:"h-8 w-8",children:[e.avatar_url&&w.jsx(U1,{src:e.avatar_url,alt:e.username}),w.jsx(V1,{className:"text-xs",children:y2(e)})]})})}),w.jsxs(fk,{align:"end",className:"w-56",children:[w.jsxs(hk,{className:"flex flex-col gap-0.5 py-2",children:[w.jsx("span",{className:"text-sm font-medium leading-tight",children:e.name||e.username}),w.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["@",e.username]}),e.is_admin&&w.jsx("span",{className:"mt-1 inline-flex w-fit items-center rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-amber-900",children:"Admin"}),e.role==="contributor"&&w.jsx("span",{className:"mt-1 inline-flex w-fit items-center rounded-full bg-blue-100 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-blue-900",children:"Contributor"})]}),w.jsx(uv,{}),w.jsx(er,{asChild:!0,children:w.jsx("a",{href:`https://huggingface.co/${encodeURIComponent(e.username)}`,target:"_blank",rel:"noopener noreferrer",children:"Hugging Face profile"})}),w.jsx(er,{asChild:!0,children:w.jsx(bn,{to:"/frameworks",children:"Frameworks"})}),w.jsx(er,{asChild:!0,children:w.jsx(bn,{to:"/trends",children:"Trends"})}),e.is_admin&&w.jsxs(w.Fragment,{children:[w.jsx(er,{asChild:!0,children:w.jsx(bn,{to:"/admin-dashboard",children:"Admin dashboard"})}),w.jsx(er,{asChild:!0,children:w.jsx(bn,{to:"/submissions",children:"Review submissions"})})]}),w.jsx(er,{asChild:!0,children:w.jsx(bn,{to:`/${encodeURIComponent(e.username)}`,children:"My contributions"})}),w.jsx(er,{asChild:!0,children:w.jsx(bn,{to:"/settings",children:"Settings"})}),w.jsx(uv,{}),w.jsx(er,{onSelect:n=>{n.preventDefault(),t()},children:"Log out"})]})]}),w2=!1;class Od extends Error{constructor(n,r){var i;super(`API request failed: ${n.status} ${n.statusText}`);kr(this,"status");kr(this,"statusText");kr(this,"response");kr(this,"detail");kr(this,"code");kr(this,"displayMessage");this.name="ApiError",this.status=n.status,this.statusText=n.statusText,this.response=r;try{if(this.detail=(i=JSON.parse(r))==null?void 0:i.detail,typeof this.detail=="string"&&(this.message=this.detail),Array.isArray(this.detail)){const s=this.detail[0];typeof s=="object"&&s!==null&&"msg"in s&&typeof s.msg=="string"&&(this.message=s.msg)}if(typeof this.detail=="object"&&this.detail!==null&&"code"in this.detail&&typeof this.detail.code=="string"&&(this.code=this.detail.code),typeof this.detail=="object"&&this.detail!==null&&"message"in this.detail&&typeof this.detail.message=="string"){const s="help"in this.detail&&typeof this.detail.help=="string"?` See ${this.detail.help} for help.`:"";this.message=`${this.detail.message}${s}`}}catch{this.detail=void 0,this.displayMessage=r||this.message;return}this.displayMessage=this.message}}function wz(e,t){return e instanceof Od?e.displayMessage||t:typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"&&e.message||t}class x2{constructor(t){this.baseUrl=t}async fetch(t,n){const r=`${this.baseUrl}${t}`;try{const{headers:i,...s}=n??{},a=(s.method??"GET").toUpperCase()==="GET"?"default":"no-store",l=new Headers(i);return typeof s.body=="string"&&!l.has("Content-Type")&&l.set("Content-Type","application/json"),await fetch(r,{...s,cache:s.cache??a,credentials:s.credentials??"include",headers:l})}catch(i){throw console.error(`[API] Request to ${r} failed:`,i),i}}async fetchOk(t,n){const r=await this.fetch(t,n);if(!r.ok){const i=new Od(r,await r.text());throw console.error("[API] Error response:",i.response),i}return r}async request(t,n){const r=await this.fetchOk(t,n);return r.status===204?void 0:await r.json()}}function b2(e){e instanceof Od&&e.status===401&&e.code!=="fresh_auth_required"&&e.code!=="saved_papers_bucket_authorization_required"&&typeof window<"u"&&window.dispatchEvent(new CustomEvent("pwc:auth-stale"))}async function pk(e){try{return await e()}catch(t){throw b2(t),t}}const cm=new x2(`${Bg()}/api/v1`),E2=(e,t)=>cm.fetch(e,t),xz=(e,t)=>pk(()=>cm.fetchOk(e,t)),cv=(e,t)=>pk(()=>cm.request(e,t));async function bz(e,t){try{return await cv(e,t)}catch(n){if(n instanceof Od&&n.status===404)return null;throw n}}const z0={async getCurrentUser(){if($o())return null;const e=await E2("/auth/me",{cache:"no-store"});return e.status===401||!e.ok?null:e.json()},async logout(){await cv("/auth/logout",{method:"POST"})},async requestStagingAccess(){await cv("/staging-access-request",{method:"POST"})}},S2={detail:e=>["paper",e],arxiv:e=>["paper-arxiv",e],preview:e=>["paper-preview",e],summary:e=>["paper-summary",e],feeds:{list:["papers"],infinite:["papers-infinite"],xTrending:["x-trending-papers-infinite"],following:["research-feed"],search:["paper-search-feed"],task:["task-papers-infinite"],conference:["conference-papers-infinite"],organization:["organization-papers-infinite"],method:["method-papers-infinite"],saved:["my-bookmarks"],related:["related-papers"],versions:["paper-versions"],searchOverlay:["search-papers"],mentions:["chat-paper-mention-search"],trending:["trending-papers"]}},Ez=10*60*1e3,hu={me:["auth","me"]},Sz={preferences:["account","preferences"],bookmarkIds:["my-bookmark-ids"]},Cz={areas:["areas-all"],area:e=>["area",e],topTasksSidebar:["top-tasks-sidebar"],task:e=>["task",e],method:e=>["method",e],organization:e=>["organization",e],dataset:e=>["dataset",e],datasets:["dataset"],datasetTasks:["dataset-tasks"],taskPage:["task-page"],taskBenchmarkTrends:["task-benchmark-trends"],organizations:["organizations"]},kz={all:["evaluations"],byPaper:e=>["evaluations","paper",e],byPaperAll:["evaluations","paper"],byDatasetAll:["dataset-evals"],byDataset:e=>["dataset-evals",e]},Pz={pendingEdits:["pendingPaperEdits"]},Rz={all:["admin"],cronStatus:["admin","cronStatus"],chatSandboxSpend:e=>["admin","chatSandboxSpend",e],chatWebSearchBudget:["admin","chatWebSearchBudget"],autonomousOperations:["admin","autonomousOperations"],paperMarkdownJobs:["admin","paperMarkdownJobs"],codexPaperJobs:["admin","codexPaperJobs"],codexPaperJob:(e,t)=>["admin","codexPaperJob",e,t],catalogAudit:["catalog-audit"]},Tz={follows:e=>["research-follows",e],topic:e=>["research-topic",e],email:e=>["research-email",e],feed:e=>[...S2.feeds.following,e]},dm=q.createContext(null),U0="pwc:auth-stale",C2=({children:e})=>{const t=zS(),n=dN({queryKey:hu.me,queryFn:()=>z0.getCurrentUser(),staleTime:1/0}),r=n.data??null,i=q.useRef(null),{refetch:s}=n,o=q.useCallback(async()=>{await s()},[s]),a=q.useCallback(async()=>{const u=qg("/api/v1/auth/logout");if(new URL(u,window.location.origin).origin!==window.location.origin){const c=document.createElement("form");c.method="POST",c.action=`${u}?return_to=${encodeURIComponent(window.location.href)}`,document.body.appendChild(c),c.submit();return}await z0.logout(),t.setQueryData(hu.me,null)},[t]);q.useEffect(()=>{},[r]),q.useEffect(()=>{i.current&&!r&&t.resetQueries({predicate:u=>u.queryKey[0]!==hu.me[0]}),i.current=r},[t,r]),q.useEffect(()=>{const u=()=>t.setQueryData(hu.me,null);return window.addEventListener(U0,u),()=>window.removeEventListener(U0,u)},[t]);const l=q.useMemo(()=>({user:r,isLoading:n.isPending,refresh:o,logout:a}),[r,n.isPending,o,a]);return w.jsx(dm.Provider,{value:l,children:e})};function vk(){const e=q.useContext(dm);if(!e)throw new Error("useAuth must be used inside an ");return e}function Iz(){return q.useContext(dm)}const Mr=({name:e,size:t=14})=>{const n={search:w.jsx("path",{d:"M11 11l3 3M7 12.5a5.5 5.5 0 110-11 5.5 5.5 0 010 11z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),bookmark:w.jsx("path",{d:"M4 2h8v12l-4-3-4 3V2z",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinejoin:"round"}),menu:w.jsx("path",{d:"M2 4h12M2 8h12M2 12h12",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),close:w.jsx("path",{d:"M3 3l10 10M13 3L3 13",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),github:w.jsx("path",{fill:"currentColor",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})};return w.jsx("svg",{className:t===11?"icon-sm":"icon",viewBox:"0 0 16 16",width:t,height:t,children:n[e]})},V0="https://github.com/huggingface/paperswithcode-feedback/issues",B0="https://github.com/huggingface/paperswithcode",k2="https://paperswithcode.co/following",q0="pwc:announcement:following-feed:v1:dismissed",th=[{to:"/",label:"Trending",end:!0},{to:"/tasks",label:"Browse state-of-the-art",end:!1},{to:"/methods",label:"Methods",end:!1},{to:"/conferences",label:"Conferences",end:!1},{to:"/organizations",label:"Organizations",end:!1},{to:"/submit",label:"Submit",end:!1}],P2=()=>{if(typeof navigator>"u")return!1;const e=navigator.userAgentData,t=(e==null?void 0:e.platform)||navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/i.test(t)},R2=()=>{const[e,t]=q.useState(!1);return q.useEffect(()=>{t(P2())},[]),w.jsx("kbd",{children:e?"⌘K":"Ctrl K"})},T2=({onOpenSearch:e})=>{const[t,n]=q.useState(!1),[r,i]=q.useState(()=>localStorage.getItem(q0)!=="1"),s=q.useRef(null),o=q.useRef(null),a=()=>n(!1),{user:l,logout:u}=vk(),c=hn(),d=c.pathname.startsWith("/pdf/"),f=`${c.pathname}${c.search}`||"/",m=$o(),_=al()?{to:"/chat",label:"Chat",end:!1,badge:"New"}:nF()?{to:"/chat",label:"Chat",end:!1,badge:"New",href:tF}:null,p=_?[th[0],_,...th.slice(1)]:th;return q.useLayoutEffect(()=>{var S;const y=s.current,h=o.current;if(!y||!h)return;let v=!1;const x=()=>{if(v)return;const P=y.querySelector(".nav-item.active"),C=(P==null?void 0:P.offsetWidth)??0;h.style.width=`${C}px`,h.style.transform=`translateX(${(P==null?void 0:P.offsetLeft)??0}px)`,h.style.opacity=C>0?"1":"0"};x();const b=window.requestAnimationFrame(()=>{h.classList.add("nav-indicator-ready")}),E=typeof ResizeObserver>"u"?null:new ResizeObserver(x);return E==null||E.observe(y),window.addEventListener("resize",x),(S=document.fonts)==null||S.ready.then(x),()=>{v=!0,window.cancelAnimationFrame(b),E==null||E.disconnect(),window.removeEventListener("resize",x)}},[c.pathname,p.length]),w.jsxs(H$,{open:t,onOpenChange:n,children:[w.jsxs("header",{className:"app-header",children:[w.jsxs("div",{className:"app-header-inner",children:[w.jsxs(ms,{to:"/",className:"brand",onClick:a,children:[w.jsx("span",{className:"brand-mark"}),w.jsxs("span",{className:"brand-name",children:["Papers ",w.jsx("em",{children:"With Code"})]})]}),w.jsxs("nav",{className:"nav",ref:s,children:[p.map(({to:y,label:h,end:v,badge:x,href:b})=>{const E=w.jsxs(w.Fragment,{children:[w.jsx("span",{children:h}),x&&w.jsx("span",{className:"nav-new-badge","aria-hidden":"true",children:x})]});return b?w.jsx("a",{href:b,target:"_blank",rel:"noreferrer",className:`nav-item${x?" nav-item-with-badge":""}`,children:E},y):w.jsx(ms,{to:y,end:v,className:({isActive:S})=>`nav-item${x?" nav-item-with-badge":""}${S?" active":""}`,children:E},y)}),w.jsx("span",{ref:o,className:"nav-indicator","aria-hidden":"true"})]}),w.jsx("div",{className:"header-spacer"}),w.jsx("a",{className:"feedback-link header-feedback-link",href:V0,target:"_blank",rel:"noreferrer",children:"Submit feedback"}),w.jsx("a",{className:"icon-btn header-github-btn",href:B0,target:"_blank",rel:"noreferrer","aria-label":"GitHub repository",title:"GitHub repository",children:w.jsx(Mr,{name:"github",size:14})}),w.jsxs("button",{className:"search-trigger","aria-label":"Search papers, authors, domains",onClick:e,children:[w.jsx(Mr,{name:"search",size:13}),w.jsx("span",{children:"Search papers, authors, domains…"}),w.jsx(R2,{})]}),w.jsx("button",{className:"icon-btn mobile-search-btn","aria-label":"Search",onClick:e,children:w.jsx(Mr,{name:"search",size:14})}),!m&&w.jsx(ms,{to:"/saved",className:"icon-btn header-bookmark-btn","aria-label":"Saved papers",title:"Saved papers",children:w.jsx(Mr,{name:"bookmark",size:13})}),m?null:l?w.jsx(_2,{user:l,onLogout:u}):w.jsx(_1,{returnTo:f}),w.jsx(G$,{asChild:!0,children:w.jsx("button",{className:"icon-btn mobile-menu-btn","aria-label":"Open menu",children:w.jsx(Mr,{name:"menu",size:14})})})]}),!d&&r&&w.jsxs("div",{className:"site-announcement",role:"status",children:[w.jsx("span",{children:"New: "}),m?w.jsx("a",{href:k2,target:"_blank",rel:"noreferrer",children:"following feed"}):w.jsx(bn,{to:"/following",children:"following feed"}),w.jsx("span",{children:", follow your favorite tasks, benchmarks, authors or organizations"}),w.jsx("button",{type:"button",className:"site-announcement-close","aria-label":"Dismiss announcement",onClick:()=>{localStorage.setItem(q0,"1"),i(!1)},children:w.jsx(Mr,{name:"close",size:11})})]})]}),w.jsx(K$,{children:w.jsx(Q$,{className:"mobile-nav-drawer",children:w.jsxs(Y$,{className:"mobile-nav-panel","aria-describedby":void 0,children:[w.jsx(X$,{className:"sr-only",children:"Navigation menu"}),w.jsx(J$,{className:"icon-btn mobile-nav-close","aria-label":"Close menu",children:w.jsx(Mr,{name:"close",size:14})}),w.jsxs("button",{type:"button",className:"mobile-nav-link mobile-nav-search",onClick:()=>{a(),e()},children:[w.jsx(Mr,{name:"search",size:14}),w.jsx("span",{children:"Search papers, authors, domains…"})]}),p.map(({to:y,label:h,end:v,badge:x,href:b})=>{const E=`mobile-nav-link${x?" mobile-nav-link-with-badge":""}`,S=w.jsxs(w.Fragment,{children:[w.jsx("span",{children:h}),x&&w.jsx("span",{className:"nav-new-badge","aria-hidden":"true",children:x})]});return b?w.jsx("a",{href:b,target:"_blank",rel:"noreferrer",className:E,onClick:a,children:S},y):w.jsx(ms,{to:y,end:v,className:E,onClick:a,children:S},y)}),w.jsx("a",{className:"mobile-nav-link",href:V0,target:"_blank",rel:"noreferrer",onClick:a,children:"Submit feedback"}),w.jsx("a",{className:"mobile-nav-link",href:B0,target:"_blank",rel:"noreferrer",onClick:a,children:"GitHub"}),!m&&w.jsx(ms,{to:"/saved",className:"mobile-nav-link",onClick:a,children:"Saved papers"}),!m&&(l==null?void 0:l.is_admin)&&w.jsx(ms,{to:"/admin-dashboard",className:"mobile-nav-link",onClick:a,children:"Admin dashboard"})]})})})]})},I2=()=>{const{pathname:e}=hn();return e==="/chat"||e.startsWith("/chat/")||e.startsWith("/pdf/")?null:w.jsx("footer",{className:"site-footer",children:w.jsxs("div",{className:"site-footer-inner",children:[w.jsxs("span",{children:["© ",new Date().getFullYear()," Hugging Face"]}),w.jsx(bn,{to:"/docs/api",children:"API"}),w.jsx(bn,{to:"/mcp",children:"MCP"}),w.jsx(bn,{to:"/privacy",children:"Privacy"}),w.jsx("a",{href:"https://github.com/huggingface/paperswithcode-feedback/issues",target:"_blank",rel:"noreferrer",children:"Feedback"})]})})},O2=1,M2=1e6;let nh=0;function A2(){return nh=(nh+1)%Number.MAX_SAFE_INTEGER,nh.toString()}const rh=new Map,W0=e=>{if(rh.has(e))return;const t=setTimeout(()=>{rh.delete(e),Ia({type:"REMOVE_TOAST",toastId:e})},M2);rh.set(e,t)},N2=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,O2)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?W0(n):e.toasts.forEach(r=>{W0(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Lu=[];let ju={toasts:[]};function Ia(e){ju=N2(ju,e),Lu.forEach(t=>{t(ju)})}function $2({...e}){const t=A2(),n=i=>Ia({type:"UPDATE_TOAST",toast:{...i,id:t}}),r=()=>Ia({type:"DISMISS_TOAST",toastId:t});return Ia({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||r()}}}),{id:t,dismiss:r,update:n}}function F2(){const[e,t]=g.useState(ju);return g.useEffect(()=>(Lu.push(t),()=>{const n=Lu.indexOf(t);n>-1&&Lu.splice(n,1)}),[e]),{...e,toast:$2,dismiss:n=>Ia({type:"DISMISS_TOAST",toastId:n})}}var L2=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),j2="VisuallyHidden",fm=g.forwardRef((e,t)=>w.jsx(ke.span,{...e,ref:t,style:{...L2,...e.style}}));fm.displayName=j2;var hm="ToastProvider",[pm,D2,z2]=Kg("Toast"),[gk]=ss("Toast",[z2]),[U2,Md]=gk(hm),mk=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:s=50,children:o}=e,[a,l]=g.useState(null),[u,c]=g.useState(0),d=g.useRef(!1),f=g.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${hm}\`. Expected non-empty \`string\`.`),w.jsx(pm.Provider,{scope:t,children:w.jsx(U2,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:s,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:g.useCallback(()=>c(m=>m+1),[]),onToastRemove:g.useCallback(()=>c(m=>m-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};mk.displayName=hm;var yk="ToastViewport",V2=["F8"],dv="toast.viewportPause",fv="toast.viewportResume",_k=g.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=V2,label:i="Notifications ({hotkey})",...s}=e,o=Md(yk,n),a=D2(n),l=g.useRef(null),u=g.useRef(null),c=g.useRef(null),d=g.useRef(null),f=et(t,d,o.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),_=o.toastCount>0;g.useEffect(()=>{const y=h=>{var x;r.length!==0&&r.every(b=>h[b]||h.code===b)&&((x=d.current)==null||x.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),g.useEffect(()=>{const y=l.current,h=d.current;if(_&&y&&h){const v=()=>{if(!o.isClosePausedRef.current){const S=new CustomEvent(dv);h.dispatchEvent(S),o.isClosePausedRef.current=!0}},x=()=>{if(o.isClosePausedRef.current){const S=new CustomEvent(fv);h.dispatchEvent(S),o.isClosePausedRef.current=!1}},b=S=>{!y.contains(S.relatedTarget)&&x()},E=()=>{y.contains(document.activeElement)||x()};return y.addEventListener("focusin",v),y.addEventListener("focusout",b),y.addEventListener("pointermove",v),y.addEventListener("pointerleave",E),window.addEventListener("blur",v),window.addEventListener("focus",x),()=>{y.removeEventListener("focusin",v),y.removeEventListener("focusout",b),y.removeEventListener("pointermove",v),y.removeEventListener("pointerleave",E),window.removeEventListener("blur",v),window.removeEventListener("focus",x)}}},[_,o.isClosePausedRef]);const p=g.useCallback(({tabbingDirection:y})=>{const v=a().map(x=>{const b=x.ref.current,E=[b,...t3(b)];return y==="forwards"?E:E.reverse()});return(y==="forwards"?v.reverse():v).flat()},[a]);return g.useEffect(()=>{const y=d.current;if(y){const h=v=>{var E,S,P;const x=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!x){const C=document.activeElement,T=v.shiftKey;if(v.target===y&&T){(E=u.current)==null||E.focus();return}const M=p({tabbingDirection:T?"backwards":"forwards"}),z=M.findIndex(F=>F===C);ih(M.slice(z+1))?v.preventDefault():T?(S=u.current)==null||S.focus():(P=c.current)==null||P.focus()}};return y.addEventListener("keydown",h),()=>y.removeEventListener("keydown",h)}},[a,p]),w.jsxs(NN,{ref:l,role:"region","aria-label":i.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:_?void 0:"none"},children:[_&&w.jsx(hv,{ref:u,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"forwards"});ih(y)}}),w.jsx(pm.Slot,{scope:n,children:w.jsx(ke.ol,{tabIndex:-1,...s,ref:f})}),_&&w.jsx(hv,{ref:c,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"backwards"});ih(y)}})]})});_k.displayName=yk;var wk="ToastFocusProxy",hv=g.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,s=Md(wk,n);return w.jsx(fm,{tabIndex:0,...i,ref:t,style:{position:"fixed"},onFocus:o=>{var u;const a=o.relatedTarget;!((u=s.viewport)!=null&&u.contains(a))&&r()}})});hv.displayName=wk;var Rl="Toast",B2="toast.swipeStart",q2="toast.swipeMove",W2="toast.swipeCancel",H2="toast.swipeEnd",xk=g.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:i,onOpenChange:s,...o}=e,[a,l]=yd({prop:r,defaultProp:i??!0,onChange:s,caller:Rl});return w.jsx(br,{present:n||a,children:w.jsx(Q2,{open:a,...o,ref:t,onClose:()=>l(!1),onPause:Ut(e.onPause),onResume:Ut(e.onResume),onSwipeStart:ee(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ee(e.onSwipeMove,u=>{const{x:c,y:d}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${d}px`)}),onSwipeCancel:ee(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ee(e.onSwipeEnd,u=>{const{x:c,y:d}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${d}px`),l(!1)})})})});xk.displayName=Rl;var[G2,K2]=gk(Rl,{onClose(){}}),Q2=g.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:i,open:s,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:c,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:m,..._}=e,p=Md(Rl,n),[y,h]=g.useState(null),v=et(t,F=>h(F)),x=g.useRef(null),b=g.useRef(null),E=i||p.duration,S=g.useRef(0),P=g.useRef(E),C=g.useRef(0),{onToastAdd:T,onToastRemove:R}=p,N=Ut(()=>{var W;(y==null?void 0:y.contains(document.activeElement))&&((W=p.viewport)==null||W.focus()),o()}),M=g.useCallback(F=>{!F||F===1/0||(window.clearTimeout(C.current),S.current=new Date().getTime(),C.current=window.setTimeout(N,F))},[N]);g.useEffect(()=>{const F=p.viewport;if(F){const W=()=>{M(P.current),u==null||u()},B=()=>{const Q=new Date().getTime()-S.current;P.current=P.current-Q,window.clearTimeout(C.current),l==null||l()};return F.addEventListener(dv,B),F.addEventListener(fv,W),()=>{F.removeEventListener(dv,B),F.removeEventListener(fv,W)}}},[p.viewport,E,l,u,M]),g.useEffect(()=>{s&&!p.isClosePausedRef.current&&M(E)},[s,E,p.isClosePausedRef,M]),g.useEffect(()=>(T(),()=>R()),[T,R]);const z=g.useMemo(()=>y?Rk(y):null,[y]);return p.viewport?w.jsxs(w.Fragment,{children:[z&&w.jsx(Y2,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:z}),w.jsx(G2,{scope:n,onClose:N,children:xl.createPortal(w.jsx(pm.ItemSlot,{scope:n,children:w.jsx(AN,{asChild:!0,onEscapeKeyDown:ee(a,()=>{p.isFocusedToastEscapeKeyDownRef.current||N(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:w.jsx(ke.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":p.swipeDirection,..._,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ee(e.onKeyDown,F=>{F.key==="Escape"&&(a==null||a(F.nativeEvent),F.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,N()))}),onPointerDown:ee(e.onPointerDown,F=>{F.button===0&&(x.current={x:F.clientX,y:F.clientY})}),onPointerMove:ee(e.onPointerMove,F=>{if(!x.current)return;const W=F.clientX-x.current.x,B=F.clientY-x.current.y,Q=!!b.current,O=["left","right"].includes(p.swipeDirection),A=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,V=O?A(0,W):0,K=O?0:A(0,B),te=F.pointerType==="touch"?10:2,oe={x:V,y:K},de={originalEvent:F,delta:oe};Q?(b.current=oe,pu(q2,d,de,{discrete:!1})):H0(oe,p.swipeDirection,te)?(b.current=oe,pu(B2,c,de,{discrete:!1}),F.target.setPointerCapture(F.pointerId)):(Math.abs(W)>te||Math.abs(B)>te)&&(x.current=null)}),onPointerUp:ee(e.onPointerUp,F=>{const W=b.current,B=F.target;if(B.hasPointerCapture(F.pointerId)&&B.releasePointerCapture(F.pointerId),b.current=null,x.current=null,W){const Q=F.currentTarget,O={originalEvent:F,delta:W};H0(W,p.swipeDirection,p.swipeThreshold)?pu(H2,m,O,{discrete:!0}):pu(W2,f,O,{discrete:!0}),Q.addEventListener("click",A=>A.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),Y2=e=>{const{__scopeToast:t,children:n,...r}=e,i=Md(Rl,t),[s,o]=g.useState(!1),[a,l]=g.useState(!1);return Z2(()=>o(!0)),g.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:w.jsx(wd,{asChild:!0,children:w.jsx(fm,{...r,children:s&&w.jsxs(w.Fragment,{children:[i.label," ",n]})})})},X2="ToastTitle",bk=g.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return w.jsx(ke.div,{...r,ref:t})});bk.displayName=X2;var J2="ToastDescription",Ek=g.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return w.jsx(ke.div,{...r,ref:t})});Ek.displayName=J2;var Sk="ToastAction",Ck=g.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?w.jsx(Pk,{altText:n,asChild:!0,children:w.jsx(vm,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Sk}\`. Expected non-empty \`string\`.`),null)});Ck.displayName=Sk;var kk="ToastClose",vm=g.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,i=K2(kk,n);return w.jsx(Pk,{asChild:!0,children:w.jsx(ke.button,{type:"button",...r,ref:t,onClick:ee(e.onClick,i.onClose)})})});vm.displayName=kk;var Pk=g.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...i}=e;return w.jsx(ke.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Rk(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),e3(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!i)if(s){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...Rk(r))}}),t}function pu(e,t,n,{discrete:r}){const i=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lg(i,s):i.dispatchEvent(s)}var H0=(e,t,n=0)=>{const r=Math.abs(e.x),i=Math.abs(e.y),s=r>i;return t==="left"||t==="right"?s&&r>n:!s&&i>n};function Z2(e=()=>{}){const t=Ut(e);fn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function e3(e){return e.nodeType===e.ELEMENT_NODE}function t3(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ih(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var n3=mk,Tk=_k,Ik=xk,Ok=bk,Mk=Ek,Ak=Ck,Nk=vm;const G0=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,K0=N1,r3=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return K0(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(u=>{const c=n==null?void 0:n[u],d=s==null?void 0:s[u];if(c===null)return null;const f=G0(c)||G0(d);return i[u][f]}),a=n&&Object.entries(n).reduce((u,c)=>{let[d,f]=c;return f===void 0||(u[d]=f),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:f,...m}=c;return Object.entries(m).every(_=>{let[p,y]=_;return Array.isArray(y)?y.includes({...s,...a}[p]):{...s,...a}[p]===y})?[...u,d,f]:u},[]);return K0(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},i3=n3,$k=g.forwardRef(({className:e,...t},n)=>w.jsx(Tk,{ref:n,className:ct("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));$k.displayName=Tk.displayName;const s3=r3("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-16 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Fk=g.forwardRef(({className:e,variant:t,...n},r)=>w.jsx(Ik,{ref:r,className:ct(s3({variant:t}),e),...n}));Fk.displayName=Ik.displayName;const o3=g.forwardRef(({className:e,...t},n)=>w.jsx(Ak,{ref:n,className:ct("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));o3.displayName=Ak.displayName;const Lk=g.forwardRef(({className:e,...t},n)=>w.jsx(Nk,{ref:n,className:ct("absolute right-2 top-2 inline-flex h-11 w-11 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring group-[.destructive]:text-destructive-foreground group-[.destructive]:hover:bg-destructive-foreground/10 group-[.destructive]:focus:ring-destructive-foreground",e),"aria-label":"Dismiss notification","toast-close":"",...t,children:w.jsx(d2,{className:"h-4 w-4"})}));Lk.displayName=Nk.displayName;const jk=g.forwardRef(({className:e,...t},n)=>w.jsx(Ok,{ref:n,className:ct("text-sm font-semibold",e),...t}));jk.displayName=Ok.displayName;const Dk=g.forwardRef(({className:e,...t},n)=>w.jsx(Mk,{ref:n,className:ct("text-sm opacity-90",e),...t}));Dk.displayName=Mk.displayName;function a3(){const{toasts:e}=F2();return w.jsxs(i3,{children:[e.map(function({id:t,title:n,description:r,action:i,...s}){return w.jsxs(Fk,{...s,children:[w.jsxs("div",{className:"grid gap-1",children:[n&&w.jsx(jk,{children:n}),r&&w.jsx(Dk,{children:r})]}),i,w.jsx(Lk,{})]},t)}),w.jsx($k,{})]})}function l3(){const{pathname:e,hash:t}=hn();g.useLayoutEffect(()=>{t||window.scrollTo({top:0,left:0,behavior:"instant"})},[e,t])}const zk=iF(),u3=zk?bA:xA;if(!zk&&typeof window<"u"){const e=window.location.hash;e.startsWith("#/")&&!e.startsWith("#//")&&window.history.replaceState(null,"",e.slice(1))}const c3=q.lazy(()=>ae(()=>import("./AuthorizePaperEditView-DNfre5z5.js"),__vite__mapDeps([0,1,2,3]))),d3=q.lazy(()=>ae(()=>import("./FollowingView-Ctbw54vk.js"),__vite__mapDeps([4,5,6,7,8,9,1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]))),Q0=q.lazy(()=>ae(()=>import("./FeedView-tA68x8iy.js"),__vite__mapDeps([5,6,7,8,9,1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]))),f3=q.lazy(()=>ae(()=>import("./ChatView-D06zYumh.js"),__vite__mapDeps([34,35,29,30,21,22,36,37,8,38,39,40,41,42,43,1,44,45,46,47,11,48,49,15,16,50,51,27,28,52,53,54]))),h3=q.lazy(()=>ae(()=>import("./SharedChatView-Cd2cL7B4.js"),__vite__mapDeps([55,35,29,30,21,22,36,37,8,38,39,40,41,42,43,1,44,45,46,47,11,48,49,15,16,50,51]))),p3=q.lazy(()=>ae(()=>import("./PapersListView-BwwaBBb8.js"),__vite__mapDeps([56,17,18,10,19,13,14,15,16,20,21,22,23,24,25,26,8,31,32,57,33,58,59]))),v3=q.lazy(()=>ae(()=>import("./PaperDetailView-BlSDULsI.js"),__vite__mapDeps([60,1,19,17,18,10,20,61,22,36,23,62,21,63,31,32,64,65,66,25,33,2,7,28,44,67,68,69,70,24,48,71,37,8,72,73,74,75,11,76,77,38,78,79,41,42,26,80,81,15,16,82]))),g3=q.lazy(()=>ae(()=>import("./PaperReaderView-C7GrMxPx.js"),__vite__mapDeps([83,35,29,30,21,22,36,37,8,38,39,40,41,42,43,1,44,45,46,47,11,48,49,15,16,50,51,84,63,23,31,32,34,27,28,52,53,54]))),m3=q.lazy(()=>ae(()=>import("./TagsIndexView-BwVoxBoD.js"),__vite__mapDeps([85,8,18,10,86,48,87,52,88,89,45,75,90,39,91,77,6,33,92,25,93,72,2,69,73,70,24,7,71,1,74,11,94,95]))),y3=q.lazy(()=>ae(()=>import("./TagBrowseView-DKVo9Mlp.js"),__vite__mapDeps([96,97,9,1,11,17,18,10,13,14,15,16,19,20,21,22,23,24,25,26,12,98,84,40,41,42,43,36,51,8,58,59,65,66,86,31,32,33,99,90,38]))),_3=q.lazy(()=>ae(()=>import("./MethodsIndexView-D_aKGLyJ.js"),__vite__mapDeps([100,8,95,86,33,92,25,93,72,2,69,73,70,24,7,48,71,1,74,11,94,88]))),w3=q.lazy(()=>ae(()=>import("./FrameworksIndexView-CZmHXkeL.js"),__vite__mapDeps([101,19,8,18,59]))),x3=q.lazy(()=>ae(()=>import("./TrendsView-DCijqOnv.js"),__vite__mapDeps([102,33,25]))),b3=q.lazy(()=>ae(()=>import("./ConferencesIndexView-DJVYKUiz.js"),__vite__mapDeps([103,8,104,33,92,25,93,72,2,69,73,70,24,7,48,71,1,74,11]))),E3=q.lazy(()=>ae(()=>import("./AiDeadlinesView--bEB1R4q.js"),__vite__mapDeps([105,8,106,78,25,33,23,7,104]))),S3=q.lazy(()=>ae(()=>import("./ConferenceDetailView-DgDeLFoO.js"),__vite__mapDeps([107,92,25,84,40,41,42,43,36,21,22,1,51,8,58,95,18,108,104,10,33,23,99]))),C3=q.lazy(()=>ae(()=>import("./ConferenceTaskView-BvWfAecx.js"),__vite__mapDeps([109,13,14,15,16,17,18,10,19,20,21,22,23,24,25,26,84,40,41,42,43,36,1,51,8,58,108,31,32,33,99]))),k3=q.lazy(()=>ae(()=>import("./OrganizationsIndexView-DpJistoL.js"),__vite__mapDeps([110,33,8,111]))),P3=q.lazy(()=>ae(()=>import("./OrganizationDetailView-DYOQ1Mwd.js"),__vite__mapDeps([112,97,9,1,11,84,40,41,42,43,36,21,22,51,113,25,8,13,14,15,16,17,18,10,19,20,23,24,26,33,70,2,7,48,71,31,32,58,81,99]))),R3=q.lazy(()=>ae(()=>import("./OrganizationDetailView-DYOQ1Mwd.js"),__vite__mapDeps([112,97,9,1,11,84,40,41,42,43,36,21,22,51,113,25,8,13,14,15,16,17,18,10,19,20,23,24,26,33,70,2,7,48,71,31,32,58,81,99]))),T3=q.lazy(()=>ae(()=>import("./AuthorDetailView-BykOxZh0.js"),__vite__mapDeps([114,15,16,13,14,17,18,10,19,20,21,22,23,24,25,26,97,9,1,11,33,31,32,58,99]))),I3=q.lazy(()=>ae(()=>import("./MethodDetailView-5wFkSBs8.js"),__vite__mapDeps([115,97,9,1,11,17,18,10,13,14,15,16,19,20,21,22,23,24,25,26,84,40,41,42,43,36,51,8,58,86,31,32,33,99]))),O3=q.lazy(()=>ae(()=>import("./BenchmarkDetailView-BObHaEFx.js"),__vite__mapDeps([116,97,9,1,11,8,61,22,36,23,62,65,66,20,106,78,19,25,33,98,86,58,99,117]))),M3=q.lazy(()=>ae(()=>import("./SavedPapersView-B2fQDeYi.js"),__vite__mapDeps([118,14,15,16,17,18,10,19,20,21,22,23,25,33,66,80]))),A3=q.lazy(()=>ae(()=>import("./SettingsView-BuCdwlbq.js"),__vite__mapDeps([119,1,9,106,78,6,12,90,30,64,53,65,66,47,89]))),N3=q.lazy(()=>ae(()=>import("./PrivacyView-BQ3x7IFA.js"),__vite__mapDeps([120,64]))),$3=q.lazy(()=>ae(()=>import("./ApiDocsView-DhYUFS5g.js"),__vite__mapDeps([121,64,41,122]))),F3=q.lazy(()=>ae(()=>import("./McpView-DYa6GKrp.js"),__vite__mapDeps([123,64,54,38,47,44,124]))),L3=q.lazy(()=>ae(()=>import("./SubmitView-CDuD6xEz.js"),__vite__mapDeps([125,1,33,2,69,73,21,22,68]))),j3=q.lazy(()=>ae(()=>import("./CronDashboard-kqcQ1rzf.js"),__vite__mapDeps([126,1,127,128,76,2,49,75,88,91,39,87,47,129,71,130,79,32,3,8,30]))),D3=q.lazy(()=>ae(()=>import("./AutonomousOperations-B4vSAvB8.js"),__vite__mapDeps([131,1,127,128,76,2,69,91,46]))),z3=q.lazy(()=>ae(()=>import("./SubmissionsDashboard-CZ6QfHso.js"),__vite__mapDeps([132,67,68,1,32,8,23,74,21,22,129,71,130,133]))),U3=q.lazy(()=>ae(()=>import("./UserProfileView-BnW4I15t.js"),__vite__mapDeps([134,113,25,8]))),V3=q.lazy(()=>ae(()=>import("./RateLimitsView-phVSVOy1.js"),__vite__mapDeps([135,66]))),B3=q.lazy(()=>ae(()=>import("./AstraForRoboticsView-BZJ-P8S9.js"),__vite__mapDeps([136,13,14,15,16,17,18,10,19,20,21,22,23,24,25,26,33,31,32,64,137]))),sh=q.lazy(()=>ae(()=>import("./NotFound-DV_nwcxG.js"),[])),q3=q.lazy(()=>ae(()=>import("./SearchOverlay-5zBt7fdP.js"),__vite__mapDeps([138,20,8,21,22,57,18,10]))),W3=q.lazy(()=>ae(()=>import("./StagingAccessRequestView-CZz80h2x.js"),__vite__mapDeps([139,130]))),Uk=()=>w.jsxs("div",{className:"page","aria-busy":"true","aria-live":"polite",children:[w.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:24,width:"30%",marginBottom:24}}),w.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:64,width:"60%",marginBottom:32}}),w.jsxs("div",{className:"paper-list",style:{display:"grid",gap:16},children:[w.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}}),w.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}}),w.jsx("div",{className:"animate-pulse rounded-md bg-muted",style:{height:96}})]})]}),H3=new JA({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}}),G3=()=>{const{arxivId:e}=xS();return w.jsx(Ro,{to:e?`/paper/${e}`:"/papers",replace:!0})},K3=()=>{const{taskSlug:e}=xS();return w.jsx(Ro,{to:e?`/tasks/${e}`:"/tasks",replace:!0})},Q3=({element:e})=>$o()?w.jsx(Ro,{to:"/",replace:!0}):w.jsx(w.Fragment,{children:e}),pv=({element:e})=>{const{user:t,isLoading:n}=vk(),r=hn();return $o()?w.jsx(Ro,{to:"/",replace:!0}):n?w.jsx("div",{className:"page",children:w.jsx("div",{className:"submission-loading",children:w.jsx("span",{children:"Checking admin session..."})})}):t?t.is_admin?w.jsx(w.Fragment,{children:e}):w.jsx("div",{className:"page",children:w.jsxs("div",{className:"submission-empty submission-empty-warn",children:[w.jsx("h1",{children:"Admin access required"}),w.jsxs("p",{children:["Signed in as @",t.username,". This dashboard is limited to allowlisted admin accounts."]})]})}):w.jsx("div",{className:"page",children:w.jsxs("div",{className:"submission-empty submission-empty-warn",children:[w.jsx("h1",{children:"Sign in required"}),w.jsx("p",{children:"Sign in with an allowlisted Hugging Face admin account to view admin operations."}),w.jsx(_1,{returnTo:`${r.pathname}${r.search}`})]})})},Y3=()=>{const e=eF(),t=typeof window<"u"&&new URL(e,window.location.origin).origin!==window.location.origin;return q.useEffect(()=>{t&&window.location.replace(e)},[e,t]),t?w.jsx("div",{className:"page",children:w.jsxs("div",{className:"submission-loading",children:[w.jsx("span",{children:"Opening the production admin dashboard..."}),w.jsx("a",{href:e,children:"Continue"})]})}):w.jsx(pv,{element:w.jsx(j3,{})})},Y0=({reader:e=!1})=>{const[t,n]=q.useState(!1),{pathname:r}=hn();q.useEffect(()=>{const a=l=>{(l.metaKey||l.ctrlKey)&&l.key==="k"&&(l.preventDefault(),n(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);const i=w.jsx(T2,{onOpenSearch:()=>n(!0)}),s=w.jsx(fS,{resetKey:r,children:w.jsx(q.Suspense,{fallback:w.jsx(Uk,{}),children:w.jsx(dA,{})})}),o=t&&w.jsx(q.Suspense,{fallback:null,children:w.jsx(q3,{open:t,onClose:()=>n(!1)})});return e?w.jsxs("div",{className:"reader-route-shell",children:[i,w.jsx("div",{className:"reader-route-content",children:s}),o]}):w.jsxs(w.Fragment,{children:[i,w.jsx("main",{children:s}),w.jsx(I2,{}),o]})},X3=()=>(l3(),q.useLayoutEffect(()=>{var e;(e=document.getElementById("initial-discovery-footer"))==null||e.remove()},[]),w.jsxs(fA,{children:[w.jsx(re,{path:"/request-access",element:w.jsx(q.Suspense,{fallback:w.jsx(Uk,{}),children:w.jsx(W3,{})})}),w.jsx(re,{element:w.jsx(Y0,{reader:!0}),children:w.jsx(re,{path:"/pdf/:paperId",element:rF()?w.jsx(g3,{}):w.jsx(sh,{})})}),w.jsxs(re,{element:w.jsx(Y0,{}),children:[w.jsx(re,{path:"/",element:w.jsx(Q0,{})}),w.jsx(re,{path:"/following",element:w.jsx(d3,{})}),w.jsx(re,{path:"/x-trending",element:w.jsx(Q0,{xTrending:!0})}),w.jsx(re,{path:"/chat/:sessionId?",element:al()?w.jsx(f3,{}):w.jsx(Ro,{to:"/",replace:!0})}),w.jsx(re,{path:"/share/:shareId",element:al()?w.jsx(h3,{}):w.jsx(sh,{})}),w.jsx(re,{path:"/papers",element:w.jsx(p3,{})}),w.jsx(re,{path:"/papers/:arxivId",element:w.jsx(G3,{})}),w.jsx(re,{path:"/paper/:arxivId",element:w.jsx(v3,{})}),w.jsx(re,{path:"/tasks",element:w.jsx(m3,{})}),w.jsx(re,{path:"/tasks/:taskSlug",element:w.jsx(y3,{})}),w.jsx(re,{path:"/task/:taskSlug",element:w.jsx(K3,{})}),w.jsx(re,{path:"/methods",element:w.jsx(_3,{})}),w.jsx(re,{path:"/methods/:methodSlug",element:w.jsx(I3,{})}),w.jsx(re,{path:"/frameworks",element:w.jsx(w3,{})}),w.jsx(re,{path:"/trends",element:w.jsx(x3,{})}),w.jsx(re,{path:"/conferences",element:w.jsx(b3,{})}),w.jsx(re,{path:"/ai-deadlines",element:w.jsx(E3,{})}),w.jsx(re,{path:"/conferences/:confSlug",element:w.jsx(S3,{})}),w.jsx(re,{path:"/conferences/:confSlug/:taskSlug",element:w.jsx(C3,{})}),w.jsx(re,{path:"/organizations",element:w.jsx(k3,{})}),w.jsx(re,{path:"/orgs/:orgSlug",element:w.jsx(P3,{})}),w.jsx(re,{path:"/orgs/:orgSlug/:taskSlug",element:w.jsx(R3,{})}),w.jsx(re,{path:"/authors/:authorId",element:w.jsx(T3,{})}),w.jsx(re,{path:"/benchmark/:datasetSlug",element:w.jsx(O3,{})}),w.jsx(re,{path:"/authorize-paper-edit/:authorizationId",element:w.jsx(c3,{})}),w.jsx(re,{path:"/submit",element:w.jsx(L3,{})}),w.jsx(re,{path:"/saved",element:w.jsx(Q3,{element:w.jsx(M3,{})})}),w.jsx(re,{path:"/settings",element:w.jsx(A3,{})}),w.jsx(re,{path:"/privacy",element:w.jsx(N3,{})}),w.jsx(re,{path:"/docs/api",element:w.jsx($3,{})}),w.jsx(re,{path:"/mcp",element:w.jsx(F3,{})}),w.jsx(re,{path:"/admin-dashboard",element:w.jsx(Y3,{})}),w.jsx(re,{path:"/autonomous-operations",element:w.jsx(pv,{element:w.jsx(D3,{})})}),w.jsx(re,{path:"/cron-dashboard",element:w.jsx(Ro,{to:"/admin-dashboard",replace:!0})}),w.jsx(re,{path:"/submissions",element:w.jsx(pv,{element:w.jsx(z3,{})})}),w.jsx(re,{path:"/rate-limits",element:w.jsx(V3,{})}),w.jsx(re,{path:"/astra-for-robotics",element:w.jsx(B3,{})}),w.jsx(re,{path:"/:username",element:w.jsx(U3,{})}),w.jsx(re,{path:"*",element:w.jsx(sh,{})})]})]})),J3=()=>w.jsx(ZA,{client:H3,children:w.jsxs(C2,{children:[w.jsx(u3,{children:w.jsx(X3,{})}),w.jsx(a3,{}),!1]})});_M();const Z3=w.jsx(_T,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,storageKey:"pwc-theme",children:w.jsx(fS,{children:w.jsx(J3,{})})}),ez=wb(document.getElementById("root"));ez.render(w.jsx(q.StrictMode,{children:Z3}));export{h2 as $,yd as A,et as B,l2 as C,ee as D,xj as E,ss as F,ct as G,_1 as H,Rz as I,dz as J,yz as K,bn as L,B1 as M,Bj as N,hC as O,br as P,c2 as Q,Vj as R,o3 as S,Ez as T,Od as U,q as V,Sz as W,d2 as X,rF as Y,cz as Z,f2 as _,vk as a,oz as a$,fk as a0,er as a1,fz as a2,uz as a3,pz as a4,aw as a5,Z$ as a6,ae as a7,N1 as a8,u2 as a9,Pz as aA,z1 as aB,U1 as aC,V1 as aD,El as aE,at as aF,Up as aG,TS as aH,WA as aI,eN as aJ,rN as aK,aN as aL,iN as aM,sN as aN,At as aO,uN as aP,l0 as aQ,oN as aR,il as aS,QA as aT,OS as aU,xz as aV,bz as aW,t1 as aX,Dg as aY,HS as aZ,jg as a_,xl as aa,b2 as ab,cv as ac,x1 as ad,r3 as ae,Qs as af,H$ as ag,K$ as ah,Q$ as ai,Y$ as aj,vi as ak,J$ as al,X$ as am,lz as an,Ro as ao,Rj as ap,Tj as aq,rC as ar,wd as as,_d as at,Ij as au,Oj as av,rz as aw,nz as ax,E2 as ay,vz as az,dN as b,sz as b0,cN as b1,qg as b2,z0 as b3,hn as c,g as d,Mg as e,Iz as f,iz as g,y1 as h,zS as i,w as j,$o as k,al as l,nF as m,tF as n,Cz as o,S2 as p,hz as q,Tz as r,Id as s,kz as t,xS as u,gz as v,mz as w,F2 as x,wz as y,ke as z}; diff --git a/assets/index-ZkEATkOr.js b/assets/index-mCi_y_l3.js similarity index 83% rename from assets/index-ZkEATkOr.js rename to assets/index-mCi_y_l3.js index 87cb5b1667954fa629fcff49c1a93ff50fd99763..9b37b0df214c0fad3ee4c943ff908c1c09e178e4 100644 --- a/assets/index-ZkEATkOr.js +++ b/assets/index-mCi_y_l3.js @@ -1,4 +1,4 @@ -import{ar as We,$ as Ot,j as Ze}from"./index-CbgxfyGU.js";function hu(){}function mu(e){const n=[],t=String(e||"");let r=t.indexOf(","),i=0,l=!1;for(;!l;){r===-1&&(r=t.length,l=!0);const o=t.slice(i,r).trim();(o||!l)&&n.push(o),i=r+1,r=t.indexOf(",",i)}return n}function Ir(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const Tr=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ar=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pr={};function Vn(e,n){return(Pr.jsx?Ar:Tr).test(e)}const zr=/[ \t\n\f\r]/g;function Lr(e){return typeof e=="object"?e.type==="text"?qn(e.value):!1:qn(e)}function qn(e){return e.replace(zr,"")===""}class Me{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}Me.prototype.normal={};Me.prototype.property={};Me.prototype.space=void 0;function _t(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Me(t,r,n)}function fn(e){return e.toLowerCase()}class J{constructor(n,t){this.attribute=t,this.property=n}}J.prototype.attribute="";J.prototype.booleanish=!1;J.prototype.boolean=!1;J.prototype.commaOrSpaceSeparated=!1;J.prototype.commaSeparated=!1;J.prototype.defined=!1;J.prototype.mustUseProperty=!1;J.prototype.number=!1;J.prototype.overloadedBoolean=!1;J.prototype.property="";J.prototype.spaceSeparated=!1;J.prototype.space=void 0;let vr=0;const z=be(),$=be(),hn=be(),k=be(),R=be(),Ie=be(),ee=be();function be(){return 2**++vr}const mn=Object.freeze(Object.defineProperty({__proto__:null,boolean:z,booleanish:$,commaOrSpaceSeparated:ee,commaSeparated:Ie,number:k,overloadedBoolean:hn,spaceSeparated:R},Symbol.toStringTag,{value:"Module"})),en=Object.keys(mn);class En extends J{constructor(n,t,r,i){let l=-1;if(super(n,t),$n(this,"space",i),typeof r=="number")for(;++l4&&t.slice(0,4)==="data"&&Fr.test(n)){if(n.charAt(4)==="-"){const l=n.slice(5).replace(Wn,Br);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=n.slice(4);if(!Wn.test(l)){let o=l.replace(Nr,Mr);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}i=En}return new i(r,n)}function Mr(e){return"-"+e.toLowerCase()}function Br(e){return e.charAt(1).toUpperCase()}const jr=_t([Nt,Dr,Mt,Bt,jt],"html"),Cn=_t([Nt,Or,Mt,Bt,jt],"svg");function du(e){const n=String(e||"").trim();return n?n.split(/[ \t\n\r\f]+/g):[]}function Hr(e){return e.join(" ").trim()}var In={},Yn=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ur=/\n/g,Vr=/^\s*/,qr=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,$r=/^:\s*/,Wr=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Yr=/^[;\s]*/,Xr=/^\s+|\s+$/g,Qr=` +import{ax as We,a5 as Ot,j as Ze}from"./index-DyXq7-Tg.js";function hu(){}function mu(e){const n=[],t=String(e||"");let r=t.indexOf(","),i=0,l=!1;for(;!l;){r===-1&&(r=t.length,l=!0);const o=t.slice(i,r).trim();(o||!l)&&n.push(o),i=r+1,r=t.indexOf(",",i)}return n}function Ir(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const Tr=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ar=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pr={};function Vn(e,n){return(Pr.jsx?Ar:Tr).test(e)}const zr=/[ \t\n\f\r]/g;function Lr(e){return typeof e=="object"?e.type==="text"?qn(e.value):!1:qn(e)}function qn(e){return e.replace(zr,"")===""}class Me{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}Me.prototype.normal={};Me.prototype.property={};Me.prototype.space=void 0;function _t(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Me(t,r,n)}function fn(e){return e.toLowerCase()}class J{constructor(n,t){this.attribute=t,this.property=n}}J.prototype.attribute="";J.prototype.booleanish=!1;J.prototype.boolean=!1;J.prototype.commaOrSpaceSeparated=!1;J.prototype.commaSeparated=!1;J.prototype.defined=!1;J.prototype.mustUseProperty=!1;J.prototype.number=!1;J.prototype.overloadedBoolean=!1;J.prototype.property="";J.prototype.spaceSeparated=!1;J.prototype.space=void 0;let vr=0;const z=be(),$=be(),hn=be(),k=be(),R=be(),Ie=be(),ee=be();function be(){return 2**++vr}const mn=Object.freeze(Object.defineProperty({__proto__:null,boolean:z,booleanish:$,commaOrSpaceSeparated:ee,commaSeparated:Ie,number:k,overloadedBoolean:hn,spaceSeparated:R},Symbol.toStringTag,{value:"Module"})),en=Object.keys(mn);class En extends J{constructor(n,t,r,i){let l=-1;if(super(n,t),$n(this,"space",i),typeof r=="number")for(;++l4&&t.slice(0,4)==="data"&&Fr.test(n)){if(n.charAt(4)==="-"){const l=n.slice(5).replace(Wn,Br);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=n.slice(4);if(!Wn.test(l)){let o=l.replace(Nr,Mr);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}i=En}return new i(r,n)}function Mr(e){return"-"+e.toLowerCase()}function Br(e){return e.charAt(1).toUpperCase()}const jr=_t([Nt,Dr,Mt,Bt,jt],"html"),Cn=_t([Nt,Or,Mt,Bt,jt],"svg");function du(e){const n=String(e||"").trim();return n?n.split(/[ \t\n\r\f]+/g):[]}function Hr(e){return e.join(" ").trim()}var In={},Yn=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ur=/\n/g,Vr=/^\s*/,qr=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,$r=/^:\s*/,Wr=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Yr=/^[;\s]*/,Xr=/^\s+|\s+$/g,Qr=` `,Xn="/",Qn="*",ke="",Gr="comment",Kr="declaration";function Jr(e,n){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];n=n||{};var t=1,r=1;function i(y){var b=y.match(Ur);b&&(t+=b.length);var T=y.lastIndexOf(Qr);r=~T?y.length-T:r+y.length}function l(){var y={line:t,column:r};return function(b){return b.position=new o(y),c(),b}}function o(y){this.start=y,this.end={line:t,column:r},this.source=n.source}o.prototype.content=e;function a(y){var b=new Error(n.source+":"+t+":"+r+": "+y);if(b.reason=y,b.filename=n.source,b.line=t,b.column=r,b.source=e,!n.silent)throw b}function u(y){var b=y.exec(e);if(b){var T=b[0];return i(T),e=e.slice(T.length),b}}function c(){u(Vr)}function s(y){var b;for(y=y||[];b=f();)b!==!1&&y.push(b);return y}function f(){var y=l();if(!(Xn!=e.charAt(0)||Qn!=e.charAt(1))){for(var b=2;ke!=e.charAt(b)&&(Qn!=e.charAt(b)||Xn!=e.charAt(b+1));)++b;if(b+=2,ke===e.charAt(b-1))return a("End of comment missing");var T=e.slice(2,b-2);return r+=2,i(T),e=e.slice(b),r+=2,y({type:Gr,comment:T})}}function d(){var y=l(),b=u(qr);if(b){if(f(),!u($r))return a("property missing ':'");var T=u(Wr),w=y({type:Kr,property:Gn(b[0].replace(Yn,ke)),value:T?Gn(T[0].replace(Yn,ke)):ke});return u(Yr),w}}function p(){var y=[];s(y);for(var b;b=d();)b!==!1&&(y.push(b),s(y));return y}return c(),p()}function Gn(e){return e?e.replace(Xr,ke):ke}var Zr=Jr,ei=We&&We.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(In,"__esModule",{value:!0});In.default=ti;const ni=ei(Zr);function ti(e,n){let t=null;if(!e||typeof e!="string")return t;const r=(0,ni.default)(e),i=typeof n=="function";return r.forEach(l=>{if(l.type!=="declaration")return;const{property:o,value:a}=l;i?n(o,a,l):a&&(t=t||{},t[o]=a)}),t}var Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.camelCase=void 0;var ri=/^--[a-zA-Z0-9_-]+$/,ii=/-([a-z])/g,li=/^[^-]+$/,oi=/^-(webkit|moz|ms|o|khtml)-/,ai=/^-(ms)-/,ui=function(e){return!e||li.test(e)||ri.test(e)},si=function(e,n){return n.toUpperCase()},Kn=function(e,n){return"".concat(n,"-")},ci=function(e,n){return n===void 0&&(n={}),ui(e)?e:(e=e.toLowerCase(),n.reactCompat?e=e.replace(ai,Kn):e=e.replace(oi,Kn),e.replace(ii,si))};Qe.camelCase=ci;var pi=We&&We.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},fi=pi(In),hi=Qe;function dn(e,n){var t={};return!e||typeof e!="string"||(0,fi.default)(e,function(r,i){r&&i&&(t[(0,hi.camelCase)(r,n)]=i)}),t}dn.default=dn;var mi=dn;const di=Ot(mi),Ht=Ut("end"),Tn=Ut("start");function Ut(e){return n;function n(t){const r=t&&t.position&&t.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function gi(e){const n=Tn(e),t=Ht(e);if(n&&t)return{start:n,end:t}}function _e(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Jn(e.position):"start"in e||"end"in e?Jn(e):"line"in e||"column"in e?gn(e):""}function gn(e){return Zn(e&&e.line)+":"+Zn(e&&e.column)}function Jn(e){return gn(e&&e.start)+"-"+gn(e&&e.end)}function Zn(e){return e&&typeof e=="number"?e:1}class Q extends Error{constructor(n,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let i="",l={},o=!1;if(t&&("line"in t&&"column"in t?l={place:t}:"start"in t&&"end"in t?l={place:t}:"type"in t?l={ancestors:[t],place:t.position}:l={...t}),typeof n=="string"?i=n:!l.cause&&n&&(o=!0,i=n.message,l.cause=n),!l.ruleId&&!l.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?l.ruleId=r:(l.source=r.slice(0,u),l.ruleId=r.slice(u+1))}if(!l.place&&l.ancestors&&l.ancestors){const u=l.ancestors[l.ancestors.length-1];u&&(l.place=u.position)}const a=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=_e(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=o&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Q.prototype.file="";Q.prototype.name="";Q.prototype.reason="";Q.prototype.message="";Q.prototype.stack="";Q.prototype.column=void 0;Q.prototype.line=void 0;Q.prototype.ancestors=void 0;Q.prototype.cause=void 0;Q.prototype.fatal=void 0;Q.prototype.place=void 0;Q.prototype.ruleId=void 0;Q.prototype.source=void 0;const An={}.hasOwnProperty,yi=new Map,xi=/[A-Z]/g,ki=new Set(["table","tbody","thead","tfoot","tr"]),bi=new Set(["td","th"]),Vt="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wi(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=zi(t,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Pi(t,n.jsx,n.jsxs)}const i={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Cn:jr,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},l=qt(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function qt(e,n,t){if(n.type==="element")return Si(e,n,t);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Ei(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Ii(e,n,t);if(n.type==="mdxjsEsm")return Ci(e,n);if(n.type==="root")return Ti(e,n,t);if(n.type==="text")return Ai(e,n)}function Si(e,n,t){const r=e.schema;let i=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Cn,e.schema=i),e.ancestors.push(n);const l=Wt(e,n.tagName,!1),o=Li(e,n);let a=zn(e,n);return ki.has(n.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!Lr(u):!0})),$t(e,o,l,n),Pn(o,a),e.ancestors.pop(),e.schema=r,e.create(n,l,o,t)}function Ei(e,n){if(n.data&&n.data.estree&&e.evaluater){const r=n.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Re(e,n.position)}function Ci(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Re(e,n.position)}function Ii(e,n,t){const r=e.schema;let i=r;n.name==="svg"&&r.space==="html"&&(i=Cn,e.schema=i),e.ancestors.push(n);const l=n.name===null?e.Fragment:Wt(e,n.name,!0),o=vi(e,n),a=zn(e,n);return $t(e,o,l,n),Pn(o,a),e.ancestors.pop(),e.schema=r,e.create(n,l,o,t)}function Ti(e,n,t){const r={};return Pn(r,zn(e,n)),e.create(n,e.Fragment,r,t)}function Ai(e,n){return n.value}function $t(e,n,t,r){typeof t!="string"&&t!==e.Fragment&&e.passNode&&(n.node=r)}function Pn(e,n){if(n.length>0){const t=n.length>1?n:n[0];t&&(e.children=t)}}function Pi(e,n,t){return r;function r(i,l,o,a){const c=Array.isArray(o.children)?t:n;return a?c(l,o,a):c(l,o)}}function zi(e,n){return t;function t(r,i,l,o){const a=Array.isArray(l.children),u=Tn(r);return n(i,l,o,a,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Li(e,n){const t={};let r,i;for(i in n.properties)if(i!=="children"&&An.call(n.properties,i)){const l=Di(e,i,n.properties[i]);if(l){const[o,a]=l;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&bi.has(n.tagName)?r=a:t[o]=a}}if(r){const l=t.style||(t.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return t}function vi(e,n){const t={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const o=l.expression;o.type;const a=o.properties[0];a.type,Object.assign(t,e.evaluater.evaluateExpression(a.argument))}else Re(e,n.position);else{const i=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,l=e.evaluater.evaluateExpression(a.expression)}else Re(e,n.position);else l=r.value===null?!0:r.value;t[i]=l}return t}function zn(e,n){const t=[];let r=-1;const i=e.passKeys?new Map:yi;for(;++ri?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)o=Array.from(r),o.unshift(n,t),e.splice(...o);else for(t&&e.splice(n,t);l0?(se(e,e.length,0,n),e):n}const tt={}.hasOwnProperty;function ji(e){const n={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function Te(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ue=ge(/[A-Za-z]/),ne=ge(/[\dA-Za-z]/),Vi=ge(/[#-'*+\--9=?A-Z^-~]/);function yn(e){return e!==null&&(e<32||e===127)}const xn=ge(/\d/),qi=ge(/[\dA-Fa-f]/),$i=ge(/[!-/:-@[-`{-~]/);function A(e){return e!==null&&e<-2}function K(e){return e!==null&&(e<0||e===32)}function O(e){return e===-2||e===-1||e===32}const Wi=ge(new RegExp("\\p{P}|\\p{S}","u")),Yi=ge(/\s/);function ge(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Pe(e){const n=[];let t=-1,r=0,i=0;for(;++t55295&&l<57344){const a=e.charCodeAt(t+1);l<56320&&a>56319&&a<57344?(o=String.fromCharCode(l,a),i=1):o="�"}else o=String.fromCharCode(l);o&&(n.push(e.slice(r,t),encodeURIComponent(o)),r=t+i+1,o=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function M(e,n,t,r){const i=r?r-1:Number.POSITIVE_INFINITY;let l=0;return o;function o(u){return O(u)?(e.enter(t),a(u)):n(u)}function a(u){return O(u)&&l++o))return;const _=n.events.length;let V=_,N,B;for(;V--;)if(n.events[V][0]==="exit"&&n.events[V][1].type==="chunkFlow"){if(N){B=n.events[V][1].end;break}N=!0}for(w(r),x=_;xE;){const U=t[j];n.containerState=U[1],U[0].exit.call(n,e)}t.length=E}function L(){i.write([null]),l=void 0,i=void 0,n.containerState._closeFlow=void 0}}function Ji(e,n,t){return M(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function it(e){if(e===null||K(e)||Yi(e))return 1;if(Wi(e))return 2}function vn(e,n,t){const r=[];let i=-1;for(;++i1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const f={...e[r][1].end},d={...e[t][1].start};lt(f,-u),lt(d,u),o={type:u>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:d},l={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},i={type:u>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[t][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=te(c,[["enter",e[r][1],n],["exit",e[r][1],n]])),c=te(c,[["enter",i,n],["enter",o,n],["exit",o,n],["enter",l,n]]),c=te(c,vn(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),c=te(c,[["exit",l,n],["enter",a,n],["exit",a,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(s=2,c=te(c,[["enter",e[t][1],n],["exit",e[t][1],n]])):s=0,se(e,r-1,t-r+3,c),t=r+c.length-s-2;break}}for(t=-1;++t0&&O(x)?M(e,L,"linePrefix",l+1)(x):L(x)}function L(x){return x===null||A(x)?e.check(ot,b,j)(x):(e.enter("codeFlowValue"),E(x))}function E(x){return x===null||A(x)?(e.exit("codeFlowValue"),L(x)):(e.consume(x),E)}function j(x){return e.exit("codeFenced"),n(x)}function U(x,_,V){let N=0;return B;function B(D){return x.enter("lineEnding"),x.consume(D),x.exit("lineEnding"),I}function I(D){return x.enter("codeFencedFence"),O(D)?M(x,C,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):C(D)}function C(D){return D===a?(x.enter("codeFencedFenceSequence"),H(D)):V(D)}function H(D){return D===a?(N++,x.consume(D),H):N>=o?(x.exit("codeFencedFenceSequence"),O(D)?M(x,q,"whitespace")(D):q(D)):V(D)}function q(D){return D===null||A(D)?(x.exit("codeFencedFence"),_(D)):V(D)}}}function cl(e,n,t){const r=this;return i;function i(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}const tn={name:"codeIndented",tokenize:fl},pl={partial:!0,tokenize:hl};function fl(e,n,t){const r=this;return i;function i(c){return e.enter("codeIndented"),M(e,l,"linePrefix",5)(c)}function l(c){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?o(c):t(c)}function o(c){return c===null?u(c):A(c)?e.attempt(pl,o,u)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||A(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function u(c){return e.exit("codeIndented"),n(c)}}function hl(e,n,t){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?t(o):A(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):M(e,l,"linePrefix",5)(o)}function l(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(o):A(o)?i(o):t(o)}}const ml={name:"codeText",previous:gl,resolve:dl,tokenize:yl};function dl(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return nthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,t,r){const i=t||0;this.setCursor(Math.trunc(n));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&De(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),De(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),De(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n=4?n(o):e.interrupt(r.parser.constructs.flow,t,n)(o)}}function Zt(e,n,t,r,i,l,o,a,u){const c=u||Number.POSITIVE_INFINITY;let s=0;return f;function f(w){return w===60?(e.enter(r),e.enter(i),e.enter(l),e.consume(w),e.exit(l),d):w===null||w===32||w===41||yn(w)?t(w):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),b(w))}function d(w){return w===62?(e.enter(l),e.consume(w),e.exit(l),e.exit(i),e.exit(r),n):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===62?(e.exit("chunkString"),e.exit(a),d(w)):w===null||w===60||A(w)?t(w):(e.consume(w),w===92?y:p)}function y(w){return w===60||w===62||w===92?(e.consume(w),p):p(w)}function b(w){return!s&&(w===null||w===41||K(w))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),n(w)):s999||p===null||p===91||p===93&&!u||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?t(p):p===93?(e.exit(l),e.enter(i),e.consume(p),e.exit(i),e.exit(r),n):A(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),s):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||A(p)||a++>999?(e.exit("chunkString"),s(p)):(e.consume(p),u||(u=!O(p)),p===92?d:f)}function d(p){return p===91||p===92||p===93?(e.consume(p),a++,f):f(p)}}function nr(e,n,t,r,i,l){let o;return a;function a(d){return d===34||d===39||d===40?(e.enter(r),e.enter(i),e.consume(d),e.exit(i),o=d===40?41:d,u):t(d)}function u(d){return d===o?(e.enter(i),e.consume(d),e.exit(i),e.exit(r),n):(e.enter(l),c(d))}function c(d){return d===o?(e.exit(l),u(o)):d===null?t(d):A(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),M(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),s(d))}function s(d){return d===o||d===null||A(d)?(e.exit("chunkString"),c(d)):(e.consume(d),d===92?f:s)}function f(d){return d===o||d===92?(e.consume(d),s):s(d)}}function Ne(e,n){let t;return r;function r(i){return A(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):O(i)?M(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}const Il={name:"definition",tokenize:Al},Tl={partial:!0,tokenize:Pl};function Al(e,n,t){const r=this;let i;return l;function l(p){return e.enter("definition"),o(p)}function o(p){return er.call(r,e,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Te(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):t(p)}function u(p){return K(p)?Ne(e,c)(p):c(p)}function c(p){return Zt(e,s,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function s(p){return e.attempt(Tl,f,f)(p)}function f(p){return O(p)?M(e,d,"whitespace")(p):d(p)}function d(p){return p===null||A(p)?(e.exit("definition"),r.parser.defined.push(i),n(p)):t(p)}}function Pl(e,n,t){return r;function r(a){return K(a)?Ne(e,i)(a):t(a)}function i(a){return nr(e,l,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function l(a){return O(a)?M(e,o,"whitespace")(a):o(a)}function o(a){return a===null||A(a)?n(a):t(a)}}const zl={name:"hardBreakEscape",tokenize:Ll};function Ll(e,n,t){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return A(l)?(e.exit("hardBreakEscape"),n(l)):t(l)}}const vl={name:"headingAtx",resolve:Dl,tokenize:Ol};function Dl(e,n){let t=e.length-2,r=3,i,l;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},l={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},se(e,r,t-r+1,[["enter",i,n],["enter",l,n],["exit",l,n],["exit",i,n]])),e}function Ol(e,n,t){let r=0;return i;function i(s){return e.enter("atxHeading"),l(s)}function l(s){return e.enter("atxHeadingSequence"),o(s)}function o(s){return s===35&&r++<6?(e.consume(s),o):s===null||K(s)?(e.exit("atxHeadingSequence"),a(s)):t(s)}function a(s){return s===35?(e.enter("atxHeadingSequence"),u(s)):s===null||A(s)?(e.exit("atxHeading"),n(s)):O(s)?M(e,a,"whitespace")(s):(e.enter("atxHeadingText"),c(s))}function u(s){return s===35?(e.consume(s),u):(e.exit("atxHeadingSequence"),a(s))}function c(s){return s===null||s===35||K(s)?(e.exit("atxHeadingText"),a(s)):(e.consume(s),c)}}const _l=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ut=["pre","script","style","textarea"],Nl={concrete:!0,name:"htmlFlow",resolveTo:Ml,tokenize:Bl},Fl={partial:!0,tokenize:Hl},Rl={partial:!0,tokenize:jl};function Ml(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function Bl(e,n,t){const r=this;let i,l,o,a,u;return c;function c(m){return s(m)}function s(m){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(m),f}function f(m){return m===33?(e.consume(m),d):m===47?(e.consume(m),l=!0,b):m===63?(e.consume(m),i=3,r.interrupt?n:h):ue(m)?(e.consume(m),o=String.fromCharCode(m),T):t(m)}function d(m){return m===45?(e.consume(m),i=2,p):m===91?(e.consume(m),i=5,a=0,y):ue(m)?(e.consume(m),i=4,r.interrupt?n:h):t(m)}function p(m){return m===45?(e.consume(m),r.interrupt?n:h):t(m)}function y(m){const le="CDATA[";return m===le.charCodeAt(a++)?(e.consume(m),a===le.length?r.interrupt?n:C:y):t(m)}function b(m){return ue(m)?(e.consume(m),o=String.fromCharCode(m),T):t(m)}function T(m){if(m===null||m===47||m===62||K(m)){const le=m===47,ye=o.toLowerCase();return!le&&!l&&ut.includes(ye)?(i=1,r.interrupt?n(m):C(m)):_l.includes(o.toLowerCase())?(i=6,le?(e.consume(m),w):r.interrupt?n(m):C(m)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(m):l?L(m):E(m))}return m===45||ne(m)?(e.consume(m),o+=String.fromCharCode(m),T):t(m)}function w(m){return m===62?(e.consume(m),r.interrupt?n:C):t(m)}function L(m){return O(m)?(e.consume(m),L):B(m)}function E(m){return m===47?(e.consume(m),B):m===58||m===95||ue(m)?(e.consume(m),j):O(m)?(e.consume(m),E):B(m)}function j(m){return m===45||m===46||m===58||m===95||ne(m)?(e.consume(m),j):U(m)}function U(m){return m===61?(e.consume(m),x):O(m)?(e.consume(m),U):E(m)}function x(m){return m===null||m===60||m===61||m===62||m===96?t(m):m===34||m===39?(e.consume(m),u=m,_):O(m)?(e.consume(m),x):V(m)}function _(m){return m===u?(e.consume(m),u=null,N):m===null||A(m)?t(m):(e.consume(m),_)}function V(m){return m===null||m===34||m===39||m===47||m===60||m===61||m===62||m===96||K(m)?U(m):(e.consume(m),V)}function N(m){return m===47||m===62||O(m)?E(m):t(m)}function B(m){return m===62?(e.consume(m),I):t(m)}function I(m){return m===null||A(m)?C(m):O(m)?(e.consume(m),I):t(m)}function C(m){return m===45&&i===2?(e.consume(m),X):m===60&&i===1?(e.consume(m),W):m===62&&i===4?(e.consume(m),ie):m===63&&i===3?(e.consume(m),h):m===93&&i===5?(e.consume(m),ce):A(m)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Fl,pe,H)(m)):m===null||A(m)?(e.exit("htmlFlowData"),H(m)):(e.consume(m),C)}function H(m){return e.check(Rl,q,pe)(m)}function q(m){return e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),D}function D(m){return m===null||A(m)?H(m):(e.enter("htmlFlowData"),C(m))}function X(m){return m===45?(e.consume(m),h):C(m)}function W(m){return m===47?(e.consume(m),o="",re):C(m)}function re(m){if(m===62){const le=o.toLowerCase();return ut.includes(le)?(e.consume(m),ie):C(m)}return ue(m)&&o.length<8?(e.consume(m),o+=String.fromCharCode(m),re):C(m)}function ce(m){return m===93?(e.consume(m),h):C(m)}function h(m){return m===62?(e.consume(m),ie):m===45&&i===2?(e.consume(m),h):C(m)}function ie(m){return m===null||A(m)?(e.exit("htmlFlowData"),pe(m)):(e.consume(m),ie)}function pe(m){return e.exit("htmlFlow"),n(m)}}function jl(e,n,t){const r=this;return i;function i(o){return A(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),l):t(o)}function l(o){return r.parser.lazy[r.now().line]?t(o):n(o)}}function Hl(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ge,n,t)}}const Ul={name:"htmlText",tokenize:Vl};function Vl(e,n,t){const r=this;let i,l,o;return a;function a(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),u}function u(h){return h===33?(e.consume(h),c):h===47?(e.consume(h),U):h===63?(e.consume(h),E):ue(h)?(e.consume(h),V):t(h)}function c(h){return h===45?(e.consume(h),s):h===91?(e.consume(h),l=0,y):ue(h)?(e.consume(h),L):t(h)}function s(h){return h===45?(e.consume(h),p):t(h)}function f(h){return h===null?t(h):h===45?(e.consume(h),d):A(h)?(o=f,W(h)):(e.consume(h),f)}function d(h){return h===45?(e.consume(h),p):f(h)}function p(h){return h===62?X(h):h===45?d(h):f(h)}function y(h){const ie="CDATA[";return h===ie.charCodeAt(l++)?(e.consume(h),l===ie.length?b:y):t(h)}function b(h){return h===null?t(h):h===93?(e.consume(h),T):A(h)?(o=b,W(h)):(e.consume(h),b)}function T(h){return h===93?(e.consume(h),w):b(h)}function w(h){return h===62?X(h):h===93?(e.consume(h),w):b(h)}function L(h){return h===null||h===62?X(h):A(h)?(o=L,W(h)):(e.consume(h),L)}function E(h){return h===null?t(h):h===63?(e.consume(h),j):A(h)?(o=E,W(h)):(e.consume(h),E)}function j(h){return h===62?X(h):E(h)}function U(h){return ue(h)?(e.consume(h),x):t(h)}function x(h){return h===45||ne(h)?(e.consume(h),x):_(h)}function _(h){return A(h)?(o=_,W(h)):O(h)?(e.consume(h),_):X(h)}function V(h){return h===45||ne(h)?(e.consume(h),V):h===47||h===62||K(h)?N(h):t(h)}function N(h){return h===47?(e.consume(h),X):h===58||h===95||ue(h)?(e.consume(h),B):A(h)?(o=N,W(h)):O(h)?(e.consume(h),N):X(h)}function B(h){return h===45||h===46||h===58||h===95||ne(h)?(e.consume(h),B):I(h)}function I(h){return h===61?(e.consume(h),C):A(h)?(o=I,W(h)):O(h)?(e.consume(h),I):N(h)}function C(h){return h===null||h===60||h===61||h===62||h===96?t(h):h===34||h===39?(e.consume(h),i=h,H):A(h)?(o=C,W(h)):O(h)?(e.consume(h),C):(e.consume(h),q)}function H(h){return h===i?(e.consume(h),i=void 0,D):h===null?t(h):A(h)?(o=H,W(h)):(e.consume(h),H)}function q(h){return h===null||h===34||h===39||h===60||h===61||h===96?t(h):h===47||h===62||K(h)?N(h):(e.consume(h),q)}function D(h){return h===47||h===62||K(h)?N(h):t(h)}function X(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),n):t(h)}function W(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),re}function re(h){return O(h)?M(e,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):ce(h)}function ce(h){return e.enter("htmlTextData"),o(h)}}const Dn={name:"labelEnd",resolveAll:Yl,resolveTo:Xl,tokenize:Ql},ql={tokenize:Gl},$l={tokenize:Kl},Wl={tokenize:Jl};function Yl(e){let n=-1;const t=[];for(;++n=3&&(c===null||A(c))?(e.exit("thematicBreak"),n(c)):t(c)}function u(c){return c===i?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),O(c)?M(e,a,"whitespace")(c):a(c))}}const G={continuation:{tokenize:uo},exit:co,name:"list",tokenize:ao},lo={partial:!0,tokenize:po},oo={partial:!0,tokenize:so};function ao(e,n,t){const r=this,i=r.events[r.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(p){const y=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:xn(p)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(qe,t,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return t(p)}function u(p){return xn(p)&&++o<10?(e.consume(p),u):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):t(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Ge,r.interrupt?t:s,e.attempt(lo,d,f))}function s(p){return r.containerState.initialBlankLine=!0,l++,d(p)}function f(p){return O(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),d):t(p)}function d(p){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(p)}}function uo(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(Ge,i,l);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,M(e,n,"listItemIndent",r.containerState.size+1)(a)}function l(a){return r.containerState.furtherBlankLines||!O(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(oo,n,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,M(e,e.attempt(G,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function so(e,n,t){const r=this;return M(e,i,"listItemIndent",r.containerState.size+1);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?n(l):t(l)}}function co(e){e.exit(this.containerState.type)}function po(e,n,t){const r=this;return M(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const o=r.events[r.events.length-1];return!O(l)&&o&&o[1].type==="listItemPrefixWhitespace"?n(l):t(l)}}const st={name:"setextUnderline",resolveTo:fo,tokenize:ho};function fo(e,n){let t=e.length,r,i,l;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!l&&e[t][1].type==="definition"&&(l=t);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",o,n]),e.splice(l+1,0,["exit",e[r][1],n]),e[r][1].end={...e[l][1].end}):e[r][1]=o,e.push(["exit",o,n]),e}function ho(e,n,t){const r=this;let i;return l;function l(c){let s=r.events.length,f;for(;s--;)if(r.events[s][1].type!=="lineEnding"&&r.events[s][1].type!=="linePrefix"&&r.events[s][1].type!=="content"){f=r.events[s][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=c,o(c)):t(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),O(c)?M(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||A(c)?(e.exit("setextHeadingLine"),n(c)):t(c)}}const mo={tokenize:go};function go(e){const n=this,t=e.attempt(Ge,r,e.attempt(this.parser.constructs.flowInitial,i,M(e,e.attempt(this.parser.constructs.flow,i,e.attempt(bl,i)),"linePrefix")));return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),n.currentConstruct=void 0,t}}const yo={resolveAll:rr()},xo=tr("string"),ko=tr("text");function tr(e){return{resolveAll:rr(e==="text"?bo:void 0),tokenize:n};function n(t){const r=this,i=this.parser.constructs[e],l=t.attempt(i,o,a);return o;function o(s){return c(s)?l(s):a(s)}function a(s){if(s===null){t.consume(s);return}return t.enter("data"),t.consume(s),u}function u(s){return c(s)?(t.exit("data"),l(s)):(t.consume(s),u)}function c(s){if(s===null)return!0;const f=i[s];let d=-1;if(f)for(;++d-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}l>0&&o.push(e[i].slice(0,l))}return o}function Oo(e,n){let t=-1;const r=[];let i;for(;++t0){const oe=P.tokenStack[P.tokenStack.length-1];(oe[1]||pt).call(P,void 0,oe[0])}for(S.position={start:de(g.length>0?g[0][1].start:{line:1,column:1,offset:0}),end:de(g.length>0?g[g.length-2][1].end:{line:1,column:1,offset:0})},F=-1;++Fi.jsx("input",{type:r,className:n("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:t,...o}));d.displayName="Input";export{d as I}; +import{d as s,j as i,G as n}from"./index-DyXq7-Tg.js";const d=s.forwardRef(({className:e,type:r,...o},t)=>i.jsx("input",{type:r,className:n("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:t,...o}));d.displayName="Input";export{d as I}; diff --git a/assets/latexPlainText-DI8YEXVe.js b/assets/latexPlainText-DI8YEXVe.js deleted file mode 100644 index 61f7028e3c957791adf588648af525dad939ed5c..0000000000000000000000000000000000000000 --- a/assets/latexPlainText-DI8YEXVe.js +++ /dev/null @@ -1 +0,0 @@ -const l={a:"á",e:"é",i:"í",o:"ó",u:"ú",y:"ý",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú",Y:"Ý"},E={a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"},s={a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"},p={a:"ä",e:"ë",i:"ï",o:"ö",u:"ü",y:"ÿ",A:"Ä",E:"Ë",I:"Ï",O:"Ö",U:"Ü",Y:"Ÿ"},_={"'":l,"`":E,"^":s,'"':p,"~":{n:"ñ",N:"Ñ"}},i={ss:"ß",ae:"æ",AE:"Æ",oe:"œ",OE:"Œ",o:"ø",O:"Ø",l:"ł",L:"Ł"},T=[["varphi","φ"],["varepsilon","ε"],["vartheta","ϑ"],["Gamma","Γ"],["Delta","Δ"],["Theta","Θ"],["Lambda","Λ"],["Sigma","Σ"],["Omega","Ω"],["alpha","α"],["beta","β"],["gamma","γ"],["delta","δ"],["epsilon","ε"],["zeta","ζ"],["eta","η"],["theta","θ"],["kappa","κ"],["lambda","λ"],["mu","μ"],["nu","ν"],["xi","ξ"],["pi","π"],["rho","ρ"],["sigma","σ"],["tau","τ"],["phi","φ"],["chi","χ"],["psi","ψ"],["omega","ω"]],m=/\\(?:textbf|mathbf|emph|textit|textsl|texttt|color|textcolor)\{([^{}]*)\}/g,u=/\\(['"`^~])([A-Za-z])/g,L=/\\c\{([cCsS])\}/g,C=new RegExp(`\\\\(${Object.keys(i).join("|")})(?![A-Za-z])`,"g"),M=/\$\$([^$]+)\$\$/g,g=/\$([^$]+)\$/g,O=/\\([A-Za-z]+)/g;function o(n,t,e){return n.split(t).join(e)}function c(n){let t=n.trim();for(const[e,a]of T)t=o(t,`\\${e}`,a);return t=t.replace(O,(e,a)=>a),o(t,"$","")}function $(n){let t=n.replace(M,(e,a)=>c(a));return t=t.replace(g,(e,a)=>c(a)),o(t,"$","")}function h(n){if(!n)return n;let t=n.replace(m,"$1");return t=t.replace(L,(e,a)=>({c:"ç",C:"Ç"})[a]??e),t=t.replace(u,(e,a,A)=>{var r;return((r=_[a])==null?void 0:r[A])??e}),t=t.replace(C,(e,a)=>i[a]??e),t=$(t),o(t,"~"," ")}const D="Papers with Code";function N(n,t=D){return`${h(n.trim())||"Paper"} | ${t}`}export{D,N as f}; diff --git a/assets/loader-circle-CWMja8Zn.js b/assets/loader-circle-C75KLEgx.js similarity index 85% rename from assets/loader-circle-CWMja8Zn.js rename to assets/loader-circle-C75KLEgx.js index 83cb8862e35b13258ccfd93ddc1d0034fe77b99f..0476394d05ff941077bc0b41925c60f5dc1e1a60 100644 --- a/assets/loader-circle-CWMja8Zn.js +++ b/assets/loader-circle-C75KLEgx.js @@ -1,4 +1,4 @@ -import{n as e}from"./index-CbgxfyGU.js";/** +import{s as e}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/moon-BVv5zopc.js b/assets/moon-DMVsctTM.js similarity index 53% rename from assets/moon-BVv5zopc.js rename to assets/moon-DMVsctTM.js index 8090737c096a0de8de3a47023eee4467ba9f010c..4eb4c43af23237d87cd4366ac732d8cdb924e2e4 100644 --- a/assets/moon-BVv5zopc.js +++ b/assets/moon-DMVsctTM.js @@ -1,6 +1,6 @@ -import{n as o}from"./index-CbgxfyGU.js";/** +import{s as o}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const n=o("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);export{n as M}; + */const t=o("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);export{t as M}; diff --git a/assets/openrouter-DiuY1sPP.js b/assets/openrouter-DiuY1sPP.js deleted file mode 100644 index 5d3588a6ee8f5050234a4a7fa43cc314e8493929..0000000000000000000000000000000000000000 --- a/assets/openrouter-DiuY1sPP.js +++ /dev/null @@ -1 +0,0 @@ -import{u as r}from"./useQuery-Bx9s5-D2.js";import{c as n}from"./chat-DzTo2WUO.js";const u=["chat","openrouter","usage"],o=["chat","openrouter","credential"];function s(e=!0){return r({queryKey:u,queryFn:()=>n.getUsage(),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0})}function c(e=!0){return r({queryKey:o,queryFn:()=>n.getOpenRouterCredential(),enabled:e,refetchOnWindowFocus:!0})}function m(e){const t=new Date(e);return{local:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t),utc:`${t.toLocaleString("en-GB",{timeZone:"UTC",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})} UTC`}}export{o as O,s as a,m as r,c as u}; diff --git a/assets/openrouter-o51Eagw8.js b/assets/openrouter-o51Eagw8.js new file mode 100644 index 0000000000000000000000000000000000000000..51d1d4695a46d158cd8c898ca280413900558b8f --- /dev/null +++ b/assets/openrouter-o51Eagw8.js @@ -0,0 +1 @@ +import{b as r}from"./index-DyXq7-Tg.js";import{c as n}from"./chat-Ix1IrIwq.js";const o=["chat","openrouter","usage"],u=["chat","openrouter","credential"];function s(e=!0){return r({queryKey:o,queryFn:()=>n.getUsage(),enabled:e,staleTime:3e4,refetchOnWindowFocus:!0})}function c(e=!0){return r({queryKey:u,queryFn:()=>n.getOpenRouterCredential(),enabled:e,refetchOnWindowFocus:!0})}function m(e){const t=new Date(e);return{local:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(t),utc:`${t.toLocaleString("en-GB",{timeZone:"UTC",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})} UTC`}}export{u as O,s as a,m as r,c as u}; diff --git a/assets/paperEdits-C5GTaRR8.js b/assets/paperEdits-CIjFYfYE.js similarity index 84% rename from assets/paperEdits-C5GTaRR8.js rename to assets/paperEdits-CIjFYfYE.js index d5ad3906c86ca4dacefadbc8a19e121261169fbf..4de8dc1863856d0bbc0a3407c222cc7fb98932bc 100644 --- a/assets/paperEdits-C5GTaRR8.js +++ b/assets/paperEdits-CIjFYfYE.js @@ -1 +1 @@ -import{a6 as p}from"./index-CbgxfyGU.js";const a={authorization:e=>p(`/paper-edit-authorizations/${encodeURIComponent(e)}`),approve:e=>p(`/paper-edit-authorizations/${encodeURIComponent(e)}/approve`,{method:"POST"}),digest:(e,t)=>p(`/admin/paper-edit-digest?day=${e}&page=${t}`),suspend:(e,t)=>p("/admin/paper-edit-suspension",{method:"POST",body:JSON.stringify({hf_subject:e,suspended:t})})};export{a as p}; +import{ac as p}from"./index-DyXq7-Tg.js";const a={authorization:e=>p(`/paper-edit-authorizations/${encodeURIComponent(e)}`),approve:e=>p(`/paper-edit-authorizations/${encodeURIComponent(e)}/approve`,{method:"POST"}),digest:(e,t)=>p(`/admin/paper-edit-digest?day=${e}&page=${t}`),suspend:(e,t)=>p("/admin/paper-edit-suspension",{method:"POST",body:JSON.stringify({hf_subject:e,suspended:t})})};export{a as p}; diff --git a/assets/paperQueryKeys-B8u1BWlI.js b/assets/paperQueryKeys-B8u1BWlI.js deleted file mode 100644 index 0ffe2783734292c6f7331445e5db0343fbfce214..0000000000000000000000000000000000000000 --- a/assets/paperQueryKeys-B8u1BWlI.js +++ /dev/null @@ -1 +0,0 @@ -import{p as n}from"./curation-C7Gmmp4z.js";import{a6 as c,aP as h,aQ as m}from"./index-CbgxfyGU.js";function p(a){const e=new URLSearchParams;for(const[t,s]of Object.entries(a??{}))s!==void 0&&s!==""&&e.set(t,String(s));const r=e.toString();return r?`?${r}`:""}class d{constructor(e){this.request=e}list(e){const r=new URLSearchParams;for(const[s,i]of Object.entries(e??{}))i!==void 0&&i!==""&&r.set(s,String(i));const t=r.toString();return this.request(`/papers/${t?`?${t}`:""}`,{cache:"no-cache"})}search(e,r=1,t=10,s,i,o){const u=new URLSearchParams({q:e,page:r.toString(),page_size:t.toString()});return s&&u.set("mode",s),o!=null&&o.start_date&&u.set("start_date",o.start_date),o!=null&&o.end_date&&u.set("end_date",o.end_date),this.request(`/papers/search?${u.toString()}`,{signal:i})}searchFeed(e){return this.request(`/papers/search/feed${p(e)}`,{cache:"no-cache"})}get(e,r=!0){const t=r?"?include_resources=true":"";return this.request(`/papers/${e}${t}`)}getByArxivId(e,r=!0){const t=r?"?include_resources=true":"";return this.request(`/papers/arxiv/${e}${t}`)}lookup(e){return this.request("/papers/lookup",{method:"POST",body:JSON.stringify({references:e})})}related(e,r=4){return this.request(`/papers/${encodeURIComponent(e)}/related?limit=${r}`)}suggestedQuestions(e){return this.request(`/papers/${encodeURIComponent(e)}/suggested-questions`)}versions(e){return this.request(`/papers/arxiv/${e}/versions`)}indexFromArxiv(e){return this.request(`/papers/index/${e}`,{method:"POST"})}submit(e){return this.request("/papers/submit",{method:"POST",body:JSON.stringify(e)})}copyToBucket(e,r){return this.request(`/papers/${encodeURIComponent(e)}/copy-to-bucket`,{method:"POST",body:JSON.stringify(r)})}trending(e){const r=new URLSearchParams;for(const[s,i]of Object.entries(e??{}))i!==void 0&&r.set(s,String(i));const t=r.toString();return this.request(`/papers/trending${t?`?${t}`:""}`,{cache:"no-store"})}xTrending(e){return this.request(`/papers/x-trending${p(e)}`)}forTask(e,r){return this.request(`/tasks/${e}/papers${p(r)}`)}forMethod(e,r){return this.request(`/methods/${encodeURIComponent(e)}/papers${p(r)}`)}forConference(e,r){return this.request(`/conferences/${e}/papers${p(r)}`)}forOrganization(e,r){return this.request(`/organizations/${e}/papers${p(r)}`)}getAuthor(e){return this.request(`/authors/${e}`)}searchAuthors(e,r){return this.request(`/authors/${p({search:e,page_size:r})}`)}primeCurationState(e,r=!1){return n.primePaper(e,r)}freshAuthMutationDraft(){return n.freshAuthMutationDraft()}resumeFreshAuthMutation(){return n.resumeFreshAuthMutation()}updateTasks(e,r){const t=new URLSearchParams(r.map(s=>["task_ids",String(s)])).toString();return n.mutatePaper(e,"tasks",r,`/papers/${e}/tasks?${t}`,{method:"PUT"})}updateMethods(e,r){const t=new URLSearchParams(r.map(s=>["method_ids",String(s)])).toString();return n.mutatePaper(e,"methods",r,`/papers/${e}/methods?${t}`,{method:"PUT"})}updateOrganizations(e,r){const t=new URLSearchParams(r.map(s=>["organization_ids",String(s)])).toString();return n.mutatePaper(e,"organizations",r,`/papers/${e}/organizations?${t}`,{method:"PUT"})}updateRepositories(e,r){return n.mutatePaper(e,"repositories",r,`/papers/${e}/repositories`,{method:"PUT",body:JSON.stringify({repositories:r})})}updateProjectPages(e,r){return n.mutatePaper(e,"project_pages",r,`/papers/${e}/project-pages`,{method:"PUT",body:JSON.stringify({project_pages:r})})}updateXThreads(e,r){return n.mutatePaper(e,"x_threads",r,`/papers/${e}/x-threads`,{method:"PUT",body:JSON.stringify({x_threads:r})})}updateSourceUrl(e,r){return n.mutatePaper(e,"source_url",r,`/papers/${e}/source-url`,{method:"PUT",body:JSON.stringify({source_url:r})})}updateHfArtifacts(e,r){return n.mutatePaper(e,"hf_artifacts",r,`/papers/${e}/hf-artifacts`,{method:"PUT",body:JSON.stringify(r)})}}const $=new d(c);async function y(a){return(await h(`/papers/${encodeURIComponent(a)}/web-markdown`)).text()}function P(a){return m(`/papers/${encodeURIComponent(a)}/layout`)}const S={detail:a=>["paper",a],arxiv:a=>["paper-arxiv",a],preview:a=>["paper-preview",a],summary:a=>["paper-summary",a],feeds:{list:["papers"],infinite:["papers-infinite"],xTrending:["x-trending-papers-infinite"],following:["research-feed"],search:["paper-search-feed"],task:["task-papers-infinite"],conference:["conference-papers-infinite"],organization:["organization-papers-infinite"],method:["method-papers-infinite"],saved:["my-bookmarks"],related:["related-papers"],versions:["paper-versions"],searchOverlay:["search-papers"],mentions:["chat-paper-mention-search"],trending:["trending-papers"]}};export{$ as a,P as b,y as g,S as p}; diff --git a/assets/papers-Dh3ljlL0.js b/assets/papers-Dh3ljlL0.js new file mode 100644 index 0000000000000000000000000000000000000000..ec09ff4d50fb332d174ef99fb9b02162ae999eec --- /dev/null +++ b/assets/papers-Dh3ljlL0.js @@ -0,0 +1 @@ +import{p as a}from"./curation-YeS7FBYf.js";import{ac as c,aV as h,aW as m}from"./index-DyXq7-Tg.js";function u(i){const e=new URLSearchParams;for(const[t,s]of Object.entries(i??{}))s!==void 0&&s!==""&&e.set(t,String(s));const r=e.toString();return r?`?${r}`:""}class d{constructor(e){this.request=e}list(e){const r=new URLSearchParams;for(const[s,o]of Object.entries(e??{}))o!==void 0&&o!==""&&r.set(s,String(o));const t=r.toString();return this.request(`/papers/${t?`?${t}`:""}`,{cache:"no-cache"})}search(e,r=1,t=10,s,o,n){const p=new URLSearchParams({q:e,page:r.toString(),page_size:t.toString()});return s&&p.set("mode",s),n!=null&&n.start_date&&p.set("start_date",n.start_date),n!=null&&n.end_date&&p.set("end_date",n.end_date),this.request(`/papers/search?${p.toString()}`,{signal:o})}searchFeed(e){return this.request(`/papers/search/feed${u(e)}`,{cache:"no-cache"})}get(e,r=!0){const t=r?"?include_resources=true":"";return this.request(`/papers/${e}${t}`)}getByArxivId(e,r=!0){const t=r?"?include_resources=true":"";return this.request(`/papers/arxiv/${e}${t}`)}lookup(e){return this.request("/papers/lookup",{method:"POST",body:JSON.stringify({references:e})})}related(e,r=4){return this.request(`/papers/${encodeURIComponent(e)}/related?limit=${r}`)}suggestedQuestions(e){return this.request(`/papers/${encodeURIComponent(e)}/suggested-questions`)}versions(e){return this.request(`/papers/arxiv/${e}/versions`)}indexFromArxiv(e){return this.request(`/papers/index/${e}`,{method:"POST"})}submit(e){return this.request("/papers/submit",{method:"POST",body:JSON.stringify(e)})}copyToBucket(e,r){return this.request(`/papers/${encodeURIComponent(e)}/copy-to-bucket`,{method:"POST",body:JSON.stringify(r)})}trending(e){const r=new URLSearchParams;for(const[s,o]of Object.entries(e??{}))o!==void 0&&r.set(s,String(o));const t=r.toString();return this.request(`/papers/trending${t?`?${t}`:""}`,{cache:"no-store"})}xTrending(e){return this.request(`/papers/x-trending${u(e)}`)}forTask(e,r){return this.request(`/tasks/${e}/papers${u(r)}`)}forMethod(e,r){return this.request(`/methods/${encodeURIComponent(e)}/papers${u(r)}`)}forConference(e,r){return this.request(`/conferences/${e}/papers${u(r)}`)}forOrganization(e,r){return this.request(`/organizations/${e}/papers${u(r)}`)}getAuthor(e){return this.request(`/authors/${e}`)}searchAuthors(e,r){return this.request(`/authors/${u({search:e,page_size:r})}`)}primeCurationState(e,r=!1){return a.primePaper(e,r)}freshAuthMutationDraft(){return a.freshAuthMutationDraft()}resumeFreshAuthMutation(){return a.resumeFreshAuthMutation()}updateTasks(e,r){const t=new URLSearchParams(r.map(s=>["task_ids",String(s)])).toString();return a.mutatePaper(e,"tasks",r,`/papers/${e}/tasks?${t}`,{method:"PUT"})}updateMethods(e,r){const t=new URLSearchParams(r.map(s=>["method_ids",String(s)])).toString();return a.mutatePaper(e,"methods",r,`/papers/${e}/methods?${t}`,{method:"PUT"})}updateOrganizations(e,r){const t=new URLSearchParams(r.map(s=>["organization_ids",String(s)])).toString();return a.mutatePaper(e,"organizations",r,`/papers/${e}/organizations?${t}`,{method:"PUT"})}updateRepositories(e,r){return a.mutatePaper(e,"repositories",r,`/papers/${e}/repositories`,{method:"PUT",body:JSON.stringify({repositories:r})})}updateProjectPages(e,r){return a.mutatePaper(e,"project_pages",r,`/papers/${e}/project-pages`,{method:"PUT",body:JSON.stringify({project_pages:r})})}updateXThreads(e,r){return a.mutatePaper(e,"x_threads",r,`/papers/${e}/x-threads`,{method:"PUT",body:JSON.stringify({x_threads:r})})}updateSourceUrl(e,r){return a.mutatePaper(e,"source_url",r,`/papers/${e}/source-url`,{method:"PUT",body:JSON.stringify({source_url:r})})}updateHfArtifacts(e,r){return a.mutatePaper(e,"hf_artifacts",r,`/papers/${e}/hf-artifacts`,{method:"PUT",body:JSON.stringify(r)})}}const g=new d(c);async function P(i){return(await h(`/papers/${encodeURIComponent(i)}/web-markdown`)).text()}function S(i){return m(`/papers/${encodeURIComponent(i)}/layout`)}export{S as a,P as g,g as p}; diff --git a/assets/plus-UK0TEjgd.js b/assets/plus-Yh42pKZz.js similarity index 66% rename from assets/plus-UK0TEjgd.js rename to assets/plus-Yh42pKZz.js index e89d9456741821a7bdee56982ca831e26605472a..5dbba74ae7eb84a136b157c0f6feb62ee054d3c9 100644 --- a/assets/plus-UK0TEjgd.js +++ b/assets/plus-Yh42pKZz.js @@ -1,6 +1,6 @@ -import{n as e}from"./index-CbgxfyGU.js";/** +import{s}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const a=e("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);export{a as P}; + */const a=s("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);export{a as P}; diff --git a/assets/popover-DKJYnYjk.js b/assets/popover-CTBEUp7Y.js similarity index 83% rename from assets/popover-DKJYnYjk.js rename to assets/popover-CTBEUp7Y.js index 1be5c8318a969bccf1be2637e68d881178206dbb..98ffe850151dad24d75ada9ae00ef029a1dccc16 100644 --- a/assets/popover-DKJYnYjk.js +++ b/assets/popover-CTBEUp7Y.js @@ -1 +1 @@ -import{r as s,j as l,ae as V,w as $,aj as L,a9 as W,x as A,v as O,y as h,ak as y,al as E,P as _,am as H,A as z,aR as B,aS as G,aT as K,aU as U,an as Z,ao as q,ap as J,B as Q}from"./index-CbgxfyGU.js";function X(e){const t=Y(e),r=s.forwardRef((n,o)=>{const{children:a,...c}=n,i=s.Children.toArray(a),p=i.find(oe);if(p){const u=p.props.children,P=i.map(f=>f===p?s.Children.count(u)>1?s.Children.only(null):s.isValidElement(u)?u.props.children:null:f);return l.jsx(t,{...c,ref:o,children:s.isValidElement(u)?s.cloneElement(u,void 0,P):null})}return l.jsx(t,{...c,ref:o,children:a})});return r.displayName=`${e}.Slot`,r}function Y(e){const t=s.forwardRef((r,n)=>{const{children:o,...a}=r;if(s.isValidElement(o)){const c=re(o),i=te(a,o.props);return o.type!==s.Fragment&&(i.ref=n?V(n,c):c),s.cloneElement(o,i)}return s.Children.count(o)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ee=Symbol("radix.slottable");function oe(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ee}function te(e,t){const r={...t};for(const n in t){const o=e[n],a=t[n];/^on[A-Z]/.test(n)?o&&a?r[n]=(...i)=>{const p=a(...i);return o(...i),p}:o&&(r[n]=o):n==="style"?r[n]={...o,...a}:n==="className"&&(r[n]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}function re(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var C="Popover",[b]=z(C,[E]),m=E(),[ne,d]=b(C),j=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:o,onOpenChange:a,modal:c=!1}=e,i=m(t),p=s.useRef(null),[u,P]=s.useState(!1),[f,v]=$({prop:n,defaultProp:o??!1,onChange:a,caller:C});return l.jsx(L,{...i,children:l.jsx(ne,{scope:t,contentId:W(),triggerRef:p,open:f,onOpenChange:v,onOpenToggle:s.useCallback(()=>v(x=>!x),[v]),hasCustomAnchor:u,onCustomAnchorAdd:s.useCallback(()=>P(!0),[]),onCustomAnchorRemove:s.useCallback(()=>P(!1),[]),modal:c,children:r})})};j.displayName=C;var w="PopoverAnchor",ae=s.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=d(w,r),a=m(r),{onCustomAnchorAdd:c,onCustomAnchorRemove:i}=o;return s.useEffect(()=>(c(),()=>i()),[c,i]),l.jsx(y,{...a,...n,ref:t})});ae.displayName=w;var S="PopoverTrigger",N=s.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=d(S,r),a=m(r),c=A(t,o.triggerRef),i=l.jsx(O.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":M(o.open),...n,ref:c,onClick:h(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:l.jsx(y,{asChild:!0,...a,children:i})});N.displayName=S;var R="PopoverPortal",[se,ce]=b(R,{forceMount:void 0}),F=e=>{const{__scopePopover:t,forceMount:r,children:n,container:o}=e,a=d(R,t);return l.jsx(se,{scope:t,forceMount:r,children:l.jsx(_,{present:r||a.open,children:l.jsx(H,{asChild:!0,container:o,children:n})})})};F.displayName=R;var g="PopoverContent",D=s.forwardRef((e,t)=>{const r=ce(g,e.__scopePopover),{forceMount:n=r.forceMount,...o}=e,a=d(g,e.__scopePopover);return l.jsx(_,{present:n||a.open,children:a.modal?l.jsx(le,{...o,ref:t}):l.jsx(pe,{...o,ref:t})})});D.displayName=g;var ie=X("PopoverContent.RemoveScroll"),le=s.forwardRef((e,t)=>{const r=d(g,e.__scopePopover),n=s.useRef(null),o=A(t,n),a=s.useRef(!1);return s.useEffect(()=>{const c=n.current;if(c)return B(c)},[]),l.jsx(G,{as:ie,allowPinchZoom:!0,children:l.jsx(I,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,c=>{var i;c.preventDefault(),a.current||(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,c=>{const i=c.detail.originalEvent,p=i.button===0&&i.ctrlKey===!0,u=i.button===2||p;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),pe=s.forwardRef((e,t)=>{const r=d(g,e.__scopePopover),n=s.useRef(!1),o=s.useRef(!1);return l.jsx(I,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var c,i;(c=e.onCloseAutoFocus)==null||c.call(e,a),a.defaultPrevented||(n.current||(i=r.triggerRef.current)==null||i.focus(),a.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:a=>{var p,u;(p=e.onInteractOutside)==null||p.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(c))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),I=s.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:c,onEscapeKeyDown:i,onPointerDownOutside:p,onFocusOutside:u,onInteractOutside:P,...f}=e,v=d(g,r),x=m(r);return K(),l.jsx(U,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:a,children:l.jsx(Z,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:P,onEscapeKeyDown:i,onPointerDownOutside:p,onFocusOutside:u,onDismiss:()=>v.onOpenChange(!1),children:l.jsx(q,{"data-state":M(v.open),role:"dialog",id:v.contentId,...x,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),T="PopoverClose",ue=s.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=d(T,r);return l.jsx(O.button,{type:"button",...n,ref:t,onClick:h(e.onClick,()=>o.onOpenChange(!1))})});ue.displayName=T;var de="PopoverArrow",fe=s.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=m(r);return l.jsx(J,{...o,...n,ref:t})});fe.displayName=de;function M(e){return e?"open":"closed"}var ve=j,Pe=N,ge=F,k=D;const Ce=ve,xe=Pe,he=s.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},o)=>l.jsx(ge,{children:l.jsx(k,{ref:o,align:t,sideOffset:r,className:Q("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));he.displayName=k.displayName;export{Ce as P,xe as a,he as b}; +import{d as s,j as l,ak as V,A as $,ap as L,af as W,B as A,z as O,D as h,aq as E,ar as _,P as y,as as H,F as z,aX as G,aY as B,aZ as Z,a_ as K,at as q,au as U,av as X,G as Y}from"./index-DyXq7-Tg.js";function J(e){const t=Q(e),r=s.forwardRef((n,o)=>{const{children:a,...c}=n,i=s.Children.toArray(a),p=i.find(oe);if(p){const u=p.props.children,P=i.map(f=>f===p?s.Children.count(u)>1?s.Children.only(null):s.isValidElement(u)?u.props.children:null:f);return l.jsx(t,{...c,ref:o,children:s.isValidElement(u)?s.cloneElement(u,void 0,P):null})}return l.jsx(t,{...c,ref:o,children:a})});return r.displayName=`${e}.Slot`,r}function Q(e){const t=s.forwardRef((r,n)=>{const{children:o,...a}=r;if(s.isValidElement(o)){const c=re(o),i=te(a,o.props);return o.type!==s.Fragment&&(i.ref=n?V(n,c):c),s.cloneElement(o,i)}return s.Children.count(o)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ee=Symbol("radix.slottable");function oe(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ee}function te(e,t){const r={...t};for(const n in t){const o=e[n],a=t[n];/^on[A-Z]/.test(n)?o&&a?r[n]=(...i)=>{const p=a(...i);return o(...i),p}:o&&(r[n]=o):n==="style"?r[n]={...o,...a}:n==="className"&&(r[n]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}function re(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var C="Popover",[b]=z(C,[_]),m=_(),[ne,d]=b(C),j=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:o,onOpenChange:a,modal:c=!1}=e,i=m(t),p=s.useRef(null),[u,P]=s.useState(!1),[f,v]=$({prop:n,defaultProp:o??!1,onChange:a,caller:C});return l.jsx(L,{...i,children:l.jsx(ne,{scope:t,contentId:W(),triggerRef:p,open:f,onOpenChange:v,onOpenToggle:s.useCallback(()=>v(x=>!x),[v]),hasCustomAnchor:u,onCustomAnchorAdd:s.useCallback(()=>P(!0),[]),onCustomAnchorRemove:s.useCallback(()=>P(!1),[]),modal:c,children:r})})};j.displayName=C;var w="PopoverAnchor",ae=s.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=d(w,r),a=m(r),{onCustomAnchorAdd:c,onCustomAnchorRemove:i}=o;return s.useEffect(()=>(c(),()=>i()),[c,i]),l.jsx(E,{...a,...n,ref:t})});ae.displayName=w;var S="PopoverTrigger",N=s.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=d(S,r),a=m(r),c=A(t,o.triggerRef),i=l.jsx(O.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":M(o.open),...n,ref:c,onClick:h(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:l.jsx(E,{asChild:!0,...a,children:i})});N.displayName=S;var R="PopoverPortal",[se,ce]=b(R,{forceMount:void 0}),F=e=>{const{__scopePopover:t,forceMount:r,children:n,container:o}=e,a=d(R,t);return l.jsx(se,{scope:t,forceMount:r,children:l.jsx(y,{present:r||a.open,children:l.jsx(H,{asChild:!0,container:o,children:n})})})};F.displayName=R;var g="PopoverContent",D=s.forwardRef((e,t)=>{const r=ce(g,e.__scopePopover),{forceMount:n=r.forceMount,...o}=e,a=d(g,e.__scopePopover);return l.jsx(y,{present:n||a.open,children:a.modal?l.jsx(le,{...o,ref:t}):l.jsx(pe,{...o,ref:t})})});D.displayName=g;var ie=J("PopoverContent.RemoveScroll"),le=s.forwardRef((e,t)=>{const r=d(g,e.__scopePopover),n=s.useRef(null),o=A(t,n),a=s.useRef(!1);return s.useEffect(()=>{const c=n.current;if(c)return G(c)},[]),l.jsx(B,{as:ie,allowPinchZoom:!0,children:l.jsx(I,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,c=>{var i;c.preventDefault(),a.current||(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,c=>{const i=c.detail.originalEvent,p=i.button===0&&i.ctrlKey===!0,u=i.button===2||p;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),pe=s.forwardRef((e,t)=>{const r=d(g,e.__scopePopover),n=s.useRef(!1),o=s.useRef(!1);return l.jsx(I,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var c,i;(c=e.onCloseAutoFocus)==null||c.call(e,a),a.defaultPrevented||(n.current||(i=r.triggerRef.current)==null||i.focus(),a.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:a=>{var p,u;(p=e.onInteractOutside)==null||p.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(c))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),I=s.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:c,onEscapeKeyDown:i,onPointerDownOutside:p,onFocusOutside:u,onInteractOutside:P,...f}=e,v=d(g,r),x=m(r);return Z(),l.jsx(K,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:a,children:l.jsx(q,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:P,onEscapeKeyDown:i,onPointerDownOutside:p,onFocusOutside:u,onDismiss:()=>v.onOpenChange(!1),children:l.jsx(U,{"data-state":M(v.open),role:"dialog",id:v.contentId,...x,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),T="PopoverClose",ue=s.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=d(T,r);return l.jsx(O.button,{type:"button",...n,ref:t,onClick:h(e.onClick,()=>o.onOpenChange(!1))})});ue.displayName=T;var de="PopoverArrow",fe=s.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=m(r);return l.jsx(X,{...o,...n,ref:t})});fe.displayName=de;function M(e){return e?"open":"closed"}var ve=j,Pe=N,ge=F,k=D;const Ce=ve,xe=Pe,he=s.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},o)=>l.jsx(ge,{children:l.jsx(k,{ref:o,align:t,sideOffset:r,className:Y("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));he.displayName=k.displayName;export{Ce as P,xe as a,he as b}; diff --git a/assets/preferences-COzeOLyS.js b/assets/preferences-COzeOLyS.js new file mode 100644 index 0000000000000000000000000000000000000000..9a42d7e8d34329ff7836edfca4ac4aa4c148ead7 --- /dev/null +++ b/assets/preferences-COzeOLyS.js @@ -0,0 +1 @@ +import{a as y,i as d,b as f,W as p}from"./index-DyXq7-Tg.js";import{u as m}from"./useMutation-UWxBeqtn.js";import{a as c}from"./account-cbblajck.js";const i={hide_closed_source_evals:!1};function v(){const{user:t}=y(),r=d(),s=p.preferences,a=f({queryKey:s,queryFn:()=>c.getPreferences(),enabled:!!t,staleTime:1/0}),o=a.data??i,l=m({mutationFn:e=>t?c.updatePreferences(e):Promise.resolve(e),onMutate:async e=>{await r.cancelQueries({queryKey:s});const u=r.getQueryData(s)??i;return r.setQueryData(s,e),{previous:u}},onError:(e,u,n)=>{n&&r.setQueryData(s,n.previous)},onSuccess:e=>r.setQueryData(s,e)});return{preferences:o,canPersist:!!t,isLoading:a.isLoading,setHideClosedSourceEvals:e=>l.mutate({...o,hide_closed_source_evals:e})}}export{v as u}; diff --git a/assets/queryInvalidation-CfHeNeUY.js b/assets/queryInvalidation-CfHeNeUY.js new file mode 100644 index 0000000000000000000000000000000000000000..681aaf3c70ceab2fb3d7a69f350e4607993c8d35 --- /dev/null +++ b/assets/queryInvalidation-CfHeNeUY.js @@ -0,0 +1 @@ +import{p as n,t as u}from"./index-DyXq7-Tg.js";function f(e,t,a){if(!e)return e;const i=r=>r.paper_id!==t||r.paper_title===a?r:{...r,paper_title:a};if(Array.isArray(e)){const r=e.map(i);return r.some((s,o)=>s!==e[o])?r:e}if(Array.isArray(e.results)){const r=e.results.map(i);return r.some((s,o)=>s!==e.results[o])?{...e,results:r}:e}return e}function p(e,t){const a=new Set(t.filter(i=>!!i));for(const i of a)for(const r of[n.detail(i),n.arxiv(i),n.preview(i),n.summary(i)])e.invalidateQueries({queryKey:r,exact:!0})}function y(e){for(const t of Object.values(n.feeds))e.invalidateQueries({queryKey:t,refetchType:"none"})}function h(e,t,a){new Set([...a,t.id,t.arxiv_id].filter(s=>!!s)).forEach(s=>{e.setQueryData(n.detail(s),t),e.setQueryData(n.arxiv(s),t),e.setQueriesData({queryKey:n.preview(s),exact:!0},t),e.setQueriesData({queryKey:n.summary(s),exact:!0},t)}),y(e);const r=String(t.id),c=s=>f(s,r,t.title);for(const s of[u.all,u.byDatasetAll])e.setQueriesData({queryKey:s},c),e.invalidateQueries({queryKey:s,refetchType:"none"})}export{y as a,p as i,h as r}; diff --git a/assets/queryInvalidation-Chlw4DEx.js b/assets/queryInvalidation-Chlw4DEx.js deleted file mode 100644 index 0ef49180c50116482e3f2e61739fa7ddde173698..0000000000000000000000000000000000000000 --- a/assets/queryInvalidation-Chlw4DEx.js +++ /dev/null @@ -1 +0,0 @@ -import{p as a}from"./paperQueryKeys-B8u1BWlI.js";function o(e,s,n){if(!e)return e;const i=r=>r.paper_id!==s||r.paper_title===n?r:{...r,paper_title:n};if(Array.isArray(e)){const r=e.map(i);return r.some((t,u)=>t!==e[u])?r:e}if(Array.isArray(e.results)){const r=e.results.map(i);return r.some((t,u)=>t!==e.results[u])?{...e,results:r}:e}return e}function v(e,s){const n=new Set(s.filter(i=>!!i));for(const i of n)for(const r of[a.detail(i),a.arxiv(i),a.preview(i),a.summary(i)])e.invalidateQueries({queryKey:r,exact:!0})}function f(e){for(const s of Object.values(a.feeds))e.invalidateQueries({queryKey:s,refetchType:"none"})}function p(e,s,n){new Set([...n,s.id,s.arxiv_id].filter(t=>!!t)).forEach(t=>{e.setQueryData(a.detail(t),s),e.setQueryData(a.arxiv(t),s),e.setQueriesData({queryKey:a.preview(t),exact:!0},s),e.setQueriesData({queryKey:a.summary(t),exact:!0},s)}),f(e);const r=String(s.id),c=t=>o(t,r,s.title);e.setQueriesData({queryKey:["evaluations"]},c),e.setQueriesData({queryKey:["dataset-evals"]},c),e.invalidateQueries({queryKey:["evaluations"],refetchType:"none"}),e.invalidateQueries({queryKey:["dataset-evals"],refetchType:"none"})}export{f as a,v as i,p as r}; diff --git a/assets/refresh-cw-Cps6nypW.js b/assets/refresh-cw-DYXzpRir.js similarity index 94% rename from assets/refresh-cw-Cps6nypW.js rename to assets/refresh-cw-DYXzpRir.js index 11b2b5f6cf0910103a8221e57cfb67939bfa2ca2..6f75ee7f01d5f3b0d276294009661b7f442a4b06 100644 --- a/assets/refresh-cw-Cps6nypW.js +++ b/assets/refresh-cw-DYXzpRir.js @@ -1,4 +1,4 @@ -import{n as e}from"./index-CbgxfyGU.js";/** +import{s as e}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/research-DgpyzSy_.js b/assets/research-DgpyzSy_.js deleted file mode 100644 index 0e0ca8e0543f55038b9a6d62dba385128db99e04..0000000000000000000000000000000000000000 --- a/assets/research-DgpyzSy_.js +++ /dev/null @@ -1 +0,0 @@ -import{a6 as t}from"./index-CbgxfyGU.js";const i=300,m={follows:()=>t("/me/follows"),followSuggestions:()=>t("/research/follow-suggestions"),setFollow:(o,e,a)=>t(`/me/follows/${o}/${e}`,{method:a?"PUT":"DELETE"}),following:(o=0,e={})=>{const a=new URLSearchParams({offset:String(o),limit:"40"});return e.startDate&&a.set("start_date",e.startDate),e.endDate&&a.set("end_date",e.endDate),!e.startDate&&!e.endDate&&a.set("all_time","true"),e.topicOnly&&a.set("topic_only","true"),t(`/me/following?${a}`)},topic:()=>t("/me/topic"),setTopic:o=>t("/me/topic",{method:"PUT",body:JSON.stringify({text:o})}),clearTopic:()=>t("/me/topic",{method:"DELETE"}),email:()=>t("/me/research-email"),setEmail:o=>t("/me/research-email",{method:"PUT",body:JSON.stringify({enabled:o})})};export{i as T,m as r}; diff --git a/assets/researchTopic-CteUev4M.js b/assets/researchTopic-CteUev4M.js deleted file mode 100644 index 05d6e46d9f0bd5a90155fcadec3c65f3f5d5b584..0000000000000000000000000000000000000000 --- a/assets/researchTopic-CteUev4M.js +++ /dev/null @@ -1 +0,0 @@ -import{d as u,f}from"./index-CbgxfyGU.js";import{u as d}from"./useMutation-P_trTy9i.js";import{r as a}from"./research-DgpyzSy_.js";function y(e){var n;const s=(n=u())==null?void 0:n.user,t=f();return d({mutationFn:async o=>o===null?(await a.clearTopic(),null):a.setTopic(o),onSuccess:o=>{t.setQueryData(["research-topic",s==null?void 0:s.hf_subject],o),m(),e==null||e(),t.invalidateQueries({queryKey:["research-feed",s==null?void 0:s.hf_subject]}),t.invalidateQueries({queryKey:["research-email",s==null?void 0:s.hf_subject]})}})}const r="pwc:following-pending-topic";function S(e){sessionStorage.setItem(r,e)}function v(){return sessionStorage.getItem(r)}function m(){sessionStorage.removeItem(r)}function P(){var t;const e=(t=u())==null?void 0:t.user,s=f();return d({mutationFn:async n=>{const l=(await Promise.allSettled(n.map(i=>a.setFollow(i.kind,i.id,i.follow??!0)))).find(i=>i.status==="rejected");if(l)throw l.reason},onSuccess:()=>g(),onSettled:()=>{s.invalidateQueries({queryKey:["research-follows",e==null?void 0:e.hf_subject]}),s.invalidateQueries({queryKey:["research-feed",e==null?void 0:e.hf_subject]}),s.invalidateQueries({queryKey:["research-email",e==null?void 0:e.hf_subject]})}})}const c="pwc:following-pending-follows";function _(e){sessionStorage.setItem(c,JSON.stringify(e))}function I(){return JSON.parse(sessionStorage.getItem(c)??"[]")}function g(){sessionStorage.removeItem(c)}export{P as a,_ as b,I as c,m as d,v as r,S as s,y as u}; diff --git a/assets/researchTopic-DbX0eko-.js b/assets/researchTopic-DbX0eko-.js new file mode 100644 index 0000000000000000000000000000000000000000..e4b22947d2f62d6bc5aeeb19e46f31928f623cf5 --- /dev/null +++ b/assets/researchTopic-DbX0eko-.js @@ -0,0 +1 @@ +import{ac as n,f as u,b as y,r,i as m}from"./index-DyXq7-Tg.js";import{u as w}from"./useMutation-UWxBeqtn.js";const _=300,c={follows:()=>n("/me/follows"),followSuggestions:()=>n("/research/follow-suggestions"),setFollow:(e,t,s)=>n(`/me/follows/${e}/${t}`,{method:s?"PUT":"DELETE"}),following:(e=0,t={})=>{const s=new URLSearchParams({offset:String(e),limit:"40"});return t.startDate&&s.set("start_date",t.startDate),t.endDate&&s.set("end_date",t.endDate),!t.startDate&&!t.endDate&&s.set("all_time","true"),t.topicOnly&&s.set("topic_only","true"),n(`/me/following?${s}`)},topic:()=>n("/me/topic"),setTopic:e=>n("/me/topic",{method:"PUT",body:JSON.stringify({text:e})}),clearTopic:()=>n("/me/topic",{method:"DELETE"}),email:()=>n("/me/research-email"),setEmail:e=>n("/me/research-email",{method:"PUT",body:JSON.stringify({enabled:e})})};function d(e,t,{follows:s}){return Promise.all([s&&e.invalidateQueries({queryKey:r.follows(t)}),e.invalidateQueries({queryKey:r.feed(t)}),e.invalidateQueries({queryKey:r.email(t)})])}function F(e=!0){var s;const t=(s=u())==null?void 0:s.user;return y({queryKey:r.follows(t==null?void 0:t.hf_subject),queryFn:c.follows,enabled:e&&!!t})}function E({onChanged:e,awaitRefresh:t=!1}={}){var i;const s=(i=u())==null?void 0:i.user,a=m();return w({mutationFn:({kind:l,entityId:o,follow:f})=>c.setFollow(l,o,f),onSuccess:async(l,o)=>{e==null||e(o);const f=d(a,s==null?void 0:s.hf_subject,{follows:!0});t&&await f}})}function D(e){var a;const t=(a=u())==null?void 0:a.user,s=m();return w({mutationFn:async i=>i===null?(await c.clearTopic(),null):c.setTopic(i),onSuccess:i=>{s.setQueryData(r.topic(t==null?void 0:t.hf_subject),i),h(),e==null||e(),d(s,t==null?void 0:t.hf_subject,{follows:!1})}})}const p="pwc:following-pending-topic";function I(e){sessionStorage.setItem(p,e)}function O(){return sessionStorage.getItem(p)}function h(){sessionStorage.removeItem(p)}function N(){var s;const e=(s=u())==null?void 0:s.user,t=m();return w({mutationFn:async a=>{const l=(await Promise.allSettled(a.map(o=>c.setFollow(o.kind,o.id,o.follow??!0)))).find(o=>o.status==="rejected");if(l)throw l.reason},onSuccess:()=>S(),onSettled:()=>void d(t,e==null?void 0:e.hf_subject,{follows:!0})})}const g="pwc:following-pending-follows";function b(e){sessionStorage.setItem(g,JSON.stringify(e))}function K(){return JSON.parse(sessionStorage.getItem(g)??"[]")}function S(){sessionStorage.removeItem(g)}export{_ as T,D as a,N as b,b as c,O as d,K as e,h as f,E as g,c as r,I as s,F as u}; diff --git a/assets/savedPapersAuth-DsQUuWa_.js b/assets/savedPapersAuth-TV7AiXOw.js similarity index 75% rename from assets/savedPapersAuth-DsQUuWa_.js rename to assets/savedPapersAuth-TV7AiXOw.js index 79881fdc854827d7bb5da3a0f2c8be81e370d5d6..d5898f4566158caeabfd069df8989abb151f0bba 100644 --- a/assets/savedPapersAuth-DsQUuWa_.js +++ b/assets/savedPapersAuth-TV7AiXOw.js @@ -1 +1 @@ -import{h as a}from"./index-CbgxfyGU.js";const t="saved_papers_authorized";function o(r=!1){const e=new URL(window.location.href);return r&&e.searchParams.set(t,"1"),a(`${e.pathname}${e.search}${e.hash}`,{authorizeBucket:!0,bucketCreate:!0})}export{t as S,o as s}; +import{h as a}from"./index-DyXq7-Tg.js";const t="saved_papers_authorized";function o(r=!1){const e=new URL(window.location.href);return r&&e.searchParams.set(t,"1"),a(`${e.pathname}${e.search}${e.hash}`,{authorizeBucket:!0,bucketCreate:!0})}export{t as S,o as s}; diff --git a/assets/search-CLtAJGOp.js b/assets/search-8ssWDP68.js similarity index 87% rename from assets/search-CLtAJGOp.js rename to assets/search-8ssWDP68.js index c718175606d071789d8db74d5375176429e8d97d..edae1d6caca9cbebddcc9b85fc61ba2fdb3b1fdb 100644 --- a/assets/search-CLtAJGOp.js +++ b/assets/search-8ssWDP68.js @@ -1,4 +1,4 @@ -import{n as e}from"./index-CbgxfyGU.js";/** +import{s as e}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/searchable-select-DNdBIahG.js b/assets/searchable-select-DNdBIahG.js deleted file mode 100644 index 9129e7d290cfc850cbd5ccab0079f4a55466dda4..0000000000000000000000000000000000000000 --- a/assets/searchable-select-DNdBIahG.js +++ /dev/null @@ -1,6 +0,0 @@ -import{n as Ae,r as a,a9 as Q,v as L,aa as Me,ab as De,ac as $e,ad as Le,ae as H,j as p,B as D,C as Pe}from"./index-CbgxfyGU.js";import{u as Fe}from"./useQuery-Bx9s5-D2.js";import{B as Ke}from"./button-Bv9oZ-QU.js";import{P as qe,a as Be,b as Ve}from"./popover-DKJYnYjk.js";import"./dialog-Cfp_d3CC.js";import{S as Ue}from"./search-CLtAJGOp.js";import{L as Qe}from"./loader-circle-CWMja8Zn.js";/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Te=Ae("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var fe=1,ze=.9,Ge=.8,He=.17,re=.1,ne=.999,We=.9999,Je=.99,Xe=/[\\\/_+.#"@\[\(\{&]/,Ye=/[\\\/_+.#"@\[\(\{&]/g,Ze=/[\s-]/,he=/[\s-]/g;function le(e,n,t,m,o,i,d){if(i===n.length)return o===e.length?fe:Je;var c=`${o},${i}`;if(d[c]!==void 0)return d[c];for(var y=m.charAt(i),u=t.indexOf(y,o),v=0,g,C,E,j;u>=0;)g=le(e,n,t,m,u+1,i+1,d),g>v&&(u===o?g*=fe:Xe.test(e.charAt(u-1))?(g*=Ge,E=e.slice(o,u-1).match(Ye),E&&o>0&&(g*=Math.pow(ne,E.length))):Ze.test(e.charAt(u-1))?(g*=ze,j=e.slice(o,u-1).match(he),j&&o>0&&(g*=Math.pow(ne,j.length))):(g*=He,o>0&&(g*=Math.pow(ne,u-o))),e.charAt(u)!==n.charAt(i)&&(g*=We)),(gg&&(g=C*re)),g>v&&(v=g),u=t.indexOf(y,u+1);return d[c]=v,v}function pe(e){return e.toLowerCase().replace(he," ")}function _e(e,n,t){return e=t&&t.length>0?`${e+" "+t.join(" ")}`:e,le(e,n,pe(e),pe(n),0,0,{})}var G='[cmdk-group=""]',ae='[cmdk-group-items=""]',Oe='[cmdk-group-heading=""]',ge='[cmdk-item=""]',ve=`${ge}:not([aria-disabled="true"])`,oe="cmdk-item-select",V="data-value",et=(e,n,t)=>_e(e,n,t),xe=a.createContext(void 0),W=()=>a.useContext(xe),be=a.createContext(void 0),ue=()=>a.useContext(be),ye=a.createContext(void 0),we=a.forwardRef((e,n)=>{let t=U(()=>{var r,s;return{search:"",value:(s=(r=e.value)!=null?r:e.defaultValue)!=null?s:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),m=U(()=>new Set),o=U(()=>new Map),i=U(()=>new Map),d=U(()=>new Set),c=Ee(e),{label:y,children:u,value:v,onValueChange:g,filter:C,shouldFilter:E,loop:j,disablePointerSelection:P=!1,vimBindings:R=!0,...F}=e,q=Q(),A=Q(),T=Q(),M=a.useRef(null),x=dt();K(()=>{if(v!==void 0){let r=v.trim();t.current.value=r,k.emit()}},[v]),K(()=>{x(6,ie)},[]);let k=a.useMemo(()=>({subscribe:r=>(d.current.add(r),()=>d.current.delete(r)),snapshot:()=>t.current,setState:(r,s,f)=>{var l,h,b,I;if(!Object.is(t.current[r],s)){if(t.current[r]=s,r==="search")O(),Z(),x(1,_);else if(r==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let S=document.getElementById(T);S?S.focus():(l=document.getElementById(q))==null||l.focus()}if(x(7,()=>{var S;t.current.selectedItemId=(S=B())==null?void 0:S.id,k.emit()}),f||x(5,ie),((h=c.current)==null?void 0:h.value)!==void 0){let S=s??"";(I=(b=c.current).onValueChange)==null||I.call(b,S);return}}k.emit()}},emit:()=>{d.current.forEach(r=>r())}}),[]),w=a.useMemo(()=>({value:(r,s,f)=>{var l;s!==((l=i.current.get(r))==null?void 0:l.value)&&(i.current.set(r,{value:s,keywords:f}),t.current.filtered.items.set(r,J(s,f)),x(2,()=>{Z(),k.emit()}))},item:(r,s)=>(m.current.add(r),s&&(o.current.has(s)?o.current.get(s).add(r):o.current.set(s,new Set([r]))),x(3,()=>{O(),Z(),t.current.value||_(),k.emit()}),()=>{i.current.delete(r),m.current.delete(r),t.current.filtered.items.delete(r);let f=B();x(4,()=>{O(),(f==null?void 0:f.getAttribute("id"))===r&&_(),k.emit()})}),group:r=>(o.current.has(r)||o.current.set(r,new Set),()=>{i.current.delete(r),o.current.delete(r)}),filter:()=>c.current.shouldFilter,label:y||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:q,inputId:T,labelId:A,listInnerRef:M}),[]);function J(r,s){var f,l;let h=(l=(f=c.current)==null?void 0:f.filter)!=null?l:et;return r?h(r,t.current.search,s):0}function Z(){if(!t.current.search||c.current.shouldFilter===!1)return;let r=t.current.filtered.items,s=[];t.current.filtered.groups.forEach(l=>{let h=o.current.get(l),b=0;h.forEach(I=>{let S=r.get(I);b=Math.max(S,b)}),s.push([l,b])});let f=M.current;z().sort((l,h)=>{var b,I;let S=l.getAttribute("id"),X=h.getAttribute("id");return((b=r.get(X))!=null?b:0)-((I=r.get(S))!=null?I:0)}).forEach(l=>{let h=l.closest(ae);h?h.appendChild(l.parentElement===h?l:l.closest(`${ae} > *`)):f.appendChild(l.parentElement===f?l:l.closest(`${ae} > *`))}),s.sort((l,h)=>h[1]-l[1]).forEach(l=>{var h;let b=(h=M.current)==null?void 0:h.querySelector(`${G}[${V}="${encodeURIComponent(l[0])}"]`);b==null||b.parentElement.appendChild(b)})}function _(){let r=z().find(f=>f.getAttribute("aria-disabled")!=="true"),s=r==null?void 0:r.getAttribute(V);k.setState("value",s||void 0)}function O(){var r,s,f,l;if(!t.current.search||c.current.shouldFilter===!1){t.current.filtered.count=m.current.size;return}t.current.filtered.groups=new Set;let h=0;for(let b of m.current){let I=(s=(r=i.current.get(b))==null?void 0:r.value)!=null?s:"",S=(l=(f=i.current.get(b))==null?void 0:f.keywords)!=null?l:[],X=J(I,S);t.current.filtered.items.set(b,X),X>0&&h++}for(let[b,I]of o.current)for(let S of I)if(t.current.filtered.items.get(S)>0){t.current.filtered.groups.add(b);break}t.current.filtered.count=h}function ie(){var r,s,f;let l=B();l&&(((r=l.parentElement)==null?void 0:r.firstChild)===l&&((f=(s=l.closest(G))==null?void 0:s.querySelector(Oe))==null||f.scrollIntoView({block:"nearest"})),l.scrollIntoView({block:"nearest"}))}function B(){var r;return(r=M.current)==null?void 0:r.querySelector(`${ge}[aria-selected="true"]`)}function z(){var r;return Array.from(((r=M.current)==null?void 0:r.querySelectorAll(ve))||[])}function ee(r){let s=z()[r];s&&k.setState("value",s.getAttribute(V))}function te(r){var s;let f=B(),l=z(),h=l.findIndex(I=>I===f),b=l[h+r];(s=c.current)!=null&&s.loop&&(b=h+r<0?l[l.length-1]:h+r===l.length?l[0]:l[h+r]),b&&k.setState("value",b.getAttribute(V))}function se(r){let s=B(),f=s==null?void 0:s.closest(G),l;for(;f&&!l;)f=r>0?st(f,G):ct(f,G),l=f==null?void 0:f.querySelector(ve);l?k.setState("value",l.getAttribute(V)):te(r)}let ce=()=>ee(z().length-1),de=r=>{r.preventDefault(),r.metaKey?ce():r.altKey?se(1):te(1)},me=r=>{r.preventDefault(),r.metaKey?ee(0):r.altKey?se(-1):te(-1)};return a.createElement(L.div,{ref:n,tabIndex:-1,...F,"cmdk-root":"",onKeyDown:r=>{var s;(s=F.onKeyDown)==null||s.call(F,r);let f=r.nativeEvent.isComposing||r.keyCode===229;if(!(r.defaultPrevented||f))switch(r.key){case"n":case"j":{R&&r.ctrlKey&&de(r);break}case"ArrowDown":{de(r);break}case"p":case"k":{R&&r.ctrlKey&&me(r);break}case"ArrowUp":{me(r);break}case"Home":{r.preventDefault(),ee(0);break}case"End":{r.preventDefault(),ce();break}case"Enter":{r.preventDefault();let l=B();if(l){let h=new Event(oe);l.dispatchEvent(h)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:w.inputId,id:w.labelId,style:ft},y),Y(e,r=>a.createElement(be.Provider,{value:k},a.createElement(xe.Provider,{value:w},r))))}),tt=a.forwardRef((e,n)=>{var t,m;let o=Q(),i=a.useRef(null),d=a.useContext(ye),c=W(),y=Ee(e),u=(m=(t=y.current)==null?void 0:t.forceMount)!=null?m:d==null?void 0:d.forceMount;K(()=>{if(!u)return c.item(o,d==null?void 0:d.id)},[u]);let v=ke(o,i,[e.value,e.children,i],e.keywords),g=ue(),C=$(x=>x.value&&x.value===v.current),E=$(x=>u||c.filter()===!1?!0:x.search?x.filtered.items.get(o)>0:!0);a.useEffect(()=>{let x=i.current;if(!(!x||e.disabled))return x.addEventListener(oe,j),()=>x.removeEventListener(oe,j)},[E,e.onSelect,e.disabled]);function j(){var x,k;P(),(k=(x=y.current).onSelect)==null||k.call(x,v.current)}function P(){g.setState("value",v.current,!0)}if(!E)return null;let{disabled:R,value:F,onSelect:q,forceMount:A,keywords:T,...M}=e;return a.createElement(L.div,{ref:H(i,n),...M,id:o,"cmdk-item":"",role:"option","aria-disabled":!!R,"aria-selected":!!C,"data-disabled":!!R,"data-selected":!!C,onPointerMove:R||c.getDisablePointerSelection()?void 0:P,onClick:R?void 0:j},e.children)}),rt=a.forwardRef((e,n)=>{let{heading:t,children:m,forceMount:o,...i}=e,d=Q(),c=a.useRef(null),y=a.useRef(null),u=Q(),v=W(),g=$(E=>o||v.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);K(()=>v.group(d),[]),ke(d,c,[e.value,e.heading,y]);let C=a.useMemo(()=>({id:d,forceMount:o}),[o]);return a.createElement(L.div,{ref:H(c,n),...i,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},t&&a.createElement("div",{ref:y,"cmdk-group-heading":"","aria-hidden":!0,id:u},t),Y(e,E=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":t?u:void 0},a.createElement(ye.Provider,{value:C},E))))}),nt=a.forwardRef((e,n)=>{let{alwaysRender:t,...m}=e,o=a.useRef(null),i=$(d=>!d.search);return!t&&!i?null:a.createElement(L.div,{ref:H(o,n),...m,"cmdk-separator":"",role:"separator"})}),at=a.forwardRef((e,n)=>{let{onValueChange:t,...m}=e,o=e.value!=null,i=ue(),d=$(u=>u.search),c=$(u=>u.selectedItemId),y=W();return a.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),a.createElement(L.input,{ref:n,...m,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":y.listId,"aria-labelledby":y.labelId,"aria-activedescendant":c,id:y.inputId,type:"text",value:o?e.value:d,onChange:u=>{o||i.setState("search",u.target.value),t==null||t(u.target.value)}})}),lt=a.forwardRef((e,n)=>{let{children:t,label:m="Suggestions",...o}=e,i=a.useRef(null),d=a.useRef(null),c=$(u=>u.selectedItemId),y=W();return a.useEffect(()=>{if(d.current&&i.current){let u=d.current,v=i.current,g,C=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let E=u.offsetHeight;v.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return C.observe(u),()=>{cancelAnimationFrame(g),C.unobserve(u)}}},[]),a.createElement(L.div,{ref:H(i,n),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":m,id:y.listId},Y(e,u=>a.createElement("div",{ref:H(d,y.listInnerRef),"cmdk-list-sizer":""},u)))}),ot=a.forwardRef((e,n)=>{let{open:t,onOpenChange:m,overlayClassName:o,contentClassName:i,container:d,...c}=e;return a.createElement(Me,{open:t,onOpenChange:m},a.createElement(De,{container:d},a.createElement($e,{"cmdk-overlay":"",className:o}),a.createElement(Le,{"aria-label":e.label,"cmdk-dialog":"",className:i},a.createElement(we,{ref:n,...c}))))}),ut=a.forwardRef((e,n)=>$(t=>t.filtered.count===0)?a.createElement(L.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),it=a.forwardRef((e,n)=>{let{progress:t,children:m,label:o="Loading...",...i}=e;return a.createElement(L.div,{ref:n,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Y(e,d=>a.createElement("div",{"aria-hidden":!0},d)))}),N=Object.assign(we,{List:lt,Item:tt,Input:at,Group:rt,Separator:nt,Dialog:ot,Empty:ut,Loading:it});function st(e,n){let t=e.nextElementSibling;for(;t;){if(t.matches(n))return t;t=t.nextElementSibling}}function ct(e,n){let t=e.previousElementSibling;for(;t;){if(t.matches(n))return t;t=t.previousElementSibling}}function Ee(e){let n=a.useRef(e);return K(()=>{n.current=e}),n}var K=typeof window>"u"?a.useEffect:a.useLayoutEffect;function U(e){let n=a.useRef();return n.current===void 0&&(n.current=e()),n}function $(e){let n=ue(),t=()=>e(n.snapshot());return a.useSyncExternalStore(n.subscribe,t,t)}function ke(e,n,t,m=[]){let o=a.useRef(),i=W();return K(()=>{var d;let c=(()=>{var u;for(let v of t){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(u=v.current.textContent)==null?void 0:u.trim():o.current}})(),y=m.map(u=>u.trim());i.value(e,c,y),(d=n.current)==null||d.setAttribute(V,c),o.current=c}),o}var dt=()=>{let[e,n]=a.useState(),t=U(()=>new Map);return K(()=>{t.current.forEach(m=>m()),t.current=new Map},[e]),(m,o)=>{t.current.set(m,o),n({})}};function mt(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function Y({asChild:e,children:n},t){return e&&a.isValidElement(n)?a.cloneElement(mt(n),{ref:n.ref},t(n.props.children)):t(n)}var ft={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Se=a.forwardRef(({className:e,...n},t)=>p.jsx(N,{ref:t,className:D("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n}));Se.displayName=N.displayName;const Ce=a.forwardRef(({className:e,...n},t)=>p.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[p.jsx(Ue,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),p.jsx(N.Input,{ref:t,className:D("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n})]}));Ce.displayName=N.Input.displayName;const Ne=a.forwardRef(({className:e,...n},t)=>p.jsx(N.List,{ref:t,className:D("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...n}));Ne.displayName=N.List.displayName;const Ie=a.forwardRef((e,n)=>p.jsx(N.Empty,{ref:n,className:"py-6 text-center text-sm",...e}));Ie.displayName=N.Empty.displayName;const je=a.forwardRef(({className:e,...n},t)=>p.jsx(N.Group,{ref:t,className:D("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...n}));je.displayName=N.Group.displayName;const pt=a.forwardRef(({className:e,...n},t)=>p.jsx(N.Separator,{ref:t,className:D("-mx-1 h-px bg-border",e),...n}));pt.displayName=N.Separator.displayName;const Re=a.forwardRef(({className:e,...n},t)=>p.jsx(N.Item,{ref:t,className:D("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),...n}));Re.displayName=N.Item.displayName;const vt=250;function kt({value:e,onChange:n,placeholder:t="Select...",searchPlaceholder:m="Search...",emptyMessage:o="No results found.",errorMessage:i,disabled:d=!1,selectedOption:c,queryKey:y,queryFn:u,enabled:v=!0,className:g,ariaLabel:C}){const[E,j]=a.useState(!1),[P,R]=a.useState(""),[F,q]=a.useState("");a.useEffect(()=>{const w=window.setTimeout(()=>{q(P.trim())},vt);return()=>window.clearTimeout(w)},[P]),a.useEffect(()=>{E||(R(""),q(""))},[E]);const{data:A=[],isFetching:T,isError:M}=Fe({queryKey:[...y,F],queryFn:()=>u(F),enabled:v&&E}),x=a.useMemo(()=>!e||A.some(w=>w.value===e)?A:(c==null?void 0:c.value)===e?[c,...A]:A,[A,c,e]),k=a.useMemo(()=>{if(!e)return t;const w=x.find(J=>J.value===e)??((c==null?void 0:c.value)===e?c:null);return(w==null?void 0:w.label)??t},[x,t,c,e]);return p.jsxs(qe,{open:E,onOpenChange:j,modal:!0,children:[p.jsx(Be,{asChild:!0,children:p.jsxs(Ke,{type:"button",variant:"outline",role:"combobox","aria-expanded":E,"aria-label":C,disabled:d,className:D("h-8 w-full justify-between px-2 text-sm font-normal",!e&&"text-muted-foreground",g),children:[p.jsx("span",{className:"truncate",children:k}),p.jsx(Te,{className:"ml-1 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),p.jsx(Ve,{className:"z-[60] w-[var(--radix-popover-trigger-width)] max-h-[var(--radix-popover-content-available-height)] overflow-hidden p-0",align:"start",collisionPadding:8,onWheel:w=>w.stopPropagation(),children:p.jsxs(Se,{shouldFilter:!1,className:"h-full",children:[p.jsx(Ce,{placeholder:m,value:P,onValueChange:R}),p.jsx(Ne,{className:"max-h-[min(300px,calc(var(--radix-popover-content-available-height)-2.75rem))] min-h-0 overscroll-contain",children:T?p.jsxs("div",{className:"flex items-center justify-center py-6 text-sm text-muted-foreground",children:[p.jsx(Qe,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading..."]}):M&&i?p.jsx("div",{className:"px-4 py-6 text-center text-sm text-destructive",role:"alert",children:i}):x.length===0?p.jsx(Ie,{children:o}):p.jsx(je,{children:x.map(w=>p.jsxs(Re,{value:w.value,onSelect:()=>{n(w.value,w),j(!1)},children:[p.jsx(Pe,{className:D("mr-2 h-4 w-4",e===w.value?"opacity-100":"opacity-0")}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"truncate",children:w.label}),w.description?p.jsx("div",{className:"truncate text-xs text-muted-foreground",children:w.description}):null]})]},w.value))})})]})})]})}export{kt as S}; diff --git a/assets/searchable-select-DiDLwvbI.js b/assets/searchable-select-DiDLwvbI.js new file mode 100644 index 0000000000000000000000000000000000000000..1c0e6334fb98bf9e6737c8c0a091fad80ce87b7c --- /dev/null +++ b/assets/searchable-select-DiDLwvbI.js @@ -0,0 +1,6 @@ +import{s as Ae,d as a,af as z,z as L,ag as Me,ah as De,ai as $e,aj as Le,ak as H,j as p,G as D,b as Pe,C as Fe}from"./index-DyXq7-Tg.js";import{B as Ke}from"./button-DZeAbOf2.js";import{P as qe,a as Ve,b as Be}from"./popover-CTBEUp7Y.js";import"./dialog-CfM0Uql2.js";import{S as Ue}from"./search-8ssWDP68.js";import{L as ze}from"./loader-circle-C75KLEgx.js";/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ge=Ae("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var fe=1,Qe=.9,Te=.8,He=.17,re=.1,ne=.999,We=.9999,Je=.99,Xe=/[\\\/_+.#"@\[\(\{&]/,Ye=/[\\\/_+.#"@\[\(\{&]/g,Ze=/[\s-]/,he=/[\s-]/g;function le(e,n,t,m,u,i,d){if(i===n.length)return u===e.length?fe:Je;var c=`${u},${i}`;if(d[c]!==void 0)return d[c];for(var y=m.charAt(i),o=t.indexOf(y,u),v=0,g,C,k,I;o>=0;)g=le(e,n,t,m,o+1,i+1,d),g>v&&(o===u?g*=fe:Xe.test(e.charAt(o-1))?(g*=Te,k=e.slice(u,o-1).match(Ye),k&&u>0&&(g*=Math.pow(ne,k.length))):Ze.test(e.charAt(o-1))?(g*=Qe,I=e.slice(u,o-1).match(he),I&&u>0&&(g*=Math.pow(ne,I.length))):(g*=He,u>0&&(g*=Math.pow(ne,o-u))),e.charAt(o)!==n.charAt(i)&&(g*=We)),(gg&&(g=C*re)),g>v&&(v=g),o=t.indexOf(y,o+1);return d[c]=v,v}function pe(e){return e.toLowerCase().replace(he," ")}function _e(e,n,t){return e=t&&t.length>0?`${e+" "+t.join(" ")}`:e,le(e,n,pe(e),pe(n),0,0,{})}var T='[cmdk-group=""]',ae='[cmdk-group-items=""]',Oe='[cmdk-group-heading=""]',ge='[cmdk-item=""]',ve=`${ge}:not([aria-disabled="true"])`,ue="cmdk-item-select",B="data-value",et=(e,n,t)=>_e(e,n,t),xe=a.createContext(void 0),W=()=>a.useContext(xe),be=a.createContext(void 0),oe=()=>a.useContext(be),ye=a.createContext(void 0),we=a.forwardRef((e,n)=>{let t=U(()=>{var r,s;return{search:"",value:(s=(r=e.value)!=null?r:e.defaultValue)!=null?s:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),m=U(()=>new Set),u=U(()=>new Map),i=U(()=>new Map),d=U(()=>new Set),c=ke(e),{label:y,children:o,value:v,onValueChange:g,filter:C,shouldFilter:k,loop:I,disablePointerSelection:P=!1,vimBindings:R=!0,...F}=e,q=z(),A=z(),G=z(),M=a.useRef(null),x=dt();K(()=>{if(v!==void 0){let r=v.trim();t.current.value=r,E.emit()}},[v]),K(()=>{x(6,ie)},[]);let E=a.useMemo(()=>({subscribe:r=>(d.current.add(r),()=>d.current.delete(r)),snapshot:()=>t.current,setState:(r,s,f)=>{var l,h,b,j;if(!Object.is(t.current[r],s)){if(t.current[r]=s,r==="search")O(),Z(),x(1,_);else if(r==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let S=document.getElementById(G);S?S.focus():(l=document.getElementById(q))==null||l.focus()}if(x(7,()=>{var S;t.current.selectedItemId=(S=V())==null?void 0:S.id,E.emit()}),f||x(5,ie),((h=c.current)==null?void 0:h.value)!==void 0){let S=s??"";(j=(b=c.current).onValueChange)==null||j.call(b,S);return}}E.emit()}},emit:()=>{d.current.forEach(r=>r())}}),[]),w=a.useMemo(()=>({value:(r,s,f)=>{var l;s!==((l=i.current.get(r))==null?void 0:l.value)&&(i.current.set(r,{value:s,keywords:f}),t.current.filtered.items.set(r,J(s,f)),x(2,()=>{Z(),E.emit()}))},item:(r,s)=>(m.current.add(r),s&&(u.current.has(s)?u.current.get(s).add(r):u.current.set(s,new Set([r]))),x(3,()=>{O(),Z(),t.current.value||_(),E.emit()}),()=>{i.current.delete(r),m.current.delete(r),t.current.filtered.items.delete(r);let f=V();x(4,()=>{O(),(f==null?void 0:f.getAttribute("id"))===r&&_(),E.emit()})}),group:r=>(u.current.has(r)||u.current.set(r,new Set),()=>{i.current.delete(r),u.current.delete(r)}),filter:()=>c.current.shouldFilter,label:y||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:q,inputId:G,labelId:A,listInnerRef:M}),[]);function J(r,s){var f,l;let h=(l=(f=c.current)==null?void 0:f.filter)!=null?l:et;return r?h(r,t.current.search,s):0}function Z(){if(!t.current.search||c.current.shouldFilter===!1)return;let r=t.current.filtered.items,s=[];t.current.filtered.groups.forEach(l=>{let h=u.current.get(l),b=0;h.forEach(j=>{let S=r.get(j);b=Math.max(S,b)}),s.push([l,b])});let f=M.current;Q().sort((l,h)=>{var b,j;let S=l.getAttribute("id"),X=h.getAttribute("id");return((b=r.get(X))!=null?b:0)-((j=r.get(S))!=null?j:0)}).forEach(l=>{let h=l.closest(ae);h?h.appendChild(l.parentElement===h?l:l.closest(`${ae} > *`)):f.appendChild(l.parentElement===f?l:l.closest(`${ae} > *`))}),s.sort((l,h)=>h[1]-l[1]).forEach(l=>{var h;let b=(h=M.current)==null?void 0:h.querySelector(`${T}[${B}="${encodeURIComponent(l[0])}"]`);b==null||b.parentElement.appendChild(b)})}function _(){let r=Q().find(f=>f.getAttribute("aria-disabled")!=="true"),s=r==null?void 0:r.getAttribute(B);E.setState("value",s||void 0)}function O(){var r,s,f,l;if(!t.current.search||c.current.shouldFilter===!1){t.current.filtered.count=m.current.size;return}t.current.filtered.groups=new Set;let h=0;for(let b of m.current){let j=(s=(r=i.current.get(b))==null?void 0:r.value)!=null?s:"",S=(l=(f=i.current.get(b))==null?void 0:f.keywords)!=null?l:[],X=J(j,S);t.current.filtered.items.set(b,X),X>0&&h++}for(let[b,j]of u.current)for(let S of j)if(t.current.filtered.items.get(S)>0){t.current.filtered.groups.add(b);break}t.current.filtered.count=h}function ie(){var r,s,f;let l=V();l&&(((r=l.parentElement)==null?void 0:r.firstChild)===l&&((f=(s=l.closest(T))==null?void 0:s.querySelector(Oe))==null||f.scrollIntoView({block:"nearest"})),l.scrollIntoView({block:"nearest"}))}function V(){var r;return(r=M.current)==null?void 0:r.querySelector(`${ge}[aria-selected="true"]`)}function Q(){var r;return Array.from(((r=M.current)==null?void 0:r.querySelectorAll(ve))||[])}function ee(r){let s=Q()[r];s&&E.setState("value",s.getAttribute(B))}function te(r){var s;let f=V(),l=Q(),h=l.findIndex(j=>j===f),b=l[h+r];(s=c.current)!=null&&s.loop&&(b=h+r<0?l[l.length-1]:h+r===l.length?l[0]:l[h+r]),b&&E.setState("value",b.getAttribute(B))}function se(r){let s=V(),f=s==null?void 0:s.closest(T),l;for(;f&&!l;)f=r>0?st(f,T):ct(f,T),l=f==null?void 0:f.querySelector(ve);l?E.setState("value",l.getAttribute(B)):te(r)}let ce=()=>ee(Q().length-1),de=r=>{r.preventDefault(),r.metaKey?ce():r.altKey?se(1):te(1)},me=r=>{r.preventDefault(),r.metaKey?ee(0):r.altKey?se(-1):te(-1)};return a.createElement(L.div,{ref:n,tabIndex:-1,...F,"cmdk-root":"",onKeyDown:r=>{var s;(s=F.onKeyDown)==null||s.call(F,r);let f=r.nativeEvent.isComposing||r.keyCode===229;if(!(r.defaultPrevented||f))switch(r.key){case"n":case"j":{R&&r.ctrlKey&&de(r);break}case"ArrowDown":{de(r);break}case"p":case"k":{R&&r.ctrlKey&&me(r);break}case"ArrowUp":{me(r);break}case"Home":{r.preventDefault(),ee(0);break}case"End":{r.preventDefault(),ce();break}case"Enter":{r.preventDefault();let l=V();if(l){let h=new Event(ue);l.dispatchEvent(h)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:w.inputId,id:w.labelId,style:ft},y),Y(e,r=>a.createElement(be.Provider,{value:E},a.createElement(xe.Provider,{value:w},r))))}),tt=a.forwardRef((e,n)=>{var t,m;let u=z(),i=a.useRef(null),d=a.useContext(ye),c=W(),y=ke(e),o=(m=(t=y.current)==null?void 0:t.forceMount)!=null?m:d==null?void 0:d.forceMount;K(()=>{if(!o)return c.item(u,d==null?void 0:d.id)},[o]);let v=Ee(u,i,[e.value,e.children,i],e.keywords),g=oe(),C=$(x=>x.value&&x.value===v.current),k=$(x=>o||c.filter()===!1?!0:x.search?x.filtered.items.get(u)>0:!0);a.useEffect(()=>{let x=i.current;if(!(!x||e.disabled))return x.addEventListener(ue,I),()=>x.removeEventListener(ue,I)},[k,e.onSelect,e.disabled]);function I(){var x,E;P(),(E=(x=y.current).onSelect)==null||E.call(x,v.current)}function P(){g.setState("value",v.current,!0)}if(!k)return null;let{disabled:R,value:F,onSelect:q,forceMount:A,keywords:G,...M}=e;return a.createElement(L.div,{ref:H(i,n),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!R,"aria-selected":!!C,"data-disabled":!!R,"data-selected":!!C,onPointerMove:R||c.getDisablePointerSelection()?void 0:P,onClick:R?void 0:I},e.children)}),rt=a.forwardRef((e,n)=>{let{heading:t,children:m,forceMount:u,...i}=e,d=z(),c=a.useRef(null),y=a.useRef(null),o=z(),v=W(),g=$(k=>u||v.filter()===!1?!0:k.search?k.filtered.groups.has(d):!0);K(()=>v.group(d),[]),Ee(d,c,[e.value,e.heading,y]);let C=a.useMemo(()=>({id:d,forceMount:u}),[u]);return a.createElement(L.div,{ref:H(c,n),...i,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},t&&a.createElement("div",{ref:y,"cmdk-group-heading":"","aria-hidden":!0,id:o},t),Y(e,k=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":t?o:void 0},a.createElement(ye.Provider,{value:C},k))))}),nt=a.forwardRef((e,n)=>{let{alwaysRender:t,...m}=e,u=a.useRef(null),i=$(d=>!d.search);return!t&&!i?null:a.createElement(L.div,{ref:H(u,n),...m,"cmdk-separator":"",role:"separator"})}),at=a.forwardRef((e,n)=>{let{onValueChange:t,...m}=e,u=e.value!=null,i=oe(),d=$(o=>o.search),c=$(o=>o.selectedItemId),y=W();return a.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),a.createElement(L.input,{ref:n,...m,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":y.listId,"aria-labelledby":y.labelId,"aria-activedescendant":c,id:y.inputId,type:"text",value:u?e.value:d,onChange:o=>{u||i.setState("search",o.target.value),t==null||t(o.target.value)}})}),lt=a.forwardRef((e,n)=>{let{children:t,label:m="Suggestions",...u}=e,i=a.useRef(null),d=a.useRef(null),c=$(o=>o.selectedItemId),y=W();return a.useEffect(()=>{if(d.current&&i.current){let o=d.current,v=i.current,g,C=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let k=o.offsetHeight;v.style.setProperty("--cmdk-list-height",k.toFixed(1)+"px")})});return C.observe(o),()=>{cancelAnimationFrame(g),C.unobserve(o)}}},[]),a.createElement(L.div,{ref:H(i,n),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":m,id:y.listId},Y(e,o=>a.createElement("div",{ref:H(d,y.listInnerRef),"cmdk-list-sizer":""},o)))}),ut=a.forwardRef((e,n)=>{let{open:t,onOpenChange:m,overlayClassName:u,contentClassName:i,container:d,...c}=e;return a.createElement(Me,{open:t,onOpenChange:m},a.createElement(De,{container:d},a.createElement($e,{"cmdk-overlay":"",className:u}),a.createElement(Le,{"aria-label":e.label,"cmdk-dialog":"",className:i},a.createElement(we,{ref:n,...c}))))}),ot=a.forwardRef((e,n)=>$(t=>t.filtered.count===0)?a.createElement(L.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),it=a.forwardRef((e,n)=>{let{progress:t,children:m,label:u="Loading...",...i}=e;return a.createElement(L.div,{ref:n,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},Y(e,d=>a.createElement("div",{"aria-hidden":!0},d)))}),N=Object.assign(we,{List:lt,Item:tt,Input:at,Group:rt,Separator:nt,Dialog:ut,Empty:ot,Loading:it});function st(e,n){let t=e.nextElementSibling;for(;t;){if(t.matches(n))return t;t=t.nextElementSibling}}function ct(e,n){let t=e.previousElementSibling;for(;t;){if(t.matches(n))return t;t=t.previousElementSibling}}function ke(e){let n=a.useRef(e);return K(()=>{n.current=e}),n}var K=typeof window>"u"?a.useEffect:a.useLayoutEffect;function U(e){let n=a.useRef();return n.current===void 0&&(n.current=e()),n}function $(e){let n=oe(),t=()=>e(n.snapshot());return a.useSyncExternalStore(n.subscribe,t,t)}function Ee(e,n,t,m=[]){let u=a.useRef(),i=W();return K(()=>{var d;let c=(()=>{var o;for(let v of t){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(o=v.current.textContent)==null?void 0:o.trim():u.current}})(),y=m.map(o=>o.trim());i.value(e,c,y),(d=n.current)==null||d.setAttribute(B,c),u.current=c}),u}var dt=()=>{let[e,n]=a.useState(),t=U(()=>new Map);return K(()=>{t.current.forEach(m=>m()),t.current=new Map},[e]),(m,u)=>{t.current.set(m,u),n({})}};function mt(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function Y({asChild:e,children:n},t){return e&&a.isValidElement(n)?a.cloneElement(mt(n),{ref:n.ref},t(n.props.children)):t(n)}var ft={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Se=a.forwardRef(({className:e,...n},t)=>p.jsx(N,{ref:t,className:D("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n}));Se.displayName=N.displayName;const Ce=a.forwardRef(({className:e,...n},t)=>p.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[p.jsx(Ue,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),p.jsx(N.Input,{ref:t,className:D("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n})]}));Ce.displayName=N.Input.displayName;const Ne=a.forwardRef(({className:e,...n},t)=>p.jsx(N.List,{ref:t,className:D("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...n}));Ne.displayName=N.List.displayName;const je=a.forwardRef((e,n)=>p.jsx(N.Empty,{ref:n,className:"py-6 text-center text-sm",...e}));je.displayName=N.Empty.displayName;const Ie=a.forwardRef(({className:e,...n},t)=>p.jsx(N.Group,{ref:t,className:D("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...n}));Ie.displayName=N.Group.displayName;const pt=a.forwardRef(({className:e,...n},t)=>p.jsx(N.Separator,{ref:t,className:D("-mx-1 h-px bg-border",e),...n}));pt.displayName=N.Separator.displayName;const Re=a.forwardRef(({className:e,...n},t)=>p.jsx(N.Item,{ref:t,className:D("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),...n}));Re.displayName=N.Item.displayName;const vt=250;function kt({value:e,onChange:n,placeholder:t="Select...",searchPlaceholder:m="Search...",emptyMessage:u="No results found.",errorMessage:i,disabled:d=!1,selectedOption:c,queryKey:y,queryFn:o,enabled:v=!0,className:g,ariaLabel:C}){const[k,I]=a.useState(!1),[P,R]=a.useState(""),[F,q]=a.useState("");a.useEffect(()=>{const w=window.setTimeout(()=>{q(P.trim())},vt);return()=>window.clearTimeout(w)},[P]),a.useEffect(()=>{k||(R(""),q(""))},[k]);const{data:A=[],isFetching:G,isError:M}=Pe({queryKey:[...y,F],queryFn:()=>o(F),enabled:v&&k}),x=a.useMemo(()=>!e||A.some(w=>w.value===e)?A:(c==null?void 0:c.value)===e?[c,...A]:A,[A,c,e]),E=a.useMemo(()=>{if(!e)return t;const w=x.find(J=>J.value===e)??((c==null?void 0:c.value)===e?c:null);return(w==null?void 0:w.label)??t},[x,t,c,e]);return p.jsxs(qe,{open:k,onOpenChange:I,modal:!0,children:[p.jsx(Ve,{asChild:!0,children:p.jsxs(Ke,{type:"button",variant:"outline",role:"combobox","aria-expanded":k,"aria-label":C,disabled:d,className:D("h-8 w-full justify-between px-2 text-sm font-normal",!e&&"text-muted-foreground",g),children:[p.jsx("span",{className:"truncate",children:E}),p.jsx(Ge,{className:"ml-1 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),p.jsx(Be,{className:"z-[60] w-[var(--radix-popover-trigger-width)] max-h-[var(--radix-popover-content-available-height)] overflow-hidden p-0",align:"start",collisionPadding:8,onWheel:w=>w.stopPropagation(),children:p.jsxs(Se,{shouldFilter:!1,className:"h-full",children:[p.jsx(Ce,{placeholder:m,value:P,onValueChange:R}),p.jsx(Ne,{className:"max-h-[min(300px,calc(var(--radix-popover-content-available-height)-2.75rem))] min-h-0 overscroll-contain",children:G?p.jsxs("div",{className:"flex items-center justify-center py-6 text-sm text-muted-foreground",children:[p.jsx(ze,{className:"mr-2 h-4 w-4 animate-spin"}),"Loading..."]}):M&&i?p.jsx("div",{className:"px-4 py-6 text-center text-sm text-destructive",role:"alert",children:i}):x.length===0?p.jsx(je,{children:u}):p.jsx(Ie,{children:x.map(w=>p.jsxs(Re,{value:w.value,onSelect:()=>{n(w.value,w),I(!1)},children:[p.jsx(Fe,{className:D("mr-2 h-4 w-4",e===w.value?"opacity-100":"opacity-0")}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"truncate",children:w.label}),w.description?p.jsx("div",{className:"truncate text-xs text-muted-foreground",children:w.description}):null]})]},w.value))})})]})})]})}export{kt as S}; diff --git a/assets/share-2-hXe4dX_y.js b/assets/share-2-fiavn5SS.js similarity index 91% rename from assets/share-2-hXe4dX_y.js rename to assets/share-2-fiavn5SS.js index 8e2b539e6a9ee97549caac05dd7261e14145ab33..b138b2f1d8e23ad01c39c92a4fb2c104df3332ba 100644 --- a/assets/share-2-hXe4dX_y.js +++ b/assets/share-2-fiavn5SS.js @@ -1,4 +1,4 @@ -import{n as c}from"./index-CbgxfyGU.js";/** +import{s as c}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/skeleton-HwvdxvSN.js b/assets/skeleton-C3IIzpSL.js similarity index 62% rename from assets/skeleton-HwvdxvSN.js rename to assets/skeleton-C3IIzpSL.js index 255c969d4368f73d28ec335f19e5c90206ae4dbc..03f97af4bb7706616e887cf3da8124cbe9a356a4 100644 --- a/assets/skeleton-HwvdxvSN.js +++ b/assets/skeleton-C3IIzpSL.js @@ -1 +1 @@ -import{j as t,B as n}from"./index-CbgxfyGU.js";function m({className:e,...s}){return t.jsx("div",{className:n("animate-pulse rounded-md bg-muted",e),...s})}export{m as S}; +import{j as t,G as n}from"./index-DyXq7-Tg.js";function m({className:e,...s}){return t.jsx("div",{className:n("animate-pulse rounded-md bg-muted",e),...s})}export{m as S}; diff --git a/assets/sparkles-BqBXJPmy.js b/assets/sparkles-CcIiUzzc.js similarity index 93% rename from assets/sparkles-BqBXJPmy.js rename to assets/sparkles-CcIiUzzc.js index 2b740680f1c0d45eb4c9780fafef2b106f9a8741..4c28f38b101e548dbed5739a2268733bdac7a14f 100644 --- a/assets/sparkles-BqBXJPmy.js +++ b/assets/sparkles-CcIiUzzc.js @@ -1,4 +1,4 @@ -import{n as a}from"./index-CbgxfyGU.js";/** +import{s as a}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/submissions-aWj7YtuZ.js b/assets/submissions-Cz_J-Ha2.js similarity index 99% rename from assets/submissions-aWj7YtuZ.js rename to assets/submissions-Cz_J-Ha2.js index c8b1ef6d7c2b95b8a37769f47c2011de2764b0a0..9fd3751f285a172d5350030f0263fe98d7677bd7 100644 --- a/assets/submissions-aWj7YtuZ.js +++ b/assets/submissions-Cz_J-Ha2.js @@ -1 +1 @@ -import{a6 as Fe}from"./index-CbgxfyGU.js";var v;(function(s){s.assertEqual=a=>{};function e(a){}s.assertIs=e;function t(a){throw new Error}s.assertNever=t,s.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},s.getValidEnumValues=a=>{const n=s.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of n)i[o]=a[o];return s.objectValues(i)},s.objectValues=a=>s.objectKeys(a).map(function(n){return a[n]}),s.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},s.find=(a,n)=>{for(const i of a)if(n(i))return i},s.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}s.joinValues=r,s.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(v||(v={}));var Se;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Se||(Se={}));const u=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=s=>{switch(typeof s){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(s)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(s)?u.array:s===null?u.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?u.promise:typeof Map<"u"&&s instanceof Map?u.map:typeof Set<"u"&&s instanceof Set?u.set:typeof Date<"u"&&s instanceof Date?u.date:u.object;default:return u.unknown}},d=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class I extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(n){return n.message},r={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let o=r,f=0;for(;ft.message){const t={},r=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}I.create=s=>new I(s);const le=(s,e)=>{let t;switch(s.code){case d.invalid_type:s.received===u.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,v.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(s.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(s.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(s.options)}, received '${s.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:v.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case d.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case d.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(s)}return{message:t}};let We=le;function Je(){return We}const Ye=s=>{const{data:e,path:t,errorMaps:r,issueData:a}=s,n=[...t,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let o="";const f=r.filter(p=>!!p).slice().reverse();for(const p of f)o=p(i,{data:e,defaultError:o}).message;return{...a,path:n,message:o}};function c(s,e){const t=Je(),r=Ye({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===le?void 0:le].filter(a=>!!a)});s.common.issues.push(r)}class C{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if(a.status==="aborted")return m;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const a of t){const n=await a.key,i=await a.value;r.push({key:n,value:i})}return C.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return m;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[n.value]=i.value)}return{status:e.value,value:r}}}const m=Object.freeze({status:"aborted"}),J=s=>({status:"dirty",value:s}),O=s=>({status:"valid",value:s}),Ce=s=>s.status==="aborted",Oe=s=>s.status==="dirty",B=s=>s.status==="valid",X=s=>typeof Promise<"u"&&s instanceof Promise;var h;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(h||(h={}));class E{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ne=(s,e)=>{if(B(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new I(s.common.issues);return this._error=t,this._error}}};function g(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:a}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:f}=s;return i.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:f??r??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:f??t??o.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new C,ctx:{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(X(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Ne(r,a)}"~validate"(e){var r,a;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return B(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(a=(r=n==null?void 0:n.message)==null?void 0:r.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>B(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},a=this._parse({data:e,path:r.path,parent:r}),n=await(X(a)?a:Promise.resolve(a));return Ne(r,n)}refine(e,t){const r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{const i=e(a),o=()=>n.addIssue({code:d.custom,...r(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new L({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return j.create(this,this._def)}nullable(){return D.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return ae.create(this,this._def)}or(e){return ee.create([this,e],this._def)}and(e){return te.create(this,e,this._def)}transform(e){return new L({...g(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ne({...g(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new ze({typeName:_.ZodBranded,type:this,...g(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ie({...g(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return be.create(this,e)}readonly(){return oe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const He=/^c[^\s-]{8,}$/i,Ge=/^[0-9a-z]+$/,Qe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ke=/^[a-z0-9_-]{21}$/i,et=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,st=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ue;const at=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,it=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ot=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ct=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$e="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ut=new RegExp(`^${$e}$`);function Pe(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);const t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function lt(s){return new RegExp(`^${Pe(s)}$`)}function ht(s){let e=`${$e}T${Pe(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ft(s,e){return!!((e==="v4"||!e)&&at.test(s)||(e==="v6"||!e)&&it.test(s))}function pt(s,e){if(!et.test(s))return!1;try{const[t]=s.split(".");if(!t)return!1;const r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function mt(s,e){return!!((e==="v4"||!e)&&nt.test(s)||(e==="v6"||!e)&&ot.test(s))}class R extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_type,expected:u.string,received:n.parsedType}),m}const r=new C;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.lengthn.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,o=e.data.lengthe.test(a),{validation:t,code:d.invalid_string,...h.errToObj(r)})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...h.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...h.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...h.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new R({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew R({checks:[],typeName:_.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...g(s)});function _t(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,n=Number.parseInt(s.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}class q extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==u.number){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_type,expected:u.number,received:n.parsedType}),m}let r;const a=new C;for(const n of this._def.checks)n.kind==="int"?v.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:d.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?_t(e.data,n.value)!==0&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_finite,message:n.message}),a.dirty()):v.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,a){return new q({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(a)}]})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.valuenew q({checks:[],typeName:_.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...g(s)});class Y extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==u.bigint)return this._getInvalidInput(e);let r;const a=new C;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):v.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,a){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(a)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Y({checks:[],typeName:_.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...g(s)});class he extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.boolean,received:r.parsedType}),m}return O(e.data)}}he.create=s=>new he({typeName:_.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...g(s)});class K extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_type,expected:u.date,received:n.parsedType}),m}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_date}),m}const r=new C;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:d.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):v.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew K({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:_.ZodDate,...g(s)});class Ae extends y{_parse(e){if(this._getType(e)!==u.symbol){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.symbol,received:r.parsedType}),m}return O(e.data)}}Ae.create=s=>new Ae({typeName:_.ZodSymbol,...g(s)});class fe extends y{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.undefined,received:r.parsedType}),m}return O(e.data)}}fe.create=s=>new fe({typeName:_.ZodUndefined,...g(s)});class pe extends y{_parse(e){if(this._getType(e)!==u.null){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.null,received:r.parsedType}),m}return O(e.data)}}pe.create=s=>new pe({typeName:_.ZodNull,...g(s)});class Ee extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}}Ee.create=s=>new Ee({typeName:_.ZodAny,...g(s)});class me extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}}me.create=s=>new me({typeName:_.ZodUnknown,...g(s)});class P extends y{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.never,received:t.parsedType}),m}}P.create=s=>new P({typeName:_.ZodNever,...g(s)});class Ze extends y{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.void,received:r.parsedType}),m}return O(e.data)}}Ze.create=s=>new Ze({typeName:_.ZodVoid,...g(s)});class N extends y{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==u.array)return c(t,{code:d.invalid_type,expected:u.array,received:t.parsedType}),m;if(a.exactLength!==null){const i=t.data.length>a.exactLength.value,o=t.data.lengtha.maxLength.value&&(c(t,{code:d.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>a.type._parseAsync(new E(t,i,t.path,o)))).then(i=>C.mergeArray(r,i));const n=[...t.data].map((i,o)=>a.type._parseSync(new E(t,i,t.path,o)));return C.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new N({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new N({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new N({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}}N.create=(s,e)=>new N({type:s,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...g(e)});function U(s){if(s instanceof w){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=j.create(U(r))}return new w({...s._def,shape:()=>e})}else return s instanceof N?new N({...s._def,type:U(s.element)}):s instanceof j?j.create(U(s.unwrap())):s instanceof D?D.create(U(s.unwrap())):s instanceof z?z.create(s.items.map(e=>U(e))):s}class w extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const p=this._getOrReturnCtx(e);return c(p,{code:d.invalid_type,expected:u.object,received:p.parsedType}),m}const{status:r,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(const p in a.data)i.includes(p)||o.push(p);const f=[];for(const p of i){const x=n[p],W=a.data[p];f.push({key:{status:"valid",value:p},value:x._parse(new E(a,W,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof P){const p=this._def.unknownKeys;if(p==="passthrough")for(const x of o)f.push({key:{status:"valid",value:x},value:{status:"valid",value:a.data[x]}});else if(p==="strict")o.length>0&&(c(a,{code:d.unrecognized_keys,keys:o}),r.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const x of o){const W=a.data[x];f.push({key:{status:"valid",value:x},value:p._parse(new E(a,W,a.path,x)),alwaysSet:x in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const p=[];for(const x of f){const W=await x.key,qe=await x.value;p.push({key:W,value:qe,alwaysSet:x.alwaysSet})}return p}).then(p=>C.mergeObjectSync(r,p)):C.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new w({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,i;const a=((i=(n=this._def).errorMap)==null?void 0:i.call(n,t,r).message)??r.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new w({...this._def,unknownKeys:"strip"})}passthrough(){return new w({...this._def,unknownKeys:"passthrough"})}extend(e){return new w({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new w({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new w({...this._def,catchall:e})}pick(e){const t={};for(const r of v.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}omit(e){const t={};for(const r of v.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}deepPartial(){return U(this)}partial(e){const t={};for(const r of v.objectKeys(this.shape)){const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new w({...this._def,shape:()=>t})}required(e){const t={};for(const r of v.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof j;)n=n._def.innerType;t[r]=n}return new w({...this._def,shape:()=>t})}keyof(){return Me(v.objectKeys(this.shape))}}w.create=(s,e)=>new w({shape:()=>s,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...g(e)});w.strictCreate=(s,e)=>new w({shape:()=>s,unknownKeys:"strict",catchall:P.create(),typeName:_.ZodObject,...g(e)});w.lazycreate=(s,e)=>new w({shape:s,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...g(e)});class ee extends y{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function a(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=n.map(o=>new I(o.ctx.common.issues));return c(t,{code:d.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(r.map(async n=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const f of r){const p={...t,common:{...t.common,issues:[]},parent:null},x=f._parseSync({data:t.data,path:t.path,parent:p});if(x.status==="valid")return x;x.status==="dirty"&&!n&&(n={result:x,ctx:p}),p.common.issues.length&&i.push(p.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(f=>new I(f));return c(t,{code:d.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}}ee.create=(s,e)=>new ee({options:s,typeName:_.ZodUnion,...g(e)});const Z=s=>s instanceof ge?Z(s.schema):s instanceof L?Z(s.innerType()):s instanceof re?[s.value]:s instanceof V?s.options:s instanceof ye?v.objectValues(s.enum):s instanceof ne?Z(s._def.innerType):s instanceof fe?[void 0]:s instanceof pe?[null]:s instanceof j?[void 0,...Z(s.unwrap())]:s instanceof D?[null,...Z(s.unwrap())]:s instanceof ze||s instanceof oe?Z(s.unwrap()):s instanceof ie?Z(s._def.innerType):[];class ke extends y{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return c(t,{code:d.invalid_type,expected:u.object,received:t.parsedType}),m;const r=this.discriminator,a=t.data[r],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(c(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const a=new Map;for(const n of t){const i=Z(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,n)}}return new ke({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...g(r)})}}function _e(s,e){const t=$(s),r=$(e);if(s===e)return{valid:!0,data:s};if(t===u.object&&r===u.object){const a=v.objectKeys(e),n=v.objectKeys(s).filter(o=>a.indexOf(o)!==-1),i={...s,...e};for(const o of n){const f=_e(s[o],e[o]);if(!f.valid)return{valid:!1};i[o]=f.data}return{valid:!0,data:i}}else if(t===u.array&&r===u.array){if(s.length!==e.length)return{valid:!1};const a=[];for(let n=0;n{if(Ce(n)||Ce(i))return m;const o=_e(n.value,i.value);return o.valid?((Oe(n)||Oe(i))&&t.dirty(),{status:t.value,value:o.data}):(c(r,{code:d.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}te.create=(s,e,t)=>new te({left:s,right:e,typeName:_.ZodIntersection,...g(t)});class z extends y{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.array)return c(r,{code:d.invalid_type,expected:u.array,received:r.parsedType}),m;if(r.data.lengththis._def.items.length&&(c(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map((i,o)=>{const f=this._def.items[o]||this._def.rest;return f?f._parse(new E(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(n).then(i=>C.mergeArray(t,i)):C.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new z({...this._def,rest:e})}}z.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:s,typeName:_.ZodTuple,rest:null,...g(e)})};class se extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.object)return c(r,{code:d.invalid_type,expected:u.object,received:r.parsedType}),m;const a=[],n=this._def.keyType,i=this._def.valueType;for(const o in r.data)a.push({key:n._parse(new E(r,o,r.path,o)),value:i._parse(new E(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?C.mergeObjectAsync(t,a):C.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof y?new se({keyType:e,valueType:t,typeName:_.ZodRecord,...g(r)}):new se({keyType:R.create(),valueType:e,typeName:_.ZodRecord,...g(t)})}}class Re extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.map)return c(r,{code:d.invalid_type,expected:u.map,received:r.parsedType}),m;const a=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([o,f],p)=>({key:a._parse(new E(r,o,r.path,[p,"key"])),value:n._parse(new E(r,f,r.path,[p,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const f of i){const p=await f.key,x=await f.value;if(p.status==="aborted"||x.status==="aborted")return m;(p.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(p.value,x.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const f of i){const p=f.key,x=f.value;if(p.status==="aborted"||x.status==="aborted")return m;(p.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(p.value,x.value)}return{status:t.value,value:o}}}}Re.create=(s,e,t)=>new Re({valueType:e,keyType:s,typeName:_.ZodMap,...g(t)});class H extends y{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.set)return c(r,{code:d.invalid_type,expected:u.set,received:r.parsedType}),m;const a=this._def;a.minSize!==null&&r.data.sizea.maxSize.value&&(c(r,{code:d.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function i(f){const p=new Set;for(const x of f){if(x.status==="aborted")return m;x.status==="dirty"&&t.dirty(),p.add(x.value)}return{status:t.value,value:p}}const o=[...r.data.values()].map((f,p)=>n._parse(new E(r,f,r.path,p)));return r.common.async?Promise.all(o).then(f=>i(f)):i(o)}min(e,t){return new H({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new H({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}H.create=(s,e)=>new H({valueType:s,minSize:null,maxSize:null,typeName:_.ZodSet,...g(e)});class ge extends y{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ge.create=(s,e)=>new ge({getter:s,typeName:_.ZodLazy,...g(e)});class re extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}re.create=(s,e)=>new re({value:s,typeName:_.ZodLiteral,...g(e)});function Me(s,e){return new V({values:s,typeName:_.ZodEnum,...g(e)})}class V extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{expected:v.joinValues(r),received:t.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{received:t.data,code:d.invalid_enum_value,options:r}),m}return O(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return V.create(e,{...this._def,...t})}exclude(e,t=this._def){return V.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}V.create=Me;class ye extends y{_parse(e){const t=v.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==u.string&&r.parsedType!==u.number){const a=v.objectValues(t);return c(r,{expected:v.joinValues(a),received:r.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=v.objectValues(t);return c(r,{received:r.data,code:d.invalid_enum_value,options:a}),m}return O(e.data)}get enum(){return this._def.values}}ye.create=(s,e)=>new ye({values:s,typeName:_.ZodNativeEnum,...g(e)});class ae extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return c(t,{code:d.invalid_type,expected:u.promise,received:t.parsedType}),m;const r=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return O(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ae.create=(s,e)=>new ae({type:s,typeName:_.ZodPromise,...g(e)});class L extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{c(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(r.data,n);if(r.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return m;const f=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return f.status==="aborted"?m:f.status==="dirty"||t.value==="dirty"?J(f.value):f});{if(t.value==="aborted")return m;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?m:o.status==="dirty"||t.value==="dirty"?J(o.value):o}}if(a.type==="refinement"){const i=o=>{const f=a.refinement(o,n);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!B(i))return m;const o=a.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>B(i)?Promise.resolve(a.transform(i.value,n)).then(o=>({status:t.value,value:o})):m);v.assertNever(a)}}L.create=(s,e,t)=>new L({schema:s,typeName:_.ZodEffects,effect:e,...g(t)});L.createWithPreprocess=(s,e,t)=>new L({schema:e,effect:{type:"preprocess",transform:s},typeName:_.ZodEffects,...g(t)});class j extends y{_parse(e){return this._getType(e)===u.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}j.create=(s,e)=>new j({innerType:s,typeName:_.ZodOptional,...g(e)});class D extends y{_parse(e){return this._getType(e)===u.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}D.create=(s,e)=>new D({innerType:s,typeName:_.ZodNullable,...g(e)});class ne extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===u.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ne.create=(s,e)=>new ne({innerType:s,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class ie extends y{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return X(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ie.create=(s,e)=>new ie({innerType:s,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class je extends y{_parse(e){if(this._getType(e)!==u.nan){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.nan,received:r.parsedType}),m}return{status:"valid",value:e.data}}}je.create=s=>new je({typeName:_.ZodNaN,...g(s)});class ze extends y{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class be extends y{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),J(n.value)):this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new be({in:e,out:t,typeName:_.ZodPipeline})}}class oe extends y{_parse(e){const t=this._def.innerType._parse(e),r=a=>(B(a)&&(a.value=Object.freeze(a.value)),a);return X(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}}oe.create=(s,e)=>new oe({innerType:s,typeName:_.ZodReadonly,...g(e)});var _;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(_||(_={}));const l=R.create,b=q.create,de=he.create,gt=me.create;P.create;const T=N.create,k=w.create,Ve=ee.create,Le=ke.create;te.create;z.create;const De=se.create,Q=re.create,ve=V.create;ae.create;j.create;D.create;const A=De(gt()),we=k({id:b(),name:l(),slug:l().optional()}).passthrough(),ce=k({url:l(),is_official:de()}),xe=k({task_id:b(),dataset_id:b(),model_name:l().nullish(),harness:l().nullish(),methodology:l().nullish(),metrics:De(Ve([l(),b()])),uses_additional_data:de().optional(),is_open:de().optional(),best_rank:b().nullish(),best_metric:l().nullish(),evaluated_on:l().nullish(),external_source_url:l().nullish(),num_parameters:b().nullish(),hf_model_url:l().nullish()}).passthrough(),yt=xe.partial().extend({id:b().optional()}),vt=Le("op",[k({op:Q("create"),data:xe}),k({op:Q("update"),evaluation_id:b(),data:xe}),k({op:Q("delete"),evaluation_id:b()})]),Ie=k({hf_models:T(l()),hf_datasets:T(l()),hf_spaces:T(l())}),Te=k({file_name:l(),mime_type:l(),data_url:l().optional(),url:l().optional()}),F=k({name:l(),description:l().optional()}),xt=F.extend({image:Te.optional(),image_credit:l().optional(),parent_id:b().optional(),area_id:b().optional(),keywords:l().optional()}),kt=F.extend({image:Te.optional(),image_credit:l().optional(),source_paper_id:b().optional(),source_url:l().optional(),source_title:l().optional()}),bt=Ve([k({benchmark:l(),task:l(),description:l()}),F.extend({description:l(),task_ids:T(b()),full_name:l().optional(),url:l().optional(),hf_url:l().optional(),paper_url:l().optional(),license_name:l().optional(),license_url:l().optional()})]),wt=F.extend({description:l(),direction:ve(["higher_is_better","lower_is_better"]),full_name:l().optional(),scale:l().optional(),task_id:b(),dataset_id:b()}),Tt=F.extend({short_name:l().optional(),venue:l().optional(),location:l().optional(),url:l(),year:b(),start_date:l().optional(),end_date:l().optional()}),St=F.extend({hf_slug:l().optional(),website_url:l().optional(),image:Te.optional()}),Ct=k({id:b(),paper_id:b().nullable(),hf_username:l(),hf_subject:l().nullish(),is_author:de(),status:ve(["pending","approved","rejected"]),applied_payload:A.nullish(),conflict_payload:A.nullish(),result_entity_type:l().nullish(),result_entity_id:l().nullish(),admin_note:l().nullish(),user_review_reason:l().nullish(),reviewed_by:l().nullish(),reviewed_by_kind:ve(["human","codex","auto"]).nullish(),catalog_event_id:l().nullish(),review_evidence:A.nullish(),created_at:l(),updated_at:l(),reviewed_at:l().nullish()});function S(s,e,t){return Ct.extend({edit_type:Q(s),proposed_payload:e,current_payload:t.nullish()})}const Ot=S("tasks",k({task_ids:T(b())}),k({tasks:T(we)})),Nt=S("methods",k({method_ids:T(b())}),k({methods:T(we)})),At=S("evaluations",k({operations:T(vt)}),k({evaluations:T(yt)})),Et=S("repositories",k({repositories:T(ce)}),k({repositories:T(ce)})),Zt=S("project_pages",k({project_pages:T(ce)}),k({project_pages:T(ce)})),Rt=S("source_url",k({source_url:l()}),k({source_url:l().nullish()})),jt=S("hf_artifacts",Ie,Ie),It=S("x_threads",k({x_threads:T(l())}),k({x_threads:T(k({url:l()}))})),$t=S("organizations",k({organization_ids:T(b())}),k({organizations:T(we)})),Pt=S("new_task",xt,A),Mt=S("new_method",kt,A),zt=S("new_benchmark",bt,A),Vt=S("new_metric",wt,A),Lt=S("new_conference",Tt,A),Dt=S("new_organization",St,A),Ut=S("new_external_paper",k({title:l().optional(),source_url:l(),authors:T(l()),date_published:l().optional(),abstract:l().optional()}),A),Ue=Le("edit_type",[Ot,Nt,At,Et,Zt,Rt,jt,It,$t,Pt,Mt,zt,Vt,Lt,Dt,Ut]);function Yt(s,e,t){return{paper_id:s,edit_type:e,proposed_payload:t}}const M=(s,e)=>({directory:{title:s,subtitle:e}}),Ht={tasks:{label:"tasks",administrative:!1},methods:{label:"methods",administrative:!1},evaluations:{label:"evaluations",administrative:!1},repositories:{label:"repositories",administrative:!1},project_pages:{label:"project pages",administrative:!1},source_url:{label:"source url",administrative:!1},x_threads:{label:"x threads",administrative:!1},hf_artifacts:{label:"hf artifacts",administrative:!1},organizations:{label:"organizations",administrative:!1},new_task:{label:"new task",administrative:!0,...M("New task","Task suggestion")},new_method:{label:"new method",administrative:!0,...M("New method","Method suggestion")},new_benchmark:{label:"new benchmark",administrative:!0,...M("New benchmark","Benchmark suggestion")},new_metric:{label:"new metric",administrative:!0,...M("New metric","Metric suggestion")},new_conference:{label:"new conference",administrative:!0,...M("New conference","Conference suggestion")},new_organization:{label:"new organization",administrative:!1,...M("New organization","Organization suggestion")},new_external_paper:{label:"external paper",administrative:!1,...M("External paper","External paper submission")}},Bt=k({count:b(),results:T(Ue)});class qt extends Error{constructor(e){super(`Malformed pending-edit payload: ${e}`),this.name="PendingEditPayloadError"}}function Be(s,e){const t=s.safeParse(e);if(t.success)return t.data;const r=t.error.issues[0];throw new qt(`${(r==null?void 0:r.path.join("."))||"response"}: ${(r==null?void 0:r.message)||"invalid value"}`)}const G=s=>Be(Ue,s),Ft=s=>Be(Bt,s);class Wt{constructor(e){this.request=e}async submit(e){return G(await this.request("/me/paper-edits",{method:"POST",body:JSON.stringify(e)}))}list(e){const t=new URLSearchParams;for(const[a,n]of Object.entries(e??{}))n!==void 0&&t.set(a,String(n));const r=t.toString();return this.request(`/admin/paper-edits${r?`?${r}`:""}`).then(Ft)}revertAutoApproved(e,t={}){return this.request(`/admin/submitters/${encodeURIComponent(e)}/revert-auto-approved`,{method:"POST",body:JSON.stringify(t)})}async get(e){return G(await this.request(`/admin/paper-edits/${e}`))}async approve(e,t={}){return G(await this.request(`/admin/paper-edits/${e}/approve`,{method:"POST",body:JSON.stringify(t)}))}async reject(e,t={}){return G(await this.request(`/admin/paper-edits/${e}/reject`,{method:"POST",body:JSON.stringify(t)}))}}const Gt=new Wt(Fe);export{Ht as E,Yt as p,Gt as s}; +import{ac as Fe}from"./index-DyXq7-Tg.js";var v;(function(s){s.assertEqual=a=>{};function e(a){}s.assertIs=e;function t(a){throw new Error}s.assertNever=t,s.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},s.getValidEnumValues=a=>{const n=s.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of n)i[o]=a[o];return s.objectValues(i)},s.objectValues=a=>s.objectKeys(a).map(function(n){return a[n]}),s.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},s.find=(a,n)=>{for(const i of a)if(n(i))return i},s.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}s.joinValues=r,s.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(v||(v={}));var Se;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Se||(Se={}));const u=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=s=>{switch(typeof s){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(s)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(s)?u.array:s===null?u.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?u.promise:typeof Map<"u"&&s instanceof Map?u.map:typeof Set<"u"&&s instanceof Set?u.set:typeof Date<"u"&&s instanceof Date?u.date:u.object;default:return u.unknown}},d=v.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class I extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(n){return n.message},r={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let o=r,f=0;for(;ft.message){const t={},r=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}I.create=s=>new I(s);const le=(s,e)=>{let t;switch(s.code){case d.invalid_type:s.received===u.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,v.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(s.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(s.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(s.options)}, received '${s.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:v.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case d.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case d.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(s)}return{message:t}};let We=le;function Je(){return We}const Ye=s=>{const{data:e,path:t,errorMaps:r,issueData:a}=s,n=[...t,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let o="";const f=r.filter(p=>!!p).slice().reverse();for(const p of f)o=p(i,{data:e,defaultError:o}).message;return{...a,path:n,message:o}};function c(s,e){const t=Je(),r=Ye({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===le?void 0:le].filter(a=>!!a)});s.common.issues.push(r)}class C{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if(a.status==="aborted")return m;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const a of t){const n=await a.key,i=await a.value;r.push({key:n,value:i})}return C.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return m;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[n.value]=i.value)}return{status:e.value,value:r}}}const m=Object.freeze({status:"aborted"}),J=s=>({status:"dirty",value:s}),O=s=>({status:"valid",value:s}),Ce=s=>s.status==="aborted",Oe=s=>s.status==="dirty",B=s=>s.status==="valid",X=s=>typeof Promise<"u"&&s instanceof Promise;var h;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(h||(h={}));class E{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ne=(s,e)=>{if(B(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new I(s.common.issues);return this._error=t,this._error}}};function g(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:a}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:f}=s;return i.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:f??r??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:f??t??o.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new C,ctx:{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(X(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Ne(r,a)}"~validate"(e){var r,a;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return B(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(a=(r=n==null?void 0:n.message)==null?void 0:r.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>B(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},a=this._parse({data:e,path:r.path,parent:r}),n=await(X(a)?a:Promise.resolve(a));return Ne(r,n)}refine(e,t){const r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{const i=e(a),o=()=>n.addIssue({code:d.custom,...r(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new L({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return j.create(this,this._def)}nullable(){return D.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return ae.create(this,this._def)}or(e){return ee.create([this,e],this._def)}and(e){return te.create(this,e,this._def)}transform(e){return new L({...g(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ne({...g(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new ze({typeName:_.ZodBranded,type:this,...g(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ie({...g(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return be.create(this,e)}readonly(){return oe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const He=/^c[^\s-]{8,}$/i,Ge=/^[0-9a-z]+$/,Qe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ke=/^[a-z0-9_-]{21}$/i,et=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,st=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ue;const at=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,nt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,it=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ot=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ct=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$e="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ut=new RegExp(`^${$e}$`);function Pe(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);const t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function lt(s){return new RegExp(`^${Pe(s)}$`)}function ht(s){let e=`${$e}T${Pe(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ft(s,e){return!!((e==="v4"||!e)&&at.test(s)||(e==="v6"||!e)&&it.test(s))}function pt(s,e){if(!et.test(s))return!1;try{const[t]=s.split(".");if(!t)return!1;const r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function mt(s,e){return!!((e==="v4"||!e)&&nt.test(s)||(e==="v6"||!e)&&ot.test(s))}class R extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_type,expected:u.string,received:n.parsedType}),m}const r=new C;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.lengthn.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,o=e.data.lengthe.test(a),{validation:t,code:d.invalid_string,...h.errToObj(r)})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...h.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...h.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...h.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new R({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew R({checks:[],typeName:_.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...g(s)});function _t(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,n=Number.parseInt(s.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}class q extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==u.number){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_type,expected:u.number,received:n.parsedType}),m}let r;const a=new C;for(const n of this._def.checks)n.kind==="int"?v.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:d.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?_t(e.data,n.value)!==0&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_finite,message:n.message}),a.dirty()):v.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,a){return new q({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(a)}]})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.valuenew q({checks:[],typeName:_.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...g(s)});class Y extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==u.bigint)return this._getInvalidInput(e);let r;const a=new C;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),c(r,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):v.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,a){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(a)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Y({checks:[],typeName:_.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...g(s)});class he extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.boolean,received:r.parsedType}),m}return O(e.data)}}he.create=s=>new he({typeName:_.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...g(s)});class K extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_type,expected:u.date,received:n.parsedType}),m}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return c(n,{code:d.invalid_date}),m}const r=new C;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:d.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):v.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew K({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:_.ZodDate,...g(s)});class Ae extends y{_parse(e){if(this._getType(e)!==u.symbol){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.symbol,received:r.parsedType}),m}return O(e.data)}}Ae.create=s=>new Ae({typeName:_.ZodSymbol,...g(s)});class fe extends y{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.undefined,received:r.parsedType}),m}return O(e.data)}}fe.create=s=>new fe({typeName:_.ZodUndefined,...g(s)});class pe extends y{_parse(e){if(this._getType(e)!==u.null){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.null,received:r.parsedType}),m}return O(e.data)}}pe.create=s=>new pe({typeName:_.ZodNull,...g(s)});class Ee extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}}Ee.create=s=>new Ee({typeName:_.ZodAny,...g(s)});class me extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}}me.create=s=>new me({typeName:_.ZodUnknown,...g(s)});class P extends y{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.never,received:t.parsedType}),m}}P.create=s=>new P({typeName:_.ZodNever,...g(s)});class Ze extends y{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.void,received:r.parsedType}),m}return O(e.data)}}Ze.create=s=>new Ze({typeName:_.ZodVoid,...g(s)});class N extends y{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==u.array)return c(t,{code:d.invalid_type,expected:u.array,received:t.parsedType}),m;if(a.exactLength!==null){const i=t.data.length>a.exactLength.value,o=t.data.lengtha.maxLength.value&&(c(t,{code:d.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>a.type._parseAsync(new E(t,i,t.path,o)))).then(i=>C.mergeArray(r,i));const n=[...t.data].map((i,o)=>a.type._parseSync(new E(t,i,t.path,o)));return C.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new N({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new N({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new N({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}}N.create=(s,e)=>new N({type:s,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...g(e)});function U(s){if(s instanceof w){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=j.create(U(r))}return new w({...s._def,shape:()=>e})}else return s instanceof N?new N({...s._def,type:U(s.element)}):s instanceof j?j.create(U(s.unwrap())):s instanceof D?D.create(U(s.unwrap())):s instanceof z?z.create(s.items.map(e=>U(e))):s}class w extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const p=this._getOrReturnCtx(e);return c(p,{code:d.invalid_type,expected:u.object,received:p.parsedType}),m}const{status:r,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(const p in a.data)i.includes(p)||o.push(p);const f=[];for(const p of i){const x=n[p],W=a.data[p];f.push({key:{status:"valid",value:p},value:x._parse(new E(a,W,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof P){const p=this._def.unknownKeys;if(p==="passthrough")for(const x of o)f.push({key:{status:"valid",value:x},value:{status:"valid",value:a.data[x]}});else if(p==="strict")o.length>0&&(c(a,{code:d.unrecognized_keys,keys:o}),r.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const x of o){const W=a.data[x];f.push({key:{status:"valid",value:x},value:p._parse(new E(a,W,a.path,x)),alwaysSet:x in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const p=[];for(const x of f){const W=await x.key,qe=await x.value;p.push({key:W,value:qe,alwaysSet:x.alwaysSet})}return p}).then(p=>C.mergeObjectSync(r,p)):C.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new w({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,i;const a=((i=(n=this._def).errorMap)==null?void 0:i.call(n,t,r).message)??r.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new w({...this._def,unknownKeys:"strip"})}passthrough(){return new w({...this._def,unknownKeys:"passthrough"})}extend(e){return new w({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new w({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new w({...this._def,catchall:e})}pick(e){const t={};for(const r of v.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}omit(e){const t={};for(const r of v.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}deepPartial(){return U(this)}partial(e){const t={};for(const r of v.objectKeys(this.shape)){const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new w({...this._def,shape:()=>t})}required(e){const t={};for(const r of v.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof j;)n=n._def.innerType;t[r]=n}return new w({...this._def,shape:()=>t})}keyof(){return Me(v.objectKeys(this.shape))}}w.create=(s,e)=>new w({shape:()=>s,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...g(e)});w.strictCreate=(s,e)=>new w({shape:()=>s,unknownKeys:"strict",catchall:P.create(),typeName:_.ZodObject,...g(e)});w.lazycreate=(s,e)=>new w({shape:s,unknownKeys:"strip",catchall:P.create(),typeName:_.ZodObject,...g(e)});class ee extends y{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function a(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=n.map(o=>new I(o.ctx.common.issues));return c(t,{code:d.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(r.map(async n=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const f of r){const p={...t,common:{...t.common,issues:[]},parent:null},x=f._parseSync({data:t.data,path:t.path,parent:p});if(x.status==="valid")return x;x.status==="dirty"&&!n&&(n={result:x,ctx:p}),p.common.issues.length&&i.push(p.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(f=>new I(f));return c(t,{code:d.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}}ee.create=(s,e)=>new ee({options:s,typeName:_.ZodUnion,...g(e)});const Z=s=>s instanceof ge?Z(s.schema):s instanceof L?Z(s.innerType()):s instanceof re?[s.value]:s instanceof V?s.options:s instanceof ye?v.objectValues(s.enum):s instanceof ne?Z(s._def.innerType):s instanceof fe?[void 0]:s instanceof pe?[null]:s instanceof j?[void 0,...Z(s.unwrap())]:s instanceof D?[null,...Z(s.unwrap())]:s instanceof ze||s instanceof oe?Z(s.unwrap()):s instanceof ie?Z(s._def.innerType):[];class ke extends y{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return c(t,{code:d.invalid_type,expected:u.object,received:t.parsedType}),m;const r=this.discriminator,a=t.data[r],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(c(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const a=new Map;for(const n of t){const i=Z(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,n)}}return new ke({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...g(r)})}}function _e(s,e){const t=$(s),r=$(e);if(s===e)return{valid:!0,data:s};if(t===u.object&&r===u.object){const a=v.objectKeys(e),n=v.objectKeys(s).filter(o=>a.indexOf(o)!==-1),i={...s,...e};for(const o of n){const f=_e(s[o],e[o]);if(!f.valid)return{valid:!1};i[o]=f.data}return{valid:!0,data:i}}else if(t===u.array&&r===u.array){if(s.length!==e.length)return{valid:!1};const a=[];for(let n=0;n{if(Ce(n)||Ce(i))return m;const o=_e(n.value,i.value);return o.valid?((Oe(n)||Oe(i))&&t.dirty(),{status:t.value,value:o.data}):(c(r,{code:d.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}te.create=(s,e,t)=>new te({left:s,right:e,typeName:_.ZodIntersection,...g(t)});class z extends y{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.array)return c(r,{code:d.invalid_type,expected:u.array,received:r.parsedType}),m;if(r.data.lengththis._def.items.length&&(c(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map((i,o)=>{const f=this._def.items[o]||this._def.rest;return f?f._parse(new E(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(n).then(i=>C.mergeArray(t,i)):C.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new z({...this._def,rest:e})}}z.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:s,typeName:_.ZodTuple,rest:null,...g(e)})};class se extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.object)return c(r,{code:d.invalid_type,expected:u.object,received:r.parsedType}),m;const a=[],n=this._def.keyType,i=this._def.valueType;for(const o in r.data)a.push({key:n._parse(new E(r,o,r.path,o)),value:i._parse(new E(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?C.mergeObjectAsync(t,a):C.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof y?new se({keyType:e,valueType:t,typeName:_.ZodRecord,...g(r)}):new se({keyType:R.create(),valueType:e,typeName:_.ZodRecord,...g(t)})}}class Re extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.map)return c(r,{code:d.invalid_type,expected:u.map,received:r.parsedType}),m;const a=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([o,f],p)=>({key:a._parse(new E(r,o,r.path,[p,"key"])),value:n._parse(new E(r,f,r.path,[p,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const f of i){const p=await f.key,x=await f.value;if(p.status==="aborted"||x.status==="aborted")return m;(p.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(p.value,x.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const f of i){const p=f.key,x=f.value;if(p.status==="aborted"||x.status==="aborted")return m;(p.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(p.value,x.value)}return{status:t.value,value:o}}}}Re.create=(s,e,t)=>new Re({valueType:e,keyType:s,typeName:_.ZodMap,...g(t)});class H extends y{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.set)return c(r,{code:d.invalid_type,expected:u.set,received:r.parsedType}),m;const a=this._def;a.minSize!==null&&r.data.sizea.maxSize.value&&(c(r,{code:d.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function i(f){const p=new Set;for(const x of f){if(x.status==="aborted")return m;x.status==="dirty"&&t.dirty(),p.add(x.value)}return{status:t.value,value:p}}const o=[...r.data.values()].map((f,p)=>n._parse(new E(r,f,r.path,p)));return r.common.async?Promise.all(o).then(f=>i(f)):i(o)}min(e,t){return new H({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new H({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}H.create=(s,e)=>new H({valueType:s,minSize:null,maxSize:null,typeName:_.ZodSet,...g(e)});class ge extends y{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ge.create=(s,e)=>new ge({getter:s,typeName:_.ZodLazy,...g(e)});class re extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}re.create=(s,e)=>new re({value:s,typeName:_.ZodLiteral,...g(e)});function Me(s,e){return new V({values:s,typeName:_.ZodEnum,...g(e)})}class V extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{expected:v.joinValues(r),received:t.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{received:t.data,code:d.invalid_enum_value,options:r}),m}return O(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return V.create(e,{...this._def,...t})}exclude(e,t=this._def){return V.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}V.create=Me;class ye extends y{_parse(e){const t=v.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==u.string&&r.parsedType!==u.number){const a=v.objectValues(t);return c(r,{expected:v.joinValues(a),received:r.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=v.objectValues(t);return c(r,{received:r.data,code:d.invalid_enum_value,options:a}),m}return O(e.data)}get enum(){return this._def.values}}ye.create=(s,e)=>new ye({values:s,typeName:_.ZodNativeEnum,...g(e)});class ae extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return c(t,{code:d.invalid_type,expected:u.promise,received:t.parsedType}),m;const r=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return O(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ae.create=(s,e)=>new ae({type:s,typeName:_.ZodPromise,...g(e)});class L extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{c(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(r.data,n);if(r.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return m;const f=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return f.status==="aborted"?m:f.status==="dirty"||t.value==="dirty"?J(f.value):f});{if(t.value==="aborted")return m;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?m:o.status==="dirty"||t.value==="dirty"?J(o.value):o}}if(a.type==="refinement"){const i=o=>{const f=a.refinement(o,n);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!B(i))return m;const o=a.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>B(i)?Promise.resolve(a.transform(i.value,n)).then(o=>({status:t.value,value:o})):m);v.assertNever(a)}}L.create=(s,e,t)=>new L({schema:s,typeName:_.ZodEffects,effect:e,...g(t)});L.createWithPreprocess=(s,e,t)=>new L({schema:e,effect:{type:"preprocess",transform:s},typeName:_.ZodEffects,...g(t)});class j extends y{_parse(e){return this._getType(e)===u.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}j.create=(s,e)=>new j({innerType:s,typeName:_.ZodOptional,...g(e)});class D extends y{_parse(e){return this._getType(e)===u.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}D.create=(s,e)=>new D({innerType:s,typeName:_.ZodNullable,...g(e)});class ne extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===u.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ne.create=(s,e)=>new ne({innerType:s,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class ie extends y{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return X(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new I(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ie.create=(s,e)=>new ie({innerType:s,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class je extends y{_parse(e){if(this._getType(e)!==u.nan){const r=this._getOrReturnCtx(e);return c(r,{code:d.invalid_type,expected:u.nan,received:r.parsedType}),m}return{status:"valid",value:e.data}}}je.create=s=>new je({typeName:_.ZodNaN,...g(s)});class ze extends y{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class be extends y{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),J(n.value)):this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new be({in:e,out:t,typeName:_.ZodPipeline})}}class oe extends y{_parse(e){const t=this._def.innerType._parse(e),r=a=>(B(a)&&(a.value=Object.freeze(a.value)),a);return X(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}}oe.create=(s,e)=>new oe({innerType:s,typeName:_.ZodReadonly,...g(e)});var _;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(_||(_={}));const l=R.create,b=q.create,de=he.create,gt=me.create;P.create;const T=N.create,k=w.create,Ve=ee.create,Le=ke.create;te.create;z.create;const De=se.create,Q=re.create,ve=V.create;ae.create;j.create;D.create;const A=De(gt()),we=k({id:b(),name:l(),slug:l().optional()}).passthrough(),ce=k({url:l(),is_official:de()}),xe=k({task_id:b(),dataset_id:b(),model_name:l().nullish(),harness:l().nullish(),methodology:l().nullish(),metrics:De(Ve([l(),b()])),uses_additional_data:de().optional(),is_open:de().optional(),best_rank:b().nullish(),best_metric:l().nullish(),evaluated_on:l().nullish(),external_source_url:l().nullish(),num_parameters:b().nullish(),hf_model_url:l().nullish()}).passthrough(),yt=xe.partial().extend({id:b().optional()}),vt=Le("op",[k({op:Q("create"),data:xe}),k({op:Q("update"),evaluation_id:b(),data:xe}),k({op:Q("delete"),evaluation_id:b()})]),Ie=k({hf_models:T(l()),hf_datasets:T(l()),hf_spaces:T(l())}),Te=k({file_name:l(),mime_type:l(),data_url:l().optional(),url:l().optional()}),F=k({name:l(),description:l().optional()}),xt=F.extend({image:Te.optional(),image_credit:l().optional(),parent_id:b().optional(),area_id:b().optional(),keywords:l().optional()}),kt=F.extend({image:Te.optional(),image_credit:l().optional(),source_paper_id:b().optional(),source_url:l().optional(),source_title:l().optional()}),bt=Ve([k({benchmark:l(),task:l(),description:l()}),F.extend({description:l(),task_ids:T(b()),full_name:l().optional(),url:l().optional(),hf_url:l().optional(),paper_url:l().optional(),license_name:l().optional(),license_url:l().optional()})]),wt=F.extend({description:l(),direction:ve(["higher_is_better","lower_is_better"]),full_name:l().optional(),scale:l().optional(),task_id:b(),dataset_id:b()}),Tt=F.extend({short_name:l().optional(),venue:l().optional(),location:l().optional(),url:l(),year:b(),start_date:l().optional(),end_date:l().optional()}),St=F.extend({hf_slug:l().optional(),website_url:l().optional(),image:Te.optional()}),Ct=k({id:b(),paper_id:b().nullable(),hf_username:l(),hf_subject:l().nullish(),is_author:de(),status:ve(["pending","approved","rejected"]),applied_payload:A.nullish(),conflict_payload:A.nullish(),result_entity_type:l().nullish(),result_entity_id:l().nullish(),admin_note:l().nullish(),user_review_reason:l().nullish(),reviewed_by:l().nullish(),reviewed_by_kind:ve(["human","codex","auto"]).nullish(),catalog_event_id:l().nullish(),review_evidence:A.nullish(),created_at:l(),updated_at:l(),reviewed_at:l().nullish()});function S(s,e,t){return Ct.extend({edit_type:Q(s),proposed_payload:e,current_payload:t.nullish()})}const Ot=S("tasks",k({task_ids:T(b())}),k({tasks:T(we)})),Nt=S("methods",k({method_ids:T(b())}),k({methods:T(we)})),At=S("evaluations",k({operations:T(vt)}),k({evaluations:T(yt)})),Et=S("repositories",k({repositories:T(ce)}),k({repositories:T(ce)})),Zt=S("project_pages",k({project_pages:T(ce)}),k({project_pages:T(ce)})),Rt=S("source_url",k({source_url:l()}),k({source_url:l().nullish()})),jt=S("hf_artifacts",Ie,Ie),It=S("x_threads",k({x_threads:T(l())}),k({x_threads:T(k({url:l()}))})),$t=S("organizations",k({organization_ids:T(b())}),k({organizations:T(we)})),Pt=S("new_task",xt,A),Mt=S("new_method",kt,A),zt=S("new_benchmark",bt,A),Vt=S("new_metric",wt,A),Lt=S("new_conference",Tt,A),Dt=S("new_organization",St,A),Ut=S("new_external_paper",k({title:l().optional(),source_url:l(),authors:T(l()),date_published:l().optional(),abstract:l().optional()}),A),Ue=Le("edit_type",[Ot,Nt,At,Et,Zt,Rt,jt,It,$t,Pt,Mt,zt,Vt,Lt,Dt,Ut]);function Yt(s,e,t){return{paper_id:s,edit_type:e,proposed_payload:t}}const M=(s,e)=>({directory:{title:s,subtitle:e}}),Ht={tasks:{label:"tasks",administrative:!1},methods:{label:"methods",administrative:!1},evaluations:{label:"evaluations",administrative:!1},repositories:{label:"repositories",administrative:!1},project_pages:{label:"project pages",administrative:!1},source_url:{label:"source url",administrative:!1},x_threads:{label:"x threads",administrative:!1},hf_artifacts:{label:"hf artifacts",administrative:!1},organizations:{label:"organizations",administrative:!1},new_task:{label:"new task",administrative:!0,...M("New task","Task suggestion")},new_method:{label:"new method",administrative:!0,...M("New method","Method suggestion")},new_benchmark:{label:"new benchmark",administrative:!0,...M("New benchmark","Benchmark suggestion")},new_metric:{label:"new metric",administrative:!0,...M("New metric","Metric suggestion")},new_conference:{label:"new conference",administrative:!0,...M("New conference","Conference suggestion")},new_organization:{label:"new organization",administrative:!1,...M("New organization","Organization suggestion")},new_external_paper:{label:"external paper",administrative:!1,...M("External paper","External paper submission")}},Bt=k({count:b(),results:T(Ue)});class qt extends Error{constructor(e){super(`Malformed pending-edit payload: ${e}`),this.name="PendingEditPayloadError"}}function Be(s,e){const t=s.safeParse(e);if(t.success)return t.data;const r=t.error.issues[0];throw new qt(`${(r==null?void 0:r.path.join("."))||"response"}: ${(r==null?void 0:r.message)||"invalid value"}`)}const G=s=>Be(Ue,s),Ft=s=>Be(Bt,s);class Wt{constructor(e){this.request=e}async submit(e){return G(await this.request("/me/paper-edits",{method:"POST",body:JSON.stringify(e)}))}list(e){const t=new URLSearchParams;for(const[a,n]of Object.entries(e??{}))n!==void 0&&t.set(a,String(n));const r=t.toString();return this.request(`/admin/paper-edits${r?`?${r}`:""}`).then(Ft)}revertAutoApproved(e,t={}){return this.request(`/admin/submitters/${encodeURIComponent(e)}/revert-auto-approved`,{method:"POST",body:JSON.stringify(t)})}async get(e){return G(await this.request(`/admin/paper-edits/${e}`))}async approve(e,t={}){return G(await this.request(`/admin/paper-edits/${e}/approve`,{method:"POST",body:JSON.stringify(t)}))}async reject(e,t={}){return G(await this.request(`/admin/paper-edits/${e}/reject`,{method:"POST",body:JSON.stringify(t)}))}}const Gt=new Wt(Fe);export{Ht as E,Yt as p,Gt as s}; diff --git a/assets/switch-BSZohE4x.js b/assets/switch-nfvTohnt.js similarity index 59% rename from assets/switch-BSZohE4x.js rename to assets/switch-nfvTohnt.js index 457e7acc0dead560989b7702957c2d38a0561224..9cc6be49e7d1858b1a0d9e9509c1ace763e1988c 100644 --- a/assets/switch-BSZohE4x.js +++ b/assets/switch-nfvTohnt.js @@ -1 +1 @@ -import{r as s,x as C,w as I,j as a,v as y,y as M,z as A,A as H,B as g}from"./index-CbgxfyGU.js";import{u as z}from"./index-CxPKwmVQ.js";var b="Switch",[U]=H(b),[q,L]=U(b),P=s.forwardRef((t,o)=>{const{__scopeSwitch:e,name:n,checked:r,defaultChecked:m,required:d,disabled:c,value:u="on",onCheckedChange:v,form:i,...w}=t,[l,p]=s.useState(null),S=C(o,h=>p(h)),k=s.useRef(!1),x=l?i||!!l.closest("form"):!0,[f,B]=I({prop:r,defaultProp:m??!1,onChange:v,caller:b});return a.jsxs(q,{scope:e,checked:f,disabled:c,children:[a.jsx(y.button,{type:"button",role:"switch","aria-checked":f,"aria-required":d,"data-state":j(f),"data-disabled":c?"":void 0,disabled:c,value:u,...w,ref:S,onClick:M(t.onClick,h=>{B(T=>!T),x&&(k.current=h.isPropagationStopped(),k.current||h.stopPropagation())})}),x&&a.jsx(N,{control:l,bubbles:!k.current,name:n,value:u,checked:f,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=b;var E="SwitchThumb",R=s.forwardRef((t,o)=>{const{__scopeSwitch:e,...n}=t,r=L(E,e);return a.jsx(y.span,{"data-state":j(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:o})});R.displayName=E;var O="SwitchBubbleInput",N=s.forwardRef(({__scopeSwitch:t,control:o,checked:e,bubbles:n=!0,...r},m)=>{const d=s.useRef(null),c=C(d,m),u=z(e),v=A(o);return s.useEffect(()=>{const i=d.current;if(!i)return;const w=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(w,"checked").set;if(u!==e&&p){const S=new Event("click",{bubbles:n});p.call(i,e),i.dispatchEvent(S)}},[u,e,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:e,...r,tabIndex:-1,ref:c,style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});N.displayName=O;function j(t){return t?"checked":"unchecked"}var _=P,D=R;const F=s.forwardRef(({className:t,...o},e)=>a.jsx(_,{className:g("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...o,ref:e,children:a.jsx(D,{className:g("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));F.displayName=_.displayName;export{F as S}; +import{d as s,B as C,A as I,j as a,z as y,D as M,E as A,F as H,G as x}from"./index-DyXq7-Tg.js";import{u as z}from"./index-C041TDos.js";var b="Switch",[U]=H(b),[q,D]=U(b),E=s.forwardRef((t,o)=>{const{__scopeSwitch:e,name:n,checked:r,defaultChecked:m,required:d,disabled:c,value:u="on",onCheckedChange:v,form:i,...w}=t,[l,p]=s.useState(null),S=C(o,h=>p(h)),k=s.useRef(!1),g=l?i||!!l.closest("form"):!0,[f,B]=I({prop:r,defaultProp:m??!1,onChange:v,caller:b});return a.jsxs(q,{scope:e,checked:f,disabled:c,children:[a.jsx(y.button,{type:"button",role:"switch","aria-checked":f,"aria-required":d,"data-state":j(f),"data-disabled":c?"":void 0,disabled:c,value:u,...w,ref:S,onClick:M(t.onClick,h=>{B(T=>!T),g&&(k.current=h.isPropagationStopped(),k.current||h.stopPropagation())})}),g&&a.jsx(N,{control:l,bubbles:!k.current,name:n,value:u,checked:f,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});E.displayName=b;var P="SwitchThumb",R=s.forwardRef((t,o)=>{const{__scopeSwitch:e,...n}=t,r=D(P,e);return a.jsx(y.span,{"data-state":j(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:o})});R.displayName=P;var F="SwitchBubbleInput",N=s.forwardRef(({__scopeSwitch:t,control:o,checked:e,bubbles:n=!0,...r},m)=>{const d=s.useRef(null),c=C(d,m),u=z(e),v=A(o);return s.useEffect(()=>{const i=d.current;if(!i)return;const w=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(w,"checked").set;if(u!==e&&p){const S=new Event("click",{bubbles:n});p.call(i,e),i.dispatchEvent(S)}},[u,e,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:e,...r,tabIndex:-1,ref:c,style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});N.displayName=F;function j(t){return t?"checked":"unchecked"}var _=E,L=R;const O=s.forwardRef(({className:t,...o},e)=>a.jsx(_,{className:x("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...o,ref:e,children:a.jsx(L,{className:x("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));O.displayName=_.displayName;export{O as S}; diff --git a/assets/textarea-Bf06GTSH.js b/assets/textarea-DPixlM5U.js similarity index 86% rename from assets/textarea-Bf06GTSH.js rename to assets/textarea-DPixlM5U.js index e458b733674ecc84cb91df31be71e2179c1aa3e1..d475e4d9c506bc079e67f41d5e158c220724d6de 100644 --- a/assets/textarea-Bf06GTSH.js +++ b/assets/textarea-DPixlM5U.js @@ -1 +1 @@ -import{r as s,j as a,B as t}from"./index-CbgxfyGU.js";const i=s.forwardRef(({className:e,...r},o)=>a.jsx("textarea",{className:t("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...r}));i.displayName="Textarea";export{i as T}; +import{d as s,j as a,G as t}from"./index-DyXq7-Tg.js";const i=s.forwardRef(({className:e,...r},o)=>a.jsx("textarea",{className:t("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...r}));i.displayName="Textarea";export{i as T}; diff --git a/assets/thumbs-up-CDCzGuPd.js b/assets/thumbs-up-CPLlGli7.js similarity index 90% rename from assets/thumbs-up-CDCzGuPd.js rename to assets/thumbs-up-CPLlGli7.js index 7fdce474174556af2311f49039504f44eb6d63da..d9c459379530cc6a6fb93c3001b884260871443f 100644 --- a/assets/thumbs-up-CDCzGuPd.js +++ b/assets/thumbs-up-CPLlGli7.js @@ -1,4 +1,4 @@ -import{n as a}from"./index-CbgxfyGU.js";/** +import{s as a}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/transform-0Udg2p6b.js b/assets/transform-0Udg2p6b.js deleted file mode 100644 index 7147e8f49dc0afd19430a84e417d5434095eef91..0000000000000000000000000000000000000000 --- a/assets/transform-0Udg2p6b.js +++ /dev/null @@ -1 +0,0 @@ -import{Z as _}from"./index-CbgxfyGU.js";function w(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function D(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const A=6048e5,z=864e5,I=6e4,R=36e5;let V={};function W(){return V}function v(t,e){var s,u,d,f;const n=W(),r=(e==null?void 0:e.weekStartsOn)??((u=(s=e==null?void 0:e.locale)==null?void 0:s.options)==null?void 0:u.weekStartsOn)??n.weekStartsOn??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.weekStartsOn)??0,a=w(t),i=a.getDay(),o=(i=a.getTime()?n+1:e.getTime()>=o.getTime()?n:n-1}function F(t){const e=w(t);return e.setHours(0,0,0,0),e}function E(t){const e=w(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Z(t,e){const n=F(t),r=F(e),a=+n-E(n),i=+r-E(r);return Math.round((a-i)/z)}function J(t){const e=j(t),n=D(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),S(n)}function K(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function tt(t){if(!K(t)&&typeof t!="number")return!1;const e=w(t);return!isNaN(Number(e))}function et(t){const e=w(t),n=D(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}const nt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},rt=(t,e,n)=>{let r;const a=nt[t];return typeof a=="string"?r=a:e===1?r=a.one:r=a.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function N(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const at={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},it={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ot={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},st={date:N({formats:at,defaultWidth:"full"}),time:N({formats:it,defaultWidth:"full"}),dateTime:N({formats:ot,defaultWidth:"full"})},ut={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ct=(t,e,n,r)=>ut[t];function O(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,s=n!=null&&n.width?String(n.width):o;a=t.formattingValues[s]||t.formattingValues[o]}else{const o=t.defaultWidth,s=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[s]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return a[i]}}const dt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},lt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ft={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ht={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},mt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},gt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},wt=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},yt={ordinalNumber:wt,era:O({values:dt,defaultWidth:"wide"}),quarter:O({values:lt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:O({values:ft,defaultWidth:"wide"}),day:O({values:ht,defaultWidth:"wide"}),dayPeriod:O({values:mt,defaultWidth:"wide",formattingValues:gt,defaultFormattingWidth:"wide"})};function P(t){return(e,n={})=>{const r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(a);if(!i)return null;const o=i[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(s)?Dt(s,g=>g.test(o)):bt(s,g=>g.test(o));let d;d=t.valueCallback?t.valueCallback(u):u,d=n.valueCallback?n.valueCallback(d):d;const f=e.slice(o.length);return{value:d,rest:f}}}function bt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Dt(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const a=r[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const s=e.slice(a.length);return{value:o,rest:s}}}const kt=/^(\d+)(th|st|nd|rd)?/i,Ot=/\d+/i,Pt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},pt={any:[/^b/i,/^(a|c)/i]},vt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},xt={any:[/1/i,/2/i,/3/i,/4/i]},Tt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},St={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Wt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Yt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Nt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ct={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},_t={ordinalNumber:Mt({matchPattern:kt,parsePattern:Ot,valueCallback:t=>parseInt(t,10)}),era:P({matchPatterns:Pt,defaultMatchWidth:"wide",parsePatterns:pt,defaultParseWidth:"any"}),quarter:P({matchPatterns:vt,defaultMatchWidth:"wide",parsePatterns:xt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:P({matchPatterns:Tt,defaultMatchWidth:"wide",parsePatterns:St,defaultParseWidth:"any"}),day:P({matchPatterns:Wt,defaultMatchWidth:"wide",parsePatterns:Yt,defaultParseWidth:"any"}),dayPeriod:P({matchPatterns:Nt,defaultMatchWidth:"any",parsePatterns:Ct,defaultParseWidth:"any"})},Ft={code:"en-US",formatDistance:rt,formatLong:st,formatRelative:ct,localize:yt,match:_t,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Et(t){const e=w(t);return Z(e,et(e))+1}function qt(t){const e=w(t),n=+S(e)-+J(e);return Math.round(n/A)+1}function Q(t,e){var f,g,l,k;const n=w(t),r=n.getFullYear(),a=W(),i=(e==null?void 0:e.firstWeekContainsDate)??((g=(f=e==null?void 0:e.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??a.firstWeekContainsDate??((k=(l=a.locale)==null?void 0:l.options)==null?void 0:k.firstWeekContainsDate)??1,o=D(t,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const s=v(o,e),u=D(t,0);u.setFullYear(r,0,i),u.setHours(0,0,0,0);const d=v(u,e);return n.getTime()>=s.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function Ut(t,e){var s,u,d,f;const n=W(),r=(e==null?void 0:e.firstWeekContainsDate)??((u=(s=e==null?void 0:e.locale)==null?void 0:s.options)==null?void 0:u.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,a=Q(t,e),i=D(t,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),v(i,e)}function Lt(t,e){const n=w(t),r=+v(n,e)-+Ut(n,e);return Math.round(r/A)+1}function c(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const y={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return c(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):c(n+1,2)},d(t,e){return c(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return c(t.getHours()%12||12,e.length)},H(t,e){return c(t.getHours(),e.length)},m(t,e){return c(t.getMinutes(),e.length)},s(t,e){return c(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return c(a,e.length)}},M={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},q={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return y.y(t,e)},Y:function(t,e,n,r){const a=Q(t,r),i=a>0?a:1-a;if(e==="YY"){const o=i%100;return c(o,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):c(i,e.length)},R:function(t,e){const n=j(t);return c(n,e.length)},u:function(t,e){const n=t.getFullYear();return c(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return c(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return c(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return y.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return c(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const a=Lt(t,r);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):c(a,e.length)},I:function(t,e,n){const r=qt(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):c(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):y.d(t,e)},D:function(t,e,n){const r=Et(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):c(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const a=t.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return c(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const a=t.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return c(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),a=r===0?7:r;switch(e){case"i":return String(a);case"ii":return c(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let a;switch(r===12?a=M.noon:r===0?a=M.midnight:a=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let a;switch(r>=17?a=M.evening:r>=12?a=M.afternoon:r>=4?a=M.morning:a=M.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return y.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):y.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):c(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):c(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):y.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):y.s(t,e)},S:function(t,e){return y.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return L(r);case"XXXX":case"XX":return b(r);case"XXXXX":case"XXX":default:return b(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return L(r);case"xxxx":case"xx":return b(r);case"xxxxx":case"xxx":default:return b(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+U(r,":");case"OOOO":default:return"GMT"+b(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+U(r,":");case"zzzz":default:return"GMT"+b(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return c(r,e.length)},T:function(t,e,n){const r=t.getTime();return c(r,e.length)}};function U(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+e+c(i,2)}function L(t,e){return t%60===0?(t>0?"-":"+")+c(Math.abs(t)/60,2):b(t,e)}function b(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=c(Math.trunc(r/60),2),i=c(r%60,2);return n+a+e+i}const H=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},X=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Ht=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return H(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",H(r,e)).replace("{{time}}",X(a,e))},At={p:X,P:Ht},It=/^D+$/,Rt=/^Y+$/,jt=["D","DD","YY","YYYY"];function Qt(t){return It.test(t)}function Xt(t){return Rt.test(t)}function Bt(t,e,n){const r=Gt(t,e,n);if(console.warn(r),jt.includes(t))throw new RangeError(r)}function Gt(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const $t=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Vt=/^'([^]*?)'?$/,Zt=/''/g,Jt=/[a-zA-Z]/;function Kt(t,e,n){var f,g,l,k;const r=W(),a=r.locale??Ft,i=r.firstWeekContainsDate??((g=(f=r.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??1,o=r.weekStartsOn??((k=(l=r.locale)==null?void 0:l.options)==null?void 0:k.weekStartsOn)??0,s=w(t);if(!tt(s))throw new RangeError("Invalid time value");let u=e.match(zt).map(m=>{const h=m[0];if(h==="p"||h==="P"){const Y=At[h];return Y(m,a.formatLong)}return m}).join("").match($t).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const h=m[0];if(h==="'")return{isToken:!1,value:te(m)};if(q[h])return{isToken:!0,value:m};if(h.match(Jt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:m}});a.localize.preprocessor&&(u=a.localize.preprocessor(s,u));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return u.map(m=>{if(!m.isToken)return m.value;const h=m.value;(Xt(h)||Qt(h))&&Bt(h,e,String(t));const Y=q[h[0]];return Y(s,h,a.localize,d)}).join("")}function te(t){const e=t.match(Vt);return e?e[1].replace(Zt,"'"):t}function B(t,e){const r=ae(t);let a;if(r.date){const u=ie(r.date,2);a=oe(u.restDateString,u.year)}if(!a||isNaN(a.getTime()))return new Date(NaN);const i=a.getTime();let o=0,s;if(r.time&&(o=se(r.time),isNaN(o)))return new Date(NaN);if(r.timezone){if(s=ue(r.timezone),isNaN(s))return new Date(NaN)}else{const u=new Date(i+o),d=new Date(0);return d.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),d.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),d}return new Date(i+o+s)}const x={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},ee=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ne=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,re=/^([+-])(\d{2})(?::?(\d{2}))?$/;function ae(t){const e={},n=t.split(x.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],x.timeZoneDelimiter.test(e.date)&&(e.date=t.split(x.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const a=x.timezone.exec(r);a?(e.time=r.replace(a[1],""),e.timezone=a[1]):e.time=r}return e}function ie(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const a=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:i===null?a:i*100,restDateString:t.slice((r[1]||r[2]).length)}}function oe(t,e){if(e===null)return new Date(NaN);const n=t.match(ee);if(!n)return new Date(NaN);const r=!!n[4],a=p(n[1]),i=p(n[2])-1,o=p(n[3]),s=p(n[4]),u=p(n[5])-1;if(r)return he(e,s,u)?ce(e,s,u):new Date(NaN);{const d=new Date(0);return!le(e,i,o)||!fe(e,a)?new Date(NaN):(d.setUTCFullYear(e,i,Math.max(a,o)),d)}}function p(t){return t?parseInt(t):1}function se(t){const e=t.match(ne);if(!e)return NaN;const n=C(e[1]),r=C(e[2]),a=C(e[3]);return me(n,r,a)?n*R+r*I+a*1e3:NaN}function C(t){return t&&parseFloat(t.replace(",","."))||0}function ue(t){if(t==="Z")return 0;const e=t.match(re);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return ge(r,a)?n*(r*R+a*I):NaN}function ce(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const a=r.getUTCDay()||7,i=(e-1)*7+n+1-a;return r.setUTCDate(r.getUTCDate()+i),r}const de=[31,null,31,30,31,30,31,31,30,31,30,31];function G(t){return t%400===0||t%4===0&&t%100!==0}function le(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(de[e]||(G(t)?29:28))}function fe(t,e){return e>=1&&e<=(G(t)?366:365)}function he(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function me(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function ge(t,e){return e>=0&&e<=59}const we={model:"models",dataset:"datasets",space:"spaces"};function ye(t){const e=t.hf_artifact_summary;return!e||!e.best_kind||!e.best_url||e.best_count<=0?{hfKind:null,hfCount:0,hfUrl:null}:{hfKind:we[e.best_kind]??null,hfCount:e.best_count,hfUrl:e.best_url}}function be(t){if(!t||t.length===0)return{github:null,githubUrl:null,velocity24h:null};const e=t.filter(a=>a.is_official),r=[...e.length>0?e:t].sort((a,i)=>(i.num_stars||0)-(a.num_stars||0))[0];return{github:r&&r.num_stars>0?r.num_stars:null,githubUrl:(r==null?void 0:r.url)||null,velocity24h:(r==null?void 0:r.trending_score)??null}}function De(t){if(!t)return null;try{const e=typeof t=="string"?B(t):t;return Kt(e,"MMM d, yyyy")}catch{return null}}function Me(t){if(!t)return null;try{return B(t).getFullYear()}catch{return null}}function ke(t){return(t||[]).filter(e=>e.best_rank>=1&&e.best_rank<=3).map(e=>{let n=null;if(e.dataset_slug){const r=new URLSearchParams;e.task_slug&&r.set("task",e.task_slug),r.set("eval",e.evaluation_id),n=`/benchmark/${e.dataset_slug}?${r}`}return{name:e.dataset_name,href:n,rank:e.best_rank}})}function ve(t){var f,g;const{github:e,githubUrl:n,velocity24h:r}=be(t.repositories),{hfKind:a,hfCount:i,hfUrl:o}=ye(t),s=(t.tasks||[]).map(l=>l.slug||"").filter(Boolean),u=(t.methods||[]).map(l=>({id:l.id,name:l.name,slug:l.slug})),d=ke(t.leaderboard_ranks);return{id:t.arxiv_id||t.id,dbId:t.id,title:t.title,abstract:t.abstract||"",authors:t.authors||[],authorIds:(t.author_links||[]).map(l=>l.id??null),authorHfProfiles:(t.author_links||[]).map(l=>l.hf_username?{username:l.hf_username,avatarUrl:l.hf_avatar_url??null}:null),tags:s,methods:u,organizations:(t.organizations||[]).map(l=>({name:l.name,slug:l.slug,logoUrl:_(l.logo_url)||null})),citations:t.citation_count||0,github:e,githubUrl:n,project:((g=(f=t.project_pages)==null?void 0:f[0])==null?void 0:g.url)||null,date:De(t.published),publishedIso:t.published||null,year:Me(t.published),thumbnailUrl:_(t.thumbnail_url)||null,tldr:t.tldr||null,version:t.version||"v1",velocity24h:r,hfKind:a,hfCount:i,hfUrl:o,sotaRanks:d}}function Oe(t){const e=$.get(t.toLowerCase());if(e)return e;const n=t.toUpperCase();return T.has(n)?n:t.replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase())}const T=new Set(["3D","AI","OCR"]),$=new Map([["3d-tracking","3D Tracking"],["point-tracking","2D Point Tracking"],["3d-generation","3D generation"],["3d-understanding","3D understanding"],["3d-semantic-segmentation","3D semantic segmentation"],["3d-instance-segmentation","3D instance segmentation"],["3d-object-detection","3D object detection"],["text-to-sql","Text-to-SQL"]]);function xe(t,e){const n=t||Oe(e||""),r=$.get((e==null?void 0:e.toLowerCase())||Pe(n));if(r)return r;const a=e==null?void 0:e.toUpperCase(),i=n.toUpperCase();return/^[A-Z0-9][A-Z0-9-]{1,}$/.test(n)||a&&T.has(a)||T.has(i)?i:n.replace(/\b[A-Za-z0-9]+\b/g,s=>/^[A-Z0-9]{2,}$/.test(s)||T.has(s.toUpperCase())?s.toUpperCase():s.charAt(0).toUpperCase()+s.slice(1).toLowerCase())}function Pe(t){return t.trim().toLowerCase().replace(/[\s_]+/g,"-")}export{ke as a,xe as d,Oe as h,be as s,ve as t}; diff --git a/assets/transform-D46m70Qr.js b/assets/transform-D46m70Qr.js new file mode 100644 index 0000000000000000000000000000000000000000..6e02e41b6d09604469d1c2b21ba4ff7a1ae6b824 --- /dev/null +++ b/assets/transform-D46m70Qr.js @@ -0,0 +1 @@ +import{a3 as _}from"./index-DyXq7-Tg.js";function w(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function D(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const A=6048e5,z=864e5,I=6e4,R=36e5;let V={};function W(){return V}function v(t,e){var s,u,d,f;const n=W(),r=(e==null?void 0:e.weekStartsOn)??((u=(s=e==null?void 0:e.locale)==null?void 0:s.options)==null?void 0:u.weekStartsOn)??n.weekStartsOn??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.weekStartsOn)??0,a=w(t),i=a.getDay(),o=(i=a.getTime()?n+1:e.getTime()>=o.getTime()?n:n-1}function F(t){const e=w(t);return e.setHours(0,0,0,0),e}function E(t){const e=w(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function J(t,e){const n=F(t),r=F(e),a=+n-E(n),i=+r-E(r);return Math.round((a-i)/z)}function Z(t){const e=j(t),n=D(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),S(n)}function K(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function tt(t){if(!K(t)&&typeof t!="number")return!1;const e=w(t);return!isNaN(Number(e))}function et(t){const e=w(t),n=D(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}const nt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},rt=(t,e,n)=>{let r;const a=nt[t];return typeof a=="string"?r=a:e===1?r=a.one:r=a.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function N(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const at={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},it={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ot={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},st={date:N({formats:at,defaultWidth:"full"}),time:N({formats:it,defaultWidth:"full"}),dateTime:N({formats:ot,defaultWidth:"full"})},ut={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ct=(t,e,n,r)=>ut[t];function O(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,s=n!=null&&n.width?String(n.width):o;a=t.formattingValues[s]||t.formattingValues[o]}else{const o=t.defaultWidth,s=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[s]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return a[i]}}const dt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},lt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ft={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ht={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},mt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},gt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},wt=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},yt={ordinalNumber:wt,era:O({values:dt,defaultWidth:"wide"}),quarter:O({values:lt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:O({values:ft,defaultWidth:"wide"}),day:O({values:ht,defaultWidth:"wide"}),dayPeriod:O({values:mt,defaultWidth:"wide",formattingValues:gt,defaultFormattingWidth:"wide"})};function P(t){return(e,n={})=>{const r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(a);if(!i)return null;const o=i[0],s=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(s)?Dt(s,g=>g.test(o)):bt(s,g=>g.test(o));let d;d=t.valueCallback?t.valueCallback(u):u,d=n.valueCallback?n.valueCallback(d):d;const f=e.slice(o.length);return{value:d,rest:f}}}function bt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Dt(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const a=r[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const s=e.slice(a.length);return{value:o,rest:s}}}const kt=/^(\d+)(th|st|nd|rd)?/i,Ot=/\d+/i,Pt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},pt={any:[/^b/i,/^(a|c)/i]},vt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},xt={any:[/1/i,/2/i,/3/i,/4/i]},Tt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},St={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Wt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Yt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Nt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ct={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},_t={ordinalNumber:Mt({matchPattern:kt,parsePattern:Ot,valueCallback:t=>parseInt(t,10)}),era:P({matchPatterns:Pt,defaultMatchWidth:"wide",parsePatterns:pt,defaultParseWidth:"any"}),quarter:P({matchPatterns:vt,defaultMatchWidth:"wide",parsePatterns:xt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:P({matchPatterns:Tt,defaultMatchWidth:"wide",parsePatterns:St,defaultParseWidth:"any"}),day:P({matchPatterns:Wt,defaultMatchWidth:"wide",parsePatterns:Yt,defaultParseWidth:"any"}),dayPeriod:P({matchPatterns:Nt,defaultMatchWidth:"any",parsePatterns:Ct,defaultParseWidth:"any"})},Ft={code:"en-US",formatDistance:rt,formatLong:st,formatRelative:ct,localize:yt,match:_t,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Et(t){const e=w(t);return J(e,et(e))+1}function qt(t){const e=w(t),n=+S(e)-+Z(e);return Math.round(n/A)+1}function Q(t,e){var f,g,l,k;const n=w(t),r=n.getFullYear(),a=W(),i=(e==null?void 0:e.firstWeekContainsDate)??((g=(f=e==null?void 0:e.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??a.firstWeekContainsDate??((k=(l=a.locale)==null?void 0:l.options)==null?void 0:k.firstWeekContainsDate)??1,o=D(t,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const s=v(o,e),u=D(t,0);u.setFullYear(r,0,i),u.setHours(0,0,0,0);const d=v(u,e);return n.getTime()>=s.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function Ut(t,e){var s,u,d,f;const n=W(),r=(e==null?void 0:e.firstWeekContainsDate)??((u=(s=e==null?void 0:e.locale)==null?void 0:s.options)==null?void 0:u.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,a=Q(t,e),i=D(t,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),v(i,e)}function Lt(t,e){const n=w(t),r=+v(n,e)-+Ut(n,e);return Math.round(r/A)+1}function c(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const y={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return c(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):c(n+1,2)},d(t,e){return c(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return c(t.getHours()%12||12,e.length)},H(t,e){return c(t.getHours(),e.length)},m(t,e){return c(t.getMinutes(),e.length)},s(t,e){return c(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return c(a,e.length)}},M={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},q={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return y.y(t,e)},Y:function(t,e,n,r){const a=Q(t,r),i=a>0?a:1-a;if(e==="YY"){const o=i%100;return c(o,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):c(i,e.length)},R:function(t,e){const n=j(t);return c(n,e.length)},u:function(t,e){const n=t.getFullYear();return c(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return c(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return c(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return y.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return c(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const a=Lt(t,r);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):c(a,e.length)},I:function(t,e,n){const r=qt(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):c(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):y.d(t,e)},D:function(t,e,n){const r=Et(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):c(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const a=t.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return c(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const a=t.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return c(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),a=r===0?7:r;switch(e){case"i":return String(a);case"ii":return c(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let a;switch(r===12?a=M.noon:r===0?a=M.midnight:a=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let a;switch(r>=17?a=M.evening:r>=12?a=M.afternoon:r>=4?a=M.morning:a=M.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return y.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):y.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):c(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):c(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):y.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):y.s(t,e)},S:function(t,e){return y.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return L(r);case"XXXX":case"XX":return b(r);case"XXXXX":case"XXX":default:return b(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return L(r);case"xxxx":case"xx":return b(r);case"xxxxx":case"xxx":default:return b(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+U(r,":");case"OOOO":default:return"GMT"+b(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+U(r,":");case"zzzz":default:return"GMT"+b(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return c(r,e.length)},T:function(t,e,n){const r=t.getTime();return c(r,e.length)}};function U(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+e+c(i,2)}function L(t,e){return t%60===0?(t>0?"-":"+")+c(Math.abs(t)/60,2):b(t,e)}function b(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=c(Math.trunc(r/60),2),i=c(r%60,2);return n+a+e+i}const H=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},X=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Ht=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return H(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",H(r,e)).replace("{{time}}",X(a,e))},At={p:X,P:Ht},It=/^D+$/,Rt=/^Y+$/,jt=["D","DD","YY","YYYY"];function Qt(t){return It.test(t)}function Xt(t){return Rt.test(t)}function Bt(t,e,n){const r=Gt(t,e,n);if(console.warn(r),jt.includes(t))throw new RangeError(r)}function Gt(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const $t=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Vt=/^'([^]*?)'?$/,Jt=/''/g,Zt=/[a-zA-Z]/;function Kt(t,e,n){var f,g,l,k;const r=W(),a=r.locale??Ft,i=r.firstWeekContainsDate??((g=(f=r.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??1,o=r.weekStartsOn??((k=(l=r.locale)==null?void 0:l.options)==null?void 0:k.weekStartsOn)??0,s=w(t);if(!tt(s))throw new RangeError("Invalid time value");let u=e.match(zt).map(m=>{const h=m[0];if(h==="p"||h==="P"){const Y=At[h];return Y(m,a.formatLong)}return m}).join("").match($t).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const h=m[0];if(h==="'")return{isToken:!1,value:te(m)};if(q[h])return{isToken:!0,value:m};if(h.match(Zt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:m}});a.localize.preprocessor&&(u=a.localize.preprocessor(s,u));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return u.map(m=>{if(!m.isToken)return m.value;const h=m.value;(Xt(h)||Qt(h))&&Bt(h,e,String(t));const Y=q[h[0]];return Y(s,h,a.localize,d)}).join("")}function te(t){const e=t.match(Vt);return e?e[1].replace(Jt,"'"):t}function B(t,e){const r=ae(t);let a;if(r.date){const u=ie(r.date,2);a=oe(u.restDateString,u.year)}if(!a||isNaN(a.getTime()))return new Date(NaN);const i=a.getTime();let o=0,s;if(r.time&&(o=se(r.time),isNaN(o)))return new Date(NaN);if(r.timezone){if(s=ue(r.timezone),isNaN(s))return new Date(NaN)}else{const u=new Date(i+o),d=new Date(0);return d.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),d.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),d}return new Date(i+o+s)}const x={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},ee=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ne=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,re=/^([+-])(\d{2})(?::?(\d{2}))?$/;function ae(t){const e={},n=t.split(x.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],x.timeZoneDelimiter.test(e.date)&&(e.date=t.split(x.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const a=x.timezone.exec(r);a?(e.time=r.replace(a[1],""),e.timezone=a[1]):e.time=r}return e}function ie(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const a=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:i===null?a:i*100,restDateString:t.slice((r[1]||r[2]).length)}}function oe(t,e){if(e===null)return new Date(NaN);const n=t.match(ee);if(!n)return new Date(NaN);const r=!!n[4],a=p(n[1]),i=p(n[2])-1,o=p(n[3]),s=p(n[4]),u=p(n[5])-1;if(r)return he(e,s,u)?ce(e,s,u):new Date(NaN);{const d=new Date(0);return!le(e,i,o)||!fe(e,a)?new Date(NaN):(d.setUTCFullYear(e,i,Math.max(a,o)),d)}}function p(t){return t?parseInt(t):1}function se(t){const e=t.match(ne);if(!e)return NaN;const n=C(e[1]),r=C(e[2]),a=C(e[3]);return me(n,r,a)?n*R+r*I+a*1e3:NaN}function C(t){return t&&parseFloat(t.replace(",","."))||0}function ue(t){if(t==="Z")return 0;const e=t.match(re);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return ge(r,a)?n*(r*R+a*I):NaN}function ce(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const a=r.getUTCDay()||7,i=(e-1)*7+n+1-a;return r.setUTCDate(r.getUTCDate()+i),r}const de=[31,null,31,30,31,30,31,31,30,31,30,31];function G(t){return t%400===0||t%4===0&&t%100!==0}function le(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(de[e]||(G(t)?29:28))}function fe(t,e){return e>=1&&e<=(G(t)?366:365)}function he(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function me(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function ge(t,e){return e>=0&&e<=59}const we={model:"models",dataset:"datasets",space:"spaces"};function ye(t){const e=t.hf_artifact_summary;return!e||!e.best_kind||!e.best_url||e.best_count<=0?{hfKind:null,hfCount:0,hfUrl:null}:{hfKind:we[e.best_kind]??null,hfCount:e.best_count,hfUrl:e.best_url}}function be(t){if(!t||t.length===0)return{github:null,githubUrl:null,velocity24h:null};const e=t.filter(a=>a.is_official),r=[...e.length>0?e:t].sort((a,i)=>(i.num_stars||0)-(a.num_stars||0))[0];return{github:r&&r.num_stars>0?r.num_stars:null,githubUrl:(r==null?void 0:r.url)||null,velocity24h:(r==null?void 0:r.trending_score)??null}}function De(t){if(!t)return null;try{const e=typeof t=="string"?B(t):t;return Kt(e,"MMM d, yyyy")}catch{return null}}function Me(t){if(!t)return null;try{return B(t).getFullYear()}catch{return null}}function ke(t){return(t||[]).filter(e=>e.best_rank>=1&&e.best_rank<=3).map(e=>{let n=null;if(e.dataset_slug){const r=new URLSearchParams;e.task_slug&&r.set("task",e.task_slug),r.set("eval",e.evaluation_id),n=`/benchmark/${e.dataset_slug}?${r}`}return{name:e.dataset_name,href:n,rank:e.best_rank}})}function ve(t){var f,g;const{github:e,githubUrl:n,velocity24h:r}=be(t.repositories),{hfKind:a,hfCount:i,hfUrl:o}=ye(t),s=(t.tasks||[]).map(l=>l.slug||"").filter(Boolean),u=(t.methods||[]).map(l=>({id:l.id,name:l.name,slug:l.slug})),d=ke(t.leaderboard_ranks);return{id:t.arxiv_id||t.id,dbId:t.id,title:t.title,abstract:t.abstract||"",authors:t.authors||[],authorIds:(t.author_links||[]).map(l=>l.id??null),authorHfProfiles:(t.author_links||[]).map(l=>l.hf_username?{username:l.hf_username,avatarUrl:l.hf_avatar_url??null}:null),tags:s,methods:u,organizations:(t.organizations||[]).map(l=>({name:l.name,slug:l.slug,logoUrl:_(l.logo_url)||null})),citations:t.citation_count||0,github:e,githubUrl:n,project:((g=(f=t.project_pages)==null?void 0:f[0])==null?void 0:g.url)||null,date:De(t.published),publishedIso:t.published||null,year:Me(t.published),thumbnailUrl:_(t.thumbnail_url)||null,tldr:t.tldr||null,version:t.version||"v1",velocity24h:r,hfKind:a,hfCount:i,hfUrl:o,sotaRanks:d}}function Oe(t){const e=$.get(t.toLowerCase());if(e)return e;const n=t.toUpperCase();return T.has(n)?n:t.replace(/[-_]+/g," ").replace(/\b\w/g,r=>r.toUpperCase())}const T=new Set(["3D","AI","OCR"]),$=new Map([["3d-tracking","3D Tracking"],["point-tracking","2D Point Tracking"],["3d-generation","3D generation"],["3d-understanding","3D understanding"],["3d-semantic-segmentation","3D semantic segmentation"],["3d-instance-segmentation","3D instance segmentation"],["3d-object-detection","3D object detection"],["text-to-sql","Text-to-SQL"]]);function xe(t,e){const n=t||Oe(e||""),r=$.get((e==null?void 0:e.toLowerCase())||Pe(n));if(r)return r;const a=e==null?void 0:e.toUpperCase(),i=n.toUpperCase();return/^[A-Z0-9][A-Z0-9-]{1,}$/.test(n)||a&&T.has(a)||T.has(i)?i:n.replace(/\b[A-Za-z0-9]+\b/g,s=>/^[A-Z0-9]{2,}$/.test(s)||T.has(s.toUpperCase())?s.toUpperCase():s.charAt(0).toUpperCase()+s.slice(1).toLowerCase())}function Pe(t){return t.trim().toLowerCase().replace(/[\s_]+/g,"-")}export{ke as a,xe as d,Oe as h,be as s,ve as t}; diff --git a/assets/trending-up-B3K5RlyX.js b/assets/trending-up-OM6wBVvQ.js similarity index 71% rename from assets/trending-up-B3K5RlyX.js rename to assets/trending-up-OM6wBVvQ.js index 2251c63fb5edf1344db188255da8012de9a9331e..1797296b7d0d07713dcc14a153d8023b6c027b90 100644 --- a/assets/trending-up-B3K5RlyX.js +++ b/assets/trending-up-OM6wBVvQ.js @@ -1,6 +1,6 @@ -import{n}from"./index-CbgxfyGU.js";/** +import{s as e}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const o=n("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);export{o as T}; + */const o=e("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);export{o as T}; diff --git a/assets/triangle-alert-U7T_j3JE.js b/assets/triangle-alert-uZ3fXFkp.js similarity index 94% rename from assets/triangle-alert-U7T_j3JE.js rename to assets/triangle-alert-uZ3fXFkp.js index 00949b2b0ea4d66598f2958b57db27183bf2b765..26afcd91280ac3853988e32953473f811b643be0 100644 --- a/assets/triangle-alert-U7T_j3JE.js +++ b/assets/triangle-alert-uZ3fXFkp.js @@ -1,4 +1,4 @@ -import{n as e}from"./index-CbgxfyGU.js";/** +import{s as e}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/trophy-BQwEH3L7.js b/assets/trophy-BtgLmZ39.js similarity index 93% rename from assets/trophy-BQwEH3L7.js rename to assets/trophy-BtgLmZ39.js index 8cea5bef1bc177c1a52d488f17448228313dfc46..c906c509aeaf1ae3104b6fd777c07532921a0974 100644 --- a/assets/trophy-BQwEH3L7.js +++ b/assets/trophy-BtgLmZ39.js @@ -1,4 +1,4 @@ -import{n as a}from"./index-CbgxfyGU.js";/** +import{s as a}from"./index-DyXq7-Tg.js";/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. diff --git a/assets/useDebounce-DkuI5tkx.js b/assets/useDebounce-B9jkN7LV.js similarity index 66% rename from assets/useDebounce-DkuI5tkx.js rename to assets/useDebounce-B9jkN7LV.js index 596bdcec81c5df07264b3bb1bae0e1f54cb36e8e..d5fdd347ca590e2a6ad483c623c105cb20a32dea 100644 --- a/assets/useDebounce-DkuI5tkx.js +++ b/assets/useDebounce-B9jkN7LV.js @@ -1 +1 @@ -import{r as o}from"./index-CbgxfyGU.js";function s(e,t=300){const[r,u]=o.useState(e);return o.useEffect(()=>{const c=setTimeout(()=>u(e),t);return()=>clearTimeout(c)},[e,t]),r}export{s as u}; +import{d as o}from"./index-DyXq7-Tg.js";function s(e,t=300){const[r,u]=o.useState(e);return o.useEffect(()=>{const c=setTimeout(()=>u(e),t);return()=>clearTimeout(c)},[e,t]),r}export{s as u}; diff --git a/assets/useDocumentTitle-DcxM2Zv_.js b/assets/useDocumentTitle-DcxM2Zv_.js new file mode 100644 index 0000000000000000000000000000000000000000..9c72dad2baf66a425d908a601974e6f6bb20146d --- /dev/null +++ b/assets/useDocumentTitle-DcxM2Zv_.js @@ -0,0 +1 @@ +import{d as s}from"./index-DyXq7-Tg.js";const E={a:"á",e:"é",i:"í",o:"ó",u:"ú",y:"ý",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú",Y:"Ý"},p={a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"},u={a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"},_={a:"ä",e:"ë",i:"ï",o:"ö",u:"ü",y:"ÿ",A:"Ä",E:"Ë",I:"Ï",O:"Ö",U:"Ü",Y:"Ÿ"},T={"'":E,"`":p,"^":u,'"':_,"~":{n:"ñ",N:"Ñ"}},i={ss:"ß",ae:"æ",AE:"Æ",oe:"œ",OE:"Œ",o:"ø",O:"Ø",l:"ł",L:"Ł"},m=[["varphi","φ"],["varepsilon","ε"],["vartheta","ϑ"],["Gamma","Γ"],["Delta","Δ"],["Theta","Θ"],["Lambda","Λ"],["Sigma","Σ"],["Omega","Ω"],["alpha","α"],["beta","β"],["gamma","γ"],["delta","δ"],["epsilon","ε"],["zeta","ζ"],["eta","η"],["theta","θ"],["kappa","κ"],["lambda","λ"],["mu","μ"],["nu","ν"],["xi","ξ"],["pi","π"],["rho","ρ"],["sigma","σ"],["tau","τ"],["phi","φ"],["chi","χ"],["psi","ψ"],["omega","ω"]],L=/\\(?:textbf|mathbf|emph|textit|textsl|texttt|color|textcolor)\{([^{}]*)\}/g,f=/\\(['"`^~])([A-Za-z])/g,C=/\\c\{([cCsS])\}/g,M=new RegExp(`\\\\(${Object.keys(i).join("|")})(?![A-Za-z])`,"g"),g=/\$\$([^$]+)\$\$/g,O=/\$([^$]+)\$/g,$=/\\([A-Za-z]+)/g;function o(e,t,a){return e.split(t).join(a)}function r(e){let t=e.trim();for(const[a,n]of m)t=o(t,`\\${a}`,n);return t=t.replace($,(a,n)=>n),o(t,"$","")}function h(e){let t=e.replace(g,(a,n)=>r(n));return t=t.replace(O,(a,n)=>r(n)),o(t,"$","")}function D(e){if(!e)return e;let t=e.replace(L,"$1");return t=t.replace(C,(a,n)=>({c:"ç",C:"Ç"})[n]??a),t=t.replace(f,(a,n,A)=>{var c;return((c=T[n])==null?void 0:c[A])??a}),t=t.replace(M,(a,n)=>i[n]??a),t=h(t),o(t,"~"," ")}const l="Papers with Code";function I(e,t=l){return`${D(e.trim())||"Paper"} | ${t}`}function R(e,{restorePrevious:t=!1}={}){s.useEffect(()=>{if(!e)return;const a=document.title;return document.title=e,()=>{document.title=t?a:l}},[e,t])}export{I as f,R as u}; diff --git a/assets/useHashScrollOnReady-DgB3XFQL.js b/assets/useHashScrollOnReady-D5UCCQuT.js similarity index 90% rename from assets/useHashScrollOnReady-DgB3XFQL.js rename to assets/useHashScrollOnReady-D5UCCQuT.js index 114a7737178db6c80b2e7d508f05819af65259dc..e8ad9dffa3699d60bae679d09ce5e62b9dd4a29e 100644 --- a/assets/useHashScrollOnReady-DgB3XFQL.js +++ b/assets/useHashScrollOnReady-D5UCCQuT.js @@ -1 +1 @@ -import{j as s,L as h,r as x}from"./index-CbgxfyGU.js";import{S as p}from"./skeleton-HwvdxvSN.js";import{A as j,a as m}from"./alert-CFDDvdIM.js";import{T as d}from"./trending-up-B3K5RlyX.js";const y=({noun:n,items:e,recentDays:i=30,baselineDays:l=180,isLoading:o,error:t,mono:c})=>!o&&!t&&!(e!=null&&e.length)?null:s.jsxs("section",{id:"trending",className:"taxonomy-trending","aria-label":`Trending ${n}s`,children:[s.jsxs("div",{className:"taxonomy-trending-header",children:[s.jsxs("h2",{children:[s.jsx(d,{size:22,"aria-hidden":"true"}),"Trending"]}),s.jsxs("p",{className:"taxonomy-trending-note",children:[n==="task"?"Tasks":"Methods"," across all areas whose share of papers in the last ",i," days grew the most against the preceding ",l," days."]})]}),t?s.jsx(j,{variant:"destructive",children:s.jsxs(m,{children:["Failed to load trending ",n,"s."]})}):o?s.jsx("div",{className:"tag-grid",children:Array.from({length:6}).map((a,r)=>s.jsx(p,{className:"h-20"},r))}):s.jsx("div",{className:"tag-grid",children:e==null?void 0:e.map((a,r)=>s.jsxs(h,{to:a.href,className:"tag-cell",children:[s.jsxs("div",{className:"name",style:c?{fontFamily:"var(--mono)",fontSize:15}:void 0,children:[s.jsx("span",{className:"taxonomy-trending-rank",children:r+1}),a.icon&&s.jsx("span",{className:"task-icon",style:{color:a.iconColor},children:s.jsx(a.icon,{size:16,strokeWidth:2,"aria-hidden":"true"})}),a.name]}),s.jsxs("div",{className:"meta taxonomy-trending-meta",children:[a.areaName&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:a.areaName}),s.jsx("span",{children:"·"})]}),s.jsxs("span",{children:[a.recentPaperCount.toLocaleString()," papers / ",i,"d"]}),s.jsx("span",{children:"·"}),s.jsxs("span",{className:"method-trend-score taxonomy-trending-lift",title:`Share of recent papers is ${a.shareLift.toFixed(1)}× its baseline share`,children:[s.jsx(d,{size:12,"aria-hidden":"true"}),a.shareLift.toFixed(1),"×"]})]})]},a.id))})]});function v(n){x.useEffect(()=>{var e;!n||!window.location.hash||(e=document.getElementById(window.location.hash.slice(1)))==null||e.scrollIntoView({block:"start"})},[n])}export{y as T,v as u}; +import{j as s,L as h,d as x}from"./index-DyXq7-Tg.js";import{S as p}from"./skeleton-C3IIzpSL.js";import{A as j,a as m}from"./alert-gbJBhAVE.js";import{T as d}from"./trending-up-OM6wBVvQ.js";const y=({noun:n,items:e,recentDays:i=30,baselineDays:l=180,isLoading:o,error:t,mono:c})=>!o&&!t&&!(e!=null&&e.length)?null:s.jsxs("section",{id:"trending",className:"taxonomy-trending","aria-label":`Trending ${n}s`,children:[s.jsxs("div",{className:"taxonomy-trending-header",children:[s.jsxs("h2",{children:[s.jsx(d,{size:22,"aria-hidden":"true"}),"Trending"]}),s.jsxs("p",{className:"taxonomy-trending-note",children:[n==="task"?"Tasks":"Methods"," across all areas whose share of papers in the last ",i," days grew the most against the preceding ",l," days."]})]}),t?s.jsx(j,{variant:"destructive",children:s.jsxs(m,{children:["Failed to load trending ",n,"s."]})}):o?s.jsx("div",{className:"tag-grid",children:Array.from({length:6}).map((a,r)=>s.jsx(p,{className:"h-20"},r))}):s.jsx("div",{className:"tag-grid",children:e==null?void 0:e.map((a,r)=>s.jsxs(h,{to:a.href,className:"tag-cell",children:[s.jsxs("div",{className:"name",style:c?{fontFamily:"var(--mono)",fontSize:15}:void 0,children:[s.jsx("span",{className:"taxonomy-trending-rank",children:r+1}),a.icon&&s.jsx("span",{className:"task-icon",style:{color:a.iconColor},children:s.jsx(a.icon,{size:16,strokeWidth:2,"aria-hidden":"true"})}),a.name]}),s.jsxs("div",{className:"meta taxonomy-trending-meta",children:[a.areaName&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:a.areaName}),s.jsx("span",{children:"·"})]}),s.jsxs("span",{children:[a.recentPaperCount.toLocaleString()," papers / ",i,"d"]}),s.jsx("span",{children:"·"}),s.jsxs("span",{className:"method-trend-score taxonomy-trending-lift",title:`Share of recent papers is ${a.shareLift.toFixed(1)}× its baseline share`,children:[s.jsx(d,{size:12,"aria-hidden":"true"}),a.shareLift.toFixed(1),"×"]})]})]},a.id))})]});function v(n){x.useEffect(()=>{var e;!n||!window.location.hash||(e=document.getElementById(window.location.hash.slice(1)))==null||e.scrollIntoView({block:"start"})},[n])}export{y as T,v as u}; diff --git a/assets/useInfiniteQuery-BAc_4HO5.js b/assets/useInfiniteQuery-BAc_4HO5.js deleted file mode 100644 index 65d028e4c3a8d718ee52400160f28f8564eb400d..0000000000000000000000000000000000000000 --- a/assets/useInfiniteQuery-BAc_4HO5.js +++ /dev/null @@ -1 +0,0 @@ -import{Q as v,h as p}from"./useQuery-Bx9s5-D2.js";import{aV as x,aW as b}from"./index-CbgxfyGU.js";var l=class extends v{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var f,P;const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:g,isError:c,isRefetchError:d}=i,r=(P=(f=s.fetchMeta)==null?void 0:f.fetchMore)==null?void 0:P.direction,h=c&&r==="forward",n=a&&r==="forward",o=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(t,s.data),hasPreviousPage:x(t,s.data),isFetchNextPageError:h,isFetchingNextPage:n,isFetchPreviousPageError:o,isFetchingPreviousPage:u,isRefetchError:d&&!h&&!o,isRefetching:g&&!n&&!u}}};function w(e,t){return p(e,l)}export{w as u}; diff --git a/assets/useInfiniteQuery-BYh2zN-T.js b/assets/useInfiniteQuery-BYh2zN-T.js new file mode 100644 index 0000000000000000000000000000000000000000..1787a2c391e4e469307bc55b925841f0c7b8e4ad --- /dev/null +++ b/assets/useInfiniteQuery-BYh2zN-T.js @@ -0,0 +1 @@ +import{aI as v,a$ as b,b0 as x,b1 as p}from"./index-DyXq7-Tg.js";var l=class extends v{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var f,P;const{state:s}=e,i=super.createResult(e,t),{isFetching:a,isRefetching:g,isError:c,isRefetchError:d}=i,r=(P=(f=s.fetchMeta)==null?void 0:f.fetchMore)==null?void 0:P.direction,h=c&&r==="forward",n=a&&r==="forward",o=c&&r==="backward",u=a&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:x(t,s.data),hasPreviousPage:b(t,s.data),isFetchNextPageError:h,isFetchingNextPage:n,isFetchPreviousPageError:o,isFetchingPreviousPage:u,isRefetchError:d&&!h&&!o,isRefetching:g&&!n&&!u}}};function m(e,t){return p(e,l)}export{m as u}; diff --git a/assets/useIntersectionObserver-CID9Kkak.js b/assets/useIntersectionObserver-CID9Kkak.js deleted file mode 100644 index 8aedf0015c8aecb5af066ace7741c99512f6853a..0000000000000000000000000000000000000000 --- a/assets/useIntersectionObserver-CID9Kkak.js +++ /dev/null @@ -1 +0,0 @@ -import{r}from"./index-CbgxfyGU.js";function b(u={}){const{threshold:t=0,rootMargin:n="0px"}=u,[i,s]=r.useState(!1),e=r.useRef(null),f=r.useCallback(c=>{if(e.current&&(e.current.disconnect(),e.current=null),!c){s(!1);return}const o=new IntersectionObserver(([l])=>s(l.isIntersecting),{threshold:t,rootMargin:n});o.observe(c),e.current=o},[t,n]);return r.useEffect(()=>()=>{e.current&&(e.current.disconnect(),e.current=null)},[]),{targetRef:f,isIntersecting:i}}export{b as u}; diff --git a/assets/useIntersectionObserver-D6_Iig9a.js b/assets/useIntersectionObserver-D6_Iig9a.js new file mode 100644 index 0000000000000000000000000000000000000000..1378b8ea6190fa9441d30c3f04052cf28d4ba13a --- /dev/null +++ b/assets/useIntersectionObserver-D6_Iig9a.js @@ -0,0 +1 @@ +import{d as r}from"./index-DyXq7-Tg.js";function b(u={}){const{threshold:t=0,rootMargin:n="0px"}=u,[i,s]=r.useState(!1),e=r.useRef(null),f=r.useCallback(c=>{if(e.current&&(e.current.disconnect(),e.current=null),!c){s(!1);return}const o=new IntersectionObserver(([l])=>s(l.isIntersecting),{threshold:t,rootMargin:n});o.observe(c),e.current=o},[t,n]);return r.useEffect(()=>()=>{e.current&&(e.current.disconnect(),e.current=null)},[]),{targetRef:f,isIntersecting:i}}export{b as u}; diff --git a/assets/useMutation-P_trTy9i.js b/assets/useMutation-UWxBeqtn.js similarity index 70% rename from assets/useMutation-P_trTy9i.js rename to assets/useMutation-UWxBeqtn.js index 23ebd972a71de65c90433655a53cbe52b85f93c1..dc33eb731820291f872c87466f534a32fdb51057 100644 --- a/assets/useMutation-P_trTy9i.js +++ b/assets/useMutation-UWxBeqtn.js @@ -1 +1 @@ -var R=i=>{throw TypeError(i)};var E=(i,t,s)=>t.has(i)||R("Cannot "+s);var e=(i,t,s)=>(E(i,t,"read from private field"),s?s.call(i):t.get(i)),b=(i,t,s)=>t.has(i)?R("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),p=(i,t,s,r)=>(E(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s),y=(i,t,s)=>(E(i,t,"access private method"),s);import{ax as U,az as k,aC as j,aD as q,ay as P,f as D,r as v,aB as L,aE as z}from"./index-CbgxfyGU.js";var a,c,o,h,n,g,S,w,A=(w=class extends U{constructor(t,s){super();b(this,n);b(this,a);b(this,c);b(this,o);b(this,h);p(this,a,t),this.setOptions(s),this.bindMethods(),y(this,n,g).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const s=this.options;this.options=e(this,a).defaultMutationOptions(t),k(this.options,s)||e(this,a).getMutationCache().notify({type:"observerOptionsUpdated",mutation:e(this,o),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&j(s.mutationKey)!==j(this.options.mutationKey)?this.reset():((r=e(this,o))==null?void 0:r.state.status)==="pending"&&e(this,o).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=e(this,o))==null||t.removeObserver(this)}onMutationUpdate(t){y(this,n,g).call(this),y(this,n,S).call(this,t)}getCurrentResult(){return e(this,c)}reset(){var t;(t=e(this,o))==null||t.removeObserver(this),p(this,o,void 0),y(this,n,g).call(this),y(this,n,S).call(this)}mutate(t,s){var r;return p(this,h,s),(r=e(this,o))==null||r.removeObserver(this),p(this,o,e(this,a).getMutationCache().build(e(this,a),this.options)),e(this,o).addObserver(this),e(this,o).execute(t)}},a=new WeakMap,c=new WeakMap,o=new WeakMap,h=new WeakMap,n=new WeakSet,g=function(){var s;const t=((s=e(this,o))==null?void 0:s.state)??q();p(this,c,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},S=function(t){P.batch(()=>{var s,r,u,f,d,O,x,K;if(e(this,h)&&this.hasListeners()){const m=e(this,c).variables,C=e(this,c).context,M={client:e(this,a),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(r=(s=e(this,h)).onSuccess)==null||r.call(s,t.data,m,C,M)}catch(l){Promise.reject(l)}try{(f=(u=e(this,h)).onSettled)==null||f.call(u,t.data,null,m,C,M)}catch(l){Promise.reject(l)}}else if((t==null?void 0:t.type)==="error"){try{(O=(d=e(this,h)).onError)==null||O.call(d,t.error,m,C,M)}catch(l){Promise.reject(l)}try{(K=(x=e(this,h)).onSettled)==null||K.call(x,void 0,t.error,m,C,M)}catch(l){Promise.reject(l)}}}this.listeners.forEach(m=>{m(e(this,c))})})},w);function Q(i,t){const s=D(),[r]=v.useState(()=>new A(s,i));v.useEffect(()=>{r.setOptions(i)},[r,i]);const u=v.useSyncExternalStore(v.useCallback(d=>r.subscribe(P.batchCalls(d)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),f=v.useCallback((d,O)=>{r.mutate(d,O).catch(L)},[r]);if(u.error&&z(r.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:f,mutateAsync:u.mutate}}export{Q as u}; +var R=i=>{throw TypeError(i)};var E=(i,t,s)=>t.has(i)||R("Cannot "+s);var e=(i,t,s)=>(E(i,t,"read from private field"),s?s.call(i):t.get(i)),b=(i,t,s)=>t.has(i)?R("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),p=(i,t,s,r)=>(E(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s),y=(i,t,s)=>(E(i,t,"access private method"),s);import{aE as U,aG as k,aS as j,aT as q,aF as P,i as L,d as v,aO as T,aU as A}from"./index-DyXq7-Tg.js";var a,c,o,h,n,C,S,w,D=(w=class extends U{constructor(t,s){super();b(this,n);b(this,a);b(this,c);b(this,o);b(this,h);p(this,a,t),this.setOptions(s),this.bindMethods(),y(this,n,C).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const s=this.options;this.options=e(this,a).defaultMutationOptions(t),k(this.options,s)||e(this,a).getMutationCache().notify({type:"observerOptionsUpdated",mutation:e(this,o),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&j(s.mutationKey)!==j(this.options.mutationKey)?this.reset():((r=e(this,o))==null?void 0:r.state.status)==="pending"&&e(this,o).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=e(this,o))==null||t.removeObserver(this)}onMutationUpdate(t){y(this,n,C).call(this),y(this,n,S).call(this,t)}getCurrentResult(){return e(this,c)}reset(){var t;(t=e(this,o))==null||t.removeObserver(this),p(this,o,void 0),y(this,n,C).call(this),y(this,n,S).call(this)}mutate(t,s){var r;return p(this,h,s),(r=e(this,o))==null||r.removeObserver(this),p(this,o,e(this,a).getMutationCache().build(e(this,a),this.options)),e(this,o).addObserver(this),e(this,o).execute(t)}},a=new WeakMap,c=new WeakMap,o=new WeakMap,h=new WeakMap,n=new WeakSet,C=function(){var s;const t=((s=e(this,o))==null?void 0:s.state)??q();p(this,c,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},S=function(t){P.batch(()=>{var s,r,u,f,d,O,x,K;if(e(this,h)&&this.hasListeners()){const m=e(this,c).variables,M=e(this,c).context,g={client:e(this,a),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(r=(s=e(this,h)).onSuccess)==null||r.call(s,t.data,m,M,g)}catch(l){Promise.reject(l)}try{(f=(u=e(this,h)).onSettled)==null||f.call(u,t.data,null,m,M,g)}catch(l){Promise.reject(l)}}else if((t==null?void 0:t.type)==="error"){try{(O=(d=e(this,h)).onError)==null||O.call(d,t.error,m,M,g)}catch(l){Promise.reject(l)}try{(K=(x=e(this,h)).onSettled)==null||K.call(x,void 0,t.error,m,M,g)}catch(l){Promise.reject(l)}}}this.listeners.forEach(m=>{m(e(this,c))})})},w);function I(i,t){const s=L(),[r]=v.useState(()=>new D(s,i));v.useEffect(()=>{r.setOptions(i)},[r,i]);const u=v.useSyncExternalStore(v.useCallback(d=>r.subscribe(P.batchCalls(d)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),f=v.useCallback((d,O)=>{r.mutate(d,O).catch(T)},[r]);if(u.error&&A(r.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:f,mutateAsync:u.mutate}}export{I as u}; diff --git a/assets/usePapers-B0s20UcU.js b/assets/usePapers-B0s20UcU.js new file mode 100644 index 0000000000000000000000000000000000000000..ad635289ae7e368a4345c2f3b38d38fd684082e0 --- /dev/null +++ b/assets/usePapers-B0s20UcU.js @@ -0,0 +1 @@ +import{b as s,T as u,p as i}from"./index-DyXq7-Tg.js";import{u as m}from"./useInfiniteQuery-BYh2zN-T.js";import{p as o}from"./papers-Dh3ljlL0.js";function g(e,t=!0){return s({queryKey:i.detail(e),queryFn:()=>o.get(e),enabled:t&&!!e,staleTime:u})}function y(e,t,{enabled:n=!0,initialPage:p=1}={}){return m({queryKey:e,queryFn:({pageParam:a})=>t(a),initialPageParam:p,getNextPageParam:a=>a.next_page??void 0,enabled:n,staleTime:5*60*1e3,placeholderData:(a,r)=>(r==null?void 0:r.queryKey[0])===e[0]?a:void 0})}export{g as a,y as u}; diff --git a/assets/usePapers-CJaWLZ3y.js b/assets/usePapers-CJaWLZ3y.js deleted file mode 100644 index 17c142491dd846f84734d524061e392b2a45af28..0000000000000000000000000000000000000000 --- a/assets/usePapers-CJaWLZ3y.js +++ /dev/null @@ -1 +0,0 @@ -import{a as u,p as i}from"./paperQueryKeys-B8u1BWlI.js";import{u as o}from"./useQuery-Bx9s5-D2.js";import{u as f}from"./useInfiniteQuery-BAc_4HO5.js";function c(e,t=!0){return o({queryKey:i.detail(e),queryFn:()=>u.get(e),enabled:t&&!!e,staleTime:10*60*1e3,refetchOnWindowFocus:!1})}function d(e,t,{enabled:n=!0,initialPage:s=1}={}){return f({queryKey:e,queryFn:({pageParam:a})=>t(a),initialPageParam:s,getNextPageParam:a=>a.next_page??void 0,enabled:n,staleTime:5*60*1e3,placeholderData:(a,r)=>(r==null?void 0:r.queryKey[0])===e[0]?a:void 0,refetchOnWindowFocus:!1})}export{c as a,d as u}; diff --git a/assets/useQuery-Bx9s5-D2.js b/assets/useQuery-Bx9s5-D2.js deleted file mode 100644 index 5d8bbff0bbf7a3557bbecc3adcb8c48407b3a03d..0000000000000000000000000000000000000000 --- a/assets/useQuery-Bx9s5-D2.js +++ /dev/null @@ -1 +0,0 @@ -var bt=s=>{throw TypeError(s)};var $=(s,t,e)=>t.has(s)||bt("Cannot "+e);var i=(s,t,e)=>($(s,t,"read from private field"),e?e.call(s):t.get(s)),p=(s,t,e)=>t.has(s)?bt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),u=(s,t,e,r)=>($(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),l=(s,t,e)=>($(s,t,"access private method"),e);import{ax as Mt,aF as gt,aG as S,az as q,aH as H,aB as tt,aI as et,aJ as vt,aK as Tt,aL as J,aM as Qt,aN as xt,aO as mt,ay as Ct,r as O,aE as Ot,f as _t}from"./index-CbgxfyGU.js";var v,a,j,g,x,D,C,w,z,P,L,_,F,M,N,n,A,st,it,rt,at,nt,ht,ot,It,Et,Ft=(Et=class extends Mt{constructor(t,e){super();p(this,n);p(this,v);p(this,a);p(this,j);p(this,g);p(this,x);p(this,D);p(this,C);p(this,w);p(this,z);p(this,P);p(this,L);p(this,_);p(this,F);p(this,M);p(this,N,new Set);this.options=e,u(this,v,t),u(this,w,null),u(this,C,gt()),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,a).addObserver(this),Rt(i(this,a),this.options)?l(this,n,A).call(this):this.updateResult(),l(this,n,at).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ct(i(this,a),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ct(i(this,a),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,l(this,n,nt).call(this),l(this,n,ht).call(this),i(this,a).removeObserver(this)}setOptions(t){const e=this.options,r=i(this,a);if(this.options=i(this,v).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof S(this.options.enabled,i(this,a))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");l(this,n,ot).call(this),i(this,a).setOptions(this.options),e._defaulted&&!q(this.options,e)&&i(this,v).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,a),observer:this});const h=this.hasListeners();h&&St(i(this,a),r,this.options,e)&&l(this,n,A).call(this),this.updateResult(),h&&(i(this,a)!==r||S(this.options.enabled,i(this,a))!==S(e.enabled,i(this,a))||H(this.options.staleTime,i(this,a))!==H(e.staleTime,i(this,a)))&&l(this,n,st).call(this);const o=l(this,n,it).call(this);h&&(i(this,a)!==r||S(this.options.enabled,i(this,a))!==S(e.enabled,i(this,a))||o!==i(this,M))&&l(this,n,rt).call(this,o)}getOptimisticResult(t){const e=i(this,v).getQueryCache().build(i(this,v),t),r=this.createResult(e,t);return Dt(this,r)&&(u(this,g,r),u(this,D,this.options),u(this,x,i(this,a).state)),r}getCurrentResult(){return i(this,g)}trackResult(t,e){return new Proxy(t,{get:(r,h)=>(this.trackProp(h),e==null||e(h),h==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&i(this,C).status==="pending"&&i(this,C).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,h))})}trackProp(t){i(this,N).add(t)}getCurrentQuery(){return i(this,a)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=i(this,v).defaultQueryOptions(t),r=i(this,v).getQueryCache().build(i(this,v),e);return r.fetch().then(()=>this.createResult(r,e))}fetch(t){return l(this,n,A).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,g)))}createResult(t,e){var ft;const r=i(this,a),h=this.options,o=i(this,g),c=i(this,x),y=i(this,D),b=t!==r?t.state:i(this,j),{state:E}=t;let d={...E},T=!1,f;if(e._optimisticResults){const R=this.hasListeners(),k=!R&&Rt(t,e),V=R&&St(t,r,e,h);(k||V)&&(d={...d,...xt(E.data,t.options)}),e._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:Q,errorUpdatedAt:B,status:m}=d;f=d.data;let W=!1;if(e.placeholderData!==void 0&&f===void 0&&m==="pending"){let R;o!=null&&o.isPlaceholderData&&e.placeholderData===(y==null?void 0:y.placeholderData)?(R=o.data,W=!0):R=typeof e.placeholderData=="function"?e.placeholderData((ft=i(this,L))==null?void 0:ft.state.data,i(this,L)):e.placeholderData,R!==void 0&&(m="success",f=mt(o==null?void 0:o.data,R,e),T=!0)}if(e.select&&f!==void 0&&!W)if(o&&f===(c==null?void 0:c.data)&&e.select===i(this,z))f=i(this,P);else try{u(this,z,e.select),f=e.select(f),f=mt(o==null?void 0:o.data,f,e),u(this,P,f),u(this,w,null)}catch(R){u(this,w,R)}i(this,w)&&(Q=i(this,w),f=i(this,P),B=Date.now(),m="error");const X=d.fetchStatus==="fetching",Y=m==="pending",Z=m==="error",lt=Y&&X,dt=f!==void 0,I={status:m,fetchStatus:d.fetchStatus,isPending:Y,isSuccess:m==="success",isError:Z,isInitialLoading:lt,isLoading:lt,data:f,dataUpdatedAt:d.dataUpdatedAt,error:Q,errorUpdatedAt:B,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:d.dataUpdateCount>b.dataUpdateCount||d.errorUpdateCount>b.errorUpdateCount,isFetching:X,isRefetching:X&&!Y,isLoadingError:Z&&!dt,isPaused:d.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:Z&&dt,isStale:ut(t,e),refetch:this.refetch,promise:i(this,C),isEnabled:S(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=I.data!==void 0,k=I.status==="error"&&!R,V=G=>{k?G.reject(I.error):R&&G.resolve(I.data)},pt=()=>{const G=u(this,C,I.promise=gt());V(G)},K=i(this,C);switch(K.status){case"pending":t.queryHash===r.queryHash&&V(K);break;case"fulfilled":(k||I.data!==K.value)&&pt();break;case"rejected":(!k||I.error!==K.reason)&&pt();break}}return I}updateResult(){const t=i(this,g),e=this.createResult(i(this,a),this.options);if(u(this,x,i(this,a).state),u(this,D,this.options),i(this,x).data!==void 0&&u(this,L,i(this,a)),q(e,t))return;u(this,g,e);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:h}=this.options,o=typeof h=="function"?h():h;if(o==="all"||!o&&!i(this,N).size)return!0;const c=new Set(o??i(this,N));return this.options.throwOnError&&c.add("error"),Object.keys(i(this,g)).some(y=>{const U=y;return i(this,g)[U]!==t[U]&&c.has(U)})};l(this,n,It).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&l(this,n,at).call(this)}},v=new WeakMap,a=new WeakMap,j=new WeakMap,g=new WeakMap,x=new WeakMap,D=new WeakMap,C=new WeakMap,w=new WeakMap,z=new WeakMap,P=new WeakMap,L=new WeakMap,_=new WeakMap,F=new WeakMap,M=new WeakMap,N=new WeakMap,n=new WeakSet,A=function(t){l(this,n,ot).call(this);let e=i(this,a).fetch(this.options,t);return t!=null&&t.throwOnError||(e=e.catch(tt)),e},st=function(){l(this,n,nt).call(this);const t=H(this.options.staleTime,i(this,a));if(et.isServer()||i(this,g).isStale||!vt(t))return;const r=Tt(i(this,g).dataUpdatedAt,t)+1;u(this,_,J.setTimeout(()=>{i(this,g).isStale||this.updateResult()},r))},it=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,a)):this.options.refetchInterval)??!1},rt=function(t){l(this,n,ht).call(this),u(this,M,t),!(et.isServer()||S(this.options.enabled,i(this,a))===!1||!vt(i(this,M))||i(this,M)===0)&&u(this,F,J.setInterval(()=>{(this.options.refetchIntervalInBackground||Qt.isFocused())&&l(this,n,A).call(this)},i(this,M)))},at=function(){l(this,n,st).call(this),l(this,n,rt).call(this,l(this,n,it).call(this))},nt=function(){i(this,_)!==void 0&&(J.clearTimeout(i(this,_)),u(this,_,void 0))},ht=function(){i(this,F)!==void 0&&(J.clearInterval(i(this,F)),u(this,F,void 0))},ot=function(){const t=i(this,v).getQueryCache().build(i(this,v),this.options);if(t===i(this,a))return;const e=i(this,a);u(this,a,t),u(this,j,t.state),this.hasListeners()&&(e==null||e.removeObserver(this),t.addObserver(this))},It=function(t){Ct.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(i(this,g))}),i(this,v).getQueryCache().notify({query:i(this,a),type:"observerResultsUpdated"})})},Et);function Ut(s,t){return S(t.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&S(t.retryOnMount,s)===!1)}function Rt(s,t){return Ut(s,t)||s.state.data!==void 0&&ct(s,t,t.refetchOnMount)}function ct(s,t,e){if(S(t.enabled,s)!==!1&&H(t.staleTime,s)!=="static"){const r=typeof e=="function"?e(s):e;return r==="always"||r!==!1&&ut(s,t)}return!1}function St(s,t,e,r){return(s!==t||S(r.enabled,s)===!1)&&(!e.suspense||s.state.status!=="error")&&ut(s,e)}function ut(s,t){return S(t.enabled,s)!==!1&&s.isStaleByTime(H(t.staleTime,s))}function Dt(s,t){return!q(s.getCurrentResult(),t)}var wt=O.createContext(!1),Pt=()=>O.useContext(wt);wt.Provider;function Lt(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var Nt=O.createContext(Lt()),Bt=()=>O.useContext(Nt),kt=(s,t,e)=>{const r=e!=null&&e.state.error&&typeof s.throwOnError=="function"?Ot(s.throwOnError,[e.state.error,e]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||r)&&(t.isReset()||(s.retryOnMount=!1))},At=s=>{O.useEffect(()=>{s.clearReset()},[s])},Ht=({result:s,errorResetBoundary:t,throwOnError:e,query:r,suspense:h})=>s.isError&&!t.isReset()&&!s.isFetching&&r&&(h&&s.data===void 0||Ot(e,[s.error,r])),jt=s=>{if(s.suspense){const e=h=>h==="static"?h:Math.max(h??1e3,1e3),r=s.staleTime;s.staleTime=typeof r=="function"?(...h)=>e(r(...h)):e(r),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},zt=(s,t)=>s.isLoading&&s.isFetching&&!t,Wt=(s,t)=>(s==null?void 0:s.suspense)&&t.isPending,yt=(s,t,e)=>t.fetchOptimistic(s).catch(()=>{e.clearReset()});function Vt(s,t,e){var T,f,Q,B;const r=Pt(),h=Bt(),o=_t(),c=o.defaultQueryOptions(s);(f=(T=o.getDefaultOptions().queries)==null?void 0:T._experimental_beforeQuery)==null||f.call(T,c);const y=o.getQueryCache().get(c.queryHash);c._optimisticResults=r?"isRestoring":"optimistic",jt(c),kt(c,h,y),At(h);const U=!o.getQueryCache().get(c.queryHash),[b]=O.useState(()=>new t(o,c)),E=b.getOptimisticResult(c),d=!r&&s.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(m=>{const W=d?b.subscribe(Ct.batchCalls(m)):tt;return b.updateResult(),W},[b,d]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),O.useEffect(()=>{b.setOptions(c)},[c,b]),Wt(c,E))throw yt(c,b,h);if(Ht({result:E,errorResetBoundary:h,throwOnError:c.throwOnError,query:y,suspense:c.suspense}))throw E.error;if((B=(Q=o.getDefaultOptions().queries)==null?void 0:Q._experimental_afterQuery)==null||B.call(Q,c,E),c.experimental_prefetchInRender&&!et.isServer()&&zt(E,r)){const m=U?yt(c,b,h):y==null?void 0:y.promise;m==null||m.catch(tt).finally(()=>{b.updateResult()})}return c.notifyOnChangeProps?E:b.trackResult(E)}function Xt(s,t){return Vt(s,Ft)}export{Ft as Q,Pt as a,Bt as b,kt as c,At as d,jt as e,yt as f,Ht as g,Vt as h,Wt as s,Xt as u}; diff --git a/index.html b/index.html index 7a5a179ab3455c6aa8037e06c2882f361692e317..ea400cffac6acd18ca32de0db590ae295ee8b982 100644 --- a/index.html +++ b/index.html @@ -72,7 +72,7 @@ plausible.init(); })(); - +