11// audit-inputs: 81590b0af12330570b0cb561b06373932c9ba6eb4f3f7583d570f95777de3e35
22import { readFileSync } from "node:fs" ;
3- //#region src/model/model.ts
3+ // src/model/model.ts
44var SITE = "site" ;
55var RUNTIME = [
66 "request" ,
@@ -669,8 +669,7 @@ function flowOf$1(b, lift) {
669669 }
670670 return fwd && back ? "both" : fwd ? "a→b" : "b→a" ;
671671}
672- //#endregion
673- //#region src/factory/tiles.ts
672+ // src/factory/tiles.ts
674673/** n, e, s, w: index (i + 2) % 4 is the opposite direction. */
675674var DIRS = [
676675 "n" ,
@@ -724,8 +723,7 @@ function dirInto(r, x, y) {
724723}
725724/** The edge a junction piece's branch leaves by (split) or joins through (merge). */
726725var joinEdge = ( p ) => p . join === "merge" ? OPP [ p . in ] : p . out ;
727- //#endregion
728- //#region src/floor/names.ts
726+ // src/floor/names.ts
729727/** Longest dotted (or path) prefix shared by at least two names, ending at a separator. */
730728function commonPrefix ( names ) {
731729 if ( names . length < 2 ) return "" ;
@@ -798,8 +796,7 @@ function shownName(model, id, prefix) {
798796 if ( model . kindOf ( id ) === "table" ) full = full . replace ( / ^ p u b l i c \. / , "" ) ;
799797 return stripShared ( full , prefix ) ;
800798}
801- //#endregion
802- //#region src/factory/fit.ts
799+ // src/factory/fit.ts
803800var PLATE_FONT = 10.5 ;
804801/** A label's width at `size`, estimated (never measured, so placement cannot depend on font loading): Archivo bold
805802* averages under 0.56 em a letter on these words (measured: "group notifier ×2" is 82 px at 10.5, estimated 100),
@@ -1029,8 +1026,7 @@ var NAME_MIN_PX = 9 * Math.exp(-.4);
10291026/** Zoom under which a name of `minName` px would render under NAME_MIN_PX: the floor shows codes instead. One switch for
10301027* the whole floor, from the smallest name drawn on it (14 px names alone would switch at about 6/14). */
10311028var codeZoom = ( minName ) => NAME_MIN_PX / minName ;
1032- //#endregion
1033- //#region src/factory/messaging.ts
1029+ // src/factory/messaging.ts
10341030/** The short label each flight's plate shows (owner decision: short words). */
10351031var FLIGHT_LABEL = {
10361032 produce : "produce" ,
@@ -1161,8 +1157,7 @@ function replicasOf(model, id) {
11611157 cur = n . parent ?? void 0 ;
11621158 }
11631159}
1164- //#endregion
1165- //#region src/factory/layout.ts
1160+ // src/factory/layout.ts
11661161/** Tiles a zone's label needs: its upper-case name at 9.5 px (a generous 7.5 px a letter) plus a margin. */
11671162var labelTiles = ( name ) => Math . ceil ( ( name . length * 7.5 + 12 ) / 24 ) ;
11681163var M = 2 ;
@@ -1744,8 +1739,7 @@ function queueStacks(tf, topicOf) {
17441739 }
17451740 return out ;
17461741}
1747- //#endregion
1748- //#region src/factory/batch.ts
1742+ // src/factory/batch.ts
17491743var byStr$2 = ( a , b ) => a < b ? - 1 : a > b ? 1 : 0 ;
17501744var byJob = ( p , q ) => byStr$2 ( p . job , q . job ) || byStr$2 ( p . relation , q . relation ) ;
17511745/** `bundles` is taken for symmetry with messaging(); a scheduler's jobs on itself and an inner yard's jobs never form
@@ -2651,8 +2645,7 @@ function railEnds(tf) {
26512645 } ) ;
26522646 return out ;
26532647}
2654- //#endregion
2655- //#region src/factory/pads.ts
2648+ // src/factory/pads.ts
26562649/** A receiving dock's length along its side, tiles. */
26572650var DOCK = 3 ;
26582651var ROLE = {
@@ -3046,8 +3039,7 @@ function webhookDocks(model, tf, bundles, routes) {
30463039 notes
30473040 } ;
30483041}
3049- //#endregion
3050- //#region src/factory/clear.ts
3042+ // src/factory/clear.ts
30513043var ZONE_FONT = 9.5 ;
30523044/** A zone name's size in world px at scale 1, estimated (never measured, so layout cannot depend on font loading): a
30533045* bold capital is at most 0.72 em wide, and the line box is 13 px tall. The drawn text is never larger. */
@@ -3357,8 +3349,7 @@ function laneLabelPlan(l, w, blocked) {
33573349 maxK : Math . max ( 1 , Math . min ( tall , spot . room / w ) )
33583350 } ;
33593351}
3360- //#endregion
3361- //#region src/factory/router.ts
3352+ // src/factory/router.ts
33623353var TURN = 3 ;
33633354var UNDER = 6 ;
33643355var MAX_UNDER = 4 ;
@@ -4118,8 +4109,7 @@ var Heap = class {
41184109 return top ;
41194110 }
41204111} ;
4121- //#endregion
4122- //#region src/factory/plan.ts
4112+ // src/factory/plan.ts
41234113var WIDEN = 2 ;
41244114var MAX_START = 3 ;
41254115var MAX_EXTRA = 6 ;
@@ -4341,14 +4331,12 @@ function roomierLanes(model, container, doors, bundles, ladders, best, opts) {
43414331 routes
43424332 } : best ;
43434333}
4344- //#endregion
4345- //#region src/factory/plan-job.ts
4334+ // src/factory/plan-job.ts
43464335/** Floor `container`'s plan: its bundles (`b`, when the caller has them already), then `planFloor` over them. */
43474336function planJob ( model , container , b = model . bundles ( container ) ) {
43484337 return planFloor ( model , container , b . doors , b . bundles , b . layered ) ;
43494338}
4350- //#endregion
4351- //#region src/audit/lines.ts
4339+ // src/audit/lines.ts
43524340/** A line's possible ends, by id: its key's two boxes (or lanes), for a rail the rail yards and stations, and for an
43534341* inbound webhook its service's receiving dock (the belt plugs into the dock, not the wall). */
43544342function endRects ( tf , r ) {
@@ -4761,8 +4749,7 @@ function failedViolations(routes) {
47614749 if ( routes . length >= 100 && failed . length <= routes . length * .01 ) return [ ] ;
47624750 return [ { detail : `${ failed . length } of ${ routes . length } routes failed: ${ failed . map ( ( r ) => r . key ) . join ( ", " ) } ` } ] ;
47634751}
4764- //#endregion
4765- //#region src/factory/boxname.ts
4752+ // src/factory/boxname.ts
47664753var NAME_FITS = {
47674754 name : fitName ,
47684755 chest : chestFit
@@ -4805,8 +4792,7 @@ function boxNameFit(model, ctx, b, fits = NAME_FITS) {
48054792 door : false
48064793 } ;
48074794}
4808- //#endregion
4809- //#region src/factory/subline.ts
4795+ // src/factory/subline.ts
48104796/** The factory's sub line: the shape and the role tag already say the kind and role, so only the count of what is inside. */
48114797function factorySubOf ( model , floorBundles , m ) {
48124798 if ( [
@@ -4837,8 +4823,7 @@ function subline(model, floorBundles, m) {
48374823 const children = model . map . nodes . filter ( ( x ) => x . parent === real ) . length ;
48384824 return `${ n ?. role ? `${ n . role } · ` : "" } ${ m . kind } ${ children ? ` · ${ children } inside` : "" } ` ;
48394825}
4840- //#endregion
4841- //#region src/factory/flights.ts
4826+ // src/factory/flights.ts
48424827var DOT = 4 ;
48434828var centre = ( r ) => ( {
48444829 x : ( r . x + r . w / 2 ) * 24 ,
@@ -5218,8 +5203,7 @@ function messagingLabels(model, tf, paths, clear, inside) {
52185203 plates : placePlates ( paths , clear , bounds )
52195204 } ;
52205205}
5221- //#endregion
5222- //#region src/factory/rail-place.ts
5206+ // src/factory/rail-place.ts
52235207/** The key a yard is selected by (and its views fade with): its rails' ends grouped as in the router. */
52245208var yardKey = ( source ) => yardId ( source ) ;
52255209/** A box's short code on its own floor: the code without the floor's own code in front (`S7·P1·F11` on S7·P1 reads
@@ -5377,8 +5361,7 @@ function placeBox(key, text, spots, clear, bounds) {
53775361 } ;
53785362 }
53795363}
5380- //#endregion
5381- //#region src/model/layers.ts
5364+ // src/model/layers.ts
53825365/** The floor's extra layers, one per heavily used item with a line, in `floor.hubs` order. Empty on most floors (no
53835366* layers button). Pure: from the model alone. */
53845367function floorLayers ( model , container ) {
@@ -5399,8 +5382,7 @@ function floorLayers(model, container) {
53995382 }
54005383 return out ;
54015384}
5402- //#endregion
5403- //#region src/floor/lane.ts
5385+ // src/floor/lane.ts
54045386/** x positions where a vertical run crosses, or ends on, the lane band at `y` (± half its height). */
54055387function crossings ( routes , y , half ) {
54065388 const xs = /* @__PURE__ */ new Set ( ) ;
@@ -5439,8 +5421,7 @@ function laneCrossings(l, routes, paths) {
54395421function moverSpeed ( kind , length ) {
54405422 return flies ( kind ) ? Math . max ( 60 , length / 5 ) : kind === "train" ? Math . max ( 60 , length / 3 ) : 60 ;
54415423}
5442- //#endregion
5443- //#region src/audit/text.ts
5424+ // src/audit/text.ts
54445425/** The fitting functions the drawing uses; a test may pass others to prove the check sees a cut. */
54455426var FITS = {
54465427 name : fitName ,
@@ -5699,8 +5680,7 @@ function narrowZoneViolations(plan) {
56995680 }
57005681 return out ;
57015682}
5702- //#endregion
5703- //#region src/floor/fitscale.ts
5683+ // src/floor/fitscale.ts
57045684/** Floor bounds `w`×`h` px in a `screenW`×`screenH` canvas, `bottomInset` px kept clear at the bottom. Inside floors keep
57055685* a 120 px pad round them; every floor keeps 60 px for its title and a 0.94 margin. Unclamped. */
57065686function fitScale ( w , h , screenW , screenH , site , bottomInset = 0 ) {
@@ -5715,8 +5695,7 @@ var clampFit = (s) => Math.max(FIT_MIN, Math.min(FIT_MAX, s));
57155695function fitZoom ( w , h , screenW , screenH , site , bottomInset = 0 ) {
57165696 return clampFit ( fitScale ( w , h , screenW , screenH , site , bottomInset ) ) ;
57175697}
5718- //#endregion
5719- //#region src/audit/floor.ts
5698+ // src/audit/floor.ts
57205699/** The longest a moving item may take over one line, seconds (audit row 25): a train over its rail, a drone over its
57215700* flight (drones fly slower, so a floor's flights stay readable). */
57225701var TRIP_MAX = {
@@ -5853,8 +5832,7 @@ function measure(plan, model, container) {
58535832 switchZoom : codeZoom ( minNameSize ( model , container , plan ) )
58545833 } ;
58555834}
5856- //#endregion
5857- //#region src/audit/types.ts
5835+ // src/audit/types.ts
58585836/** The row of the owner's audit each check comes from. */
58595837var ROW = {
58605838 "lines.failed" : "9" ,
@@ -5875,8 +5853,7 @@ var ROW = {
58755853 "floor.wide" : "46" ,
58765854 "plan.crashed" : "—"
58775855} ;
5878- //#endregion
5879- //#region src/audit/run.ts
5856+ // src/audit/run.ts
58805857var firstLine = ( e ) => ( String ( e instanceof Error ? e . message : e ) . split ( "\n" ) [ 0 ] || "error" ) . trim ( ) ;
58815858/** The base's lines and each layer's, with the suffix a violation names its view by. */
58825859var views = ( plan ) => [ [ "" , plan . routes ] , ...Object . entries ( plan . layers ?? { } ) . map ( ( [ id , l ] ) => [ ` (layer ${ id } )` , l . routes ] ) ] ;
@@ -5990,8 +5967,7 @@ function auditMap(map, budget = BUDGET) {
59905967 }
59915968 return out ;
59925969}
5993- //#endregion
5994- //#region src/audit/cli.ts
5970+ // src/audit/cli.ts
59955971var args = process . argv . slice ( 2 ) ;
59965972var path = args . find ( ( a ) => ! a . startsWith ( "--" ) ) ;
59975973var map ;
@@ -6010,5 +5986,4 @@ try {
60105986 process . exit ( 2 ) ;
60115987}
60125988process . stdout . write ( `${ JSON . stringify ( report ) } \n` ) ;
6013- //#endregion
60145989export { } ;
0 commit comments