1/** 2 * @copyright 2026 Fortee Uniforme Inc. All rights reserved. 3 * @license PROPRIETARY - Unauthorized copying prohibited. 4 * Protected under the Canadian Copyright Act (R.S.C., 1985, c. C-42). 5 */(function(){"use strict";var CM_PER_IN=2.54,DEFAULTS={snapTolIn:.25,stdTolIn:.06,keyStepIn:.25,keyStepShiftIn:1,minFloorIn:.75,minZoneFrac:.15,heightMismatchWarnIn:.5,stdFitFrac:.65},REFERENCE_ZONE_IN=12;function inSpace(geo,inches){return geo&&geo.measured===!1?num(geo.zoneWIn)*(num(inches)/REFERENCE_ZONE_IN):num(inches)}function num(v){var n=Number(v);return isFinite(n)?n:0}function clamp(v,lo,hi){return hi>lo?v<lo?lo:v>hi?hi:v:lo}function round4(v){return Math.round(num(v)*1e4)/1e4}function toInches(magnitude,unit){var n=Number(magnitude);if(!isFinite(n)||n<0)return 0;var u=String(unit||"").toUpperCase().replace(/[^A-Z]/g,"");return u.indexOf("CENTIMET")===0||u==="CM"?n/CM_PER_IN:u.indexOf("MILLIMET")===0||u==="MM"?n/(CM_PER_IN*10):u.indexOf("INCH")===0||u==="IN"?n:u.indexOf("METER")===0||u.indexOf("METRE")===0||u==="M"?n*100/CM_PER_IN:n/CM_PER_IN}function fromInches(inches,unit){var n=Number(inches);if(!isFinite(n))return 0;var u=String(unit||"").toLowerCase();return u==="cm"?n*CM_PER_IN:n}function zonePx(rawZone,boxW,boxH){var z=rawZone||{},W=num(boxW),H=num(boxH),wSrc=z.w!=null?z.w:z.width!=null?z.width:z.size!=null?z.size:"10%",hSrc=z.h!=null?z.h:z.height!=null?z.height:wSrc,wVal=String(wSrc),hVal=String(hSrc),zW,zH;wVal.indexOf("%")!==-1?(zW=W*(parseFloat(wVal)/100),zH=W*(parseFloat(hVal)/100)):(zW=Number(wVal)*(W/600),zH=Number(hVal)*(W/600)),isFinite(zW)||(zW=0),isFinite(zH)||(zH=0);var centerX=W*((parseFloat(z.left)||50)/100),topEdgeY=H*((parseFloat(z.top)||25)/100),angle=Number(z.angle);return isFinite(angle)||(angle=0),{x:centerX-zW/2,y:topEdgeY,w:zW,h:zH,angle:angle}}function paintedRect(natW,natH,boxW,boxH){var nw=Number(natW),nh=Number(natH),bw=Number(boxW),bh=Number(boxH);if(!(isFinite(nw)&&nw>0)||!(isFinite(nh)&&nh>0)||!(isFinite(bw)&&bw>0)||!(isFinite(bh)&&bh>0))return{x:0,y:0,w:num(boxW),h:num(boxH)};var s=Math.min(bw/nw,bh/nh),w=nw*s,h=nh*s;return{x:(bw-w)/2,y:(bh-h)/2,w:w,h:h}}function zoneGeometry(area,rawZone,boxW,boxH){var a=area||{},z=rawZone||{},areaWIn=toInches(a.maxWidth,a.maxWidthUnit),zoneDeclWIn=Number(z.wIn),hasZoneW=isFinite(zoneDeclWIn)&&zoneDeclWIn>0,px=zonePx(rawZone,boxW,boxH);if(!(isFinite(px.w)&&px.w>0))return null;var measured=hasZoneW,wIn=measured?zoneDeclWIn:1,pxPerIn=px.w/wIn;if(!(isFinite(pxPerIn)&&pxPerIn>0))return null;var declaredHIn=toInches(a.maxHeight,a.maxHeightUnit),drawnHIn=px.h/pxPerIn,zoneDeclHIn=Number(z.hIn),hasZoneH=measured&&isFinite(zoneDeclHIn)&&zoneDeclHIn>0,zoneHIn=hasZoneH?zoneDeclHIn:drawnHIn,heightSource=hasZoneH?"zone":"drawn",widthDisagrees=hasZoneW&&areaWIn>0&&Math.abs(zoneDeclWIn-areaWIn)>DEFAULTS.heightMismatchWarnIn,areaImpliedHIn=measured&&declaredHIn>0&&areaWIn>0?wIn*(declaredHIn/areaWIn):null,areaDisagrees=areaImpliedHIn!==null&&Math.abs(zoneHIn-areaImpliedHIn)>DEFAULTS.heightMismatchWarnIn;return{px:px,pxPerIn:pxPerIn,measured:measured,zoneWIn:wIn,zoneHIn:zoneHIn,declaredHIn:declaredHIn,drawnHIn:drawnHIn,areaWIn:areaWIn,boxHpx:zoneHIn*pxPerIn,heightSource:heightSource,angle:px.angle,scaleSource:measured?"zone":"drawn",widthMismatch:widthDisagrees,heightMismatch:Math.abs(drawnHIn-zoneHIn)>DEFAULTS.heightMismatchWarnIn||areaDisagrees||widthDisagrees}}function minWidthIn(geo){if(!geo)return DEFAULTS.minFloorIn;var byFrac=num(geo.zoneWIn)*DEFAULTS.minZoneFrac,m=Math.max(inSpace(geo,DEFAULTS.minFloorIn),byFrac);return Math.min(m,num(geo.zoneWIn))}function snapTolFor(geo,opts){var o=opts||{};return inSpace(geo,typeof o.snapTolIn=="number"?o.snapTolIn:DEFAULTS.snapTolIn)}function keyStepFor(geo,shift){return inSpace(geo,shift?DEFAULTS.keyStepShiftIn:DEFAULTS.keyStepIn)}function stdTolFor(geo){return inSpace(geo,DEFAULTS.stdTolIn)}function fractionToInches(frac,minIn,maxIn){var lo=num(minIn),hi=num(maxIn);if(!(hi>lo))return lo;var f=Number(frac);return isFinite(f)?lo+clamp(f,0,1)*(hi-lo):lo}function inchesToFraction(wIn,minIn,maxIn){var lo=num(minIn),hi=num(maxIn);if(!(hi>lo))return 0;var v=Number(wIn);return isFinite(v)?clamp((v-lo)/(hi-lo),0,1):0}
5function standardPlacement(geo,artAspect,vAlign,hAlign,opts){if(!geo)return{wIn:0,lxIn:0,lyIn:0};var o=opts||{},aspect=Number(artAspect);isFinite(aspect)&&aspect>0||(aspect=1);var zW=num(geo.px&&geo.px.w),zH=num(geo.px&&geo.px.h),frac=typeof o.fitFrac=="number"&&isFinite(o.fitFrac)&&o.fitFrac>0?Math.min(o.fitFrac,1):DEFAULTS.stdFitFrac,fitW=Math.min(zW,zH*aspect)*frac,fitH=fitW/aspect,leftoverW=zW-fitW,leftoverH=zH-fitH,dx=o.centre?leftoverW/2:hAlign==="left"?0:hAlign==="right"?leftoverW:leftoverW/2,dy=o.centre||vAlign==="center"?leftoverH/2:vAlign==="bottom"?leftoverH:0,ppi=num(geo.pxPerIn)||1;return{wIn:fitW/ppi,lxIn:dx/ppi,lyIn:dy/ppi}}function clampPlace(lxIn,lyIn,wIn,artAspect,geo,opts){var o=opts||{};if(!geo)return{wIn:num(wIn),lxIn:num(lxIn),lyIn:num(lyIn),snapped:!1};var aspect=Number(artAspect);isFinite(aspect)&&aspect>0||(aspect=1);var zW=num(geo.zoneWIn),zH=num(geo.zoneHIn),maxW=Math.min(zW,zH*aspect),lo=minWidthIn(geo),w=maxW>lo?clamp(num(wIn),lo,maxW):Math.min(num(wIn)||lo,maxW||lo),h=w/aspect,x=clamp(num(lxIn),0,Math.max(0,zW-w)),y=clamp(num(lyIn),0,Math.max(0,zH-h)),centreX=Math.max(0,zW-w)/2,tol=snapTolFor(geo,o),dist=Math.abs(x-centreX),snapped=dist<1e-6;return o.snap&&dist<tol&&(x=centreX,snapped=!0),{wIn:w,lxIn:x,lyIn:y,snapped:snapped}}function clampRectPx(geo){if(!geo||!geo.px)return null;var ppi=num(geo.pxPerIn);if(!(ppi>0))return null;var w=num(geo.zoneWIn)*ppi,h=num(geo.zoneHIn)*ppi;return w>0&&h>0?{x:num(geo.px.x),y:num(geo.px.y),w:w,h:h}:null}function logoRectPx(geo,rec){if(!geo||!geo.px||!rec)return null;var ppi=num(geo.pxPerIn);if(!(ppi>0))return null;var aspect=Number(rec.aspect);isFinite(aspect)&&aspect>0||(aspect=1);var w=num(rec.wIn)*ppi;return{x:num(geo.px.x)+num(rec.lxIn)*ppi,y:num(geo.px.y)+num(rec.lyIn)*ppi,w:w,h:w/aspect}}function clampWidth(wIn,lxIn,lyIn,artAspect,geo){if(!geo)return num(wIn);var aspect=Number(artAspect);isFinite(aspect)&&aspect>0||(aspect=1);var zW=num(geo.zoneWIn),zH=num(geo.zoneHIn),byRight=zW-num(lxIn),byBottom=(zH-num(lyIn))*aspect,hi=Math.min(zW,byRight,byBottom),lo=minWidthIn(geo);return hi>lo?clamp(num(wIn),lo,hi):lo}function rotateDelta(dx,dy,angleDeg){var a=Number(angleDeg);if(!isFinite(a)||a===0)return{dx:num(dx),dy:num(dy)};var r=-a*Math.PI/180,c=Math.cos(r),s=Math.sin(r);return{dx:num(dx)*c-num(dy)*s,dy:num(dx)*s+num(dy)*c}}function isStandard(place,std,tolIn){if(!place||!std)return!1;var t=typeof tolIn=="number"?tolIn:DEFAULTS.stdTolIn;return Math.abs(num(place.wIn)-num(std.wIn))<=t&&Math.abs(num(place.lxIn)-num(std.lxIn))<=t&&Math.abs(num(place.lyIn)-num(std.lyIn))<=t}function formatMeasure(valueIn,unit,decimalSep){var v=fromInches(valueIn,unit),s=(isFinite(v)?v:0).toFixed(1),sep=decimalSep==null?".":String(decimalSep);return s.split(".").join(sep)}function parseMeasure(raw,unit){if(raw==null)return null;var s=String(raw).trim().split(",").join(".");if(s==="")return null;var n=parseFloat(s);if(!isFinite(n)||n<=0)return null;var u=String(unit||"").toLowerCase();return u==="cm"?n/CM_PER_IN:n}function toCompositorRect(place,geo){return{lxIn:round4(place&&place.lxIn),lyIn:round4(place&&place.lyIn),wIn:round4(place&&place.wIn),zoneWIn:round4(geo&&geo.zoneWIn)}}var UNMEASURED_MARK="unmeasured";function cartMeasureFields(rec){if(!rec)return null;var w=Number(rec.wIn);if(!(isFinite(w)&&w>0))return null;var aspect=Number(rec.aspect);isFinite(aspect)&&aspect>0||(aspect=1);var h=w/aspect,lx=Number(rec.lxIn);isFinite(lx)||(lx=0);var ly=Number(rec.lyIn);if(isFinite(ly)||(ly=0),rec.measured!==!0)return{measured:!1,size:UNMEASURED_MARK,pos:UNMEASURED_MARK,unit:null,wIn:null,hIn:null};var n=function(v){return Number(v).toFixed(1)};return{measured:!0,size:n(w)+"x"+n(h)+" in",pos:n(lx)+","+n(ly)+" in",unit:rec.unit==="cm"?"cm":"po",wIn:w,hIn:h}}function cartMeasureLabel(rec,unit,decimalSep,unitWord){var f=cartMeasureFields(rec);if(!f||!f.measured)return null;var u=unit==="cm"?"cm":"po";return formatMeasure(f.wIn,u,decimalSep)+" \xD7 "+formatMeasure(f.hIn,u,decimalSep)+" "+String(unitWord==null?u:unitWord)}function __selfTest(){var failures=[],passed=0;function ok(cond,label){cond?passed++:failures.push(label)}function near(a,b,tol,label){var d=Math.abs(Number(a)-Number(b));ok(isFinite(d)&&d<=tol,label+" (got "+a+", want "+b+" +/-"+tol+")")}near(toInches(30,"CENTIMETERS"),11.811,.001,"toInches cm"),ok(toInches(10,"INCHES")===10,"toInches inches is exact"),near(toInches(300,"MILLIMETERS"),11.811,.001,"toInches mm"),near(toInches(1,"METERS"),39.37,.01,"toInches m"),ok(toInches(30,"")===toInches(30,"CENTIMETERS"),"toInches empty unit falls back to cm"),ok(toInches(30,"FURLONGS")===toInches(30,"CENTIMETERS"),"toInches unknown unit falls back to cm"),ok(toInches(NaN,"CENTIMETERS")===0,"toInches NaN is 0"),ok(toInches(1/0,"CENTIMETERS")===0,"toInches Infinity is 0"),ok(toInches(-5,"CENTIMETERS")===0,"toInches negative is 0"),near(fromInches(11,"cm"),27.94,.001,"fromInches cm"),ok(fromInches(11,"po")===11,"fromInches inches is identity");var rz={top:"25%",left:"50%",w:"34%",h:"50.37%"},zp=zonePx(rz,600,720),expW=600*.34,expH=600*.5037;near(zp.w,expW,.01,"zonePx width mirrors compositor"),near(zp.h,expH,.01,"zonePx height is a fraction of box WIDTH"),near(zp.x,600*.5-expW/2,.01,"zonePx x centres on left%"),near(zp.y,720*.25,.01,"zonePx y is a fraction of box HEIGHT"),ok(zonePx({w:204,h:272},600,720).w===204,"zonePx legacy 600px numbers scale 1:1 at 600"),ok(zonePx(null,600,720).w>0,"zonePx survives a null zone"),ok(zonePx({left:"x",top:"y",w:"10%"},600,720).x===600*.5-30,"zonePx defaults left to 50% on a bad parse"),ok(zoneGeometry({maxWidth:30,maxWidthUnit:"CENTIMETERS"},{w:"0%",wIn:6},600,720)===null,"zoneGeometry null on a zero-width zone"),ok(zoneGeometry({maxWidth:12,maxWidthUnit:"INCHES"},{w:"0%"},600,720)===null,"zoneGeometry null on a zero-width zone even when unmeasured"),ok(zoneGeometry({maxWidth:12,maxWidthUnit:"INCHES"},rz,0,0)===null,"zoneGeometry null when the box it is measured into has no width");for(var junkAreas=[{maxWidth:0,maxWidthUnit:"CENTIMETERS"},{maxWidth:-3,maxWidthUnit:"CENTIMETERS"},{maxWidth:"abc",maxWidthUnit:"CENTIMETERS"}],junkAreaOk=!0,jai=0;jai<junkAreas.length;jai++){var jag=zoneGeometry(junkAreas[jai],rz,600,720);(!jag||jag.measured!==!1)&&(junkAreaOk=!1)}ok(junkAreaOk,"an unusable area maxWidth no longer decides anything: still an unmeasured zone");
5var fixZone={top:"18.5185%",left:"50%",w:"34%",h:"45.3333%"},fixArea={maxWidth:12,maxWidthUnit:"INCHES",maxHeight:16,maxHeightUnit:"INCHES"},unmGeo=zoneGeometry(fixArea,fixZone,600,540);if(ok(unmGeo!==null,"an untyped zone RESOLVES, so its logo stays draggable"),unmGeo){ok(unmGeo.measured===!1,"an untyped zone is flagged unmeasured"),ok(unmGeo.scaleSource==="drawn","an untyped zone reports the drawn box as its scale"),ok(unmGeo.zoneWIn!==12,"an untyped zone does NOT inherit the shared area width"),ok(unmGeo.zoneWIn===1,"an untyped zone is exactly one zone wide, by definition"),near(unmGeo.zoneHIn,unmGeo.px.h/unmGeo.px.w,1e-9,"and its height is the drawn box's aspect, in the same unit"),near(unmGeo.pxPerIn,unmGeo.px.w,1e-9,"the scale is the rendered box width, so the record stays surface-free"),near(unmGeo.areaWIn,12,.01,"the catalogue width is still REPORTED, it just cannot size"),ok(unmGeo.widthMismatch===!1,"no width cross-check on an unmeasured zone \u2014 there is no second figure to disagree"),ok(unmGeo.heightMismatch===!1,"and no height cross-check either");var unmBox=clampRectPx(unmGeo);ok(unmBox!==null,"an unmeasured zone still yields a drawable boundary"),unmBox&&(near(unmBox.w,unmGeo.px.w,1e-9,"the unmeasured boundary is the drawn box, exactly"),near(unmBox.h,unmGeo.px.h,1e-9,"on both axes"))}var halfMeasured=zoneGeometry(fixArea,{top:"18.5185%",left:"50%",w:"34%",h:"45.3333%",hIn:16},600,540);ok(halfMeasured&&halfMeasured.measured===!1,"a height with no width is not a measurement"),ok(halfMeasured&&halfMeasured.heightSource==="drawn","and it does not become the zone height"),ok(halfMeasured&&Math.abs(halfMeasured.zoneHIn-halfMeasured.px.h/halfMeasured.px.w)<1e-9,"the drawn box governs both axes when the width was never typed");var typedZone={top:"18.5185%",left:"50%",w:"34%",h:"45.3333%",wIn:12},geo=zoneGeometry(fixArea,typedZone,600,540);ok(geo!==null,"zoneGeometry fixture resolves once the zone is measured"),geo&&(near(geo.px.w,204,.01,"fixture zone is 204px wide"),near(geo.px.h,272,.01,"fixture zone is 272px tall"),near(geo.pxPerIn,17,.01,"fixture scale is 17px per inch"),ok(geo.zoneWIn===12,"fixture zone width is 12in"),near(geo.zoneHIn,16,.01,"fixture derived zone height is 16in"),ok(geo.scaleSource==="zone","scale always comes from the zone now"),ok(geo.measured===!0,"a typed width is a real measurement and says so"),ok(geo.heightSource==="drawn","height falls back to the DRAWN box, never the area"),ok(geo.heightMismatch===!1,"fixture declared and derived heights agree"));var squareZone={top:"10%",left:"50%",w:"20%",h:"20%",wIn:3.5},sliverArea={maxWidth:8,maxWidthUnit:"CENTIMETERS",maxHeight:25,maxHeightUnit:"CENTIMETERS"},sq=zoneGeometry(sliverArea,squareZone,600,600);ok(sq!==null,"a measured square zone resolves against a lopsided area"),sq&&(near(sq.zoneWIn,3.5,.001,"the typed width wins over the catalogue 8cm"),near(sq.zoneHIn,3.5,.001,"a square drawn box stays SQUARE \u2014 no area aspect"),ok(sq.heightSource==="drawn","height came from the drawn box"),ok(sq.heightMismatch===!0,"the catalogue disagreement is still surfaced"));var badGeo=zoneGeometry({maxWidth:12,maxWidthUnit:"INCHES",maxHeight:4,maxHeightUnit:"INCHES"},typedZone,600,540);ok(badGeo&&badGeo.heightMismatch===!0,"heightMismatch flags a disagreeing drawn box"),ok(badGeo&&Math.abs(badGeo.zoneHIn-16)<.01,"the DRAWN box wins over the declared area aspect"),ok(badGeo&&Math.abs(badGeo.drawnHIn-16)<.01,"the drawn height is still reported separately"),ok(badGeo&&badGeo.boxHpx>0,"boxHpx gives the renderable zone height in pixels");var calZone={top:"18.5185%",left:"50%",w:"34%",h:"45.3333%",wIn:6},calArea={maxWidth:12,maxWidthUnit:"INCHES",maxHeight:16,maxHeightUnit:"INCHES"},calGeo=zoneGeometry(calArea,calZone,600,540);ok(calGeo!==null,"a calibrated zone resolves"),calGeo&&(near(calGeo.pxPerIn,204/6,.01,"zone wIn sets the scale, not the area maxWidth"),ok(calGeo.zoneWIn===6,"zoneWIn is the per-zone measurement"),ok(calGeo.scaleSource==="zone","scaleSource reports the zone won"),near(calGeo.areaWIn,12,.01,"the area width is still reported for comparison"),ok(calGeo.widthMismatch===!0,"a 6in zone against a 12in area is flagged"));var calH=zoneGeometry(calArea,{top:"25%",left:"50%",w:"34%",h:"45%",wIn:12,hIn:9},600,540);ok(calH&&Math.abs(calH.zoneHIn-9)<1e-4,"zone hIn is used verbatim as the zone height"),ok(calH&&calH.drawnHIn!==calH.zoneHIn,"the drawn height is still reported separately");
5var plainZone={top:"18.5185%",left:"50%",w:"34%",h:"45.3333%"},plainGeo=zoneGeometry(calArea,plainZone,600,540);ok(plainGeo!==null,"an uncalibrated zone resolves"),ok(plainGeo&&plainGeo.zoneWIn!==12,"an uncalibrated zone does not inherit the area width"),ok(plainGeo&&plainGeo.measured===!1,"and it is flagged unmeasured so nothing labels its numbers");for(var junk=[0,-3,"abc",null,1/0,NaN],junkOk=!0,ji=0;ji<junk.length;ji++){var jz={top:"25%",left:"50%",w:"34%",h:"45%",wIn:junk[ji]},jg=zoneGeometry(calArea,jz,600,540);(!jg||jg.measured!==!1||jg.zoneWIn!==1)&&(junkOk=!1)}ok(junkOk,"a zero, negative or non-numeric wIn yields an unmeasured zone, never a fallback scale"),ok(minWidthIn({zoneWIn:12})===Math.max(DEFAULTS.minFloorIn,12*DEFAULTS.minZoneFrac),"minWidthIn scales with the zone"),ok(minWidthIn({zoneWIn:4})===DEFAULTS.minFloorIn,"minWidthIn floors on a small zone"),ok(minWidthIn({zoneWIn:.2})<=.2,"minWidthIn never exceeds the zone width"),ok(minWidthIn({zoneWIn:4,measured:!0})===DEFAULTS.minFloorIn,"an explicitly measured small zone keeps the physical floor"),ok(minWidthIn({zoneWIn:4})===minWidthIn({zoneWIn:4,measured:!0}),"an absent measured flag is treated as measured, not as unmeasured"),ok(minWidthIn({zoneWIn:1,measured:!1})===DEFAULTS.minZoneFrac,"an unmeasured zone floors proportionally, never at an inch constant"),ok(minWidthIn({zoneWIn:1,measured:!1})<1,"the unmeasured floor never reaches the zone width"),ok(inSpace({measured:!0,zoneWIn:12},.25)===.25,"inSpace is identity on a measured geometry"),ok(inSpace(null,.25)===.25,"and on no geometry at all"),ok(inSpace({zoneWIn:12},.25)===.25,"and on a geometry with no flag"),near(inSpace({measured:!1,zoneWIn:1},DEFAULTS.snapTolIn),DEFAULTS.snapTolIn/REFERENCE_ZONE_IN,1e-12,"an unmeasured zone keeps the tunable's PROPORTION of the reference zone"),ok(inSpace({measured:!1,zoneWIn:1},0)===0,"zero converts to zero"),ok(inSpace({measured:!1,zoneWIn:1},REFERENCE_ZONE_IN)===1,"a tunable the size of the reference zone becomes the size of this one"),near(fractionToInches(0,2,12),2,1e-9,"fractionToInches 0 maps to the minimum"),near(fractionToInches(1,2,12),12,1e-9,"fractionToInches 1 maps to the maximum"),near(fractionToInches(.5,2,12),7,1e-9,"fractionToInches 0.5 maps to the midpoint"),ok(fractionToInches(-3,2,12)===2,"fractionToInches clamps a press left of the track"),ok(fractionToInches(9,2,12)===12,"fractionToInches clamps a press right of the track"),ok(fractionToInches(NaN,2,12)===2,"fractionToInches falls back to the minimum on junk"),ok(fractionToInches(.5,12,12)===12,"fractionToInches returns the floor on a zero-width range"),ok(fractionToInches(.5,12,2)===12,"fractionToInches returns the floor on an inverted range"),near(inchesToFraction(2,2,12),0,1e-9,"inchesToFraction is 0 at the minimum"),near(inchesToFraction(12,2,12),1,1e-9,"inchesToFraction is 1 at the maximum"),near(inchesToFraction(7,2,12),.5,1e-9,"inchesToFraction is 0.5 at the midpoint"),ok(inchesToFraction(-5,2,12)===0,"inchesToFraction clamps a below-range value"),ok(inchesToFraction(99,2,12)===1,"inchesToFraction clamps an above-range value"),ok(inchesToFraction(7,12,12)===0,"inchesToFraction is 0 on a zero-width range"),ok(inchesToFraction(NaN,2,12)===0,"inchesToFraction is 0 on junk");for(var rtOk=!0,si=0;si<=10;si++){var wRt=fractionToInches(si/10,DEFAULTS.minFloorIn,12);Math.abs(inchesToFraction(wRt,DEFAULTS.minFloorIn,12)-si/10)>1e-9&&(rtOk=!1)}if(ok(rtOk,"fraction and inches round-trip across the whole track"),geo){var stdWide=standardPlacement(geo,2.381,"top","center");near(stdWide.wIn,12*DEFAULTS.stdFitFrac,.01,"standard fit leaves a margin on a wide zone"),near(stdWide.lxIn,(12-12*DEFAULTS.stdFitFrac)/2,.01,"standard wide fit centres its margin"),near(stdWide.lyIn,0,.01,"standard top anchor sits at the zone top");var stdTall=standardPlacement(geo,.5,"center","center");ok(stdTall.wIn<12,"a tall artwork is height-constrained, not width-constrained"),near(stdTall.lyIn,(16-stdTall.wIn/.5)/2,.01,"centre anchor halves the vertical leftover"),ok(stdTall.wIn>0,"a tall artwork still gets a positive width");var aspects=[2.381,1,.5,4,.25],vs=["top","center","bottom"],hs=["left","center","right"],i,j,k,fits=!0,touches=!0;for(i=0;i<aspects.length;i++)for(j=0;j<vs.length;j++)for(k=0;k<hs.length;k++){var p=standardPlacement(geo,aspects[i],vs[j],hs[k]),ph=p.wIn/aspects[i];(p.wIn-12>
5.01||ph-16>.01||p.lxIn<-.01||p.lyIn<-.01||p.lxIn+p.wIn-12>.01||p.lyIn+ph-16>.01)&&(fits=!1);var tw=Math.abs(p.wIn-12*DEFAULTS.stdFitFrac)<.01,th=Math.abs(ph-16*DEFAULTS.stdFitFrac)<.01;!tw&&!th&&(touches=!1)}ok(fits,"standardPlacement always fits inside the zone on both axes"),ok(touches,"standardPlacement always fills stdFitFrac of one axis")}var g={zoneWIn:12,zoneHIn:16,pxPerIn:17,px:{w:204,h:272}},farLeft=clampPlace(-99,4,6,2,g,{});ok(farLeft.lxIn===0,"clampPlace pins the left edge");var farRight=clampPlace(99,4,6,2,g,{});near(farRight.lxIn,6,.001,"clampPlace pins the right edge");var farUp=clampPlace(3,-99,6,2,g,{});ok(farUp.lyIn===0,"clampPlace pins the top edge");var farDown=clampPlace(3,99,6,2,g,{});near(farDown.lyIn,13,.001,"clampPlace pins the bottom edge");var inTol=clampPlace(3+.1,2,6,2,g,{snap:!0});near(inTol.lxIn,3,.001,"clampPlace snaps to centre inside the tolerance"),ok(inTol.snapped===!0,"clampPlace reports snapped inside the tolerance");var outTol=clampPlace(3+.4,2,6,2,g,{snap:!0});near(outTol.lxIn,3.4,.001,"clampPlace leaves the value alone outside the tolerance"),ok(outTol.snapped===!1,"clampPlace reports not snapped outside the tolerance");var overridden=clampPlace(3+.4,2,6,2,g,{snap:!0,snapTolIn:.5});near(overridden.lxIn,3,.001,"clampPlace honours an overridden snap tolerance"),ok(clampPlace(3,2,999,2,g,{}).wIn===12,"clampPlace clamps width to the zone"),ok(clampPlace(3,2,1e-4,2,g,{}).wIn===minWidthIn(g),"clampPlace clamps width to the floor"),(function(){var geos=[zoneGeometry({maxWidth:10,maxWidthUnit:"CENTIMETERS",maxHeight:10,maxHeightUnit:"CENTIMETERS"},{top:"20%",left:"50%",w:"30%",h:"18%",wIn:3.5},600,600),zoneGeometry({maxWidth:25,maxWidthUnit:"CENTIMETERS",maxHeight:30,maxHeightUnit:"CENTIMETERS"},{top:"15%",left:"50%",w:"45%",h:"30%",wIn:9.84},600,720),zoneGeometry({maxWidth:12,maxWidthUnit:"INCHES",maxHeight:16,maxHeightUnit:"INCHES"},{top:"10%",left:"40%",w:"50%",h:"40%",wIn:12,hIn:16},800,800)].filter(Boolean);ok(geos.length===3,"boundary sweep built all three geometries");for(var aspects2=[.3,.8,1,1.4,2.5,6],spots=[-999,0,1.5,999],widths=[.1,1,4,999],checked=0,outside=0,boxMismatch=0,gi=0;gi<geos.length;gi++){var g2=geos[gi],box=clampRectPx(g2);
5if(!box){ok(!1,"clampRectPx returned null for a valid geometry");continue}(Math.abs(box.w-g2.px.w)>.001||Math.abs(box.h-g2.boxHpx)>.001)&&boxMismatch++;for(var ai=0;ai<aspects2.length;ai++)for(var si2=0;si2<spots.length;si2++)for(var sj=0;sj<spots.length;sj++)for(var wi=0;wi<widths.length;wi++){var p2=clampPlace(spots[si2],spots[sj],widths[wi],aspects2[ai],g2,{snap:!0}),r=logoRectPx(g2,{wIn:p2.wIn,lxIn:p2.lxIn,lyIn:p2.lyIn,aspect:aspects2[ai]});if(checked++,!r){outside++;continue}(r.x-box.x<-.001||r.y-box.y<-.001||r.x+r.w-(box.x+box.w)>.001||r.y+r.h-(box.y+box.h)>.001)&&outside++}}ok(checked===3*aspects2.length*spots.length*spots.length*widths.length,"boundary sweep ran every combination"),ok(boxMismatch===0,"the drawn rectangle equals the enforced rectangle for every geometry"),ok(outside===0,"a clamped logo never leaves the drawn boundary, in pixels")})(),(function(){var gSq=zoneGeometry({maxWidth:10,maxWidthUnit:"CENTIMETERS",maxHeight:10,maxHeightUnit:"CENTIMETERS"},{top:"20%",left:"50%",w:"40%",h:"20%",wIn:3.5},600,600);if(!gSq){ok(!1,"drawn-box height: geometry did not build");return}near(gSq.zoneWIn,3.5,.001,"typed zone width is used verbatim"),near(gSq.zoneHIn,3.5*.5,.001,"a zone drawn 2:1 reports a 2:1 boundary, whatever the catalogue says"),ok(gSq.heightSource==="drawn","height is reported as coming from the drawn box"),ok(gSq.heightMismatch===!0,"and the disagreement with the square catalogue area is still surfaced");var gTall=zoneGeometry({maxWidth:30,maxWidthUnit:"CENTIMETERS",maxHeight:35,maxHeightUnit:"CENTIMETERS"},{top:"20%",left:"50%",w:"40%",h:"10%",wIn:12},600,600);near(gTall.zoneHIn,12*(10/40),.001,"the DRAWN aspect governs, not the declared area aspect");var gExplicit=zoneGeometry({maxWidth:10,maxWidthUnit:"CENTIMETERS",maxHeight:10,maxHeightUnit:"CENTIMETERS"},{top:"20%",left:"50%",w:"40%",h:"20%",wIn:3.5,hIn:2},600,600);near(gExplicit.zoneHIn,2,.001,"an explicit zone hIn outranks the area aspect"),ok(gExplicit.heightSource==="zone","explicit hIn is reported as the zone source");var gDrawn=zoneGeometry({maxWidth:10,maxWidthUnit:"CENTIMETERS"},{top:"20%",left:"50%",w:"40%",h:"20%",wIn:3.5},600,600);ok(gDrawn.heightSource==="drawn","no declared height falls back to the drawn box"),near(gDrawn.zoneHIn,gDrawn.px.h/gDrawn.pxPerIn,.001,"the drawn fallback still reports the drawn height")})(),(function(){var g2=zoneGeometry({maxWidth:12,maxWidthUnit:"INCHES",maxHeight:16,maxHeightUnit:"INCHES"},{top:"10%",left:"50%",w:"50%",h:"40%",wIn:12},600,720);if(!g2){ok(!1,"clampPlace two-axis sweep could not build a geometry");return}for(var zW=g2.zoneWIn,zH=g2.zoneHIn,aspects2=[.2,.5,.9,zW/zH,1.5,3,8],starts=[-999,0,zW/2,999],escaped=0,checked=0,ai=0;ai<aspects2.length;ai++)for(var si2=0;si2<starts.length;si2++)for(var sj=0;sj<starts.length;sj++){var r=clampPlace(starts[si2],starts[sj],999,aspects2[ai],g2,{}),rh=r.wIn/aspects2[ai];checked++,(r.wIn-zW>1e-6||rh-zH>1e-6||r.lxIn<-1e-6||r.lyIn<-1e-6||r.lxIn+r.wIn-zW>1e-6||r.lyIn+rh-zH>1e-6)&&escaped++}ok(checked===aspects2.length*starts.length*starts.length,"clampPlace two-axis sweep ran every combination"),ok(escaped===0,"clampPlace never lets the logo leave the zone on either axis")})();var input={lxIn:-99};clampPlace(input.lxIn,0,6,2,g,{}),ok(input.lxIn===-99,"clampPlace does not mutate its input"),ok(clampWidth(999,0,0,2,g)===12,"clampWidth ceiling is the zone width"),near(clampWidth(999,6,0,2,g),6,.001,"clampWidth respects the right edge"),near(clampWidth(999,0,12,2,g),8,.001,"clampWidth respects the bottom edge via the aspect"),ok(clampWidth(1e-4,0,0,2,g)===minWidthIn(g),"clampWidth floors at minWidthIn"),(function(){var drawn={top:"20%",left:"50%",w:"34%",h:"25%"},area={maxWidth:12,maxWidthUnit:"INCHES",maxHeight:16,maxHeightUnit:"INCHES"},mGeo=zoneGeometry(area,{top:"20%",left:"50%",w:"34%",h:"25%",wIn:12},600,600),uGeo=zoneGeometry(area,drawn,600,600);if(ok(mGeo!==null&&uGeo!==null,"both the measured and the unmeasured fixture resolve"),!(!mGeo||!uGeo)){ok(uGeo.measured===!1&&mGeo.measured===!0,"the pair differs only in measuredness"),near(uGeo.px.x,mGeo.px.x,1e-9,"the drawn box lands in the same place either way"),near(uGeo.px.w,mGeo.px.w,1e-9,"and is the same size on screen"),near(uGeo.px.h,mGeo.px.h,1e-9,"on both axes");var uBox=clampRectPx(uGeo),mBox=clampRectPx(mGeo);ok(uBox!==null,"an unmeasured zone has an enforceable boundary"),uBox&&mBox&&
5(near(uBox.x,mBox.x,1e-9,"the two boundaries share an origin"),near(uBox.w,mBox.w,1e-9,"and a width in painted pixels"),near(uBox.h,mBox.h,1e-9,"and a height in painted pixels"));for(var aspects2=[.25,.6,1,uGeo.px.w/uGeo.px.h,2.5,7],fracs=[-9,0,.5,9],wFracs=[.001,.2,.8,9],checked=0,outside=0,disagreed=0,ai=0;ai<aspects2.length;ai++)for(var si2=0;si2<fracs.length;si2++)for(var sj=0;sj<fracs.length;sj++)for(var wi=0;wi<wFracs.length;wi++){var uP=clampPlace(fracs[si2]*uGeo.zoneWIn,fracs[sj]*uGeo.zoneHIn,wFracs[wi]*uGeo.zoneWIn,aspects2[ai],uGeo,{snap:!0}),uR=logoRectPx(uGeo,{wIn:uP.wIn,lxIn:uP.lxIn,lyIn:uP.lyIn,aspect:aspects2[ai]});if(checked++,!uR||!uBox){outside++;continue}(uR.x-uBox.x<-1e-6||uR.y-uBox.y<-1e-6||uR.x+uR.w-(uBox.x+uBox.w)>1e-6||uR.y+uR.h-(uBox.y+uBox.h)>1e-6)&&outside++;var mP=clampPlace(fracs[si2]*mGeo.zoneWIn,fracs[sj]*mGeo.zoneHIn,wFracs[wi]*mGeo.zoneWIn,aspects2[ai],mGeo,{snap:!0}),mR=logoRectPx(mGeo,{wIn:mP.wIn,lxIn:mP.lxIn,lyIn:mP.lyIn,aspect:aspects2[ai]});if(!mR){disagreed++;continue}(Math.abs(uR.x-mR.x)>1e-6||Math.abs(uR.y-mR.y)>1e-6||Math.abs(uR.w-mR.w)>1e-6||Math.abs(uR.h-mR.h)>1e-6)&&disagreed++,uP.snapped!==mP.snapped&&disagreed++}ok(checked===aspects2.length*fracs.length*fracs.length*wFracs.length,"the unmeasured sweep ran every combination"),ok(outside===0,"an unmeasured logo never leaves its print area, in pixels"),ok(disagreed===0,"a measured and an unmeasured zone put the same gesture on the same pixels");var uTol=snapTolFor(uGeo,{snapTolIn:DEFAULTS.snapTolIn}),mTol=snapTolFor(mGeo,{snapTolIn:DEFAULTS.snapTolIn});near(uTol*uGeo.pxPerIn,mTol*mGeo.pxPerIn,1e-9,"the snap tolerance is the same on-screen distance in both spaces"),ok(uTol*uGeo.pxPerIn>1,"and is a usable one, not a fraction of a pixel"),ok(snapTolFor(mGeo,{snapTolIn:.4})===.4,"a measured zone still honours the caller's tolerance verbatim"),ok(snapTolFor(mGeo,{})===DEFAULTS.snapTolIn,"and falls back to the physical default"),ok(snapTolFor(null,{})===DEFAULTS.snapTolIn,"snapTolFor survives a null geometry"),ok(snapTolFor(uGeo,{snapTolIn:.5})===2*snapTolFor(uGeo,{snapTolIn:.25}),"and an overridden tolerance still scales an unmeasured zone"),ok(keyStepFor(mGeo,!1)===DEFAULTS.keyStepIn,"a measured arrow step is unchanged"),ok(keyStepFor(mGeo,!0)===DEFAULTS.keyStepShiftIn,"as is the shifted one"),near(keyStepFor(uGeo,!1)*uGeo.pxPerIn,keyStepFor(mGeo,!1)*mGeo.pxPerIn,1e-9,"an unmeasured arrow press moves the same on-screen distance"),ok(keyStepFor(uGeo,!1)*uGeo.pxPerIn>1,"which is a visible one"),ok(keyStepFor(uGeo,!0)>keyStepFor(uGeo,!1),"and shift still moves further"),ok(keyStepFor(null,!1)===DEFAULTS.keyStepIn,"keyStepFor survives a null geometry"),near(stdTolFor(uGeo)*uGeo.pxPerIn,stdTolFor(mGeo)*mGeo.pxPerIn,1e-9,"the standard-tolerance band is the same on-screen distance in both spaces"),ok(stdTolFor(mGeo)===DEFAULTS.stdTolIn,"and is the physical default when measured"),ok(stdTolFor(uGeo)<DEFAULTS.stdTolIn*.5,"and is far tighter than six percent of an unmeasured zone");var uStdRec=standardPlacement(uGeo,1.5,"top","center");ok(isStandard(uStdRec,uStdRec,stdTolFor(uGeo)),"a re-derived unmeasured default still reports as standard"),ok(!isStandard({wIn:uStdRec.wIn+uGeo.zoneWIn*.05,lxIn:uStdRec.lxIn,lyIn:uStdRec.lyIn},uStdRec,stdTolFor(uGeo)),"and a five-percent nudge on an unmeasured zone clears the mark");var nearCentre=clampPlace((uGeo.zoneWIn-uGeo.zoneWIn*.5)/2+uTol*.5,0,uGeo.zoneWIn*.5,1,uGeo,{snap:!0});ok(nearCentre.snapped===!0,"centre snap engages inside the tolerance on an unmeasured zone");var offCentre=clampPlace((uGeo.zoneWIn-uGeo.zoneWIn*.5)/2+uTol*3,0,uGeo.zoneWIn*.5,1,uGeo,{snap:!0});ok(offCentre.snapped===!1,"and lets go outside it");for(var boxes=[[600,600],[240,240],[900,720]],sGeos=[],bi=0;bi<boxes.length;bi++)sGeos.push(zoneGeometry(area,drawn,boxes[bi][0],boxes[bi][1]));if(ok(sGeos[0]&&sGeos[1]&&sGeos[2],"the same unmeasured zone resolves at three sizes"),sGeos[0]&&sGeos[1]&&sGeos[2]){ok(sGeos[0].zoneWIn===sGeos[1].zoneWIn&&sGeos[1].zoneWIn===sGeos[2].zoneWIn,"the zone is the same width in every one of them, whatever the box");for(var shared=clampPlace(.2,.1,.55,1.4,sGeos[0],{snap:!1}),drift=0,base=null,sgi=0;sgi<sGeos.length;sgi++){var sBox=clampRectPx(sGeos[sgi]),sR=logoRectPx(sGeos[sgi],{wIn:shared.wIn,lxIn:shared.lxIn,lyIn:shared.lyIn,aspect:1.4});if(!sBox||!sR){drift++;continue}var asFrac={w:sR.w/sBox.w,x:(sR.x-sBox.x)/sBox.w,y:(sR.y-sBox.y)/sBox.h};if(!base){base=asFrac;continue}(Math.abs(asFrac.w-base.w)>1e-9||Math.abs(asFrac.x-base.x)>1e-9||Math.abs(asFrac.y-base.y)>1e-9)&&drift++}
5ok(drift===0,"one unmeasured record lands on the same proportion of the zone on every surface");for(var clampDrift=0,ci=0;ci<sGeos.length;ci++){var c0=clampPlace(9,9,9,1.4,sGeos[ci],{snap:!0}),c1=clampPlace(9,9,9,1.4,sGeos[0],{snap:!0});(Math.abs(c0.wIn-c1.wIn)>1e-9||Math.abs(c0.lxIn-c1.lxIn)>1e-9||Math.abs(c0.lyIn-c1.lyIn)>1e-9)&&clampDrift++}ok(clampDrift===0,"and the clamp gives the same answer on every surface")}var uStd=standardPlacement(uGeo,1.6,"top","center"),mStd=standardPlacement(mGeo,1.6,"top","center"),uRect=toCompositorRect(uStd,uGeo),mRect=toCompositorRect(mStd,mGeo);near(uRect.wIn/uRect.zoneWIn,mRect.wIn/mRect.zoneWIn,1e-6,"the baked logo is the same fraction of the zone either way"),near(uRect.lxIn/uRect.zoneWIn,mRect.lxIn/mRect.zoneWIn,1e-6,"and sits at the same fraction across it"),near(uRect.lyIn/uRect.zoneWIn,mRect.lyIn/mRect.zoneWIn,1e-6,"and at the same fraction down it");for(var leaked=0,unmarked=0,recs=0,li=0;li<aspects2.length;li++)for(var lw=0;lw<wFracs.length;lw++){var pl=clampPlace(.3*uGeo.zoneWIn,.2*uGeo.zoneHIn,wFracs[lw]*uGeo.zoneWIn,aspects2[li],uGeo,{snap:!1}),rec={wIn:pl.wIn,lxIn:pl.lxIn,lyIn:pl.lyIn,aspect:aspects2[li],unit:"po",measured:uGeo.measured},f=cartMeasureFields(rec);if(recs++,!f){leaked++;continue}f.measured!==!1&&leaked++,(/[0-9]/.test(f.size)||/[0-9]/.test(f.pos))&&leaked++,/in|cm|po|"|â³/.test(f.size.replace(UNMEASURED_MARK,""))&&leaked++,(f.unit!==null||f.wIn!==null||f.hIn!==null)&&leaked++,(f.size!==UNMEASURED_MARK||f.pos!==UNMEASURED_MARK)&&unmarked++,cartMeasureLabel(rec,"po",".","po")!==null&&leaked++,cartMeasureLabel(rec,"cm",",","cm")!==null&&leaked++}ok(recs===aspects2.length*wFracs.length,"the cart sweep ran every placement"),ok(leaked===0,"no unmeasured placement produces a physical dimension anywhere"),ok(unmarked===0,"and every one of them is explicitly marked instead")}})();var cartMeasured=cartMeasureFields({wIn:11.04,lxIn:.48,lyIn:1.52,aspect:2,unit:"cm",measured:!0});ok(cartMeasured&&cartMeasured.measured===!0,"a measured record still reports measured"),ok(cartMeasured&&cartMeasured.size==="11.0x5.5 in","and emits true inches at one decimal"),ok(cartMeasured&&cartMeasured.pos==="0.5,1.5 in","and its position in the same unit"),ok(cartMeasured&&cartMeasured.unit==="cm","and the unit the customer was reading"),ok(cartMeasureLabel({wIn:11,lxIn:0,lyIn:0,aspect:1,measured:!0},"po",",","po")==="11,0 \xD7 11,0 po","the visible line is locale-formatted from the same record");for(var notProvable=[{wIn:11,lxIn:0,lyIn:0,aspect:1},{wIn:11,lxIn:0,lyIn:0,aspect:1,measured:void 0},{wIn:11,lxIn:0,lyIn:0,aspect:1,measured:!1},{wIn:11,lxIn:0,lyIn:0,aspect:1,measured:"true"},{wIn:11,lxIn:0,lyIn:0,aspect:1,measured:1}],closedOk=!0,ni=0;ni<notProvable.length;ni++){var nf=cartMeasureFields(notProvable[ni]);(!nf||nf.measured!==!1||nf.size!==UNMEASURED_MARK||nf.pos!==UNMEASURED_MARK||nf.unit!==null)&&(closedOk=!1),cartMeasureLabel(notProvable[ni],"po",".","po")!==null&&(closedOk=!1)}ok(closedOk,"anything short of measured === true fails closed to the marker"),ok(cartMeasureFields({wIn:11,aspect:1,measured:"false"}).measured===!1,"the flag is compared by identity, never by truthiness"),ok(isNaN(parseFloat(UNMEASURED_MARK)),"the marker is not a number to parseFloat"),ok(!/(\d+(?:\.\d+)?)x(\d+(?:\.\d+)?)\s*in/.test(UNMEASURED_MARK),"and does not match the size pattern the measured branch emits"),ok(UNMEASURED_MARK!=="","and is not empty, which would read as absent"),ok(cartMeasureFields(null)===null,"no record contributes nothing"),ok(cartMeasureFields({wIn:0,measured:!0})===null,"a zero width contributes nothing"),ok(cartMeasureFields({wIn:-4,measured:!0})===null,"a negative width contributes nothing"),ok(cartMeasureFields({wIn:"abc",measured:!0})===null,"a non-numeric width contributes nothing"),ok(cartMeasureFields({wIn:1/0,measured:!0})===null,"a non-finite width contributes nothing");var r90=rotateDelta(10,0,90);near(r90.dx,0,1e-4,"rotateDelta 90deg dx"),near(r90.dy,-10,1e-4,"rotateDelta 90deg dy");var r0=rotateDelta(7,-3,0);ok(r0.dx===7&&r0.dy===-3,"rotateDelta is identity at zero angle");var rBad=rotateDelta(7,-3,NaN);ok(rBad.dx===7&&rBad.dy===-3,"rotateDelta is identity on a non-finite angle");var std={wIn:11,lxIn:.5,lyIn:1.5};ok(isStandard({wIn:11.05,lxIn:.52,lyIn:1.53},std),"isStandard true inside tolerance"),ok(!isStandard({wIn:11.2,lxIn:.5,lyIn:1.5},std),"isStandard false when width drifts"),ok(!isStandard({wIn:11,lxIn:.7,lyIn:1.5},std),"isStandard false when x drifts"),ok(!isStandard({wIn:11,lxIn:.5,lyIn:1.8},std),"isStandard false when y drifts");var stdT=DEFAULTS.stdTolIn;if(ok(isStandard({wIn:11+stdT*.99,lxIn:.5+stdT*.99,lyIn:1.5+stdT*.99},std),"isStandard true just inside the tolerance on all three values at once"),ok(isStandard({wIn:11-stdT*.99,lxIn:.5-stdT*.99,lyIn:1.5-stdT*.99},std),"isStandard true just inside the negative tolerance boundary"),ok(!isStandard({wIn:11+stdT*1.5,lxIn:.5,lyIn:1.5},std),"isStandard false when width ALONE exceeds the tolerance"),ok(!isStandard({wIn:11,lxIn:.5+stdT*1.5,lyIn:1.5},std),"isStandard false when x ALONE exceeds the tolerance"),ok(!isStandard({wIn:11,lxIn:.5,lyIn:1.5+stdT*1.5},std),"isStandard false when y ALONE exceeds the tolerance"),ok(isStandard({wIn:11.5,lxIn:.5,lyIn:1.5},std,1),"isStandard honours an overridden tolerance"),ok(!isStandard(null,
5std),"isStandard false with no placement"),ok(!isStandard({wIn:11,lxIn:.5,lyIn:1.5},null),"isStandard false with no default"),geo){var seedA=standardPlacement(geo,2.381,"top","center",{fitFrac:.9,centre:!0}),seedB=standardPlacement(geo,2.381,"top","center",{fitFrac:.9,centre:!0});ok(seedA.wIn===seedB.wIn&&seedA.lxIn===seedB.lxIn&&seedA.lyIn===seedB.lyIn,"standardPlacement is deterministic, so restore reproduces the seed exactly"),ok(isStandard(seedA,seedB),"a re-derived default reports as standard against itself")}ok(formatMeasure(11,"po",".")==="11.0","formatMeasure inches"),ok(formatMeasure(11,"cm",",")==="27,9","formatMeasure cm with a comma separator"),near(parseMeasure("27,9","cm"),10.98,.01,"parseMeasure accepts a comma decimal"),near(parseMeasure("27.9","cm"),10.98,.01,"parseMeasure accepts a period decimal"),ok(parseMeasure("abc","po")===null,"parseMeasure rejects text"),ok(parseMeasure("-3","po")===null,"parseMeasure rejects a negative"),ok(parseMeasure("0","po")===null,"parseMeasure rejects zero"),ok(parseMeasure("","po")===null,"parseMeasure rejects empty"),ok(parseMeasure(null,"po")===null,"parseMeasure rejects null"),ok(parseMeasure("1e999","po")===null,"parseMeasure rejects a non-finite"),ok(parseMeasure("11","po")===11,"parseMeasure passes inches through"),ok(parseMeasure("27,9","cm")===parseMeasure("27.9","cm"),"parseMeasure treats a comma and a period identically"),ok(parseMeasure("11,5","po")===parseMeasure("11.5","po"),"parseMeasure treats the separators identically in inches too"),ok(parseMeasure(" 11.5 ","po")===11.5,"parseMeasure tolerates surrounding whitespace"),near(parseMeasure("30","cm"),30/CM_PER_IN,1e-9,"parseMeasure converts centimetres to inches"),ok(parseMeasure("11","PO")===11,"parseMeasure is case-insensitive about the unit"),ok(parseMeasure("11","CM")===parseMeasure("11","cm"),"parseMeasure lowercases cm too"),ok(parseMeasure(" ","po")===null,"parseMeasure rejects whitespace only"),ok(parseMeasure(".","po")===null,"parseMeasure rejects a bare separator"),ok(parseMeasure(",","po")===null,"parseMeasure rejects a bare comma");for(var rtWidths=[.75,2,4.5,7.25,11,12],fmtRtOk=!0,fi=0;fi<rtWidths.length;fi++){var shownCm=formatMeasure(rtWidths[fi],"cm","."),backCm=parseMeasure(shownCm,"cm"),shownIn=formatMeasure(rtWidths[fi],"po",","),backIn=parseMeasure(shownIn,"po");(backCm===null||Math.abs(backCm-rtWidths[fi])>.1)&&(fmtRtOk=!1),(backIn===null||Math.abs(backIn-rtWidths[fi])>.1)&&(fmtRtOk=!1)}ok(fmtRtOk,"format then parse round-trips within a tenth of an inch in both units"),ok(parseMeasure(formatMeasure(11,"cm",","),"cm")!==null,"a comma-formatted value parses back");var rect=toCompositorRect({lxIn:1/3,lyIn:2/3,wIn:11.00004},{zoneWIn:12}),keys=[];for(var kk in rect)Object.prototype.hasOwnProperty.call(rect,kk)&&keys.push(kk);keys.sort(),ok(keys.join(",")==="lxIn,lyIn,wIn,zoneWIn","toCompositorRect has exactly the four keys"),ok(rect.lxIn===.3333,"toCompositorRect rounds to four decimals"),ok(rect.wIn===11,"toCompositorRect rounds float noise away");var pr=paintedRect(1e3,500,600,600);near(pr.w,600,.01,"paintedRect width fills the constrained axis"),near(pr.h,300,.01,"paintedRect height follows the aspect"),near(pr.y,150,.01,"paintedRect centres the letterbox");var prBad=paintedRect(0,500,600,600);return ok(prBad.w===600&&prBad.h===600,"paintedRect returns the full box on bad input"),{passed:passed,failed:failures.length,failures:failures}}var api={CM_PER_IN:CM_PER_IN,DEFAULTS:DEFAULTS,toInches:toInches,fromInches:fromInches,zonePx:zonePx,paintedRect:paintedRect,zoneGeometry:zoneGeometry,minWidthIn:minWidthIn,REFERENCE_ZONE_IN:REFERENCE_ZONE_IN,inSpace:inSpace,snapTolFor:snapTolFor,keyStepFor:keyStepFor,stdTolFor:stdTolFor,fractionToInches:fractionToInches,inchesToFraction:inchesToFraction,standardPlacement:standardPlacement,clampRectPx:clampRectPx,logoRectPx:logoRectPx,clampPlace:clampPlace,clampWidth:clampWidth,rotateDelta:rotateDelta,isStandard:isStandard,formatMeasure:formatMeasure,parseMeasure:parseMeasure,toCompositorRect:toCompositorRect,UNMEASURED_MARK:UNMEASURED_MARK,cartMeasureFields:cartMeasureFields,cartMeasureLabel:cartMeasureLabel,__selfTest:__selfTest};typeof window!="undefined"&&(window.forteeLogoPlacement=api),typeof module!="undefined"&&module.exports&&(module.exports=api)})(); 6//# sourceMappingURL=/cdn/shop/t/38/assets/fortee-logo-placement.js.map?v=36443685815007774791790345778
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.