{
  "sourceKind": "separate production-editor working copy; not a public GitHub commit",
  "reviewedAt": "2026-10-22",
  "excerpts": [
    {
      "file": "app/studio/content-aware.ts",
      "start": 7,
      "end": 15,
      "code": "/** Exemplar patch synthesis. Donor patches never include selected or excluded pixels. */\nexport async function contentAwarePixels(image:{width:number;height:number;data:Uint8ClampedArray|Float32Array},mask:ArrayLike<number>,options:Pick<FillOptions,'radius'|'sampling'|'signal'|'progress'>){\n check(options.signal);const {width:w,height:h}=image,n=w*h,r=Math.round(options.radius);if(!supportedSize(w,h)||!Number.isInteger(w)||!Number.isInteger(h)||image.data.length!==n*4||mask.length!==n||!Number.isFinite(r)||r<1||r>15)throw Error('Invalid fill image or patch size.');if(options.sampling&&(options.sampling.length!==n||options.sampling.some(v=>!Number.isFinite(v)||v<0||v>255)))throw Error('Invalid sampling area.');\n const source=image.data,out=source.slice(),missing=new Uint8Array(n),queue=new Int32Array(n),seen=new Uint8Array(n),integral=new Int32Array((w+1)*(h+1));let total=0,tail=0;\n for(let y=0;y<h;y++){if(y%64===0){check(options.signal);await new Promise(r=>setTimeout(r,0));}let row=0;for(let x=0;x<w;x++){const i=y*w+x;if(!Number.isFinite(mask[i])||mask[i]<0||mask[i]>255)throw Error('Invalid fill selection.');missing[i]=mask[i]>0?1:0;total+=missing[i];row+=missing[i]||source[i*4+3]<250||options.sampling&&options.sampling[i]<128?1:0;integral[(y+1)*(w+1)+x+1]=integral[y*(w+1)+x+1]+row;}}\n if(!total)throw Error('Select an area to fill.');\n const candidates:number[]=[],valid=new Uint8Array(n),stride=w+1;\n for(let y=r;y<h-r;y++){if(y%64===0){check(options.signal);await new Promise(r=>setTimeout(r,0));}for(let x=r;x<w-r;x++){const x0=x-r,y0=y-r,x1=x+r+1,y1=y+r+1;if(integral[y1*stride+x1]-integral[y0*stride+x1]-integral[y1*stride+x0]+integral[y0*stride+x0]===0){valid[y*w+x]=1;candidates.push(y*w+x);}}}\n if(!candidates.length)throw Error('No clean sampling patch. Expand the sampling area or reduce Patch Size.');",
      "ref": "working-copy-2026-10-22",
      "sha256": "3f1bafefa260a1f7f61126b72b6be5b8ca8cb01833dacba13a8b0a208b861029"
    },
    {
      "file": "app/studio/content-aware.ts",
      "start": 33,
      "end": 37,
      "code": "export async function contentAwareFill(doc:StudioDoc,layer:Layer,options:FillOptions):Promise<StudioDoc>{\n\n if(!doc.selection)throw Error('Make a selection first.');if(options.output==='new'&&doc.layers.length>=256)throw Error('Up to 256 layers.');if(options.output==='current'&&(layerLocked(doc,layer,'pixels')||layer.kind==='text'||layer.kind==='adjustment'||layer.shape||layer.smartObject||layer.gridWarp||layer.puppet))throw Error('Choose New Layer or an unlocked raster layer.');\n check(options.signal);const edit=await openPixelEdit(options.sample==='all'?doc:{...doc,layers:[layer]}),pixels=edit.image,result=await contentAwarePixels(pixels,doc.selection.alpha,options);check(options.signal);\n if(options.output==='new'){for(let i=0;i<doc.width*doc.height;i++)result[i*4+3]*=doc.selection.alpha[i]/255;const output=await newPixelEditLayer(edit,'Content-Aware Fill',result);check(options.signal);return {...doc,layers:[...doc.layers,output]};}",
      "ref": "working-copy-2026-10-22",
      "sha256": "3f1bafefa260a1f7f61126b72b6be5b8ca8cb01833dacba13a8b0a208b861029"
    },
    {
      "file": "app/studio/content-scale.ts",
      "start": 9,
      "end": 12,
      "code": "/** Dynamic-programming seams, including masks, follow the same pixel correspondence. */\nexport async function carveImage(input:ImageBuffer,width:number,height:number,options:{signal?:AbortSignal;progress?:(n:number)=>void}={}){\n if(!supportedSize(width,height)||!Number.isInteger(width)||!Number.isInteger(height)||!supportedSize(input.width,input.height)||input.data.length!==input.width*input.height*4||input.channels.some(c=>c.length!==input.width*input.height||c.some(v=>!Number.isFinite(v)||v<0||v>255)))throw Error('Invalid content-aware size or channels.');let image:ImageBuffer={...input,data:input.data.slice(),channels:input.channels.map(c=>c.slice())},done=0,total=Math.abs(width-input.width)+Math.abs(height-input.height),yieldAt=performance.now();\n const checkpoint=async()=>{if(options.signal?.aborted)throw new DOMException('Scale canceled.','AbortError');if(performance.now()-yieldAt>16){options.progress?.(total?done/total:1);await new Promise(r=>setTimeout(r,0));yieldAt=performance.now();if(options.signal?.aborted)throw new DOMException('Scale canceled.','AbortError');}};",
      "ref": "working-copy-2026-10-22",
      "sha256": "ff2884f5e7a4c6d52baa3174245a3dbb4add751f863c349b895f3047b9f00bd7"
    },
    {
      "file": "app/studio/content-scale.ts",
      "start": 20,
      "end": 24,
      "code": "export async function contentAwareScale(doc:StudioDoc,layer:Layer,options:ScaleOptions):Promise<StudioDoc>{\n\n if(layerLocked(doc,layer,'pixels')||layerLocked(doc,layer,'position')||layer.kind==='adjustment'||layer.kind==='text'||layer.smartObject||layer.shape||layer.gridWarp||layer.puppet)throw Error('Select an unlocked raster layer. Rasterize type, shapes, Smart Objects or existing warps first.');if(!Number.isInteger(options.anchor)||options.anchor<0||options.anchor>8)throw Error('Invalid scale reference point.');\n const edit=await openPixelEdit(doc,layer),canvas=edit.canvas,pixels=edit.image,selected=options.protect==='$selection'?doc.selection:options.protect?doc.savedSelections?.[options.protect]:undefined;if(options.protect&&!selected)throw Error('Protection selection is unavailable.');const channels=[selected?Float32Array.from(selectionForLayer(selected,layer).alpha):new Float32Array(canvas.width*canvas.height)],maskKeys=(['mask','vectorMask'] as const).filter(k=>layer[k]);for(const key of maskKeys){const m=maskSurface({...layer[key]!,enabled:true},canvas.width,canvas.height),p=m.getContext('2d')!.getImageData(0,0,m.width,m.height).data;channels.push(Float32Array.from({length:m.width*m.height},(_,i)=>p[i*4+3]));}\n const result=await carveImage({width:pixels.width,height:pixels.height,data:pixels.data,channels},options.width,options.height,options);const raster=await closePixelEdit(edit,layer,result.data,result.width,result.height),masks:Partial<Layer>={};if(options.signal?.aborted)throw new DOMException('Scale canceled.','AbortError');maskKeys.forEach((key,i)=>{masks[key]={width:result.width,height:result.height,enabled:layer[key]!.enabled,inverted:false,strokes:[],raster:{width:result.width,height:result.height,alpha:Array.from(result.channels[i+1],Math.round)}};});if(layer.vectorMask){const enabled=maskKeys.filter(key=>layer[key]!.enabled),merge=enabled.length?enabled:maskKeys;masks.mask={width:result.width,height:result.height,enabled:enabled.length>0,inverted:false,strokes:[],raster:{width:result.width,height:result.height,alpha:Array.from({length:result.width*result.height},(_,n)=>Math.round(merge.reduce((a,key)=>a*result.channels[maskKeys.indexOf(key)+1][n]/255,255)))}};masks.vectorMask=undefined;}const next=aroundAnchor(layer,{...raster,...masks,width:result.width,height:result.height},options.anchor);return {...doc,layers:doc.layers.map(l=>l.id===layer.id?next:l)};",
      "ref": "working-copy-2026-10-22",
      "sha256": "ff2884f5e7a4c6d52baa3174245a3dbb4add751f863c349b895f3047b9f00bd7"
    }
  ],
  "productionUI": {
    "originalBytesUnchanged": true,
    "layers": [
      "original",
      "Content-Aware Fill"
    ],
    "size": [
      1536,
      1024
    ],
    "alphaBBox": [
      187,
      305,
      340,
      463
    ],
    "alphaLevels": 255,
    "passed": true,
    "date": "2026-10-22",
    "route": "Corrected fill selection and successful repeat; protected and unprotected scaling with saved-pixel checks",
    "settings": {
      "feather": 4,
      "patchSize": 4,
      "sample": "all",
      "sampling": "outside selection",
      "output": "new"
    },
    "noSourceError": "No clean sampling patch. Expand the sampling area or reduce Patch Size.",
    "cancelLayersUnchanged": true,
    "contentScaleDirectlyTested": true,
    "historicalSuiteRerun": false,
    "fillCorrectedAndRepeated": true,
    "repeatFillPixelsMatch": true,
    "protectedScale": {
      "passed": true,
      "document": [
        1536,
        1024
      ],
      "layer": [
        336,
        0,
        1200,
        1024
      ],
      "protectedPixels": 757020,
      "protectedBounds": [
        796,
        1,
        1536,
        1024
      ],
      "maximumProtectedPixelDifference": 0,
      "meanProtectedPixelDifference": 0.0,
      "anchor": "Middle Right",
      "protect": "Portrait protect"
    },
    "unprotectedComparison": {
      "protectedPixelsCompared": 757020,
      "changedPixelsWithoutProtection": 522490,
      "maximumDifference": 188,
      "meanAbsoluteDifference": 8.91982906660326,
      "sameSizeAndAnchor": true
    }
  },
  "historicalReports": [
    {
      "file": "creative-advanced-render-results.json",
      "sha256": "8b4b31dc709a693b61c1c942154989c138012d4deee51618ac12221b86e3e649",
      "results": {
        "passed": true,
        "checks": [
          "All/current-below sampling, hidden layer exclusion, blank target, transformed target, aligned source",
          "Patch fill clean source exclusion, custom sampling, untouched pixels, new/current output, cancellation and source immutability",
          "Spot Healing removes selected object; Smudge transports color and handles off-canvas strokes",
          "Arc-length path type, flip, editable project and PSD/PSB restoration, smart conversion",
          "Content-aware shrink/enlarge in both axes, protected subject proportions, mask correspondence, reference point, one-pixel alpha and cancellation"
        ]
      },
      "freshRun": false
    },
    {
      "file": "creative-advanced-ui-results.json",
      "sha256": "7d77a478582344300100c9bae427617ab76de47fab273d03151cfd99fcd2e31a",
      "results": {
        "passed": true,
        "fillPreviewCancelUndoRecovery": true,
        "contentScaleProtectUndoCancel": true,
        "blankLayerSamplingAligned": true,
        "pathTypeControlsUndoRecovery": true,
        "errors": []
      },
      "freshRun": false
    }
  ]
}