1var f=Object.defineProperty;var g=(i,t,e)=>t in i?f(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var y=(i,t,e)=>g(i,typeof t!="symbol"?t+"":t,e);import{l as v,S as p}from"./remoteActionApprovalC_byoH4M.js";import{b as S}from"./item.typesx7Q7rrX9.js";import{b}from"./AIToolGateTJCcVK_a.js";import{f as w}from"./chunkReloadRecoveryrjuMb-b8.js";import"./OperationQueueKzEpmh-u.js";import"./item-name.utilsBH3paGZr.js";import"./dexie2jmnBxhj.js";import"./content.typesyje91KzF.js";import"./constantsDW26WJ6H.js";import"./extraction.pure.utilsDQPW8yIh.js";import"./url.utils3SlYVg-c.js";import"./classificationEvalProgramStatusBazwXda2.js";import"./ActivityUtilsDiYdCK40.js";import"./reason-code.utilswudkndKE.js";import"./reason-metadataDPJV5z5v.js";import"./socialMediaSitesDTleWHW6.js";import"./regexCcuTG5WM.js";import"./appUsageDisplayBY7OQki1.js";import"./urlGuardsBFjEFH91.js";import"./deviceAppIdsBqiQQIm5.js";import"./sentryUtilsC8JjCXHs.js";import"./ItemServiceDYS7Z6Pr.js";import"./noteAttachmentDId5R_kp.js";import"./file_utilsBvAXo0vA.js";import"./api-typesD1zIcSfT.js";import"./freshSignInv8N2vL5e.js";import"./textEmbeddingUtilsBRNkRshv.js";import"./searchContentKindsBGoDYC-k.js";import"./feedback.utilscwcZGi10.js";import"./feedDiscoveryCsjZq3pR.js";import"./itemImageSourcesCubmTdva.js";import"./search-provider.utilsBiOzVtNa.js";import"./statusFacetsB0tsuUpJ.js";import"./browseFacets8dSOpUAG.js";import"./rolloutCapsBJsLLLO7.js";import"./vue-runtimeBHGad_ZB.js";import"./cjs-helpersC4iS2aBk.js";import"./bootstrap-vue-nextDXY4qsO1.js";import"./classificationRulesDUyL5GMw.js";import"./browserTabsCpW6SD42.js";import"./settingsMenuCatalogBT0bsy85.js";import"./tourGateGu4icdk6.js";import"./searchTargets.pureDLBWinh3.js";import"./SearchHistoryStoreBNg-02Jq.js";import"./urlDuplicateMatchingB9T_GhRn.js";import"./siteBlockModeCGmJVg0R.js";import"./alwaysAllowedBZhbIqQn.js";import"./familyClockv2WXhBE2.js";import"./deviceAppPolicyG0TWkbSX.js";import"./familyDowntimeDMv_mvJ9.js";import"./google-ai-modeaEFJUNOw.js";import"./usageBDNfLijZ.js";import"./v4CtRu48qb.js";import"./restrictionPresetsAJUpiAxw.js";import"./deviceAppInventoryMergevnYbxNmN.js";import"./usageIdentityCn48n3s8.js";import"./usageInterventionModeBjzyP5YP.js";import"./TextEmbeddingServiceD7QjSnH7.js";import"./analysis-utilsDkY9KbJt.js";import"./queryEmbeddingl6fVc4SQ.js";import"./usageRuleStateD0i2H3LO.js";import"./aiAgentApprovalsDHfWEcxe.js";import"./scopedSettings39hV2RLq.js";import"./TaskServiceWHtFbUzu.js";import"./TaskCompletionRefStateServiceDiefvKK0.js";import"./refStateBatchSupportDh0Q7mM-.js";import"./TaskItemServiceP03d_i_t.js";import"./libraryWriteGuardslN41qmuD.js";import"./restrictedSiteAccessWarning.utilsCD4Urb73.js";import"./ai_lookup_utilszDX_hcwM.js";import"./typespYBkq7G_.js";import"./appTestRunfuVuTQEj.js";import"./aiLimitCopyBGu8nbyi.js";import"./ai-task-modelsBeJRs03P.js";import"./firefoxMlProbeV0nNkr25.js";import"./ActivityVisitServiceBx6JVwhp.js";import"./libraryWritesCIlf8O8q.js";import"./ruleOverrideUtilsbdiM4nZd.js";import"./usageRowStatuscqOMbT-P.js";import"./deviceHealthCq8tdRO9.js";import"./sidebarNavDnagZR1g.js";import"./agentParentalGrantCz4Xs1Ac.js";import"./familyDowntimeCopyBHQ3lAwm.js";import"./dayGroupLabelsBMNWfGiA.js";const I={type:"object",properties:{label:{type:"string",description:'Short name for this cleanup, e.g. "Hide recommendations"'},css:{type:"string",description:"The CSS rules. Selectors and display:none declarations only."},rationale:{type:"string",description:"One sentence on what was hidden and why."}},required:["label","css"]},C=` 2Write selectors that survive a redesign. In order of preference: 31. Custom element tag names the site defines (ytd-rich-shelf-renderer, shreddit-comment-tree). 42. ARIA landmarks and roles ([role="complementary"], aside, [role="banner"]). 53. Stable semantic attributes ([aria-label="..."], [data-testid="..."], [page-subtype="home"]). 6 7Never use: 8- An id derived from one piece of content (#t3_1hgkflm). It dies when that post scrolls away. 9- Build-generated class names (.css-1x2y3z, .sc-bdVaJa). They change on the next deploy. 10- Chains of four or more utility classes (.flex.gap-sm.items-center.h-2xl). 11- :nth-child or :nth-of-type. Lists reorder. 12 13Do not target ads; they are handled elsewhere. Target engagement noise: recommendation 14shelves, side rails, autoplay overlays, infinite-scroll trays, c
14omment sections. 15Use "display: none !important" and nothing else. Never write a url(), @import, or 16position/size rule that could break the page layout. 17`.trim(),m=class m{static get instance(){return this._staticInstance||(this._staticInstance=new m),this._staticInstance}async generate(t){var r,s;const e={ok:!1,css:"",label:"",issues:[]};try{let o=`${C} 18 19Write CSS that removes distractions from this page.`;(r=t.instructions)!=null&&r.trim()&&(o+=` 20 21The user asked for: ${t.instructions.trim()}`),t.previousAttempt&&((s=t.previousIssues)!=null&&s.length)&&(o+=` 22 23Your previous attempt was rejected. Fix these selectors and keep the rest: 24`+t.previousIssues.map(h=>`- "${h.selector}" â ${h.detail}`).join(` 25`)+` 26 27Previous attempt: 28${t.previousAttempt}`);const d=await b.instance.textRequest({instructions:o,context:t.outline,schema:I}),a=this.parseResponse(d);if(!a)return{...e,error:"The model returned nothing usable."};const l=S(a.css);if(!l.trim())return{...e,error:"The model returned no usable CSS."};const u=v(l);return{ok:u.ok,css:l,label:a.label||"Cleanup",rationale:a.rationale,issues:u.issues}}catch(o){return w("SiteStyleGenerator: generation failed",o),{...e,error:(o==null?void 0:o.message)||"Generation failed."}}}async generateWithRetries(t,e=3){let r={ok:!1,css:"",label:"",issues:[]};for(let s=0;s<e;s++)if(r=await this.generate({...t,previousAttempt:s>0?r.css:void 0,previousIssues:s>0?r.issues:void 0}),r.ok||r.error)return r;return r}parseResponse(t){const e=typeof t=="string"?t:(t==null?void 0:t.text)??t;if(!e)return null;if(typeof e=="object"&&typeof e.css=="string")return e;if(typeof e=="string")try{const r=e.replace(/^```(?:json)?\s*/i,"").replace(/\s*```$/,""),s=JSON.parse(r);if(typeof(s==null?void 0:s.css)=="string")return s}catch{return null}return null}};y(m,"_staticInstance",null);let c=m;const n=[];n.push({path:"/sitestyle/forUrl",handler:async(i,t)=>({success:!0,entries:await p.instance.getEntriesForUrl((t==null?void 0:t.url)||"")})});n.push({path:"/sitestyle/list",handler:async(i,t)=>({success:!0,...await p.instance.listForUser((t==null?void 0:t.userId)||null,(t==null?void 0:t.userType)||null)})});n.push({path:"/sitestyle/reportMatch",handler:async(i,t)=>(await p.instance.recordMatchReport(t),{success:!0})});n.push({path:"/sitestyle/matchReports",handler:async()=>({success:!0,reports:await p.instance.listMatchReports()})});n.push({path:"/sitestyle/saveEntry",handler:async(i,t)=>await p.instance.saveEntry(t)});n.push({path:"/sitestyle/revertEntry",handler:async(i,t)=>await p.instance.revertEntry(t)});n.push({path:"/sitestyle/generate",handler:async(i,t)=>{const e=await c.instance.generateWithRetries({outline:t==null?void 0:t.outline,instructions:t==null?void 0:t.instructions});return{success:e.ok,...e}}});export{n as default};
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.