1const c="image_upload",T=6,y="[Attached workspace media assets]";const f=/data:([a-z0-9.+-]+\/[a-z0-9.+-]+)(?:;[^,]*)?,[a-z0-9+/=_-]+/gi,u="[omitted persisted media data URL]",d=new Set(["base64","dataUrl","dataURL","experimental_attachments","previewDataUrl"]);function o(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function U(e){return e.includes("data:")?e.replace(f,(i,n)=>i.length<=160?i:`${u} (${n})`):e}function a(e,i){if(typeof e=="string")return i&&d.has(i)?e.startsWith("data:")||e.length>160?u:e:U(e);if(Array.isArray(e))return e.map(r=>a(r));if(!o(e))return e;const n={};for(const[r,t]of Object.entries(e))d.has(r)||(n[r]=a(t,r));return n}function p(e){const i=String(e||"").trim().toLowerCase();return i.startsWith("image/")?"image":i.startsWith("video/")?"video":i.startsWith("audio/")?"audio":"file"}function m(e){return o(e)?e.type===c&&typeof e.assetId=="string"&&e.assetId.length>0&&typeof e.projectId=="string"&&e.projectId.length>0&&typeof e.storageKey=="string"&&e.storageKey.length>0&&typeof e.url=="string"&&e.url.length>0:!1}function I(e){return{type:c,assetId:e.id,projectId:e.workspaceid,storageKey:e.originalKey,optimizedStorageKey:e.optimizedKey,thumbnailStorageKey:e.thumbnailKey,url:e.url,optimizedUrl:e.optimizedUrl,thumbnailUrl:e.thumbnailUrl,filename:e.filename,mimeType:e.mimeType,width:e.width,height:e.height,sizeBytes:e.sizeBytes,source:e.source,category:e.category,assetType:e.assetType,appId:e.appId,visibility:e.visibility,publicKey:e.publicKey,publicBucket:e.publicBucket,publicUrl:e.publicUrl,mediaKind:e.assetType||p(e.mimeType),signedUrl:e.signedUrl,signedUrlStrategy:e.signedUrlStrategy}}function S(e){const i=e?.annotations;return Array.isArray(i)?i.filter(m):[]}function E(e,i){if(i.length===0)return e;const n=Array.isArray(e)?[...e]:[],r=new Set;for(const t of n)m(t)&&r.add(t.assetId);for(const t of i)r.has(t.assetId)||(n.push(t),r.add(t.assetId));return n}function b(e){return e.publicUrl||e.workspacePublicUrl||e.signedUrl||e.optimizedUrl||e.url}function R(e,i={}){const n=[y,"The user selected these managed workspace media assets. They are provided as public R2/CDN URLs in this text context; no image, video, or audio binary is attached to this model request.","Use these exact URLs whenever the user asks to use the selected, attached, uploaded, or provided media.","Do not replace them with stock photos, placeholder graphics, gradients, newly generated illustrations, or generic sample media.","Use the listed publicUrl directly in generated app or site code. Do not use a remote asset API URL when a publicUrl is available.","When multiple media assets are listed, keep each asset mapped to its own distinct URL. Asset 1 must use Asset 1 publicUrl, Asset 2 must use Asset 2 publicUrl, and so on.",i.newsletter?"If the user asks for the first attached image, first image, attached image, or hero image, place Asset 1 in the first/hero newsletter section using its publicUrl.":null,i.newsletter?"For newsletter email output, never embed <video> or <audio>. Use video/audio assets only as linked email-safe cards with thumbnail/icon, title, short description, and a button to the publicUrl.":"For image assets, render a real <img> element using the matching publicUrl.",i.newsletter?"For newsletter images, insert the publicUrl directly only when it is an HTTPS URL on cdn.cloudmysite.ai.":'For video assets, render a real <video> element with src set to the matching publicUrl plus controls, playsInline, and preload="metadata". Do not set muted, defaultMuted, volume={0}, or autoPlay unless the user explicitly asks for muted/autoplay video; preserve audio playback.',i.newsletter?null:"For audio assets, render a real <audio> element with controls and src set to the matching publicUrl."].filter(r=>typeof r=="string"&&r.length>0);for(const[r,t]of e.entries()){const s=b(t),h=t.mediaKind||t.assetType||p(t.mimeType),g=[` assetId: ${t.assetId}`,` mediaKind: ${h}`,t.mimeType?` mimeType: ${t.mimeType}`:null,t.filename?` filename: ${t.filename}`:null,t.title?` title: ${t.title}`:null,t.durationSeconds?` durationSeconds: ${t.durationSeconds}`:null,t.builderSource?` source: ${t.builderSource}`:null,t.intendedUse?` intendedUse: ${t.intendedUse}`:null,s?` publicUrl: ${s}`:null,t.publicUrl?" publicUrlStrategy: public-r2-url":t.signedUrlStrategy?` publicUrlStrategy: ${t.signedUrlStrategy}`:null,t.thumbnailUrl?` thumbnailUrl: ${t.thumbnailUrl}`:null,t.workspaceFilePath?` projectFile: ${t.workspaceFilePath}`:null,t.width&&t.height?` dimensions: ${t.width}x${t.height}`:null,t.sizeBytes?` sizeBytes: ${t.sizeBytes}`:null].filter(l=>typeof l=="string"&&l.length>0);n.push(`Asset ${r+1}:`,...g)}return n.join(` 2`)}function A(e){const i=Array.isArray(e.parts)?e.parts:[],n=i.filter(s=>o(s)&&s.type==="text").map(s=>a(s)),r=n.length!==i.length,t=a(e);return r&&(t.parts=n),"experimental_attachments"in t&&delete t.experimental_attachments,t}function _(e){return e.map(i=>A(i))}export{T as M,y as W,I as a,E as b,R as c,S as e,p as g,m as i,_ as s};
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.