[{"data":1,"prerenderedAt":711},["ShallowReactive",2],{"navigation":3,"-guide-api":48,"-guide-api-surround":707},[4],{"title":5,"path":6,"stem":7,"children":8,"icon":47},"Guide","\u002Fguide","1.guide\u002F1.index",[9,12,17,22,27,32,37,42],{"title":10,"path":6,"stem":7,"icon":11},"Getting started","i-lucide-rocket",{"title":13,"path":14,"stem":15,"icon":16},"Nuxt","\u002Fguide\u002Fnuxt","1.guide\u002F2.nuxt","i-logos-nuxt-icon",{"title":18,"path":19,"stem":20,"icon":21},"Next.js","\u002Fguide\u002Fnext","1.guide\u002F3.next","i-logos-nextjs-icon",{"title":23,"path":24,"stem":25,"icon":26},"How it works","\u002Fguide\u002Fhow-it-works","1.guide\u002F4.how-it-works","i-lucide-workflow",{"title":28,"path":29,"stem":30,"icon":31},"Options","\u002Fguide\u002Foptions","1.guide\u002F5.options","i-lucide-settings",{"title":33,"path":34,"stem":35,"icon":36},"API","\u002Fguide\u002Fapi","1.guide\u002F6.api","i-lucide-code",{"title":38,"path":39,"stem":40,"icon":41},"Privacy","\u002Fguide\u002Fprivacy","1.guide\u002F7.privacy","i-lucide-lock",{"title":43,"path":44,"stem":45,"icon":46},"Benchmarks","\u002Fguide\u002Fbenchmarks","1.guide\u002F8.benchmarks","i-lucide-gauge","i-lucide-book-open",{"id":49,"title":33,"body":50,"description":701,"extension":702,"meta":703,"navigation":704,"path":34,"seo":705,"stem":35,"__hash__":706},"content\u002F1.guide\u002F6.api.md",{"type":51,"value":52,"toc":693,"icon":36},"minimark",[53,61,131,231,243,249,253,300,303,307,389,393,483,490,494,497,599,609,620,631,635,689],[54,55,57],"h2",{"id":56},"useprecog",[58,59,60],"code",{},"usePrecog()",[62,63,68],"pre",{"className":64,"code":65,"language":66,"meta":67,"style":67},"language-ts shiki shiki-themes github-light github-dark github-dark","const { enabled, pause, resume, refresh, grantConsent, metrics, plan } = usePrecog();\n","ts","",[58,69,70],{"__ignoreMap":67},[71,72,75,79,83,87,90,93,95,98,100,103,105,108,110,113,115,118,121,124,128],"span",{"class":73,"line":74},"line",1,[71,76,78],{"class":77},"so5gQ","const",[71,80,82],{"class":81},"slsVL"," { ",[71,84,86],{"class":85},"suiK_","enabled",[71,88,89],{"class":81},", ",[71,91,92],{"class":85},"pause",[71,94,89],{"class":81},[71,96,97],{"class":85},"resume",[71,99,89],{"class":81},[71,101,102],{"class":85},"refresh",[71,104,89],{"class":81},[71,106,107],{"class":85},"grantConsent",[71,109,89],{"class":81},[71,111,112],{"class":85},"metrics",[71,114,89],{"class":81},[71,116,117],{"class":85},"plan",[71,119,120],{"class":81}," } ",[71,122,123],{"class":77},"=",[71,125,127],{"class":126},"shcOC"," usePrecog",[71,129,130],{"class":81},"();\n",[132,133,134,147],"table",{},[135,136,137],"thead",{},[138,139,140,144],"tr",{},[141,142,143],"th",{},"Member",[141,145,146],{},"What it does",[148,149,150,164,174,184,198,210,219],"tbody",{},[138,151,152,157],{},[153,154,155],"td",{},[58,156,86],{},[153,158,159,160,163],{},"False while paused, or before consent when ",[58,161,162],{},"privacy.requireConsent"," is on.",[138,165,166,171],{},[153,167,168],{},[58,169,170],{},"pause()",[153,172,173],{},"Stops predicting and removes the speculation rules.",[138,175,176,181],{},[153,177,178],{},[58,179,180],{},"resume()",[153,182,183],{},"Starts again.",[138,185,186,191],{},[153,187,188],{},[58,189,190],{},"refresh()",[153,192,193,194,197],{},"Predicts now, ignoring ",[58,195,196],{},"minIntervalMs",".",[138,199,200,205],{},[153,201,202],{},[58,203,204],{},"grantConsent()",[153,206,207,208,163],{},"Lets the module run when ",[58,209,162],{},[138,211,212,216],{},[153,213,214],{},[58,215,112],{},[153,217,218],{},"Counters, latency percentiles, hit rate and the estimated cost.",[138,220,221,225],{},[153,222,223],{},[58,224,117],{},[153,226,227,228,197],{},"What is speculated right now, or ",[58,229,230],{},"null",[232,233,234],"note",{},[235,236,237,239,240,242],"p",{},[58,238,170],{}," stays paused until you call ",[58,241,180],{},". A navigation will not undo it, which is a\ndeliberate change from an earlier version that silently resumed on every route change.",[235,244,245,246,248],{},"On the server, and when the module is off, ",[58,247,60],{}," returns a no-op object, so a page can\ncall it unconditionally.",[54,250,252],{"id":251},"per-page","Per page",[62,254,258],{"className":255,"code":256,"language":257,"meta":67,"style":67},"language-vue shiki shiki-themes github-light github-dark github-dark","\u003Cscript setup>\ndefinePageMeta({ precog: false });\n\u003C\u002Fscript>\n","vue",[58,259,260,275,290],{"__ignoreMap":67},[71,261,262,265,269,272],{"class":73,"line":74},[71,263,264],{"class":81},"\u003C",[71,266,268],{"class":267},"sByVh","script",[71,270,271],{"class":126}," setup",[71,273,274],{"class":81},">\n",[71,276,278,281,284,287],{"class":73,"line":277},2,[71,279,280],{"class":126},"definePageMeta",[71,282,283],{"class":81},"({ precog: ",[71,285,286],{"class":85},"false",[71,288,289],{"class":81}," });\n",[71,291,293,296,298],{"class":73,"line":292},3,[71,294,295],{"class":81},"\u003C\u002F",[71,297,268],{"class":267},[71,299,274],{"class":81},[235,301,302],{},"The module collects nothing and speculates nothing while this page is open, and picks up again\nwhen the visitor leaves it.",[54,304,306],{"id":305},"per-link","Per link",[62,308,310],{"className":255,"code":309,"language":257,"meta":67,"style":67},"\u003Ctemplate>\n  \u003CNuxtLink to=\"\u002Fsettings\" data-precog=\"off\">Never speculate this\u003C\u002FNuxtLink>\n  \u003CNuxtLink to=\"\u002Fpricing\" data-precog=\"hint\">Always a candidate, even off screen\u003C\u002FNuxtLink>\n\u003C\u002Ftemplate>\n",[58,311,312,321,353,380],{"__ignoreMap":67},[71,313,314,316,319],{"class":73,"line":74},[71,315,264],{"class":81},[71,317,318],{"class":267},"template",[71,320,274],{"class":81},[71,322,323,326,329,332,334,338,341,343,346,349,351],{"class":73,"line":277},[71,324,325],{"class":81},"  \u003C",[71,327,328],{"class":267},"NuxtLink",[71,330,331],{"class":126}," to",[71,333,123],{"class":81},[71,335,337],{"class":336},"sfrk1","\"\u002Fsettings\"",[71,339,340],{"class":126}," data-precog",[71,342,123],{"class":81},[71,344,345],{"class":336},"\"off\"",[71,347,348],{"class":81},">Never speculate this\u003C\u002F",[71,350,328],{"class":267},[71,352,274],{"class":81},[71,354,355,357,359,361,363,366,368,370,373,376,378],{"class":73,"line":292},[71,356,325],{"class":81},[71,358,328],{"class":267},[71,360,331],{"class":126},[71,362,123],{"class":81},[71,364,365],{"class":336},"\"\u002Fpricing\"",[71,367,340],{"class":126},[71,369,123],{"class":81},[71,371,372],{"class":336},"\"hint\"",[71,374,375],{"class":81},">Always a candidate, even off screen\u003C\u002F",[71,377,328],{"class":267},[71,379,274],{"class":81},[71,381,383,385,387],{"class":73,"line":382},4,[71,384,295],{"class":81},[71,386,318],{"class":267},[71,388,274],{"class":81},[54,390,392],{"id":391},"client-hooks","Client hooks",[62,394,396],{"className":64,"code":395,"language":66,"meta":67,"style":67},"nuxtApp.hook(\"precog:decision\", (plan, trigger) => {\n  \u002F\u002F trigger is 'route' | 'scroll' | 'pointer' | 'dom' | 'manual' | 'visible'\n});\n\nnuxtApp.hook(\"precog:metrics\", (summary) => {\n  \u002F\u002F summary.hitRate, summary.p95, summary.inputTokens, ...\n});\n",[58,397,398,432,438,443,449,472,478],{"__ignoreMap":67},[71,399,400,403,406,409,412,415,418,420,423,426,429],{"class":73,"line":74},[71,401,402],{"class":81},"nuxtApp.",[71,404,405],{"class":126},"hook",[71,407,408],{"class":81},"(",[71,410,411],{"class":336},"\"precog:decision\"",[71,413,414],{"class":81},", (",[71,416,117],{"class":417},"sQHwn",[71,419,89],{"class":81},[71,421,422],{"class":417},"trigger",[71,424,425],{"class":81},") ",[71,427,428],{"class":77},"=>",[71,430,431],{"class":81}," {\n",[71,433,434],{"class":73,"line":277},[71,435,437],{"class":436},"sCsY4","  \u002F\u002F trigger is 'route' | 'scroll' | 'pointer' | 'dom' | 'manual' | 'visible'\n",[71,439,440],{"class":73,"line":292},[71,441,442],{"class":81},"});\n",[71,444,445],{"class":73,"line":382},[71,446,448],{"emptyLinePlaceholder":447},true,"\n",[71,450,452,454,456,458,461,463,466,468,470],{"class":73,"line":451},5,[71,453,402],{"class":81},[71,455,405],{"class":126},[71,457,408],{"class":81},[71,459,460],{"class":336},"\"precog:metrics\"",[71,462,414],{"class":81},[71,464,465],{"class":417},"summary",[71,467,425],{"class":81},[71,469,428],{"class":77},[71,471,431],{"class":81},[71,473,475],{"class":73,"line":474},6,[71,476,477],{"class":436},"  \u002F\u002F summary.hitRate, summary.p95, summary.inputTokens, ...\n",[71,479,481],{"class":73,"line":480},7,[71,482,442],{"class":81},[235,484,485,486,489],{},"A route change fires ",[58,487,488],{},"precog:decision"," with an empty plan, because the links the old plan named\nare gone.",[54,491,493],{"id":492},"server-hooks","Server hooks",[235,495,496],{},"In a Nitro plugin:",[62,498,501],{"className":64,"code":499,"filename":500,"language":66,"meta":67,"style":67},"export default defineNitroPlugin((nitro) => {\n  nitro.hooks.hook(\"precog:predict\", (ctx) => {\n    \u002F\u002F Read ctx.state, or set ctx.prediction to answer without calling Jev at all.\n  });\n\n  nitro.hooks.hook(\"precog:predicted\", (ctx) => {\n    \u002F\u002F Every fresh answer. ctx.substituted is true when it came from the hook above.\n  });\n});\n","server\u002Fplugins\u002Fprecog.ts",[58,502,503,526,549,554,559,563,584,589,594],{"__ignoreMap":67},[71,504,505,508,511,514,517,520,522,524],{"class":73,"line":74},[71,506,507],{"class":77},"export",[71,509,510],{"class":77}," default",[71,512,513],{"class":126}," defineNitroPlugin",[71,515,516],{"class":81},"((",[71,518,519],{"class":417},"nitro",[71,521,425],{"class":81},[71,523,428],{"class":77},[71,525,431],{"class":81},[71,527,528,531,533,535,538,540,543,545,547],{"class":73,"line":277},[71,529,530],{"class":81},"  nitro.hooks.",[71,532,405],{"class":126},[71,534,408],{"class":81},[71,536,537],{"class":336},"\"precog:predict\"",[71,539,414],{"class":81},[71,541,542],{"class":417},"ctx",[71,544,425],{"class":81},[71,546,428],{"class":77},[71,548,431],{"class":81},[71,550,551],{"class":73,"line":292},[71,552,553],{"class":436},"    \u002F\u002F Read ctx.state, or set ctx.prediction to answer without calling Jev at all.\n",[71,555,556],{"class":73,"line":382},[71,557,558],{"class":81},"  });\n",[71,560,561],{"class":73,"line":451},[71,562,448],{"emptyLinePlaceholder":447},[71,564,565,567,569,571,574,576,578,580,582],{"class":73,"line":474},[71,566,530],{"class":81},[71,568,405],{"class":126},[71,570,408],{"class":81},[71,572,573],{"class":336},"\"precog:predicted\"",[71,575,414],{"class":81},[71,577,542],{"class":417},[71,579,425],{"class":81},[71,581,428],{"class":77},[71,583,431],{"class":81},[71,585,586],{"class":73,"line":480},[71,587,588],{"class":436},"    \u002F\u002F Every fresh answer. ctx.substituted is true when it came from the hook above.\n",[71,590,592],{"class":73,"line":591},8,[71,593,558],{"class":81},[71,595,597],{"class":73,"line":596},9,[71,598,442],{"class":81},[235,600,601,604,605,608],{},[58,602,603],{},"precog:predict"," is how the playground runs with no API key, and how you would swap in your own\nmodel. ",[58,606,607],{},"precog:predicted"," is how it records real answers for replay.",[232,610,611],{},[235,612,613,614,616,617,619],{},"A ",[58,615,607],{}," listener that throws is ignored: the prediction already happened and the\nvisitor gets it. A ",[58,618,603],{}," listener that throws fails the request, because that hook is\nallowed to replace the answer.",[235,621,622,623,626,627,630],{},"When a prediction fails, the endpoint answers ",[58,624,625],{},"503"," with an empty prediction and puts a short\nreason in the ",[58,628,629],{},"x-precog-reason"," header. The client falls open either way.",[54,632,634],{"id":633},"types","Types",[62,636,638],{"className":64,"code":637,"language":66,"meta":67,"style":67},"import type {\n  PrecogPlan,\n  PrecogPrediction,\n  PrecogState,\n  PrecogCandidate,\n  MetricsSummary,\n} from \"nuxt-precog\";\n",[58,639,640,650,655,660,665,670,675],{"__ignoreMap":67},[71,641,642,645,648],{"class":73,"line":74},[71,643,644],{"class":77},"import",[71,646,647],{"class":77}," type",[71,649,431],{"class":81},[71,651,652],{"class":73,"line":277},[71,653,654],{"class":81},"  PrecogPlan,\n",[71,656,657],{"class":73,"line":292},[71,658,659],{"class":81},"  PrecogPrediction,\n",[71,661,662],{"class":73,"line":382},[71,663,664],{"class":81},"  PrecogState,\n",[71,666,667],{"class":73,"line":451},[71,668,669],{"class":81},"  PrecogCandidate,\n",[71,671,672],{"class":73,"line":474},[71,673,674],{"class":81},"  MetricsSummary,\n",[71,676,677,680,683,686],{"class":73,"line":480},[71,678,679],{"class":81},"} ",[71,681,682],{"class":77},"from",[71,684,685],{"class":336}," \"nuxt-precog\"",[71,687,688],{"class":81},";\n",[690,691,692],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sByVh, html code.shiki .sByVh{--shiki-light:#22863A;--shiki-default:#85E89D;--shiki-dark:#85E89D}",{"title":67,"searchDepth":277,"depth":277,"links":694},[695,696,697,698,699,700],{"id":56,"depth":277,"text":60},{"id":251,"depth":277,"text":252},{"id":305,"depth":277,"text":306},{"id":391,"depth":277,"text":392},{"id":492,"depth":277,"text":493},{"id":633,"depth":277,"text":634},"The composable, the hooks, and the page and link attributes.","md",{"icon":36},{"icon":36},{"title":33,"description":701},"J_-C1iwPDDW-gYfF9SPWw0bEPnncVHJDEF8MdHyGjck",[708,710],{"title":28,"path":29,"stem":30,"description":709,"icon":31,"children":-1},"Everything under the precog key in nuxt.config.ts.",{"title":38,"path":39,"stem":40,"description":67,"icon":41,"children":-1},1789942050301]