PageSourceSearch

https://citeme.app/_next/static/chunks/51293.7cbc0ce80c261262.js

js citeme.app collected 2026-10-01 23:46:34 UTC 92,376 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[51293,79064],{565:(e,t,r)=>{r.d(t,{d:()=>o});var n=r(95155),a=r(12115),i=r(75163);let o=(0,a.forwardRef)((e,t)=>(0,n.jsx)(i.I,{ref:t,...e,children:(0,n.jsxs)("g",{fill:"none",fillRule:"evenodd",children:[(0,n.jsx)("path",{d:"M24 0v24H0V0zM12.593 23.258l-.011.002-.071.035-.02.004-.014-.004-.071-.035q-.016-.005-.024.005l-.004.01-.017.428.005.02.01.013.104.074.015.004.012-.004.104-.074.012-.016.004-.017-.017-.427q-.004-.016-.017-.018m.265-.113-.013.002-.185.093-.01.01-.003.011.018.43.005.012.008.007.201.093q.019.005.029-.008l.004-.014-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014-.034.614q.001.018.017.024l.015-.002.201-.093.01-.008.004-.011.017-.43-.003-.012-.01-.01z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M12.707 15.707a1 1 0 0 1-1.414 0L5.636 10.05A1 1 0 1 1 7.05 8.636l4.95 4.95 4.95-4.95a1 1 0 0 1 1.414 1.414z"})]})}));o.displayName="DownLine",(0,a.forwardRef)((e,t)=>(0,n.jsx)(i.I,{ref:t,...e,children:(0,n.jsxs)("g",{fill:"none",fillRule:"evenodd",children:[(0,n.jsx)("path",{d:"M24 0v24H0V0zM12.593 23.258l-.011.002-.071.035-.02.004-.014-.004-.071-.035q-.016-.005-.024.005l-.004.01-.017.428.005.02.01.013.104.074.015.004.012-.004.104-.074.012-.016.004-.017-.017-.427q-.004-.016-.017-.018m.265-.113-.013.002-.185.093-.01.01-.003.011.018.43.005.012.008.007.201.093q.019.005.029-.008l.004-.014-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014-.034.614q.001.018.017.024l.015-.002.201-.093.01-.008.004-.011.017-.43-.003-.012-.01-.01z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M13.06 16.06a1.5 1.5 0 0 1-2.12 0l-5.658-5.656a1.5 1.5 0 1 1 2.122-2.121L12 12.879l4.596-4.596a1.5 1.5 0 0 1 2.122 2.12l-5.657 5.658Z"})]})})).displayName="DownFill"},1296:(e,t,r)=>{r.d(t,{s:()=>o});var n=r(95155),a=r(12115),i=r(75163);let o=(0,a.forwardRef)((e,t)=>(0,n.jsx)(i.I,{ref:t,...e,children:(0,n.jsxs)("g",{fill:"none",children:[(0,n.jsx)("path",{d:"M24 0v24H0V0zM12.593 23.258l-.011.002-.071.035-.02.004-.014-.004-.071-.035q-.016-.005-.024.005l-.004.01-.017.428.005.02.01.013.104.074.015.004.012-.004.104-.074.012-.016.004-.017-.017-.427q-.004-.016-.017-.018m.265-.113-.013.002-.185.093-.01.01-.003.011.018.43.005.012.008.007.201.093q.019.005.029-.008l.004-.014-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014-.034.614q.001.018.017.024l.015-.002.201-.093.01-.008.004-.011.017-.43-.003-.012-.01-.01z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M17 2c1.598 0 3 1.3 3 3v13c0 1.7-1.4 3-3 3H6c-1.054 0-2-.95-2-2V4c0-1.054.95-2 2-2zm0 2h-7v15h7c.513 0 1-.39 1-1V5c0-.513-.49-1-1-1M8 4H6v15h2z"})]})}));o.displayName="NotebookLine",(0,a.forwardRef)((e,t)=>(0,n.jsx)(i.I,{ref:t,...e,children:(0,n.jsxs)("g",{fill:"none",children:[(0,n.jsx)("path",{d:"M24 0v24H0V0zM12.593 23.258l-.011.002-.071.035-.02.004-.014-.004-.071-.035q-.016-.005-.024.005l-.004.01-.017.428.005.02.01.013.104.074.015.004.012-.004.104-.074.012-.016.004-.017-.017-.427q-.004-.016-.017-.018m.265-.113-.013.002-.185.093-.01.01-.003.011.018.43.005.012.008.007.201.093q.019.005.029-.008l.004-.014-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014-.034.614q.001.018.017.024l.015-.002.201-.093.01-.008.004-.011.017-.43-.003-.012-.01-.01z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M8 2v19H6c-1.054 0-2-.95-2-2V4c0-1.054.95-2 2-2zm9 0c1.598 0 3 1.3 3 3v13c0 1.7-1.4 3-3 3h-7V2z"})]})})).displayName="NotebookFill"},2430:(e,t,r)=>{r.d(t,{$V:()=>l,I2:()=>c,ww:()=>a});var n=r(47293),a="citation-js-core@1",i={abnt:"nbr6023-2018","abnt-numerico":"nbr6023-2018",apa:"7",mla:"9","chicago-author-date":"17","chicago-note":"17",turabian:"9",harvard:"ctr13",vancouver:"uniform",ieee:"latest",ama:"11",cse:"8",asa:"6",aglc:"4"},o={harvard:"Harvard (Cite Them Right)",apa:"APA 7th Edition",mla:"MLA 9th Edition",abnt:"ABNT (NBR 6023:2018)","abnt-numerico":"ABNT Num\xe9rico (NBR 6023:2018)"};function l(e){var t,r,a;return null!=(t=null!=(r=o[e])?r:null==(a=n.rY[e])?void 0:a.name)?t:e.toUpperCase()}function c(e){return"".concat(e,":").concat(function(e){var t=i[e];if(t)return t;var r=n.rY[e];if(!r)return"1";var a=r.file;if(!a)return"1";var o=a.match(/(19|20)\d{2}/);if(o)return o[0];var l=a.match(/(?:-|_)(\d{1,2})(?:st|nd|rd|th)?(?:\.|-|_|$)/i);return(null==l?void 0:l[1])?l[1]:"1"}(e))}},7974:(e,t,r)=>{r.d(t,{e:()=>s});var n=r(42021),a=r(88162),i=r(29959),o=r(71937),l=r(76123),c=r(96453);function s(e,t,r){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unknown";return(0,n._)(function*(){var n=t||"apa";if(e.title||e.authors.length>0)try{var u=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",n=function(e){if(!e.journal)return!0;
1if(e.title){var t=e.journal.toLowerCase().trim(),r=e.title.toLowerCase().trim();if(r===t)return!0;var n=t.length/r.length,a=r.charAt(t.length),i=""===a||/[:;,.()[\]-]/.test(a),o=/\s/.test(a);if(r.startsWith(t)&&(n>=.4&&i||n>=.75&&o))return!0}return!1}(e),a={id:"grobid-".concat(e.index),type:n?"book":"article-journal"};if(e.title){var i,o,{cleanTitle:l,edition:c}=(o=(i=e.title).match(/\s*[.,]\s*(\d{1,2})\s*(?:st|nd|rd|th|º|ª|ème|\.|a|e)?\s*(?:ed|éd|aufl|edição|edicion|edición|edition|ed\.)\.?\s*$/i))||(o=i.match(/\.\s+(\d{1,2})\.?\s*$/))&&parseInt(o[1],10)>=2&&20>=parseInt(o[1],10)?{cleanTitle:i.slice(0,o.index).trimEnd(),edition:o[1]}:{cleanTitle:i};a.title=l,c&&(a.edition=c)}if(e.authors.length>0&&(a.author=e.authors.filter(e=>e.family||e.given).map(e=>({family:e.family||void 0,given:e.given||void 0}))),e.year){var s=parseInt(e.year,10);Number.isFinite(s)&&(a.issued={"date-parts":[[s]]})}e.doi&&(a.DOI=e.doi),!n&&e.journal&&(a["container-title"]=e.journal),e.volume&&(a.volume=e.volume),e.pages&&(a.page=e.pages);var u=function(e){switch(e){case"pt":return"pt-BR";case"es":return"es-ES";case"fr":return"fr-FR";case"de":return"de-DE";case"it":return"it-IT";default:return}}((t=e.title,!t||/[áàâãéêèíìîóôõòúùûüçñ]/i.test(t)?r:"en"));return u&&(a.language=u),a}(e,s),d=yield(0,i.as)(u,n);if(null==d?void 0:d.reference)return{html:(0,a.pn)(d.reference),plain:(0,a.QZ)(d.reference)};(0,l.trackEvent)("reader_wasm_fallback",{reason:"empty_result",style:n,paper_language:s})}catch(e){(0,l.trackEvent)("reader_wasm_fallback",{reason:"exception",style:n,paper_language:s,error:(0,c.u)(e)})}else(0,l.trackEvent)("reader_wasm_fallback",{reason:"no_metadata",style:n,paper_language:s});return(0,o.ox)(e,t,r,s)})()}},8387:(e,t,r)=>{r.d(t,{N:()=>o,x:()=>i});var n=r(42021);function a(e,t){t&&e.append("allow_ocr","true")}function i(e){var{file:t,mode:r,libraryCitationId:n,allowOcrHint:i,copyContext:o,signal:l}=e;if("library"===r&&n){var c=new FormData;return c.append("file",t),a(c,i),fetch("/api/v1/library/".concat(n,"/pdf"),{method:"POST",body:c,credentials:"include",signal:l})}var s=new FormData;return s.append("pdf",t),a(s,i),o&&s.append("copy_context",o),fetch("/api/v1/papers/extract-references",{method:"POST",body:s,credentials:"include",signal:l})}function o(e){return(0,n._)(function*(){if(!e.ok)return"";var t,r=yield e.json(),n=null==r||null==(t=r.data)?void 0:t.references;return Array.isArray(n)?n.map(e=>
1e.rawText||[e.title,e.year].filter(Boolean).join(", ")).filter(e=>e.trim().length>0).join("\n"):""})()}},8777:(e,t,r)=>{r.d(t,{G:()=>a});var n=r(12115);function a(e){var[t,r]=(0,n.useState)(!1),a=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(t){null==e||null==(n=e.onOpen)||n.call(e);var n,i=t=>{var n,i=t.target;if(i instanceof Node){var o=!!(a.current&&a.current.contains(i)),l=!!(null==e||null==(n=e.additionalRefs)?void 0:n.some(e=>{var t;return null==(t=e.current)?void 0:t.contains(i)}));o||l||r(!1)}},o=t=>{if("Escape"===t.key){var n,a;r(!1),null==e||null==(a=e.triggerRef)||null==(n=a.current)||n.focus()}},l=(null==e?void 0:e.pointerEvents)?"pointerdown":"mousedown";return document.addEventListener(l,i),document.addEventListener("keydown",o),()=>{document.removeEventListener(l,i),document.removeEventListener("keydown",o)}}},[t]);var i=(0,n.useCallback)(()=>r(e=>!e),[]);return{isOpen:t,menuRef:a,toggle:i,close:(0,n.useCallback)(()=>r(!1),[]),open:(0,n.useCallback)(()=>r(!0),[]),setIsOpen:r}}},11077:(e,t,r)=>{r.d(t,{O:()=>s,v:()=>c});var n=r(74508),a=["/tools","/reference-checker","/search","/formatter","/library","/read","/projects","/bulk","/convert"],i=["/"],o=n.DT.locales.filter(e=>e!==n.DT.defaultLocale),l=o.length>0?new RegExp("^/(?:".concat(o.join("|"),")(/|$)")):/(?!)/;function c(e){if(!e)return null;var t=e.split("?")[0];if(!(t.startsWith("/")&&!t.startsWith("//")&&!t.includes("://")))return null;var r=t.replace(l,"/");return i.includes(r)||a.some(e=>r===e||r.startsWith("".concat(e,"/")))?e:null}function s(e){if(/[?&]checkout=success\b/.test(e))return e;var t=e.includes("?")?"&":"?";return"".concat(e).concat(t,"checkout=success")}},20414:(e,t,r)=>{r.d(t,{Mh:()=>i,ln:()=>n,s7:()=>a});var n=0xa00000,a=0x3200000;function i(e){return e>=1048576?"".concat(Math.round(e/1024/1024),"MB"):"".concat(Math.round(e/1024),"KB")}},28080:(e,t,r)=>{r.d(t,{F6:()=>u,G1:()=>s,Gg:()=>m,Iw:()=>x,J3:()=>f,KP:()=>y,OO:()=>d,SX:()=>v,aS:()=>c,cR:()=>h,oh:()=>b,un:()=>g,xo:()=>l});var n=r(43078),a=r(16305),i=r(76123),o=r(90949);function l(e,t,r,a){(0,o.T)("quota_wall");var l,c,s=null!=(l=null==a?void 0:a.monthly_remaining)?l:void 0,u=null!=(c=null==a?void 0:a.daily_remaining)?c:void 0;(0,i.trackEvent)("quota_hit",(0,n._)({feature:e,current:t,limit:r},(null==a?void 0:a.scope)!==void 0&&{scope:a.scope},(null==a?void 0:a.tier)!==void 0&&{tier:a.tier},(null==a?void 0:a.surface)!==void 0&&{surface:a.surface},void 0!==s&&{monthly_remaining:s},void 0!==u&&{daily_remaining:u}))}function c(e,t,r,a){(0,i.trackEvent)("upgrade_click",(0,n._)({feature:e,variant:t},r&&{source:r},p(a)))}function s(e){(0,i.trackEvent)("upgrade_modal_shown",{source:e})}function u(e){(0,i.trackEvent)("upgrade_modal_closed",{source:e})}function d(e,t,r,l,c,s,u,d,f,v,m,h,y,g,b,x){"opened"===e&&(0,o.T)("checkout");var _,w,k="checkout_".concat(e),j="u">typeof navigator?/Mobile|Android|iPhone|iPad/i.test(navigator.userAgent)?"mobile":"desktop":void 0,S=(0,n._)({billing_cycle:t},r&&{entry_locale:r},l&&{error_type:l},c&&{source:c},j&&{device:j},s&&{price:s},u&&{overlay_locale:u},(null==d?void 0:d.paymentMethod)&&{payment_method:d.paymentMethod},(null==d?void 0:d.cardType)&&{card_type:d.cardType},(null==d?void 0:d.errorCode)&&{error_code:d.errorCode},(null==d?void 0:d.errorName)&&{error_name:d.errorName},(null==d?void 0:d.errorDetail)&&{error_detail:d.errorDetail.replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,"[email]").slice(0,160)},(null==d?void 0:d.paddleErrorType)&&{paddle_error_type:d.paddleErrorType},void 0!==f&&{is_guest:f},void 0!==h&&{duration_ms:h},void 0!==y&&{had_error:y},g&&{close_source:g},b&&{open_path:b},(null==x||null==(_=x.available)?void 0:_.length)?{payment_methods_available:[...x.available].sort().join(",")}:{},(null==x||null==(w=x.pass)?void 0:w.length)?{payment_methods_pass:[...x.pass].sort().join(",")}:{},p(v,{includeLastValue:!1})),E=(0,n._)({},S,p(v,{includeTransactional:!1}));(0,i.trackEvent)(k,E),(0,a.jl)("analytics")||(0,i.trackEssentialEvent)(k,S,m)}function f(e,t){var r="attempted"===e?"checkout_retry_attempted":"checkout_retry_opened",o=(0,n._)({billing_cycle:t.billingCycle},t.source&&{source:t.source},t.conversionId&&{conversion_id:t.conversionId},void 0!==t.isGuest&&{is_guest:t.isGuest},t.errorCode&&{error_code:t.errorCode},t.paddleErrorType&&{paddle_error_type:t.paddleErrorType});(0,i.trackEvent)(r,o),(0,a.jl)("analytics")||(0,i.trackEssentialEvent)(r,o,t.userId)}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,n._)({stage:e},t.billingCycle&&{billing_cycle:t.billingCycle},t.source&&{source:t.source},void 0!==t.msSinceOpen&&{ms_since_open:Math.round(t.msSinceOpen)},t.paymentMethod&&{payment_method:t.paymentMethod});(0,i.trackEvent)("checkout_stage",r),(0,a.jl)("analytics")||(0,i.trackEssentialEvent)("checkout_stage",r)}function m(e,t,r,a,o){(0,i.trackEvent)("checkout_mobile_stage",(0,n._)({stage:e,billing_cycle:t,device:"mobile"},r&&{source:r},(null==o?void 0:o.frameTarget)&&{frame_target:o.frameTarget},(null==o?void 0:o.containerFound)!==void 0&&{container_found:o.containerFound}
1,(null==o?void 0:o.iframeCount)!==void 0&&{iframe_count:o.iframeCount},(null==o?void 0:o.containerHeight)!==void 0&&{container_height:o.containerHeight},p(a)))}function p(e){var t,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return{};var i=null==(t=a.includeTransactional)||t,o=null==(r=a.includeLastValue)||r;return(0,n._)({},i&&e.conversionId&&{conversion_id:e.conversionId},i&&e.sourceSurface&&{source_surface:e.sourceSurface},i&&e.sourceTrigger&&{source_trigger:e.sourceTrigger},i&&e.sourceFeature&&{source_feature:e.sourceFeature},i&&e.sourceFamily&&{source_family:e.sourceFamily},o&&e.lastValueEvent&&{last_value_event:e.lastValueEvent},o&&e.lastValueToolId&&{last_value_tool_id:e.lastValueToolId},o&&e.lastValueTotalBucket&&{last_value_total_bucket:e.lastValueTotalBucket},o&&e.lastValueIssueBucket&&{last_value_issue_bucket:e.lastValueIssueBucket},o&&e.lastValueInputMethod&&{last_value_input_method:e.lastValueInputMethod},o&&e.lastValueTier&&{last_value_tier:e.lastValueTier},o&&e.lastValueAgeBucket&&{last_value_age_bucket:e.lastValueAgeBucket})}function h(e,t){(0,i.trackEvent)("cancel_intent",{billing_cycle:null!=e?e:void 0,plan:null!=t?t:void 0})}function y(e,t,r,n){(0,i.trackEvent)("cancel_flow_outcome",{outcome:e,billing_cycle:null!=t?t:void 0,plan:null!=r?r:void 0,provider:n})}function g(e,t,r){(0,o.T)("upgrade_prompt"),(0,i.trackEvent)("upgrade_prompt_viewed",(0,n._)({feature:e,variant:t},(null==r?void 0:r.triggerAfterActions)!==void 0&&{trigger_after_actions:r.triggerAfterActions},(null==r?void 0:r.ctaMode)&&{cta_mode:r.ctaMode}))}function b(e,t){(0,i.trackEvent)("upgrade_prompt_cta_click",{feature:e,variant:t})}function x(e,t,r){(0,i.trackEvent)("upgrade_prompt_dismissed",(0,n._)({feature:e,variant:t},r&&{dismiss_reason:r}))}},29959:(e,t,r)=>{r.d(t,{Ys:()=>p,as:()=>m});var n=r(42021),a=r(47293),i="/csl",o=["en-US","en-GB","pt-BR","es-ES","fr-FR","de-DE"],l=null,c=new Set,s=new Map,u=new Map;function d(){return l||(l=(0,n._)(function*(){var{createEngine:e}=yield r.e(56409).then(r.bind(r,56409)),t=yield e({module_or_path:"/wasm/citeme_engine_wasm_bg.wasm"});return yield Promise.all(o.map(e=>(0,n._)(function*(){try{var r=yield fetch("".concat(i,"/locales/locales-").concat(e,".xml"));if(!r.ok)return;t.loadLocale(e,(yield r.text()))}catch(e){}})())),t})().catch(e=>{throw l=null,e})),l}function f(e,t){return(0,n._)(function*(){if(!(c.has(t)||e.hasStyle(t))){var r=s.get(t);if(r)return r;var o=(0,a.qR)(t);if(!(null==o?void 0:o.file))throw Error("Unsupported style for Wasm: ".concat(t));var l=(0,n._)(function*(){var r=yield fetch("".concat(i,"/").concat(o.file));if(!r.ok)throw Error("Failed to load style ".concat(t,": ").concat(r.status));e.loadStyle(t,(yield r.text())),c.add(t)})().finally(()=>s.delete(t));return s.set(t,l),l}})()}function v(e,t){return(0,n._)(function*(){if(!(!t||e.hasLocale(t))){var r=u.get(t);if(r)return r;var a=(0,n._)(function*(){var r=yield fetch("".concat(i,"/locales/locales-").concat(t,".xml"));if(!r.ok)throw Error("Failed to load locale ".concat(t,": ").concat(r.status));e.loadLocale(t,(yield r.text()))})().finally(()=>u.delete(t));return u.set(t,a),a}})()}function m(e,t){return(0,n._)(function*(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=(0,a.qR)(t);if(!(null==i?void 0:i.file))throw Error("Unsupported style for Wasm: ".concat(t));var o=yield d();yield Promise.all([f(o,t),v(o,i.locale)]);var l="abnt"===t||"abnt-numerico"===t;return JSON.parse(o.formatOneWithOutput(JSON.stringify(e),t,i.locale,l,null!=(r=n.outputFormat)?r:"html",!1))}).apply(this,arguments)}function p(e){var t=()=>{d().then(t=>(0,n._)(function*(){if(e)try{yield f(t,e),yield v(t,(0,a.qR)(e).locale)}catch(e){}})()).catch(()=>{})},r=window.requestIdleCallback;r?r(t,{timeout:2e3}):setTimeout(t,200)}},32014:(e,t,r)=>{r.d(t,{l:()=>o,u:()=>l});var n=r(19749),a=r(96334),i=new Set(["/","/pricing","/tools","/styles","/extension","/apps"]);function o(e,t){if("en"===t||!t)return e;var r=e.search(/[?#]/),n=-1===r?e:e.slice(0,r),a=-1===r?"":e.slice(r);if(!i.has(n))return e;var o="/"===n?"/".concat(t):"/".concat(t).concat(n);return"".concat(o).concat(a)}function l(e){var t,r=(0,n.c)(3),i=(0,a.Ym)();return r[0]!==i||r[1]!==e?(t=o(e,i),r[0]=i,r[1]=e,r[2]=t):t=r[2],t}},35756:(e,t,r)=>{r.r(t),r.d(t,{OaReaderClient:()=>ep});var n=r(95155),a=r(19749),i=r(12115),o=r(29071),l=r(82222),c=r(99345),s=r(73549),u=r.n(s),d=r(1296),f=r(28080),v=r(32014),m=r(72194),p="readerPdfsPerMonth",h="upgrade_inline_".concat(p);function y(e){var t,r,o,l,s,y,g,b,x,_,w,k,j,S,E,N=(0,a.c)(34),{surface:R,used:C,limit:L}=e,I=(0,c.c)("Reader"),T="reader-cap-".concat(R),M=(0,v.u)("/pricing?plan=month&source=".concat(h,"&surface=").concat(R)),P=(0,i.useRef)(!1),A=(0,i.useRef)(!1),O=(0,i.useRef)(!1);N[0]!==T?(t=()=>{P.current||(P.current=!0,(0,f.un)(p,T),(0,f.aS)("reader-cap","view"))},r=[T],N[0]=T,N[1]=t,N[2]=r):(t=N[1],r=N[2]),(0,i.useEffect)(t,r),N[3]!==T?(o=()=>()=>{!P.current||A.current||O.current||(O.current=!0,(0,f.Iw)(p,T,"unmount"))},l=[T],N[3]=T,N[4]=o,N[5]=l):(o=N[4],l=N[5]),(0,i.useEffect)(o,l),N[6]!==T?(s=()=>{A.current=!0,(0,f.oh)(p,T),(0,f.aS)("reader-cap","click");try{(0,m.Pl)(sessionStorage,window.location.pathname+window.location.search)}catch(e){}},N[6]=T,N[7]=s):s=N[7];var D=s;return N[8]!==I?(y=I("quotaGateTitle"),N[8]=I,N[9]=y):y=N[9],N[10]===Symbol.for("react.memo_cache_sentinel")?(g=(0,n.jsx)(d.s,{className:"mx-auto mb-4 h-6 w-6 text-muted","aria-hidden":!0}),N[10]=g):g=N[10],N[11]!==I?(b=I("quotaGateTitle"),N[11]=I,N[12]=b):b=N[12],N[13]!==b?(x=(0,n.jsx)("h2",{className:"text-lg font-semibold text-secondary",children:b}),N[13]=b,N[14]=x):x=N[14],N[15]!==I?(_=I("quotaGateDescription"),N[15]=I,N[16]=_):_=N[16],N[17]!==_?
1(w=(0,n.jsx)("p",{className:"mt-2 text-sm text-muted",children:_}),N[17]=_,N[18]=w):w=N[18],N[19]!==L||N[20]!==C?(k="number"==typeof C&&"number"==typeof L?(0,n.jsxs)("p",{className:"mt-1 text-xs text-disabled","aria-live":"polite",children:[C," / ",L]}):null,N[19]=L,N[20]=C,N[21]=k):k=N[21],N[22]!==I?(j=I("quotaGateCta"),N[22]=I,N[23]=j):j=N[23],N[24]!==D||N[25]!==M||N[26]!==j?(S=(0,n.jsx)("div",{className:"mt-5",children:(0,n.jsx)(u(),{href:M,onClick:D,className:"inline-flex min-h-[44px] items-center justify-center rounded-md bg-accent px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-accent/90",children:j})}),N[24]=D,N[25]=M,N[26]=j,N[27]=S):S=N[27],N[28]!==w||N[29]!==k||N[30]!==S||N[31]!==y||N[32]!==x?(E=(0,n.jsxs)("div",{role:"alertdialog","aria-label":y,className:"mx-auto my-8 max-w-md rounded-lg border border-subtle bg-surface p-6 text-center",children:[g,x,w,k,S]}),N[28]=w,N[29]=k,N[30]=S,N[31]=y,N[32]=x,N[33]=E):E=N[33],E}var g=r(29959),b=r(28737),x=r(73711),_=r(42021);function w(e,t){return(0,_._)(function*(){try{var r,n=yield fetch("/api/v1/papers/forward-citations?doi=".concat(encodeURIComponent(e)),{signal:t,credentials:"include"});if(!n.ok)return null;var a=yield n.json();if(!(null==a?void 0:a.success))return null;return"number"==typeof(null==(r=a.data)?void 0:r.count)?a.data.count:null}catch(e){return null}})()}var k=r(43078),j=[3e3,8e3,2e4,45e3];function S(e){return 0===e.size?e:new Map}var E=r(85527);function N(e,t){return(0,_._)(function*(){try{a=yield fetch("/api/v1/papers/fetch-pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({doi:e}),signal:t})}catch(e){return{kind:"expired"}}if(403===a.status){try{var r=yield a.json();if((null==r||null==(i=r.error)?void 0:i.code)==="QUOTA_EXCEEDED"){var n,a,i,o,l=null!=(o=r.error.details)?o:{};return{kind:"quota_blocked",used:"number"==typeof l.used?l.used:void 0,limit:"number"==typeof l.limit?l.limit:void 0}}}catch(e){return{kind:"expired"}}return{kind:"forbidden"}}if(!a.ok)return{kind:"expired"};if((null!=(n=a.headers.get("content-type"))?n:"").includes("application/pdf"))try{return{kind:"pdf_blob",blob:yield a.blob()}}catch(e){return{kind:"expired"}}try{var c=yield a.json();if("string"==typeof(null==c?void 0:c.cachedUrl)&&c.cachedUrl.length>0)return{kind:"cached_url",url:c.cachedUrl}}catch(e){}return{kind:"expired"}})()}var R=r(71945),C=r(85626),L=r(83387),I=r(52124),T=r(55019);function M(e){var t,r=null==(t=e.state.data)?void 0:t.enrichmentStatus;return("pending"===r||"running"===r)&&3e3}var P=["pt","es","en","fr","de","it","unknown"];function A(e){return"string"==typeof e&&P.includes(e)?e:"unknown"}function O(e,t){return(0,_._)(function*(){try{var r,n,a,i=yield fetch("/api/v1/papers/references?doi=".concat(encodeURIComponent(e)),{signal:t});if(202===i.status)return{kind:"pending"};if(!i.ok)return{kind:"error"};var o=yield i.json(),l=null!=(r=null==o||null==(n=o.data)?void 0:n.references)?r:[];return{kind:"ok",refs:l,paperLanguage:A(null==o||null==(a=o.data)?void 0:a.paperLanguage)}}catch(e){return{kind:"error"}}})()}var D=r(58910),U=r(79064),q=r(35928),F=r(96334),B=r(85362),z=r(96843),V=r(69431),H=r(71937),K=r(7974),G=r(47293),J="citeme:lastStyle";function W(){return window.location.search}function Z(e){return!!(e&&e in G.rY)}var $=r(83160),Q=r(96453);function Y(e){var{reference:t,onClose:r,style:a,paperLanguage:o="unknown",surface:l="pdf_reader_sidebar"}=e,s=(0,c.c)("Reader"),{recordCopy:u}=(0,B.r)(),[d,f]=(0,i.useState)(!1),[v,m]=(0,i.useState)(!1),[p,h]=(0,i.useState)(null),y=(0,i.useRef)(null),g=(0,i.useRef)(null);(0,i.useEffect)(()=>()=>{var e;null==(e=y.current)||e.abort(),g.current&&clearTimeout(g.current)},[]),(0,i.useEffect)(()=>{var e;null==(e=y.current)||e.abort(),g.current&&clearTimeout(g.current),m(!1),h(null),f(!1)},[t.index]),(0,i.useEffect)(()=>{var e=e=>{if("Escape"===e.key){var t=e.target;t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable)||r()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r]);var b=t.authors.map(e=>"".concat(e.family).concat(e.given?", ".concat(e.given):"")).join("; "),x=(0,i.useCallback)(()=>(0,_._)(function*(){null==(e=y.current)||e.abort();var e,r=new AbortController;y.current=r,f(!0),h(null),m(!1);try{var n=yield(0,K.e)(t,a,r.signal,o);if(r.signal.aborted||(yield(0,H.Tv)(n),r.signal.aborted))return;(0,V.S)("reference",{surface:l,style:a}
1),u(),m(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>m(!1),2e3)}catch(e){if(r.signal.aborted||e instanceof Error&&"AbortError"===e.name)return;h((0,Q.u)(e,"Failed to cite"))}finally{r.signal.aborted||f(!1)}})(),[t,a,o,l,u]);return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("button",{type:"button",onClick:r,className:"mb-4 inline-flex items-center gap-2 h-9 px-3 rounded-md border border-accent bg-accent text-sm font-medium text-white shadow-sm hover:bg-accent/90 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2","aria-label":s("backToReferences"),children:[(0,n.jsx)($.N,{className:"w-4 h-4"}),(0,n.jsx)("span",{children:s("backToReferences")})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,n.jsxs)("span",{className:"text-xs text-accent font-semibold",children:["[",t.index+1,"]"]}),(0,n.jsx)("h2",{className:"text-sm font-medium text-accent-900",children:s("referenceLabel")})]}),(0,n.jsxs)("div",{className:"space-y-2 text-sm",children:[t.title&&(0,n.jsx)("p",{className:"font-medium text-accent-900",children:t.title}),b&&(0,n.jsx)("p",{className:"text-muted-foreground",children:b}),(0,n.jsxs)("div",{className:"flex gap-2 text-xs text-muted-foreground",children:[t.year&&(0,n.jsx)("span",{children:t.year}),t.journal&&(0,n.jsxs)("span",{children:["\xb7 ",t.journal]}),t.volume&&(0,n.jsxs)("span",{children:["vol. ",t.volume]})]}),t.doi&&(0,n.jsxs)("p",{className:"text-xs",children:[(0,n.jsxs)("span",{className:"text-muted-foreground",children:[s("doiLabel"),": "]}),(0,n.jsx)("a",{href:"https://doi.org/".concat(encodeURIComponent(t.doi)),target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline",children:t.doi})]})]}),(0,n.jsx)("button",{type:"button",onClick:x,disabled:d,className:"mt-4 block w-full px-3 py-2.5 rounded-md text-sm font-medium text-center transition-all duration-200 disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 ".concat(v?"bg-accent/10 text-accent border border-accent/30":"bg-accent text-white hover:bg-accent/90"),children:v?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 animate-in fade-in-0 zoom-in-95 duration-300",children:[(0,n.jsx)("span",{children:"✓"}),(0,n.jsx)("span",{children:s("copiedToClipboard")})]}):s(d?"copying":"copyCitation")}),p&&(0,n.jsx)("p",{className:"mt-2 text-xs text-destructive",children:s("failedToCite")}),!t.title&&(0,n.jsx)("p",{className:"mt-3 text-xs text-muted-foreground italic",children:t.rawText})]})}var X=r(8158),ee=(0,i.memo)(function(e){var t,r,i,o,l,c,s,u,d,f,v,m,p,h,y,g,b,x,_,w,k,j,S=(0,a.c)(66),{reference:E,citeState:N,isFlashing:R,inLibrary:C,t:L,onSelect:I,onCite:T}=e,M=E.index,P=null==(i=E.authors)||null==(r=i[0])?void 0:r.family,A=P?E.authors.length>1?"".concat(P," et al."):P:null,O=null!=(t=null==(o=E.occurrences)?void 0:o.length)?t:0,D=O>=3,U="flex items-start gap-2 p-2 rounded transition-all ".concat(D?"ring-1 ring-accent/20 bg-accent/5":""," ").concat(R?"!ring-2 !ring-accent !bg-accent/10":"");S[0]!==I||S[1]!==E?(l=()=>I(E),S[0]=I,S[1]=E,S[2]=l):l=S[2],S[3]!==O||S[4]!==M||S[5]!==L?(c=L(O>0?"cycleOccurrenceForRef":"openDetailsForRef",{n:M+1}),S[3]=O,S[4]=M,S[5]=L,S[6]=c):c=S[6];var q=M+1;S[7]!==q?(s=(0,n.jsxs)("span",{className:"text-xs text-accent font-semibold mr-1",children:["[",q,"]"]}),S[7]=q,S[8]=s):s=S[8],S[9]!==A||S[10]!==D||S[11]!==E.year?(u=A&&(0,n.jsxs)("span",{className:"text-accent-900 ".concat(D?"font-semibold":"font-medium"),children:[A,E.year?" ".concat(E.year):""," \xb7"," "]}),S[9]=A,S[10]=D,S[11]=E.year,S[12]=u):u=S[12];var F=E.title||E.rawText||"Untitled";S[13]!==F?(d=(0,n.jsx)("span",{className:"text-accent-900",children:F}),S[13]=F,S[14]=d):d=S[14],S[15]!==A||S[16]!==E.year?(f=!A&&E.year&&(0,n.jsxs)("span",{className:"text-muted-foreground ml-1",children:["(",E.year,")"]}),S[15]=A,S[16]=E.year,S[17]=f):f=S[17],S[18]!==O||S[19]!==L?(v=O>0&&(0,n.jsxs)("span",{className:"ml-1.5 text-[10px] text-accent font-medium align-middle",children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"\xb7 "}),L("citedHere",{count:O})]}),S[18]=O,S[19]=L,S[20]=v):v=S[20],S[21]!==C||S[22]!==L?(m=C&&(0,n.jsxs)("span",{className:"ml-1.5 text-[10px] text-accent font-medium align-middle",title:L("inLibrary"),children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"\xb7 ✓"}),(0,n.jsx)("span",{className:"sr-only",children:L("inLibrary")})]}),S[21]=C,S[22]=L,S[23]=m):m=S[23],S[24]!==v||S[25]!==m||S[26]!==s||S[27]!==u||S[28]!==d||S[29]!==f?(p=(0,n.jsxs)("span",{className:"line-clamp-2 leading-snug",children:[s,u,d,f,v,m]}),S[24]=v,S[25]=m,S[26]=s,S[27]=u,S[28]=d,S[29]=f,S[30]=p):p=S[30],S[31]!==p||S[32]!==l||S[33]!==c?(h=(0,n.jsx)("button",{type:"button",onClick:l,"aria-label":c,className:"text-left flex-1 text-sm min-w-0 rounded px-1 py-0.5 hover:bg-white transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1",children:p}),S[31]=p,S[32]=l,S[33]=c,S[34]=h):h=S[34],S[35]!==M||S[36]!==T?(y=()=>T(M),S[35]=M,S[36]=T,S[37]=y):y=S[37];var B="loading"===N,z=M+1;S[38]!==L||S[39]!==z?(g=L("citeRef",{n:z}),S[38]=L,S[39]=z,S[40]=g):g=S[40];var V="shrink-0 text-xs px-3 py-2 md:py-1.5 rounded-md border bg-white hover:bg-cream-50 disabled:opacity-50 transition-all duration-200 min-w-[68px] focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1 ".concat("copied"===N?"border-accent/40 text-accent bg-accent/5":"border-subtle text-accent-900");return S[41]!==N?(b="loading"===N&&(0,n.jsx)("span",{className:"inline-block",children:"…"}
1),S[41]=N,S[42]=b):b=S[42],S[43]!==N||S[44]!==L?(x="copied"===N&&(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 animate-in fade-in-0 zoom-in-95 duration-300",children:[(0,n.jsx)("span",{children:"✓"}),(0,n.jsx)("span",{children:L("copied")})]}),S[43]=N,S[44]=L,S[45]=x):x=S[45],S[46]!==N||S[47]!==L?(_="error"===N&&L("tryAgain"),S[46]=N,S[47]=L,S[48]=_):_=S[48],S[49]!==N||S[50]!==L?(w="idle"===N&&L("cite"),S[49]=N,S[50]=L,S[51]=w):w=S[51],S[52]!==y||S[53]!==B||S[54]!==g||S[55]!==V||S[56]!==b||S[57]!==x||S[58]!==_||S[59]!==w?(k=(0,n.jsxs)("button",{type:"button",onClick:y,disabled:B,"aria-label":g,className:V,children:[b,x,_,w]}),S[52]=y,S[53]=B,S[54]=g,S[55]=V,S[56]=b,S[57]=x,S[58]=_,S[59]=w,S[60]=k):k=S[60],S[61]!==M||S[62]!==U||S[63]!==h||S[64]!==k?(j=(0,n.jsxs)("li",{"data-ref-row":M,className:U,children:[h,k]}),S[61]=M,S[62]=U,S[63]=h,S[64]=k,S[65]=j):j=S[65],j});function et(e){var t,r,i,o,l,c,s,u=(0,a.c)(45),{t:d,references:f,sortedReferences:v,refsLoading:m,refsError:p,selectedRef:h,forwardCiteCount:y,citeStates:g,libraryMatches:b,sidebarFlashIndex:x,resolvedStyle:_,paperLanguage:w,readerCopySurface:k,localeKey:j,sortBy:S,onSortByChange:E,onCloseDrawer:N,onSelectedRefClose:R,onStyleChange:C,onStyleUpgrade:L,onSelectReference:I,onCiteReference:T}=e;return u[0]!==N||u[1]!==f.length||u[2]!==d?(t=f.length>0&&(0,n.jsxs)("div",{className:"lg:hidden flex items-center justify-between px-4 py-3 border-b border-border bg-white/50 sticky top-0",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-accent-900",children:d("refsCount",{count:f.length})}),(0,n.jsx)("button",{type:"button",onClick:N,className:"h-9 px-3 text-xs text-muted-foreground hover:text-foreground","aria-label":d("close"),children:d("close")})]}),u[0]=N,u[1]=f.length,u[2]=d,u[3]=t):t=u[3],u[4]!==y||u[5]!==d?(r=null!==y&&y>=3&&(0,n.jsx)("div",{className:"px-4 pt-3 pb-2 border-b border-border bg-accent/5",children:(0,n.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:[(0,n.jsx)("span",{className:"text-accent font-semibold",children:d("forwardCites",{count:y})})," \xb7 ",(0,n.jsx)("span",{children:d("forwardCitesSource")})]})}),u[4]=y,u[5]=d,u[6]=r):r=u[6],u[7]!==f.length||u[8]!==m||u[9]!==d?(i=m&&0===f.length&&(0,n.jsx)("div",{className:"flex h-full min-h-[200px] items-center justify-center px-6 py-12",children:(0,n.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,n.jsx)("div",{className:"animate-spin w-6 h-6 border-2 border-accent border-t-transparent rounded-full"}),(0,n.jsx)("p",{className:"text-sm text-accent-900 font-medium",children:d("readingBibliographyShort")})]})}),u[7]=f.length,u[8]=m,u[9]=d,u[10]=i):i=u[10],u[11]!==f.length||u[12]!==p||u[13]!==m||u[14]!==d?(o=!m&&0===f.length&&(0,n.jsx)("div",{className:"flex h-full min-h-[200px] items-center justify-center px-6 py-12",children:(0,n.jsx)("p",{className:"text-sm text-center ".concat(p?"text-destructive":"text-muted-foreground"),children:null!=p?p:d("noBibliography")})}),u[11]=f.length,u[12]=p,u[13]=m,u[14]=d,u[15]=o):o=u[15],u[16]!==g||u[17]!==b||u[18]!==j||u[19]!==T||u[20]!==I||u[21]!==E||u[22]!==C||u[23]!==L||u[24]!==f.length||u[25]!==_||u[26]!==
1h||u[27]!==x||u[28]!==S||u[29]!==v||u[30]!==d?(l=f.length>0&&!h&&(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("header",{className:"mb-4",children:[(0,n.jsx)("h2",{className:"text-base font-serif text-accent-900",children:d("refsCount",{count:f.length})}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:d("refsHint")}),(0,n.jsx)("div",{className:"mt-3",children:(0,n.jsx)(X.StylePicker,{value:_,onChange:C,onUpgradeNeeded:L,locale:j,compact:!0,curatedOnly:!0,planGated:!0,className:"w-full"})}),(0,n.jsxs)("div",{className:"mt-3 flex items-center gap-1 text-[10px]",children:[(0,n.jsx)("button",{type:"button",onClick:()=>E("cited"),className:"px-2 py-0.5 rounded ".concat("cited"===S?"bg-accent/15 text-accent font-medium":"text-muted-foreground hover:text-foreground"),children:d("sortByCited")}),(0,n.jsx)("button",{type:"button",onClick:()=>E("original"),className:"px-2 py-0.5 rounded ".concat("original"===S?"bg-accent/15 text-accent font-medium":"text-muted-foreground hover:text-foreground"),children:d("sortByOriginal")})]})]}),(0,n.jsx)("ul",{className:"space-y-1.5",children:v.map(e=>{var t,r,a,i,o=e.index,l=null!=(t=null==(i=e.occurrences)?void 0:i.length)?t:0;return(0,n.jsx)(ee,{reference:e,citeState:null!=(r=g[o])?r:"idle",isFlashing:x===o,inLibrary:null!=(a=b.get(o))&&a,t:d,onSelect:e=>I(e,l),onCite:T},o)})})]}),u[16]=g,u[17]=b,u[18]=j,u[19]=T,u[20]=I,u[21]=E,u[22]=C,u[23]=L,u[24]=f.length,u[25]=_,u[26]=h,u[27]=x,u[28]=S,u[29]=v,u[30]=d,u[31]=l):l=u[31],u[32]!==R||u[33]!==w||u[34]!==k||u[35]!==_||u[36]!==h?(c=h&&(0,n.jsx)(Y,{reference:h,onClose:R,style:_,paperLanguage:w,surface:k}),u[32]=R,u[33]=w,u[34]=k,u[35]=_,u[36]=h,u[37]=c):c=u[37],u[38]!==t||u[39]!==r||u[40]!==i||u[41]!==o||u[42]!==l||u[43]!==c?(s=(0,n.jsxs)(n.Fragment,{children:[t,r,i,o,l,c]}),u[38]=t,u[39]=r,u[40]=i,u[41]=o,u[42]=l,u[43]=c,u[44]=s):s=u[44],s}var er=r(20414).s7;function en(e){return"application/pdf"===e.type||e.name.endsWith(".pdf")?e.size>er?"too-big":null:"not-pdf"}function ea(e){return(0,_._)(function*(e){var t,n,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null!=(t=i.minChars)?t:500,l=null!=(n=i.pagesToCheck)?n:3;try{for(var{getDocumentProxy:c}=yield r.e(868).then(r.bind(r,868)),s=yield c(new Uint8Array(e.slice(0))),u=s.numPages,d=Math.min(l,u),f=0,v=1;v<=d&&!(f>=o);v++){var m=yield s.getPage(v);for(var p of(yield m.getTextContent()).items){var h="string"==typeof(null==p?void 0:p.str)?p.str:"";h&&(f+=h.replace(/\s+/g,"").length)}}return{hasText:f>=o,charCount:f,pagesScanned:d,pageCount:u,probeFailed:!1}}catch(e){return null==(a=i.onProbeError)||a.call(i,e),{hasText:!0,charCount:0,pagesScanned:0,pageCount:0,probeFailed:!0}}}).apply(this,arguments)}function ei(e,t){return(0,_._)(function*(){var r=null!=(n=t.probe)?n:ea;try{var n,a,i=yield e.arrayBuffer(),o=yield r(i,{onProbeError:r=>{var n;null==(n=t.trackEvent)||n.call(t,"pdf_probe_error",{surface:t.surface,error:(0,Q.u)(r).slice(0,120),file_size_kb:Math.round(e.size/1024)})}});if(!o.hasText&&!o.probeFailed)return null==(a=t.trackEvent)||a.call(t,"pdf_likely_scanned_detected",{surface:t.surface,char_count:o.charCount,page_count:o.pageCount,file_size_kb:Math.round(e.size/1024)}),{allowOcrHint:!0,buffer:i};return{allowOcrHint:!1,buffer:i}}catch(e){return{allowOcrHint:!1,buffer:null}}})()}var eo=r(8387),el=["pending","running","done","failed"];function ec(e,t){return(0,_._)(function*(){if(403===e.status&&"library"!==t){try{var r=yield e.json();if((null==r||null==(n=r.error)?void 0:n.code)==="QUOTA_EXCEEDED"){var n,a,i=null!=(a=r.error.details)?a:{};return{kind:"quota_blocked",used:"number"==typeof i.used?i.used:void 0,limit:"number"==typeof i.limit?i.limit:void 0}}}catch(e){}return{kind:"http_error",status:403}}if(e.ok){var o,l,c,s,u,d,f,v,m=yield e.json(),p=null!=(l=null==m||null==(c=m.data)?void 0:c.references)?l:[],h="string"==typeof(null==m||null==(s=m.data)?void 0:s.paperLanguage)?m.data.paperLanguage:"unknown";return{kind:"success",refs:p,paperLanguage:A(null==m||null==(u=m.data)?void 0:u.paperLanguage),paperLanguageRaw:h,signedUrl:"string"==typeof(null==m||null==(d=m.data)?void 0:d.signedUrl)&&m.data.signedUrl.length>0?m.data.signedUrl:null,enrichmentStatus:"string"==typeof(o=null==m||null==(f=m.data)?void 0:f.enrichmentStatus)&&el.includes(o)?o:void 0,extractionStatus:"string"==typeof(null==m||null==(v=m.data)?void 0:v.extractionStatus)?m.data.extractionStatus:void 0}}try{var y,g,b=yield e.json();y="string"==typeof(null==b||null==(g=b.error)?void 0:g.code)?b.error.code:void 0}catch(e){}return{kind:"http_error",status:e.status,code:y}})()}var es=r(76123),eu=r(81039);function ed(e){var t,r,i,o,l,c,s,u,d,f,v,m,p,h,y,g=(0,a.c)(36),{t:b,uploadError:x,resumeMeta:_,fileInputRef:w,onDrop:k,onDragOver:j,onInputChange:S,onResume:E,onDismissResume:N}=e;return(g[0]!==b?(o=b("label"),g[0]=b,g[1]=o):o=g[1],g[2]!==o?(l=(0,n.jsx)("p",{className:"text-xs tracking-wider up
1percase text-accent mb-3 font-medium",children:o}),g[2]=o,g[3]=l):l=g[3],g[4]!==b?(c=b("headline"),g[4]=b,g[5]=c):c=g[5],g[6]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsx)("br",{}),g[6]=s):s=g[6],g[7]!==b?(u=b("headlineAccent"),g[7]=b,g[8]=u):u=g[8],g[9]!==c||g[10]!==u?(d=(0,n.jsxs)("h1",{className:"text-4xl md:text-5xl font-serif text-accent-900 leading-tight mb-4",children:[c,s,u]}),g[9]=c,g[10]=u,g[11]=d):d=g[11],g[12]!==b?(f=b("tagline"),g[12]=b,g[13]=f):f=g[13],g[14]!==f?(v=(0,n.jsx)("p",{className:"text-base text-muted-foreground max-w-prose leading-relaxed",children:f}),g[14]=f,g[15]=v):v=g[15],g[16]!==l||g[17]!==d||g[18]!==v?(m=(0,n.jsxs)("header",{className:"mb-10",children:[l,d,v]}),g[16]=l,g[17]=d,g[18]=v,g[19]=m):m=g[19],g[20]!==w||g[21]!==j||g[22]!==k||g[23]!==S||g[24]!==b||g[25]!==x?(p=(0,n.jsx)(eu.s,{t:b,uploadError:x,fileInputRef:w,onDrop:k,onDragOver:j,onInputChange:S}),g[20]=w,g[21]=j,g[22]=k,g[23]=S,g[24]=b,g[25]=x,g[26]=p):p=g[26],g[27]!==N||g[28]!==E||g[29]!==_||g[30]!==b)?(h=_&&(0,n.jsxs)("div",{className:"mt-10 pt-8 border-t border-accent/10",children:[(0,n.jsx)("p",{className:"text-xs tracking-wider uppercase text-muted-foreground mb-4 font-medium",children:b("resumeReadingLabel")}),(0,n.jsxs)("div",{className:"relative flex items-center gap-4 p-4 rounded-lg border border-accent/15 hover:border-accent/40 hover:bg-cream-50 transition-colors focus-within:ring-2 focus-within:ring-accent focus-within:ring-offset-2",children:[(0,n.jsxs)("button",{type:"button",onClick:E,className:"flex items-center gap-4 flex-1 min-w-0 text-left focus:outline-none",children:[(0,n.jsx)("div",{className:"shrink-0 w-10 h-12 rounded border border-accent/20 bg-white flex items-center justify-center",children:(0,n.jsx)("span",{className:"text-[9px] font-serif text-accent-900/60",children:"PDF"})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-accent-900 truncate",title:_.name,children:_.name}),(0,n.jsxs)("p",{className:"text-xs text-muted-foreground mt-0.5",children:[b("resumeReadingMeta",{size:(t=_.size)>=1048576?"".concat((t/1048576).toFixed(1)," MB"):t>=1024?"".concat(Math.round(t/1024)," KB"):"".concat(t," B"),when:(r=Date.now()-_.savedAt,(i=Math.floor(r/6e4))<1?b("timeJustNow"):i<60?b("timeMinutesAgo",{count:i}):b("timeHoursAgo",{count:Math.floor(i/60)}))}),null!=_.refCount&&_.refCount>0&&(0,n.jsxs)(n.Fragment,{children:[" \xb7 ",(0,n.jsx)("span",{className:"text-accent font-medium",children:b("refsCount",{count:_.refCount})})]})]})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs text-accent font-medium",children:b("resumeReadingAction")})]}),(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),N()},"aria-label":b("resumeReadingDismiss"),title:b("resumeReadingDismiss"),className:"shrink-0 w-7 h-7 inline-flex items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground text-base leading-none",children:"\xd7"})]})]}),g[27]=N,g[28]=E,g[29]=_,g[30]=b,g[31]=h):h=g[31],g[32]!==p||g[33]!==h||g[34]!==m?(y=(0,n.jsxs)("div",{className:"max-w-3xl mx-auto px-4 py-12 md:py-16",children:[m,p,h]}),g[32]=p,g[33]=h,g[34]=m,g[35]=y):y=g[35],y}function ef(e){var t,r,i,o,l,c,s,u,d,f=(0,a.c)(21),{t:v,onSearchAgain:m,onReopenDropzone:p}=e;return f[0]!==v?(t=v("sessionExpired"),f[0]=v,f[1]=t):t=f[1],f[2]!==t?(r=(0,n.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:t}),f[2]=t,f[3]=r):r=f[3],f[4]!==v?(i=v("searchAgain"),f[4]=v,f[5]=i):i=f[5],f[6]!==m||f[7]!==i?(o=(0,n.jsx)("button",{type:"button",onClick:m,className:"text-sm text-accent hover:underline",children:i}),f[6]=m,f[7]=i,f[8]=o):o=f[8],f[9]===Symbol.for("react.memo_cache_sentinel")?(l=(0,n.jsx)("span",{className:"text-muted-foreground text-xs",children:"\xb7"}),f[9]=l):l=f[9],f[10]!==v?(c=v("dropzoneTitle"),f[10]=v,f[11]=c):c=f[11],f[12]!==p||f[13]!==c?(s=(0,n.jsx)("button",{type:"button",onClick:p,className:"text-sm text-accent hover:underline",children:c}),f[12]=p,f[13]=c,f[14]=s):s=f[14],f[15]!==o||f[16]!==s?(u=(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row items-center gap-3",children:[o,l,s]}),f[15]=o,f[16]=s,f[17]=u):u=f[17],f[18]!==r||f[19]!==u?(d=(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-5 px-4",children:[r,u]}),f[18]=r,f[19]=u,f[20]=d):d=f[20],d}var ev=e=>window.matchMedia(e),em=(0,o.default)(()=>Promise.all([r.e(54542),r.e(45853),r.e(51945),r.e(874)]).then(r.bind(r,874)).then(e=>e.ReaderLoadedView),{loadableGenerated:{webpack:()=>[874]},loading:()=>(0,n.jsx)("div",{className:"min-h-[60vh] animate-pulse bg-surface","aria-hidden":"true"}),ssr:!1});function ep(e){var t,r,o,s,u,d,f,m,p,h,P,G,$,Y,X,ee,er,ea,el,eu,ep,eb,ex,e_,ew,ek,ej,eS,eE,eN,eR,eC,eL,eI,eT,eM,eP,eA,eO,eD,eU,eq,eF,eB,ez,eV=(0,a.c)(146);eV[0]!==e?(p=void 0===e?{}
1:e,eV[0]=e,eV[1]=p):p=eV[1];var{libraryCitation:eH}=p,eK=(0,c.c)("Reader"),{user:eG}=(0,b.A)(),eJ=null==eG?void 0:eG.id,eW=(0,l.useRouter)(),eZ=(0,v.u)("/pricing"),e$=(0,l.useSearchParams)();eV[2]!==eH?(h=()=>eH?"library":"idle",eV[2]=eH,eV[3]=h):h=eV[3];var[eQ,eY]=(0,i.useState)(h),[eX,e0]=(0,i.useState)(null),[e1,e2]=(0,i.useState)(null),[e4,e3]=(0,i.useState)(null),[e5,e7]=(0,i.useState)(!1),[e6,e9]=(0,i.useState)(null),[e8,te]=(0,i.useState)(1.5);eV[4]===Symbol.for("react.memo_cache_sentinel")?(P=[],eV[4]=P):P=eV[4];var[tt,tr]=(0,i.useState)(P),[tn,ta]=(0,i.useState)("unknown"),[ti,to]=(0,i.useState)(null),[tl,tc]=(0,i.useState)(!1),[ts,tu]=(0,i.useState)(null),[td,tf]=(0,i.useState)(null),[tv,tm]=(0,i.useState)("cited"),tp=(0,i.useRef)(null),th=(0,i.useRef)(null),ty=(0,i.useRef)(null),tg=(0,i.useRef)(null),tb=(0,i.useRef)(null);eV[5]===Symbol.for("react.memo_cache_sentinel")?(G=()=>te(eg),eV[5]=G):G=eV[5];var tx=G;eV[6]===Symbol.for("react.memo_cache_sentinel")?($=()=>te(ey),eV[6]=$):$=eV[6];var t_=$;eV[7]===Symbol.for("react.memo_cache_sentinel")?(Y=()=>te(1.5),eV[7]=Y):Y=eV[7];var tw=Y;eV[8]!==e$?(X=e$.get("doi"),eV[8]=e$,eV[9]=X):X=eV[9];var tk=X;eV[10]!==eH||eV[11]!==eQ||eV[12]!==eX||eV[13]!==eK?(ee={t:eK,mode:eQ,pdfUrl:eX,libraryCitation:eH,setPdfUrl:e0,setReferences:tr,setRefsLoading:tc,setRefsError:tu},eV[10]=eH,eV[11]=eQ,eV[12]=eX,eV[13]=eK,eV[14]=ee):ee=eV[14];var{setLibraryHasDocument:tj,refetchLibraryPdfUrl:tS,deletePdfMutation:tE,isLibraryPdfLoading:tN}=function(e){var t,r,n,o,l,c,s,u,d,f,v,m,p,h,y,g,b,x,w,k,j,S,E,N=(0,a.c)(19),{t:P,mode:A,pdfUrl:O,libraryCitation:D,setPdfUrl:U,setReferences:q,setRefsLoading:F,setRefsError:B}=e;N[0]!==(null==D?void 0:D.hasExistingDocument)?(x=()=>!!(null==D?void 0:D.hasExistingDocument),N[0]=null==D?void 0:D.hasExistingDocument,N[1]=x):x=N[1];var[z,V]=(0,i.useState)(x),H=(t=null!=(g=null==D?void 0:D.id)?g:"",r=!!D&&z,s=(0,a.c)(9),u=void 0!==r&&r,s[0]===Symbol.for("react.memo_cache_sentinel")?(n={operation:"pdf.load",userImpact:"blocking",skipAuthRedirect:!0},s[0]=n):n=s[0],s[1]!==t?(o=I.lH.pdfReader.url(t),s[1]=t,s[2]=o):o=s[2],s[3]!==t?(l=()=>(0,_._)(function*(){var e=yield fetch("/api/v1/library/".concat(t,"/pdf/url"),{credentials:"include"});if(!e.ok)throw yield T.hD.fromResponse(e);return(yield e.json()).data})(),s[3]=t,s[4]=l):l=s[4],s[5]!==u||s[6]!==o||s[7]!==l?(c={meta:n,queryKey:o,queryFn:l,enabled:u,refetchInterval:M,staleTime:18e5},s[5]=u,s[6]=o,s[7]=l,s[8]=c):c=s[8],(0,R.I)(c)),K=(d=null!=(b=null==D?void 0:D.id)?b:"",h=(0,a.c)(9),y=(0,C.jE)(),h[0]===Symbol.for("react.memo_cache_sentinel")?(f={operation:"pdf.delete",userImpact:"blocking"},h[0]=f):f=h[0],h[1]!==d?(v=()=>(0,_._)(function*(){var e=yield fetch("/api/v1/library/".concat(d,"/pdf"),{method:"DELETE",credentials:"include"});if(!e.ok)throw yield T.hD.fromResponse(e)})(),h[1]=d,h[2]=v):v=h[2],h[3]!==d||h[4]!==y?(m=()=>y.removeQueries({queryKey:I.lH.pdfReader.url(d)}),h[3]=d,h[4]=y,h[5]=m):m=h[5],h[6]!==v||h[7]!==m?(p={meta:f,mutationFn:v,onSuccess:m},h[6]=v,h[7]=m,h[8]=p):p=h[8],(0,L.n)(p));N[2]!==D?(w=()=>{D&&V(D.hasExistingDocument)},k=[D],N[2]=D,N[3]=w,N[4]=k):(w=N[3],k=N[4]),(0,i.useEffect)(w,k),N[5]!==A||N[6]!==H.data||N[7]!==U||N[8]!==q||N[9]!==B||N[10]!==F||N[11]!==P?(j=()=>{if("library"===A&&H.data){H.data.signedUrl&&U(H.data.signedUrl);var e,t=H.data.enrichmentStatus;if("pending"===t||"running"===t){F(!0),B(null),q([]);return}if("failed"===t){F(!1),q([]),B(P("refsExtractionFailed"));return}F(!1),B(null),q(null!=(e=H.data.references)?e:[])}},S=[A,H.data,U,q,F,B,P],N[5]=A,N[6]=H.data,N[7]=U,N[8]=q,N[9]=B,N[10]=F,N[11]=P,N[12]=j,N[13]=S):(j=N[12],S=N[13]),(0,i.useEffect)(j,S);var G="library"===A&&z&&H.isLoading&&!O;return N[14]!==K||N[15]!==G||N[16]!==z||N[17]!==H.refetch?(E={libraryHasDocument:z,setLibraryHasDocument:V,refetchLibraryPdfUrl:H.refetch,deletePdfMutation:K,isLibraryPdfLoading:G},N[14]=K,N[15]=G,N[16]=z,N[17]=H.refetch,N[18]=E):E=N[18],E}(ee),tR="library"===eQ?"pdf_reader_library":"upload"===eQ?"pdf_reader_upload":"pdf_reader_oa";eV[15]!==eH||eV[16]!==eQ?(er={mode:eQ,libraryCitation:eH}
1,eV[15]=eH,eV[16]=eQ,eV[17]=er):er=eV[17],function(e){var t,r,n,o,l=(0,a.c)(8),{mode:c,libraryCitation:s,trackOpened:u}=e,d=void 0===u?D.Kg:u,f=(0,i.useRef)(!1);l[0]!==s||l[1]!==d?(t=()=>{!f.current&&s&&(f.current=!0,d({citation_id:s.id,surface:"library",preset:"library"}))},r=[s,d],l[0]=s,l[1]=d,l[2]=t,l[3]=r):(t=l[2],r=l[3]),(0,i.useEffect)(t,r),l[4]!==c||l[5]!==d?(n=()=>{f.current||("oa"===c?(f.current=!0,d({surface:"oa",preset:"neutral"})):"upload"===c&&(f.current=!0,d({surface:"upload",preset:"neutral"})))},o=[c,d],l[4]=c,l[5]=d,l[6]=n,l[7]=o):(n=l[6],o=l[7]),(0,i.useEffect)(n,o)}(er);var tC=!!eH;eV[18]!==tk||eV[19]!==tC?(ea={doiParam:tk,hasLibraryCitation:tC,blobUrlRef:tp,setPdfUrl:e0,setDoi:e3,setMode:eY,setQuotaGate:e9,setExpired:e7},eV[18]=tk,eV[19]=tC,eV[20]=ea):ea=eV[20],function(e){var t,r,n=(0,a.c)(12),{doiParam:o,hasLibraryCitation:l,blobUrlRef:c,setPdfUrl:s,setDoi:u,setMode:d,setQuotaGate:f,setExpired:v,consumeStorage:m,fetchOaPdf:p}=e,h=void 0===m?E.u:m,y=void 0===p?N:p,g=(0,i.useRef)(!1);n[0]!==c||n[1]!==h||n[2]!==o||n[3]!==y||n[4]!==l||n[5]!==u||n[6]!==v||n[7]!==d||n[8]!==s||n[9]!==f?(t=()=>{if(!g.current){if(l){g.current=!0;return}g.current=!0;var e=h();if(e){s(e.url),e.url.startsWith("blob:")&&(c.current=e.url),e.doi&&u(e.doi),d("oa");return}var t=!1,r=new AbortController;return(0,_._)(function*(){if(o){var e=yield y(o,r.signal);if(t)return;switch(e.kind){case"quota_blocked":return void f({surface:"oa",used:e.used,limit:e.limit});case"pdf_blob":var n=URL.createObjectURL(e.blob);if(t)return void URL.revokeObjectURL(n);c.current=n,s(n),u(o),d("oa");return;case"cached_url":s(e.url),u(o),d("oa");return;case"forbidden":case"expired":return void v(!0)}}t||d("idle")})(),()=>{t=!0,r.abort()}}},r=[o,l,c,s,u,d,f,v,h,y],n[0]=c,n[1]=h,n[2]=o,n[3]=y,n[4]=l,n[5]=u,n[6]=v,n[7]=d,n[8]=s,n[9]=f,n[10]=t,n[11]=r):(t=n[10],r=n[11]),(0,i.useEffect)(t,r)}(ea),eV[21]===Symbol.for("react.memo_cache_sentinel")?(el=()=>()=>{var e;tp.current&&URL.revokeObjectURL(tp.current),null==(e=th.current)||e.abort()},eu=[],eV[21]=el,eV[22]=eu):(el=eV[21],eu=eV[22]),(0,i.useEffect)(el,eu);var tL="oa"===eQ;eV[23]!==e4||eV[24]!==tL?(ep={enabled:tL,doi:e4,setRefsLoading:tc,setReferences:tr,setRefsError:tu,setPaperLanguage:ta},eV[23]=e4,eV[24]=tL,eV[25]=ep):ep=eV[25],function(e){var{enabled:t,doi:r,setRefsLoading:n,setReferences:a,setRefsError:o,setPaperLanguage:l,fetchRefs:c=O}=e;(0,i.useEffect)(()=>{if(t&&r){var e=!1,i=null,s=0,u=Date.now(),d=()=>(0,_._)(function*(){n(!0);var t=yield c(r);if(!e)switch(t.kind){case"ok":a(t.refs),o(null),l(t.paperLanguage),n(!1);return;case"pending":var{delayMs:f}=function(e){var{attempt:t,pollStartedAt:r,now:n}=e;if((null!=n?n:Date.now())-r>=24e4)return{delayMs:null};var a=j[t];return{delayMs:null!=a?a:3e4}}({attempt:s,pollStartedAt:u});null!==f?(s++,i=setTimeout(()=>{e||d()},f)):n(!1);return;case"error":n(!1);return}})();return d(),()=>{e=!0,i&&clearTimeout(i)}}},[t,r,n,a,o,l,c])}(ep),eV[26]!==eH||eV[27]!==eQ||eV[28]!==tS||eV[29]!==tj||eV[30]!==eK||eV[31]!==eJ?(eb={t:eK,userId:eJ,mode:eQ,libraryCitation:eH,refetchLibraryPdfUrl:tS,blobUrlRef:tp,uploadAbortRef:th,currentDocumentIdRef:ty,setUploadError:tf,setRefsError:tu,setReferences:tr,setSelectedRef:to,setPaperLanguage:ta,setPdfUrl:e0,setFileName:e2,setMode:eY,setRefsLoading:tc,setLibraryHasDocument:tj,setQuotaGate:e9},eV[26]=eH,eV[27]=eQ,eV[28]=tS,eV[29]=tj,eV[30]=eK,eV[31]=eJ,eV[32]=eb):eb=eV[32];var{handleFile:tI,handleDrop:tT,handleDragOver:tM,handleInputChange:tP}=function(e){var{t,userId:r,mode:n,libraryCitation:a,refetchLibraryPdfUrl:o,blobUrlRef:l,uploadAbortRef:c,currentDocumentIdRef:s,setUploadError:u,setRefsError:d,setReferences:f,setSelectedRef:v,setPaperLanguage:m,setPdfUrl:p,setFileName:h,setMode:y,setRefsLoading:g,setLibraryHasDocument:b,setQuotaGate:x,validatePdf:w=en,probePdf:j=ei,startExtraction:S=eo.x,classifyResponse:E=ec,saveToIdb:N=U.savePdfLocally,touchIdbTimestamp:R=U.touchStoredPdfTimestamp,persistIdbReferences:C=U.persistStoredPdfReferences,emitEvent:L=es.trackEvent,emitUploadStarted:I=D.Un}=e,T=(0,i.useCallback)((e,i)=>(0,_._)(function*(){var _=null==(U=null==i?void 0:i.persist)||U,T=null==i?void 0:i.prebufferedBuffer,M=w(e);if("not-pdf"===M)return void u(t("errorNotPdf"));if("too-big"===M)return void u(t("errorTooBig"));u(null),d(null),f([]),v(null),m("unknown"),"library"===n&&a?I({citation_id:a.id,surface:"library"}):I({surface:"upload"}),null==(q=c.current)||q.abort();var P=new AbortController;c.current=P,l.current&&URL.revokeObjectURL(l.current);var A=URL.createObjectURL(e);l.current=A,p(A),h(e.name),"library"!==n&&y("upload");var{allowOcrHint:O,buffer:D}=yield j(e,{surface:"library"===n?"library":"upload",trackEvent:L});if(_&&"library"!==n&&e.size<=0x1400000)try{var U,q,F,B=crypto.randomUUID();s.current=B;var V=null!=(F=null!=T?T:D)?F:yield e.arrayBuffer();yield N(e.name,V,r,B)}catch(e){}else!_&&s.current&&R(r,s.current);g(!0);var H=S({file:e,mode:"library"===n&&a?"library":"upload",libraryCitationId:null==a?void 0:a.id,allowOcrHint:O,signal:P.signal}),K=!1;try{var G=yield H,J=yield E(G,"library"===n?"library":"upload");if("quota_blocked"===J.kind)return void x({surface:"upload",used:J.used,limit:J.limit});if("success"===J.kind){if(m(J.paperLanguage),"library"===n){if(b(!0),J.signedUrl&&(l.current&&(URL.revokeObjectURL(l.current),l.current=null),p(J.signedUrl)),"pending"===J.enrichmentStatus||"running"===J.enrichmentStatus){f([]),d(null),K=!0,o();return}if("failed"===J.enrichmentStatus){f([]),d(t("refsExtractionFailed"));return}}f(J.refs),"error"===J.extractionStatus?(d(t("refsExtractionFailed")),L("pdf_reader_extract_error",{surface:"library"===n?"library":"upload",status:"extraction_error",file_size_kb:Math.round(e.size/1024)})):d(null),"library"!==n&&J.refs.length>0&&e.size<=0x1400000&&s.current&&C(r,s.current,e.name,J.refs,J.paperLanguageRaw);return}d(t("refsExtractionFailed")),L("pdf_reader_extract_error",(0,z._)((0,k._)({surface:"library"===n?"library":"upload",status:J.status}
1,J.code&&{code:J.code}),{file_size_kb:Math.round(e.size/1024)}))}catch(r){if(r instanceof Error&&"AbortError"===r.name)return;d(t("refsExtractionFailed")),L("pdf_reader_extract_error",{surface:"library"===n?"library":"upload",status:"network_error",error:(0,Q.u)(r).slice(0,120),file_size_kb:Math.round(e.size/1024)})}finally{P.signal.aborted||K||g(!1)}})(),[t,r,n,a,o,l,c,s,u,d,f,v,m,p,h,y,g,b,x,w,j,S,E,N,R,C,L,I]),M=(0,i.useCallback)(e=>{e.preventDefault();var t=e.dataTransfer.files[0];t&&T(t)},[T]),P=(0,i.useCallback)(e=>{e.preventDefault()},[]),A=(0,i.useCallback)(e=>{var t,r=null==(t=e.target.files)?void 0:t[0];r&&T(r)},[T]);return{handleFile:T,handleDrop:M,handleDragOver:P,handleInputChange:A}}(eb),tA="idle"===eQ&&!eH;eV[33]!==tI||eV[34]!==tA||eV[35]!==eJ?(ex={userId:eJ,enabled:tA,blobUrlRef:tp,currentDocumentIdRef:ty,handleFile:tI,setPdfUrl:e0,setFileName:e2,setMode:eY,setReferences:tr,setPaperLanguage:ta,setRefsLoading:tc,setUploadError:tf,setRefsError:tu,setSelectedRef:to},eV[33]=tI,eV[34]=tA,eV[35]=eJ,eV[36]=ex):ex=eV[36];var{resumeMeta:tO,handleResume:tD,handleDismissResume:tU}=function(e){var t,r,n,o,l,c=(0,a.c)(29),{userId:s,enabled:u,blobUrlRef:d,currentDocumentIdRef:f,handleFile:v,setPdfUrl:m,setFileName:p,setMode:h,setReferences:y,setPaperLanguage:g,setRefsLoading:b,setUploadError:x,setRefsError:w,setSelectedRef:k,loadStoredPdf:j,peekStoredMeta:S,clearStored:E,touchStoredTimestamp:N}=e,R=void 0===j?U.loadLocalPdf:j,C=void 0===S?U.getStoredPdfMeta:S,L=void 0===E?U.clearLocalPdf:E,I=void 0===N?U.touchStoredPdfTimestamp:N,[T,M]=(0,i.useState)(null);c[0]!==u||c[1]!==C||c[2]!==s?(t=()=>{if(u){var e=!1;return C(s).then(t=>{e||M(t)}),()=>{e=!0}}},r=[u,s,C],c[0]=u,c[1]=C,c[2]=s,c[3]=t,c[4]=r):(t=c[3],r=c[4]),(0,i.useEffect)(t,r),c[5]!==d||c[6]!==f||c[7]!==v||c[8]!==R||c[9]!==p||c[10]!==h||c[11]!==g||c[12]!==m||c[13]!==y||c[14]!==w||c[15]!==b||c[16]!==k||c[17]!==x||c[18]!==I||c[19]!==s?(n=()=>(0,_._)(function*(){var e,t=(e=yield R(s))?Array.isArray(e.references)&&e.references.length>0?{kind:"fast-path",stored:e,references:e.references,paperLanguage:A(e.paperLanguage)}:{kind:"fallback",stored:e}:{kind:"no-stored"};if("no-stored"===t.kind)return void M(null);var{stored:r}=t;if(f.current=r.documentId,"fast-path"===t.kind){d.current&&URL.revokeObjectURL(d.current);var n=new Blob([r.buffer],{type:"application/pdf"}),a=URL.createObjectURL(n);d.current=a,m(a),p(r.name),h("upload"),y(t.references),g(t.paperLanguage),b(!1),x(null),w(null),k(null),I(s,r.documentId);return}var i=new File([r.buffer],r.name,{type:"application/pdf"});yield v(i,{persist:!1,prebufferedBuffer:r.buffer})})(),c[5]=d,c[6]=f,c[7]=v,c[8]=R,c[9]=p,c[10]=h,c[11]=g,c[12]=m,c[13]=y,c[14]=w,c[15]=b,c[16]=k,c[17]=x,c[18]=I,c[19]=s,c[20]=n):n=c[20];var P=n;c[21]!==L||c[22]!==T||c[23]!==s?(o=()=>(0,_._)(function*(){T&&(yield L(s,T.documentId)),M(null)})(),c[21]=L,c[22]=T,c[23]=s,c[24]=o):o=c[24];var O=o;return c[25]!==O||c[26]!==P||c[27]!==T?(l={resumeMeta:T,handleResume:P,handleDismissResume:O},c[25]=O,c[26]=P,c[27]=T,c[28]=l):l=c[28],l}(ex);eV[37]!==tj||eV[38]!==eJ?(e_={userId:eJ,blobUrlRef:tp,uploadAbortRef:th,currentDocumentIdRef:ty,fileInputRef:tb,setPdfUrl:e0,setFileName:e2,setReferences:tr,setSelectedRef:to,setUploadError:tf,setRefsError:tu,setRefsLoading:tc,setPaperLanguage:ta,setDoi:e3,setMode:eY,setLibraryHasDocument:tj},eV[37]=tj,eV[38]=eJ,eV[39]=e_):e_=eV[39];var{handleReset:tq,handleLibraryReset:tF}=function(e){var t,r,n,i=(0,a.c)(32),{userId:o,blobUrlRef:l,uploadAbortRef:c,currentDocumentIdRef:s,fileInputRef:u,setPdfUrl:d,setFileName:f,setReferences:v,setSelectedRef:m,setUploadError:p,setRefsError:h,setRefsLoading:y,setPaperLanguage:g,setDoi:b,setMode:x,setLibraryHasDocument:_,clearStored:w}=e,k=void 0===w?U.clearLocalPdf:w;i[0]!==l||i[1]!==k||i[2]!==s||i[3]!==u||i[4]!==b||i[5]!==f||i[6]!==x||i[7]!==g||i[8]!==d||i[9]!==v||i[10]!==h||i[11]!==y||i[12]!==m||i[13]!==p||i[14]!==c||i[15]!==o?(t=()=>{var e;l.current&&URL.revokeObjectURL(l.current),l.current=null,null==(e=c.current)||e.abort(),s.current&&(k(o,s.current),s.current=null),d(null),f(null),v([]),m(null),p(null),h(null),y(!1),g("unknown"),b(null),x("idle"),u.current&&(u.current.value="")},i[0]=l,i[1]=k,i[2]=s,i[3]=u,i[4]=b,i[5]=f,i[6]=x,i[7]=g,i[8]=d,i[9]=v,i[10]=h,i[11]=y,i[12]=m,i[13]=p,i[14]=c,i[15]=o,i[16]=t):t=i[16];var j=t;i[17]!==l||i[18]!==u||i[19]!==_||i[20]!==g||i[21]!==d||i[22]!==v||i[23]!==h||i[24]!==y||i[25]!==m||i[26]!==p||i[27]!==c?(r=()=>{var e;l.current&&URL.revokeObjectURL(l.current),l.current=null,null==(e=c.current)||e.abort(),d(null),v([]),m(null),p(null),h(null),y(!1),g("unknown"),_(!1),u.current&&(u.current.value="")},i[17]=l,i[18]=u,i[19]=_,i[20]=g,i[21]=d,i[22]=v,i[23]=h,i[24]=y,i[25]=m,i[26]=p,i[27]=c,i[28]=r):r=i[28];var S=r;return i[29]!==S||i[30]!==j?(n={handleReset:j,handleLibraryReset:S},i[29]=S,i[30]=j,i[31]=n):n=i[31],n}(e_);eV[40]!==tE||eV[41]!==tF||eV[42]!==eH||eV[43]!==eQ?(ew=()=>{"library"===eQ&&eH&&tE.mutate(void 0,{onSuccess:tF})},eV[40]=tE,eV[41]=tF,eV[42]=eH,eV[43]=eQ,eV[44]=ew):ew=eV[44];var tB=ew,{sidebarFlashIndex:tz,flashReferenceRow:tV}=function(){var e,t,r,n,o,l,c,s=(0,a.c)(15);void 0!==s[0]?(e={},s[0]=void 0,s[1]=e):e=s[1];var{flashMs:u,ownerDocument:d,requestFrame:f}=e,v=void 0===u?1500:u;
1s[2]!==d?(t=void 0===d?"u"<typeof document?null:document:d,s[2]=d,s[3]=t):t=s[3];var m=t;s[4]!==f?(r=void 0===f?window.requestAnimationFrame.bind(window):f,s[4]=f,s[5]=r):r=s[5];var p=r,[h,y]=(0,i.useState)(null),g=(0,i.useRef)(null);s[6]!==v||s[7]!==m||s[8]!==p?(n=e=>{g.current&&clearTimeout(g.current),p(()=>{var t=null==m?void 0:m.querySelector('[data-ref-row="'.concat(e,'"]'));if(t){var r=t.getBoundingClientRect();r.width>0&&r.height>0&&(y(e),t.scrollIntoView({behavior:"smooth",block:"center"}),g.current=setTimeout(()=>y(null),v))}})},s[6]=v,s[7]=m,s[8]=p,s[9]=n):n=s[9];var b=n;return s[10]===Symbol.for("react.memo_cache_sentinel")?(o=()=>()=>{g.current&&clearTimeout(g.current)},l=[],s[10]=o,s[11]=l):(o=s[10],l=s[11]),(0,i.useEffect)(o,l),s[12]!==b||s[13]!==h?(c={sidebarFlashIndex:h,flashReferenceRow:b},s[12]=b,s[13]=h,s[14]=c):c=s[14],c}(),tH=((u=(0,a.c)(6))[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Map,u[0]=t):t=u[0],d=(0,i.useRef)(t),u[1]!==tg?(r=(e,t)=>{var r,n,a=function(e){var{lastScrolledIndex:t,totalOccurrences:r}=e;return r<=0?null:(t+1)%r}({lastScrolledIndex:null!=(r=d.current.get(e))?r:-1,totalOccurrences:t});if(null===a)return!1;var i=null==(n=tg.current)?void 0:n.scrollToRefOccurrence(e,a);return!!i&&!!i.scrolled&&(d.current.set(e,i.actualIdx),!0)},u[1]=tg,u[2]=r):r=u[2],f=r,u[3]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{d.current.clear()},u[3]=o):o=u[3],u[4]!==tt?(s=[tt],u[4]=tt,u[5]=s):s=u[5],(0,i.useEffect)(o,s),f),tK=function(e){var t,r,n,o=(0,a.c)(6);void 0!==o[0]?(t={},o[0]=void 0,o[1]=t):t=o[1];var{fetchCount:l}=t,c=void 0===l?w:l,[s,u]=(0,i.useState)(null);return o[2]!==e||o[3]!==c?(r=()=>{if(!e)return void u(null);u(null);var t=new AbortController;return(0,_._)(function*(){var r=yield c(e,t.signal);t.signal.aborted||u(r)})(),()=>t.abort()},n=[e,c],o[2]=e,o[3]=c,o[4]=r,o[5]=n):(r=o[4],n=o[5]),(0,i.useEffect)(r,n),s}(e4),{libraryMatches:tG,markReferenceInLibrary:tJ}=function(e){var t,r,n,o,l,c,s=(0,a.c)(11);void 0!==s[0]?(t={},s[0]=void 0,s[1]=t):t=s[1];var{maxChunkSize:u,fetchImpl:d}=t,f=void 0===u?50:u,v=void 0===d?fetch:d;s[2]===Symbol.for("react.memo_cache_sentinel")?(r=new Map,s[2]=r):r=s[2];var[m,p]=(0,i.useState)(r);s[3]===Symbol.for("react.memo_cache_sentinel")?(n=e=>{p(t=>{var r=new Map(t);return r.set(e,!0),r})},s[3]=n):n=s[3];var h=n;return s[4]!==v||s[5]!==f||s[6]!==e?(o=()=>{if(0===e.length)return void p(S);var t=new AbortController;return(0,_._)(function*(){var r=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,r=[],n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}(e,f),n=yield Promise.all(r.map(e=>{var r;return r=t.signal,(0,_._)(function*(){var t=e.map(e=>{var t;return(0,k._)({},e.doi&&{doi:e.doi},e.title&&{title:e.title},(null==(t=e.authors[0])?void 0:t.family)&&{firstAuthor:e.authors[0].family},e.year&&{year:parseInt(e.year,10)})});try{var n,a=yield v("/api/v1/library/match",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:t}),signal:r});if(!a.ok)return{chunk:e,matches:[]};var i=yield a.json();return{chunk:e,matches:Array.isArray(null==(n=i.data)?void 0:n.matches)?i.data.matches:[]}}catch(t){return r.aborted||t instanceof Error&&t.name,{chunk:e,matches:[]}}})()}));t.signal.aborted||p(function(e){var t=new Map;for(var{chunk:r,matches:n}of e)for(var a of n){var i=r[a.index];i&&t.set(i.index,a.inLibrary)}return t}(n))})(),()=>t.abort()},l=[e,f,v],s[4]=v,s[5]=f,s[6]=e,s[7]=o,s[8]=l):(o=s[7],l=s[8]),(0,i.useEffect)(o,l),s[9]!==m?(c={libraryMatches:m,markReferenceInLibrary:h},s[9]=m,s[10]=c):c=s[10],c}(tt),tW=!!eG;eV[45]!==tW?(ek={enabled:tW},eV[45]=tW,eV[46]=ek):ek=eV[46];var{preferences:tZ}=(0,x.b)(ek),t$=null!=(m=null==tZ?void 0:tZ.default_style)?m:"apa";eV[47]!==t$||eV[48]!==tV||eV[49]!==eH||eV[50]!==tJ||eV[51]!==tt?(ej={references:tt,libraryCitation:eH,markReferenceInLibrary:tJ,flashReferenceRow:tV,defaultStyle:t$},eV[47]=t$,eV[48]=tV,eV[49]=eH,eV[50]=tJ,eV[51]=tt,eV[52]=ej):ej=eV[52];var{popoverState:tQ,handleRefClick:tY,handleSaveFromPopover:tX,closePopover:t0}=function(e){var t,r,n,o,l=(0,a.c)(13),{references:c,libraryCitation:s,markReferenceInLibrary:u,flashReferenceRow:d,defaultStyle:f}=e,v=void 0===f?"apa":f,[m,p]=(0,i.useState)(null),h=(0,q.zI)();l[0]!==d||l[1]!==s||l[2]!==c?(t=(e,t)=>
1{var r=c[e];r&&(s&&(0,D.MV)(s.id,e,!!r.doi),p({ref:r,anchor:t}),d(e))},l[0]=d,l[1]=s,l[2]=c,l[3]=t):t=l[3];var y=t;l[4]!==v||l[5]!==u||l[6]!==h?(r=e=>(0,_._)(function*(){var t,r,n,a,i,o,l=(n=(null==(r=e.title)?void 0:r.trim())||e.rawText.slice(0,200)||"Untitled reference",a=(null!=(t=e.authors)?t:[]).map(e=>{var t,r,n,a,i=null!=(t=null==(n=e.given)?void 0:n.trim())?t:"",o=null!=(r=null==(a=e.family)?void 0:a.trim())?r:"";return{name:[i,o].filter(Boolean).join(" ")||o||i}}),i=e.year?Number.parseInt(e.year,10):void 0,o={id:e.doi?"doi:".concat(e.doi):"grobid:".concat(e.index,":").concat(n.slice(0,64).toLowerCase().replace(/\s+/g,"-")),title:n,authors:a},e.doi&&(o.doi=e.doi),"number"==typeof i&&Number.isFinite(i)&&(o.year=i),e.journal&&(o.venue=e.journal),e.volume&&(o.volume=e.volume),e.pages&&(o.page=e.pages),o);yield h.mutateAsync({paper:l,style:v,_clientSource:"reader"}),u(e.index)})(),l[4]=v,l[5]=u,l[6]=h,l[7]=r):r=l[7];var g=r;l[8]===Symbol.for("react.memo_cache_sentinel")?(n=()=>p(null),l[8]=n):n=l[8];var b=n;return l[9]!==y||l[10]!==g||l[11]!==m?(o={popoverState:m,handleRefClick:y,handleSaveFromPopover:g,closePopover:b},l[9]=y,l[10]=g,l[11]=m,l[12]=o):o=l[12],o}(ej);eV[53]!==eZ||eV[54]!==eW?(eS=()=>{eW.push(eZ)},eV[53]=eZ,eV[54]=eW,eV[55]=eS):eS=eV[55];var t1=eS,{isDesktop:t2,refsDrawerOpen:t4,setRefsDrawerOpen:t3}=function(){var e,t,r,n,o=(0,a.c)(9);void 0!==o[0]?(e={},o[0]=void 0,o[1]=e):e=o[1];var{initialIsDesktop:l,query:c,matchMedia:s}=e,u=void 0===c?"(min-width: 1024px)":c,d=void 0===s?ev:s,[f,v]=(0,i.useState)(void 0===l||l),[m,p]=(0,i.useState)(!1);return o[2]!==d||o[3]!==u?(t=()=>{var e=d(u);v(e.matches);var t=e=>{v(e.matches),e.matches&&p(!1)};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},r=[u,d],o[2]=d,o[3]=u,o[4]=t,o[5]=r):(t=o[4],r=o[5]),(0,i.useEffect)(t,r),o[6]!==f||o[7]!==m?(n={isDesktop:f,refsDrawerOpen:m,setRefsDrawerOpen:p},o[6]=f,o[7]=m,o[8]=n):n=o[8],n}(),{sidebarLayout:t5,handleSidebarLayoutChanged:t7}=function(){var{storage:e=window.localStorage,storageKey:t="citeme:readSidebarLayout:v1"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[r,n]=(0,i.useState)(void 0);return(0,i.useEffect)(()=>{if(e)try{var r=e.getItem(t);if(!r)return;var a=JSON.parse(r);a&&"object"==typeof a&&!Array.isArray(a)&&Object.values(a).every(e=>"number"==typeof e&&Number.isFinite(e)&&e>=0&&e<=100)&&n(a)}catch(e){}},[e,t]),{sidebarLayout:r,handleSidebarLayoutChanged:(0,i.useCallback)(r=>{if("read-sidebar"in r){n(r);try{null==e||e.setItem(t,JSON.stringify(r))}catch(e){}}},[e,t])}}();eV[56]!==tH||eV[57]!==tK||eV[58]!==t1||eV[59]!==tG||eV[60]!==tn||eV[61]!==tR||eV[62]!==tt||eV[63]!==ts||eV[64]!==tl||eV[65]!==ti||eV[66]!==t3||eV[67]!==tz||eV[68]!==tv||eV[69]!==eK?(eE={t:eK,references:tt,refsLoading:tl,refsError:ts,selectedRef:ti,paperLanguage:tn,readerCopySurface:tR,forwardCiteCount:tK,libraryMatches:tG,sidebarFlashIndex:tz,sortBy:tv,setSortBy:tm,setRefsDrawerOpen:t3,setSelectedRef:to,cycleToNextOccurrence:tH,onStyleUpgrade:t1},eV[56]=tH,eV[57]=tK,eV[58]=t1,eV[59]=tG,eV[60]=tn,eV[61]=tR,eV[62]=tt,eV[63]=ts,eV[64]=tl,eV[65]=ti,eV[66]=t3,eV[67]=tz,eV[68]=tv,eV[69]=eK,eV[70]=eE):eE=eV[70];var{resolvedStyle:t6,sidebarBody:t9}=function(e){var t,r,o,l,c,s,u,d,f,v=(0,a.c)(48),{t:m,references:p,refsLoading:h,refsError:y,selectedRef:g,paperLanguage:b,readerCopySurface:w,forwardCiteCount:j,libraryMatches:S,sidebarFlashIndex:E,sortBy:N,setSortBy:R,setRefsDrawerOpen:C,setSelectedRef:L,cycleToNextOccurrence:I,onStyleUpgrade:T}=e,{recordCopy:M}=(0,B.r)(),{preferences:P}=(0,x.b)();v[0]!==b||v[1]!==P||v[2]!==h?(t={preferences:P,paperLanguage:b,refsLoading:h},v[0]=b,v[1]=P,v[2]=h,v[3]=t):t=v[3];var{resolvedStyle:A,handleStyleChange:O}=function(e){var{preferences:t,paperLanguage:r,refsLoading:n,storage:a=window.localStorage,getSearch:o=W,trackStyle:l=V.Ju}=e,[c,s]=(0,i.useState)("apa"),u=(0,i.useRef)(!1);return(0,i.useEffect)(()=>{if(!u.current&&null!==t&&("unknown"!==r||!n)){var e=new URLSearchParams(o()).get("style");if(Z(e))return void s(e);var i=null==t?void 0:t.default_style;if((null==t?void 0:t.onboarding_completed)&&Z(i))return void s(i);var l=null==a?void 0:a.getItem(J);if(Z(l))return void s(l);
1s("pt"===r?"abnt":"apa")}},[t,r,n,a,o]),{resolvedStyle:c,handleStyleChange:(0,i.useCallback)(e=>{u.current=!0,s(e);try{null==a||a.setItem(J,e)}catch(e){}l(e,"reader")},[a,l])}}(t),D=(0,F.Ym)();v[4]!==p||v[5]!==N?(r="original"===N?p:[...p].sort((e,t)=>{var r,n,a,i;return(null!=(r=null==(a=t.occurrences)?void 0:a.length)?r:0)-(null!=(n=null==(i=e.occurrences)?void 0:i.length)?n:0)}),v[4]=p,v[5]=N,v[6]=r):r=v[6];var U=r;v[7]!==b||v[8]!==w||v[9]!==M||v[10]!==p||v[11]!==A?(o={references:p,style:A,paperLanguage:b,surface:w,recordCopy:M},v[7]=b,v[8]=w,v[9]=M,v[10]=p,v[11]=A,v[12]=o):o=v[12];var{citeStates:q,citeReference:G}=function(e){var{references:t,style:r,paperLanguage:n,surface:a,recordCopy:o,copiedStateMs:l=2e3,errorStateMs:c=3e3,formatCitation:s=K.e,copyCitation:u=H.Tv,trackCopy:d=V.S}=e,[f,v]=(0,i.useState)({}),m=(0,i.useRef)(new Map),p=(0,i.useRef)(new Map),h=(0,i.useCallback)(e=>{var t=m.current.get(e);t&&(clearTimeout(t),m.current.delete(e))},[]),y=(0,i.useCallback)((e,t)=>{h(e);var r=setTimeout(()=>{v(t=>{if(void 0===t[e])return t;var r=(0,k._)({},t);return delete r[e],r}),m.current.delete(e)},t);m.current.set(e,r)},[h]),g=(0,i.useCallback)(e=>(0,_._)(function*(){var i,f=t[e];if(f){h(e),null==(i=p.current.get(e))||i.abort();var m=new AbortController;p.current.set(e,m),v(t=>(0,z._)((0,k._)({},t),{[e]:"loading"}));try{var g=yield s(f,r,m.signal,n);if(m.signal.aborted||(yield u(g),m.signal.aborted))return;d("reference",{surface:a,style:r}),o(),v(t=>(0,z._)((0,k._)({},t),{[e]:"copied"})),y(e,l)}catch(t){if(m.signal.aborted||t instanceof Error&&"AbortError"===t.name)return;v(t=>(0,z._)((0,k._)({},t),{[e]:"error"})),y(e,c)}finally{p.current.get(e)===m&&p.current.delete(e)}}})(),[t,h,s,r,n,u,d,a,o,y,l,c]);return(0,i.useEffect)(()=>()=>{m.current.forEach(e=>clearTimeout(e)),m.current.clear(),p.current.forEach(e=>e.abort()),p.current.clear()},[]),{citeStates:f,citeReference:g}}(o);v[13]!==C?(l=()=>C(!1),v[13]=C,v[14]=l):l=v[14],v[15]!==L?(c=()=>L(null),v[15]=L,v[16]=c):c=v[16],v[17]!==I||v[18]!==L?(s=(e,t)=>{I(e.index,t)||L(e)},v[17]=I,v[18]=L,v[19]=s):s=v[19],v[20]!==G?(u=e=>void G(e),v[20]=G,v[21]=u):u=v[21],v[22]!==q||v[23]!==j||v[24]!==O||v[25]!==S||v[26]!==D||v[27]!==T||v[28]!==b||v[29]!==w||v[30]!==p||v[31]!==y||v[32]!==h||v[33]!==g||v[34]!==R||v[35]!==E||v[36]!==N||v[37]!==U||v[38]!==m||v[39]!==A||v[40]!==l||v[41]!==c||v[42]!==s||v[43]!==u?(d=(0,n.jsx)(et,{t:m,references:p,sortedReferences:U,refsLoading:h,refsError:y,selectedRef:g,forwardCiteCount:j,citeStates:q,libraryMatches:S,sidebarFlashIndex:E,resolvedStyle:A,paperLanguage:b,readerCopySurface:w,localeKey:D,sortBy:N,onSortByChange:R,onCloseDrawer:l,onSelectedRefClose:c,onStyleChange:O,onStyleUpgrade:T,onSelectReference:s,onCiteReference:u}),v[22]=q,v[23]=j,v[24]=O,v[25]=S,v[26]=D,v[27]=T,v[28]=b,v[29]=w,v[30]=p,v[31]=y,v[32]=h,v[33]=g,v[34]=R,v[35]=E,v[36]=N,v[37]=U,v[38]=m,v[39]=A,v[40]=l,v[41]=c,v[42]=s,v[43]=u,v[44]=d):d=v[44];var $=d;return v[45]!==$||v[46]!==A?(f={resolvedStyle:A,sidebarBody:$},v[45]=$,v[46]=A,v[47]=f):f=v[47],f}(eE),t8=(0,i.useRef)(null);eV[71]!==tt.length||eV[72]!==t6?(eN=()=>{0===tt.length||t8.current!==t6&&(t8.current=t6,(0,g.Ys)(t6))},eR=[tt.length,t6],eV[71]=tt.length,eV[72]=t6,eV[73]=eN,eV[74]=eR):(eN=eV[73],eR=eV[74]),(0,i.useEffect)(eN,eR);var re=!!eX,rt=!!ti;if(eV[75]===Symbol.for("react.memo_cache_sentinel")?(eC=()=>to(null),eV[75]=eC):eC=eV[75],eV[76]!==t2||eV[77]!==eQ||eV[78]!==t4||eV[79]!==t3||eV[80]!==re||eV[81]!==rt?(eL={mode:eQ,hasPdf:re,hasSelectedRef:rt,refsDrawerOpen:t4,isDesktop:t2,clearSelectedRef:eC,setRefsDrawerOpen:t3,zoomIn:tx,zoomOut:t_,zoomReset:tw},eV[76]=t2,eV[77]=eQ,eV[78]=t4,eV[79]=t3,eV[80]=re,eV[81]=rt,eV[82]=eL):eL=eV[82],!function(e){var t,r,n=(0,a.c)(12),{mode:o,hasPdf:l,hasSelectedRef:c,refsDrawerOpen:s,isDesktop:u,clearSelectedRef:d,setRefsDrawerOpen:f,zoomIn:v,zoomOut:m,zoomReset:p}=e;n[0]!==d||n[1]!==l||n[2]!==c||n[3]!==u||n[4]!==o||n[5]!==s||n[6]!==f||n[7]!==v||n[8]!==m||n[9]!==p?(t=()=>{if("idle"!==o&&l){var e=e=>{var t;if((!(t=e.target)||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)&&!e.metaKey&&!e.ctrlKey&&!e.altKey){if("Escape"===e.key){if(c){d(),e.preventDefault();return}!u&&s&&(f(!1),e.preventDefault());return}"+"===e.key?(v(),e.preventDefault()):"-"===e.key||"_"===e.key?(m(),e.preventDefault()):"0"===e.key&&(p(),e.preventDefault())}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}},r=[o,l,c,s,u,d,f,v,m,p],n[0]=d,n[1]=l,n[2]=c,n[3]=u,n[4]=o,n[5]=s,n[6]=f,n[7]=v,n[8]=m,n[9]=p,n[10]=t,n[11]=r):(t=n[10],r=n[11]),(0,i.useEffect)(t,r)}(eL),e6)return eV[83]!==e6.limit||eV[84]!==e6.surface||eV[85]!==e6.used?(eI=(0,n.jsx)(y,{surface:e6.surface,used:e6.used,limit:e6.limit}),eV[83]=e6.limit,eV[84]=e6.surface,eV[85]=e6.used,eV[86]=eI):eI=eV[86],eI;if(e5)return eV[87]!==eW?(eT=()=>eW.push("/search"),eV[87]=eW,eV[88]=eT):eT=eV[88],eV[89]===Symbol.for("react.memo_cache_sentinel")?(eM=()=>{e7(!1),eY("idle")},eV[89]=eM):eM=eV[89],eV[90]!==eK||eV[91]!==eT?(eP=(0,n.jsx)(ef,{t:eK,onSearchAgain:eT,onReopenDropzone:eM}),eV[90]=eK,eV[91]=eT,eV[92]=eP):eP=eV[92],eP;if("library"!==eQ&&("idle"===eQ||!eX))return eV[93]!==tD?(eA=()=>void tD(),eV[93]=tD,eV[94]=eA):eA=eV[94],eV[95]!==tU?(eO=()=>
1void tU(),eV[95]=tU,eV[96]=eO):eO=eV[96],eV[97]!==tM||eV[98]!==tT||eV[99]!==tP||eV[100]!==tO||eV[101]!==eK||eV[102]!==eA||eV[103]!==eO||eV[104]!==td?(eD=(0,n.jsx)(ed,{t:eK,uploadError:td,resumeMeta:tO,fileInputRef:tb,onDrop:tT,onDragOver:tM,onInputChange:tP,onResume:eA,onDismissResume:eO}),eV[97]=tM,eV[98]=tT,eV[99]=tP,eV[100]=tO,eV[101]=eK,eV[102]=eA,eV[103]=eO,eV[104]=td,eV[105]=eD):eD=eV[105],eD;var rr=null==eH?void 0:eH.title;return eV[106]!==tq||eV[107]!==eQ||eV[108]!==eW?(eU=()=>{"upload"===eQ?tq():eW.back()},eV[106]=tq,eV[107]=eQ,eV[108]=eW,eV[109]=eU):eU=eV[109],eV[110]!==t3?(eq=()=>t3(eh),eF=()=>t3(!1),eV[110]=t3,eV[111]=eq,eV[112]=eF):(eq=eV[111],eF=eV[112]),eV[113]!==tH?(eB=e=>{var t,r;tH(e.index,null!=(t=null==(r=e.occurrences)?void 0:r.length)?t:0)},eV[113]=tH,eV[114]=eB):eB=eV[114],eV[115]!==t0||eV[116]!==tE.isPending||eV[117]!==e1||eV[118]!==tM||eV[119]!==tT||eV[120]!==tP||eV[121]!==tB||eV[122]!==tY||eV[123]!==tX||eV[124]!==t7||eV[125]!==t2||eV[126]!==tN||eV[127]!==tG||eV[128]!==eQ||eV[129]!==tn||eV[130]!==eX||eV[131]!==tQ||eV[132]!==tt||eV[133]!==t4||eV[134]!==e8||eV[135]!==t9||eV[136]!==t5||eV[137]!==eK||eV[138]!==rr||eV[139]!==t6||eV[140]!==eU||eV[141]!==eq||eV[142]!==eF||eV[143]!==eB||eV[144]!==td?(ez=(0,n.jsx)(em,{t:eK,mode:eQ,fileName:e1,libraryTitle:rr,pdfUrl:eX,isLibraryPdfLoading:tN,removePending:tE.isPending,references:tt,scale:e8,isDesktop:t2,refsDrawerOpen:t4,sidebarLayout:t5,uploadError:td,fileInputRef:tb,pdfViewerRef:tg,sidebarBody:t9,popoverState:tQ,paperLanguage:tn,resolvedStyle:t6,libraryMatches:tG,onClose:eU,onLibraryRemove:tB,onZoomIn:tx,onZoomOut:t_,onZoomReset:tw,onToggleRefsDrawer:eq,onCloseRefsDrawer:eF,onReferenceClick:tY,onSidebarLayoutChanged:t7,onDrop:tT,onDragOver:tM,onInputChange:tP,onSavePopover:tX,onCycleOccurrence:eB,onClosePopover:t0}),eV[115]=t0,eV[116]=tE.isPending,eV[117]=e1,eV[118]=tM,eV[119]=tT,eV[120]=tP,eV[121]=tB,eV[122]=tY,eV[123]=tX,eV[124]=t7,eV[125]=t2,eV[126]=tN,eV[127]=tG,eV[128]=eQ,eV[129]=tn,eV[130]=eX,eV[131]=tQ,eV[132]=tt,eV[133]=t4,eV[134]=e8,eV[135]=t9,eV[136]=t5,eV[137]=eK,eV[138]=rr,eV[139]=t6,eV[140]=eU,eV[141]=eq,eV[142]=eF,eV[143]=eB,eV[144]=td,eV[145]=ez):ez=eV[145],ez}function eh(e){return!e}function ey(e){return Math.max(e-.25,.5)}function eg(e){return Math.min(e+.25,3)}},48887:(e,t,r)=>{r.d(t,{A:()=>n});function n(e){return e}},58910:(e,t,r)=>{r.d(t,{Kg:()=>i,MV:()=>l,Un:()=>o,XF:()=>c,hM:()=>s});var n=r(43078),a=r(76123),i=e=>{if("string"==typeof e)return void(0,a.trackEvent)("pdf_reader_opened",{citation_id:e});var t={};(null==e?void 0:e.citation_id)&&(t.citation_id=e.citation_id),(null==e?void 0:e.surface)&&(t.surface=e.surface),(null==e?void 0:e.preset)&&(t.preset=e.preset),(0,a.trackEvent)("pdf_reader_opened",t)},o=e=>{if("string"==typeof e)return void(0,a.trackEvent)("pdf_upload_started",{citation_id:e});var t={};(null==e?void 0:e.citation_id)&&(t.citation_id=e.citation_id),(null==e?void 0:e.surface)&&(t.surface=e.surface),(0,a.trackEvent)("pdf_upload_started",t)},l=(e,t,r)=>(0,a.trackEvent)("pdf_reference_clicked",{citation_id:e,ref_index:t,has_doi:r}),c=e=>(0,a.trackEvent)("pdf_reader_save_clicked",(0,n._)({surface:e.surface,n_selected:e.n_selected},void 0!==e.n_matched&&{n_matched:e.n_matched},void 0!==e.confidence_p50&&{confidence_p50:e.confidence_p50},void 0!==e.default_selected_count&&{default_selected_count:e.default_selected_count},e.pdf_id&&{pdf_id:e.pdf_id})),s=e=>(0,a.trackEvent)("pdf_reader_save_completed",(0,n._)({surface:e.surface,n_saved:e.n_saved,n_duplicate:e.n_duplicate,n_failed:e.n_failed},void 0!==e.quota_remaining&&null!==e.quota_remaining&&{quota_remaining:e.quota_remaining},e.pdf_id&&{pdf_id:e.pdf_id}))},63309:(e,t,r)=>{r.d(t,{q:()=>l});var n=r(18156),a=r(48676),i=class extends n.${constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:(0,a.PL)()})}getOptimisticResult(e){return e.behavior=(0,a.PL)(),super.getOptimisticResult(e)}
1fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){let{state:r}=e,n=super.createResult(e,t),{isFetching:i,isRefetching:o,isError:l,isRefetchError:c}=n,s=r.fetchMeta?.fetchMore?.direction,u=l&&"forward"===s,d=i&&"forward"===s,f=l&&"backward"===s,v=i&&"backward"===s;return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,a.rB)(t,r.data),hasPreviousPage:(0,a.RQ)(t,r.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:v,isRefetchError:c&&!u&&!f,isRefetching:o&&!d&&!v}}},o=r(28510);function l(e,t){return(0,o.t)(e,i,t)}},71937:(e,t,r)=>{r.d(t,{Tv:()=>o,ox:()=>i});var n=r(42021),a=r(88162);function i(e,t,r,i){return(0,n._)(function*(){var n=new URLSearchParams;e.doi?n.set("doi",e.doi):n.set("q",e.rawText),t&&n.set("style",t);var o={},l=function(e){switch(e){case"pt":return"pt-BR";case"es":return"es-ES";case"en":return"en-US";case"fr":return"fr-FR";case"de":return"de-DE";case"it":return"it-IT";default:return null}}(i);l&&(o["Accept-Language"]=l);var c=yield fetch("/api/v1/cite?".concat(n),{credentials:"include",signal:r,headers:o});if(!c.ok){var s="Cite failed (".concat(c.status,")");try{var u,d,f,v,m,p=yield c.json();
1(null==p||null==(m=p.error)?void 0:m.message)&&(s=p.error.message)}catch(e){}throw Error(s)}var h=null==(v=(yield c.json()).data)||null==(f=v.citations)||null==(d=f[0])||null==(u=d.formatted)?void 0:u.reference;if(!h)throw Error("No formatted citation in response");return{html:(0,a.pn)(h),plain:(0,a.QZ)(h)}})()}function o(e){return(0,n._)(function*(){if("u">typeof ClipboardItem&&navigator.clipboard.write)try{yield navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e.html],{type:"text/html"}),"text/plain":new Blob([e.plain],{type:"text/plain"})})]);return}catch(e){}yield navigator.clipboard.writeText(e.plain)})()}},72194:(e,t,r)=>{r.d(t,{$7:()=>p,NU:()=>m,Pl:()=>d,T9:()=>s,WI:()=>u,YA:()=>v,eX:()=>f,ih:()=>h,to:()=>y});var n=r(43078),a=r(11077),i="pendingCheckout",o="checkoutReturnTo",l="checkoutBillingCycle";function c(e){return"week"===e||"month"===e||"semester"===e}function s(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now(),a=(0,n._)({cycle:t.cycle,ts:r},!1===t.autoOpen&&{autoOpen:!1});try{return e.setItem(i,JSON.stringify(a)),!0}catch(e){return!1}}function u(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();try{t=e.getItem(i),null!==t&&e.removeItem(i)}catch(e){return null}if(!t)return null;if(c(t))return{cycle:t,autoOpen:!0};try{r=JSON.parse(t)}catch(e){return null}if(!r||"object"!=typeof r||Array.isArray(r))return null;var a=r;return c(a.cycle)&&"number"==typeof a.ts&&Number.isFinite(a.ts)&&!(n-a.ts>3e5)?{cycle:a.cycle,autoOpen:!1!==a.autoOpen}:null}function d(e,t){var r=(0,a.v)(t);if(!r)return!1;
1try{return e.setItem(o,r),!0}catch(e){return!1}}function f(e){try{return(0,a.v)(e.getItem(o))}catch(e){return null}}function v(e){var t;try{t=e.getItem(o),e.removeItem(o)}catch(e){return null}return(0,a.v)(t)}function m(e){try{e.removeItem(o)}catch(e){}}function p(e,t){try{return e.setItem(l,t),!0}catch(e){return!1}}function h(e){try{var t=e.getItem(l);return"week"===t||"month"===t||"semester"===t||"pass"===t?t:null}catch(e){return null}}function y(e){try{e.removeItem(l)}catch(e){}}},74508:(e,t,r)=>{r.d(t,{DT:()=>n,IB:()=>a,JP:()=>i});var n=(0,r(48887).A)({locales:["en","pt","es","fr","de"],defaultLocale:"en",localePrefix:"as-needed",localeDetection:!1,localeCookie:!1}),a=n.locales;function i(e){return a.includes(e)}},75163:(e,t,r)=>{r.d(t,{I:()=>a});var n=r(95155);let a=(0,r(12115).forwardRef)(({size:e=24,color:t="currentColor",children:r,...a},i)=>(0,n.jsx)("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",style:{color:t,...a.style},...a,children:r}));a.displayName="Icon"},79064:(e,t,r)=>{r.r(t),r.d(t,{EXTRACTOR_VERSION:()=>u,clearAllLocalPdfs:()=>E,clearLocalPdf:()=>S,getStoredPdfMeta:()=>w,loadLocalPdf:()=>_,persistStoredPdfReferences:()=>j,savePdfLocally:()=>x,touchStoredPdfTimestamp:()=>k});var n=r(42021),a=r(43078),i=r(96843),o="pdfs",l="current-pdf",c="current",s="by_user",u="v1";function d(e){return e&&e.length>0?e:"__anon__"}function f(){return new Promise((e,t)=>{var r=indexedDB.open("citeme-reader",2);r.onupgradeneeded=()=>{var e=r.result;e.objectStoreNames.contains(o)||e.createObjectStore(o,{keyPath:["userId","documentId"]}).createIndex(s,"userId",{unique:!1})},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error),r.onblocked=()=>t(Error("pdf-idb: upgrade blocked by another tab"))})}function v(e){return new Promise((t,r)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>r(e.error)})}function m(e){return(0,n._)(function*(){if(e.objectStoreNames.contains(l))try{var t=e.transaction(l,"readwrite");yield v(t.objectStore(l).delete(c))}catch(e){}})()}function p(e,t){return(0,n._)(function*(){var r=yield(0,n._)(function*(){if(!e.objectStoreNames.contains(l))return null;try{var t=e.transaction(l,"readonly"),r=yield v(t.objectStore(l).get(c));return null!=r?r:null}catch(e){return null}})();if(!r)return null;if(void 0!==r.userId&&r.userId!==t)return yield m(e),null;var a={userId:t,documentId:crypto.randomUUID(),name:r.name,buffer:r.buffer,savedAt:r.savedAt,extractorVersion:r.extractorVersion,references:r.references,paperLanguage:r.paperLanguage,referencesExtractedAt:r.referencesExtractedAt};try{var i=e.transaction(o,"readwrite");return yield v(i.objectStore(o).put(a)),yield m(e),a}catch(e){return null}})()}function h(e,t){return(0,n._)(function*(){try{var r=e.transaction(o,"readonly").objectStore(o).index(s),n=yield v(r.getAll(t));return null!=n?n:[]}catch(e){return[]}})()}function y(e){var t;return 0===e.length?null:null!=(t=[...e].sort((e,t)=>t.savedAt-e.savedAt)[0])?t:null}function g(e){return Date.now()-e.savedAt>144e5}function b(e,t,r){return(0,n._)(function*(){try{var n=e.transaction(o,"readwrite");yield v(n.objectStore(o).delete([t,r]))}catch(e){}})()}function x(e,t,r,a){return(0,n._)(function*(){if("u">typeof indexedDB){var i={userId:d(r),documentId:a,name:e,buffer:t,savedAt:Date.now(),extractorVersion:u};try{var l=yield f();try{var c,s=l.transaction(o,"readwrite");yield v(s.objectStore(o).put(i)),yield(c=i.userId,(0,n._)(function*(){var e=yield h(l,c);if(!(e.length<=5))for(var t of[...e].sort((e,t)=>t.savedAt-e.savedAt).slice(5))yield b(l,t.userId,t.documentId)})())}finally{l.close()}}catch(e){}}})()}function _(e,t){return(0,n._)(function*(){if("u"<typeof indexedDB)return null;var r=d(e);try{var n,l=yield f();try{if(t){var c,s=l.transaction(o,"readonly"),m=yield v(s.objectStore(o).get([r,t]));n=null!=m?m:null}else{var x=yield h(l,r);(n=y(x))||(n=yield p(l,r))}if(!n)return null;if(g(n))return yield b(l,n.userId,n.documentId),null;return(c=n).extractorVersion&&c.extractorVersion!==u?(0,i._)((0,a._)({},c),{references:void 0,paperLanguage:void 0,referencesExtractedAt:void 0}):void 0===c.references||Array.isArray(c.references)?c:(0,i._)((0,a._)({},c),{references:void 0})}finally{l.close()}}catch(e){return null}})()}function w(e){return(0,n._)(function*(){if("u"<typeof indexedDB)return null;var t=d(e);try{var r=yield f();try{var n=yield h(r,t),a=y(n);if(a||(a=yield p(r,t)),!a)return null;if(g(a))return yield b(r,a.userId,a.documentId),null;var i=Array.isArray(a.references)&&(!a.extractorVersion||a.extractorVersion===u);return{documentId:a.documentId,name:a.name,size:a.buffer.byteLength,savedAt:a.savedAt,refCount:i?a.references.length:void 0}}finally{r.close()}}catch(e){return null}})()}function k(e,t){return(0,n._)(function*(){if("u">typeof indexedDB){var r=d(e);try{var n=yield f();try{var l=n.transaction(o,"readwrite").objectStore(o),c=yield v(l.get([r,t]));if(!c||g(c))return;yield v(l.put((0,i._)((0,a._)({},c),{savedAt:Date.now()})))}finally{n.close()}}catch(e){}}})()}function j(e,t,r,l,c){return(0,n._)(function*(){if("u">typeof indexedDB){var n=d(e);try{var s=yield f();try{var m=s.transaction(o,"readwrite").objectStore(o),p=yield v(m.get([n,t]));if(!p||p.name!==r)return;yield v(m.put((0,i._)((0,a._)({},p),{references:l,paperLanguage:c,referencesExtractedAt:Date.now(),extractorVersion:u})))}finally{s.close()}}catch(e){}}})()}function S(e,t){return(0,n._)(function*(){if("u">typeof indexedDB)try{var r=yield f();try{yield b(r,d(e),t)}finally{r.close()}}catch(e){}})()}function E(){return(0,n._)(function*(){if("u">typeof indexedDB)try{var e=yield f();try{if(e.objectStoreNames.contains(o)){var t=e.transaction(o,"readwrite");yield v(t.objectStore(o).clear())}yield m(e)}finally{e.close()}}catch(e){}})()}},81039:(e,t,r)=>{r.d(t,{s:()=>i});var n=r(95155),a=r(19749);function i(e){var t,r,i,o,l,c,s,u,d,f,v,m=(0,a.c)(29),{t:p,uploadError:h,fileInputRef:y,onDrop:g,onDragOver:b,onInputChange:x}=e;return m[0]!==y?(t=()=>{var e;return null==(e=y.current)?void 0:e.click()},m[0]=y,m[1]=t):t=m[1],m[2]!==y?(r=e=>{if("Enter"===e.key||" "===e.key){var t;e.preventDefault(),null==(t=y.current)||t.click()}},m[2]=y,m[3]=r):r=m[3],m[4]!==y||m[5]!==x?(i=(0,n.jsx)("input",{ref:y,type:"file",accept:".pdf,application/pdf",onChange:x,className:"hidden"}),m[4]=y,m[5]=x,m[6]=i):i=m[6],m[7]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsxs)("div",{className:"shrink-0 w-12 h-16 rounded border border-accent/20 bg-white flex items-center justify-center relative",children:[(0,n.jsx)("span",{className:"text-[10px] font-serif text-accent-900/60",children:"PDF"}),(0,n.jsx)("div",{className:"absolute -top-1 -right-1 w-3 h-3 rounded-full bg-accent/80"})]}),m[7]=o):o=m[7],m[8]!==p?(l=p("dropzoneTitle"),m[8]=p,m[9]=l):l=m[9],m[10]!==l?(c=(0,n.jsx)("p",{className:"text-accent-900 font-medium text-base mb-1",children:l}
1),m[10]=l,m[11]=c):c=m[11],m[12]!==p?(s=p("dropzoneHint"),m[12]=p,m[13]=s):s=m[13],m[14]!==s?(u=(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),m[14]=s,m[15]=u):u=m[15],m[16]!==c||m[17]!==u?(d=(0,n.jsxs)("div",{className:"flex items-center gap-5",children:[o,(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[c,u]})]}),m[16]=c,m[17]=u,m[18]=d):d=m[18],m[19]!==h?(f=h&&(0,n.jsx)("p",{className:"text-sm text-destructive mt-4 border-t border-accent/10 pt-3",children:h}),m[19]=h,m[20]=f):f=m[20],m[21]!==b||m[22]!==g||m[23]!==t||m[24]!==f||m[25]!==r||m[26]!==i||m[27]!==d?(v=(0,n.jsxs)("div",{onDrop:g,onDragOver:b,onClick:t,role:"button",tabIndex:0,onKeyDown:r,className:"group relative bg-cream-50/60 border border-accent/15 hover:border-accent/40 hover:bg-cream-50 rounded-xl px-8 py-10 cursor-pointer transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2",children:[i,d,f]}),m[21]=b,m[22]=g,m[23]=t,m[24]=f,m[25]=r,m[26]=i,m[27]=d,m[28]=v):v=m[28],v}},82222:(e,t,r)=>{var n=r(55042);r.o(n,"notFound")&&r.d(t,{notFound:function(){return n.notFound}}),r.o(n,"permanentRedirect")&&r.d(t,{permanentRedirect:function(){return n.permanentRedirect}}),r.o(n,"redirect")&&r.d(t,{redirect:function(){return n.redirect}}),r.o(n,"usePathname")&&r.d(t,{usePathname:function(){return n.usePathname}}),r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}})},83160:(e,t,r)=>{r.d(t,{N:()=>o});var n=r(95155),a=r(12115),i=r(75163);let o=(0,a.forwardRef)((e,t)=>(0,n.jsx)(i.I,{ref:t,...e,children:(0,n.jsxs)("g",{fill:"none",children:[(0,n.jsx)("path",{d:"M24 0v24H0V0zM12.593 23.258l-.011.002-.071.035-.02.004-.014-.004-.071-.035q-.016-.005-.024.005l-.004.01-.017.428.005.02.01.013.104.074.015.004.012-.004.104-.074.012-.016.004-.017-.017-.427q-.004-.016-.017-.018m.265-.113-.013.002-.185.093-.01.01-.003.011.018.43.005.012.008.007.201.093q.019.005.029-.008l.004-.014-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014-.034.614q.001.018.017.024l.015-.002.201-.093.01-.008.004-.011.017-.43-.003-.012-.01-.01z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M3.636 11.293a1 1 0 0 0 0 1.414l5.657 5.657a1 1 0 0 0 1.414-1.414L6.757 13H20a1 1 0 1 0 0-2H6.757l3.95-3.95a1 1 0 0 0-1.414-1.414z"})]})}));o.displayName="ArrowLeftLine",(0,a.forwardRef)((e,t)=>(0,n.jsx)(i.I,{ref:t,...e,children:(0,n.jsxs)("g",{fill:"none",children:[(0,n.jsx)("path",{d:"M24 0v24H0V0zM12.593 23.258l-.011.002-.071.035-.02.004-.014-.004-.071-.035q-.016-.005-.024.005l-.004.01-.017.428.005.02.01.013.104.074.015.004.012-.004.104-.074.012-.016.004-.017-.017-.427q-.004-.016-.017-.018m.265-.113-.013.002-.185.093-.01.01-.003.011.018.43.005.012.008.007.201.093q.019.005.029-.008l.004-.014-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014-.034.614q.001.018.017.024l.015-.002.201-.093.01-.008.004-.011.017-.43-.003-.012-.01-.01z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M3.283 10.94a1.5 1.5 0 0 0 0 2.12l5.656 5.658a1.5 1.5 0 1 0 2.122-2.122L7.965 13.5H19.5a1.5 1.5 0 0 0 0-3H7.965l3.096-3.096a1.5 1.5 0 1 0-2.122-2.121z"})]})})).displayName="ArrowLeftFill"},83387:(e,t,r)=>{r.d(t,{n:()=>f});var n=r(43078),a=r(96843),i=r(12115),o=r(60961),l=r(44154),c=r(99683),s=r(97387),u=class extends c.Q{#e;#t=void 0;#r;#n;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#a()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,s.f8)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,s.EN)(t.mutationKey)!==(0,s.EN)(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(e){this.#a(),this.#i(e)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#a(),this.#i()}mutate(e,t){return this.#n=t,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(e)}#a(){let e=this.#r?.state??(0,o.$)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#i(e){l.jG.batch(()=>
1{if(this.#n&&this.hasListeners()){let t=this.#t.variables,r=this.#t.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#n.onSuccess?.(e.data,t,r,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(e.data,null,t,r,n)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#n.onError?.(e.error,t,r,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(void 0,e.error,t,r,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},d=r(85626);function f(e,t){var r=(0,d.jE)(t),[o]=i.useState(()=>new u(r,e));i.useEffect(()=>{o.setOptions(e)},[o,e]);var c=i.useSyncExternalStore(i.useCallback(e=>o.subscribe(l.jG.batchCalls(e)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),f=i.useCallback((e,t)=>{o.mutate(e,t).catch(s.lQ)},[o]);if(c.error&&(0,s.GU)(o.options.throwOnError,[c.error]))throw c.error;return(0,a._)((0,n._)({},c),{mutate:f,mutateAsync:c.mutate})}},85362:(e,t,r)=>{r.d(t,{r:()=>c});var n=r(43078),a=r(96843),i=r(19749),o=r(12115),l=r(78704);function c(){var e,t,r,c,s,u,d,f=(0,i.c)(8);f[0]===Symbol.for("react.memo_cache_sentinel")?(e={sessionCopies:0,sessionToolCompletions:0,hasReachedPromptThreshold:!1,promptReason:null},f[0]=e):e=f[0];var[v,m]=(0,o.useState)(e);f[1]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{var e=()=>m((0,l.YH)()),t=t=>{(t.key===l.n3||t.key===l.SH)&&e()};return e(),window.addEventListener(l.rx,e),window.addEventListener(l.vr,e),window.addEventListener("storage",t),()=>{window.removeEventListener(l.rx,e),window.removeEventListener(l.vr,e),window.removeEventListener("storage",t)}},r=[],f[1]=t,f[2]=r):(t=f[1],r=f[2]),(0,o.useEffect)(t,r),f[3]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{var e=(0,l.UC)();return m(e),e.sessionCopies},f[3]=c):c=f[3];var p=c;f[4]===Symbol.for("react.memo_cache_sentinel")?(s=(e,t)=>{var r=(0,l.PR)(e,void 0===t?"functional":t);return r&&m(r),r},f[4]=s):s=f[4];var h=s;f[5]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{m((0,l.ZA)())},f[5]=u):u=f[5];var y=u;return f[6]!==v?(d=(0,a._)((0,n._)({},v),{recordCopy:p,recordToolCompletion:h,reset:y}),f[6]=v,f[7]=d):d=f[7],d}},85527:(e,t,r)=>{r.d(t,{h:()=>i,u:()=>o});var n="oa-pdf-source-url",a="oa-pdf-doi";function i(e,t){sessionStorage.setItem(n,e),t?sessionStorage.setItem(a,t):sessionStorage.removeItem(a)}function o(){var e,t=sessionStorage.getItem(n);if(!t)return null;var r=null!=(e=sessionStorage.getItem(a))?e:void 0;return t.startsWith("blob:")&&(sessionStorage.removeItem(n),sessionStorage.removeItem(a)),{url:t,doi:r}}},88162:(e,t,r)=>{r.d(t,{QZ:()=>o,pn:()=>i});var n=["i","em","b","strong","span","sub","sup"],a={"&nbsp;":" ","&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&apos;":"'","&mdash;":"—","&ndash;":"–","&hellip;":"…","&copy;":"\xa9","&reg;":"\xae","&trade;":"™","&middot;":"\xb7","&bull;":"•"};function i(e){if(!e)return"";var t=n.join("|");return e.replace(RegExp("<(?!\\/?(".concat(t,")\\s*\\/?>)[^>]*>"),"gi"),"").trim()}function o(e){return e?e.replace(/\r\n?/g,"\n").replace(/<\s*br\s*\/?>/gi,"\n").replace(/<\/\s*(p|div|li|ul|ol|blockquote|h[1-6]|tr)\s*>/gi,"\n").replace(/<[^>]*>/g,"").replace(/&(?:#x[0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]+);/g,e=>{if(e in a)return a[e];var t=e.match(/^&#(\d+);$/);if(t){var r=Number.parseInt(t[1],10);return Number.isNaN(r)?e:String.fromCodePoint(r)}var n=e.match(/^&#x([0-9a-fA-F]+);$/);if(n){var i=Number.parseInt(n[1],16);return Number.isNaN(i)?e:String.fromCodePoint(i)}return e}).replace(/\u00A0/g," ").replace(/[ \t\f\v]+/g," ").replace(/ *\n */g,"\n").replace(/\n{3,}/g,"\n\n").trim():""}},99345:(e,t,r)=>{r.d(t,{c:()=>i,k:()=>o});var n=r(96334);function a(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let i=a(0,n.c3),o=a(0,n.kc)}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.