@wowok/agent-mcp 3.4.4 → 3.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/chain-semantics/composition-truth.js +1 -1
  3. package/dist/composition/audit.js +1 -1
  4. package/dist/composition/compile.js +1 -1
  5. package/dist/composition/emit-phases.js +1 -1
  6. package/dist/composition/guard-fill.js +1 -1
  7. package/dist/composition/input-normalize.js +1 -1
  8. package/dist/composition/materialize.js +1 -1
  9. package/dist/composition/mode-gates.js +1 -1
  10. package/dist/composition/param-disclosure.js +1 -1
  11. package/dist/composition/plan-run-store.js +1 -0
  12. package/dist/composition/reflux.js +1 -1
  13. package/dist/composition/role-bindings.js +1 -0
  14. package/dist/composition/shape-expand.js +1 -1
  15. package/dist/composition/supply-chain-emit.js +1 -1
  16. package/dist/config/judgment.d.ts +13 -25
  17. package/dist/config/judgment.js +1 -1
  18. package/dist/config/match-policy-file.js +1 -1
  19. package/dist/config/rule-engine.d.ts +4 -10
  20. package/dist/config/rule-engine.js +1 -1
  21. package/dist/config/template-params.js +1 -1
  22. package/dist/evaluation/engine.js +1 -1
  23. package/dist/experience/realtime-feedback.js +1 -1
  24. package/dist/extensions/capability.js +1 -1
  25. package/dist/graph/onchain/expand.js +1 -1
  26. package/dist/graph/onchain/exposure.js +1 -1
  27. package/dist/harness/forward-roster-preflight.js +1 -0
  28. package/dist/keeper/detectors.js +1 -1
  29. package/dist/knowledge/allocator-rail-verifier.js +1 -1
  30. package/dist/knowledge/arb-operation-face.js +1 -1
  31. package/dist/knowledge/arbitration-rail-verifier.js +1 -1
  32. package/dist/knowledge/audit-rules.d.ts +17 -1
  33. package/dist/knowledge/audit-rules.js +1 -1
  34. package/dist/knowledge/baselines/rules/alloc_audit.json.good.sha256 +1 -0
  35. package/dist/knowledge/baselines/rules/allocation.json.good.sha256 +1 -0
  36. package/dist/knowledge/baselines/rules/arb.json.good.sha256 +1 -0
  37. package/dist/knowledge/baselines/rules/arbitration.json.good.sha256 +1 -0
  38. package/dist/knowledge/baselines/rules/bridge.json.good.sha256 +1 -0
  39. package/dist/knowledge/baselines/rules/contact.json.good.sha256 +1 -0
  40. package/dist/knowledge/baselines/rules/demand.json.good.sha256 +1 -0
  41. package/dist/knowledge/baselines/rules/graph.json.good.sha256 +1 -0
  42. package/dist/knowledge/baselines/rules/guard.json.good.sha256 +1 -0
  43. package/dist/knowledge/baselines/rules/machine.json.good.sha256 +1 -0
  44. package/dist/knowledge/baselines/rules/oracle.json.good.sha256 +1 -0
  45. package/dist/knowledge/baselines/rules/order.json.good.sha256 +1 -0
  46. package/dist/knowledge/baselines/rules/payment.json.good.sha256 +1 -0
  47. package/dist/knowledge/baselines/rules/permission.json.good.sha256 +1 -0
  48. package/dist/knowledge/baselines/rules/personal.json.good.sha256 +1 -0
  49. package/dist/knowledge/baselines/rules/plan.json +153 -33
  50. package/dist/knowledge/baselines/rules/plan.json.good +153 -33
  51. package/dist/knowledge/baselines/rules/plan.json.good.sha256 +1 -0
  52. package/dist/knowledge/baselines/rules/progress.json.good.sha256 +1 -0
  53. package/dist/knowledge/baselines/rules/proof.json.good.sha256 +1 -0
  54. package/dist/knowledge/baselines/rules/registrar.json.good.sha256 +1 -0
  55. package/dist/knowledge/baselines/rules/repository.json.good.sha256 +1 -0
  56. package/dist/knowledge/baselines/rules/resource.json.good.sha256 +1 -0
  57. package/dist/knowledge/baselines/rules/reward.json.good.sha256 +1 -0
  58. package/dist/knowledge/baselines/rules/service.json.good.sha256 +1 -0
  59. package/dist/knowledge/baselines/rules/treasury.json.good.sha256 +1 -0
  60. package/dist/knowledge/baselines/rules/util.json.good.sha256 +1 -0
  61. package/dist/knowledge/builtin-templates.d.ts +1 -1
  62. package/dist/knowledge/builtin-templates.js +1 -1
  63. package/dist/knowledge/discount-threshold.js +1 -1
  64. package/dist/knowledge/fee-param-bindings.js +1 -1
  65. package/dist/knowledge/getting-started.js +1 -1
  66. package/dist/knowledge/guard-binding-table.js +1 -1
  67. package/dist/knowledge/guard-design-patterns.js +1 -1
  68. package/dist/knowledge/guard-templates.d.ts +3 -2
  69. package/dist/knowledge/guard-templates.js +1 -1
  70. package/dist/knowledge/index.js +1 -1
  71. package/dist/knowledge/industry-registry.js +1 -1
  72. package/dist/knowledge/jsonrpc-enum.js +1 -1
  73. package/dist/knowledge/knob-docs.js +1 -1
  74. package/dist/knowledge/machine-topology.js +1 -1
  75. package/dist/knowledge/param-schema.js +1 -1
  76. package/dist/knowledge/param-tiers.js +1 -1
  77. package/dist/knowledge/path-oracle/products/alibaba-1688.js +1 -1
  78. package/dist/knowledge/path-oracle/products/amazon.js +1 -1
  79. package/dist/knowledge/path-oracle/products/booking-com.js +1 -1
  80. package/dist/knowledge/path-oracle/products/contra.js +1 -1
  81. package/dist/knowledge/path-oracle/products/costco.js +1 -1
  82. package/dist/knowledge/path-oracle/products/duoduo-maicai.js +1 -1
  83. package/dist/knowledge/path-oracle/products/etsy.js +1 -1
  84. package/dist/knowledge/path-oracle/products/gamefound.js +1 -1
  85. package/dist/knowledge/path-oracle/products/gofundme.js +1 -1
  86. package/dist/knowledge/path-oracle/products/klook.js +1 -1
  87. package/dist/knowledge/path-oracle/products/ninety-nine-designs.js +1 -1
  88. package/dist/knowledge/path-oracle/products/pinduoduo-kuaituantuan.js +1 -1
  89. package/dist/knowledge/path-oracle/products/shansong.js +1 -1
  90. package/dist/knowledge/path-oracle/products/taobao-presale.js +1 -1
  91. package/dist/knowledge/path-oracle/products/upwork-catalog.js +1 -1
  92. package/dist/knowledge/path-oracle/products/upwork.js +1 -1
  93. package/dist/knowledge/pattern-resolutions.js +1 -1
  94. package/dist/knowledge/protocol-facts.js +1 -1
  95. package/dist/knowledge/publish-gate.js +1 -1
  96. package/dist/knowledge/publish-surface-contract.js +1 -1
  97. package/dist/knowledge/template-loader.js +1 -1
  98. package/dist/knowledge/template-registry.js +1 -1
  99. package/dist/knowledge/template-scanner.js +1 -1
  100. package/dist/knowledge/time-units.js +1 -0
  101. package/dist/knowledge/tools-reference.js +1 -1
  102. package/dist/knowledge/workflow-guidance.js +1 -1
  103. package/dist/monitor/MonitorLoop.js +1 -1
  104. package/dist/participation/radar-core.js +1 -1
  105. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  106. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  107. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  108. package/dist/playbooks/service-build/migration-planner.js +1 -1
  109. package/dist/playbooks/service-build/object-panorama.js +1 -1
  110. package/dist/playbooks/service-build/participation-radar.js +1 -1
  111. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  112. package/dist/playbooks/service-build/service-panorama.js +1 -1
  113. package/dist/playbooks/service-build/service-quote.js +1 -1
  114. package/dist/review/index.js +1 -1
  115. package/dist/safety/confirm-gate.js +1 -1
  116. package/dist/schema/benchmark-migration/index.d.ts +110 -2
  117. package/dist/schema/benchmark-migration/index.js +1 -1
  118. package/dist/schema/boundary-coercion.js +1 -0
  119. package/dist/schema/call/arbitration.js +1 -1
  120. package/dist/schema/call/base.js +1 -1
  121. package/dist/schema/call/handler.js +1 -1
  122. package/dist/schema/call/machine.d.ts +56 -8
  123. package/dist/schema/call/order.d.ts +37 -10
  124. package/dist/schema/call/order.js +1 -1
  125. package/dist/schema/call/permission.d.ts +210 -30
  126. package/dist/schema/call/personal.d.ts +56 -8
  127. package/dist/schema/call/progress.d.ts +28 -4
  128. package/dist/schema/call/semantic.js +1 -1
  129. package/dist/schema/call/service.d.ts +84 -12
  130. package/dist/schema/common/index.d.ts +14 -2
  131. package/dist/schema/common/index.js +1 -1
  132. package/dist/schema/evaluation/index.js +1 -1
  133. package/dist/schema/goal/index.d.ts +1 -1
  134. package/dist/schema/goal/planning.js +1 -1
  135. package/dist/schema/local/index.js +1 -1
  136. package/dist/schema/messenger/index.d.ts +168 -24
  137. package/dist/schema/messenger/index.js +1 -1
  138. package/dist/schema/operations.d.ts +655 -22
  139. package/dist/schema/operations.js +1 -1
  140. package/dist/schema/persona/index.d.ts +22 -110
  141. package/dist/schema/query/index.js +1 -1
  142. package/dist/schema/schema-version.js +1 -1
  143. package/dist/schema/workflow/index.d.ts +4 -0
  144. package/dist/schema/workflow/index.js +1 -1
  145. package/dist/schema-query-impl/index.js +1 -1
  146. package/dist/schemas/benchmark_migration_operation.schema.json +1 -1
  147. package/dist/schemas/evaluation_operation.schema.json +1 -1
  148. package/dist/schemas/goal_operation.schema.json +1 -1
  149. package/dist/schemas/guard_rebind_replacement.schema.json +1 -0
  150. package/dist/schemas/index.json +1 -1
  151. package/dist/schemas/messenger_operation.schema.json +1 -1
  152. package/dist/schemas/onchain_operations.schema.json +1 -1
  153. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  154. package/dist/schemas/onchain_operations_arbitration.schema.json +1 -1
  155. package/dist/schemas/onchain_operations_contact.schema.json +1 -1
  156. package/dist/schemas/onchain_operations_demand.schema.json +1 -1
  157. package/dist/schemas/onchain_operations_gen_passport.schema.json +1 -1
  158. package/dist/schemas/onchain_operations_machine.schema.json +1 -1
  159. package/dist/schemas/onchain_operations_order.schema.json +1 -1
  160. package/dist/schemas/onchain_operations_permission.schema.json +1 -1
  161. package/dist/schemas/onchain_operations_personal.schema.json +1 -1
  162. package/dist/schemas/onchain_operations_progress.schema.json +1 -1
  163. package/dist/schemas/onchain_operations_proof.schema.json +1 -1
  164. package/dist/schemas/onchain_operations_repository.schema.json +1 -1
  165. package/dist/schemas/onchain_operations_reward.schema.json +1 -1
  166. package/dist/schemas/onchain_operations_service.schema.json +1 -1
  167. package/dist/schemas/onchain_operations_treasury.schema.json +1 -1
  168. package/dist/schemas/persona_operation.schema.json +1 -1
  169. package/dist/schemas/time_convert.schema.json +1 -0
  170. package/dist/schemas/wip_file.schema.json +1 -1
  171. package/dist/schemas/workflow_operation.schema.json +1 -1
  172. package/dist/tools/handlers/benchmark-migration.js +1 -1
  173. package/dist/tools/handlers/config.js +1 -1
  174. package/dist/tools/handlers/fund-rail-recipe.js +1 -1
  175. package/dist/tools/handlers/guard-rebind-replacement.js +1 -0
  176. package/dist/tools/handlers/local.js +1 -1
  177. package/dist/tools/handlers/mark-namespace.js +1 -1
  178. package/dist/tools/handlers/onchain.js +1 -1
  179. package/dist/tools/handlers/query.js +1 -1
  180. package/dist/tools/handlers/settle-sweep.js +1 -1
  181. package/dist/tools/handlers/time-convert.js +1 -0
  182. package/dist/tools/handlers/wip.js +1 -1
  183. package/dist/tools/handlers/workflow.js +1 -1
  184. package/dist/tools/index.d.ts +1 -0
  185. package/dist/tools/index.js +1 -1
  186. package/dist/tools/registry/business.js +1 -1
  187. package/dist/tools/registry/local.js +1 -1
  188. package/dist/tools/registry/onchain.js +1 -1
  189. package/dist/tools/wip-verify-ledger.js +1 -1
  190. package/dist/tools/wrap.js +1 -1
  191. package/package.json +6 -5
@@ -1 +1 @@
1
- import{ENTRYPOINT}from'@wowok/wowok';import{expandShapeSegments}from'../composition/shape-expand.js';import{buildViewport,runNodeAnalyzers}from'../graph/onchain/index.js';import{makeProposalNode}from'../graph/onchain/proposal-graph.js';import{machineRuleNodeAnalyzer,allocationRuleNodeAnalyzer}from'./rule-node-analyzers.js';import{GUARD_TEMPLATES,fillGuardTemplate,getTemplateById}from'./guard-templates.js';import{validateQuerySignatures}from'./chain-query-registry.js';import{refundGatePolarityMix}from'./allocator-rail-verifier.js';import{TASK_BINDING_SLOT,ONCE_SLOT_BYTES}from'./onchain-constants.js';import{GUARD_DESIGN_PATTERNS}from'./guard-design-patterns.js';import{lookupBinding}from'./guard-binding-table.js';import{unannotatedBuyerActionNodes}from'./scenario-modes.js';import{findLoopCycles,lintForwardAmbiguity}from'./machine-topology.js';import{TWO_TX_RENEW_RECIPE}from'./protocol-facts.js';import{DIRECT_SALES_INVARIANT,ENTITY_RECIPIENT_RULE_ID}from'./entity-recipient-guard.js';import{DISPUTE_FAMILY_NODE_REGEX,FUND_TERMINAL_NODE_REGEX,classifyLoopCycle}from'./audit-rules.js';import{bindingsFor,FEE_PARAM_BINDINGS}from'./fee-param-bindings.js';import{classifyFeeParam,EXTERNAL_CARRIER_KEYS,GENERATION_SHAPE_KEYS}from'./param-tiers.js';import{TIME_GUARD_INSTANTIATIONS}from'./pattern-resolutions.js';import{findSourceCoordinates}from'./template-validation.js';import{PLATFORM_TAKE_KEY,platformShareBps,validateAllocatorRows}from'./template-loader.js';import{canonicalizeMachineProse,machineProseFields,machineProseFindings,proseClaim}from'./template-prose.js';import{oracleCoverageFindings}from'./path-oracle/index.js';import{abortSafeVerbCheck,equalityFaceCheck,setCollapseCheck,thresholdLiteralCheck}from'./guard-quality.js';export{PLATFORM_TAKE_KEY};const MERCHANT_SHARE_KEY=/^(?:host|property|partner|institution|landlord|freelancer|creator|seller|instructor)_rate_bps$/,SYBIL_CLAIM_KEY_REGEX=/^experience_claim_amount$/;function directSalesEconomyChecks(a){const b=[],c=a['fee_params'],d=Object['keys'](c)['filter'](H=>PLATFORM_TAKE_KEY['test'](H)&&typeof c[H]==='number'&&c[H]!==0x0);d['length']>0x0&&b['push']({'rule_id':'R-ECON-01','severity':'critical','title':'Template\x20mandates\x20a\x20platform\x20commission\x20('+d['map'](H=>H+'='+c[H])['join'](',\x20')+')','detail':'WoWok\x20is\x20DIRECT\x20SALES:\x20the\x20protocol\x20never\x20extracts\x20and\x20a\x20merchant\x20pays\x20only\x20gas,\x20so\x20the\x20merchant-side\x20share\x20must\x20default\x20to\x20the\x20whole\x20sale.\x20A\x20non-zero\x20platform\x20take\x20is\x20(a)\x20an\x20extraction\x20the\x20platform\x20has\x20no\x20right\x20to,\x20and\x20(b)\x20an\x20UNALLOCATED\x20liability\x20—\x20no\x20template\x20declares\x20a\x20platform\x20address,\x20so\x20at\x20build\x20time\x20it\x20resolves\x20to\x20the\x20deploying\x20merchant\x20itself\x20(a\x20blank\x20slot\x20→\x20the\x20account\x20that\x20deployed\x20the\x20service),\x20to\x20the\x20keeper\x20(a\x20Signer\x20recipient\x20→\x20the\x20transaction\x20sender),\x20or\x20back\x20to\x20the\x20buyer\x20(a\x20guard-identifier\x20recipient).\x20None\x20of\x20those\x20is\x20revenue.','suggestion':'Set\x20'+d['join'](',\x20')+'\x20to\x200\x20and\x20give\x20the\x20merchant\x20the\x20whole\x20sale\x20(single\x20Rate\x2010000\x20leg).\x20If\x20the\x20merchant\x20IS\x20the\x20aggregator\x20and\x20genuinely\x20charges\x20a\x20fee,\x20declare\x20it\x20via\x20merchant_service_fee_bps\x20with\x20an\x20EXPLICIT\x20non-empty\x20recipient\x20Entity.'});const e=a['allocator']['description'],f=e['split'](/[.;]/)['filter'](H=>!/\b(?:never|no|not|don'?t|cannot|must not|avoid|prohibit\w*|forbid\w*|instead of|rather than|previously)\b/i['test'](H))['join']('\x20.\x20'),h=/(?:commission|take|platform|remainder|share)\s*(?:=|:)\s*order\s*total\s*-\s*(?:segment|sum)/i['test'](f),j=(a['allocator']['rows']??[])['some'](H=>H['mode']==='surplus')||a['allocator']['mode']==='surplus',k=j&&/(?:platform|commission|fee|take)[^.;]{0,120}\bsurplus\b|\bsurplus\b[^.;]{0,120}(?:platform|commission|fee|take)/i['test'](f);h&&b['push']({'rule_id':'R-ECON-02','severity':'critical','title':'Take\x20is\x20an\x20implicit\x20remainder\x20(not\x20computable\x20before\x20ordering)','detail':'The\x20allocator\x20describes\x20the\x20platform\x20share\x20as\x20\x22order\x20total\x20-\x20segment\x20sums\x22,\x20so\x20the\x20amount\x20taken\x20depends\x20on\x20the\x20segment\x20configuration\x20rather\x20than\x20a\x20declared\x20rate.\x20A\x20buyer\x20(or\x20their\x20AI)\x20cannot\x20compute\x20the\x20take\x20BEFORE\x20ordering,\x20which\x20defeats\x20pre-order\x20evaluation\x20—\x20and\x20an\x20unbounded\x20remainder\x20off\x20a\x20transit\x20pool\x20is\x20unbounded\x20extraction.','suggestion':'Pin\x20every\x20share\x20to\x20an\x20EXPLICIT\x20Rate\x20(or\x20an\x20Amount\x20derived\x20from\x20a\x20declared\x20rate).\x20A\x20supplier\x20fee\x20belongs\x20in\x20its\x20own\x20explicitly-priced\x20segment\x20order,\x20never\x20as\x20a\x20residual\x20share.'});k&&b['push']({'rule_id':'R-ECON-02','severity':'high','title':'Fee\x20appears\x20to\x20be\x20taken\x20by\x20a\x20Surplus\x20leg','detail':'A\x20Surplus\x20sharing\x20entry\x20allocates\x20the\x20WHOLE\x20remaining\x20balance\x20(withdraw-all\x20semantics\x20on\x20the\x20on-chain\x20allocation),\x20so\x20it\x20cannot\x20express\x20\x22take\x2015%\x22:\x20it\x20doubles\x20as\x20draining\x20the\x20pool.','suggestion':'Use\x20Rate\x20(or\x20RateGross)\x20for\x20any\x20proportional\x20share.\x20Reserve\x20Surplus\x20for\x20an\x20explicitly-bounded\x20residual\x20whose\x20recipient\x20and\x20cap\x20are\x20stated.'});const l=/\{\s*(?:who|Entity|Signer|GuardIdentifier)\s*:/['test'](e)||/recipient\s*[:=]/i['test'](e),m=/^(?:merchant_service_fee_bps|digital_product_fee_bps|logistics_rate_bps|service_fee_rate_bps)$/,n=Object['keys'](c)['some'](H=>m['test'](H)&&typeof c[H]==='number'&&c[H]!==0x0);if(n&&!l&&d['length']===0x0){const H=collectFeeParamLandings(a),I=Object['keys'](c)['filter'](L=>m['test'](L)&&typeof c[L]==='number'&&c[L]!==0x0),J=I['some'](L=>(H['get'](L)??[])['some'](M=>M['surface']==='guard'||M['surface']==='allocator_row'&&M['recipient_blank']!==!![])),K=!J&&I['some'](L=>(H['get'](L)??[])['some'](M=>M['surface']==='directive'));!J?b['push']({'rule_id':'R-ECON-03','severity':'high','title':K?'Fee-bearing\x20template\x20is\x20a\x20DIRECTIVE\x20only\x20—\x20the\x20share\x20has\x20no\x20on-chain\x20carrier':'Fee-bearing\x20template\x20names\x20no\x20recipient\x20slot\x20for\x20the\x20non-merchant\x20share','detail':K?'fee_params\x20carry\x20fee-shaped\x20keys\x20('+I['join'](',\x20')+')\x20whose\x20only\x20landing\x20is\x20directive\x20prose\x20—\x20no\x20allocator\x20row\x20or\x20guard\x20consumes\x20them.\x20On-chain\x20NOTHING\x20carries\x20the\x20fee:\x20whoever\x20materializes\x20the\x20template\x20computes\x20the\x20cut\x20themselves\x20(and\x20the\x20promised\x20clamps\x20live\x20only\x20in\x20text),\x20so\x20two\x20builders\x20can\x20take\x20different\x20shares\x20with\x20nothing\x20to\x20verify\x20against.':'fee_params\x20carry\x20fee-shaped\x20keys\x20but\x20the\x20allocator\x20names\x20no\x20recipient\x20for\x20them.\x20On-chain\x20each\x20Rate\x20lands\x20in\x20ITS\x20OWN\x20recipient\x20slot;\x20an\x20unnamed\x20one\x20resolves\x20to\x20the\x20deploying\x20account,\x20to\x20the\x20keeper\x20(a\x20Signer\x20recipient),\x20or\x20back\x20to\x20the\x20buyer.\x20The\x20share\x20is\x20then\x20an\x20unallocated\x20liability\x20rather\x20than\x20revenue.','suggestion':'State\x20the\x20recipient\x20per\x20share\x20in\x20the\x20allocator\x20description\x20and\x20bind\x20it\x20to\x20an\x20explicit\x20NON-EMPTY\x20Entity\x20the\x20buyer\x20can\x20see\x20before\x20ordering.\x20Never\x20leave\x20it\x20blank.'}):b['push']({'rule_id':'R-ECON-03','severity':'low','title':'Fee\x20share\x20has\x20a\x20declared\x20landing\x20—\x20keep\x20its\x20recipient\x20explicit\x20and\x20visible\x20pre-order','detail':'The\x20fee-shaped\x20keys\x20('+I['join'](',\x20')+')\x20land\x20in\x20allocator\x20rows/guards;\x20the\x20allocator\x20prose\x20names\x20no\x20recipient\x20slot,\x20so\x20the\x20binding\x20relies\x20on\x20the\x20row\x20declarations.\x20Keep\x20every\x20recipient\x20an\x20explicit\x20NON-EMPTY\x20Entity\x20the\x20buyer\x20can\x20see\x20before\x20ordering.','suggestion':'Re-check\x20at\x20template_scan\x20after\x20edits\x20that\x20the\x20fee\x20keys\x20still\x20land\x20in\x20rows\x20whose\x20recipient\x20is\x20explicit.'});}const o=/(?:layer-?1|service-?level|pool)[^.]*settles? the full amount|full amount to the (?:platform|organizer) pool/i['test'](e);o&&b['push']({'rule_id':'R-ECON-04','severity':'medium','title':'Escrow\x20transits\x20an\x20organizer\x20pool\x20before\x20reaching\x20the\x20merchant','detail':'The\x20full\x20order\x20amount\x20settles\x20into\x20a\x20platform/organizer\x20pool\x20first\x20and\x20is\x20then\x20redistributed.\x20That\x20contradicts\x20the\x20direct-sales\x20promise\x20(\x22money\x20moves\x20only\x20between\x20the\x20two\x20parties\x22)\x20and\x20makes\x20the\x20organizer\x20a\x20waypoint\x20on\x20every\x20payout,\x20including\x20every\x20refund.','suggestion':'Release\x20supplier\x20segments\x20directly\x20from\x20the\x20order\x27s\x20own\x20Allocation,\x20and\x20make\x20the\x20organizer\x20a\x20named\x20party\x20rather\x20than\x20a\x20transit\x20node.'});const p=Object['keys'](c)['find'](L=>/^attributed_.*_bps$/['test'](L)&&typeof c[L]==='number'),q=Object['keys'](c)['find'](L=>/^(?:base_)?commission_rate_bps$/['test'](L)&&typeof c[L]==='number');p&&q&&c[p]>c[q]&&b['push']({'rule_id':'R-ECON-05','severity':'medium','title':'Attribution-priced\x20take:\x20a\x20cheaper\x20acquisition\x20channel\x20is\x20charged\x20MORE','detail':p+'='+c[p]+'\x20exceeds\x20'+q+'='+c[q]+'.\x20Charging\x20more\x20for\x20attributed\x20orders\x20means\x20the\x20merchant\x27s\x20cheap\x20channels\x20(KOC,\x20social,\x20repeat\x20buyers)\x20are\x20penalised\x20—\x20the\x20opposite\x20of\x20what\x20direct\x20sales\x20should\x20reward.','suggestion':'Price\x20every\x20channel\x20identically.\x20Attribution\x20may\x20change\x20RANKING,\x20never\x20the\x20take.'});if(a['allocator']['mode']==='rate'){const L=Object['keys'](c)['filter'](O=>MERCHANT_SHARE_KEY['test'](O)&&typeof c[O]==='number'),M=Object['keys'](c)['filter'](O=>PLATFORM_TAKE_KEY['test'](O)&&typeof c[O]==='number'),N=[...L,...M];if(L['length']>0x0&&M['length']>0x0){const O=N['map'](R=>c[R])['filter'](R=>typeof R==='number'),P=O['reduce']((R,S)=>R+S,0x0),Q=/surplus/i['test'](e);P!==0x2710&&!Q&&b['push']({'rule_id':'R-ECON-06','severity':'critical','title':'Rate\x20shares\x20sum\x20to\x20'+P+',\x20not\x2010000','detail':'Declared\x20rate\x20shares\x20('+N['map']((R,S)=>R+'='+O[S])['join']('\x20+\x20')+')\x20total\x20'+P+'.\x20With\x20no\x20Surplus\x20recipient\x20the\x20remainder\x20is\x20not\x20protected:\x20the\x20chain\x20records\x20no\x20\x22already\x20triggered\x22\x20flag,\x20so\x20a\x20balance\x20left\x20behind\x20after\x20a\x20partial\x20split\x20can\x20be\x20claimed\x20REPEATEDLY\x20by\x20anyone\x20passing\x20the\x20same\x20Guard.\x20This\x20is\x20exactly\x20what\x20happens\x20when\x20a\x20platform\x20leg\x20is\x20zeroed\x20without\x20recomputing\x20the\x20merchant\x20leg.','suggestion':'Make\x20the\x20shares\x20sum\x20to\x20exactly\x2010000,\x20or\x20declare\x20an\x20explicit\x20Surplus\x20recipient\x20for\x20the\x20residual.'});}}a['review_mode']==='review_reward'&&b['push']({'rule_id':'R-ECON-07','severity':'low','title':'Reward\x20pool\x20has\x20no\x20natural\x20reclaim\x20—\x20unclaimed\x20balance\x20stays\x20escrowed','detail':'This\x20template\x20arms\x20a\x20merchant-funded\x20reward/bounty\x20pool.\x20When\x20the\x20claim\x20window\x20closes,\x20an\x20unclaimed\x20balance\x20does\x20NOT\x20return\x20to\x20the\x20merchant\x20automatically:\x20the\x20sole\x20exit\x20is\x20the\x20owner-side\x20permission-158\x20reward\x20withdraw,\x20a\x20separate\x20governance\x20transaction\x20this\x20build\x20does\x20not\x20emit.\x20Per\x20store\x20the\x20residue\x20is\x20small,\x20but\x20across\x20campaigns\x20it\x20is\x20a\x20permanent\x20escrowed\x20float\x20the\x20merchant\x20may\x20mistake\x20for\x20spent\x20budget.','suggestion':'Either\x20plan\x20an\x20explicit\x20post-window\x20sweep\x20step\x20(permission-158\x20reward\x20withdraw\x20back\x20to\x20the\x20merchant\x20account)\x20in\x20the\x20campaign\x20runbook,\x20or\x20book\x20the\x20armed\x20pool\x20as\x20operating\x20cost\x20upfront\x20and\x20size\x20it\x20to\x20expected\x20claims.'});const s=Object['keys'](c)['find'](R=>SYBIL_CLAIM_KEY_REGEX['test'](R)&&typeof c[R]==='number'),w=s!==undefined?c[s]:undefined,x=Object['keys'](c)['find'](R=>MIN_PRICE_KEY_REGEX['test'](R)&&typeof c[R]==='number'),y=x!==undefined?c[x]:undefined;w!==undefined&&y!==undefined&&y>0x0&&w>y*0.2&&b['push']({'rule_id':'R-ECON-08','severity':'high','title':'Per-claim\x20'+s+'\x20=\x20'+w+'\x20exceeds\x2020%\x20of\x20the\x20lowest\x20SKU\x20price\x20('+y+')\x20—\x20sybil-farm\x20shape','detail':'The\x20goodwill/reward\x20per-claim\x20draw\x20is\x20more\x20than\x201/5\x20of\x20the\x20cheapest\x20SKU:\x20a\x20farm\x20of\x20bot\x20accounts\x20'+'earns\x20more\x20by\x20mass-claiming\x20the\x20compensation/review\x20bounty\x20than\x20a\x20real\x20after-sale\x20event\x20costs\x20—\x20'+'the\x20classic\x20sybil-arbitrage\x20shape\x20(sso7-mn-261104\x20F-31:\x20a\x20shipped\x20default\x20paid\x202.0x\x20the\x20lowest\x20'+'SKU\x20price\x20per\x20claim).\x20The\x20pre-funded\x20pool\x20drains\x20on\x20autopilot\x20and\x20the\x20claim/review\x20traffic\x20it\x20'+'buys\x20is\x20worthless\x20signal\x20—\x20batch-farmed\x20reviews\x20and\x20goodwill\x20claims\x20out-earn\x20genuine\x20'+'after-sales\x20cost.','suggestion':'Couple\x20the\x20draw\x20to\x20the\x20catalog:\x20keep\x20the\x20per-claim\x20amount\x20at\x20<=\x2020%\x20of\x20the\x20LOWEST\x20SKU\x20price\x20'+('(here\x20<=\x20'+Math['floor'](y*0.2)+'),\x20and\x20add\x20sybil\x20friction\x20before\x20a\x20claim\x20lands\x20—\x20a\x20')+'minimum\x20activity\x20row\x20count\x20(min_rows)\x20or\x20a\x20minimum\x20rating\x20threshold\x20—\x20with\x20the\x20claim\x20window\x20'+'parameterized\x20as\x20a\x20fee\x20param,\x20not\x20a\x20hard-coded\x20constant.'});const z=(a['allocator']['rows']??[])['map']((R,S)=>({'r':R,'i':S})),A=z['filter'](({r:R})=>R['recipient']==='entity'&&!(R['recipient_key']??'')['trim']());A['length']>0x0&&b['push']({'rule_id':ENTITY_RECIPIENT_RULE_ID,'severity':'critical','title':'Allocator\x20row(s)\x20'+A['map'](({i:R})=>'#'+R)['join'](',\x20')+'\x20name\x20no\x20Entity\x20recipient\x20—\x20the\x20share\x20silently\x20pays\x20the\x20deploying\x20merchant','detail':A['map'](({i:R})=>'rows['+R+']')['join'](',\x20')+'\x20declare\x20recipient=\x27entity\x27\x20with\x20no\x20recipient_key,\x20which\x20builds\x20as\x20'+'{\x20who:\x20{\x20Entity:\x20{\x20name_or_address:\x20\x22\x22\x20}\x20}\x20}.\x20That\x20is\x20NOT\x20a\x20no-op:\x20the\x20SDK\x20resolver\x20substitutes\x20the\x20DEFAULT\x20LOCAL\x20ACCOUNT\x20before\x20the\x20'+'address\x20reaches\x20Move,\x20so\x20the\x20order\x20escrow\x20pays\x20whoever\x20ran\x20the\x20deploy\x20—\x20the\x20\x27platform\x27\x20share\x20the\x20template\x20left\x20unnamed\x20becomes\x20the\x20merchant\x27s\x20'+('own\x20take.\x20'+DIRECT_SALES_INVARIANT),'suggestion':'Give\x20the\x20row\x20an\x20explicit\x20`recipient_key`\x20naming\x20the\x20party\x20(a\x20mark\x20name\x20or\x20a\x200x\x20address\x20the\x20buyer\x20can\x20see\x20BEFORE\x20ordering).\x20If\x20the\x20whole\x20sale\x20goes\x20'+'to\x20the\x20merchant,\x20do\x20not\x20declare\x20an\x20entity\x20row\x20at\x20all:\x20use\x20ONE\x20full-share\x20row\x20to\x20the\x20merchant\x27s\x20own\x20account\x20({\x20who:\x20{\x20Signer:\x20\x22signer\x22\x20}\x20}\x20when\x20'+'the\x20merchant\x20is\x20always\x20the\x20triggering\x20party,\x20or\x20an\x20explicit\x20Entity\x20row).\x20A\x20{\x20who:\x20{\x20GuardIdentifier:\x200\x20}\x20}\x20leg\x20pays\x20the\x20order\x20anchor,\x20not\x20the\x20'+'merchant\x20—\x20reserve\x20it\x20for\x20refunds\x20(see\x20the\x20order-anchored\x20refund\x20convention).\x20The\x20scalar\x20'+'`allocator.recipient:\x20\x22entity\x22`\x20form\x20is\x20auditable\x20too:\x20it\x20must\x20carry\x20a\x20`recipient_key`\x20(or\x20a\x20`rows[]`\x20array)\x20when\x20no\x20rows\x20narrow\x20it.'});!a['allocator']['rows']&&a['allocator']['recipient']==='entity'&&!(a['allocator']['recipient_key']??'')['trim']()&&b['push']({'rule_id':ENTITY_RECIPIENT_RULE_ID,'severity':'critical','title':'Allocator\x20names\x20no\x20Entity\x20recipient\x20(scalar\x20form,\x20no\x20rows)\x20—\x20the\x20share\x20silently\x20pays\x20the\x20deploying\x20merchant','detail':'The\x20allocator\x20declares\x20scalar\x20recipient=\x27entity\x27\x20with\x20no\x20recipient_key\x20and\x20no\x20rows[],\x20which\x20builds\x20as\x20'+'{\x20who:\x20{\x20Entity:\x20{\x20name_or_address:\x20\x22\x22\x20}\x20}\x20}.\x20That\x20is\x20NOT\x20a\x20no-op:\x20the\x20SDK\x20resolver\x20substitutes\x20the\x20DEFAULT\x20LOCAL\x20ACCOUNT\x20before\x20the\x20'+'address\x20reaches\x20Move,\x20so\x20the\x20order\x20escrow\x20pays\x20whoever\x20ran\x20the\x20deploy\x20—\x20the\x20share\x20the\x20template\x20left\x20unnamed\x20becomes\x20the\x20merchant\x27s\x20'+('own\x20take.\x20'+DIRECT_SALES_INVARIANT),'suggestion':'Declare\x20the\x20destination\x20machine-checkably:\x20set\x20`recipient_key`\x20on\x20the\x20allocator\x20(a\x20mark\x20name\x20or\x20a\x200x\x20address\x20the\x20buyer\x20can\x20see\x20BEFORE\x20ordering),\x20'+'or\x20add\x20a\x20`rows[]`\x20array\x20carrying\x20the\x20on-chain\x20`who`\x20shape.\x20If\x20the\x20whole\x20sale\x20goes\x20to\x20the\x20merchant,\x20use\x20ONE\x20row\x20naming\x20the\x20merchant\x27s\x20own\x20account\x20'+'({\x20recipient:\x20\x27entity\x27,\x20recipient_key:\x20\x27<merchant>\x27\x20}\x20or\x20{\x20recipient:\x20\x27signer\x27\x20}\x20when\x20the\x20merchant\x20is\x20always\x20the\x20triggering\x20party);\x20a\x20'+'{\x20recipient:\x20\x27guard_identifier\x27\x20}\x20row\x20pays\x20the\x20order\x20anchor\x20(refund\x20semantics),\x20not\x20the\x20merchant.'});const B=z['filter'](({r:R})=>R['recipient']==='entity'&&/^0x0*$/i['test']((R['recipient_key']??'')['trim']()));B['length']>0x0&&b['push']({'rule_id':ENTITY_RECIPIENT_RULE_ID,'severity':'high','title':'Allocator\x20row(s)\x20'+B['map'](({i:R})=>'#'+R)['join'](',\x20')+'\x20name\x20the\x20zero\x20address\x20as\x20Entity\x20recipient','detail':B['map'](({i:R})=>'rows['+R+']')['join'](',\x20')+'\x20carry\x20recipient_key=\x270x0\x27\x20(or\x20an\x20all-zero\x20literal).\x20The\x20chain\x20does\x20NOT\x20reject\x20it:\x20'+'the\x20on-chain\x20allocation\x20swallows\x20Recipient::Entity\x20in\x20a\x20(_)\x20catch-all\x20at\x20declaration\x20time,\x20and\x20forwards\x20the\x20raw\x20'+'address\x20straight\x20to\x20the\x20payout\x20constructor.\x20The\x20allocation\x20is\x20accepted\x20and\x20the\x20share\x20is\x20silently\x20transferred\x20to\x200x0\x20and\x20permanently\x20burned\x20—\x20'+'this\x20scan\x20is\x20the\x20only\x20defence.','suggestion':'Replace\x20the\x20zero\x20literal\x20with\x20the\x20real\x20recipient\x20address\x20(a\x20mark\x20name\x20or\x20a\x200x\x20address),\x20or\x20drop\x20the\x20row\x20if\x20the\x20share\x20is\x20not\x20owed.'});const C=R=>R['recipient']+':'+(R['recipient_key']??'')['trim']()['toLowerCase'](),D=/^(recover_gate|awarded_recover|terminal_settlement_recover)$/,E=R=>R['guard_key']??'\x00unkeyed',F=new Map();for(const R of a['allocator']['rows']??[]){if(R['mode']!=='rate'||D['test'](R['guard_key']??''))continue;const S=E(R),T=F['get'](S);if(T===undefined)F['set'](S,new Set([C(R)]));else T['add'](C(R));}const G=z['filter'](({r:U})=>U['mode']==='surplus'&&(F['get'](E(U))?.['has'](C(U))??![]));return G['length']>0x0&&b['push']({'rule_id':'R-RECIPIENT-04','severity':'critical','title':'Surplus\x20row(s)\x20'+G['map'](({i:U})=>'#'+U)['join'](',\x20')+'\x20pay\x20a\x20recipient\x20a\x20Rate\x20leg\x20already\x20pays\x20—\x20the\x20remainder\x20swallows\x20an\x20undeclared\x20share','detail':G['map'](({i:U})=>'rows['+U+']')['join'](',\x20')+'\x20duplicate\x20a\x20Rate\x20leg\x27s\x20recipient.\x20The\x20chain\x20pays\x20every\x20Rate\x20leg\x20its\x20declared\x20basis\x20points\x20'+'and\x20then\x20pays\x20the\x20ENTIRE\x20remainder\x20to\x20the\x20Surplus\x20recipient,\x20so\x20this\x20party\x20quietly\x20receives\x20rate%\x20+\x20100%\x20of\x20the\x20residual\x20and\x20any\x20leg\x20the\x20'+'author\x20intended\x20but\x20omitted\x20(commission,\x20payment\x20fee,\x20platform\x20take)\x20is\x20never\x20created.\x20The\x20Rate-sum\x20rule\x20passes\x20because\x20the\x20sum\x20is\x20legal\x20—\x20'+'the\x20misroute\x20is\x20invisible\x20there,\x20and\x20order_allocators\x20freezes\x20permanently\x20at\x20publish.\x20Mainnet\x20precedent\x20(Booking\x20replica,\x202026-10-06):\x20the\x20'+'property\x20took\x20100%\x20(Rate\x208350\x20+\x20Surplus),\x20the\x2015%\x20commission\x20and\x201.5%\x20payment-fee\x20legs\x20never\x20existed,\x20and\x20the\x20published\x20Service\x20had\x20to\x20be\x20abandoned.','suggestion':'Point\x20the\x20Surplus\x20row\x20at\x20the\x20party\x20meant\x20to\x20absorb\x20the\x20remainder\x20(usually\x20the\x20merchant),\x20distinct\x20from\x20every\x20Rate\x20leg\x20—\x20or,\x20if\x20the\x20duplicated\x20'+'recipient\x20is\x20truly\x20intended\x20to\x20take\x20rate%\x20+\x20remainder,\x20collapse\x20the\x20two\x20rows\x20into\x20ONE\x20rate\x20row\x20so\x20the\x20declared\x20split\x20equals\x20the\x20actual\x20split.\x20'+'Every\x20intended\x20payee\x20must\x20be\x20its\x20own\x20explicit\x20row.'}),b;}const KNOWN_GUARD_REF_IDS=new Set([...GUARD_DESIGN_PATTERNS['map'](a=>a['id']),...GUARD_TEMPLATES['map'](a=>a['id'])]);function guardRefChecks(a){const b=[];for(const c of a['guards']){if(!/^(pattern\.[a-z0-9_]+|tpl_[a-z0-9_]+)$/['test'](c['template_id'])){b['push']({'rule_id':'R-REF-01','severity':'high','title':'Guard\x20reference\x20\x27'+c['template_id']+'\x27\x20is\x20not\x20a\x20resolvable\x20id','detail':'Guard\x20references\x20must\x20name\x20a\x20guard\x20design\x20pattern\x20(\x27pattern.*\x27,\x20'+GUARD_DESIGN_PATTERNS['length']+'\x20available)\x20or\x20a\x20guard\x20template\x20(\x27tpl_*\x27,\x20'+GUARD_TEMPLATES['length']+'\x20available).\x20Bare\x20prose\x20ids\x20dangle:\x20no\x20builder\x20can\x20resolve\x20them,\x20so\x20the\x20AI\x20invents\x20guard\x20logic\x20at\x20build\x20time.','suggestion':'Replace\x20with\x20the\x20semantically\x20nearest\x20pattern.*/tpl_*\x20id\x20(compose\x20multi-condition\x20logic\x20in\x20the\x20purpose\x20text).'});continue;}!KNOWN_GUARD_REF_IDS['has'](c['template_id'])&&b['push']({'rule_id':'R-REF-02','severity':'high','title':'Guard\x20reference\x20\x27'+c['template_id']+'\x27\x20does\x20not\x20exist\x20in\x20any\x20guard\x20catalog','detail':'The\x20id\x20is\x20namespaced\x20correctly\x20but\x20matches\x20no\x20guard\x20design\x20pattern\x20nor\x20guard\x20template\x20—\x20a\x20dangling\x20reference\x20the\x20AI\x20cannot\x20resolve.','suggestion':'Fix\x20the\x20id\x20(typo)\x20or\x20point\x20it\x20at\x20the\x20nearest\x20existing\x20pattern.*/tpl_*\x20entry.'});}return b;}function staticChecks(a){const b=[],c=l=>{const m=new RegExp('\x5cb'+l['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&')+'\x5cb','i');for(const n of a['allocator']?.['rows']??[]){if(n['track']!=='refund'||!n['guard_key'])continue;const o=a['guards']['find'](q=>q['key']===n['guard_key']);if(o&&m['test']((o['key']??'')+'\x20'+o['purpose']))return!![];}return![];};for(const l of a['machine_shape']){const m=DISPUTE_FAMILY_NODE_REGEX['test'](l['name']),n=!m&&FUND_TERMINAL_NODE_REGEX['test'](l['name']);if(m||n&&!c(l['name']))b['push']({'rule_id':'R-M1-11','severity':'critical','title':'Machine\x20node\x20\x27'+l['name']+'\x27\x20models\x20dispute/refund\x20flow','detail':'Disputes\x20are\x20independent\x20of\x20the\x20Machine\x20workflow;\x20refunds\x20route\x20via\x20Allocators\x20triggered\x20by\x20business\x20states.','suggestion':'Remove\x20the\x20node;\x20route\x20refunds\x20via\x20Allocator\x20states\x20(closed_cancel/cancel_requested)\x20and\x20disputes\x20via\x20the\x20Arbitration\x20object.'});else{if(n){const o=/record[ -]waypoint|accepted-node set|money never moves/i['test'](l['role']??'');!o&&b['push']({'rule_id':'R-M1-11','severity':'low','title':'Machine\x20node\x20\x27'+l['name']+'\x27\x20reuses\x20a\x20fund-terminal\x20name\x20(guard-anchored,\x20exempt)','detail':'The\x20refund-track\x20allocator\x20consumes\x20a\x20guard\x20anchored\x20to\x20\x27'+l['name']+'\x27\x20—\x20the\x20guard\x20moves\x20the\x20funds,\x20so\x20the\x20node\x20is\x20a\x20routing\x20state,\x20not\x20a\x20money\x20move.','suggestion':'Prefer\x20a\x20routing-state\x20name\x20(closed_cancel/cancel_requested)\x20so\x20the\x20intent\x20is\x20self-evident\x20without\x20the\x20guard\x20chain.'});}}}for(const q of a['machine_shape']){for(const s of q['from']??[]){const w=typeof s==='string'?{'prev':s}:s;typeof w['prev']==='string'&&w['prev']!==''&&w['prev']===q['name']&&b['push']({'rule_id':'R-EDGE-SELF-LOOP','severity':'high','title':'Machine\x20edge\x20\x27'+(w['forward']??'(unnamed)')+'\x27\x20on\x20node\x20\x27'+q['name']+'\x27\x20is\x20a\x20SELF-loop','detail':'The\x20edge\x20is\x20mounted\x20in\x20its\x20own\x20target\x27s\x20from-list\x20(prev\x20==\x20the\x20owning\x20node).\x20A\x20same-node\x20forward\x20never\x20moves\x20progress.current\x20—\x20the\x20chain\x20records\x20the\x20tap\x20but\x20the\x20order\x20stays\x20on\x20the\x20node,\x20so\x20the\x20buyer/merchant\x20re-taps\x20it,\x20burns\x20gas,\x20and\x20every\x20path\x20that\x20leaves\x20the\x20node\x20stays\x20unreachable\x20(mainnet\x20B-01:\x20the\x20buyer\x27s\x20withdraw-return\x20spun\x20on\x20return_requested\x20while\x20the\x20guard\x20purpose\x20said\x20`return_requested\x20->\x20delivered`).','suggestion':'Mount\x20the\x20edge\x20in\x20the\x20TARGET\x20node\x27s\x20from-list\x20instead\x20(move\x20`{\x20prev:\x20\x27'+q['name']+'\x27,\x20forward:\x20...\x20}`\x20under\x20node\x20\x27<target>\x27),\x20or\x20delete\x20the\x20edge\x20if\x20no\x20movement\x20was\x20intended.'});}}{const x=(a['machine_shape']??[])['map'](z=>{const A=new Map();for(const B of z['from']??[]){const C=typeof B==='string'?{'prev':B}:B,D=typeof C['prev']==='string'?C['prev']:'',E=typeof C['forward']==='string'?C['forward']:'';if(E==='')continue;const F=A['get'](D)??[];F['push']({'name':E}),A['set'](D,F);}return{'name':z['name'],'pairs':[...A['entries']()]['map'](([G,H])=>({'prev_node':G,'forwards':H}))};}),y=lintForwardAmbiguity(x,'template\x20\x27'+a['id']+'\x27');for(const z of y['critical']){b['push']({'rule_id':'R-FORWARD-DEST-AMBIGUITY','severity':'critical','title':'Forward\x20ambiguity\x20blocks\x20every\x20generate\x20of\x20\x27'+a['id']+'\x27\x20(P0-6)','detail':z+'\x20—\x20the\x20compile/plan\x20faces\x20hard-block\x20this\x20shape\x20(P0-6:\x20the\x20caller\x20picks\x20next_node,\x20so\x20a\x20forked\x20(prev,\x20forward)\x20name\x20can\x20land\x20the\x20order\x20—\x20and\x20its\x20escrow\x20direction\x20—\x20on\x20the\x20WRONG\x20node;\x20test/10\x20P0-6\x20stranded\x20129,000,000).\x20A\x20template\x20whose\x20generate\x20is\x20BLOCKED\x20is\x20a\x20first-deploy\x20completeness\x20violation:\x20template_scan\x20must\x20catch\x20what\x20template_generate\x20blocks\x20(hiswkp\x20F-01).','suggestion':'Give\x20each\x20destination\x20its\x20own\x20forward\x20name\x20(destination-honest\x20fork\x20naming,\x20e.g.\x20WithdrawClaim\x20→\x20WithdrawClaimReturn\x20on\x20the\x20return\x20branch),\x20then\x20re-scan.'});}for(const A of y['warnings']){b['push']({'rule_id':'R-FORWARD-DEST-AMBIGUITY','severity':'medium','title':'Forward\x20fork\x20in\x20\x27'+a['id']+'\x27\x20needs\x20destination-unique\x20names','detail':''+A,'suggestion':'Prefer\x20destination-unique\x20forward\x20names\x20unless\x20the\x20fork\x20is\x20intentional\x20and\x20the\x20caller-facing\x20duty\x20names\x20the\x20choice.'});}}const d=new Map();for(const B of a['guards']??[]){const C=B&&typeof B['params']==='object'&&B['params']!==null?B['params']['expected_node']:undefined;typeof B?.['key']==='string'&&typeof C==='string'&&C!==''&&d['set'](B['key'],C);}if(d['size']>0x0){const D=new Map();for(const E of a['machine_shape']){for(const F of E['from']??[]){const G=typeof F==='string'?{'prev':F,'guard_key':undefined}:F;if(typeof G['guard_key']==='string'&&d['has'](G['guard_key'])){const H=D['get'](G['guard_key'])??new Set();H['add'](typeof G['prev']==='string'?G['prev']:''),D['set'](G['guard_key'],H);}}}for(const [I,J]of d){const K=D['get'](I);if(K===undefined||K['size']===0x1&&K['has'](J))continue;b['push']({'rule_id':'R-NODE-GATE-SOURCE','severity':'high','title':'Guard\x20\x27'+I+'\x27\x20pins\x20expected_node\x20\x27'+J+'\x27\x20but\x20no\x20mount\x20fires\x20from\x20that\x20node','detail':'progress.current\x20at\x20tap\x20time\x20equals\x20the\x20edge\x27s\x20prev;\x20a\x20node-check\x20guard\x20whose\x20expected_node\x20(\x27'+J+'\x27)\x20differs\x20from\x20its\x20mount\x20prev\x20('+(K?[...K]['map'](L=>'\x27'+(L||'(entry)')+'\x27')['join'](',\x20'):'none')+')\x20evaluates\x20FALSE\x20on\x20every\x20tap\x20—\x20the\x20forward\x20aborts\x20in\x20guard\x20verification,\x20a\x20paid\x20no-op\x20that\x20strands\x20the\x20order\x20on\x20the\x20source\x20node\x20(B-01\x20family).','suggestion':'Mount\x20the\x20edge\x20in\x20the\x20gated\x20node\x27s\x20from-list\x20(prev\x20=\x20expected_node),\x20or\x20re-point\x20the\x20guard\x27s\x20expected_node\x20to\x20the\x20mount\x27s\x20prev.\x20One\x20of\x20the\x20two\x20must\x20name\x20the\x20other\x27s\x20node.'});}}const e=new Map();for(const L of a['guards']){if(/time_lock|order_holder|progress_state/['test'](L['template_id'])&&!/order\.service|project bind|service binding/i['test'](L['purpose'])){const M=e['get'](L['template_id'])??[];M['push'](L['key']??'(no\x20key)'),e['set'](L['template_id'],M);}}for(const [N,O]of e){b['push']({'rule_id':'R-C3-05','severity':'low','title':'Guard\x20\x27'+N+'\x27\x20consumes\x20a\x20submitted\x20Order\x20without\x20project\x20binding\x20('+O['length']+'x:\x20'+O['join'](',\x20')+')\x20—\x20advisory\x20(v148\x20backstop)','detail':'Passport\x20submissions\x20are\x20caller-built;\x20without\x20logic_equal[order.service,\x20<service>]\x20a\x20stale\x20order\x20from\x20another\x20project\x20could\x20satisfy\x20the\x20guard\x20for\x20a\x20fresh\x20order.\x20Since\x20protocol\x20v148\x20the\x20Progress\x20layer\x20itself\x20rejects\x20cross-order\x20submissions\x20(the\x20chain-side\x20task-binding\x20check),\x20so\x20this\x20is\x20now\x20defense-in-depth:\x20the\x20window\x20is\x20closed\x20at\x20the\x20chain,\x20the\x20template\x20binding\x20only\x20shortens\x20the\x20failure\x20distance.','suggestion':'Optionally\x20state\x20the\x20project\x20binding\x20in\x20the\x20guard\x20purpose\x20AND\x20include\x20it\x20in\x20the\x20guard\x20root\x20at\x20build\x20time\x20(fails\x20earlier,\x20closer\x20to\x20the\x20cause).\x20No\x20longer\x20a\x20publish\x20blocker.'});}const f=new Map();for(const P of a['guards']){if(P['host']==='reward')continue;if(/order\.service/i['test'](P['purpose'])){const Q=f['get'](P['template_id'])??[];Q['push'](P['key']??'(no\x20key)'),f['set'](P['template_id'],Q);}}for(const [R,S]of f){b['push']({'rule_id':'R-C3-05-REDUNDANT','severity':'low','title':'Guard\x20\x27'+R+'\x27\x20still\x20declares\x20the\x20order.service\x20host-binding\x20leg\x20('+S['length']+'x:\x20'+S['join'](',\x20')+')\x20—\x20redundant\x20since\x20v148','detail':'The\x20catalog\x20sweep\x20(bsw4\x20F-06)\x20removed\x20the\x20order.service\x20==\x20<service>\x20leg\x20from\x20every\x20guard\x20template:\x20protocol\x20v148\x27s\x20chain-side\x20task-binding\x20check\x20already\x20rejects\x20cross-order\x20submissions,\x20and\x20the\x20leg\x20pinned\x20the\x20Machine\x20to\x20ONE\x20Service\x20instance\x20—\x20republishing\x20the\x20Service\x20stranded\x20the\x20Machine\x20and\x20every\x20forward\x20guard.\x20The\x20only\x20legitimate\x20order.service\x20comparison\x20is\x20the\x20cross-service\x20rule\x20against\x20the\x20MAIN\x20service\x20address\x20(tpl_buy_guard_order_holder),\x20which\x20is\x20not\x20a\x20host\x20pin.','suggestion':'Drop\x20the\x20leg\x20(guard_resolutions\x20entry\x20{\x20kind:\x20\x22omit\x22\x20})\x20or\x20rewrite\x20the\x20guard\x20purpose;\x20keep\x20an\x20order.service\x20leg\x20only\x20when\x20it\x20compares\x20against\x20a\x20DIFFERENT\x20service\x27s\x20address\x20(cross-service\x20business\x20rule,\x20not\x20the\x20host).'});}a['machine_shape']['length']===0x0&&b['push']({'rule_id':'R-M1-01','severity':'critical','title':'machine_shape\x20is\x20empty','detail':'No\x20entry\x20node\x20—\x20the\x20Machine\x20cannot\x20start.','suggestion':'Add\x20at\x20least\x20one\x20entry\x20node\x20representing\x20the\x20escrowed\x20state.'});const h=a['guards']['some'](T=>/refund|cancel/i['test'](T['template_id'])||/refund|cancel/i['test'](T['purpose']))||/refund/i['test'](a['allocator']['description']);!h&&b['push']({'rule_id':'R1','severity':'high','title':'No\x20refund\x20path\x20detected','detail':'No\x20refund/cancel\x20guard\x20and\x20no\x20refund\x20route\x20in\x20the\x20allocator\x20description.','suggestion':'Add\x20a\x20refund/cancel\x20guard\x20or\x20an\x20allocator\x20refund\x20route\x20before\x20publishing.'});const j=a['guards']['some'](T=>T['host']==='arbitration')||a['trust_mechanisms']['some'](T=>T['startsWith']('R2'));!j&&b['push']({'rule_id':'R2','severity':'high','title':'No\x20independent\x20Arbitration\x20reference\x20detected','detail':'The\x20template\x20carries\x20no\x20arbitration-hosted\x20guard\x20and\x20no\x20R2\x20trust\x20mechanism.','suggestion':'Mount\x20an\x20independent\x20Arbitration\x20object\x20with\x20its\x20own\x20Permission.'});a['keeper_dependencies']['length']===0x0&&b['push']({'rule_id':'R9','severity':'medium','title':'No\x20keeper\x20dependencies\x20declared','detail':'Time-driven\x20transitions\x20only\x20ALLOW\x20advancement\x20—\x20someone\x20must\x20run\x20the\x20keepers.','suggestion':'Declare\x20the\x20keeper\x20operations\x20(timeouts,\x20window\x20expiries,\x20settlement\x20triggers).'});b['push'](...directSalesEconomyChecks(a));const k=unannotatedBuyerActionNodes(a['machine_shape']);k['length']>0x0&&b['push']({'rule_id':'R-OPER-01','severity':'medium','title':'Buyer-side\x20node(s)\x20without\x20an\x20operator\x20annotation','detail':'Node(s)\x20'+k['map'](T=>'\x27'+T+'\x27')['join'](',\x20')+'\x20look\x20like\x20order-payer\x20actions\x20but\x20carry\x20no\x20operator\x20field.\x20At\x20build\x20time\x20they\x20default\x20to\x20a\x20merchant\x20permission\x20slot,\x20and\x20the\x20order\x20payer\x20cannot\x20advance\x20them\x20(E_PERMISSION_DENIED).','suggestion':'Annotate\x20true\x20buyer\x20actions\x20with\x20operator:\x20\x22order_payer\x22\x20(an\x20EMPTY\x20namedOperator\x20—\x20the\x20on-chain\x20check\x20resolves\x20it\x20to\x20the\x20order\x20payer);\x20rename\x20merchant-side\x20states\x20(e.g.\x20\x27cancelled\x27\x20->\x20\x27merchant_cancelled\x27)\x20when\x20the\x20actor\x20is\x20NOT\x20the\x20buyer.'});a['review_mode']&&a['review_mode']!=='none'&&b['push']({'rule_id':'R-REVIEW-WRITE-ONCE','severity':'low','title':'Reviews\x20are\x20write-once\x20—\x20a\x20mis-rating\x20cannot\x20be\x20edited,\x20deleted\x20or\x20followed\x20up','detail':'This\x20template\x20mounts\x20a\x20buyer\x20review\x20rail\x20whose\x20rating\x20+\x20comment\x20rows\x20are\x20write-once\x20(row\x20id\x20=\x20the\x20order).\x20There\x20is\x20NO\x20on-chain\x20update,\x20delete\x20or\x20follow-up-review\x20edge:\x20a\x20mistyped\x20rating\x20or\x20comment\x20is\x20permanent,\x20and\x20extortion-by-bad-review\x20has\x20no\x20negotiated-retraction\x20buffer\x20(the\x20repository\x20protocol\x20exposes\x20no\x20tombstone\x20semantics).','suggestion':'State\x20the\x20irreversibility\x20in\x20the\x20storefront\x20copy\x20and\x20any\x20pre-review\x20confirmation\x20step;\x20do\x20not\x20promise\x20\x27edit\x20your\x20review\x27\x20to\x20buyers.\x20A\x20negotiated\x20goodwill\x20remedy\x20must\x20ride\x20arbitration\x20or\x20a\x20refund,\x20not\x20a\x20review\x20edit.'});for(const T of a['guards']??[]){const U=T['template_id']?.['startsWith']('tpl_')?T['template_id']:undefined;if(U===undefined)continue;const V={...a['fee_params'],...T['params']};let W=fillGuardTemplate(U,V);if(!W['ok']){const Y=getTemplateById(U);if(Y===undefined)continue;const Z={...V};for(const a0 of Y['parameters']){if(a0['required']&&!(a0['name']in Z))Z[a0['name']]=a0['type']==='number'?0x1:'__scan_probe_'+a0['name']+'__';}W=fillGuardTemplate(U,Z);if(!W['ok'])continue;}const X=validateQuerySignatures(W['root'],U,T['key']);X!==undefined&&b['push']({'rule_id':'R-QUERY-SIGNATURE','severity':'critical','title':'Guard\x20\x27'+T['key']+'\x27\x20('+U+')\x20ships\x20a\x20root\x20the\x20SDK/chain\x20will\x20reject','detail':X+'\x20The\x20SDK\x20rejects\x20such\x20roots\x20at\x20guard-create\x20time\x20and\x20the\x20chain\x20at\x20verification\x20time\x20—\x20publishing\x20the\x20template\x20would\x20guarantee\x20a\x20mid-order\x20hard\x20failure\x20on\x20this\x20rail.','suggestion':'Fix\x20the\x20guard\x20template\x27s\x20example_root\x20(parameter\x20count\x20per\x20chain-query-registry;\x20logic_equal\x20operand\x20order\x20—\x20typed\x20operand\x20first,\x20dynamic\x20Value\x20second)\x20or\x20supply\x20the\x20missing\x20parameter\x20at\x20the\x20guard\x20spec\x20params.'});}return b;}const PERIOD_COUNT_KEY_REGEX=/^(monthly_allocators|term_count|session_count|segment_count|periods|cycles|installments)$/;function poolPeriodCount(a){for(const [b,c]of Object['entries'](a['fee_params'])){if(PERIOD_COUNT_KEY_REGEX['test'](b)&&typeof c==='number'&&c>=0x2)return c;}return undefined;}function periodicReleaseChecks(a){const b=poolPeriodCount(a);if(b===undefined)return[];const c=[a['allocator']['description'],...a['build_notes'],...a['trust_mechanisms'],...a['guards']['map'](h=>h['purpose'])]['join']('\x20\x0a\x20'),d=[];/surplus/i['test'](c)&&!/no surplus|surplus[^.\n]*(disabled|forbidden|disallowed)|amount mode only|single surplus/i['test'](c)&&d['push']({'rule_id':'R-PER-01','severity':'high','title':'Multi-period\x20pool\x20('+b+'\x20periods)\x20declares\x20Surplus\x20without\x20a\x20terminal-only\x20qualifier','detail':'A\x20Surplus\x20allocator\x20entry\x20runs\x20a\x20withdraw-all\x20release\x20(the\x20on-chain\x20allocation\x20withdraws\x20the\x20whole\x20remaining\x20balance).\x20In\x20a\x20pool\x20pre-funded\x20for\x20'+b+'\x20periods\x20it\x20drains\x20every\x20future\x20release,\x20not\x20just\x20the\x20remainder.','suggestion':'Release\x20each\x20period\x20with\x20Amount;\x20if\x20the\x20pool\x20remainder\x20settles\x20in\x20one\x20entry,\x20declare\x20it\x20explicitly\x20as\x20the\x20SINGLE\x20terminal\x20Surplus\x20at\x20the\x20settlement\x20node,\x20or\x20disable\x20Surplus\x20outright.'});const e=a['guards']['map'](h=>[h['key'],h['template_id'],h['purpose']]['filter'](Boolean)['join']('\x20'))['join']('\x20\x0a\x20'),f=c+'\x20\x0a\x20'+e,g=/per[- ](month|period|term|session|cycle|segment)|one per (rent )?period|release-sequence lock/i['test'](f)||/(?:month|period|term|week|session)_\d+_(?:release|unlock|guard)|release_\d+/i['test'](e);return!g&&d['push']({'rule_id':'R-PER-02','severity':'high','title':'Multi-period\x20pool\x20('+b+'\x20periods)\x20declares\x20no\x20per-period\x20release\x20Guard','detail':'the\x20on-chain\x20alloc\x20entry\x20has\x20no\x20consumed/nonce\x20flag:\x20two\x20releases\x20bound\x20to\x20the\x20SAME\x20Guard\x20can\x20both\x20fire\x20the\x20same\x20day\x20and\x20drain\x20the\x20pool.\x20The\x20cadence\x20gate\x20must\x20be\x20one\x20Guard\x20per\x20period.','suggestion':'Declare\x20one\x20release\x20Guard\x20per\x20period\x20(per-month/per-term\x20time-lock\x20Guards,\x20each\x20keyed\x20to\x20its\x20own\x20period\x20window)\x20in\x20the\x20guard\x20set.'}),!/threshold[^.\n]*(one|single|per[- ]|month|period|term|session|=\s*0\b|\b0\b|must be 0)/i['test'](c)&&d['push']({'rule_id':'R-PER-03','severity':'medium','title':'Multi-period\x20pool\x20('+b+'\x20periods)\x20does\x20not\x20pin\x20threshold\x20to\x20one\x20period','detail':'the\x20on-chain\x20alloc\x20asserts\x20balance\x20>=\x20threshold\x20before\x20EVERY\x20release.\x20A\x20threshold\x20sized\x20to\x20the\x20total\x20pool\x20passes\x20the\x20first\x20release\x20and\x20then\x20locks\x20all\x20remaining\x20periods.','suggestion':'State\x20in\x20the\x20allocator\x20description\x20or\x20build\x20notes\x20that\x20threshold\x20=\x20one\x20period\x27s\x20release\x20amount\x20(never\x20the\x20pre-funded\x20total).'}),d;}const MIN_PRICE_KEY_REGEX=/^(?:min_[a-z0-9_]*?(?:price|amount|usd|value)|price_floor)$/,FLOOR_TEXT_REGEX=/fixed (?:fee|charge)[^.\n]*(?:<|less than|below) [^.\n]*(?:lowest|minimum|min)|minimum (?:sku|order|item|unit) (?:price|amount)|(?:below|under|<=)\s*the\s+smallest[^.\n]*(?:order|escrow|booking|price)/i,FIXED_FEE_TEXT_REGEX=/\bamount mode\b|fixed (?:fee|fulfillment|fulfilment|per[- ]order) (?:fee|charge)|\bAmount\b[^.\n]*(?:fee|charge)/i;function fundAnchorChecks(a){const b=[],c=[a['allocator']['description'],...a['build_notes'],...a['trust_mechanisms'],...a['guards']['map'](h=>h['template_id']+'\x20'+h['purpose'])]['join']('\x20\x0a\x20'),d=a['allocator']['refund_track']==='order_anchored'||/allocator_order_anchor/['test'](c)||/guardidentifier\(0\)|order[- ]anchored|for_object/i['test'](c);!d&&b['push']({'rule_id':'R-ANCHOR-01','severity':'critical','title':'Allocator\x20has\x20no\x20order\x20anchor\x20—\x20its\x20Guard\x20cannot\x20bind\x20the\x20paying\x20Order','detail':'Every\x20recipient\x20of\x20this\x20allocator\x20is\x20a\x20fixed\x20party\x20(recipient=\x27'+a['allocator']['recipient']+'\x27,\x20no\x20GuardIdentifier\x20row),\x20so\x20nothing\x20in\x20the\x20Guard\x27s\x20verification\x20context\x20names\x20the\x20Order\x20being\x20settled:\x20Recipient::Entity/Signer\x20are\x20resolved\x20without\x20any\x20submission\x20check\x20(on-chain\x20allocation)\x20and\x20the\x20Allocation\x20itself\x20never\x20enters\x20the\x20Guard\x20context.\x20Testnet\x20proved\x20the\x20consequence:\x20a\x20passport\x20built\x20from\x20an\x20ALREADY-SETTLED\x20order\x20of\x20the\x20same\x20Service\x20drained\x20a\x20different\x20order\x27s\x20escrow\x20(CR-01).\x20The\x20identifier-255\x20once-slot\x20does\x20not\x20help\x20—\x20it\x20is\x20stored\x20per\x20Allocation,\x20so\x20a\x20fresh\x20pool\x20has\x20no\x20record.','suggestion':'Adopt\x20pattern.allocator_order_anchor:\x20add\x20one\x20{GuardIdentifier:\x200}\x20row\x20with\x20Rate\x200\x20(pays\x20nothing,\x20makes\x20the\x20submitted\x20Order\x20the\x20Guard\x27s\x20binding\x20target),\x20declare\x20refund_track:\x20\x22order_anchored\x22,\x20and\x20pin\x20the\x20Guard\x20expression\x20to\x20that\x20identifier\x20plus\x20logic_equal[order.service,\x20<this\x20service>].'});const e=a['allocator']['mode']==='amount',f=e||FIXED_FEE_TEXT_REGEX['test'](c),g=Object['keys'](a['fee_params'])['some'](h=>MIN_PRICE_KEY_REGEX['test'](h))||FLOOR_TEXT_REGEX['test'](c);f&&!g&&b['push']({'rule_id':'R-FIXFEE-01','severity':e?'critical':'high','title':'Fixed\x20Amount\x20fee\x20with\x20no\x20minimum\x20order\x20value\x20—\x20sub-fee\x20orders\x20deadlock\x20permanently','detail':'the\x20on-chain\x20allocation\x20asserts\x20balance\x20>=\x20fix\x20before\x20distributing:\x20an\x20order\x20escrowed\x20BELOW\x20the\x20fixed\x20fee\x20can\x20never\x20settle,\x20and\x20the\x20terminal\x20nodes\x20(completed/closed_cancel)\x20leave\x20no\x20refund\x20path\x20for\x20it,\x20so\x20buyer\x20funds\x20and\x20the\x20order\x20strand\x20forever\x20(testnet\x20CR-02,\x20reproduced\x20on\x20a\x200.001\x20WOW\x20SKU\x20against\x20a\x200.15\x20WOW\x20fee).','suggestion':'Declare\x20a\x20minimum\x20listing/order\x20value\x20above\x20every\x20fixed\x20leg\x20in\x20fee_params\x20(e.g.\x20min_sku_price)\x20and\x20state\x20it\x20in\x20the\x20allocator\x20description,\x20or\x20model\x20the\x20per-order\x20fee\x20as\x20Rate/RateGross\x20instead\x20of\x20a\x20fixed\x20Amount.'});a['allocator']['once_per_order']===!![]&&!/per[- ]allocation|per[- ]pool|not cross[- ]order|within (a|the) (pool|allocation)/i['test'](c)&&b['push']({'rule_id':'R-ONCE-SCOPE-01','severity':'medium','title':'once_per_order\x20claim\x20does\x20not\x20state\x20its\x20per-Allocation\x20scope','detail':'The\x20identifier-255\x20once-slot\x20is\x20keyed\x20(guard,\x20allocator,\x20submission)\x20ON\x20ONE\x20Allocation,\x20so\x20replay\x20immunity\x20holds\x20within\x20a\x20single\x20pool\x20only;\x20a\x20second\x20Allocation\x20of\x20the\x20same\x20Service\x20starts\x20with\x20no\x20record.\x20Presenting\x20ONCE\x20as\x20general\x20idempotency\x20is\x20what\x20let\x20testnet\x20CR-01\x20read\x20as\x20\x27already\x20protected\x27.','suggestion':'Say\x20explicitly\x20that\x20255\x20protects\x20one\x20pool,\x20and\x20pair\x20it\x20with\x20the\x20order\x20anchor\x20(R-ANCHOR-01)\x20for\x20cross-order\x20safety.'});if(a['allocator']['once_per_order']===!![]){const h=new Set((a['allocator']['rows']??[])['map'](n=>n['guard_key'])['filter'](n=>typeof n==='string'&&n['length']>0x0)),j=h['size']>0x0?a['guards']['filter'](n=>n['key']!=null&&h['has'](n['key'])):a['guards'],k=j['map'](n=>n['key']??n['template_id']),l=j['some'](n=>{if(!n['template_id']['startsWith']('tpl_'))return![];const o=GUARD_TEMPLATES['find'](p=>p['id']===n['template_id']);return Array['isArray'](o?.['example_table'])&&o['example_table']['some'](p=>p?.['identifier']===TASK_BINDING_SLOT||p?.['identifier']===ONCE_SLOT_BYTES);}),m=/\bidentifier[- ]?25[45]\b/['test'](c)||/\b25[45]\b[^.\n]{0,80}\bb_submission\b/i['test'](c)||/ONCE-FOR-OBJECT/['test'](c);!l&&!m&&b['push']({'rule_id':'R-ONCE-ARM','severity':'critical','title':'once-slot\x20NOT\x20armed\x20—\x20once_per_order\x20is\x20claimed\x20but\x20no\x20254/255\x20submission\x20slot\x20is\x20declared\x20anywhere','detail':'once_per_order\x20has\x20NO\x20automatic\x20on-chain\x20wiring:\x20the\x20chain\x20only\x20sees\x20a\x20replay\x20defense\x20if\x20the\x20BUILT\x20Guard\x20table\x20declares\x20the\x20ONCE\x20submission\x20slot\x20(identifier\x20254\x20ONCE-FOR-OBJECT\x20for\x20settlement/claim\x20rails,\x20255\x20byte-keyed\x20for\x20per-period\x20repeats)\x20and\x20the\x20trigger\x20passport\x20submits\x20it.\x20This\x20template\x20sets\x20once_per_order=true,\x20yet\x20neither\x20a\x20tpl_*\x20guard\x20table\x20nor\x20the\x20build\x20notes\x20declare\x20the\x20slot\x20for\x20any\x20allocator-bound\x20guard\x20—\x20the\x20advertised\x20replay\x20protection\x20does\x20not\x20exist\x20on-chain.','suggestion':'Arm\x20the\x20SETTLEMENT\x20allocator-bound\x20guard\x20row(s)\x20['+(k['join'](',\x20')||'<none\x20—\x20template\x20declares\x20no\x20guards>')+']:\x20add\x20the\x20arming\x20build_note\x20\x27Generation\x20must\x20add\x20a\x20submission\x20entry\x20{identifier:254,\x20b_submission:true,\x20value_type:\x22Address\x22,\x20object_type:\x22Order\x22}\x20to\x20each\x20SETTLEMENT\x20allocator\x20Guard\x20(never\x20a\x20refund\x20rail\x20—\x20a\x20refund\x20pays\x20the\x20Order\x20through\x20user\x20slot\x200\x20and\x20a\x20later\x20re-entry\x20would\x20abort\x2016,\x20OFN\x20#P-04)\x20and\x20submit\x20identifier\x20254\x20in\x20the\x20trigger\x20Passport\x27\x20(255\x20with\x20a\x20per-period\x20key\x20instead,\x20for\x20rails\x20that\x20legitimately\x20repeat),\x20or\x20reference\x20a\x20tpl_*\x20guard\x20whose\x20example_table\x20already\x20declares\x20the\x20slot\x20—\x20or\x20set\x20once_per_order=false\x20if\x20replay\x20protection\x20is\x20not\x20intended.'});}return b;}function templateText(a,b=[]){return[a['allocator']['description'],...a['build_notes'],...a['trust_mechanisms'],...a['guards']['map'](c=>c['template_id']+'\x20'+c['purpose']),...a['machine_shape']['map'](c=>c['name']+'\x20'+c['role']),...Object['entries'](a['time_anchors']??{})['map'](([c,d])=>c+'\x20'+d),...b]['join']('\x20\x0a\x20');}const BUY_GATE_CLAIM_REGEX=/\b(buy[\s-]?gate|purchase[\s-]?gate|age[\s-]?verification|age[\s-]?gate|adult[\s-]?verification|kyc[\s-]?gate|identity[\s-]?gate)\b/i;function buyKeyDeclarationChecks(a){const b=[];if(a['guards']['some'](c=>c['host']==='service'&&c['key']==='buy'))return b;return BUY_GATE_CLAIM_REGEX['test'](templateText(a))&&b['push']({'rule_id':'R-BUYKEY-01','severity':'critical','title':'A\x20purchase/buy\x20gate\x20is\x20declared\x20but\x20no\x20service\x20guard\x20carries\x20key\x20\x22buy\x22\x20—\x20the\x20gate\x20never\x20mounts','detail':'The\x20template\x20prose\x20declares\x20a\x20buy/purchase\x20gate\x20(age\x20verification,\x20KYC,\x20identity\x20gate\x20or\x20similar),\x20but\x20the\x20compiler\x20mounts\x20the\x20Service\x20buy\x20guard\x20ONLY\x20from\x20a\x20guard\x20spec\x20with\x20host=\x27service\x27\x20AND\x20key=\x27buy\x27.\x20No\x20such\x20spec\x20exists,\x20so\x20the\x20service\x20would\x20publish\x20with\x20NO\x20purchase\x20gate\x20while\x20trust_mechanisms\x20still\x20claim\x20one.','suggestion':'Add\x20key:\x20\x22buy\x22\x20to\x20the\x20service-host\x20guard\x20spec\x20that\x20implements\x20the\x20gate\x20(host\x20stays\x20\x27service\x27),\x20or\x20drop\x20the\x20gate\x20claim\x20from\x20the\x20prose\x20if\x20no\x20gate\x20is\x20intended.'}),b;}const CLAIM_BEARING_ARB_RE=/^tpl_forward_arb_ruling_(won|dismissed)$/,NO_CLAIMED_BY_OCCURRENCE_RE=/no\s+claimed_by[\s-]+leg/gi,DENIAL_RAIL_SCOPING_RE=/node[\s-]?gated|decision\s*11|caller-authorization|caller[\s-]?auth/i,RULING_SURFACE_RE=/ruling|award|arb[_ -]?(refund|won|dismissed)/i;function rulingEdgeDenial(a){NO_CLAIMED_BY_OCCURRENCE_RE['lastIndex']=0x0;let b;while((b=NO_CLAIMED_BY_OCCURRENCE_RE['exec'](a))!==null){const c=a['slice'](Math['max'](0x0,b['index']-0x3c),b['index']);if(DENIAL_RAIL_SCOPING_RE['test'](c))continue;const d=a['slice'](Math['max'](0x0,b['index']-0x50),b['index']+b[0x0]['length']+0x50);if(RULING_SURFACE_RE['test'](d))return!![];}return![];}const TWO_TRACK_DISCLOSURE_RE=/two[\s-]rail independence|independent\s+(channel|channels|rail|rails|track|tracks|fund|commercial)|sequencing seal|\u6392\u5e8f\u5c01\u5370|dual[\s-]?payout|\u53cc\u62ff|acknowledge_dual_payout|\u4e24\u6761\u72ec\u7acb|\u72ec\u7acb\u8d44\u91d1|independent commerce|claim aborts|code 27|keeper conclude/i;function docExpressionDriftChecks(a){const b=[],c=a['guards']['some'](h=>CLAIM_BEARING_ARB_RE['test'](h['template_id'])),d=templateText(a);c&&rulingEdgeDenial(d)&&b['push']({'rule_id':'R-DOC-EXPR-DRIFT','severity':'high','title':'Prose\x20denies\x20a\x20claimed_by\x20leg\x20ON\x20THE\x20RULING\x20EDGE\x20while\x20the\x20mounted\x20arb-ruling\x20guard\x20ships\x20one\x20(ddmq\x20F-22\x20drift\x20family,\x20PG-DOC-TRUTH)','detail':'This\x20template\x20mounts\x20tpl_forward_arb_ruling_won/_dismissed,\x20whose\x20award\x20edge\x20carries\x20the\x204R-03b\x20'+'claimed_by\x20SEQUENCING\x20SEAL\x20(the\x20edge\x20advances\x20only\x20after\x20the\x20award\x20claim\x20or\x20a\x20keeper\x20conclude).\x20'+'Yet\x20the\x20prose\x20ties\x20a\x20\x27no\x20claimed_by\x20leg\x27\x20denial\x20to\x20the\x20ruling/award\x20surface\x20itself.\x20A\x20user,\x20merchant,\x20'+'or\x20arbitrator\x20reading\x20that\x20prose\x20would\x20mispredict\x20the\x20ruling-edge\x20behaviour\x20—\x20exactly\x20the\x20'+'transparency\x20failure\x20the\x20two-independent-fund-chains\x20doctrine\x20forbids\x20(ddmq\x20F-22\x20mainnet).','suggestion':'Scope\x20the\x20prose\x20honestly\x20per\x20the\x20doctrine:\x20the\x20ORDER-MONEY\x20(escrow)\x20rail\x20is\x20node-gated\x20and\x20never\x20'+'reads\x20claimed_by\x20(decision\x2011\x20—\x20two\x20independent\x20fund\x20chains);\x20the\x20ARBITRATION\x20award\x20is\x20a\x20separate\x20'+'commercial\x20track\x20whose\x20claim\x20stamps\x20claimed_by\x20(a\x20sequencing\x20seal,\x20not\x20a\x20funding\x20gate\x20—\x20an\x20empty\x20'+'compensation\x20pool\x20aborts\x20the\x20claim\x20with\x20code\x2027,\x20and\x20a\x20keeper\x20CONCLUDE\x20stamps\x20it\x20without\x20any\x20fund).\x20'+'Rail-scoped\x20denials\x20are\x20doctrine-true;\x20ruling-edge-scoped\x20denials\x20are\x20the\x20lie.'});c&&!TWO_TRACK_DISCLOSURE_RE['test'](d)&&b['push']({'rule_id':'R-DOC-EXPR-DRIFT','severity':'medium','title':'Build\x20mounts\x20an\x20arb-ruling\x20edge\x20but\x20its\x20prose\x20never\x20teaches\x20the\x20two-independent-fund-chains\x20fact\x20(transparency\x20floor,\x20PG-DOC-TRUTH)','detail':'The\x20mounted\x20ruling\x20edge\x20moves\x20award\x20money\x20on\x20the\x20ARBITRATION\x20fund\x20chain\x20(the\x20service\x20compensation\x20'+'pool)\x20while\x20the\x20escrow\x20moves\x20order\x20money\x20—\x20two\x20independent\x20chains\x20ordered\x20by\x20business\x20rules,\x20not\x20'+'chain-enforced\x20netting.\x20The\x20doctrine\x20requires\x20FULL\x20transparency\x20to\x20buyer,\x20merchant,\x20and\x20arbitrator;\x20'+'this\x20template\x27s\x20prose\x20surfaces\x20never\x20state\x20the\x20two-track\x20fact,\x20the\x20sequencing\x20seal,\x20or\x20the\x20'+'dual-payout\x20confirmation\x20—\x20a\x20reader\x20cannot\x20predict\x20that\x20a\x20buyer\x20may\x20collect\x20both\x20the\x20award\x20and\x20an\x20'+'escrow\x20refund,\x20or\x20that\x20the\x20award\x20claim\x20aborts\x20(code\x2027)\x20on\x20an\x20unfunded\x20pool.','suggestion':'Add\x20a\x20TWO\x20INDEPENDENT\x20FUND\x20CHAINS\x20disclosure\x20sentence\x20to\x20allocator\x20description\x20or\x20build_notes:\x20\x27the\x20'+'arbitration\x20award\x20pays\x20from\x20the\x20compensation\x20fund\x20as\x20an\x20INDEPENDENT\x20commercial\x20track\x20—\x20it\x20never\x20'+'moves\x20the\x20order\x20escrow;\x20a\x20buyer\x20may\x20collect\x20BOTH\x20the\x20award\x20and\x20an\x20escrow\x20refund\x20(the\x20dual-payout\x20'+'confirmation\x20gate\x20governs\x20that\x20combination);\x20the\x20ruling\x20edge\x20advances\x20only\x20after\x20the\x20award\x20claim\x20'+'(aborts\x20code\x2027\x20if\x20the\x20pool\x20is\x20empty)\x20or\x20a\x20keeper\x20conclude.\x27'});const e=/\barb_dismissed_resume\b|dismissed[\s-]+(resume|twin|branch|forward)|tpl_forward_arb_ruling_dismissed/i,f=/machine[ -]no-?op|ordinary settle|settle_window_gate|edge addition at plan time|no dismissed (?:edge|branch|forward)|assembles? no tpl_forward_arb_ruling_dismissed/i,g=a['guards']['some'](h=>h['template_id']==='tpl_forward_arb_ruling_dismissed');return!g&&e['test'](templateText(a))&&!f['test'](templateText(a))&&b['push']({'rule_id':'R-DOC-EXPR-DRIFT','severity':'high','title':'Prose\x20promises\x20a\x20dismissed/resume\x20arbitration\x20branch\x20the\x20build\x20never\x20assembles\x20(ddmq\x20F-24\x20drift\x20family,\x20PG-DOC-TRUTH)','detail':'The\x20prose\x20names\x20a\x20dismissed-ruling\x20branch\x20(arb_dismissed_resume\x20or\x20the\x20tpl_forward_arb_ruling_dismissed\x20'+'twin),\x20but\x20no\x20guard\x20spec\x20in\x20this\x20template\x20mounts\x20that\x20template\x20—\x20a\x20merchant\x20reading\x20the\x20prose\x20expects\x20a\x20'+'dismissed-ruling\x20re-route\x20that\x20does\x20not\x20exist\x20on\x20chain.','suggestion':'Either\x20mount\x20tpl_forward_arb_ruling_dismissed\x20on\x20the\x20sanctioned\x20exit,\x20or\x20reword\x20the\x20prose\x20to\x20the\x20real\x20'+'shape\x20(F-54\x20cure):\x20a\x20dismissed/zero\x20award\x20is\x20a\x20machine\x20no-op\x20—\x20the\x20order\x20rests\x20where\x20it\x20was\x20and\x20the\x20'+'merchant-favour\x20outcome\x20rides\x20the\x20ordinary\x20settle\x20edge;\x20a\x20machine-recorded\x20dismissal\x20is\x20an\x20edge\x20'+'addition\x20at\x20plan\x20time.'}),b;}const STAY_DATE_REGEX=/check[\s-]?in|check[\s-]?out|departure\s+date|arrival\s+date|booking\s+date|checkin|checkout|stay\s+date|stay_nights|\bstay\s+nights?\b|\bper\s+night\b/i,CHAIN_CLOCK_REGEX=/order\.time|progress\.current_time|\border\s+time\b|witness/i,REPOSITORY_DATE_SOURCE_REGEX=/(?:write|writes|written|storing|store|stores|persist|persisted|record|records|read|reads)\b[^.\n]{0,90}repositor|repositor\w*\b[^.\n]{0,90}(?:stay|check[\s-]?in|check[\s-]?out|departure|arrival|date)/i;function timeWindowAnchorChecks(a){const b=templateText(a);if(!STAY_DATE_REGEX['test'](b))return[];if(CHAIN_CLOCK_REGEX['test'](b)||REPOSITORY_DATE_SOURCE_REGEX['test'](b))return[];const c=b['match'](new RegExp(STAY_DATE_REGEX['source'],'gi'))??[],d=/\d+\s*[-–]\s*\d+\s*h(?:ours?|rs?)?\s*(?:adjustable|tunable|configurable)|\badjustable\b|\btunable\b/i['test'](b);return[{'rule_id':'R-WIN-ANCHOR-01','severity':'high','title':'Per-order\x20time\x20window(s)\x20anchored\x20to\x20a\x20stay\x20date\x20that\x20does\x20not\x20exist\x20on\x20chain\x20('+Array['from'](new Set(c))['slice'](0x0,0x5)['join'](',\x20')+')','detail':'The\x20template\x27s\x20windows\x20are\x20relative\x20to\x20a\x20check-in\x20/\x20check-out\x20/\x20departure\x20/\x20night\x20date.\x20No\x20such\x20field\x20exists\x20on\x20chain:\x20'+'The\x20order\x20items\x20vector\x20is\x20`vector<SaleItem>`\x20with\x20`SaleItem\x20{\x20item,\x20price,\x20quantity,\x20wip_hash\x20}`\x20and\x20the\x20purchasable\x20'+'`Sale\x20{\x20name,\x20price,\x20stock,\x20suspension,\x20wip,\x20wip_hash\x20}`\x20carries\x20no\x20schedule;\x20the\x20only\x20per-order\x20clock\x20is\x20'+'`Order.time`,\x20the\x20CREATION\x20timestamp.\x20`Progress.current_time`\x20is\x20overwritten\x20on\x20every\x20forward\x20'+'and\x20`Progress.history`\x20records\x20node\x20visits,\x20so\x20neither\x20is\x20a\x20business\x20date.\x20A\x20window\x20declared\x20relative\x20to\x20the\x20'+'stay\x20calendar\x20is\x20therefore\x20UNREACHABLE\x20—\x20every\x20published\x20Guard\x20silently\x20measures\x20from\x20booking\x20time\x20instead,\x20and\x20for\x20a\x20lead\x20time\x20of\x20'+'days-to-weeks\x20that\x20is\x20a\x20material\x20semantic\x20loss,\x20not\x20a\x20rounding\x20error.'+(d?'\x20The\x20window\x20is\x20also\x20advertised\x20as\x20adjustable,\x20which\x20is\x20doubly\x20unreachable:\x20a\x20Guard\x20is\x20frozen\x20at\x20creation\x20'+'(transfer::freeze_object)\x20and\x20Machine\x20forwards\x20are\x20immutable\x20after\x20publish\x20(the\x20not-published\x20guard),\x20so\x20an\x20\x27N-Mh\x20adjustable\x27\x20window\x20means\x20one\x20separately\x20published\x20Guard\x20per\x20window\x20value,\x20never\x20a\x20tunable\x20one.':''),'suggestion':'Express\x20every\x20window\x20relative\x20to\x20`order.time`\x20(or\x20`order.time\x20+\x20<window>`),\x20and\x20if\x20the\x20business\x20promise\x20is\x20genuinely\x20a\x20stay-date\x20'+'deadline,\x20write\x20the\x20stay\x20dates\x20into\x20a\x20Repository\x20at\x20buy\x20time,\x20pin\x20that\x20Repository\x20address\x20as\x20a\x20table\x20constant,\x20and\x20read\x20them\x20in\x20the\x20'+'Guard\x20(`query\x20repository.data`).\x20State\x20the\x20residual\x20semantic\x20loss\x20in\x20build_notes\x20rather\x20than\x20declaring\x20a\x20calendar-relative\x20window.'}];}function signerRefundChecks(a){const b=[],c=a['allocator']['rows']??[],d=c['find'](k=>k['recipient']==='signer'&&k['track']==='refund'),e=templateText(a),f=/Recipient::Signer[^;]{0,200}(?:tx_context::sender|tx[_ ]sender|signer-binding|pins? that claim|identity-bound)/i['test'](e),g=a['allocator']['recipient']==='signer'&&!f;if(!d&&!g)return b;const h=/refund|chargeback|repay|(?:pay(?:ment|out)?|release|send|transfer|settle)\w*[^.\n]{0,40}to the (?:buyer|order|customer)/i['test'](e);if(!h)return b;const j=d?'allocator\x20row\x20'+d['track']+'/'+(d['recipient_key']??'?'):'allocator.recipient=\x27signer\x27';return b['push']({'rule_id':'R-SIGNER-02','severity':'high','title':'Refund\x20leg\x20pays\x20Recipient::Signer\x20—\x20the\x20keeper,\x20not\x20the\x20buyer\x20('+j+')','detail':'`Recipient::Signer`\x20resolves\x20to\x20`tx_context::sender(ctx)`,\x20i.e.\x20whoever\x20signed\x20the\x20transaction\x20that\x20triggered\x20'+'`alloc`.\x20Time-driven\x20refunds\x20are\x20keeper-triggered\x20by\x20construction,\x20so\x20this\x20leg\x20pays\x20the\x20KEEPER,\x20and\x20because\x20the\x20allocation\x20records\x20no\x20'+'consumed\x20flag\x20for\x20the\x20recipient,\x20first-come-first-served.\x20Only\x20`Recipient::GuardIdentifier`\x20(resolved\x20through\x20the\x20Guard\x20submission)\x20or\x20an\x20explicit\x20`Entity`\x20is\x20safe\x20for\x20a\x20refund.','suggestion':'Replace\x20the\x20Signer\x20refund\x20row\x20with\x20a\x20`{GuardIdentifier:\x200}`\x20row\x20(the\x20submission\x20for\x20a\x20Service-created\x20Allocation\x20is\x20pinned\x20to\x20the\x20paying\x20'+'Order,\x20so\x20only\x20`order.owner`\x20can\x20receive\x20it)\x20and\x20bind\x20the\x20Guard\x20to\x20`order.owner`\x20+\x20`progress.current\x20==\x20<refund\x20node>`.'}),b;}function orderAnchorDeclarationChecks(a){const b=templateText(a),c=a['allocator']['refund_track']==='order_anchored'||/order[\s-]anchored|order anchor|refund recipient is the order|anchor row|guardidentifier\s*\(\s*0\s*\)|for_object/i['test'](b);if(!c)return[];const d=(a['allocator']['rows']??[])['some'](g=>g['recipient']==='guard_identifier'||g['recipient']==='guard_identifier_to_order'),e=a['guards']['some'](h=>h['template_id']==='pattern.allocator_order_anchor');if(d||e)return[];const f=a['allocator']['recipient']??'?';return[{'rule_id':'R-RECIPIENT-02','severity':'high','title':'Order-anchored\x20refund\x20recipient\x20is\x20asserted\x20in\x20prose\x20but\x20declared\x20nowhere\x20machine-checkable','detail':'The\x20template\x20claims\x20an\x20order-anchored\x20escrow\x20/\x20refund\x20recipient\x20while\x20its\x20machine-readable\x20allocator\x20says\x20recipient=\x27'+f+'\x27\x20'+'with\x20no\x20`guard_identifier`\x20row\x20and\x20no\x20`pattern.allocator_order_anchor`\x20Guard\x20reference.\x20Two\x20on-chain\x20facts\x20make\x20the\x20claim\x20as\x20written\x20'+'unbuildable:\x20(1)\x20`Recipient`\x20has\x20only\x20`GuardIdentifier(u8)`\x20/\x20`Entity(address)`\x20/\x20`Signer`\x20—\x20there\x20is\x20NO\x20'+'`Order`\x20variant,\x20so\x20\x27the\x20refund\x20recipient\x20is\x20the\x20order\x20object\x27\x20can\x20only\x20be\x20written\x20as\x20a\x20`GuardIdentifier`\x20row;\x20(2)\x20recipients\x20that\x20are\x20'+'all\x20fixed\x20`Entity`\x20rows\x20resolve\x20without\x20the\x20passport\x20submission\x20and\x20the\x20Allocation\x20never\x20enters\x20the\x20Guard\x20'+'context,\x20so\x20the\x20Guard\x20has\x20no\x20order\x20to\x20bind\x20at\x20all\x20—\x20the\x20CR-01\x20drain\x20shape.\x20A\x20build\x20agent\x20reading\x20the\x20prose\x20instead\x20of\x20the\x20schema\x20will\x20'+'emit\x20an\x20Entity\x20refund\x20leg\x20to\x20the\x20merchant,\x20or\x20a\x20Signer\x20leg\x20to\x20the\x20keeper.','suggestion':'Declare\x20the\x20anchor\x20machine-checkably:\x20one\x20`{\x20recipient:\x20\x27guard_identifier\x27,\x20recipient_key:\x20\x270\x27,\x20mode:\x20\x27rate\x27,\x20value:\x200\x20}`\x20row\x20(the\x20'+'pattern.allocator_order_anchor\x20convention)\x20plus\x20`refund_track:\x20\x27order_anchored\x27`,\x20and\x20reference\x20`pattern.allocator_order_anchor`\x20in\x20the\x20'+'guard\x20set\x20with\x20the\x20`logic_equal[order.service,\x20<this\x20service>]`\x20binding\x20stated\x20in\x20its\x20purpose.'}];}const EDGE_DEPENDENCY_REGEX=/\b(?:incoming|outgoing|arb_refund)\s+edge\b|\bstop[\s-]node\b|\bedges?\b|\bpairs?\b|\bforwards?\b|one pair|two pairs/i;function topologyChecks(a){const b=[],c=templateText(a);if(a['machine_shape']['some'](j=>(j['from']??[])['length']>0x0))return b;EDGE_DEPENDENCY_REGEX['test'](c)&&b['push']({'rule_id':'R-TOPO-01','severity':'high','title':'machine_shape\x20ships\x20nodes\x20only\x20—\x20no\x20Pair/forward\x20list,\x20so\x20stop-node\x20fund-exit\x20coverage\x20is\x20unauditable','detail':'This\x20template\x27s\x20correctness\x20depends\x20on\x20Machine\x20edges\x20(its\x20own\x20notes\x20reason\x20about\x20incoming/outgoing\x20edges,\x20pairs\x20and\x20stop-node\x20'+'fund-exit\x20coverage),\x20but\x20`machine_shape`\x20carries\x20NO\x20edges:\x20an\x20edge\x20on\x20chain\x20is\x20`Node[target].pairs\x20=\x20{\x20prev_node,\x20threshold,\x20'+'forwards[]\x20}`,\x20which\x20this\x20schema\x20cannot\x20express.\x20The\x20scanner\x20therefore\x20has\x20to\x20invent\x20a\x20linear\x20chain,\x20and\x20the\x20mandatory\x20'+'stop-node\x20walk\x20(R-M5-03\x20/\x20R-M5-09:\x20every\x20rest\x20state\x20needs\x20a\x20defined\x20withdrawal\x20AND\x20refund\x20rule,\x20satisfiable\x20in\x20both\x20directions)\x20'+'cannot\x20be\x20performed\x20—\x20an\x20uncovered\x20stop\x20node\x20strands\x20escrow\x20permanently\x20once\x20Machine\x20+\x20Allocator\x20are\x20frozen\x20at\x20publish.','suggestion':'Either\x20state\x20the\x20edges\x20explicitly\x20in\x20build_notes\x20as\x20`prev\x20─forward(op,w)→\x20next`\x20with\x20the\x20Pair\x20grouping,\x20or\x20declare\x20a\x20machine-readable\x20'+'edge\x20list\x20so\x20the\x20scanner\x20can\x20audit\x20stop-node\x20coverage\x20and\x20prev_node\x20uniqueness\x20instead\x20of\x20guessing.'});const d=a['machine_shape']['map'](j=>j['name']);if(d['length']===0x0)return b;const e=d['filter'](j=>BRANCH_STATE_REGEX['test'](j));if(e['length']===0x0)return b;const f=d[0x0],g=!BRANCH_STATE_REGEX['test'](d[0x1]),h=(g?0x1:0x0)+e['length'];if(h<=0x1)return b;return b['push']({'rule_id':'R-TOPO-02','severity':'medium','title':'Node\x20\x27'+f+'\x27\x20has\x20'+h+'\x20outgoing\x20rails\x20—\x20declare\x20the\x20Pair\x20grouping\x20(E_DUPLICATE_NODE_PREV\x20is\x20per\x20TARGET\x20node,\x20not\x20per\x20source)','detail':'From\x20\x27'+f+'\x27\x20the\x20declared\x20node\x20set\x20requires\x20'+h+'\x20distinct\x20rails\x20'+('('+(g?'the\x20linear\x20rail\x20to\x20\x27'+d[0x1]+'\x27,\x20':''))+(e['map'](j=>'the\x20branch\x20to\x20\x27'+j+'\x27')['join'](',\x20')+').\x20These\x20are\x20LEGAL\x20and\x20must\x20NOT\x20be\x20merged:\x20an\x20edge\x20A→B\x20is\x20')+'stored\x20in\x20`Node[B].pairs\x20=\x20{\x20prev_node:\x20A,\x20threshold,\x20forwards[]\x20}`,\x20and\x20the\x20chain\x20rejects\x20only\x20the\x20SAME\x20`prev_node`\x20appearing\x20'+'twice\x20inside\x20ONE\x20node\x27s\x20pairs\x20(`assert!(!vector::contains(&res,\x20&pair.prev_node),\x20E_DUPLICATE_NODE_PREV)`,\x20on\x20chain).\x20Rails\x20into\x20different\x20targets\x20occupy\x20different\x20nodes,\x20so\x20each\x20`prev_node`\x20still\x20appears\x20exactly\x20once\x20per\x20node.\x20'+'THE\x20HAZARD\x20IS\x20THE\x20MIRROR\x20IMAGE:\x20two\x20forwards\x20from\x20the\x20SAME\x20source\x20into\x20the\x20SAME\x20target\x20must\x20be\x20ONE\x20Pair\x20carrying\x20both\x20forwards\x20—\x20'+'a\x20builder\x20that\x20emits\x20one\x20Pair\x20per\x20forward\x20duplicates\x20`prev_node`\x20and\x20ABORTS\x20at\x20publish,\x20after\x20Machine\x20+\x20Guard\x20are\x20frozen.\x20Note\x20'+'also\x20that\x20one\x20forward\x20cannot\x20satisfy\x20two\x20operators:\x20each\x20forward\x20contributes\x20its\x20weight\x20at\x20most\x20once\x20(locked\x20by\x20its\x20first\x20operator),\x20'+'so\x20a\x20dual-confirmation\x20step\x20needs\x20`threshold\x20=\x202`\x20with\x20two\x20DISTINCT\x20forwards.\x20A\x20node\x20list\x20cannot\x20distinguish\x20'+'these\x20cases,\x20which\x20is\x20why\x20this\x20is\x20advisory\x20and\x20not\x20a\x20proven\x20defect.','suggestion':'Do\x20NOT\x20merge\x20the\x20rails.\x20Instead\x20declare\x20the\x20grouping\x20explicitly\x20in\x20build_notes\x20as\x20'+'`prev\x20─forward(op,w)→\x20next`,\x20marking\x20which\x20forwards\x20SHARE\x20one\x20target\x20and\x20therefore\x20belong\x20in\x20ONE\x20Pair,\x20and\x20state\x20each\x20Pair\x27s\x20'+'`threshold`\x20(2\x20with\x20two\x20distinct\x20forwards\x20when\x20two\x20different\x20operators\x20must\x20act).\x20This\x20also\x20lets\x20the\x20scanner\x20audit\x20prev_node\x20'+'uniqueness\x20instead\x20of\x20guessing.\x20Related:\x20R-TOPO-01\x20(high)\x20is\x20the\x20finding\x20that\x20records\x20that\x20edges\x20are\x20unauditable\x20at\x20all.'}),b;}function reachabilityChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0)return[];if(!b['some'](w=>(w['from']??[])['length']>0x0))return[];const c=new Map(),d=[],f=new Map();for(const w of b){const x=w['segment'];if(x&&typeof x['id']==='string')f['set'](x['id'],w['name']);}const g=y=>{if(typeof y!=='string')return y;const z=y['match'](/^\{(.+)\.(?:last|all)\}$/);return z&&f['has'](z[0x1])?f['get'](z[0x1]):y;};for(const y of b){for(const z of y['from']??[]){const A=g(typeof z==='string'?z:z?.['prev']);if(A==='')d['push'](y['name']);else{if(!c['has'](A))c['set'](A,[]);c['get'](A)['push'](y['name']);}}}const h=[];if(d['length']===0x0)h['push']('no\x20entry\x20edge\x20(prev:\x20\x22\x22)\x20—\x20the\x20Machine\x20has\x20no\x20starting\x20Pair\x20and\x20orders\x20can\x20never\x20begin');else d['length']>0x1&&h['push'](d['length']+'\x20entry\x20edges\x20(prev:\x20\x22\x22)\x20into\x20'+d['map'](B=>'\x27'+B+'\x27')['join'](',\x20')+'\x20—\x20'+'exactly\x20one\x20starting\x20Pair\x20is\x20expressible\x20on\x20chain\x20(the\x20first\x20pair\x20with\x20prev_node\x20\x22\x22)');const j=new Set(d),k=[...d];while(k['length']>0x0){const B=k['pop']();for(const C of c['get'](B)??[]){!j['has'](C)&&(j['add'](C),k['push'](C));}}const l=b['filter'](D=>!j['has'](D['name']))['map'](D=>'\x27'+D['name']+'\x27');l['length']>0x0&&h['push']('unreachable\x20from\x20the\x20entry\x20(declared\x20but\x20dead):\x20'+l['join'](',\x20'));const n=D=>D['semantic_role']==='final'||D['semantic_role']==='cancelled',o=new Map();for(const [D,E]of c){for(const F of E){if(!o['has'](F))o['set'](F,[]);o['get'](F)['push'](D);}}const p=new Set(),q=b['filter'](n)['map'](G=>G['name']);q['forEach'](G=>p['add'](G));while(q['length']>0x0){const G=q['pop']();for(const H of o['get'](G)??[]){!p['has'](H)&&(p['add'](H),q['push'](H));}}const s=b['filter'](I=>!n(I)&&!p['has'](I['name'])&&(c['get'](I['name'])??[])['length']>0x0)['map'](I=>{const J='exits\x20lead\x20only\x20to\x20'+[...new Set(c['get'](I['name'])??[])]['map'](K=>'\x27'+K+'\x27')['join'](',\x20')+',\x20none\x20of\x20which\x20reaches\x20a\x20settlement\x20or\x20refund\x20endpoint';return'\x27'+I['name']+'\x27\x20('+(I['semantic_role']??'no\x20semantic_role')+')\x20—\x20'+J;});s['length']>0x0&&h['push']('no\x20path\x20to\x20a\x20terminal\x20(final/cancelled):\x20'+s['join'](';\x20'));if(h['length']===0x0)return[];return[{'rule_id':'R-TOPO-03','severity':'high','title':'Machine\x20edge\x20graph\x20breaks\x20reachability\x20—\x20declared\x20semantics\x20can\x20never\x20execute\x20or\x20never\x20end','detail':'Auditing\x20the\x20structured\x20from-edges:\x20'+h['join'](';\x20')+'.\x20Every\x20declared\x20node\x20must\x20be\x20'+'reachable\x20from\x20the\x20single\x20entry\x20Pair,\x20and\x20every\x20non-terminal\x20node\x20must\x20reach\x20a\x20final/cancelled\x20'+'endpoint\x20—\x20buy\x20escrows\x20ATOMICALLY,\x20so\x20a\x20node\x20from\x20which\x20the\x20world\x20cannot\x20end\x20strands\x20the\x20pool.\x20'+'Machine\x20topology\x20is\x20frozen\x20at\x20publish\x20(IMMUT-001),\x20so\x20these\x20defects\x20are\x20unfixable\x20after\x20the\x20fact;\x20'+'the\x20only\x20remedy\x20is\x20correcting\x20the\x20template\x20BEFORE\x20the\x20Machine\x20is\x20built.\x20Zero-exit\x20leaves\x20are\x20'+'reported\x20by\x20R-DEAD-END\x20(an\x20`optional:\x20true`\x20mark\x20does\x20not\x20rescue\x20them);\x20this\x20finding\x20covers\x20nodes\x20'+'WITH\x20exits\x20whose\x20exits\x20never\x20reach\x20an\x20endpoint.','suggestion':'Fix\x20the\x20edge\x20data:\x20give\x20every\x20non-entry\x20node\x20a\x20from-edge\x20chain\x20back\x20to\x20the\x20entry,\x20give\x20every\x20mandatory\x20'+'state\x20at\x20least\x20one\x20forward\x20path\x20into\x20a\x20final/cancelled\x20endpoint,\x20and\x20mark\x20genuinely\x20skippable\x20side\x20'+'actions\x20`optional:\x20true`\x20(which\x20exempts\x20them\x20from\x20THIS\x20audit\x27s\x20mandatory-flow\x20reading\x20only\x20—\x20a\x20'+'zero-exit\x20optional\x20leaf\x20is\x20still\x20an\x20R-DEAD-END\x20lockup).\x20One\x20entry\x20edge\x20(prev:\x20\x22\x22)\x20only\x20—\x20the\x20'+'on-chain\x20Machine\x20has\x20exactly\x20one\x20starting\x20Pair.'}];}function rewardReachabilityChecks(a){const b=a['experience_compensation_mode']==='reward'||(a['guards']??[])['some'](o=>o['host']==='reward');if(!b)return[];const c=a['machine_shape']??[];if(c['length']===0x0)return[];if(!c['some'](o=>(o['from']??[])['length']>0x0))return[];const d=new Map(),f=[];for(const o of c){for(const p of o['from']??[]){const q=typeof p==='string'?p:p?.['prev'];if(q==='')f['push'](o['name']);else{const s=resolveSegmentToken(a,q);if(!d['has'](s))d['set'](s,[]);d['get'](s)['push'](o['name']);}}}const g=new Set(f),h=[...f];while(h['length']>0x0){const w=h['pop']();for(const x of d['get'](w)??[]){!g['has'](x)&&(g['add'](x),h['push'](x));}}const j=/deliver|complet|receiv|fulfil|finish|compensat|graduat|certif/i,k=c['some'](y=>j['test'](y['name'])&&g['has'](y['name'])),l=[];!k&&l['push']({'rule_id':'R-UNREACHABLE-REWARD','severity':'high','title':'Reward\x20pool\x20emitted\x20with\x20no\x20reachable\x20claim\x20state\x20—\x20funds\x20stuck\x20at\x20birth\x20(F-049)','detail':'The\x20template\x20emits\x20a\x20goodwill\x20Reward\x20(experience_compensation_mode=\x22reward\x22\x20or\x20a\x20reward-host\x20'+'guard)\x20but\x20the\x20machine\x20edge\x20graph\x20offers\x20NO\x20reachable\x20claim-face\x20node\x20(delivery/fulfilment\x20'+'completion\x20or\x20a\x20compensat-class\x20marker)\x20—\x20the\x20pre-funded\x20pool\x20can\x20never\x20be\x20drawn\x20by\x20any\x20order\x20'+'(mtw-mainnet\x20F-049:\x20the\x20money\x20went\x20in,\x20no\x20edge\x20could\x20trigger\x20it\x20out).\x20Machine\x20topology\x20freezes\x20'+'at\x20publish\x20(IMMUT-001),\x20so\x20the\x20pool\x20would\x20strand\x20permanently.','suggestion':'Add\x20a\x20claim-face\x20state\x20to\x20the\x20graph\x20that\x20an\x20order\x20can\x20actually\x20reach\x20(e.g.\x20a\x20compensat-class\x20'+'marker\x20fed\x20by\x20an\x20evidence-gated\x20edge\x20—\x20tpl_forward_late_delivery_gate),\x20or\x20set\x20'+'experience_compensation_mode\x20to\x20\x22none\x22\x20and\x20drop\x20the\x20pool.'});const n=c['some'](y=>{if(!/compensat/i['test'](y['name'])||!g['has'](y['name']))return![];return(y['from']??[])['some'](z=>typeof z!=='string'&&!!z?.['guard_key']);});return k&&!n&&l['push']({'rule_id':'R-UNREACHABLE-REWARD','severity':'medium','title':'Reward\x20claim\x20anchors\x20on\x20bare\x20fulfillment\x20states\x20—\x20no\x20on-chain\x20lateness\x20evidence\x20(disclosure)','detail':'The\x20goodwill\x20pool\x20is\x20claimable\x20from\x20delivery/completion\x20states\x20only;\x20nothing\x20in\x20the\x20machine\x20'+'records\x20WHY\x20an\x20order\x20deserved\x20compensation,\x20so\x20the\x20payout\x20is\x20a\x20trust-based\x20gesture\x20rather\x20'+'than\x20an\x20evidence-gated\x20claim.\x20Disclosed,\x20not\x20blocked\x20—\x20the\x20C-11\x20delivered-anchored\x20claim\x20is\x20a\x20'+'sanctioned\x20design\x20(F-049\x27s\x20cure\x20in\x20the\x20delivery\x20archetype\x20was\x20the\x20compensated\x20marker\x20fed\x20by\x20'+'tpl_forward_late_delivery_gate).','suggestion':'Optionally\x20add\x20a\x20compensat-class\x20marker\x20whose\x20incoming\x20edge\x20carries\x20a\x20late-evidence\x20guard\x20'+'(tpl_forward_late_delivery_gate:\x20delivered-minus-picked_up\x20history\x20delta\x20>=\x20the\x20promised\x20'+'window)\x20so\x20the\x20claim\x20state\x20itself\x20is\x20the\x20on-chain\x20proof.'}),l;}function loyaltyClaimNoLegChecks(a){const b=new RegExp(['\x5cb(?:repeat(?:ed)?|returning)\x5cs+(?:customers?|buyers?|purchas\x5cw+|orders?)\x5cb[^.]{0,60}?\x5cb(?:get|gets|receive|receives|enjoy|enjoys|unlock|unlocks|pay|pays|qualify|qualifies|skip|skips|save|saves)\x5cb','\x5cb(?:discount|deal|price|pricing|rate|rebate)\x5cb[^.]{0,40}?\x5cbfor\x5cb\x5cs+(?:repeat(?:ed)?|returning)\x5cb','\x5cb(?:repeat|returning)[-\x5cs]?(?:customer|buyer)s?\x5cs+(?:discount|price|pricing|rate)\x5cb','\x5cbloyalty\x5cs+(?:discount|price|pricing|rate|tier|eligib\x5cw*)\x5cb']['join']('|'),'i'),c=[a['body']??'',...a['build_notes']??[],...a['trust_mechanisms']??[],...a['differences']??[],a['key_risk']??'']['join']('\x0a');if(!b['test'](c))return[];const d=a['fee_params']['loyalty_min_orders'],e=typeof d==='number'?d>=0x1:typeof d==='string'&&Number(d['replace'](/^[^0-9]*/,''))>=0x1;if(e)return[];return[{'rule_id':'R-LOYALTY-CLAIM-NO-LEG','severity':'medium','title':'History-gated\x20benefit\x20promised\x20with\x20no\x20cross-order\x20leg\x20—\x20disclosure-only\x20claim\x20(U-19a/N-12)','detail':'The\x20prose\x20promises\x20a\x20repeat-customer\x20/\x20history-gated\x20benefit\x20(returning-buyer\x20pricing,\x20membership-level\x20'+'access)\x20but\x20no\x20`loyalty_min_orders`\x20fee_param\x20is\x20armed\x20—\x20the\x20chain\x20cannot\x20enforce\x20the\x20claim,\x20so\x20it\x20is\x20'+'disclosure-only.\x20The\x20expressible\x20form\x20exists:\x20query\x202251\x20(entity_order.entity\x20count,\x20genesis\x20singleton\x20'+'@0xaa8)\x20counts\x20a\x20buyer\x20address\x27s\x20PARTICIPATED\x20orders\x20across\x20all\x20roles\x20and\x20statuses\x20—\x20'+'\x27>=\x20N\x20orders\x20participated\x27,\x20never\x20\x27>=\x20N\x20completed\x27.','suggestion':'Arm\x20the\x20knob:\x20set\x20fee_param\x20loyalty_min_orders\x20to\x20the\x20minimum\x20order\x20count\x20(>=\x201).\x20The\x20compiler\x20mounts\x20'+'the\x202251\x20gate\x20on\x20the\x20buy\x20face\x20automatically\x20(emitLoyaltyGate)\x20and\x20emits\x20the\x20participation-scope\x20'+'disclosure.\x20Keep\x20the\x20prose\x20scope-matched:\x20say\x20\x27orders\x20placed\x27,\x20not\x20\x27orders\x20completed\x27.'}];}function slaPromiseNoLegChecks(a){const b=new RegExp(['\x5cb(?:late|lateness|delay(?:ed|s)?|on[-\x20]time|ontime|punctual\x5cw*|ship[-\x20]by|SLA)\x5cb[^.!?]{0,80}?\x5cb(?:penalt\x5cw+|compensat\x5cw+|refund\x5cw*|reimburse\x5cw+|money[-\x20]back|guarantee\x5cw*)\x5cb','\x5cb(?:penalt\x5cw+|compensat\x5cw+|refund\x5cw*|reimburse\x5cw+|money[-\x20]back|guarantee\x5cw*)\x5cb[^.!?]{0,80}?\x5cb(?:late|lateness|delay(?:ed|s)?|on[-\x20]time|ontime|punctual\x5cw*|ship[-\x20]by|SLA)\x5cb']['join']('|'),'i'),c=/\b(?:off[- ]?chain|disclos\w+|never|no|not|cannot|can'?t|won'?t|isn'?t|aren'?t|without|voluntar\w+|unenforce\w+|advisory|safe harbor|stall(?:ed|s|ing)?|strand\w*|beyond the (?:chain|machine|protocol)|outside the (?:chain|machine))\b/i,d=[a['body']??'',...a['build_notes']??[],...a['trust_mechanisms']??[],...a['differences']??[],a['key_risk']??'']['join']('\x0a')['split'](/(?<=[.!?])\s+/),e=d['find'](h=>b['test'](h)&&!c['test'](h));if(e===undefined)return[];const f=a['fee_params']??{},g=f['sla_compensation_mode']==='proactive_payment'||f['sla_compensation_mode']==='ladder'||Object['keys'](f)['some'](h=>/^cancel_tier_\d+_boundary_hours$/['test'](h))||JSON['stringify'](a['conditional_guards']??[])['includes']('tpl_forward_penalty_payment');if(g)return[];return[{'rule_id':'R-SLA-PROMISE-NO-LEG','severity':'high','title':'Lateness\x20remedy\x20promised\x20with\x20no\x20compensation\x20leg\x20—\x20false-commitment\x20risk\x20(U-01/N-01)','detail':'The\x20prose\x20promises\x20a\x20lateness\x20remedy\x20(\x22'+e['trim']()['slice'](0x0,0x78)+'\x22)\x20but\x20no\x20expressible\x20compensation\x20face\x20is\x20armed\x20—\x20the\x20chain\x20has\x20NO\x20auto-debit\x20primitive\x20'+'(U-01:\x20no\x20function\x20moves\x20another\x20party\x27s\x20Balance),\x20so\x20the\x20promise\x20is\x20a\x20false\x20commitment,\x20not\x20a\x20'+'disclosure.\x20The\x20closest\x20wrong\x20way\x20is\x20exactly\x20this\x20wording:\x20an\x20\x22automatic\x20late\x20fine\x22\x20reads\x20as\x20an\x20automatic\x20'+'fine\x20the\x20chain\x20cannot\x20execute.\x20(U-01\x20chain\x20truth:\x20the\x20only\x20money\x20primitives\x20are\x20voluntary\x20'+'Payments\x20a\x20payer\x20signs\x20—\x20no\x20function\x20moves\x20another\x20party\x27s\x20Balance.)','suggestion':'Arm\x20the\x20face:\x20fee_param\x20sla_compensation_mode\x20=\x20\x22proactive_payment\x22\x20with\x20sla_penalty_amount\x20/\x20'+'sla_deadline_hours\x20/\x20sla_marker_version\x20—\x20the\x20compiler\x20splices\x20the\x20breach->compensated\x20rail\x20'+'(tpl_forward_penalty_payment:\x20order-bound\x20payment\x20proof,\x20255\x20once-slot,\x20settle-after-compensation\x20'+'second\x20inbound\x20edge).\x20For\x20tiered\x20ladders\x20arm\x20the\x20D5\x20cancel_tier_N_*\x20knobs.\x20Keep\x20the\x20prose\x20honest:\x20'+'say\x20\x22late\x20=>\x20we\x20compensate,\x20or\x20settlement\x20stays\x20parked\x22,\x20never\x20\x22automatic\x20fine\x22.'}];}function keeperDutyUnkeyedChecks(a){const b=a['keeper_duty']??[];if(b['length']===0x0)return[];const c=b['filter'](e=>e['duty_kind']!==undefined&&e['detector']!==undefined&&e['anchor']!==undefined&&e['window_param']!==undefined),d=b['length']-c['length'];if(d===0x0)return[];return[{'rule_id':'R-KEEPER-DUTY-UNKEYED','severity':'medium','title':d+'\x20of\x20'+b['length']+'\x20keeper\x20duties\x20are\x20prose-only\x20—\x20scheduleable\x20keying\x20missing\x20(N-05)','detail':d+'\x20keeper_duty\x20row(s)\x20carry\x20no\x20machine\x20keys\x20(duty_kind\x20/\x20detector\x20/\x20anchor\x20/\x20window_param).\x20They\x20render\x20as\x20'+'runbook\x20lines\x20but\x20cannot\x20be\x20scheduled:\x20the\x20chain\x20has\x20no\x20time-triggered\x20execution,\x20and\x20an\x20unkeyed\x20duty\x20is\x20a\x20'+'manual\x20obligation\x20invisible\x20to\x20the\x20keeper\x20detectors.\x20Migration\x20gauge:\x20this\x20template\x27s\x20keyed\x20share\x20is\x20'+(c['length']+'/'+b['length']+'.'),'suggestion':'Add\x20the\x20four\x20machine\x20keys\x20to\x20each\x20duty\x20row:\x20duty_kind\x20(semantic\x20id),\x20detector\x20(payment_unclaimed\x20/\x20'+'progress_actionable\x20/\x20settlement_pending\x20/\x20timeout_intermediate),\x20anchor\x20(the\x20machine\x20node\x20the\x20duty\x20'+'watches),\x20window_param\x20(the\x20fee_params\x20key\x20carrying\x20the\x20window).\x20Compile\x20then\x20emits\x20the\x20row\x20into\x20the\x20'+'plan\x27s\x20keeper_duties\x20receipt\x20and\x20the\x20keeper\x20schedules\x20it.\x20Auto-execution\x20NEVER\x20widens\x20by\x20keying\x20—\x20'+'payment_unclaimed\x20stays\x20the\x20only\x20auto-executable\x20detector.'}];}const SHAPE_COUNT_NODE_FAMILIES=[{'key':'session_count','prefix':'session_','label':'session'},{'key':'term_count','prefix':'semester_','label':'semester'},{'key':'segment_count','prefix':'segment_','label':'segment'}];function resolveSegmentToken(a,b){const c=/^\{([a-z0-9_]+)\.(?:all|last|first|\d+)\}$/['exec'](b);if(!c)return b;const d=(a['machine_shape']??[])['find'](e=>e['segment']?.['id']===c[0x1]);return d?d['name']:b;}function shapeKeyCountChecks(a){const b=a['fee_params']??{},c=a['machine_shape'],d=Array['isArray'](c)?c:c?.['nodes']??[],e=[],f=new Set(d['map'](g=>g['segment'])['filter'](g=>typeof g?.['count_from']==='string')['map'](g=>g['count_from']));for(const g of d){const h=g['segment'];if(h===undefined)continue;const j=g['name'],k=typeof j!=='string'||!j['includes']('{i}'),l=typeof h['count_from']!=='string'||typeof b[h['count_from']]!=='number';if(!k&&!l)continue;e['push']({'rule_id':'R-SEGMENT-PROTOTYPE-INVALID','severity':'critical','title':'segment\x20prototype\x20\x27'+String(h['id']??j)+'\x27\x20cannot\x20be\x20expanded\x20('+(k?'name\x20lacks\x20{i}':'count_from\x20\x27'+String(h['count_from'])+'\x27\x20is\x20not\x20a\x20numeric\x20fee_param')+')','detail':'A\x20machine_shape\x20node\x20with\x20a\x20segment\x20declaration\x20is\x20a\x20BUILD-TIME\x20prototype:\x20the\x20kernel\x27s\x20segment\x20expander\x20replaces\x20it\x20with\x20'+'effective(count_from)\x20concrete\x20instances\x20at\x20compile.\x20The\x20prototype\x20name\x20must\x20contain\x20\x22{i}\x22\x20and\x20count_from\x20must\x20name\x20a\x20'+'numeric\x20fee_param,\x20otherwise\x20compile\x20is\x20BLOCKED\x20(SEGMENT_DECLARATION_INVALID)\x20and\x20no\x20order\x20can\x20advance\x20past\x20it.','suggestion':'Rename\x20the\x20prototype\x20to\x20\x22<prefix>_{i}\x22\x20and\x20point\x20count_from\x20at\x20the\x20declared\x20GENERATION_SHAPE_KEY\x20(session_count\x20/\x20term_count\x20/\x20segment_count).'});}for(const m of SHAPE_COUNT_NODE_FAMILIES){const o=b[m['key']];if(typeof o!=='number')continue;if(f['has'](m['key']))continue;const p=d['filter'](q=>typeof q['name']==='string'&&new RegExp('^'+m['prefix']+'[\x5cw-]+$')['test'](q['name']))['length'];if(p===o)continue;e['push']({'rule_id':'R-SHAPE-COUNT-MISMATCH','severity':'critical','title':m['key']+'\x20declares\x20'+o+'\x20but\x20machine_shape\x20authors\x20'+p+'\x20'+m['label']+'\x20node(s)\x20—\x20first\x20deploy\x20would\x20deliver\x20'+p+'\x20(K3\x20R19)','detail':'The\x20\x22'+m['key']+':\x20'+o+'\x22\x20fee_param\x20is\x20a\x20GENERATION_SHAPE_KEY\x20(authoring-time\x20fact\x20—\x20compile\x20never\x20'+('re-reads\x20it\x20to\x20grow\x20the\x20machine),\x20while\x20machine_shape\x20carries\x20exactly\x20'+p+'\x20node(s)\x20matching\x20')+('\x22'+m['prefix']+'<n>\x22.\x20Every\x20deployment\x20of\x20this\x20template\x20as\x20written\x20would\x20sell\x20'+o+'\x20'+m['label']+'s\x20')+('and\x20deliver\x20'+p+':\x20release\x20rails,\x20refund\x20segments\x20and\x20numeric\x20floor\x20derivations\x20that\x20multiply\x20by\x20')+(m['key']+'\x20all\x20inherit\x20the\x20divergence\x20(live\x20yfd-mn-26108-k7m2:\x20session_count\x2020\x20over\x203\x20nodes,\x20buyer\x20')+'paid\x204\x20sessions,\x20machine\x20could\x20only\x20advance\x203).\x20Shape\x20keys\x20are\x20not\x20live\x20dials\x20—\x20post-publish\x20cure\x20is\x20'+'impossible\x20(Machine\x20nodes\x20immutable,\x20Allocation\x20rows\x20snapshot\x20at\x20buy).','suggestion':'Make\x20the\x20declaration\x20true:\x20either\x20(a)\x20set\x20the\x20fee_param\x20to\x20the\x20authored\x20node\x20count\x20and\x20re-derive\x20every\x20'+'expression\x20that\x20multiplies\x20by\x20it\x20(floors,\x20pools,\x20refund\x20segments),\x20or\x20(b)\x20author\x20the\x20missing\x20'+(m['prefix']+'<n>\x20nodes\x20with\x20their\x20release\x20rails/guards\x20so\x20machine_shape\x20really\x20carries\x20'+o+'.\x20')+'A\x20build-time\x20expander\x20may\x20replace\x20(b)\x20later\x20—\x20this\x20rule\x20then\x20proves\x20its\x20expansion.'});}return e;}function thirdPartyNoRemedyChecks(a){if(a['logistics_mode']!=='courier')return[];const b=a['allocator']?.['rows']??[],c=b['some'](e=>(e['recipient']==='entity'||e['recipient']==='signer')&&e['recipient_key']!==undefined&&e['recipient_key']!=='merchant'),d=b['some'](e=>e['track']==='reward')||Object['keys'](a['fee_params']??{})['some'](e=>/reward/['test'](e));if(c||d)return[];return[{'rule_id':'R-THIRD-PARTY-NO-REMEDY','severity':'critical','title':'Courier\x20fulfilment\x20with\x20no\x20third-party\x20payout\x20rail\x20—\x20a\x20ruling\x20for\x20the\x20runner\x20is\x20unexecutable\x20(U-03/N-03)','detail':'This\x20template\x20models\x20third-party\x20fulfilment\x20(logistics_mode\x20courier)\x20but\x20its\x20allocator\x20carries\x20no\x20'+'non-merchant\x20Entity/Signer\x20leg\x20(platform\x20/\x20third_party\x20named\x20rail)\x20and\x20no\x20Reward\x20pool.\x20'+'the\x20compensation\x20rail\x20pays\x20order.owner\x20ONLY\x20(hard-bound\x20to\x20the\x20order\x20owner)\x20and\x20Allocation\x20rows\x20are\x20'+'append-only\x20after\x20publish\x20—\x20once\x20published,\x20NO\x20on-chain\x20path\x20can\x20pay\x20the\x20fulfilment\x20party,\x20ever.','suggestion':'Pre-set\x20one\x20of\x20two\x20rails\x20before\x20publish:\x20(a)\x20an\x20arbitration-triggered\x20sharing\x20leg\x20with\x20a\x20'+'Recipient::Entity/Signer\x20row\x20named\x20for\x20the\x20fulfilment\x20party\x20(platform\x20/\x20third_party\x20key\x20—\x20those\x20legs\x20'+'are\x20not\x20payment_info.for_object-constrained\x20and\x20can\x20pay\x20a\x20non-owner);\x20or\x20(b)\x20a\x20Reward\x20pool\x20the\x20runner\x20'+'claims\x20directly\x20(claim\x20asserts\x20recipient\x20==\x20tx\x20sender\x20—\x20the\x20only\x20permissionless\x20third-party\x20channel),\x20'+'pinned\x20store_from\x20so\x20one\x20fulfilment\x20pays\x20once.\x20Note:\x20the\x20merchant\x27s\x20OWN\x20Entity\x20leg\x20does\x20not\x20count\x20—\x20'+'it\x20cannot\x20carry\x20the\x20runner\x27s\x20money.'}];}function ladderMonotonicChecks(a){const b=a['fee_params']??{},c=Object['keys'](b)['filter'](l=>/^cancel_tier_\d+_boundary_hours$/['test'](l))['sort']((k,l)=>k['localeCompare'](l));if(c['length']<0x2)return[];const d=[],e=k=>typeof k==='number'?k:undefined,f=c['map'](l=>({'key':l,'tier':Number(l['match'](/\d+/)[0x0]),'v':e(b[l])}));if(f['some'](k=>k['v']===undefined))d['push'](highFinding(a,'R-LADDER-MONOTONIC-01','ladder\x20boundary\x20knob\x20is\x20not\x20a\x20number',c['join'](',')));else for(let k=0x1;k<f['length'];k++){f[k]['v']>=f[k-0x1]['v']&&d['push'](highFinding(a,'R-LADDER-MONOTONIC-01','ladder\x20boundaries\x20not\x20strictly\x20decreasing',f[k]['key']+'\x20('+f[k]['v']+')\x20must\x20be\x20<\x20'+f[k-0x1]['key']+'\x20('+f[k-0x1]['v']+')\x20—\x20tier\x20'+f[k]['tier']+'\x20fires\x20closer\x20to\x20the\x20start\x20than\x20tier\x20'+f[k-0x1]['tier']+',\x20an\x20inverted\x20or\x20flat\x20pair\x20double-charges\x20the\x20overlap'));}const g=Object['keys'](b)['filter'](l=>/^cancel_tier_\d+_charge_bps$/['test'](l))['sort']((l,m)=>l['localeCompare'](m));if(g['length']>=0x2){const l=g['map'](m=>({'key':m,'v':e(b[m])}));if(l['some'](m=>m['v']===undefined))d['push'](highFinding(a,'R-LADDER-MONOTONIC-01','ladder\x20charge\x20knob\x20is\x20not\x20a\x20number',g['join'](',')));else for(let m=0x1;m<l['length'];m++){l[m]['v']<=l[m-0x1]['v']&&d['push'](highFinding(a,'R-LADDER-MONOTONIC-01','ladder\x20charges\x20not\x20strictly\x20increasing',l[m]['key']+'\x20('+l[m]['v']+')\x20must\x20be\x20>\x20'+l[m-0x1]['key']+'\x20('+l[m-0x1]['v']+')\x20—\x20later\x20cancellation\x20must\x20cost\x20more,\x20an\x20inverted\x20charge\x20makes\x20the\x20cheapest\x20band\x20the\x20priciest'));}}const h=(a['allocator']?.['rows']??[])['filter'](n=>typeof n['guard_key']==='string'&&/^cancel_tier_\d+_alloc$/['test'](n['guard_key'])),j=new Map();for(const n of h)j['set'](n['guard_key'],[...j['get'](n['guard_key'])??[],n]);for(const [o,p]of[...j['entries']()]['sort']()){let q=0x0;for(const s of p){if(typeof s['value']==='number')q+=s['value'];else{if(typeof s['value_from']==='string')q+=e(b[s['value_from']])??NaN;else{if(typeof s['value_from_complement']==='string'){const w=e(b[s['value_from_complement']]);q+=w===undefined?NaN:0x2710-w;}else q=NaN;}}}(Number['isNaN'](q)||q!==0x2710)&&d['push'](highFinding(a,'R-LADDER-MONOTONIC-01','tier\x20allocator\x20group\x20does\x20not\x20close\x20at\x2010000',o+':\x20legs\x20sum\x20to\x20'+q+'\x20(literal\x20rates,\x20value_from\x20defaults,\x20and\x20value_from_complement\x20=\x2010000-x)\x20—\x20a\x20stranded\x20remainder\x20or\x20an\x20over-draw'));}return d;}function highFinding(a,b,c,d){return void a,{'rule_id':b,'severity':'high','title':c,'detail':d,'suggestion':'fix\x20the\x20template\x27s\x20ladder\x20defaults\x20—\x20the\x20rails\x20compile\x20either\x20way,\x20so\x20a\x20mis-formed\x20ladder\x20only\x20shows\x20up\x20as\x20mis-charged\x20orders'};}function pairNoSharedRepoChecks(a){if(a['logistics_mode']!=='courier'&&a['logistics_mode']!=='carrier')return[];const b=a['guards']??[],c=b['some'](d=>d['template_id']==='tpl_repository_row_equals_order_field'||/fulfilment order|rendezvous|supply.chain|paired/['test'](d['purpose']??''))||/supply.chain|rendezvous|fulfilment order|procured (courier|delivery|fulfilment)|paired ledger/i['test']([a['body']??'',...a['build_notes']??[],...a['trust_mechanisms']??[],...a['differences']??[],a['key_risk']??'']['join']('\x0a'));if(c)return[];return[{'rule_id':'R-PAIR-NO-SHARED-REPO','severity':'medium','title':'Merchant-procured\x20fulfilment\x20with\x20no\x20cross-order\x20pairing\x20leg\x20—\x20the\x20sub-order\x20link\x20is\x20disclosure-only\x20(N-06)','detail':'logistics_mode\x20\x27'+String(a['logistics_mode'])+'\x27\x20declares\x20the\x20merchant_procured\x20axis\x20(a\x20third\x20party\x20fulfils,\x20P1..P5\x20expected),\x20but\x20no\x20guard\x20reads\x20a\x20'+'foreign\x20fulfilment\x20order\x20and\x20no\x20supply-chain\x20pairing\x20is\x20declared:\x20nothing\x20on\x20chain\x20ties\x20the\x20sub-order\x20'+'to\x20this\x20one,\x20so\x20the\x20composition\x20claim\x20(courier/carrier\x20fulfilment\x20the\x20main\x20order\x27s\x20settlement\x20depends\x20'+'on)\x20cannot\x20be\x20verified\x20by\x20a\x20third\x20party\x20—\x20the\x20fulfilment\x20story\x20settles\x20on\x20prose\x20alone.','suggestion':'Declare\x20the\x20supply-chain\x20promise\x20at\x20build\x20time\x20(P1\x20shared-Repository\x20rendezvous:\x20the\x20ledger\x20is\x20created\x20'+'once,\x20injected\x20into\x20both\x20Services,\x20policies\x20write_once\x20so\x20neither\x20side\x20can\x20re-point\x20the\x20fact\x20—\x20the\x20'+'emitter\x20also\x20arms\x20the\x20N-10\x20removal\x20pins),\x20or\x20disclose\x20that\x20fulfilment\x20is\x20an\x20off-chain\x20arrangement\x20'+'with\x20no\x20on-chain\x20pairing\x20fact.'}];}function demandNoAwardFactChecks(a){const b=/\b(?:winn\w*|award\w*|selected|won)\b[^.]{0,60}?\b(?:start\w*|begin\w*|commenc\w*|kick[\s-]?off|open\w*\s+the\s+order)\b|\b(?:start\w*|begin\w*|commenc\w*)\b[^.]{0,60}?\b(?:award\w*|winn\w+|winner)\b/i,c=[a['body']??'',...a['build_notes']??[],...a['trust_mechanisms']??[],...a['differences']??[],a['key_risk']??'']['join']('\x0a');if(!b['test'](c))return[];const d=(a['guards']??[])['some'](e=>e['template_id']==='tpl_demand_award_gate')||/demand_award|award row|award fact|repository\.data has/['test'](c);if(d)return[];return[{'rule_id':'R-DEMAND-NO-AWARD-FACT','severity':'medium','title':'Award-gated\x20start\x20promised\x20with\x20no\x20award\x20fact\x20in\x20the\x20machine\x20graph\x20—\x20disclosure-only\x20claim\x20(U-11/U-13/N-07)','detail':'The\x20prose\x20promises\x20that\x20the\x20award\x20selection\x20gates\x20starting\x20the\x20resulting\x20order,\x20but\x20no\x20award\x20fact\x20'+'reaches\x20the\x20machine\x20graph:\x20Demand.present\x20only\x20registers\x20a\x20table\x20entry\x20and\x20nothing\x20'+'on\x20chain\x20links\x20the\x20award\x20to\x20the\x20order\x20(composition-truth\x20S8)\x20—\x20the\x20claim\x20is\x20disclosure-only\x20and\x20any\x20'+'presenter\x20can\x20self-start\x20the\x20order.','suggestion':'Bind\x20the\x20award\x20fact:\x20mount\x20tpl_demand_award_gate\x20on\x20the\x20machine\x27s\x20first\x20forward\x20(query\x201166\x20'+'repository.data\x20has\x20over\x20a\x20write-guarded,\x20write_once\x20award\x20policy\x20—\x20the\x20demander\x27s\x20tooling\x20files\x20a\x20'+'row\x20whose\x20ID\x20is\x20the\x20winner\x27s\x20address),\x20and\x20disclose\x20that\x20the\x20Demand->Order\x20linkage\x20is\x20tooling-side\x20'+'(never\x20describe\x20the\x20award\x20as\x20an\x20on-chain\x20contract\x20formation\x20—\x20S8\x20disclosureObligation).'}];}function loopFundChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0||!b['some'](s=>(s['from']??[])['length']>0x0))return[];const c=new Map();for(const s of b){for(const w of s['from']??[]){const x=typeof w==='string'?w:w?.['prev'];if(typeof x!=='string'||x==='')continue;if(!c['has'](x))c['set'](x,[]);c['get'](x)['push'](s['name']);}}const d=findLoopCycles(c);if(d['length']===0x0)return[];const f=[],g=a['reentry_kind']&&a['reentry_kind']!=='none'?a['reentry_kind']:undefined,h=d['filter'](y=>classifyLoopCycle(y['cycle'],g)==='remedy');h['length']>0x0&&f['push']({'rule_id':'R-LOOP-FUND','severity':'low','title':'Remedy\x20loop\x20cycle(s)\x20'+h['map'](y=>'['+y['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+'\x20—\x20same-order\x20revisit,\x20no\x20new\x20charge\x20implied','detail':'A\x20revision/review/rework/refund/cancel/claim-family\x20cycle\x20re-enters\x20work\x20states\x20WITHIN\x20one\x20paid\x20order,\x20so\x20it\x20needs\x20'+'no\x20fund\x20gate\x20while\x20the\x20revisit\x20is\x20free\x20(crs\x20P2-3\x20visibility).\x20If\x20the\x20business\x20EVER\x20intends\x20a\x20revisit\x20'+'to\x20cost\x20money,\x20that\x20fee\x20IS\x20enforceable\x20via\x20the\x20allocation.balance\x20Guard\x20query\x20(1051,\x20witness\x20'+'OrderAllocation\x20109)\x20—\x20but\x20that\x20reshapes\x20the\x20cycle\x20into\x20the\x20charge\x20tier\x20below.','suggestion':'Keep\x20remedy\x20loops\x20single-charge\x20(one\x20paid\x20order,\x20revisions\x20included)\x20—\x20or,\x20if\x20each\x20revisit\x20'+'must\x20be\x20paid,\x20declare\x20the\x20guard-layer\x20fund\x20gate\x20convention\x20(see\x20the\x20charge\x20tier)\x20or\x20replace\x20the\x20loop\x20'+'with\x20per-period\x20NEW\x20Orders\x20(REUSE\x20pattern\x20—\x20a\x20fresh\x20order\x20per\x20period\x20instead\x20of\x20an\x20in-order\x20loop\x20that\x20replays\x20its\x20forwards\x20every\x20lap).'});const j=templateText(a),k=/order_renew/i['test'](j)&&/atomic|re-fund/i['test'](j),l=d['filter'](y=>classifyLoopCycle(y['cycle'],g)==='renewal'),n=k?[]:l,o=d['filter'](y=>classifyLoopCycle(y['cycle'],g)==='charge'),p=[...o,...n];if(p['length']===0x0)return f;const q=o['length']===0x0?'the\x20atomic\x20order_renew\x20funding\x20convention\x20is\x20not\x20declared\x20in\x20the\x20template\x20prose':n['length']===0x0?'a\x20cycle\x20implies\x20a\x20per-revisit\x20charge\x20(retake\x20/\x20session-card\x20shape)\x20whose\x20fund\x20gate\x20is\x20not\x20declared\x20in\x20the\x20template\x20prose':'a\x20cycle\x20implies\x20a\x20per-revisit\x20charge\x20with\x20no\x20declared\x20fund\x20gate,\x20AND\x20the\x20renewal-shaped\x20cycles\x20lack\x20the\x20declared\x20order_renew\x20convention';return f['push']({'rule_id':'R-LOOP-FUND','severity':'critical','title':'Loop\x20cycle(s)\x20'+p['map'](y=>'['+y['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+'\x20—\x20revisit\x20funding\x20is\x20not\x20declared\x20at\x20the\x20template\x20layer','detail':'A\x20cycle\x20lets\x20an\x20order\x20revisit\x20nodes,\x20and\x20the\x20contract\x20never\x20verifies\x20that\x20a\x20revisit\x20re-funds\x20the\x20'+'Allocation\x20—\x20every\x20charge-bearing\x20loop\x20forward\x20MUST\x20carry\x20the\x20new-period\x20payment\x20atomically\x20or\x20the\x20loop\x20allows\x20'+'zero-value\x20re-delivery\x20cycles\x20(test/11\x20R2-F3,\x20crs\x20P2-3).\x20The\x20allocation.balance\x20Guard\x20query\x20(1051,\x20witness\x20'+'OrderAllocation\x20109)\x20makes\x20the\x20fee\x20enforceable\x20at\x20the\x20guard\x20layer,\x20but\x20this\x20template\x20does\x20not\x20DECLARE\x20that\x20'+('convention,\x20and\x20here\x20'+q+'.'),'suggestion':(n['length']>0x0?'For\x20the\x20renewal-shaped\x20cycle(s)\x20'+n['map'](y=>'['+y['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+':\x20declare\x20the\x20'+'order_renew\x20re-fund\x20convention\x20in\x20build_notes\x20—\x20\x27use\x20the\x20order\x20call\x27s\x20`order_renew`\x20field:\x20ONE\x20PTB\x20pays\x20'+'the\x20period\x20amount\x20into\x20the\x20Allocation\x20and\x20advances\x20the\x20renew\x20forward\x20(fund\x20+\x20record\x20+\x20'+'advance,\x20no\x20unfunded-advance\x20window);\x20NEVER\x20bind\x20an\x20allocation.balance\x20gate\x20on\x20this\x20forward\x20—\x20guards\x20read\x20the\x20COMMITTED\x20pre-transaction\x20balance,\x20so\x20the\x20same-PTB\x20payment\x20is\x20invisible\x20to\x20them\x20(esound-mn-261021\x20B-1;\x20HIS-35\x202026-11-09\x20re-verification\x20kept\x20the\x20doctrine)\x27.\x20':'')+'For\x20charge-bearing\x20cycles\x20that\x20are\x20not\x20renewal-shaped,\x20declare\x20the\x20guard-layer\x20fund\x20gate\x20in\x20build_notes\x20—\x20'+'\x27the\x20revisit\x20forward\x20carries\x20a\x20Guard:\x20constant\x20=\x20order\x20address,\x20convert_witness\x20OrderAllocation(109),\x20'+'allocation.balance\x20(query\x201051)\x20>=\x20revisit\x20fee\x27\x20—\x20or\x20replace\x20the\x20loop\x20'+'with\x20per-period\x20NEW\x20Orders\x20(REUSE\x20pattern\x20—\x20a\x20fresh\x20order\x20per\x20period)\x20or\x20remove\x20the\x20back-edge\x20—\x20rework\x20the\x20business\x20'+'flow\x20so\x20re-entry\x20is\x20a\x20fresh\x20order,\x20not\x20a\x20node\x20revisit.'}),f;}function deadEndLockChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0||!b['some'](k=>(k['from']??[])['length']>0x0))return[];const c=new Map(),d=[];for(const k of b){for(const l of k['from']??[]){const n=typeof l==='string'?l:l?.['prev'];if(n==='')d['push'](k['name']);else{const o=resolveSegmentToken(a,n);if(!c['has'](o))c['set'](o,[]);c['get'](o)['push'](k['name']);}}}const f=new Set(d),g=[...d];while(g['length']>0x0){const p=g['pop']();for(const q of c['get'](p)??[]){!f['has'](q)&&(f['add'](q),g['push'](q));}}const h=s=>/pool is empty|pool drains?ed|drains? in full|already (?:released|paid)|escrow (?:is )?(?:empty|drained)/i['test'](s),j=b['filter'](s=>s['semantic_role']!=='final'&&s['semantic_role']!=='cancelled')['filter'](s=>f['has'](s['name'])&&(c['get'](s['name'])??[])['length']===0x0)['filter'](s=>!h(s['role']))['map'](s=>'\x27'+s['name']+'\x27\x20('+(s['semantic_role']??'no\x20semantic_role')+(s['optional']===!![]?',\x20optional':'')+')');if(j['length']===0x0)return[];return[{'rule_id':'R-DEAD-END','severity':'high','title':'Dead-end\x20node(s)\x20'+j['join'](',\x20')+'\x20—\x20taking\x20the\x20forward\x20locks\x20the\x20order\x20and\x20its\x20escrow\x20forever','detail':'A\x20reachable\x20node\x20with\x20no\x20outgoing\x20forward\x20strands\x20the\x20order\x20the\x20moment\x20someone\x20advances\x20into\x20it:\x20'+'Machine\x20topology\x20freezes\x20at\x20publish,\x20so\x20there\x20is\x20no\x20later\x20repair,\x20and\x20`optional:\x20true`\x20does\x20NOT\x20help\x20—\x20'+'the\x20buyer\x20can\x20still\x20take\x20the\x20optional\x20forward,\x20and\x20the\x20order\x20then\x20stands\x20at\x20a\x20node\x20from\x20which\x20no\x20Pair\x20'+'exists\x20(Etsy\x20mainnet\x20ets1_o2\x20stopped\x20exactly\x20there:\x20delivered\x20→\x20reviewed,\x20history\x20ends,\x20no\x20rail\x20can\x20'+'ever\x20anchor\x20that\x20state\x20again).\x20Buy\x20escrows\x20ATOMICALLY,\x20so\x20the\x20full\x20pool\x20rides\x20into\x20the\x20dead\x20end\x20'+'unless\x20a\x20rail\x20drained\x20it\x20upstream.\x20This\x20is\x20the\x20defect\x20class\x20the\x20old\x20optional-leaf\x20exemption\x20in\x20'+'R-TOPO-03\x20let\x20ship\x20into\x20two\x20builtin\x20templates.','suggestion':'Wire\x20an\x20exit\x20edge\x20back\x20into\x20the\x20live\x20flow\x20(review\x20re-joins\x20the\x20settlement\x20rail,\x20e.g.\x20reviewed\x20'+'─settle→\x20completed)\x20or\x20remove\x20the\x20node\x20from\x20machine_shape\x20and\x20keep\x20the\x20action\x20off-Machine\x20'+'(Repository\x20/\x20Reward).\x20If\x20the\x20node\x20is\x20genuinely\x20a\x20record\x20state\x20whose\x20pool\x20already\x20drained\x20upstream,\x20'+'say\x20so\x20in\x20its\x20role\x20(\x27pool\x20is\x20empty\x27)\x20so\x20this\x20rule\x20and\x20TERMINAL-NO-RAIL\x20exempt\x20it.'}];}const EXCEPTION_NODE_REGEX=/exception|damaged|disputed|denied|broken/i,ALLOCATOR_GATE_TEMPLATE_REGEX=/allocator_node_gate|progress_state_check/;function exceptionExitChecks(a){const b=a['machine_shape'],c=b['filter'](j=>EXCEPTION_NODE_REGEX['test'](j['name']));if(c['length']===0x0)return[];const d=new Set(b['map'](j=>j['name'])),e=new Map();for(const j of a['guards']){if(j['host']!=='machine'||!ALLOCATOR_GATE_TEMPLATE_REGEX['test'](j['template_id']))continue;for(const k of Object['values'](j['params']??{})){if(typeof k==='string'&&d['has'](k)){if(!e['has'](k))e['set'](k,new Set());if(j['key']!==undefined)e['get'](k)['add'](j['key']);}}}const f=new Set((a['allocator']['rows']??[])['filter'](l=>l['track']==='refund')['map'](l=>l['guard_key'])['filter'](l=>typeof l==='string'&&l['length']>0x0)),h=[];for(const l of c){const m=[...e['get'](l['name'])??[]];if(m['length']===0x0)continue;if(m['some'](o=>f['has'](o)))continue;h['push']({'rule_id':'R-EXCEPTION-EXIT','severity':'high','title':'Exception\x20node\x20\x27'+l['name']+'\x27\x20carries\x20money\x20but\x20has\x20NO\x20buyer-ward\x20(refund)\x20exit\x20—\x20the\x20escrow\x20principal\x20is\x20merchant-ward\x20only','detail':'A\x20machine-host\x20allocator\x20rail\x20fires\x20while\x20the\x20order\x20rests\x20at\x20\x27'+l['name']+'\x27\x20(guarded\x20by\x20'+m['join'](',\x20')+'),\x20'+'and\x20none\x20of\x20the\x20rows\x20on\x20those\x20rails\x20is\x20a\x20refund\x20track.\x20The\x20exception\x20entry\x20is\x20typically\x20a\x20one-way\x20door\x20'+'past\x20the\x20return-request\x20edges,\x20so\x20after\x20reporting\x20the\x20problem\x20the\x20buyer\x20can\x20neither\x20return\x20(the\x20return\x20'+'rail\x20is\x20topologically\x20gone)\x20nor\x20claw\x20back\x20the\x20principal\x20(no\x20refund\x20rail\x20fires\x20here)\x20—\x20the\x20merchant-ward\x20'+'rail\x20is\x20the\x20ONLY\x20money\x20exit\x20(ksk4\x20live\x20o10:\x2050M\x20escrow,\x2010M\x20indemnity\x20to\x20the\x20buyer,\x20the\x2050M\x20principal\x20'+'swept\x20to\x20the\x20merchant).\x20Machine\x20+\x20Allocator\x20freeze\x20at\x20publish\x20(IMMUT-001)\x20—\x20there\x20is\x20no\x20later\x20repair.','suggestion':'Give\x20\x27'+l['name']+'\x27\x20the\x20refund/recover\x20DUAL\x20exit:\x20(a)\x20a\x20track\x20\x22refund\x22\x20allocator\x20row\x20(order-anchored\x20'+('GuardIdentifier(0)\x20recipient)\x20gated\x20by\x20tpl_allocator_node_gate_refund\x20over\x20\x27'+l['name']+'\x27\x20(node-gated\x20')+'fund\x20rail,\x20decision\x2011)\x20—\x20the\x20buyer\x20recovers\x20the\x20principal\x20at\x20the\x20refund\x20terminal;\x20'+'(b)\x20a\x20merchant-recovery\x20row\x20gated\x20by\x20tpl_allocator_node_gate_recover\x20(terminal-node-gated\x20sweep)\x20so\x20'+'the\x20principal\x20still\x20exits\x20after\x20a\x20merchant-favored\x20ruling.\x20NEVER\x20add\x20a\x20claimed_by\x20leg\x20to\x20either\x20'+'fund\x20rail\x20(R-FUND-RAIL-CLAIMED-BY\x20critical);\x20an\x20award\x20never\x20silences\x20a\x20due\x20refund\x20—\x20overlap\x20is\x20legal\x20'+'and\x20disclosed\x20at\x20the\x20dual-payout\x20gate.\x20Keep\x20each\x20allocator\x27s\x20Rate\x20sum\x20at\x20exactly\x2010000,\x20'+'and\x20keep\x20the\x20return\x20rail\x20reachable:\x20either\x20enter\x20the\x20exception\x20node\x20from\x20a\x20state\x20that\x20retains\x20its\x20'+'return\x20exits,\x20or\x20mount\x20the\x20refund\x20rail\x20directly\x20on\x20the\x20exception\x20node\x20as\x20above.'});}return h;}const RULING_TEMPLATES=new Set(['tpl_forward_arb_ruling_won','tpl_forward_arb_ruling_dismissed']);function arbZeroExitChecks(a){const b=new Set(a['guards']['filter'](h=>RULING_TEMPLATES['has'](h['template_id'])&&h['host']==='machine'&&typeof h['key']==='string')['map'](h=>h['key']));if(b['size']===0x0)return[];const c=new Map(a['machine_shape']['map'](g=>[g['name'],g['semantic_role']])),d=new Map();for(const g of a['machine_shape']){for(const h of g['from']??[]){if(typeof h==='string'){if(h['length']===0x0)continue;if(!d['has'](h))d['set'](h,[]);d['get'](h)['push']({'forward':h+'_to_'+g['name'],'guardKey':undefined});continue;}if(typeof h!=='object'||h===null)continue;const j=h;if(typeof j['prev']!=='string'||j['prev']['length']===0x0)continue;const k=typeof j['forward']==='string'&&j['forward']['length']>0x0?j['forward']:j['prev']+'_to_'+g['name'];if(!d['has'](j['prev']))d['set'](j['prev'],[]);d['get'](j['prev'])['push']({'forward':k,'guardKey':typeof j['guard_key']==='string'?j['guard_key']:undefined});}}const f=[];for(const [l,m]of d){const o=c['get'](l);if(o==='final'||o==='cancelled')continue;if(!m['some'](w=>w['guardKey']!==undefined&&b['has'](w['guardKey'])))continue;const p=m['find'](w=>w['guardKey']===undefined||!b['has'](w['guardKey']));if(p!==undefined)continue;const q=m['some'](w=>w['guardKey']!==undefined&&a['guards']['some'](x=>x['template_id']==='tpl_forward_arb_ruling_dismissed'&&x['host']==='machine'&&x['key']===w['guardKey'])),s=q?'a\x20case\x20that\x20NEVER\x20rules\x20(withdrawn\x20via\x20arb_withdraw,\x20reset,\x20or\x20abandoned\x20—\x20both\x20ruling\x20roots\x20fail-closed\x20on\x20the\x20None\x20indemnity)':'a\x20merchant-favor\x20(zero-award)\x20ruling\x20AND\x20any\x20case\x20that\x20never\x20rules';f['push']({'rule_id':'R-ARB-ZERO-EXIT','severity':'high','title':'Dispute\x20waypoint\x20\x27'+l+'\x27\x20has\x20ONLY\x20ruling-keyed\x20exits\x20—\x20'+s+'\x20strands\x20the\x20order\x20with\x20no\x20edge\x20at\x20all','detail':'Every\x20exit\x20from\x20\x27'+l+'\x27\x20is\x20guarded\x20by\x20an\x20arbitration-ruling\x20template\x20('+m['filter'](w=>w['guardKey']!==undefined&&b['has'](w['guardKey']))['map'](w=>w['guardKey'])['join'](',\x20')+'),\x20and\x20the\x20dismissed\x20root\x20errors\x20on\x20the\x20None\x20indemnity\x20field\x20(fail-closed).\x20'+('Under\x20'+s+',\x20NOTHING\x20fires:\x20the\x20order\x20rests\x20at\x20\x27'+l+'\x27\x20permanently\x20—\x20Machine\x20+\x20Allocator\x20')+'freeze\x20at\x20publish\x20(IMMUT-001)\x20and\x20there\x20is\x20no\x20later\x20repair\x20(ddmc4\x20B-29\x20zero-payout\x20deadlock\x20family).','suggestion':'Give\x20\x27'+l+'\x27\x20the\x20WithdrawClaim\x20void\x20escape,\x20declared\x20on\x20the\x20target\x20node:\x20'+('{\x20prev:\x20\x27'+l+'\x27,\x20forward:\x20\x27WithdrawClaim\x27,\x20operator:\x20\x27order_payer\x27,\x20guard_key:\x20\x27withdraw_claim\x27\x20}\x20')+'into\x20the\x20cancelled\x20terminal,\x20with\x20the\x20matching\x20machine-host\x20guard\x20keyed\x20\x27withdraw_claim\x27\x20'+'(pattern.identity_check_order_holder\x20—\x20signer\x20==\x20order\x20owner;\x20no\x20ruling\x20=\x20arb.claimed_by\x20none\x20=\x20'+'the\x20order\x20is\x20untouched\x20and\x20the\x20node-gated\x20refund\x20rail\x20stays\x20open,\x20full\x20escrow\x20back;\x20decision\x2011\x20'+'KEEP\x20face:\x20never\x20add\x20a\x20claimed_by\x20leg\x20to\x20the\x20fund\x20rail\x20itself,\x20R-FUND-RAIL-CLAIMED-BY).\x20A\x20'+'ForceSettleExpired\x20clock\x20edge\x20substitutes\x20ONLY\x20if\x20it\x20routes\x20buyer-ward\x20(refund\x20to\x20the\x20payer).'});}return f;}function evidenceMarkerEchoChecks(a){const b=[];for(const c of a['guards']){if(c['template_id']!=='tpl_repository_row_present'||c['host']!=='machine'||c['key']===undefined)continue;const d=c['params']?.['evidence_marker'];if(typeof d!=='string'||d['length']===0x0)continue;const f=new Set();for(const k of a['machine_shape']){for(const l of k['from']??[]){if(typeof l!=='object'||l===null)continue;const m=l;m['guard_key']===c['key']&&typeof m['forward']==='string'&&m['forward']['length']>0x0&&f['add'](m['forward']);}}if(f['size']===0x0)continue;const h=[...f]['some'](o=>{const p=o['toLowerCase'](),q=d['toLowerCase']();return p['includes'](q)||q['includes'](p);});if(h)continue;const j=[...f]['map'](o=>'\x27'+o+'\x27')['join'](',\x20');b['push']({'rule_id':'R-EVIDENCE-MARKER-ECHO','severity':'medium','title':'Evidence\x20marker\x20\x27'+d+'\x27\x20(guard\x20\x27'+c['key']+'\x27)\x20is\x20not\x20derivable\x20from\x20its\x20mounting\x20forward\x20name(s)\x20'+j,'detail':'The\x20guard\x20requires\x20a\x20repository\x20row\x20whose\x20value\x20contains\x20the\x20constant\x20\x27'+d+'\x27,\x20but\x20the\x20write-time\x20'+('failure\x20surfaces\x20no\x20expected\x20value\x20and\x20the\x20mounting\x20forward\x20name(s)\x20'+j+'\x20share\x20no\x20substring\x20')+'with\x20it\x20—\x20a\x20builder\x20writing\x20the\x20evidence\x20row\x20can\x20only\x20discover\x20the\x20marker\x20by\x20reading\x20the\x20plan\x27s\x20raw\x20'+'value\x20bytes\x20(dmcx\x20live:\x20the\x20builder\x20wrote\x20\x27CompensateBadItem\x27,\x20the\x20guard\x20wanted\x20\x27BadItemCompensation\x27,\x20'+'the\x20forward\x20died\x20off-chain\x20with\x20a\x20bare\x20\x22guard\x20not\x20passed\x22).','suggestion':'Rename\x20the\x20mount\x27s\x20evidence_marker\x20to\x20its\x20forward\x20name\x20(catalog\x20convention:\x20marker\x20==\x20forward,\x20e.g.\x20'+('evidence_marker\x20\x27'+[...f][0x0]+'\x27\x20for\x20guard\x20\x27'+c['key']+'\x27),\x20or\x20at\x20minimum\x20echo\x20the\x20expected\x20marker\x20')+'verbatim\x20in\x20every\x20build/plan\x20surface\x20that\x20names\x20this\x20guard\x20—\x20never\x20let\x20the\x20row-value\x20tag\x20be\x20a\x20'+'free-standing\x20constant\x20with\x20no\x20derivation\x20from\x20the\x20mount.'});}return b;}function reviewNoRaceChecks(a){const b=a['machine_shape'];if(b['length']===0x0)return[];const c=[],d=k=>/review(ed|ing)?\b/i['test'](k)&&!/un|no |not |without |expire/i['test'](k),f=k=>/unreviewed|no[_ -]?review|not[_ -]?reviewed|without[_ -]?review|review[^.;]{0,40}expire|expire[^.;]{0,40}review|review[_ -]?timeout|auto[_ -]?accept[^.;]{0,30}review/i['test'](k),g=k=>/\b(accept(ed|ance)?|approv(ed|e|al)|place(ment|d)?|rul(ed|ing)|valid(ated)?|award(ed)?|winner)\b/i['test'](k)&&!/timeout|expire|auto[_ -]?accept|un|no |not |without |reject|denied|dismiss/i['test'](k),h=k=>/accept(ance)?[_ -]?timeout|auto[_ -]?accept|judge[_ -]?timeout|ruling[_ -]?timeout|decision[_ -]?timeout|placement[_ -]?timeout|accept[^.;]{0,30}expire|expire[^.;]{0,30}accept|appeal[^.;]{0,20}expire/i['test'](k),j=new Map();for(const k of b){const l=new Set();for(const m of k['from']??[]){const o=typeof m==='string'?{'prev':m}:m;if(!o['prev']||l['has'](o['prev']))continue;l['add'](o['prev']);const p=j['get'](o['prev'])??[];p['push']({'name':k['name'],'role':k['role']??''}),j['set'](o['prev'],p);}}for(const [q,s]of j){const w=s['find'](C=>d(C['name']+'\x20'+C['role'])),x=s['find'](C=>C['name']!==w?.['name']&&(f(C['name'])||/(expire|timeout|deadline|window|clock|after|day|hour|auto)/i['test'](C['role'])&&f(C['name']+'\x20'+C['role']))),y=s['find'](C=>g(C['name']+'\x20'+C['role'])),z=s['find'](C=>C['name']!==y?.['name']&&h(C['name']+'\x20'+C['role'])),A=w??y,B=w!==undefined&&x!==undefined?x:y!==undefined&&z!==undefined?z:undefined;if(A===undefined||B===undefined)continue;c['push']({'rule_id':'R-REVIEW-NORACE','severity':'high','title':'Node\x20\x27'+q+'\x27\x20fans\x20out\x20\x27'+A['name']+'\x27\x20and\x20its\x20complement\x20\x27'+B['name']+'\x27\x20as\x20SIBLING\x20outgoing\x20edges\x20—\x20complementary\x20conditions\x20race\x20(F-REVIEW-BLOCK)','detail':'Sibling\x20forwards\x20on\x20one\x20NodePair\x20have\x20no\x20on-chain\x20mutual\x20exclusion.\x20Reviewed/unreviewed\x20(or\x20accepted/acceptance-timeout)\x20'+'as\x20parallel\x20edges\x20race\x20on\x20their\x20time\x20conditions:\x20in\x20an\x20overlap\x20BOTH\x20fire\x20(double\x20movement),\x20in\x20a\x20gap\x20NEITHER\x20fires\x20—\x20and\x20with\x20'+'topology\x20frozen\x20at\x20publish\x20the\x20neither-gap\x20is\x20a\x20permanent\x20deadlock\x20that\x20no\x20later\x20repair\x20can\x20close.','suggestion':'Fold\x20the\x20complement\x20into\x20ONE\x20release\x20guard\x20as\x20a\x20logic_or\x20time\x20variant\x20(\x27reviewed\x20OR\x20unreviewed\x20after\x20T\x27\x20/\x20\x27accepted\x20OR\x20'+'auto-accept\x20after\x20T\x27)\x20on\x20a\x20single\x20edge\x20—\x20REVIEW-GATED\x20RELEASE\x20in\x20guard-design-patterns\x20—\x20or\x20give\x20each\x20sibling\x20its\x20own\x20NodePair\x20'+'so\x20the\x20choice\x20is\x20a\x20build-time\x20topology\x20decision,\x20not\x20a\x20runtime\x20race.'});}return c;}export function afterSalesRailRegex(a){return a==='return'?/return|refund/i:a==='exchange'?/exchange|replace|reship|swap/i:/warranty|repair|claim/i;}export function afterSalesRailNodeMatches(a,b){if(!afterSalesRailRegex(a)['test'](b))return![];return!/missed|withdraw|pre_deadline|goal/i['test'](b);}function afterSalesRailChecks(a){const b=a['after_sales_mode'];if(b===undefined||b==='none')return[];const c=a['machine_shape'],d=afterSalesRailRegex(b);if(c['some'](e=>afterSalesRailNodeMatches(b,e['name'])))return[];return[{'rule_id':'R-AFTER-SALES-RAIL','severity':'high','title':'after_sales_mode\x20\x27'+b+'\x27\x20declares\x20a\x20buyer\x20remedy\x20but\x20machine_shape\x20has\x20no\x20backing\x20rail\x20(no\x20node\x20matching\x20'+d+')','detail':'A\x20declared\x20after-sales\x20capability\x20the\x20topology\x20cannot\x20walk\x20is\x20a\x20false\x20promise\x20at\x20quote\x20time.\x20compile\x20hard-blocks\x20'+'this\x20(AFTER_SALES_RAIL_MISSING);\x20the\x20scanner\x20surfaces\x20it\x20at\x20authoring\x20time.\x20The\x20money-safety\x20invariants\x20'+'(node-gated\x20fund\x20rail\x20with\x20NO\x20claimed_by\x20leg\x20(decision\x2011),\x20delivered-entry\x20window\x20anchor,\x20dual-payout\x20'+'disclosure)\x20are\x20separate\x20generic\x20rules\x20and\x20are\x20NOT\x20re-checked\x20here.','suggestion':'Add\x20the\x20\x27'+b+'\x27\x20node\x20family\x20(e.g.\x20return_requested\x20->\x20returned\x20for\x20\x27return\x27)\x20as\x20a\x20node-gated\x20fund\x20rail\x20'+'(decision\x2011:\x20NEVER\x20a\x20claimed_by\x20polarity\x20leg\x20—\x20R-FUND-RAIL-CLAIMED-BY\x20critical)\x20anchored\x20on\x20the\x20delivered\x20'+'ENTRY\x20time\x20(INV-C2);\x20refund\x20and\x20award\x20are\x20independent\x20tracks\x20and\x20any\x20overlap\x20is\x20disclosed\x20at\x20the\x20'+'dual-payout\x20gate\x20(DUAL-RAIL-01)\x20—\x20or\x20set\x20after_sales_mode\x20\x27none\x27.'}];}function acceptanceModeChecks(a){const b=a['acceptance_mode'];if(b===undefined||b==='none')return[];const c=[],d=b==='contest'||b==='bounty'||b==='agent';d&&a['arbitration_mode']!=='third_party'&&c['push']({'rule_id':'R-ACCEPTANCE-JUDGE','severity':'high','title':'acceptance_mode\x20\x27'+b+'\x27\x20is\x20judge-decided\x20but\x20arbitration_mode\x20is\x20\x27'+(a['arbitration_mode']??'none')+'\x27,\x20not\x20\x27third_party\x27\x20(INV-A3)','detail':'A\x20judge-decided\x20acceptance\x20(contest\x20ranking\x20/\x20bounty\x20triage\x20/\x20agent\x20evaluator)\x20lets\x20a\x20third\x20party\x20rule\x20on\x20whether\x20the\x20'+'escrow\x20releases.\x20If\x20that\x20decider\x20is\x20not\x20independent\x20of\x20the\x20party\x20owing\x20the\x20payout,\x20the\x20merchant\x20self-adjudicates\x20its\x20own\x20'+'obligation.\x20compile\x20hard-blocks\x20this\x20(ACCEPTANCE_JUDGE_NOT_INDEPENDENT);\x20the\x20scanner\x20surfaces\x20it\x20at\x20authoring\x20time.\x20The\x20'+'publish-gate\x20controller-disjointness\x20half\x20is\x20checkArbitrationNeutrality,\x20which\x20already\x20gates\x20every\x20build.','suggestion':'Set\x20arbitration_mode\x20\x27third_party\x27\x20so\x20an\x20independent\x20venue/judge\x20Permission\x20rules\x20(R2),\x20or\x20use\x20acceptance_mode\x20\x27milestone\x27\x20'+'if\x20the\x20buyer\x20genuinely\x20self-adjudicates\x20the\x20delivery.'});const e=a['fee_params']?.['revision_rounds_max'],f=typeof e==='number'||typeof e==='string'&&e['trim']()!==''&&/^\d+$/['test'](e['trim']());if(f){const g=(a['guards']??[])['some'](h=>h['host']==='repository'||/repository/i['test'](h['template_id']??''));!g&&c['push']({'rule_id':'R-ACCEPTANCE-REVISION','severity':'high','title':'acceptance_mode\x20\x27'+b+'\x27\x20declares\x20a\x20finite\x20revision\x20cap\x20(revision_rounds_max\x20=\x20'+String(e)+')\x20with\x20no\x20counter-backed\x20Repository\x20guard\x20(INV-A1)','detail':'the\x20chain\x20caps\x20EDGE\x20count\x20(MAX_FORWARD\x20/\x20MAX_NODE_PAIR),\x20never\x20VISIT\x20count,\x20so\x20a\x20revision\x20loop\x20can\x20be\x20re-entered\x20any\x20'+'number\x20of\x20times.\x20A\x20finite\x20revision_rounds_max\x20written\x20in\x20fee_params\x20alone\x20is\x20a\x20promise\x20the\x20chain\x20cannot\x20keep\x20—\x20compile\x20'+'hard-blocks\x20it\x20(ACCEPTANCE_REVISION_UNBOUNDED).\x20This\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Declare\x20revision_rounds_max\x20\x27unlimited\x27\x20(the\x20honest\x20form\x20—\x20the\x20loop\x20is\x20then\x20genuinely\x20unbounded),\x20or\x20mount\x20a\x20counter-backed\x20'+'Repository\x20guard\x20(pattern.repository_data_check\x20reading\x20a\x20per-order\x20revision\x20tally\x20written\x20via\x20'+'pattern.repository_write_authorization)\x20that\x20gates\x20redelivery\x20once\x20the\x20tally\x20reaches\x20the\x20cap.'});}return c;}function revisionLoopChecks(a){const b=a['machine_shape']??[],c=new Set(b['map'](h=>h['name'])),d=b['some'](h=>(h['from']??[])['some'](j=>{if(typeof j==='string')return![];return/needs_info|info_requested|revision/i['test'](j['prev']??'')&&c['has'](j['prev']??'')&&/provide|resubmit|revis|redeliver/i['test'](j['forward']??'');}));if(!d)return[];const e=a['fee_params']?.['revision_rounds_max'],f=typeof e==='number'||typeof e==='string'&&e['trim']()!==''&&/^\d+$/['test'](e['trim']());if(!f)return[];const g=(a['guards']??[])['some'](h=>h['host']==='repository'||/repository/i['test'](h['template_id']??''));if(g)return[];return[{'rule_id':'R-REVISION-LOOP-NO-COUNTER','severity':'high','title':'machine_shape\x20ships\x20a\x20revision\x20loop\x20(a\x20provide/resubmit/revise/redeliver\x20return\x20edge\x20from\x20a\x20needs-info/revision\x20waypoint)\x20with\x20a\x20finite\x20revision_rounds_max\x20('+String(e)+')\x20and\x20no\x20counter-backed\x20Repository\x20guard\x20(INV-A1)','detail':'the\x20chain\x20caps\x20EDGE\x20count\x20(MAX_FORWARD\x20/\x20MAX_NODE_PAIR),\x20never\x20VISIT\x20count,\x20so\x20this\x20loop\x27s\x20return\x20edge\x20can\x20be\x20walked\x20'+'any\x20number\x20of\x20times.\x20The\x20declared\x20twin\x20(R-ACCEPTANCE-REVISION)\x20only\x20covers\x20templates\x20that\x20DECLARE\x20an\x20acceptance\x20mode;\x20'+'this\x20graph-face\x20twin\x20catches\x20the\x20loop\x20STRUCTURE\x20itself.\x20A\x20finite\x20revision_rounds_max\x20over\x20an\x20ungated\x20loop\x20is\x20a\x20promise\x20'+'the\x20contract\x20cannot\x20enforce.','suggestion':'Declare\x20revision_rounds_max\x20\x27unlimited\x27\x20(the\x20honest\x20form),\x20or\x20gate\x20the\x20loop\x27s\x20return\x20edge\x20with\x20the\x20counter-backed\x20'+'tpl_repository_revision_gate\x20(request/provided\x20marker-count\x20tally\x20pair,\x20per-side\x20write\x20guards\x20binding\x20the\x20tally\x20to\x20'+'the\x20party\x20the\x20cap\x20constrains\x20—\x20see\x20freelance/bug-bounty\x27s\x20revision_gate\x20mount)\x20or\x20a\x20pattern.repository_data_check\x20'+'tally\x20written\x20via\x20pattern.repository_write_authorization.'}];}function exclusivityRegistryChecks(a){const b=templateText(a),c=/\bexclusive[- ](license|tier|grant|sale)s?\b|\bexclusively licen[cs]ed\b/i['test'](b);if(!c)return[];const d=(a['guards']??[])['some'](e=>e['policy']?.['name']==='claimed_subjects'||/claim_registry/i['test'](e['key']??'')||/tpl_buy_guard_exclusive_subject/i['test'](e['template_id']??''));if(d)return[];return[{'rule_id':'R-EXCLUSIVITY-NO-REGISTRY','severity':'medium','title':'the\x20template\x20discloses\x20EXCLUSIVITY\x20(an\x20exclusive\x20license/tier/grant/sale)\x20but\x20ships\x20no\x20claimed-subject\x20registry\x20—\x20the\x20uniqueness\x20claim\x20has\x20no\x20on-chain\x20proof\x20or\x20refusal\x20path','detail':'an\x20exclusive\x20premium\x20is\x20only\x20worth\x20what\x20proves\x20the\x20subject\x20was\x20not\x20sold\x20twice.\x20Without\x20a\x20write_once\x20claimed-subject\x20'+'registry\x20(claim\x20rows\x20keyed\x20by\x20the\x20listing\x27s\x20Service\x20address,\x20written\x20at\x20first\x20grant\x20settlement),\x20a\x20re-sold\x20exclusive\x20'+'is\x20undetectable\x20on\x20chain\x20and\x20the\x20arbitration\x20face\x20has\x20no\x20already-transferred\x20proof\x20to\x20read.','suggestion':'Mount\x20the\x20exclusivity\x20registry:\x20a\x20tpl_repository_write_allowlist\x20guard\x20over\x20a\x20write_once\x20\x27claimed_subjects\x27\x20policy\x20'+'(SERVICE-keyed\x20rows,\x20one\x20claim\x20row\x20written\x20at\x20first\x20grant\x20settlement)\x20plus\x20—\x20when\x20the\x20listing\x20is\x20dedicated\x20to\x20the\x20'+'exclusive\x20tier\x20—\x20the\x20drop-in\x20tpl_buy_guard_exclusive_subject\x20buy\x20gate\x20(logic_not\x20over\x20query_repository_data_has,\x20the\x20'+'negated\x20read\x20of\x20the\x20same\x20registry).\x20Disclose\x20the\x20settlement-window\x20face:\x20the\x20gate\x20opens\x20for\x20buys\x20between\x20purchase\x20and\x20'+'claim-row\x20write,\x20so\x20single-flight\x20sales\x20are\x20part\x20of\x20the\x20posture.'}];}function rateTierClosureChecks(a){const b=Object['keys'](a['fee_params']??{})['find'](f=>/_bands$/['test'](f));if(!b)return[];const c=a['fee_params']?.[b];if(typeof c!=='string')return[];const d=[];for(const f of c['split'](';')){const g=/^(\d+)-(\d+):(\d+)$/['exec'](f['trim']());if(!g)return[{'rule_id':'R-RATE-TIER-GAP','severity':'high','title':'fee_params.'+b+'\x20(\x22'+c+'\x22)\x20is\x20malformed\x20—\x20tiers\x20must\x20be\x20\x22floor-ceiling:buyer_refund_bps\x22\x20separated\x20by\x20\x27;\x27\x20(R-RATE-TIER-GAP)','detail':'an\x20unparseable\x20band\x20declaration\x20cannot\x20be\x20mirrored\x20into\x20band-guard\x20params,\x20so\x20the\x20on-chain\x20bands\x20and\x20the\x20declared\x20tiers\x20can\x20drift\x20apart\x20silently.','suggestion':'Fix\x20the\x20tier\x20syntax\x20in\x20fee_params.'+b+'\x20(e.g.\x20\x220-5000:10000;5000-9000:5000;9000-10001:1000\x22)\x20and\x20keep\x20the\x20cancel_band_*\x20guard\x20params\x20and\x20allocator\x20rows\x20in\x20sync.'}];d['push']({'floor':Number(g[0x1]),'ceiling':Number(g[0x2]),'bps':Number(g[0x3])});}d['sort']((h,j)=>h['floor']-j['floor']);const e=h=>({'rule_id':'R-RATE-TIER-GAP','severity':'high','title':'fee_params.'+b+'\x20(\x22'+c+'\x22)\x20fails\x20the\x20tier-closure\x20contract:\x20'+h+'\x20—\x20a\x20mid-band\x20ratio\x20passes\x20NO\x20band\x20guard\x20(stranded\x20funds)\x20or\x20TWO\x20(double-pay)','detail':'the\x20band\x20allocators\x20partition\x20[0,\x2010001)\x20only\x20when\x20the\x20declared\x20tiers\x20are\x20HALF-OPEN\x20ADJACENT\x20from\x200\x20and\x20reach\x20past\x2010000\x20'+'(ceiling_k\x20==\x20floor_{k+1},\x20lowest\x20floor\x200,\x20last\x20ceiling\x20>=\x2010001\x20with\x20the\x20exclusive-ceiling\x20convention).\x20A\x20gap\x20strands\x20the\x20'+'allocation\x20(no\x20guard\x20passes);\x20an\x20overlap\x20double-pays\x20(two\x20guards\x20pass,\x20two\x20allocators\x20drain);\x20an\x20unowned\x20end\x20leaves\x20a\x20'+'fresh\x20order\x20(no\x20row,\x20falls\x20to\x20the\x200-floor\x20band)\x20or\x20a\x20fully-delivered\x20ratio\x20(10000)\x20outside\x20every\x20band.','suggestion':'Fix\x20the\x20tiers\x20so\x20they\x20tile\x20the\x20axis:\x20start\x20at\x20floor\x200,\x20make\x20each\x20tier\x27s\x20ceiling\x20the\x20next\x20tier\x27s\x20floor,\x20end\x20with\x20a\x20ceiling\x20'+'>=\x2010001,\x20and\x20keep\x20every\x20band\x20allocator\x27s\x20internal\x20ERATE\x20sum\x20at\x2010000.'});if(d['length']===0x0)return[e('zero\x20tiers')];if(d[0x0]['floor']!==0x0)return[e('the\x20lowest\x20tier\x20starts\x20at\x20'+d[0x0]['floor']+',\x20not\x200')];if(d[d['length']-0x1]['ceiling']<0x2711)return[e('the\x20highest\x20tier\x20ends\x20at\x20'+d[d['length']-0x1]['ceiling']+',\x20leaving\x20['+d[d['length']-0x1]['ceiling']+',\x2010000]\x20unowned')];for(let h=0x0;h<d['length'];h++){if(d[h]['ceiling']<=d[h]['floor'])return[e('tier\x20'+h+'\x20('+d[h]['floor']+'-'+d[h]['ceiling']+')\x20is\x20empty\x20or\x20inverted')];if(h>0x0&&d[h]['floor']<d[h-0x1]['ceiling'])return[e('tier\x20'+h+'\x20(floor\x20'+d[h]['floor']+')\x20OVERLAPS\x20tier\x20'+(h-0x1)+'\x20(ceiling\x20'+d[h-0x1]['ceiling']+')')];if(h>0x0&&d[h]['floor']>d[h-0x1]['ceiling'])return[e('tier\x20'+h+'\x20(floor\x20'+d[h]['floor']+')\x20leaves\x20['+d[h-0x1]['ceiling']+',\x20'+d[h]['floor']+')\x20unowned\x20after\x20tier\x20'+(h-0x1))];}return[];}function piiCommitmentChecks(a){const b=templateText(a),c=/\b(id[- ]?verification|identity verification|id document|passport (?:no\.?|number)|national id|driver'?s licen[cs]e|real[- ]?name|kyc|know[- ]your[- ]customer|guest identity|tenant identity|member roster|guest roster|contact (?:details|info(?:rmation)?)|whatsapp|phone number|home address|pickup contact|emergency contact|personal data|personal information)\b/i,d=/\b(zero PII|no PII|PII commitment|presence[- ]only|E2EE|off[- ]chain encrypted|encrypted (?:conversation|channel|Messenger)|never as (?:public )?on[- ]chain|never (?:in|to) a public on[- ]chain|never stored on[- ]chain|chain records? (?:only )?the (?:presence|proof|hash))\b/i;if(!c['test'](b))return[];if(d['test'](b))return[];return[{'rule_id':'R-PII-NO-COMMITMENT','severity':'medium','title':'PII-handling\x20prose\x20with\x20no\x20on-chain-zero\x20commitment','detail':'The\x20template\x27s\x20prose\x20discusses\x20personal\x20information\x20(identity\x20verification,\x20contact\x20exchange,\x20or\x20a\x20roster)\x20but\x20never\x20declares\x20the\x20publicity\x20boundary.\x20The\x20chain\x20is\x20a\x20PUBLIC\x20ledger:\x20a\x20phone\x20number,\x20home\x20address\x20or\x20ID\x20document\x20written\x20into\x20a\x20repository\x20row,\x20a\x20progress\x20message\x20or\x20WIP\x20text\x20is\x20publicly\x20readable\x20forever\x20(U-09),\x20and\x20there\x20is\x20no\x20delete.\x20The\x20kernel\x27s\x20ONE\x20privacy\x20primitive\x20is\x20presence-only\x20—\x20plaintext\x20must\x20ride\x20the\x20E2EE\x20Messenger\x20conversation\x20while\x20the\x20chain\x20records\x20the\x20proof.','suggestion':'Add\x20a\x20disclosure\x20note\x20(build_note\x20or\x20user_inputs\x20note)\x20declaring\x20the\x20commitment:\x20\x22ON-CHAIN\x20ZERO\x20PII\x20—\x20names,\x20phones,\x20addresses\x20and\x20ID\x20documents\x20NEVER\x20enter\x20on-chain\x20fields;\x20plaintext\x20travels\x20only\x20the\x20E2EE\x20Messenger\x20conversation,\x20the\x20chain\x20records\x20the\x20presence\x20proof\x22\x20(the\x20batch7\x20T-A\x20zero-chain\x20approximation\x20—\x20the\x20disclosure\x20is\x20the\x20control).'}];}function installmentModeChecks(a){const b=a['installment_mode'];if(b===undefined||b==='none')return[];const c=a['machine_shape']??[];if(c['length']===0x0||!c['some'](z=>(z['from']??[])['length']>0x0))return[];const d=/(due|owed|owing|unpaid|awaiting|pending)/i,f=/(paid|captured|funded|settled)/i,h=/(deposit|down_?pay|balance_due|balance_owed|awaiting|installment|milestone)/i,j=/(refund|cancel|exit|forfeit|kill|void|abandon|release|expire|lapse)/i,k=[];for(const z of c){for(const A of z['from']??[]){if(typeof A==='string')k['push']({'prev':A,'target':z['name']});else k['push']({'prev':A?.['prev']??'','target':z['name'],'guardKey':A?.['guard_key']});}}const l=[],n=k['filter'](B=>d['test'](B['prev'])&&f['test'](B['target'])&&(B['guardKey']===undefined||B['guardKey']['trim']()===''));n['length']>0x0&&l['push']({'rule_id':'R-INSTALLMENT-FUNDING','severity':'high','title':'installment_mode\x20\x27'+b+'\x27\x20has\x20an\x20ungated\x20funding\x20forward\x20('+n['map'](B=>'\x27'+B['prev']+'\x27\x20→\x20\x27'+B['target']+'\x27')['join'](',\x20')+')\x20—\x20a\x20bare\x20advance\x20is\x20a\x20zero-value\x20capture\x20(INV-B1)','detail':'A\x20capture\x20forward\x20(a\x20DUE\x20state\x20advancing\x20into\x20a\x20PAID\x20state)\x20with\x20no\x20guard_key\x20lets\x20the\x20Machine\x20advance\x20WITHOUT\x20the\x20'+'later\x20payment\x20landing\x20in\x20the\x20Allocation\x20—\x20the\x20balance\x20is\x20recorded\x20paid\x20on\x20a\x20zero-value\x20advance\x20(H4).\x20compile\x20hard-blocks\x20'+'this\x20(INSTALLMENT_FUNDING_UNGATED);\x20the\x20scanner\x20surfaces\x20it\x20at\x20authoring\x20time.\x20Whether\x20the\x20bound\x20Guard\x20actually\x20reads\x20'+'allocation.balance\x20is\x20R-LOOP-FUND\x27s\x20job,\x20not\x20this\x20rule\x27s.','suggestion':'Bind\x20a\x20fund-gate\x20Guard\x20on\x20each\x20capture\x20forward\x20(constant\x20=\x20order\x20address,\x20convert_witness\x20OrderAllocation(109),\x20'+'allocation.balance\x20query\x201051\x20>=\x20the\x20capture\x20amount).\x20PRE-STATE\x20CONSTRAINT\x20(esound-mn-261021\x20B-1,\x20mainnet-verified):\x20'+'the\x20gate\x20reads\x20the\x20COMMITTED\x20pre-transaction\x20balance\x20—\x20the\x20one-PTB\x20order_renew\x20payment\x20is\x20INVISIBLE\x20to\x20it,\x20so\x20a\x20'+'balance-gated\x20capture\x20advanced\x20by\x20order_renew\x20ALWAYS\x20aborts.\x20'+TWO_TX_RENEW_RECIPE+'\x20Pair\x20the\x20balance\x20gate\x20with\x20'+'the\x20once\x20slot\x20(H5\x20—\x20the\x20fund\x20gate\x20is\x20a\x20STATE\x20READ,\x20not\x20a\x20once).'});const o=new Set((a['allocator']['rows']??[])['filter'](B=>B['track']==='refund'||B['track']==='settlement')['map'](B=>B['guard_key'])['filter'](B=>typeof B==='string'&&B['trim']()!=='')),p=new Set(c['map'](B=>B['name'])),q=new Map(c['map'](B=>[B['name'],B['semantic_role']])),s=new Set();for(const B of a['guards']??[]){if(B['host']!=='machine'||!/allocator_node_gate|progress_state_check/['test'](B['template_id']))continue;if(!o['has'](B['key']))continue;for(const C of Object['values'](B['params']??{})){if(typeof C==='string'&&p['has'](C))s['add'](C);}}const w=new Map();for(const D of k){const E=w['get'](D['prev'])??[];E['push'](D['target']),w['set'](D['prev'],E);}const x=F=>{const G=new Set([F]),H=[...w['get'](F)??[]];while(H['length']>0x0){const I=H['pop']();if(s['has'](I))return!![];const J=q['get'](I);if(J==='final'||J==='cancelled')return!![];if(G['has'](I))continue;G['add'](I);for(const K of w['get'](I)??[])if(!G['has'](K))H['push'](K);}return![];},y=[];for(const F of c){if(!h['test'](F['name']))continue;const G=k['filter'](H=>H['prev']===F['name']);if(G['length']===0x0||!x(F['name'])){const H=G['filter'](I=>j['test'](I['target']))['map'](I=>'\x27'+I['target']+'\x27');y['push'](H['length']>0x0?F['name']+'\x20(keyword-named\x20target(s)\x20'+H['join'](',\x20')+'\x20reach\x20no\x20refund/settlement\x20rail\x20and\x20no\x20final/cancelled\x20state\x20—\x20the\x20NAME\x20alone\x20is\x20not\x20an\x20exit)':F['name']);}}return y['length']>0x0&&l['push']({'rule_id':'R-INSTALLMENT-DEPOSIT','severity':'high','title':'installment_mode\x20\x27'+b+'\x27\x20holds\x20buyer\x20funds\x20at\x20'+y['map'](I=>'\x27'+I+'\x27')['join'](',\x20')+'\x20with\x20no\x20deposit-exit\x20rail\x20(INV-B2)','detail':'There\x20is\x20no\x20on-chain\x20obligation\x20to\x20pay\x20the\x20balance\x20(H1).\x20A\x20deposit-held\x20state\x20whose\x20only\x20outgoing\x20edges\x20go\x20forward\x20(pay\x20'+'more)\x20strands\x20the\x20already-paid\x20portion\x20when\x20the\x20buyer\x20walks\x20away\x20—\x20Machine\x20+\x20Allocator\x20are\x20immutable\x20(IMMUT-001),\x20so\x20it\x20is\x20'+'a\x20permanent\x20stranding,\x20not\x20a\x20fixable\x20typo.\x20compile\x20hard-blocks\x20this\x20(INSTALLMENT_DEPOSIT_STRANDED);\x20this\x20is\x20the\x20'+'authoring-time\x20twin.','suggestion':'Add\x20a\x20deposit-exit\x20rail\x20from\x20each\x20held\x20state\x20—\x20a\x20refund/cancel\x20forward\x20into\x20an\x20exit\x20node\x20whose\x20allocator\x20returns\x20the\x20held\x20'+'funds\x20to\x20the\x20order\x20payer\x20(GuardIdentifier(0))\x20or\x20applies\x20the\x20declared\x20deposit_exit_policy\x20(full\x20refund\x20vs\x20a\x20kill\x20fee\x20'+'compensating\x20the\x20merchant\x20for\x20the\x20reserved\x20capacity).'}),l;}const CALLER_LEG_TPL_WHITELIST=new Set(['tpl_allocator_node_gate_settle','tpl_allocator_node_gate_settle_nodes','tpl_allocator_node_gate_settle_once','tpl_allocator_settle_band_once','tpl_allocator_prize_settle_once','tpl_allocator_node_gate_settle_tier_small','tpl_allocator_node_gate_settle_tier_large','tpl_allocator_node_gate_refund','tpl_allocator_node_gate_refund_renewal','tpl_allocator_node_gate_claim_settle','tpl_allocator_session_release','tpl_repository_band_gate']);function fundRailUnboundRecipientChecks(a){const b=[],c=new Set((a['allocator']['rows']??[])['filter'](d=>d['track']==='refund'||d['track']==='settlement')['map'](d=>d['guard_key'])['filter'](d=>typeof d==='string'&&d['trim']()!==''));if(c['size']===0x0)return b;for(const d of a['guards']??[]){if(d['host']!=='machine'||!c['has'](d['key']))continue;if(!d['template_id']['startsWith']('tpl_'))continue;if(CALLER_LEG_TPL_WHITELIST['has'](d['template_id']))continue;if(d['identity_leg_exempt'])continue;b['push']({'rule_id':'R-FUND-RAIL-UNBOUND-RECIPIENT','severity':'critical','title':'fund\x20rail\x20\x27'+d['key']+'\x27\x20('+d['template_id']+')\x20pays\x20a\x20fixed\x20recipient\x20with\x20NO\x20caller-authorization\x20leg\x20—\x20any\x20address\x20that\x20satisfies\x20the\x20node/condition\x20legs\x20can\x20fire\x20the\x20payout','detail':'alloc_by_guard\x20has\x20NO\x20chain-side\x20caller\x20check\x20(gf30\x20A2):\x20a\x20refund/recover/settlement\x20rail\x20whose\x20guard\x20ships\x20no\x20'+'signer==order.owner\x20/\x20permission-dynamic\x20/\x20allowlist\x20leg\x20is\x20a\x20PERMISSIONLESS\x20payout\x20on\x20a\x20standing\x20pot\x20—\x20the\x20ks11\x20'+'live\x20incident\x20(an\x20unexpected\x20account\x20swept\x20a\x20merchant-recovery\x20payout).\x20The\x20compile\x20face\x20'+'(RAIL_NO_CALLER_IDENTITY_BOUND)\x20hard-blocks\x20this\x20at\x20build\x20time;\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Re-point\x20the\x20rail\x20at\x20a\x20tpl_*\x20that\x20ships\x20the\x20caller-authorization\x20leg\x20in\x20its\x20root\x20('+[...CALLER_LEG_TPL_WHITELIST]['join'](',\x20')+'),\x20'+'or\x20declare\x20identity_leg_exempt\x20on\x20the\x20spec\x20with\x20the\x20business\x20justification\x20—\x20permissionless\x20entity\x20payouts\x20are\x20never\x20publishable.'});}return b;}function recoverCoversRefundTerminalChecks(a){const b=[],c=new Set((a['machine_shape']??[])['map'](d=>d['name']));for(const d of a['guards']??[]){if(d['host']!=='machine')continue;const e=Object['entries'](d['params']??{}),f=d['template_id']==='tpl_allocator_node_gate_recover'||e['some'](([l])=>/^recover_node/['test'](l));if(!f)continue;const h=e['filter'](([l,m])=>/^recover_node/['test'](l)&&typeof m==='string'&&c['has'](m))['map'](([,k])=>k),j=h['filter'](k=>/^(closed_cancel|cancelled)$/i['test'](k));if(j['length']===0x0)continue;b['push']({'rule_id':'R-RECOVER-COVERS-REFUND-TERMINAL','severity':'critical','title':'recover\x20rail\x20\x27'+d['key']+'\x27\x20covers\x20the\x20buyer\x20refund\x20terminal(s)\x20'+j['map'](k=>'\x27'+k+'\x27')['join'](',\x20')+'\x20—\x20'+'an\x20ALREADY-REFUNDED\x20order\x20can\x20be\x20swept\x20again\x20by\x20the\x20merchant\x20recover\x20rail\x20(C-F01,\x20mainnet\x20ks11\x20live\x20deduction)','detail':'The\x20refund\x20rail\x20is\x20the\x20authorized\x20exit\x20at\x20the\x20buyer\x20refund\x20terminal;\x20the\x20recover\x20twin\x20fires\x20WITHOUT\x20a\x20caller\x20leg\x20'+'(deliberately\x20keeper-reachable),\x20so\x20covering\x20the\x20refund\x20terminal\x20means\x20a\x20refunded\x20order\x27s\x20residual\x20—\x20or\x20a\x20refund\x20'+'the\x20recover\x20rail\x20races\x20—\x20can\x20be\x20re-swept\x20to\x20the\x20merchant\x20entity.\x20Node-gate\x20partition:\x20recover\x20and\x20refund\x20rails\x20'+'must\x20stay\x20disjoint\x20at\x20the\x20buyer\x20refund\x20terminal.','suggestion':'remove\x20the\x20refund\x20terminal\x20from\x20the\x20recover\x20set;\x20the\x20refund\x20rail\x20is\x20the\x20only\x20authorized\x20exit\x20there\x20(C-F01)'});}return b;}function arbVotingGateConstantTrueChecks(a){const b=[],c=(a['guards']??[])['some'](d=>d['host']==='arbitration'&&d['template_id']==='tpl_voting_guard_open_vote');if(!c)return b;return b['push']({'rule_id':'R-ARB-VOTING-GATE-CONSTANT-TRUE','severity':'critical','title':'factory\x20voting\x20gate\x20is\x20an\x20open\x20surface\x20(only\x20the\x20dispute\x20parties\x20excluded)\x20—\x20'+'configure\x20a\x20roster+threshold\x20voting_guard\x20before\x20publishing','detail':'tpl_voting_guard_open_vote\x27s\x20canonical\x20root\x20is\x20the\x20HIS-50\x20three-leg\x20form\x20(always-true\x20core\x20+\x20buyer\x20'+'self-vote\x20exclusion\x20+\x20arb.order==order\x20case\x20pin\x20—\x20mainnet\x2031uLR2nh:\x20under\x20the\x20bare\x20always-true\x20shape\x20a\x20'+'buyer\x20self-voted\x20their\x20own\x20case\x20and\x20the\x20refund\x20swung;\x20the\x20merchant\x20side\x20stays\x20in-expressible\x20in-guard).\x20'+'The\x20mounted\x20surface\x20still\x20admits\x20EVERY\x20non-party\x20passport\x20holder:\x20sanctioned\x20only\x20as\x20the\x20one-click\x20'+'unblocking\x20default\x20(crs9-F-36);\x20a\x20template\x20that\x20'+'mounts\x20it\x20deliberately\x20must\x20say\x20so\x20and\x20should\x20move\x20to\x20a\x20roster\x20form\x20before\x20real\x20disputes\x20arrive.','suggestion':'Declare\x20tpl_voting_guard_party_only\x20(party\x20panel)\x20or\x20tpl_voting_guard_numeric_weight\x20(roster+threshold)\x20instead;\x20'+'at\x20build\x20time\x20pass\x20arbitration_vote_policy:\x27party_panel\x27\x20to\x20opt\x20out\x20of\x20the\x20kernel\x27s\x20open-vote\x20injection\x20entirely.'}),b;}const PROSE_ALL_RAILS_ONCE_RE=/(?<!not |no |never )\b(every|all|each)\b[^.]{0,40}\b(rail|track)\b[^.]{0,80}(255|once)|\barms? (the )?identifier-?255\b/i;function proseBodyOnceChecks(a){const b=[],c=a['allocator']?.['description'],d=[...a['build_notes']??[],...typeof c==='string'?[c]:[]],e=d['filter'](l=>PROSE_ALL_RAILS_ONCE_RE['test'](l));if(e['length']===0x0)return b;const f=[...d,...(a['guards']??[])['map'](l=>l['purpose']??''),...a['differences']??[]]['some'](l=>/refund_renewal|_renewal.*255|renewal-safe/i['test'](l)),g=new Set((a['allocator']['rows']??[])['filter'](l=>l['track']==='refund')['map'](l=>l['guard_key'])['filter'](l=>typeof l==='string'&&l['trim']()!=='')),h=[...new Set((a['guards']??[])['filter'](l=>g['has'](l['key'])&&/refund/i['test'](l['template_id']))['map'](l=>l['template_id']))];if(h['length']===0x0)return b;const j=h['filter'](l=>/_renewal$/['test'](l)||/255/['test'](l)),k=j['length']*0x2>h['length'];if(k||f)return b;return b['push']({'rule_id':'R-PROSE-BODY-ONCE','severity':'high','title':'prose\x20claims\x20X\x20but\x20the\x20guard\x20bodies\x20disagree\x20—\x20fix\x20the\x20prose\x20or\x20the\x20bodies\x20before\x20publish','detail':'The\x20prose\x20declares\x20the\x20identifier-255/once\x20discipline\x20for\x20the\x20rails,\x20but\x20the\x20refund-class\x20guard\x20bodies\x20do\x20NOT\x20carry\x20it\x20'+('in\x20majority:\x20renewal/255-form\x20'+j['length']+'/'+h['length']+'.\x20Claim\x20sentence(s):\x20'+e['map'](l=>'\x27'+l['slice'](0x0,0xa0)+(l['length']>0xa0?'…':'')+'\x27')['join'](';\x20')+'.\x20Actual\x20refund-class\x20guard\x20templates:\x20'+h['join'](',\x20')+'.'),'suggestion':'Either\x20fix\x20the\x20prose\x20to\x20stop\x20claiming\x20the\x20once/255\x20discipline,\x20or\x20re-point\x20the\x20refund-class\x20rails\x20at\x20'+'tpl_allocator_node_gate_refund_renewal\x20(the\x20255\x20epoch\x20form)\x20so\x20the\x20bodies\x20carry\x20what\x20the\x20prose\x20promises.'}),b;}function affiliateModeChecks(a){const b=a['affiliate_mode'];if(b===undefined||b==='none')return[];const c=[],d=/(commission|affiliate|referr|attribut|partner_?payout)/i,e=a['machine_shape']??[],f=e['some'](l=>d['test'](l['name'])),g=a['allocator']?.['rows']??[],h=g['some'](l=>d['test'](l['value_from']??'')||d['test'](l['recipient_key']??''));!f&&!h&&c['push']({'rule_id':'R-AFFILIATE-RAIL','severity':'high','title':'affiliate_mode\x20\x27'+b+'\x27\x20declares\x20a\x20commission\x20overlay\x20with\x20no\x20commission\x20node\x20and\x20no\x20commission\x20allocator\x20row\x20(INV-D3)','detail':'A\x20declared\x20referral/affiliate\x20commission\x20with\x20no\x20rail\x20to\x20walk\x20it\x20is\x20a\x20false\x20promise\x20at\x20quote\x20time.\x20compile\x20hard-blocks\x20this\x20'+'(AFFILIATE_RAIL_MISSING);\x20the\x20scanner\x20surfaces\x20it\x20at\x20authoring\x20time.\x20The\x20commission\x20leg\x20MUST\x20be\x20INDEPENDENT\x20of\x20the\x20goods\x20escrow\x20'+'(anti-grab\x20pool)\x20—\x20that\x20money-safety\x20half\x20rides\x20the\x20generic\x20DUAL-RAIL-01\x20+\x20once/order-anchor\x20audits,\x20not\x20this\x20rule.','suggestion':'Add\x20an\x20INDEPENDENT\x20commission\x20leg:\x20a\x20Rate\x20row\x20off\x20a\x20dedicated\x20commission\x20pool\x20(never\x20a\x20Surplus/Rate\x20drain\x20of\x20the\x20buyer\x27s\x20goods\x20'+'escrow)\x20to\x20an\x20explicit\x20non-empty\x20partner\x20Entity,\x20gated\x20by\x20a\x20window-anchored\x20claim\x20guard\x20(INV-D1\x20rides\x20TIME-ANCHOR-01)\x20so\x20the\x20'+'commission\x20is\x20claimable\x20only\x20after\x20the\x20attribution/refund\x20window\x20closes.\x20Name\x20the\x20node\x20or\x20the\x20row\x20recipient_key/value_from\x20'+'with\x20a\x20commission-family\x20token\x20so\x20the\x20rail\x20is\x20machine-detectable\x20(a\x20free-text\x20note\x20is\x20NOT\x20a\x20detection\x20signal\x20—\x20direct-sales\x20'+'templates\x20carry\x20\x270%\x20commission\x27\x20negation\x20notes).'});const j=/(post-?lock|clawback|unrecoverable|irrevocab|no\s*(?:revers|recov|clawback)|cannot be reversed|once released|released commission)/i,k=(a['build_notes']??[])['some'](l=>j['test'](l));return!k&&c['push']({'rule_id':'R-AFFILIATE-DISCLOSURE','severity':'high','title':'affiliate_mode\x20\x27'+b+'\x27\x20has\x20no\x20build_note\x20disclosing\x20the\x20post-lock\x20no-clawback\x20truth\x20(INV-D2)','detail':'SOLE\x20TRUTH:\x20Allocation\x20distribute\x20is\x20a\x20ONE-WAY\x20outflow\x20(no\x20debit/clawback\x20primitive,\x20§11.0\x20G2),\x20so\x20once\x20a\x20commission\x20is\x20RELEASED\x20it\x20'+'CANNOT\x20be\x20reversed\x20on\x20chain\x20—\x20a\x20refund/chargeback\x20after\x20the\x20attribution\x20window\x20leaves\x20the\x20affiliate\x20commission\x20unrecoverable.\x20A\x20'+'template\x20that\x20declares\x20the\x20overlay\x20without\x20disclosing\x20this\x20implies\x20a\x20recovery\x20capability\x20the\x20chain\x20does\x20not\x20have\x20(L-04/D-5).\x20'+'compile\x20hard-blocks\x20it\x20(AFFILIATE_CLAWBACK_UNDISCLOSED);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Add\x20a\x20build_note\x20stating\x20the\x20post-lock\x20truth\x20honestly,\x20e.g.\x20\x22post-lock:\x20a\x20released\x20affiliate\x20commission\x20is\x20unrecoverable\x20/\x20'+'Non-recoverable\x20—\x20refunds\x20after\x20the\x20attribution\x20window\x20do\x20NOT\x20claw\x20back\x20the\x20partner\x20payout.\x22\x20Pair\x20with\x20the\x20INV-D1\x20window\x20anchor\x20so\x20the\x20'+'commission\x20is\x20only\x20claimable\x20once\x20the\x20refund\x20window\x20has\x20closed,\x20minimizing\x20the\x20unrecoverable\x20surface.'}),c;}function crowdfundingModeChecks(a){const b=a['crowdfunding_mode'];if(b===undefined||b==='none')return[];const c=[],d=/(releas|settle|funded|disburs|project)/i,f=/(refund|missed|unmet|return|reimburse)/i,g=a['machine_shape']??[],h=a['allocator']?.['rows']??[],j=g['some'](E=>d['test'](E['name'])),k=h['some'](E=>E['track']==='settlement'&&(d['test'](E['guard_key']??'')||d['test'](E['recipient_key']??''))),l=g['some'](E=>f['test'](E['name'])),n=h['some'](E=>E['track']==='refund'||f['test'](E['guard_key']??''));!j&&!k&&c['push']({'rule_id':'R-CROWDFUNDING-RAIL','severity':'high','title':'crowdfunding_mode\x20\x27'+b+'\x27\x20declares\x20a\x20campaign\x20with\x20no\x20release/settlement\x20node\x20and\x20no\x20settlement\x20allocator\x20row\x20(INV-E1)','detail':'A\x20declared\x20campaign\x20with\x20no\x20exit\x20rail\x20strands\x20the\x20escrowed\x20contributions\x20at\x20the\x20deadline.\x20compile\x20hard-blocks\x20this\x20'+'(CROWDFUNDING_THRESHOLD_GATE_MISSING);\x20the\x20scanner\x20surfaces\x20it\x20at\x20authoring\x20time.\x20The\x20money-safety\x20half\x20(node-gated\x20'+'fund\x20rails\x20with\x20NO\x20claimed_by\x20leg,\x20decision\x2011)\x20rides\x20the\x20generic\x20DUAL-RAIL-01\x20+\x20R-FUND-RAIL-CLAIMED-BY\x20audits,\x20not\x20this\x20rule.','suggestion':'Add\x20a\x20release\x20leg:\x20a\x20Rate\x2010000\x20row\x20to\x20a\x20NON-EMPTY\x20project\x20Entity,\x20gated\x20at\x20the\x20campaign-deadline\x20settlement\x20terminal.\x20Name\x20'+'the\x20node\x20or\x20the\x20row\x20guard_key/recipient_key\x20with\x20a\x20release-family\x20token\x20so\x20the\x20rail\x20is\x20machine-detectable\x20(a\x20free-text\x20note\x20'+'is\x20NOT\x20a\x20detection\x20signal).'});b==='threshold'&&!l&&!n&&c['push']({'rule_id':'R-CROWDFUNDING-RAIL','severity':'high','title':'crowdfunding_mode\x20\x27threshold\x27\x20declares\x20an\x20all-or-nothing\x20campaign\x20with\x20no\x20refund-family\x20node/row\x20(INV-E1\x20/\x20D-BUG-2)','detail':'A\x20missed\x20goal\x20would\x20strand\x20every\x20contribution\x20instead\x20of\x20returning\x20it.\x20compile\x20hard-blocks\x20this\x20'+'(CROWDFUNDING_THRESHOLD_GATE_MISSING).\x20The\x20release\x20and\x20refund\x20legs\x20are\x20mutually\x20exclusive\x20on\x20the\x20same\x20aggregate\x20'+'(D-BUG-2\x20escrow-exit\x20polarity):\x20aggregate\x20>=\x20goal\x20→\x20release;\x20aggregate\x20<\x20goal\x20→\x20refund.','suggestion':'Add\x20the\x20refund\x20leg\x20as\x20the\x20release\x20leg\x27s\x20escrow-exit\x20twin:\x20a\x20per-contributor\x20refund\x20row\x20(order-anchored\x20user\x20slot\x200\x20—\x20'+'the\x20submitted\x20Order,\x20extracted\x20by\x20the\x20Order\x27s\x20owner-claim\x20entry;\x20NEVER\x20slot\x20254\x20on\x20a\x20refund\x20rail:\x20254\x20is\x20the\x20ONCE-FOR-OBJECT\x20slot,\x20'+'so\x20a\x20refund\x20node\x20re-entered\x20in\x20a\x20later\x20period\x20aborts\x20E_ONCE_TRIGGERED(16),\x20OFN\x20#P-04;\x20node-gated\x20at\x20the\x20refund\x20terminal,\x20'+'decision\x2011\x20—\x20NEVER\x20a\x20claimed_by\x20leg,\x20R-FUND-RAIL-CLAIMED-BY\x20critical)\x20on\x20a\x20\x27refund\x27\x20'+'track\x20or\x20a\x20refund-family\x20guard_key,\x20plus\x20a\x20terminal-node-gated\x20recover_gate\x20rail\x20(tpl_allocator_node_gate_recover)\x20so\x20an\x20'+'arbitration-awarded\x20order\x27s\x20residual\x20still\x20exits.'});const o=g['find'](E=>(E['from']??[])['some'](F=>typeof F!=='string'&&F['prev']===''))?.['name'],p=[];for(const E of g){if(!/cancel/i['test'](E['name'])||E['semantic_role']!=='cancelled')continue;for(const F of E['from']??[]){if(typeof F==='string')continue;if(F['operator']!=='order_payer')continue;if(o!==undefined&&F['prev']===o)continue;p['push']((F['prev']||'(entry)')+'\x20--'+(F['forward']??'advance')+'-->\x20'+E['name']);}}p['length']>0x0&&c['push']({'rule_id':'R-CROWDFUNDING-CANCEL-RAIL','severity':'high','title':'crowdfunding_mode\x20\x27'+b+'\x27\x20anchors\x20a\x20buyer-cancel\x20rail\x20AFTER\x20the\x20pledge\x20entry\x20('+p['length']+'\x20edge(s):\x20'+p['join'](',\x20')+')\x20—\x20post-goal\x20escrow\x20drain\x20(ksr-tn-261026\x20Q8-F02)','detail':'The\x20campaign\x20goal\x20is\x20a\x20commitment\x20snapshot\x20taken\x20at\x20the\x20deadline:\x20once\x20the\x20goal\x20decision\x20passes,\x20a\x20backer\x20can\x20no\x20longer\x20'+'cancel\x20their\x20pledge.\x20In\x20a\x20threshold\x20campaign\x20every\x20node\x20below\x20the\x20entry\x20is\x20reachable\x20only\x20AFTER\x20the\x20deadline\x20(the\x20goal\x20'+'decision\x20requires\x20Clock\x20>=\x20deadline),\x20so\x20an\x20order_payer\x20cancel\x20edge\x20from\x20a\x20non-entry\x20prev\x20opens\x20a\x2030-day-style\x20'+'hist(<goal-node>)+N\x20drain\x20window\x20on\x20an\x20already-met\x20campaign\x20—\x20the\x20project\x20schedules\x20production\x20against\x20a\x20total\x20the\x20'+'backer\x20can\x20then\x20claw\x20back.\x20This\x20is\x20the\x20exact\x20face\x20the\x20ksr-tn-261026\x20run\x20proved\x20live\x20(CancelPledge\x20after\x20funded_released\x20'+'moved\x200.05\x20WOW\x20of\x20escrow\x20back\x20to\x20the\x20backer).','suggestion':'Remove\x20the\x20post-goal\x20cancel\x20rail\x20(node\x20+\x20forwards\x20+\x20its\x20refund\x20allocator\x20row).\x20Keep\x20ONE\x20buyer-cancellation\x20path:\x20the\x20'+'PRE-DEADLINE\x20withdrawal\x20from\x20the\x20entry\x20node,\x20gated\x20by\x20lte(context(Clock),\x20identifier[N](campaign_deadline_ms))\x20—\x20the\x20'+'ABSOLUTE\x20shared\x20deadline,\x20the\x20ksrq8-g-withdraw\x20form.\x20After\x20the\x20goal\x20decision\x20the\x20buyer\x27s\x20only\x20remedies\x20are\x20the\x20'+'post-delivery\x20return\x20rail\x20and\x20arbitration.\x20If\x20a\x20variant\x20genuinely\x20needs\x20a\x20cooling-off\x20window,\x20anchor\x20it\x20at\x20'+'min(deadline,\x20release+24h)\x20and\x20disclose\x20it\x20—\x20never\x20a\x20default\x20post-goal\x20window.'});const q=[];for(const G of g){for(const H of G['from']??[]){if(typeof H==='string')continue;if(!/cancel/i['test'](H['forward']??''))continue;const I=H['operator']==='merchant'||typeof H['permission_index']==='number';if(!I)continue;if(!f['test'](G['name'])&&G['semantic_role']!=='cancelled')continue;q['push']((H['prev']||'(entry)')+'\x20--'+(H['forward']??'cancel')+'-->\x20'+G['name']);}}q['length']===0x0&&c['push']({'rule_id':'R-CROWD-CANCEL-NO-RAIL','severity':'high','title':'crowdfunding_mode\x20\x27'+b+'\x27\x20declares\x20a\x20campaign\x20with\x20no\x20permission-gated\x20organizer-cancel\x20rail\x20(batch7\x20T-L)','detail':'Every\x20shipped\x20crowdfunding\x20archetype\x20carries\x20a\x20CREATOR-side\x20cancel\x20rail\x20(CancelCampaign\x20/\x20CancelByLeader,\x20'+'merchant\x20on\x20the\x20dedicated\x20refund-rail\x20slot\x201001,\x20tpl_forward_node_check\x20on\x20the\x20source)\x20that\x20refunds\x20still-escrowed\x20'+'pledges\x20IN\x20FULL\x20through\x20the\x20SAME\x20node-gated\x20refund\x20rail\x20—\x20an\x20absent\x20creator\x20can\x20no\x20longer\x20let\x20the\x20settle_clock\x20'+'auto-release\x20pay\x20an\x20absent\x20project\x20(INV-KTT-LEADERCANCEL)\x20and\x20a\x20backer\x20is\x20never\x20trapped\x20waiting\x20for\x20the\x20creator\x20'+'to\x20act.\x20The\x20rail\x20pays\x20the\x20BACKER\x20(slot\x200),\x20so\x20the\x20creator\x20gains\x20nothing\x20by\x20cancelling\x20—\x20no\x20Q8-F02\x20drain\x20'+'(the\x20buyer-side\x20post-goal\x20cancel\x20face\x20stays\x20covered\x20by\x20R-CROWDFUNDING-CANCEL-RAIL).','suggestion':'Mount\x20an\x20organizer-cancel\x20forward\x20from\x20the\x20campaign\x27s\x20entry/active\x20node(s)\x20into\x20the\x20refund\x20terminal:\x20forward\x20'+'CancelCampaign\x20(or\x20CancelByLeader\x20post-goal),\x20operator\x20merchant\x20+\x20permission_index\x201001\x20(the\x20refund\x20rail,\x20never\x20'+'the\x20settle\x20bucket,\x20W5-14),\x20guard\x20tpl_forward_node_check\x20{\x20expected_node:\x20<source>\x20},\x20landing\x20in\x20the\x20EXISTING\x20'+'node-gated\x20refund\x20terminal\x20—\x20an\x20equivalent\x20exit,\x20not\x20a\x20new\x20refund\x20channel.\x20Mount\x20post-goal\x20exits\x20wherever\x20an\x20'+'active\x20node\x20auto-releases\x20to\x20the\x20project\x20(funded_released\x20/\x20fulfilling),\x20so\x20an\x20absent\x20creator\x20cannot\x20collect.'});if(b==='threshold'){const J=a['guards']??[],K=J['filter'](N=>N['host']==='repository'||/repository_write/i['test'](N['template_id'])),L=K['length']>0x0,M=K['some'](N=>{const O=(N['policy']?.['id_from']??'')['toLowerCase']();return O==='signer'||O==='clock';});if(!L)c['push']({'rule_id':'R-CROWDFUNDING-AGGREGATE','severity':'high','title':'crowdfunding_mode\x20\x27threshold\x27\x20gates\x20release\x20on\x20an\x20aggregate\x20with\x20no\x20write-bound\x20Repository\x20policy\x20(INV-E2)','detail':'The\x20threshold\x20total\x20is\x20an\x20escrow-bound\x20repository\x20sum\x20(query\x201179\x20→\x20U256,\x20per-row\x20min(row,\x20order.amount,\x20LIVE\x20allocation.balance)\x20—\x20v140\x20live\x20cap)\x20over\x20'+'ORDER-keyed\x20contribution\x20rows.\x20With\x20NO\x20write-bound\x20policy\x20the\x20rows\x20are\x20unauthenticated\x20—\x20anyone\x20could\x20inflate\x20'+'the\x20total\x20and\x20fake\x20a\x20\x27goal\x20met\x27\x20(R-X1-17\x20existence-is-not-trust).\x20compile\x20hard-blocks\x20it\x20'+'(CROWDFUNDING_AGGREGATE_UNBOUND);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Mount\x20a\x20host:\x22repository\x22\x20guard\x20resolving\x20pattern.repository_write_authorization\x20with\x20an\x20identity\x20write_guard\x20'+'(order.owner==Signer\x20/\x20order.agent\x20has\x20Signer)\x20and\x20key\x20the\x20contribution\x20rows\x20by\x20the\x20funder\x27s\x20ORDER\x20(policy\x20'+'id_from\x20unset;\x20row\x20id\x20=\x20the\x20Order\x20address).\x20The\x20on-chain\x20policy\x20store\x20only\x20asserts\x20the\x20write_guard\x20LIST\x20is\x20non-empty\x20'+'(E_POLICY_WRITE_GUARD_REQUIRED=22),\x20never\x20what\x20a\x20listed\x20guard\x20proves\x20—\x20a\x20placeholder\x20that\x20returns\x20true\x20is\x20an\x20'+'OPEN\x20write.'});else{if(M){const N=K['filter'](O=>{const P=(O['policy']?.['id_from']??'')['toLowerCase']();return P==='signer'||P==='clock';})['map'](O=>'\x27'+O['key']+'\x27')['join'](',\x20');c['push']({'rule_id':'R-CROWDFUNDING-AGGREGATE','severity':'high','title':'crowdfunding_mode\x20\x27threshold\x27\x20keys\x20contribution\x20rows\x20by\x20the\x20WALLET\x20(id_from\x20signer/clock)\x20on\x20'+N+'\x20—\x20the\x20pre-migration\x20shape\x20(INV-E2,\x20ksc-tn-261024\x20F-01/F-05)','detail':'Wallet-keyed\x20rows\x20feed\x20the\x20escrow-bound\x20sum\x20(query\x201179,\x20per-row\x20min(row,\x20order.amount,\x20LIVE\x20allocation.balance\x20—\x20v140\x20live\x20cap))\x20ZERO\x20—\x20the\x20goal\x20gate\x20'+'silently\x20bricks\x20—\x20and\x20the\x20free-form\x20sum-where\x20(1174)\x20stays\x20self-reported,\x20so\x20a\x20backer\x20can\x20record\x201.0\x20for\x20a\x200.1\x20'+'pledge.\x20compile\x20hard-blocks\x20it\x20(CROWDFUNDING_SIGNER_KEYED_ROWS);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Key\x20the\x20contribution\x20rows\x20by\x20the\x20funder\x27s\x20ORDER:\x20policy\x20id_from\x20unset,\x20the\x20backer\x27s\x20tooling\x20submits\x20the\x20row\x20id\x20=\x20'+'their\x20Order\x20address\x20through\x20the\x20passport-bearing\x20data\x20write,\x20and\x20the\x20gate\x20passes\x20those\x20ORDER\x20addresses\x20as\x20the\x20aggregate\x27s\x20'+'candidate\x20ids.\x20Pair\x20the\x20gate\x20with\x20the\x20live-escrow\x20leg\x20(allocation.balance\x20query\x201051\x20via\x20convert_witness\x20'+'OrderAllocation\x20109,\x20>=\x20order.amount)\x20so\x20a\x20refunded/never-funded\x20order\x20can\x20neither\x20count\x20toward\x20the\x20goal\x20nor\x20be\x20'+'settled.\x20The\x20withdrawal\x20flow\x20should\x20still\x20ZERO\x20the\x20row\x20value\x20(an\x20upsert\x20of\x200\x20through\x20the\x20same\x20write\x20guard)\x20so\x20the\x20'+'valueMin:1\x20aggregate\x20predicate\x20stops\x20counting\x20it\x20—\x20v140\x20live\x20cap\x20already\x20zeroes\x20a\x20drained\x20row\x27s\x20contribution\x20on\x20'+'chain,\x20so\x20zeroing\x20is\x20attestation\x20hygiene,\x20not\x20correctness.'});}}}const s=a['build_notes']??[],w=/(attest|keeper|aggregate trust|read-?only sum|not a chain-?verified|independent recomputation)/i,x=/(not investment|non-?investment|no (?:investment )?return|never promise)/i,y=/(kyc|aml|securities|money-?transmission|regulatory|cross-border|compliance)/i,z=/(no-?refund|non-?refundable|keep-?it-?all)/i,A=[];if(b==='threshold'&&!s['some'](O=>w['test'](O)))A['push']('the\x20aggregate-trust\x20boundary\x20(the\x20funding\x20total\x20is\x20a\x20keeper-attested\x20Repository\x20sum,\x20NOT\x20a\x20chain-verified\x20money\x20oracle)');if(!s['some'](O=>x['test'](O)))A['push']('the\x20L-01\x20non-investment\x20statement\x20(never\x20promise\x20returns\x20/\x20promote\x20coin\x20price;\x20not\x20investment\x20advice\x20or\x20a\x20return\x20promise)');if(!s['some'](O=>y['test'](O)))A['push']('the\x20L-05\x20KYC/AML\x20+\x20cross-border\x20regulatory\x20caution\x20(HIGH\x20intensity)');if(b==='flexible'&&!s['some'](O=>z['test'](O)))A['push']('the\x20flexible\x20keep-it-all\x20NO-REFUND\x20posture\x20(contributions\x20non-refundable\x20once\x20the\x20deadline\x20passes;\x20no\x20refunds)');A['length']>0x0&&c['push']({'rule_id':'R-CROWDFUNDING-DISCLOSURE','severity':'high','title':'crowdfunding_mode\x20\x27'+b+'\x27\x20has\x20build_notes\x20missing\x20honest\x20disclosure(s):\x20'+A['length']+'\x20(INV-E3)','detail':'Missing:\x20'+A['join'](';\x20')+'.\x20A\x20campaign\x20that\x20declares\x20the\x20overlay\x20without\x20these\x20disclosures\x20implies\x20a\x20chain-verified\x20'+'custody\x20proof,\x20an\x20investment\x20return,\x20or\x20a\x20refund\x20the\x20model\x20does\x20not\x20have\x20(L-04/L-01/L-05).\x20compile\x20hard-blocks\x20it\x20'+'(CROWDFUNDING_DISCLOSURE_MISSING);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Add\x20build_notes\x20stating\x20each\x20honestly:\x20the\x20aggregate\x20is\x20a\x20read-only\x20sum\x20over\x20keeper-attested\x20writer-bound\x20rows\x20(not\x20an\x20'+'independent\x20re-computation\x20of\x20every\x20escrow\x20balance);\x20a\x20threshold/flexible\x20raise\x20is\x20NOT\x20an\x20investment\x20(never\x20promise\x20returns\x20or\x20'+'promote\x20coin\x20price);\x20pooled\x20cross-border\x20fundraising\x20is\x20HIGH\x20regulatory\x20intensity\x20(KYC/AML);\x20and\x20for\x20a\x20flexible\x20model,\x20'+'contributions\x20are\x20non-refundable\x20once\x20the\x20deadline\x20passes.'});const B=[...(a['machine_shape']??[])['map'](O=>(O['role']??'')+'\x20'+(O['from']??[])['map'](P=>typeof P==='string'?P:'')['join']('\x20')),...(a['guards']??[])['map'](O=>O['purpose']??''),...a['build_notes']??[],...a['trust_mechanisms']??[],...a['keeper_dependencies']??[],...(a['keeper_duty']??[])['map'](O=>(O['when']??'')+'\x20'+(O['action']??'')),a['allocator']?.['description']??'',a['key_risk']??'']['join']('\x0a'),C=/sum-where|sum_where|1179|1174|escrow-bound aggregate/i['test'](B),D=/1181|sum_where_bound_all|sum-where-BOUND-ALL|ALL-MODE|all-mode/i['test'](B);return b==='threshold'&&C&&!D&&c['push']({'rule_id':'R-ROSTER-IDS-AGGREGATE','severity':'medium','title':'crowdfunding_mode\x20\x27threshold\x27\x20aggregates\x20over\x20a\x20SUBMITTER-controlled\x20candidate\x20roster\x20(1179/1174\x20+\x20b_submission\x20ids)\x20—\x20migrate\x20to\x20the\x20v141\x20ALL-MODE\x20aggregate\x20(ks13\x20ROSTER-01,\x20INV-E4)','detail':'The\x20sum-where\x20forms\x20(query\x201174\x20self-reported\x20/\x201179\x20escrow-bound)\x20read\x20a\x20caller-supplied\x20candidate-ids\x20list\x20'+'(b_submission\x20VecAddress\x20replaced\x20by\x20submission\x20bytes\x20at\x20forward\x20time):\x20whoever\x20advances\x20the\x20gate\x20controls\x20the\x20'+'roster\x20and\x20can\x20understate\x20the\x20raise\x20by\x20omitting\x20live\x20rows\x20—\x20an\x20order_payer\x20abandon\x20edge\x20lets\x20a\x20backer\x20abandon\x20a\x20'+'genuinely\x20funded\x20campaign\x20(the\x20ks13\x20ROSTER-01\x20face).\x20The\x20v141\x20ALL-MODE\x20aggregate\x20(query\x201181,\x20'+'query_repository_data_sum_where_bound_all)\x20derives\x20the\x20candidate\x20set\x20on-chain\x20from\x20the\x20per-key\x20RowRosterKey\x20'+'roster\x20the\x20framework\x20maintains\x20at\x20every\x20data\x20write\x20—\x20omission\x20is\x20structurally\x20impossible\x20and\x20the\x20W5-04\x20pin\x20'+'retires\x20with\x20the\x20ids\x20leg.','suggestion':'Migrate\x20the\x20aggregate\x20leg\x20to\x20query_repository_data_sum_where_bound_all\x20(query\x201181):\x20drop\x20the\x20ids\x20table\x20row\x20and\x20'+'the\x20vec_contains_address\x20pin,\x20keep\x20the\x20per-row\x20clamp\x20and\x20the\x20live-escrow\x20leg.\x20Disclose\x20the\x20three\x20boundaries:\x20'+'VERSION\x20PREREQUISITE\x20(enable_repository_data_sum_bound_all,\x20protocol\x20v141\x20—\x20the\x20query\x20aborts\x20fail-closed\x20while\x20'+'the\x20flag\x20is\x20off),\x20ROSTER\x20CAP\x20(>100\x20rows\x20per\x20key\x20aborts\x20fail-closed),\x20PRE-FLAG\x20ROWS\x20(rows\x20written\x20before\x20the\x20'+'roster\x20shipped\x20contribute\x200\x20—\x20an\x20understate,\x20never\x20an\x20overstate).'}),D&&!(/enable_repository_data_sum_bound_all/i['test'](B)&&/v141|protocol\s+v?141/i['test'](B))&&c['push']({'rule_id':'R-ALLMODE-VERSION-DISCLOSURE','severity':'critical','title':'template\x20references\x20the\x201181\x20ALL-MODE\x20aggregate\x20without\x20disclosing\x20the\x20flag\x20prerequisite\x20(enable_repository_data_sum_bound_all\x20/\x20protocol\x20v141)\x20(INV-E5)','detail':'query\x201181\x20(sum_where_bound_all)\x20is\x20flag-gated:\x20on\x20any\x20binary\x20with\x20enable_repository_data_sum_bound_all\x20OFF\x20'+'(pre-v141\x20protocol)\x20the\x20query\x20ABORTS\x20—\x20every\x20gate\x20built\x20on\x20it\x20fails\x20closed\x20at\x20runtime.\x20A\x20template\x20that\x20'+'references\x20the\x20all-mode\x20aggregate\x20without\x20the\x20version-prerequisite\x20disclosure\x20ships\x20a\x20settlement\x20brick\x20that\x20'+'no\x20authoring-time\x20check\x20catches.','suggestion':'State\x20the\x20prerequisite\x20in\x20the\x20template\x20prose\x20(guard\x20purpose,\x20machine\x20role,\x20build_notes\x20or\x20trust_mechanisms):\x20'+'\x27the\x201181\x20all-mode\x20aggregate\x20is\x20gated\x20by\x20enable_repository_data_sum_bound_all\x20(protocol\x20v141)\x20and\x20aborts\x20'+'fail-closed\x20while\x20the\x20flag\x20is\x20off\x20—\x20verify\x20build_stamp.chain_stamp\x20via\x20upgrade_check\x20before\x20shipping\x27,\x20plus\x20'+'the\x20roster-cap\x20(>100\x20rows\x20per\x20key\x20aborts)\x20and\x20pre-flag-rows\x20(contribute\x200)\x20boundaries.'}),c;}function logisticsModeChecks(a){const b=a['logistics_mode'];if(b===undefined||b==='none')return[];const c=[],d=a['machine_shape']??[],e=d['some'](g=>g['named_operator']!==undefined||(g['from']??[])['some'](h=>typeof h!=='string'&&h['named_operator']!==undefined)),f=a['allocator']?.['rows']??[];if(b==='courier'){if(!e)c['push']({'rule_id':'R-LOGISTICS-COURIER','severity':'high','title':'logistics_mode\x20\x27courier\x27\x20declares\x20dispatched\x20riders\x20with\x20no\x20named_operator\x20handover\x20rail','detail':'A\x20dispatched\x20rider\x20is\x20NEITHER\x20a\x20permission\x20entity\x20NOR\x20the\x20buyer\x20—\x20the\x20only\x20forward\x20they\x20can\x20ever\x20pass\x20is\x20a\x20'+'namedOperator\x20roster\x20rail\x20(roster\x20written\x20per\x20order\x20by\x20the\x20dispatch\x20keeper\x20via\x20permission\x20index\x20221).\x20compile\x20'+'hard-blocks\x20the\x20missing\x20rail\x20(LOGISTICS_COURIER_RAIL_MISSING);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Bind\x20the\x20handover\x20forwards\x20(merchant→courier\x20pickup,\x20courier→buyer\x20drop-off)\x20with\x20named_operator\x20\x27<namespace>\x27\x20'+'and\x20disclose\x20the\x20roster\x20duty\x20in\x20a\x20build_note.\x20For\x20EXCLUSIVE\x20admission\x20—\x20non-roster\x20addresses\x20actually\x20BARRED,\x20not\x20'+'merely\x20members\x20authorized\x20—\x20also\x20mount\x20the\x20kernel\x20roster-membership\x20predicate\x20(query\x201575,\x20protocol\x20v138\x20flag)\x20on\x20'+'both\x20handover\x20edges\x20(template\x20tpl_forward_roster_member_gate);\x20the\x20rail\x20alone\x20AUTHORIZES\x20without\x20denying.\x20Also\x20keep\x20'+'the\x20delivery\x20fee\x20OFF\x20the\x20goods\x20pool:\x20a\x20SURPLUS\x20row\x20in\x20a\x20delivery-fee\x20family\x20drains\x20the\x20buyer\x27s\x20escrow\x20(compile\x20'+'LOGISTICS_COURIER_FEE_POOLED)\x20—\x20use\x20an\x20independent\x20Amount/Rate\x20leg\x20(the\x20fee\x20is\x20known\x20at\x20order\x20time).'});else{const g=/(deliver|courier|shipping|freight|ride|dispatch|logistic)/i,h=f['some'](j=>j['mode']==='surplus'&&g['test']((j['value_from']??'')+'\x20'+(j['recipient_key']??'')));h&&c['push']({'rule_id':'R-LOGISTICS-COURIER','severity':'high','title':'logistics_mode\x20\x27courier\x27\x20has\x20a\x20delivery-fee\x20SURPLUS\x20row\x20draining\x20the\x20goods\x20pool','detail':'A\x20surplus\x20leg\x20takes\x20the\x20remainder\x20of\x20the\x20pool\x20it\x20hangs\x20on\x20—\x20for\x20a\x20courier\x20build\x20that\x20pool\x20IS\x20the\x20buyer\x27s\x20goods\x20'+'escrow\x20(the\x20grab-pool\x20shape\x20the\x20affiliate\x20INV-D3\x20family\x20bans).\x20compile\x20hard-blocks\x20it\x20'+'(LOGISTICS_COURIER_FEE_POOLED);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Make\x20the\x20delivery\x20fee\x20an\x20INDEPENDENT\x20leg:\x20a\x20fixed\x20Amount\x20row\x20(the\x20buyer\x20sees\x20and\x20pays\x20the\x20fee\x20before\x20dispatch)\x20'+'or\x20a\x20Rate\x20row\x20off\x20a\x20dedicated\x20delivery-fee\x20pool\x20funded\x20separately\x20—\x20never\x20a\x20Surplus\x20drain\x20of\x20the\x20goods\x20pool.'});}}if(b==='pickup_point'){const j=(a['guards']??[])['some'](l=>l['template_id']==='pattern.time_lock_absolute'||l['template_id']==='tpl_time_lock_absolute_ms'),k=(a['guards']??[])['some'](l=>l['template_id']==='pattern.time_window_upper_bound'||l['template_id']==='tpl_time_window_upper'||l['template_id']==='tpl_time_window_upper_absolute_ms');(!j||!k)&&c['push']({'rule_id':'R-LOGISTICS-CUTOFF','severity':'high','title':'logistics_mode\x20\x27pickup_point\x27\x20is\x20missing\x20'+(!j?'the\x20absolute\x20batch-cutoff\x20gate':'')+(!j&&!k?'\x20and\x20':'')+(!k?'the\x20unclaimed-goods\x20exit\x20window':''),'detail':'Consolidation\x20batch\x20semantics\x20need\x20BOTH:\x20releases\x20anchor\x20on\x20the\x20SAME\x20shared\x20cutoff\x20clock\x20(per-order\x20entry+duration\x20'+'is\x20not\x20a\x20batch),\x20and\x20goods\x20never\x20picked\x20up\x20must\x20refund/return\x20at\x20a\x20bounded\x20deadline\x20(never\x20hold\x20open-ended).\x20compile\x20'+'hard-blocks\x20it\x20(LOGISTICS_PICKUP_CUTOFF_MISSING);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Add\x20a\x20pattern.time_lock_absolute\x20guard\x20on\x20the\x20batch\x20release\x20forward\x20AND\x20a\x20pattern.time_window_upper_bound\x20guard\x20on\x20'+'the\x20unclaimed-goods\x20refund/return\x20exit.'});}if(b==='carrier'){const l=/(track|shipping evidence|waybill|airbill|carrier record|parcel evidence)/i,m=(a['guards']??[])['some'](n=>n['host']==='machine'&&l['test']((n['key']??'')+'\x20'+n['purpose']));!m&&c['push']({'rule_id':'R-LOGISTICS-EVIDENCE','severity':'high','title':'logistics_mode\x20\x27carrier\x27\x20binds\x20no\x20shipping/tracking\x20evidence\x20guard','detail':'A\x20carrier\x20shipment\x20with\x20no\x20evidence\x20binding\x20has\x20no\x20dispute-ready\x20record\x20of\x20what\x20was\x20shipped\x20and\x20when.\x20The\x20retail\x20'+'idiom\x20(a\x20tracking-hash\x20repository_data_check\x20on\x20the\x20ship\x20forward,\x20written\x20by\x20an\x20authorized\x20writer)\x20is\x20the\x20MANDATORY\x20'+'floor.\x20compile\x20hard-blocks\x20it\x20(LOGISTICS_CARRIER_EVIDENCE_MISSING);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Add\x20a\x20pattern.repository_data_check\x20guard\x20on\x20the\x20ship\x20forward\x20keyed\x20to\x20a\x20tracking-hash\x20row;\x20pair\x20it\x20with\x20'+'pattern.repository_write_authorization\x20so\x20a\x20counterparty\x20cannot\x20pre-write\x20the\x20tracking\x20row.'});}{const n=/(lost|loss|damag|theft)/i,o=w=>w['replace'](/permanently lost/gi,''),p=/(transit loss|lost (?:parcel|package|goods|in transit)|in[- ]transit loss|carrier lost|loss (?:is |)remed|loss route|lost shipment)/i,q=d['some'](w=>n['test'](w['name'])||n['test'](w['role']))||(a['guards']??[])['some'](w=>w['host']==='machine'&&n['test'](o((w['key']??'')+'\x20'+w['purpose']))),s=(a['build_notes']??[])['some'](w=>p['test'](w));!q&&!s&&c['push']({'rule_id':'R-LOGISTICS-TRANSIT','severity':'high','title':'logistics_mode\x20\x27'+b+'\x27\x20has\x20no\x20in-transit\x20loss\x20rail\x20and\x20no\x20loss-remedy\x20disclosure','detail':'Goods\x20can\x20be\x20lost\x20or\x20damaged\x20between\x20handover\x20and\x20acceptance\x20in\x20EVERY\x20physical\x20mode\x20—\x20silence\x20means\x20the\x20buyer\x27s\x20funds\x20'+'strand\x20behind\x20an\x20undeliverable\x20order\x20with\x20no\x20taught\x20route\x20(the\x20STOP-NODE-FUND-EXIT-COVERAGE\x20logistics\x20specialization).\x20'+'compile\x20hard-blocks\x20it\x20(LOGISTICS_TRANSIT_LOSS_UNCOVERED);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Either\x20express\x20the\x20loss\x20waypoint\x20(a\x20lost-parcel\x20record\x20node,\x20or\x20a\x20loss-evidence\x20machine\x20guard)\x20or\x20add\x20a\x20build_note\x20'+'disclosing\x20the\x20remedy\x20route\x20(e.g.\x20the\x20buyer\x27s\x20arbitration\x20path\x20into\x20the\x20refund\x20rail;\x20the\x20carrier\x20claim\x20is\x20an\x20'+'off-chain\x20recovery).'});}if(b==='courier'||b==='pickup_point'){const w=/(dispatch|schedul|no.{0,24}oracle|no on-chain.{0,24}(dispatch|scheduler)|off-chain keeper|keeper.{0,40}dispatch|roster|named.?operator|permission.{0,12}221)/i,x=(a['build_notes']??[])['some'](y=>w['test'](y));!x&&c['push']({'rule_id':'R-LOGISTICS-DISCLOSURE','severity':'high','title':'logistics_mode\x20\x27'+b+'\x27\x20discloses\x20neither\x20dispatch\x20boundary','detail':'The\x20chain\x20has\x20NO\x20dispatch/scheduling\x20primitive\x20(dispatch\x20is\x20an\x20OFF-CHAIN\x20keeper\x20duty;\x20the\x20roster\x20rides\x20permission\x20'+'index\x20221)\x20and\x20NO\x20distance/weight/weather\x20oracle\x20(ETA,\x20route,\x20and\x20dynamic\x20pricing\x20are\x20NOT\x20chain-verifiable).\x20'+'Undisclosed,\x20a\x20builder\x20assumes\x20on-chain\x20dispatch\x20exists\x20and\x20designs\x20a\x20silent\x20brick.\x20compile\x20hard-blocks\x20it\x20'+'(LOGISTICS_DISPATCH_UNDISCLOSED);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Add\x20a\x20build_note\x20stating\x20WHO\x20dispatches\x20(the\x20keeper),\x20WHAT\x20the\x20keeper\x20writes\x20(the\x20namedOperator\x20roster,\x20per\x20'+'order/shift,\x20via\x20permission\x20index\x20221),\x20and\x20that\x20ETA/pricing\x20live\x20off-chain.'});}return c;}function allocatorRecipientId(a){return(a['recipient']??'?')+'/'+(a['recipient_key']??'');}function groupBuyBlockerChecks(a){const b=[],c=a['build_notes']??[],d=[...c,a['allocator']?.['description']??'',a['key_risk']??'',...(a['machine_shape']??[])['map'](E=>E['role']??''),...(a['guards']??[])['map'](E=>E['purpose'])],f=a['allocator']?.['rows']??[],g=a['machine_shape']??[],h=numericFeeParam(a['fee_params']??{},/^platform_(commission|take|fee)_bps$/)===0x0||numericFeeParam(a['fee_params']??{},/^(courier_|platform_)?retention_bps$/)===0x2710,j=d['some'](E=>/(?:zero|0%|no)\s+(?:platform\s+)?(?:commission|take|cut|rate)/i['test'](E)),k=f['some'](E=>{if(E['recipient']!=='entity')return![];if(!/^(platform|tool.?fee)/i['test'](E['recipient_key']??''))return![];return typeof E['value']==='number'&&E['value']>0x0;}),l=d['some'](E=>/(?:membership|admission|joining|access)\s+fee|traffic\s+compensat|separately\s+priced|separate\s+fee\s+service/i['test'](E));(h||j)&&k&&!l&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'ZERO_TAKE_RATE_HIDDEN_FEE:\x20a\x20zero-take\x20claim\x20coexists\x20with\x20a\x20positive\x20platform\x20leg\x20and\x20no\x20admission/traffic-compensation\x20disclosure','detail':'The\x20template\x20claims\x20the\x20platform\x20takes\x20nothing\x20while\x20an\x20allocator\x20row\x20still\x20pays\x20a\x20platform\x20Entity\x20—\x20the\x20\x27zero\x20take\x27\x20'+'is\x20only\x20honest\x20when\x20the\x20platform\x27s\x20real\x20income\x20lives\x20on\x20a\x20SEPARATE,\x20separately-priced\x20surface\x20(a\x20membership/admission-fee\x20'+'Service)\x20or\x20is\x20compensated\x20another\x20way\x20(disclosed\x20traffic\x20compensation).\x20Silence\x20here\x20is\x20the\x20hidden-fee\x20pattern\x20the\x20'+'UU\x20errand\x20dossier\x20defined\x20blocker\x20#1\x20for.\x20The\x20shipped\x20benchmark\x20shapes\x20do\x20not\x20fire:\x20their\x20platform\x20legs\x20carry\x20value\x200.','suggestion':'Either\x20zero\x20the\x20platform\x20leg,\x20or\x20add\x20a\x20build_note\x20disclosing\x20WHERE\x20the\x20platform\x27s\x20income\x20comes\x20from\x20(a\x20separately-priced\x20'+'membership/admission-fee\x20Service,\x20or\x20an\x20explicit\x20traffic-compensation\x20arrangement)\x20so\x20the\x20zero-take\x20claim\x20is\x20auditable.'});const n=numericFeeParam(a['fee_params']??{},/^(min|minimum)_order(_price)?$/),o=numericFeeParam(a['fee_params']??{},/^supply(_unit)?_price$/);n!==undefined&&o!==undefined&&o>=n&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'SUPPLY_PRICE_ABOVE_MIN_ORDER:\x20supply_price\x20('+o+')\x20>=\x20min_order_price\x20('+n+')\x20—\x20the\x20reseller\x20margin\x20is\x20negative\x20or\x20zero\x20by\x20construction','detail':'A\x20reseller\x20whose\x20supply\x20price\x20is\x20at\x20or\x20above\x20their\x20minimum-order\x20floor\x20earns\x20nothing\x20on\x20every\x20admissible\x20order,\x20and\x20any\x20'+'fixed\x20fulfillment\x20leg\x20then\x20hard-subtracts\x20past\x20the\x20balance\x20(alloc()\x20asserts\x20balance\x20>=\x20fix,\x20EINSUFFICIENT_BALANCE)\x20—\x20the\x20'+'order\x20can\x20neither\x20settle\x20nor\x20refund.\x20This\x20is\x20the\x20kuaituantuan\x20challenger\x27s\x20CR-02\x20deadlock\x20as\x20a\x20template-data\x20check.','suggestion':'Set\x20supply_price\x20strictly\x20BELOW\x20min_order_price,\x20or\x20drop\x20the\x20reseller\x20overlay\x20—\x20the\x20margin\x20must\x20live\x20strictly\x20between\x20'+'the\x20two\x20numbers.'});const q=numericFeeParam(a['fee_params']??{},/^total_(take|fee|commission)_bps$/),s=numericFeeParam(a['fee_params']??{},/^leader_commission_bps$/),w=numericFeeParam(a['fee_params']??{},/^(platform_fee|platform_commission|platform_tool_fee)_bps$/);if(q!==undefined&&s!==undefined&&w!==undefined){const E=s+w;E!==q&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'TIER_COMMISSION_SUM_MISMATCH:\x20leader_commission_bps\x20('+s+')\x20+\x20platform\x20fee\x20bps\x20('+w+')\x20=\x20'+E+'\x20!=\x20total_take_bps\x20('+q+')','detail':'The\x20tier\x20split\x20(leader\x20share\x20+\x20platform\x20share)\x20is\x20declared\x20as\x20ONE\x20total\x20take;\x20when\x20the\x20two\x20legs\x20do\x20not\x20sum\x20to\x20it,\x20the\x20'+'generation\x20rebalance\x20cannot\x20hold\x20the\x20declared\x20economics\x20and\x20one\x20leg\x20silently\x20drifts.\x20The\x20tier\x20difference\x20is\x20WHO\x20gets\x20'+'how\x20much\x20of\x20the\x20SAME\x20total\x20—\x20never\x20two\x20independent\x20rates.','suggestion':'Make\x20leader_commission_bps\x20+\x20platform_fee_bps\x20equal\x20total_take_bps\x20(or\x20drop\x20total_take_bps\x20and\x20declare\x20the\x20two\x20legs\x20'+'independently\x20with\x20a\x20build_note\x20stating\x20their\x20declared\x20sum).'});}if(n!==undefined){const F=f['filter'](G=>G['track']==='settlement'&&G['mode']==='amount'&&typeof G['value']==='number'&&G['value']>=n);F['length']>0x0&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'FIXED_LEG_EXCEEDS_MIN_ORDER:\x20'+F['length']+'\x20fixed\x20Amount\x20settlement\x20leg(s)\x20>=\x20min_order_price\x20('+n+')\x20—\x20hard\x20deadlock','detail':'A\x20fixed\x20Amount\x20leg\x20at\x20or\x20above\x20the\x20order\x20floor\x20subtracts\x20the\x20WHOLE\x20(or\x20more\x20than\x20the)\x20escrowed\x20total:\x20alloc()\x20asserts\x20'+'balance\x20>=\x20fix,\x20so\x20an\x20order\x20at\x20the\x20floor\x20can\x20neither\x20settle\x20NOR\x20refund\x20—\x20every\x20admissible\x20order\x20deadlocks.\x20This\x20is\x20the\x20'+'taocaicai\x20absolute\x20gate;\x20it\x20precedes\x20the\x20ratio\x20check\x20(#6),\x20which\x20governs\x20sustainability,\x20not\x20liveness.','suggestion':'Reduce\x20the\x20fixed\x20leg\x20strictly\x20below\x20min_order_price\x20(the\x20FULFILLMENT_FIXED_LEG_RATIO\x20bar\x20adds\x20the\x2025-30%\x20'+'sustainability\x20ceiling\x20on\x20top\x20of\x20this\x20liveness\x20floor),\x20or\x20convert\x20it\x20to\x20a\x20Rate\x20leg.'});}if(f['length']>0x0){const G=new Map();for(const I of f){const J=(I['guard_key']??'?')+'::'+allocatorRecipientId(I),K=G['get'](J)??new Set();if(I['mode']==='rate'||I['mode']==='surplus')K['add'](I['mode']);G['set'](J,K);}const H=[...G['entries']()]['filter'](([,L])=>L['has']('rate')&&L['has']('surplus'))['map'](([L])=>L);H['length']>0x0&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'COMMISSION_AND_SURPLUS_COEXIST:\x20recipient(s)\x20'+H['join'](',\x20')+'\x20hold\x20BOTH\x20a\x20Rate\x20leg\x20and\x20a\x20Surplus\x20leg\x20in\x20the\x20SAME\x20allocator','detail':'Rate\x20and\x20Surplus\x20are\x20two\x20different\x20claims\x20on\x20the\x20SAME\x20money:\x20a\x20recipient\x20holding\x20both\x20is\x20paid\x20its\x20rate\x20share\x20AND\x20'+'the\x20residual\x20—\x20the\x20jd-pingpin\x20double-pay.\x20A\x20recipient\x27s\x20claim\x20shape\x20is\x20ONE\x20of\x20the\x20two;\x20the\x20residual\x20either\x20goes\x20to\x20'+'them\x20or\x20it\x20does\x20not.','suggestion':'Split\x20the\x20recipient\x20into\x20two\x20identities\x20(a\x20commission\x20Entity\x20and\x20a\x20residual\x20Entity)\x20or\x20drop\x20one\x20of\x20the\x20legs\x20—\x20never\x20'+'let\x20one\x20identity\x20draw\x20both\x20claim\x20shapes\x20in\x20the\x20same\x20allocator.'});}if(s!==undefined&&w!==undefined){const L=s+w,M=[a['variant'],...c,a['allocator']?.['description']??'']['join']('\x20'),N=[[/fresh|grocery|produce|vegetable|fruit|cold.?chain/i,0xdac,'fresh\x20grocery'],[/prepared|ready.?to.?eat|hot\s?food|deli/i,0x1388,'prepared\x20food'],[/packaged|snack|canned|dry\s?goods|standard goods/i,0x1770,'packaged\x20goods'],[/errand|cleaning|repair|installation/i,0x1f40,'services']];for(const [O,P,Q]of N){if(!O['test'](M))continue;L>P&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'COMMISSION_EXCEEDS_CATEGORY_MARGIN:\x20leader_commission_bps\x20+\x20platform\x20fee\x20bps\x20=\x20'+L+'\x20>\x20'+P+'\x20('+Q+'\x20ceiling)','detail':'The\x20combined\x20take\x20exceeds\x20the\x20category\x27s\x20margin\x20ceiling\x20—\x20the\x20Meituan\x20Youxuan\x20failure\x20mode:\x20a\x20fulfillment\x20cost\x20'+'structure\x20the\x20take\x20rate\x20cannot\x20carry,\x20so\x20every\x20order\x20LOSES\x20money\x20and\x20volume\x20only\x20accelerates\x20the\x20loss.\x20The\x20ceiling\x20'+'table\x20comes\x20from\x20the\x20dossier\x27s\x20cross-sample\x20margin\x20study\x20(fresh\x203500\x20/\x20prepared\x205000\x20/\x20packaged\x206000\x20/\x20service\x208000).','suggestion':'Bring\x20the\x20combined\x20take\x20to\x20<=\x20'+P+'\x20bps\x20for\x20a\x20'+Q+'\x20build,\x20or\x20move\x20the\x20cost\x20structure\x20(fixed\x20legs,\x20logistics\x20mode)\x20until\x20the\x20unit\x20economics\x20close.'});break;}}const x=f['some'](R=>/leader/i['test'](R['recipient_key']??''));if(a['archetype']==='challenger'&&x){const R=d['some'](S=>{const T=/(?:1002|settl\w+)/i['test'](S)&&/(?:1000|leader)/i['test'](S);if(!T)return![];return/different|distinct|separate|differ|not the same|another address|own address|must not be the same/i['test'](S);});!R&&b['push']({'rule_id':'R-GB-EXIT-AVAILABILITY','severity':'high','title':'CHALLENGER_SETTLER_IS_LEADER:\x20a\x20challenger\x20leader\x20build\x20discloses\x20no\x20distinct-address\x20requirement\x20between\x20the\x20settlement\x20slot\x20and\x20the\x20leader\x20slot','detail':'In\x20the\x20challenger\x20shape\x20the\x20LEADER\x20sources\x20and\x20fulfills;\x20the\x20settlement\x20executor\x20(permission\x20index\x201002)\x20is\x20the\x20'+'counterweight\x20that\x20drives\x20the\x20buyer\x27s\x20two\x20fund\x20exits\x20(the\x20unclaimed/missed\x20refund\x20and\x20the\x20arbitration\x20refund).\x20If\x20'+'the\x20builder\x20binds\x201002\x20to\x20the\x20leader\x27s\x20own\x20address\x20(1000),\x20BOTH\x20exits\x20depend\x20on\x20one\x20party\x27s\x20goodwill\x20—\x20the\x20leader\x20'+'walks\x20away\x20and\x20every\x20buyer\x27s\x20money\x20locks.\x20The\x20template\x20must\x20TEACH\x20the\x20distinctness;\x20it\x20cannot\x20be\x20expressed\x20as\x20a\x20'+'guard\x20(the\x20two\x20slots\x20bind\x20different\x20Permission\x20entities\x20at\x20build\x20time).','suggestion':'Add\x20a\x20build_note:\x20\x27the\x20settling\x20permission\x20slot\x20(1002)\x20MUST\x20be\x20bound\x20to\x20a\x20DIFFERENT\x20address\x20from\x20the\x20leader\x20slot\x20'+'(1000)\x20—\x20bind\x20it\x20to\x20the\x20platform\x27s\x20settlement\x20keeper\x20or\x20an\x20independent\x20operator,\x20never\x20the\x20leader\x27.'});}const y=[];for(const S of g){for(const T of S['from']??[]){if(typeof T==='string')continue;if(!T['named_operator'])continue;const U=T['forward']??'';(/hand.?over/i['test'](U)||/hand.?over/i['test'](S['name']))&&y['push']((T['prev']||'(entry)')+'\x20--'+(U||'advance')+'-->\x20'+S['name']);}}const z=g['some'](V=>(V['from']??[])['some'](W=>typeof W!=='string'&&W['operator']==='order_payer'&&/collect|pick.?up|receipt|confirm/i['test'](W['forward']??V['name'])));y['length']>0x0&&!z&&b['push']({'rule_id':'R-GB-EXIT-AVAILABILITY','severity':'high','title':'LEADER_SELF_HANDOVER_EDGE:\x20'+y['length']+'\x20handover\x20edge(s)\x20with\x20NO\x20buyer-signed\x20collect/receipt\x20edge\x20—\x20the\x20handover\x20signature\x20is\x20the\x20only\x20proof','detail':'A\x20third-party\x20handover\x20whose\x20ONLY\x20evidence\x20is\x20the\x20handover\x20signer\x27s\x20own\x20signature\x20proves\x20nothing\x20when\x20that\x20signer\x20is\x20the\x20'+'party\x20that\x20loses\x20money\x20by\x20admitting\x20a\x20failed\x20handover\x20(the\x20leader\x20self-certifying\x20their\x20own\x20delivery).\x20The\x20narrowed\x20rule\x20'+'(the\x20Amazon\x20Hub\x20Locker\x20correction)\x20fires\x20only\x20when\x20no\x20buyer-signed\x20collect\x20edge\x20exists:\x20with\x20the\x20buyer\x27s\x20own\x20'+'confirmation\x20edge\x20present,\x20the\x20buyer\x27s\x20signature\x20is\x20the\x20STRONGER\x20evidence\x20and\x20the\x20handover\x20edge\x20is\x20auxiliary.','suggestion':'Add\x20a\x20buyer-signed\x20collect/receipt\x20edge\x20(operator\x20order_payer\x20+\x20an\x20identity_check_order_holder\x20guard)\x20from\x20the\x20handover\x20'+'node,\x20or\x20switch\x20the\x20arrival\x20design\x20to\x20the\x20automated/locker\x20variant\x20where\x20the\x20buyer\x27s\x20access-code\x20retrieval\x20is\x20the\x20receipt.'});const A=a['logistics_mode']==='pickup_point'||g['some'](V=>/at_point|pickup|self.?pick/i['test'](V['name'])),B=g['some'](V=>/unclaimed|abandon|refund|withdraw|cancel/i['test'](V['name'])||(V['from']??[])['some'](W=>typeof W!=='string'&&/unclaimed|abandon|refund|withdraw|cancel/i['test'](W['forward']??'')));A&&!B&&b['push']({'rule_id':'R-GB-EXIT-AVAILABILITY','severity':'medium','title':'ABANDON_EXIT_MISSING:\x20a\x20pickup-point\x20fulfillment\x20shape\x20with\x20no\x20abandon-family\x20node/edge','detail':'Goods\x20sitting\x20at\x20a\x20pickup\x20point\x20with\x20no\x20unclaimed-refund\x20/\x20abandon-self-heal\x20exit\x20strand\x20silently:\x20the\x20buyer\x20who\x20never\x20'+'comes,\x20never\x20refunds,\x20and\x20the\x20escrow\x20waits\x20on\x20a\x20keeper\x20timeout\x20this\x20shape\x20does\x20not\x20declare.\x20The\x20GF2-30\x20idiom\x20(the\x20'+'buyer\x20refunds\x20THEMSELVES\x20while\x20the\x20pickup\x20window\x20is\x20open)\x20is\x20the\x20benchmark\x20self-heal;\x20a\x20keeper\x20timeout\x20exit\x20is\x20the\x20'+'fallback.','suggestion':'Add\x20an\x20unclaimed/abandon\x20exit:\x20a\x20buyer\x20self-serve\x20refund\x20edge\x20(order_payer,\x20time_window_upper_bound\x20on\x20the\x20pickup-node\x20'+'entry)\x20or\x20a\x20keeper\x20timeout\x20advance,\x20disclosed\x20in\x20a\x20build_note.'});if(n!==undefined&&n>0x0){const V=f['filter'](Z=>Z['track']==='settlement'&&Z['mode']==='amount'&&typeof Z['value']==='number')['reduce']((Z,a0)=>Z+a0['value'],0x0),W=V/n,X=d['some'](Z=>/overseas|cross.?border|international/i['test'](Z)),Y=X?0.25:0.3;W>Y&&W<=0x1&&b['push']({'rule_id':'R-GB-UNIT-ECONOMICS','severity':W>0.3?'high':'medium','title':'FULFILLMENT_FIXED_LEG_RATIO:\x20fixed\x20Amount\x20settlement\x20legs\x20sum\x20to\x20'+V+'\x20=\x20'+(W*0x64)['toFixed'](0x1)+'%\x20of\x20min_order_price\x20('+n+')\x20>\x20'+(Y*0x64)['toFixed'](0x0)+'%\x20bar','detail':'The\x20fixed\x20fulfillment\x20cost\x20per\x20order\x20exceeds\x20the\x20sustainable\x20share\x20of\x20the\x20order\x20floor\x20—\x20the\x20Meituan\x20Youxuan\x20failure\x20'+'mode\x20at\x20template\x20time:\x20volume\x20scales\x20the\x20LOSS.\x2030%\x20is\x20the\x20domestic\x20bar;\x20an\x20overseas\x20build\x20(cross-border\x20fulfillment\x20'+'costs)\x20carries\x20the\x20tighter\x2025%\x20bar,\x20detected\x20from\x20the\x20template\x27s\x20own\x20overseas\x20disclosure.\x20The\x20absolute\x20liveness\x20gate\x20'+'(FIXED_LEG_EXCEEDS_MIN_ORDER)\x20covers\x20ratio\x20>=\x201;\x20this\x20rule\x20governs\x20the\x20band\x20below\x20it.','suggestion':'Cut\x20the\x20fixed\x20legs\x20below\x20'+(Y*0x64)['toFixed'](0x0)+'%\x20of\x20the\x20floor\x20(subsume\x20them\x20into\x20the\x20goods\x20price\x20as\x20a\x20Rate\x20split),\x20or\x20raise\x20min_order_price\x20to\x20carry\x20them.'});}const C=/\b(never|no|not|don'?t|cannot|must not|avoid|prohibit\w*|forbid\w*|absent|impossible|unenforceable|inexpressible|instead of|rather than|without|discard\w*|drop\w*|refut\w*|considered and DISCARDED)\b/i,D=[];for(const Z of d){for(const a0 of Z['split'](/[.;]/)){if(C['test'](a0))continue;const a1=/\b(multi.?(level|layer|tier)|pyramid|mlm|headhunt\w*|downline|recruit\w*)\b/i['test'](a0)&&/\b(reward|bonus|commission|incentive|rebate|payout)\b/i['test'](a0),a2=/\b(cumulat\w*|accumulat\w*|points?|badges?)\b/i['test'](a0)&&/\b(reward|bonus|payout|earn)\b/i['test'](a0)&&/\b(across|per|every|each|total|count)\b/i['test'](a0),a3=/\b(?:per|for each|every)\s+\d+\s+(?:orders?|referrals?|members?|invites?|signups?|heads?)\b/i['test'](a0);if(a1||a2||a3)D['push'](a0['trim']()['slice'](0x0,0xa0));}}return D['length']>0x0&&b['push']({'rule_id':'R-GB-UNIT-ECONOMICS','severity':'high','title':'TIERED_INCENTIVE_ON_CHAIN:\x20'+D['length']+'\x20affirmative\x20tiered/cumulative/per-head\x20incentive\x20claim(s)\x20the\x20chain\x20cannot\x20express','detail':'The\x20chain\x20expresses\x20a\x20commission\x20as\x20ONE\x20layer,\x20per-order,\x20fixed-ratio\x20(Rate\x20legs).\x20A\x20multi-tier\x20ladder,\x20a\x20cross-order\x20'+'cumulative\x20counter,\x20or\x20a\x20per-head-count\x20payment\x20needs\x20either\x20a\x20cross-order\x20aggregate\x20as\x20a\x20PAYMENT\x20condition\x20(the\x20read-only\x20'+'repository\x20aggregates\x20gate\x20nothing\x20as\x20a\x20payment\x20condition\x20—\x20a\x20guard\x20built\x20on\x20one\x20is\x20permanently\x20unsatisfiable\x20and\x20strands\x20'+'the\x20funding)\x20or\x20cross-order\x20identity\x20bookkeeping\x20no\x20primitive\x20provides.\x20Affirmative\x20claims\x20found:\x20'+D['slice'](0x0,0x3)['join']('\x20|\x20'),'suggestion':'Restructure\x20the\x20incentive\x20to\x20a\x20single-layer\x20per-order\x20Rate\x20leg\x20or\x20a\x20per-order\x20claim\x20Reward;\x20keep\x20multi-tier/cumulative\x20'+'incentives\x20OFF\x20the\x20machine\x20as\x20an\x20off-chain\x20loyalty\x20program,\x20disclosed\x20as\x20such.'}),b;}export function rootHasRewardRecordGate(a){if(a===null||typeof a!=='object')return![];const b=a;if(b['type']==='query_reward_record_exists')return!![];if(b['type']==='query'&&typeof b['query']==='string'&&/^reward\.record[ .](has|count|find|exists_where)/i['test'](b['query']))return!![];if(b['type']==='query'&&typeof b['query']==='number'&&[0x64c,0x64d,0x65a,0x65d]['includes'](b['query']))return!![];for(const c of b['nodes']??[])if(rootHasRewardRecordGate(c))return!![];for(const d of b['and']??[])if(rootHasRewardRecordGate(d))return!![];for(const e of b['or']??[])if(rootHasRewardRecordGate(e))return!![];if(b['node']!==undefined&&rootHasRewardRecordGate(b['node']))return!![];return![];}function subtreeHasOrderAmount(a){if(Array['isArray'](a))return a['some'](subtreeHasOrderAmount);if(a===null||typeof a!=='object')return![];const b=a;if(b['type']==='query'&&b['query']==='order.amount')return!![];if(b['type']==='query'&&b['query']===0x619)return!![];return(b['nodes']??[])['some'](subtreeHasOrderAmount);}export function rootHasPositiveAmountLeg(a){if(a===null||typeof a!=='object')return![];const b=a;if(typeof b['type']==='string'&&/^logic_as_u256_greater/['test'](b['type'])&&subtreeHasOrderAmount(b))return!![];for(const c of b['nodes']??[])if(rootHasPositiveAmountLeg(c))return!![];for(const d of b['and']??[])if(rootHasPositiveAmountLeg(d))return!![];for(const e of b['or']??[])if(rootHasPositiveAmountLeg(e))return!![];if(b['node']!==undefined&&rootHasPositiveAmountLeg(b['node']))return!![];return![];}function rewardZeroOrderChecks(a){const b=(a['guards']??[])['filter'](h=>h['host']==='reward');if(b['length']===0x0)return[];const c=b['some'](h=>{if(!h['template_id']['startsWith']('tpl_'))return![];const j=GUARD_TEMPLATES['find'](k=>k['id']===h['template_id']);return rootHasPositiveAmountLeg(j?.['example_root']);}),d=templateText(a),e=/order\.amount/i['test'](d)&&/positive[- ]amount|zero[- ]?(total|value)|0[- ]?value/i['test'](d);if(c||e)return[];const f=b['map'](h=>h['key']??h['template_id']);return[{'rule_id':'R-REWARD-ZERO-ORDER','severity':'medium','title':'Reward-claim\x20guard(s)\x20['+f['join'](',\x20')+']\x20not\x20positive-amount\x20gated\x20—\x20a\x20zero-total\x20order\x20can\x20mint\x20a\x20reward\x20claim','detail':'A\x20coupon\x20that\x20zeroes\x20the\x20basket\x20(MINUS\x20value\x20>=\x20the\x20SKU\x20price,\x20RATES\x2010000)\x20creates\x20a\x20ZERO-VALUE\x20order:\x20'+'the\x20escrow\x20holds\x200\x20while\x20the\x20order\x20still\x20walks\x20the\x20machine\x20nodes.\x20A\x20claim\x20guard\x20without\x20a\x20positive-amount\x20'+'leg\x20lets\x20that\x20free\x20buy\x20clear\x20the\x20review\x20node\x20and\x20collect\x20the\x20bounty\x20—\x20zero-cost\x20incentive\x20arbitrage\x20'+'(bkmn\x20F-M39/T6).\x20Reward\x20guards\x20are\x20immutable\x20once\x20the\x20Reward\x20object\x20is\x20published,\x20so\x20the\x20leg\x20must\x20be\x20in\x20'+'the\x20design\x20BEFORE\x20publish.\x20The\x20coupon\x20side\x20is\x20floored\x20at\x20issuance\x20(zeroing\x20coupons\x20are\x20blocked\x20'+'unconditionally\x20—\x20BSX-F07:\x20allow_zero_total\x20waives\x20nothing);\x20this\x20leg\x20is\x20the\x20claim-side\x20half\x20of\x20the\x20pair.','suggestion':'Add\x20to\x20every\x20reward\x20claim\x20root,\x20wrapped\x20in\x20logic_and\x20with\x20the\x20identity\x20+\x20replay\x20legs:\x20'+'logic_as_u256_greater_or_equal[query(order.amount),\x20identifier[N](1)]\x20(declare\x20slot\x20N\x20as\x20a\x20static\x20U64\x20'+'value\x201\x20—\x20see\x20tpl_reward_one_time_claim\x20v55\x20notes);\x20or\x20reference\x20a\x20tpl_*\x20guard\x20whose\x20example_root\x20already\x20'+'carries\x20the\x20positive-amount\x20leg;\x20or\x20declare\x20the\x20requirement\x20verbatim\x20in\x20the\x20build\x20notes\x20'+'(order.amount\x20+\x20positive-amount\x20phrasing)\x20so\x20the\x20generated\x20root\x20includes\x20it.'}];}function rewardReplayChecks(a){const b=(a['guards']??[])['filter'](f=>f['host']==='reward');if(b['length']===0x0)return[];const c=b['some'](f=>{if(!f['template_id']['startsWith']('tpl_'))return![];const h=GUARD_TEMPLATES['find'](j=>j['id']===f['template_id']);return rootHasRewardRecordGate(h?.['example_root']);}),d=/query_reward_record_exists/i['test'](templateText(a))||/reward\.record[ .](has|count|find|exists_where)/i['test'](templateText(a))||/reward[ -]record[ -]gate/i['test'](templateText(a));if(c||d)return[];const e=b['map'](f=>f['key']??f['template_id']);return[{'rule_id':'R-REWARD-REPLAY','severity':'high','title':'Reward-claim\x20guard(s)\x20['+e['join'](',\x20')+']\x20not\x20record-gated\x20—\x20the\x20replay\x20defense\x20this\x20template\x20implies\x20does\x20not\x20exist\x20on-chain','detail':'Reward.claim\x20pays\x20Recipient::Signer\x20with\x20no\x20order\x20binding\x20of\x20its\x20own:\x20the\x20armed\x20rail\x20is\x20the\x20record\x20gate\x20—\x20'+'logic_not(query_reward_record_exists(...))\x20inside\x20the\x20claim\x20guard\x20root,\x20forced\x20together\x20with\x20an\x20identity\x20leg\x20'+'(Signer\x20==\x20order.owner).\x20The\x20PRIMARY\x20form\x20is\x20ORDER-SCOPED\x20(where.storeFromId\x20=\x20the\x20submitted\x20Order\x20address\x20slot,\x20'+'the\x20same\x20slot\x20the\x20guard_add\x20entry\x20stamps;\x20azx7-mn-261014\x20live\x20T8)\x20=\x20once\x20per\x20buyer\x20per\x20order;\x20the\x20EMPTY-where\x20'+'variant\x20is\x20the\x20deliberate\x20once-per-buyer-FOR-LIFE\x20choice\x20(upw\x20F-48:\x20it\x20silently\x20kills\x20the\x20buyer\x27s\x20second\x20order).\x20'+'The\x20ofn-mn-261012\x20F-01\x20\x27storeFromId\x20filter\x20is\x20a\x20silent\x20no-op\x27\x20verdict\x20described\x20UNSTAMPED/legacy\x20rewards\x20only\x20—\x20'+'records\x20written\x20without\x20the\x20guard_add\x20entry\x20stamp\x20carry\x20store_from\x20=\x20none\x20and\x20match\x20no\x20storeFromId\x20predicate;\x20the\x20'+'MCP\x20stamp\x20gate\x20(UPW-K7)\x20now\x20rejects\x20unstamped\x20record-consuming\x20entries.\x20This\x20template\x20'+'mounts\x20host:\x22reward\x22\x20claim\x20machinery\x20yet\x20arms\x20it\x20nowhere:\x20no\x20tpl_*\x20guard\x20whose\x20example_root\x20carries\x20the\x20record\x20gate,\x20'+'no\x20prose\x20declaring\x20the\x20idiom.\x20reward_claim_policy\x20is\x20a\x20documentation\x20field\x20with\x20no\x20compile\x20wiring\x20and\x20does\x20NOT\x20arm\x20'+'anything\x20(same\x20ruling\x20as\x20once_per_order\x20/\x20R-ONCE-ARM)\x20—\x20a\x20funded\x20pool\x20behind\x20an\x20un-armed\x20claim\x20guard\x20is\x20a\x20drainable\x20target.','suggestion':'Arm\x20the\x20claim\x20guard\x20root:\x20add,\x20wrapped\x20in\x20logic_and\x20with\x20the\x20identity\x20leg\x20(Signer\x20==\x20order.owner)\x20and\x20the\x20existing\x20'+'state\x20checks,\x20logic_not(query_reward_record_exists(object=<reward\x20object>,\x20where:{storeFromId:{identifier:<order\x20slot>}}))\x20'+'—\x20the\x20SV-2\x20ORDER-SCOPED\x20form\x20(once\x20per\x20buyer\x20per\x20order;\x20swap\x20to\x20an\x20EMPTY\x20where\x20ONLY\x20for\x20a\x20deliberate\x20'+'one-bounty-per-buyer\x20design).\x20The\x20reward.guard_add\x20store_from_id\x20STAMP\x20is\x20the\x20separate,\x20mandatory\x20field:\x20a\x20'+'record-consuming\x20guard\x20must\x20be\x20added\x20with\x20store_from_id\x20=\x20the\x20per-order\x20stamp\x20slot\x20(the\x20submitted\x20Order\x20address,\x20'+'conventionally\x20slot\x200)\x20or\x20the\x20MCP\x20stamp\x20gate\x20rejects\x20the\x20entry.\x20Reference\x20a\x20tpl_*\x20guard\x20whose\x20example_root\x20already\x20'+'carries\x20the\x20order-scoped\x20gate;\x20or\x20declare\x20the\x20idiom\x20verbatim\x20in\x20the\x20'+'build\x20notes\x20so\x20the\x20generated\x20guard\x20root\x20includes\x20it\x20(guard-risk\x20R-X1-14\x20then\x20audits\x20the\x20built\x20guard\x20and\x20flags\x20the\x20'+'un-wrapped\x20pseudo-protection\x20form).\x20Until\x20armed,\x20keep\x20the\x20Reward\x20pool\x20unfunded\x20—\x20an\x20unfunded\x20incentive\x20promise\x20is\x20'+'already\x20blocked\x20at\x20compile\x20(INV-4\x20reward_funding).'}];}function rewardScaleChecks(a){const b=(a['guards']??[])['filter'](d=>d['host']==='reward');if(b['length']===0x0)return[];const c=b['filter'](d=>d['params']!==undefined&&d['params']['reward_claim_amount']!==undefined)['map'](d=>d['key']??d['template_id']);if(c['length']===0x0)return[];return[{'rule_id':'R-REWARD-SCALE','severity':'medium','title':'Reward-claim\x20guard(s)\x20['+c['join'](',\x20')+']\x20hard-pin\x20the\x20per-claim\x20bounty\x20(reward_claim_amount)\x20in\x20template\x20data','detail':'A\x20spec-level\x20reward_claim_amount\x20pin\x20DEFEATS\x20the\x20T-02\x20compile\x20derivation\x20(2%\x20of\x20the\x20cheapest\x20'+'positive\x20SKU,\x20floored\x20at\x201\x20smallest\x20unit)\x20—\x20spec\x20params\x20beat\x20build\x20inputs,\x20so\x20every\x20adopter\x20gets\x20'+'the\x20same\x20fixed\x20bounty\x20regardless\x20of\x20their\x20SKU\x20prices.\x20The\x20shipped\x20templates\x27\x20former\x201000000000\x20'+'pin\x20was\x2050x\x20a\x200.02-WOW\x20SKU:\x20every\x20claimed\x20order\x20paid\x20out\x20more\x20than\x20the\x20sale\x20earned,\x20and\x20no\x20audit\x20'+'flagged\x20it\x20(bsn7-tn-261026).\x20Template-level\x20pins\x20must\x20be\x20conscious\x20economics\x20rulings,\x20not\x20defaults.','suggestion':'Remove\x20the\x20reward_claim_amount\x20param\x20from\x20the\x20guard\x20spec\x20and\x20let\x20compile\x20derive\x20the\x20bounty\x20from\x20'+'the\x20adopter\x27s\x20sales\x20catalog;\x20if\x20a\x20fixed\x20bounty\x20is\x20the\x20template\x27s\x20deliberate\x20economics\x20(e.g.\x20a\x20'+'denominated\x20loyalty\x20point),\x20restate\x20the\x20pin\x20in\x20the\x20build\x20notes\x20WITH\x20the\x20ratio\x20rationale\x20—\x20the\x20'+'plan\x20audit\x20(PLAN-REWARD-SCALE-01)\x20still\x20judges\x20the\x20resulting\x20ratio\x20against\x20the\x20catalog.'}];}function rewardFundedChecks(a){if(a['review_mode']!=='review_reward')return[];const b=Object['keys'](a['fee_params']??{}),c=b['some'](d=>/review_reward_pool|reward_pool/i['test'](d))||/review_reward_pool|reward_pool/i['test'](templateText(a))||a['reward_claim_policy']?.['max_total_per_recipient']!==undefined;if(c)return[];return[{'rule_id':'R-REWARD-FUNDED','severity':'high','title':'review_reward\x20template\x20declares\x20no\x20reward\x20pool\x20surface\x20—\x20an\x20unfunded\x20incentive\x20promise\x20must\x20not\x20publish\x20(INV-4)','detail':'review_mode\x20\x27review_reward\x27\x20promises\x20buyers\x20a\x20claim\x20reward,\x20but\x20the\x20template\x20declares\x20neither\x20a\x20pool\x20'+'fee_param\x20(review_reward_pool)\x20nor\x20a\x20pool-sizing\x20reward_claim_policy\x20cap.\x20At\x20compile\x20the\x20reward_funding\x20'+'input\x20hard-gates\x20the\x20build,\x20so\x20the\x20promise\x20dies\x20at\x20build\x20time\x20—\x20surface\x20the\x20pool\x20plan\x20in\x20the\x20template\x20'+'so\x20the\x20wizard\x20can\x20ask\x20the\x20funding\x20question\x20with\x20real\x20numbers.','suggestion':'Declare\x20a\x20review_reward_pool\x20fee_param\x20(>=\x20expected\x20orders\x20x\x20per-order\x20reward)\x20and\x20fund\x20it\x20at\x20build\x20time\x20'+'via\x20the\x20reward_funding\x20input\x20(sale-time\x20planning:\x20the\x20buyer\x20perceives\x20the\x20funded\x20reward\x20at\x20quote/buy),\x20'+'or\x20set\x20a\x20reward_claim_policy\x20max_total_per_recipient\x20that\x20sizes\x20the\x20pool.'}];}const PROSE_REVIEW_MODE_CLAIM=/(?<!inputs\.)\breview_mode\s*[=:]\s*["']?(none|review|review_reward)\b/gi,PROSE_OFFERING_CONTEXT=/inputs?\b|addable|per[ -]?build|opt[ -]?in|via the input|override/i;function phantomReviewModeFinding(a,b){return{'rule_id':'PROSE-CAPABILITY-01','severity':'high','title':'Build\x20prose\x20claims\x20review_mode=\x27'+a+'\x27\x20but\x20the\x20template\x20declares\x20\x27'+b+'\x27\x20'+'(phantom\x20capability)','detail':'The\x20compiled\x20service\x20is\x20built\x20from\x20the\x20DECLARED\x20review_mode\x20(\x27'+b+'\x27),\x20so\x20a\x20prose\x20'+('claim\x20of\x20\x27'+a+'\x27\x20ships\x20a\x20service\x20without\x20the\x20promised\x20review\x20rail\x20while\x20the\x20build\x20')+'notes\x20tell\x20the\x20merchant\x20(and\x20through\x20them\x20the\x20buyer)\x20it\x20exists\x20—\x20a\x20template-level\x20false\x20'+'promise\x20(bstn-tn-261024\x20F-01:\x20the\x20licensing\x20build\x20note\x20promised\x20a\x20review\x20route\x20the\x20shape\x20'+'could\x20never\x20carry).\x20Compile\x20gates\x20the\x20reviewed\x20node\x20against\x20the\x20declared\x20mode\x20only\x20'+'(REVIEW_NODE_MISSING);\x20it\x20cannot\x20see\x20prose.','suggestion':'Make\x20the\x20prose\x20tell\x20the\x20truth:\x20either\x20set\x20the\x20template\x27s\x20review_mode\x20to\x20\x27'+a+'\x27\x20AND\x20'+'ship\x20the\x20matching\x20shape\x20(reviewed\x20node\x20+\x20rail,\x20reward\x20guards\x20when\x20review_reward),\x20or\x20'+'rewrite\x20the\x20claim\x20as\x20per-build\x20availability\x20—\x20e.g.\x20\x22addable\x20per-build\x20via\x20'+('inputs.review_mode=\x27'+a+'\x27\x22\x20—\x20only\x20where\x20the\x20shape\x20actually\x20supports\x20the\x20addition.')};}function proseCapabilityChecks(a,b=a){const c=a['review_mode']??'none';for(const f of machineProseFields(b)){const g=proseClaim(b,f['address'],'review_mode');if(typeof g==='string'&&g!==c)return[phantomReviewModeFinding(g,c)];}const d=[],e=[...a['build_notes']??[],a['allocator']['description'],...a['trust_mechanisms']??[]];for(const h of e){for(const j of h['split'](/[;\n]/)){const k=[...j['matchAll'](PROSE_REVIEW_MODE_CLAIM)];if(k['length']===0x0||PROSE_OFFERING_CONTEXT['test'](j))continue;for(const l of k){const n=l[0x1]['toLowerCase']();if(n===c)continue;d['push'](phantomReviewModeFinding(n,c));break;}if(d['length']>0x0)return d;}}return d;}function ratingKeyRowIsSubmittedOrder(a){return!!a&&a['value_type']==='Address'&&a['b_submission']===!![];}function ratingKeyIdViolation(a,b){if(a===null||typeof a!=='object')return'row-id\x20parameter\x20missing\x20or\x20malformed';const c=a;if(c['type']==='context'&&c['context']==='Signer')return'row-id\x20keyed\x20on\x20context\x20Signer\x20(the\x20Signer-keyed\x20display\x20row\x20never\x20carries\x20the\x20per-order\x20rating)';if((c['type']==='identifier'||c['type']===undefined)&&typeof c['identifier']==='number'){const d=b['find'](e=>e['identifier']===c['identifier']);if(!ratingKeyRowIsSubmittedOrder(d)){if(!d)return'row-id\x20references\x20table\x20slot\x20'+c['identifier']+'\x20which\x20the\x20table\x20does\x20not\x20declare\x20(dangling\x20read\x20—\x20fails\x20closed)';if(d['value_type']!=='Address')return'row-id\x20resolves\x20to\x20table\x20slot\x20'+c['identifier']+'\x20typed\x20'+d['value_type']+'\x20(a\x20display/text\x20row)\x20instead\x20of\x20the\x20Address-typed\x20submitted\x20order';return'row-id\x20resolves\x20to\x20static\x20table\x20slot\x20'+c['identifier']+'\x20(b_submission=false)\x20—\x20the\x20same\x20row\x20is\x20read\x20for\x20EVERY\x20claim\x20instead\x20of\x20the\x20submitted\x20order';}return null;}return'row-id\x20parameter\x20type\x20\x22'+(c['type']??'unknown')+'\x22\x20is\x20neither\x20the\x20Signer\x20context\x20nor\x20a\x20table\x20identifier';}function ratingKeyReads(a,b,c,d){if(Array['isArray'](a)){for(const f of a)ratingKeyReads(f,b,c,d);return;}if(a===null||typeof a!=='object')return;const e=a;if(e['type']==='vec_contains_address')d['value']=!![];if(e['type']==='query'&&typeof e['query']==='string'&&/^repository\.data( has)?$/i['test'](e['query'])){const g=Array['isArray'](e['parameters'])?e['parameters'][0x1]:undefined,h=ratingKeyIdViolation(g,c);if(h)b['push'](e['query']+':\x20'+h);}if(e['type']==='query_repository_data_keys_where'){const j=e['where']!==null&&typeof e['where']==='object'&&Object['keys'](e['where'])['length']===0x0;if(j)b['push']('query_repository_data_keys_where:\x20EMPTY\x20where\x20—\x20a\x20presence\x20probe\x20with\x20no\x20floor\x20predicate\x20gates\x20presence,\x20not\x20rating');else{const k=ratingKeyIdViolation(e['id'],c);if(k)b['push']('query_repository_data_keys_where:\x20'+k);}}if(e['type']==='query_repository_data_count_where'||e['type']==='query_repository_data_find_where'||e['type']==='query_repository_data_sum_where'||e['type']==='query_repository_data_sum_where_bound'){if(!d['value']){const l=e['ids'],m=l&&typeof l['identifier']==='number'?c['find'](o=>o['identifier']===l['identifier']):undefined;m&&m['b_submission']===!![]&&b['push'](e['type']+':\x20buyer-submitted\x20candidate\x20ids\x20with\x20NO\x20vec_contains_address\x20pin\x20—\x20a\x20padded\x20candidate\x20list\x20borrows\x20another\x20order\x27s\x20row\x20(pin\x20the\x20matched\x20set\x20to\x20the\x20submitted\x20order)');}}for(const o of e['nodes']??[])ratingKeyReads(o,b,c,d);if(e['node']!==undefined)ratingKeyReads(e['node'],b,c,d);}function treeHasVecAddressPin(a){if(Array['isArray'](a))return a['some'](c=>treeHasVecAddressPin(c));if(a===null||typeof a!=='object')return![];const b=a;if(b['type']==='vec_contains_address')return!![];if((b['nodes']??[])['some'](c=>treeHasVecAddressPin(c)))return!![];return b['node']!==undefined&&treeHasVecAddressPin(b['node']);}export function auditRewardRootRatingKey(a,b){const c=[],d={'value':treeHasVecAddressPin(a)};return ratingKeyReads(a,c,b,d),c['map'](e=>String(e));}function rewardRatingKeyChecks(a){const b=(a['guards']??[])['filter'](e=>e['host']==='reward');if(b['length']===0x0)return[];const c=[];for(const e of b){const f=e['template_id'];if(!f?.['startsWith']('tpl_'))continue;const h=GUARD_TEMPLATES['find'](j=>j['id']===f);if(!h?.['example_root'])continue;for(const j of auditRewardRootRatingKey(h['example_root'],h['example_table']??[])){c['push']('['+f+']\x20'+j);}}if(c['length']===0x0)return[];const d=b['map'](k=>k['key']??k['template_id']);return[{'rule_id':'R-REWARD-RATING-KEY','severity':'critical','title':'Reward-claim\x20guard(s)\x20['+d['join'](',\x20')+']\x20gate\x20on\x20wrongly-keyed\x20repository\x20reads\x20—\x20a\x20rating\x20gate\x20that\x20never\x20reads\x20THIS\x20order\x27s\x20rating\x20row\x20(upwk-mn-261017\x20F-62)','detail':'A\x20minimum-rating\x20bounty\x20is\x20ENFORCEABLE\x20only\x20by\x20the\x20CLAIM\x20guard\x20reading\x20the\x20ORDER-KEYED\x20U64\x20rating\x20row\x20'+'(id\x20=\x20the\x20submitted\x20order\x20address,\x20under\x20the\x20compile-emitted\x20\x27rating\x27\x20policy\x20the\x20buyer\x20writes\x20at\x20review\x20'+'time).\x20A\x20Signer-keyed\x20review\x20TEXT\x20row\x20(custom\x20policies;\x20the\x20compile-emitted\x20\x27review\x27\x20default\x20is\x20'+'order-keyed\x20since\x20F09,\x20yfd-ln-261024)\x20is\x20display-only:\x20keying\x20the\x20gate\x20on\x20it\x20either\x20gates\x20nothing\x20'+'(presence\x20of\x20any\x20review)\x20or\x20dead-locks\x20the\x20claim\x20fail-closed\x20(F-62\x20four-layer\x20break:\x20adjudication\x20right,\x20'+'data\x20row\x20missing,\x20template\x20leg\x20missing,\x20scanner\x20blind\x20—\x20this\x20rule\x20closes\x20layer\x204).\x20Violations:\x0a'+c['map'](k=>'\x20\x20-\x20'+k)['join']('\x0a'),'suggestion':'Replace\x20the\x20wrongly-keyed\x20read\x20with\x20the\x20canonical\x20rating\x20leg\x20(tpl_reward_one_time_claim\x20v1.14.0):\x20'+'logic_as_u256_greater_or_equal[query(repository.data,\x20object=<plan-bound\x20\x27_review\x27\x20repository>,\x20'+'parameters=[<rating\x20policy\x20name\x20row>,\x20<SUBMITTED\x20order\x20Address\x20row>]),\x20<floor\x20U64\x20row>]\x20—\x20the\x20row\x20id\x20IS\x20'+'the\x20submitted\x20order\x20(b_submission\x20Address\x20slot);\x20membership\x20probes\x20must\x20carry\x20the\x20floor\x20predicate\x20in\x20'+'their\x20where;\x20candidate-list\x20forms\x20must\x20carry\x20a\x20vec_contains_address\x20pin\x20on\x20the\x20submitted\x20order.\x20Emit\x20'+'the\x20order-keyed\x20rating\x20ROW\x20(compile\x20review\x20component)\x20and\x20this\x20LEG\x20as\x20a\x20pair,\x20or\x20ship\x20neither\x20—\x20a\x20leg\x20'+'without\x20its\x20data\x20row\x20dead-locks\x20the\x20bounty.'}];}function repoDataHasRef(a){if(a['type']==='query'){const c=a['query'];if(typeof c==='string'&&c['trim']()['toLowerCase']()==='repository.data\x20has')return!![];if(c===0x48e||c==='1166')return!![];}const b=a['type'];return typeof b==='string'&&b['toLowerCase']()==='query_repository_data_has';}function subtreeRefsRepoDataHas(a){if(Array['isArray'](a))return a['some'](subtreeRefsRepoDataHas);if(typeof a!=='object'||a===null)return![];const b=a;if(repoDataHasRef(b))return!![];return Object['values'](b)['some'](subtreeRefsRepoDataHas);}export function rootNegatesRepoDataHasTemplateRoot(a){if(Array['isArray'](a))return a['some'](rootNegatesRepoDataHasTemplateRoot);if(typeof a!=='object'||a===null)return![];const b=a;if(b['type']==='logic_not'&&subtreeRefsRepoDataHas(b['node']))return!![];return Object['values'](b)['some'](rootNegatesRepoDataHasTemplateRoot);}function repoWriteOnceIdiomChecks(a){const b=a['guards']??[],c=[];for(const d of b){if(d['host']!=='repository')continue;if(!d['template_id']?.['startsWith']('tpl_'))continue;const e=GUARD_TEMPLATES['find'](f=>f['id']===d['template_id']);if(!e?.['example_root'])continue;rootNegatesRepoDataHasTemplateRoot(e['example_root'])&&c['push']('\x27'+(d['key']??d['template_id'])+'\x27\x20->\x20'+d['template_id']);}if(c['length']===0x0)return[];return[{'rule_id':'R-REPO-WRITE-ONCE-INEFFECTIVE','severity':'critical','title':'Repository\x20write\x20guard(s)\x20['+c['join'](',\x20')+']\x20negate\x20the\x20row-existence\x20probe\x20—\x20the\x20write-once\x20leg\x20is\x20INEFFECTIVE\x20and\x20must\x20not\x20publish','detail':'The\x20write\x20guard\x20is\x20verified\x20INSIDE\x20the\x20same\x20PTB\x20as\x20the\x20write,\x20before\x20the\x20row\x20exists:\x20a\x20logic_not\x20over\x20'+'\x22repository.data\x20has\x22\x20(1166)\x20always\x20evaluates\x20the\x20PRE-write\x20state,\x20so\x20the\x20leg\x20cannot\x20enforce\x20write-once.\x20'+'Mainnet\x20A/B\x20(ofn-mn-261012\x20F-02):\x20the\x20identical\x20guard\x20minus\x20the\x20leg\x20succeeded,\x20and\x20the\x20author\x20then\x20'+'overwrote\x20their\x20own\x205-star\x20review\x20with\x201\x20star.\x20A\x20defence\x20that\x20cannot\x20be\x20enforced\x20is\x20worse\x20than\x20none\x20—\x20'+'the\x20publish\x20gate\x20flags\x20it\x20INEFFECTIVE\x20instead\x20of\x20accepting\x20it.','suggestion':'Drop\x20the\x20negated-existence\x20leg\x20and\x20enforce\x20write-once\x20with\x20a\x20primitive\x20that\x20actually\x20binds:\x20'+'PolicyRule.write_once=true\x20on\x20the\x20target\x20policy\x20(a\x20second\x20write\x20to\x20the\x20same\x20id\x20aborts\x20with\x20repository\x20'+'error\x2024,\x20E_POLICY_WRITE_ONCE_CONFLICT,\x20live-verified\x20amz9-ln-261023),\x20or\x20scope\x20the\x20ONCE(255)\x20submission\x20'+'slot\x20(per\x20guard-pool\x20—\x20pair\x20with\x20the\x20order\x20anchor\x20R-ANCHOR-01)\x20/\x20the\x20254\x20task-binding\x20slot\x20for\x20'+'order-bound\x20rails.'}];}function compoundPayoutChecks(a){const b=templateText(a),c=a['allocator']['rows']??[],d=a['allocator']['refund_track']!==undefined||c['some'](j=>j['track']==='refund')||/refund/i['test'](a['allocator']['description']);if(!d)return[];const e=a['guards']['some'](j=>j['host']==='arbitration')||a['trust_mechanisms']['some'](j=>/^R2\b/['test'](j))||/compensation[_ ]fund/i['test'](b);if(!e)return[];const f=new Set(c['filter'](j=>j['track']==='refund'&&typeof j['guard_key']==='string')['map'](j=>j['guard_key'])),g=j=>j['split'](/[.;]/)['some'](k=>/\brefund/i['test'](k)&&/allocator\s+gate/i['test'](k)),h=a['guards']['filter'](j=>j['key']!==undefined&&f['has'](j['key'])||g(j['purpose']))['map'](j=>j['key']??j['template_id'])['filter']((j,l,m)=>m['indexOf'](j)===l)['join'](',\x20');return[{'rule_id':'R-COMPOUND-01','severity':'low','title':'Dual\x20buyer-remedy\x20rails\x20(escrow\x20refund\x20+\x20compensation\x20fund)\x20—\x20independent\x20tracks,\x20dual\x20payout\x20disclosed\x20(decision\x2011)','detail':'This\x20template\x20carries\x20BOTH\x20buyer-remedy\x20channels:\x20a\x20refund\x20Allocator\x20paying\x20out\x20of\x20the\x20order\x20escrow\x20AND\x20a\x20bound\x20Arbitration\x20'+'paying\x20out\x20of\x20the\x20Service\x27s\x20compensation\x20fund.\x20Decision\x2011:\x20the\x20two\x20tracks\x20are\x20INDEPENDENT\x20—\x20the\x20fund\x20rail\x20pays\x20strictly\x20'+'from\x20node\x20state\x20and\x20never\x20reads\x20order.claimed_by,\x20and\x20the\x20award\x20is\x20the\x20indemnity\x20track\x27s\x20separate\x20commercial\x20payout\x20—\x20so\x20a\x20'+'buyer\x20collecting\x20BOTH\x20is\x20a\x20LEGAL\x20commercial\x20outcome,\x20not\x20a\x20defect:\x20the\x20merchant\x20chose\x20the\x20arbitrator,\x20and\x20the\x20arbitrator\x20'+'rules\x20on\x20the\x20full\x20fund\x20picture.\x20The\x20overlap\x20is\x20disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20(amz9\x20A-1).'+(h!==''?'\x20Refund\x20rail\x20guard(s):\x20['+h+'].':'')+'\x20A\x20claimed_by\x20polarity\x20leg\x20on\x20the\x20fund\x20rail\x20is\x20BANNED\x20(R-FUND-RAIL-CLAIMED-BY\x20critical)\x20—\x20an\x20award\x20must\x20never\x20silence\x20a\x20due\x20escrow\x20refund.','suggestion':'No\x20structural\x20change\x20required.\x20Keep\x20the\x20operational\x20rule:\x20arbitrators\x20read\x20order_fund_facts\x20before\x20finalizing\x20the\x20indemnity,\x20and\x20the\x20'+'netting\x20is\x20release-bound\x20(rex5\x20B-66)\x20—\x20net\x20against\x20payouts\x20released\x20TO\x20THE\x20ORDER\x20(buyer-side\x20refund\x20rail,\x20per\x20Payment\x20record\x20'+'recipients);\x20payouts\x20released\x20to\x20merchant/Entity\x20recipients\x20leave\x20the\x20same\x20deficit\x20while\x20the\x20buyer\x20receives\x20nothing,\x20so\x20the\x20award\x20'+'must\x20NOT\x20be\x20reduced\x20by\x20those.\x20If\x20a\x20template\x20intends\x20a\x20non-monetary\x20remedy\x20instead,\x20say\x20so\x20explicitly\x20in\x20the\x20arbitration\x20proposition\x20wording.'}];}function surplusTrackChecks(a){const b=a['allocator']['rows']??[],c=[],d=b['filter'](h=>h['track']==='refund'&&h['mode']==='surplus'),e=b['filter'](h=>h['track']==='settlement'&&h['mode']==='amount');d['length']>0x0&&e['length']>0x0&&c['push']({'rule_id':'R-SURPLUS-01','severity':'critical','title':'Refund-track\x20Surplus\x20sweeps\x20UNPAID\x20settlement\x20Amounts\x20out\x20of\x20the\x20shared\x20pool','detail':'An\x20order\x20funds\x20ONE\x20pool\x20—\x20`track`\x20is\x20a\x20build-time\x20grouping\x20the\x20chain\x20never\x20sees.\x20The\x20refund\x20row\x20'+'runs\x20Surplus\x20mode,\x20which\x20pays\x20the\x20ENTIRE\x20remaining\x20balance\x20(the\x20on-chain\x20surplus\x20release;\x20template\x20rows\x20cannot\x20set\x20'+'`Allocator.max`,\x20so\x20the\x20sweep\x20is\x20uncapped),\x20while\x20the\x20settlement\x20track\x20still\x20carries\x20fixed\x20Amount\x20obligations\x20'+('('+e['map'](h=>h['recipient_key']??h['recipient'])['join'](',\x20')+').\x20Track\x20guards\x20are\x20independent\x20—\x20a\x20')+'time-locked\x20deposit\x20release\x20does\x20not\x20wait\x20for\x20month-gated\x20rent\x20—\x20so\x20when\x20the\x20refund\x20fires\x20first,\x20the\x20sweep\x20hands\x20'+'the\x20unpaid\x20Amounts\x20to\x20the\x20refund\x20recipient.\x20VERIFIED\x20LIVE\x20on\x20ziroom\x20mainnet\x20T-05:\x20the\x20deposit_back\x20Surplus\x20paid\x20'+'the\x20tenant\x20the\x20deposit\x20PLUS\x20the\x20unreleased\x20rent\x20(585/525\x20in\x20full);\x20the\x20landlord\x20received\x200.','suggestion':'Size\x20the\x20refund\x20leg\x20explicitly:\x20an\x20Amount\x20row\x20pinned\x20to\x20the\x20deposit\x20value\x20(value/value_from),\x20so\x20the\x20payout\x20can\x20'+'never\x20exceed\x20its\x20own\x20scope\x20—\x20or\x20split\x20the\x20two\x20fund\x20scopes\x20into\x20separate\x20Allocation\x20objects\x20so\x20a\x20sweep\x20can\x20only\x20'+'reach\x20its\x20own\x20pool.\x20If\x20an\x20uncapped\x20sweep\x20is\x20truly\x20intended,\x20gate\x20it\x20on\x20a\x20node\x20that\x20provably\x20follows\x20the\x20FINAL\x20'+'settlement\x20release,\x20and\x20state\x20in\x20the\x20template\x20that\x20any\x20obligation\x20unpaid\x20by\x20then\x20is\x20forfeit.'});const f=b['filter'](h=>h['track']==='settlement'&&h['mode']==='surplus'),g=b['filter'](h=>h['track']==='refund'&&h['mode']==='amount');return f['length']>0x0&&g['length']>0x0&&c['push']({'rule_id':'R-SURPLUS-02','severity':'high','title':'Settlement-track\x20Surplus\x20can\x20drain\x20the\x20pool\x20ahead\x20of\x20a\x20fixed-Amount\x20refund','detail':'The\x20settlement\x20sweep\x20(Surplus,\x20uncapped\x20on\x20the\x20on-chain\x20allocation)\x20pays\x20the\x20merchant\x20the\x20entire\x20remainder\x20while\x20'+('the\x20refund\x20track\x20still\x20owes\x20fixed\x20Amounts\x20('+g['map'](h=>h['recipient_key']??h['recipient'])['join'](',\x20')+').\x20')+'If\x20the\x20settlement\x20guard\x20fires\x20while\x20a\x20refund\x20obligation\x20is\x20still\x20open\x20(the\x20tracks\x20are\x20gated\x20independently),\x20the\x20'+'pool\x20is\x20empty\x20when\x20the\x20refund\x20fires\x20and\x20the\x20release\x20aborts\x20on\x20insufficient\x20balance\x20—\x20the\x20buyer\x20'+'remedy\x20is\x20bricked\x20and\x20the\x20merchant\x20keeps\x20money\x20the\x20template\x20declared\x20refundable.','suggestion':'Make\x20the\x20two\x20tracks\x20mutually\x20exclusive\x20by\x20construction\x20(refund\x20fires\x20only\x20from\x20cancel\x20nodes\x20the\x20settlement\x20'+'guard\x20can\x20never\x20reach,\x20and\x20vice\x20versa),\x20or\x20size\x20the\x20refund\x20as\x20a\x20Rate\x20so\x20it\x20degrades\x20to\x20a\x20share\x20instead\x20of\x20'+'aborting.\x20NOTE:\x20there\x20is\x20no\x20on-chain\x20holdback\x20(FACT-ALLOC-03)\x20—\x20do\x20NOT\x20try\x20to\x20\x27reserve\x27\x20the\x20refund\x20Amount\x20'+'via\x20a\x20fix\x20value;\x20split\x20the\x20two\x20fund\x20scopes\x20into\x20separate\x20Allocation\x20objects\x20if\x20isolation\x20is\x20required.'}),c;}const BRANCH_STATE_REGEX=/(cancel|return|withdraw|exit|expired)/i;function amountDeadlockChecks(a){const b=a['allocator']['rows']??[],c=b['filter'](f=>f['track']==='settlement');if(c['length']===0x0||!c['every'](f=>f['mode']==='amount'))return[];const d=[a['allocator']['description'],...a['build_notes'],...a['trust_mechanisms'],...a['guards']['map'](f=>f['template_id']+'\x20'+f['purpose'])]['join']('\x20\x0a\x20'),e=Object['keys'](a['fee_params'])['some'](f=>MIN_PRICE_KEY_REGEX['test'](f))||FLOOR_TEXT_REGEX['test'](d);if(e)return[];return[{'rule_id':'R-DEADLOCK-01','severity':'medium','title':'Settlement\x20track\x20is\x20ALL\x20fixed\x20Amount\x20—\x20an\x20under-funded\x20pool\x20deadlocks\x20permanently','detail':'Every\x20settlement\x20row\x20is\x20mode\x20\x27amount\x27\x20('+c['length']+'\x20row(s));\x20each\x20asserts\x20balance\x20>=\x20fix\x20at\x20release\x20'+'(the\x20on-chain\x20balance\x20assert).\x20When\x20the\x20pool\x20is\x20smaller\x20than\x20the\x20pinned\x20leg\x20—\x20a\x20discount\x20code,\x20a\x20low-price\x20SKU,\x20a\x20'+'partially-funded\x20order\x20—\x20the\x20call\x20aborts\x20and\x20NO\x20later\x20call\x20can\x20settle\x20a\x20smaller\x20amount:\x20the\x20merchant\x27s\x20payout\x20'+'path\x20is\x20bricked\x20for\x20that\x20order\x20(ziroom\x20CR-02:\x20fixed\x20Amount\x20legs\x20+\x20a\x20cheap\x20SKU\x20=\x20permanent\x20settlement\x20abort).\x20'+'Rate\x20and\x20Surplus\x20legs\x20degrade\x20to\x20whatever\x20the\x20pool\x20actually\x20holds;\x20Amount\x20legs\x20cannot.','suggestion':'Carry\x20at\x20least\x20one\x20Rate/Surplus\x20leg\x20as\x20the\x20degradation\x20path\x20(e.g.\x20the\x20merchant\x20remainder\x20as\x20Rate).\x20'+'If\x20the\x20fixed\x20legs\x20are\x20the\x20design\x20(staged\x20tuition,\x20per-session\x20releases),\x20the\x20BUY\x20path\x20already\x20enforces\x20'+'order\x20>=\x20the\x20fixed-leg\x20SUM\x20per\x20order\x20(the\x20b6-11-family\x20fixed-leg\x20gate,\x20error\x20'+'order_below_fixed_leg_sum\x20—\x20a\x20discounted\x20order\x20is\x20rejected\x20before\x20any\x20money\x20moves),\x20so\x20the\x20template-side\x20'+'duty\x20narrows\x20to\x20pricing\x20every\x20SKU\x20at\x20or\x20above\x20the\x20fixed-leg\x20sum\x20(state\x20that\x20floor\x20in\x20fee_params)\x20—\x20a\x20SKU\x20'+'below\x20the\x20floor\x20could\x20never\x20complete\x20a\x20sale.'}];}const DISCOUNT_FIXED_KEY_REGEX=/(?:discount|coupon)[a-z0-9_]*(?:value|amount)/i,DISCOUNT_RATE_KEY_REGEX=/(?:discount|coupon)[a-z0-9_]*(?:rate_bps|bps|percent)/i,DISCOUNT_ISSUANCE_PROSE_REGEX=/create a discount|discount object|coupon handoff|run promotions|(?:mint|issue)\s+(?:a\s+|the\s+)?coupon|first-order discount/i,TIER_VARIANT_REGEX=/\btiers?\b|\bvariants?\b|\bpackages?\b|\bplans?\b/i;function numericFeeParam(a,b){const c=Object['keys'](a)['find'](d=>b['test'](d)&&typeof a[d]==='number');return c!==undefined?a[c]:undefined;}function railValue(a,b){if(typeof a['value']==='number')return a['value'];if(typeof a['value']==='string'&&/^\d+(\.\d+)?$/['test'](a['value']['trim']()))return Number(a['value']);if(a['value_from']!==undefined){const d=b[a['value_from']];if(typeof d==='number')return d;if(typeof d==='string'&&/^\d+(\.\d+)?$/['test'](d['trim']()))return Number(d);}const c=a['value_from_complement'];if(c!==undefined){const e=b[c],f=typeof e==='number'?e:typeof e==='string'&&/^\d+(\.\d+)?$/['test'](e['trim']())?Number(e):NaN;if(Number['isFinite'](f))return 0x2710-f;}return null;}function railRepeats(a,b){const c=a['repeat_from'];if(c===undefined)return 0x1;const d=b[c],e=typeof d==='number'?d:typeof d==='string'&&/^\d+$/['test'](d['trim']())?Number(d):NaN;return Number['isInteger'](e)&&e>0x0?e:null;}function discountRailScaleChecks(a){const b=a['fee_params'],c=(a['allocator']['rows']??[])['filter'](n=>n['track']==='settlement'&&n['mode']==='amount');if(c['length']===0x0)return[];const d=numericFeeParam(b,DISCOUNT_FIXED_KEY_REGEX),e=numericFeeParam(b,DISCOUNT_RATE_KEY_REGEX),f=DISCOUNT_ISSUANCE_PROSE_REGEX['test'](templateText(a));if(d===undefined&&e===undefined&&!f)return[];const h=Object['keys'](b)['find'](n=>MIN_PRICE_KEY_REGEX['test'](n)&&typeof b[n]==='number'),j=h!==undefined?b[h]:undefined;let k;if(j!==undefined&&d!==undefined)k=Math['max'](0x0,j-d);else{if(j!==undefined&&e!==undefined)k=j*(0x2710-Math['min'](e,0x2710))/0x2710;}const l=n=>TIER_VARIANT_REGEX['test']((n['note']??'')+'\x20'+(n['guard_key']??'')),m=new Map();if(c['length']>=0x2&&c['every'](l))for(const n of c){const o=n['guard_key']??n['recipient_key']??'row/'+n['recipient'],p=m['get'](o)??{'label':o,'sum':0x0,'resolvable':!![]},q=railValue(n,b),s=railRepeats(n,b);if(q===null||s===null)p['resolvable']=![];else p['sum']+=q*s;m['set'](o,p);}else{let w=0x0,x=!![];for(const y of c){const z=railValue(y,b),A=railRepeats(y,b);if(z===null||A===null)x=![];else w+=z*A;}m['set']('settlement',{'label':'settlement','sum':w,'resolvable':x});}if(k!==undefined){const B=[...m['values']()]['filter'](C=>C['resolvable']&&C['sum']>k);if(B['length']>0x0)return[{'rule_id':'R-FAMT-SCALE','severity':'critical','title':'Absolute\x20Amount\x20rails\x20exceed\x20the\x20minimum\x20post-discount\x20payable\x20('+B['map'](C=>C['label']+':\x20'+C['sum']+'\x20>\x20'+k)['join'](';\x20')+')','detail':'This\x20template\x20combines\x20ABSOLUTE\x20Amount\x20rails\x20with\x20a\x20discount\x20configuration,\x20and\x20the\x20arithmetic\x20is\x20'+('resolvable\x20at\x20build\x20time:\x20minimum\x20order\x20value\x20'+j+'\x20('+h+')\x20minus\x20the\x20discount\x20leaves\x20'+k+',\x20')+'while\x20the\x20settlement\x20Amount\x20rail(s)\x20named\x20above\x20sum\x20to\x20more\x20(a\x20leg\x20declaring\x20repeat_from\x20counts\x20once\x20per\x20'+'unit\x20—\x20the\x20tail\x20fire\x20is\x20the\x20one\x20that\x20strands).\x20On\x20chain\x20the\x20order\x20escrows\x20the\x20POST-discount\x20'+'total\x20(the\x20on-chain\x20discounted-quote\x20computation)\x20and\x20every\x20Amount\x20leg\x20asserts\x20balance\x20>=\x20fix\x20at\x20release\x20'+'on\x20chain\x20—\x20the\x20LAST\x20rail\x20to\x20fire\x20aborts\x20mid-workflow\x20and\x20the\x20order\x20strands\x20with\x20its\x20remaining\x20'+'pool.\x20Machines\x20and\x20allocators\x20are\x20immutable\x20after\x20publish:\x20no\x20late\x20repair\x20exists.\x20Offending\x20rail\x20'+('scope(s)\x20(each\x20tier\x20judged\x20on\x20its\x20own\x20selected\x20variant,\x20not\x20the\x20first\x20row):\x20'+B['map'](C=>C['label'])['join'](',\x20')+'.'),'suggestion':'Shrink\x20the\x20rails\x20to\x20fit\x20the\x20discounted\x20floor\x20('+B['map'](C=>C['label']+'\x20<=\x20'+k)['join'](',\x20')+'),\x20or\x20'+'express\x20the\x20rails\x20as\x20Rate/RateGross\x20legs\x20which\x20degrade\x20to\x20whatever\x20the\x20discounted\x20pool\x20actually\x20holds.\x20A\x20'+'percentage\x20discount\x20keeps\x20rails\x20payable\x20only\x20when\x20the\x20rails\x20are\x20percentage-based\x20too.'}];if([...m['values']()]['every'](C=>C['resolvable']))return[];}return[{'rule_id':'R-FAMT-SCALE','severity':'medium','title':'Absolute\x20Amount\x20rails\x20combined\x20with\x20a\x20discount\x20—\x20the\x20tail\x20rail\x20can\x20strand\x20when\x20the\x20discounted\x20total\x20undercuts\x20the\x20rails','detail':'This\x20template\x20directs\x20the\x20build\x20to\x20attach\x20a\x20Service-side\x20discount\x20(coupon)\x20while\x20its\x20settlement\x20track\x20carries\x20fixed\x20'+'Amount\x20rails.\x20The\x20order\x20escrows\x20the\x20POST-discount\x20total\x20(the\x20on-chain\x20discounted-quote\x20computation)\x20and\x20every\x20'+'Amount\x20leg\x20asserts\x20balance\x20>=\x20fix\x20at\x20release\x20(on-chain\x20balance\x20assert),\x20so\x20whenever\x20the\x20discounted\x20payable\x20falls\x20below\x20'+'the\x20rail\x20sum\x20the\x20LAST\x20rail\x20aborts\x20and\x20the\x20order\x20strands\x20—\x20unrepairable\x20after\x20publish.\x20The\x20minimum\x20post-discount\x20'+'payable\x20cannot\x20be\x20resolved\x20at\x20build\x20time\x20here\x20(the\x20order\x20value\x20is\x20a\x20merchant\x20runtime\x20input\x20such\x20as\x20the\x20SKU\x20price,\x20'+'or\x20the\x20discount\x20magnitude\x20is\x20declared\x20only\x20in\x20prose,\x20or\x20a\x20repeated\x20release\x20names\x20a\x20count\x20key\x20that\x20does\x20not\x20'+'resolve\x20to\x20a\x20positive\x20integer),\x20so\x20the\x20scale\x20cannot\x20be\x20proven\x20safe\x20statically.\x20RUNTIME\x20'+'ENFORCEMENT\x20FACE:\x20this\x20advisory\x20does\x20NOT\x20mean\x20the\x20shape\x20ships\x20unguarded\x20—\x20the\x20buy\x20path\x20carries\x20the\x20fixed-leg\x20'+'completion\x20gate\x20(order_below_fixed_leg_sum,\x20b6-11\x20family):\x20it\x20computes\x20the\x20minimum\x20completion-route\x20fixed-leg\x20'+'sum\x20for\x20THIS\x20machine\x20(completion\x20routes\x20only\x20—\x20refund/cancel\x20early-exit\x20routes\x20are\x20excluded,\x20yfd-ln-261024\x20F04)\x20'+'and\x20rejects\x20the\x20buy\x20before\x20any\x20money\x20moves\x20when\x20the\x20discounted\x20payable\x20cannot\x20cover\x20it.\x20With\x20that\x20gate\x20live\x20the\x20'+'residual\x20exposure\x20is\x20buy-time\x20rejections\x20(a\x20coupon\x20priced\x20below\x20the\x20rail\x20sum\x20makes\x20orders\x20unbuyable\x20—\x20a\x20merchant\x20'+'UX\x20problem),\x20not\x20escrow\x20stranding;\x20the\x20MCP-side\x20gate\x20is\x20an\x20enforcement\x20courtesy,\x20not\x20a\x20chain\x20invariant,\x20so\x20a\x20'+'build\x20that\x20bypasses\x20the\x20buy\x20tool\x20face\x20still\x20strands.','suggestion':'Prefer\x20percentage-based\x20rails:\x20express\x20the\x20settlement\x20legs\x20as\x20Rate/RateGross\x20(which\x20degrade\x20to\x20whatever\x20the\x20'+'discounted\x20pool\x20holds)\x20instead\x20of\x20fixed\x20Amounts\x20—\x20or\x20pin\x20BOTH\x20sides\x20machine-checkably\x20(a\x20numeric\x20min_*\x20'+'order-value\x20floor\x20in\x20fee_params\x20plus\x20a\x20numeric\x20discount\x20magnitude\x20key)\x20so\x20the\x20build-time\x20scale\x20check\x20can\x20run.\x20'+'Otherwise\x20keep\x20the\x20discount\x20budget\x20documented\x20so\x20the\x20merchant\x20prices\x20coupons\x20above\x20the\x20rail\x20sum\x20(the\x20buy-path\x20'+'order_below_fixed_leg_sum\x20gate\x20will\x20otherwise\x20reject\x20discounted\x20orders\x20one\x20by\x20one\x20—\x20correct,\x20but\x20the\x20merchant\x20'+'should\x20learn\x20it\x20from\x20this\x20report,\x20not\x20from\x20failed\x20buys).'}];}function cancelCoverageChecks(a){const b=a['allocator']['rows']??[];if(b['some'](d=>d['track']==='refund'))return[];if(a['allocator']['refund_track']!==undefined)return[];const c=a['machine_shape']['find'](d=>BRANCH_STATE_REGEX['test'](d['name']));if(!c)return[];return[{'rule_id':'R-CANCEL-01','severity':'high','title':'Machine\x20models\x20\x27'+c['name']+'\x27\x20but\x20the\x20allocator\x20has\x20NO\x20refund-track\x20rows\x20—\x20money\x20locks\x20on\x20that\x20path','detail':'The\x20machine\x20shape\x20carries\x20a\x20cancel/return/exit\x20state,\x20yet\x20no\x20allocator\x20row\x20pays\x20on\x20the\x20refund\x20track.\x20Text-level\x20'+'claims\x20(guard\x20purposes,\x20allocator\x20description)\x20may\x20still\x20say\x20\x27refund\x27,\x20but\x20on\x20chain\x20only\x20rows\x20move\x20money:\x20an\x20'+'order\x20that\x20reaches\x20this\x20state\x20keeps\x20its\x20escrow\x20with\x20no\x20rail\x20out\x20(ofn\x20#P-02:\x20the\x20subscription\x20template\x27s\x20refund\x20'+'rails\x20missed\x20closed_cancel\x20and\x200.5\x20WOW\x20locked\x20permanently;\x20verified\x20live).','suggestion':'Add\x20refund-track\x20rows\x20covering\x20EVERY\x20cancel-ish\x20terminal\x20(order-anchored\x20GuardIdentifier(0)\x20recipient,\x20'+'Rate-sized\x20with\x20the\x20group\x20summing\x2010000),\x20or\x20remove\x20the\x20state\x20from\x20the\x20machine\x20so\x20orders\x20can\x20never\x20enter\x20it.'}];}function redundGuardObjectMismatchChecks(a){const b=a['allocator']['rows']??[],c=b['filter'](h=>h['track']==='refund'&&h['recipient']==='guard_identifier');if(c['length']===0x0)return[];const d=new Set(c['map'](h=>h['guard_key'])['filter'](h=>typeof h==='string')),e=a['guards']['some'](h=>h['key']!==undefined&&d['has'](h['key'])&&(/arb/i['test'](h['template_id'])||/arb\.(?:indemnity|order|winner|status|ruling|case)/i['test'](h['purpose'])));if(!e)return[];const f=templateText(a),g=/two[- ]slot|slot\s*0.*order|slot\s*1.*arb|arb\.order.*==|for_object.*binding/i['test'](f);if(g)return[{'rule_id':'REDUND-GUARD-OBJECT-MISMATCH','severity':'low','title':'Arb-refund\x20guard\x20uses\x20two-slot\x20design\x20(Order\x20+\x20Arb)\x20—\x20self-certifying\x20pair','detail':'The\x20template\x20carries\x20a\x20refund\x20allocator\x20row\x20with\x20a\x20GuardIdentifier\x20recipient\x20AND\x20an\x20arbitration-ruling\x20guard.\x20'+'The\x20two-slot\x20design\x20(slot\x200\x20=\x20Order\x20for\x20the\x20allocator\x20recipient,\x20slot\x201\x20=\x20Arb\x20for\x20the\x20ruling\x20state)\x20is\x20the\x20'+'correct\x20resolution\x20of\x20the\x20F-02\x20slot\x20conflict:\x20the\x20allocator\x20reads\x20slot\x200\x20(payment_info.for_object\x20binding),\x20'+'the\x20forward\x20reads\x20slot\x201\x20(arb.indemnity\x20state),\x20and\x20the\x20binding\x20assertion\x20query(\x22arb.order\x22,\x20slot1)\x20==\x20slot0\x20'+'makes\x20the\x20pair\x20self-certifying\x20against\x20redirect\x20attacks.','suggestion':'Verify\x20the\x20guard\x20is\x20tpl_forward_arb_ruling_won\x20(two-slot\x20form)\x20or\x20an\x20equivalent\x20custom\x20guard\x20with\x20the\x20same\x20'+'slot\x20layout\x20and\x20binding\x20assertion.\x20Single-slot\x20arb-refund\x20guards\x20are\x20unreachable\x20(F-02).'}];return[{'rule_id':'REDUND-GUARD-OBJECT-MISMATCH','severity':'high','title':'Arb-refund\x20guard\x20may\x20use\x20a\x20SINGLE\x20slot\x20—\x20unreachable\x20rail\x20(F-02)','detail':'The\x20template\x20carries\x20a\x20refund\x20allocator\x20row\x20with\x20a\x20GuardIdentifier\x20recipient\x20AND\x20an\x20arbitration-ruling\x20guard,\x20'+'but\x20the\x20template\x20text\x20does\x20not\x20mention\x20the\x20two-slot\x20design.\x20A\x20single-slot\x20guard\x20cannot\x20satisfy\x20both\x20consumers:\x20'+'the\x20forward\x20needs\x20the\x20Arb\x20object\x20(to\x20read\x20arb.indemnity),\x20while\x20the\x20allocator\x20recipient\x20GuardIdentifier(0)\x20needs\x20'+'the\x20Order\x20object\x20(payment_info.for_object\x20binding).\x20F-02\x20verified\x20live:\x20Order\x20address\x20→\x20forward\x20aborts;\x20Arb\x20address\x20'+'→\x20allocation\x20aborts\x2015\x20(ERECIPIENT_NOT_FOR_OBJECT).\x20The\x20escrow\x20strands\x20permanently\x20with\x20no\x20on-chain\x20exit.','suggestion':'Use\x20tpl_forward_arb_ruling_won\x20(two-slot\x20form:\x20slot\x200\x20=\x20Order,\x20slot\x201\x20=\x20Arb,\x20with\x20arb.order\x20==\x20order\x20binding),\x20'+'or\x20document\x20the\x20two-slot\x20design\x20explicitly\x20in\x20the\x20template\x20build_notes.\x20A\x20single-slot\x20arb-refund\x20guard\x20is\x20'+'unreachable\x20by\x20construction\x20(F-02).'}];}function zeroAmountGuardChecks(a){const b=templateText(a),c=/zero[- ]amount|0[ -]?amount|free[^a-z]|price\s*=\s*0|amount\s*>\s*0|min_booking_amount/i['test'](b)||/no[- ]charge|gratis|complimentary/i['test'](b);if(c)return[];const d=new Set((a['allocator']['rows']??[])['map'](f=>f['guard_key'])['filter'](f=>typeof f==='string')),e=a['guards']['some'](f=>f['host']==='machine'&&!(f['key']!==undefined&&d['has'](f['key']))&&(/claimed_by|allocation|payment\s|alloc\b/i['test'](f['template_id'])||/claimed_by|allocation|payment\s|alloc\b/i['test'](f['purpose']))&&!/refund|pro-?rata|staged[_ -]?release|recovery|polarity/i['test'](f['template_id']+'\x20'+f['purpose']));if(!e)return[];return[{'rule_id':'D7-ZERO-AMOUNT-GUARD','severity':'medium','title':'Machine\x20progress\x20guards\x20may\x20depend\x20on\x20allocator\x20events\x20—\x20zero-amount\x20orders\x20deadlock','detail':'The\x20protocol\x20does\x20NOT\x20create\x20an\x20Allocation\x20for\x20a\x20zero-amount\x20order\x20(amount\x20>\x200\x20is\x20required).\x20'+'A\x20zero-amount\x20order\x20therefore\x20has\x20NO\x20claimed_by,\x20NO\x20payment\x20history,\x20and\x20NO\x20allocation\x20balance.\x20'+'This\x20template\x20carries\x20machine\x20guards\x20that\x20reference\x20allocator-dependent\x20state\x20(claimed_by\x20/\x20allocation\x20/\x20payment),\x20'+'but\x20the\x20template\x20does\x20NOT\x20explicitly\x20exclude\x20zero-amount\x20items.\x20A\x20zero-amount\x20order\x20can\x20never\x20satisfy\x20such\x20a\x20guard\x20'+'and\x20deadlocks\x20at\x20the\x20node\x20with\x20no\x20exit.','suggestion':'Either\x20(a)\x20exclude\x20zero-amount\x20items\x20explicitly\x20(e.g.\x20min_booking_amount,\x20amount\x20>\x200\x20in\x20build_notes),\x20or\x20'+'(b)\x20redesign\x20progress\x20guards\x20to\x20use\x20order-native\x20signals\x20(order.time,\x20signer,\x20progress.current,\x20Repository\x20data)\x20'+'instead\x20of\x20allocator-derived\x20state,\x20so\x20zero-amount\x20orders\x20can\x20still\x20advance.'}];}function terminalRailCoverageChecks(a){const b=a['machine_shape'];if(b['length']===0x0||!b['some'](y=>(y['from']??[])['length']>0x0))return[];const c=a['allocator']['rows']??[];if(c['length']===0x0)return[];const d=[...a['guards']['map'](y=>y['purpose']),...c['map'](y=>y['note']??'')];if(!d['some'](y=>/current\s*==/i['test'](y)))return[];const f=a['allocator']['description']??'',g=new Set();for(const y of b){for(const z of y['from']??[]){const A=typeof z==='string'?z:z?.['prev'];if(A)g['add'](resolveSegmentToken(a,A));}}const h=b['filter'](B=>!g['has'](B['name']));if(h['length']===0x0)return[];const j=B=>B['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),k=B=>{const C=new RegExp('current\x5cs*==\x5cs*[\x22\x27]?'+j(B)+'\x5cb','i');if(a['guards']['some'](E=>C['test'](E['purpose'])))return!![];if(c['some'](E=>E['note']!==undefined&&C['test'](E['note'])))return!![];const D=new RegExp('\x5cb'+j(B)+'\x5cb','i');if(a['guards']['some'](E=>D['test'](E['purpose'])))return!![];if(c['some'](E=>E['note']!==undefined&&D['test'](E['note'])))return!![];return D['test'](f);},l=B=>/pool is empty|pool drains?ed|drains? in full|already (?:released|paid)|escrow (?:is )?(?:empty|drained)/i['test'](B),n=h['filter'](B=>!k(B['name'])&&!l(B['role']))['map'](B=>'\x27'+B['name']+'\x27'),o=/cancel|refund|return|withdraw|compensat/i,p=/refund|repay|chargeback|compensat/i,q=B=>B['semantic_role']==='cancelled'||o['test'](B['name']),s=B=>{const C=new RegExp('current\x5cs*==\x5cs*[\x22\x27]?'+j(B)+'\x5cb','i'),D=new RegExp('\x5cb'+j(B)+'\x5cb','i');if(c['some'](E=>E['track']==='refund'&&(C['test'](E['note']??'')||D['test'](E['note']??''))))return!![];return a['guards']['some'](E=>(C['test'](E['purpose'])||D['test'](E['purpose']))&&p['test'](E['template_id']+'\x20'+E['purpose']));},w=h['filter'](B=>q(B)&&k(B['name'])&&!s(B['name'])&&!l(B['role']))['map'](B=>'\x27'+B['name']+'\x27'),x=[];return n['length']>0x0&&x['push']({'rule_id':'TERMINAL-NO-RAIL','severity':'critical','title':'Terminal\x20node(s)\x20'+n['join'](',\x20')+'\x20have\x20no\x20allocator\x20rail\x20—\x20escrow\x20strands\x20permanently\x20(publish\x20blocked)','detail':'An\x20order\x20that\x20reaches\x20a\x20terminal\x20node\x20moves\x20no\x20money\x20by\x20itself:\x20settlement\x20is\x20a\x20separate\x20keeper\x20'+'submit\x20against\x20an\x20allocator\x20whose\x20guard\x20anchors\x20that\x20node\x20(progress.current\x20==\x20<terminal>).\x20'+'A\x20terminal\x20without\x20a\x20rail\x20publishes\x20into\x20a\x20permanent\x20strand\x20—\x20the\x20escrow\x20of\x20every\x20order\x20that\x20stops\x20'+'there\x20is\x20unrecoverable\x20(mainnet\x20az-mn-261007:\x200.299\x20stranded;\x20ofshop:\x200.25\x20stranded\x20at\x20\x27expired\x27),\x20'+'and\x20topology\x20+\x20allocators\x20are\x20both\x20immutable\x20after\x20publish.\x20Either\x20this\x20terminal\x20needs\x20its\x20own\x20'+'settlement/refund\x20rail\x20(canonical\x20guard\x20designs:\x20tpl_allocator_node_gate_settle\x20/\x20'+'tpl_allocator_node_gate_refund,\x20M-T12),\x20or\x20the\x20pool\x20legitimately\x20drains\x20at\x20an\x20EARLIER\x20node\x20—\x20in\x20'+'which\x20case\x20document\x20that\x20in\x20the\x20terminal\x27s\x20role\x20(e.g.\x20\x27pool\x20is\x20empty\x27)\x20so\x20this\x20rule\x20can\x20exempt\x20it.','suggestion':'For\x20each\x20listed\x20terminal:\x20add\x20an\x20allocator\x20row\x20whose\x20guard\x20purpose\x20anchors\x20progress.current\x20==\x20<terminal>,\x20'+'or\x20state\x20in\x20the\x20node\x20role\x20that\x20the\x20pool\x20is\x20already\x20empty\x20when\x20the\x20terminal\x20is\x20reached.'}),w['length']>0x0&&x['push']({'rule_id':'TERMINAL-WRONG-RAIL','severity':'critical','title':'Refund\x20terminal(s)\x20'+w['join'](',\x20')+'\x20anchored\x20ONLY\x20by\x20the\x20settlement\x20track\x20—\x20the\x20refund\x20pays\x20the\x20merchant\x20(publish\x20blocked)','detail':'A\x20cancel-flavored\x20terminal\x20must\x20drain\x20through\x20the\x20REFUND\x20track\x20(order-anchored\x20GuardIdentifier\x20rows):\x20'+'the\x20only\x20anchor\x20that\x20currently\x20covers\x20it\x20lives\x20on\x20a\x20settlement\x20row\x20or\x20a\x20guard\x20with\x20no\x20refund\x20intent,\x20'+'and\x20a\x20settlement\x20rail\x20resolves\x20its\x20recipients\x20to\x20the\x20merchant\x20side.\x20Triggered\x20that\x20way,\x20the\x20buyer\x27s\x20'+'refund\x20is\x20paid\x20to\x20the\x20counterparty\x20—\x20same\x20irreversibility\x20class\x20as\x20a\x20missing\x20rail\x20(topology\x20and\x20'+'allocators\x20are\x20immutable\x20after\x20publish).','suggestion':'For\x20each\x20listed\x20terminal:\x20add\x20refund-track\x20rows\x20anchored\x20to\x20it\x20(progress.current\x20==\x20<terminal>\x20on\x20a\x20'+'track:\x22refund\x22\x20row\x20note,\x20or\x20a\x20guard\x20purpose\x20that\x20names\x20both\x20the\x20node\x20and\x20the\x20refund\x20intent),\x20or\x20state\x20'+'in\x20the\x20node\x20role\x20that\x20the\x20pool\x20is\x20already\x20empty\x20when\x20the\x20terminal\x20is\x20reached.'}),x;}function railNodeDriftChecks(a){const b=a['machine_shape'];if(b['length']===0x0)return[];const c=a['allocator']['rows']??[],d=[...a['guards']['map'](h=>h['purpose']),...c['map'](h=>h['note']??'')];if(!d['some'](h=>/current\s*==|current_time\s+of/i['test'](h)))return[];d['push'](a['allocator']['description']??'');const e=new Set(b['map'](h=>h['name']['toLowerCase']())),f=new Set(),g=h=>{const j=(h[0x1]??h[0x2]??'')['trim']();if(j===''||/^<.*>$/['test'](j))return;if(!/^[A-Za-z0-9_]+$/['test'](j))return;if(!e['has'](j['toLowerCase']()))f['add']('\x27'+j+'\x27');};for(const h of d){for(const j of h['matchAll'](/current\s*==\s*(?:"([^"]+)"|'([^']+)')/gi))g(j);for(const k of h['matchAll'](/current_time\s+of\s+(?:"([^"]+)"|'([^']+)')/gi))g(k);}if(f['size']===0x0)return[];return[{'rule_id':'RAIL-NODE-DRIFT','severity':'high','title':'Progress\x20anchor(s)\x20'+[...f]['join'](',\x20')+'\x20name\x20no\x20machine_shape\x20node\x20—\x20the\x20rail\x20can\x20never\x20fire','detail':'These\x20progress\x20anchors\x20(current\x20==\x20\x27X\x27\x20/\x20current_time\x20of\x20\x27X\x27)\x20reference\x20node\x20names\x20absent\x20from\x20'+'machine_shape,\x20so\x20the\x20guard\x20can\x20never\x20match\x20a\x20real\x20progress\x20state\x20and\x20whatever\x20the\x20rail\x20drains\x20'+'(settlement,\x20refund,\x20compensation)\x20strands\x20permanently.\x20The\x20usual\x20cause\x20is\x20a\x20node\x20rename\x20that\x20did\x20'+'not\x20propagate:\x20rails\x20pinned\x20\x27cancelled\x27\x20while\x20the\x20node\x20shipped\x20as\x20\x27guest_cancelled\x27\x20killed\x20every\x20'+'refund\x20path\x20on\x20a\x20live\x20store.\x20Chain\x20publishability\x20does\x20NOT\x20compare\x20anchor\x20literals\x20against\x20the\x20'+'node\x20set\x20—\x20this\x20prose-drift\x20is\x20only\x20visible\x20to\x20a\x20scan.','suggestion':'Align\x20each\x20listed\x20anchor\x20with\x20the\x20actual\x20machine_shape\x20node\x20name\x20(preferred:\x20update\x20the\x20guard\x20'+'purpose\x20/\x20allocator\x20note\x20to\x20the\x20current\x20node\x20name),\x20or\x20restore\x20the\x20node\x20name\x20in\x20machine_shape\x20'+'if\x20the\x20anchor\x20was\x20correct\x20and\x20the\x20shape\x20drifted.'}];}const PATH_CLASS_PATH_CAP=0x1388;function extractHistoryAnchorLiteral(a){for(const b of a['matchAll'](/next_node\s*=\s*["']([A-Za-z0-9_]+)["']/g)){const c=a['slice'](Math['max'](0x0,b['index']-0x40),b['index']);if(/progress\.history\.time[\s\S]{0,48}$/i['test'](c))return b[0x1];}return undefined;}function enumeratePathClasses(a,b,c,d,e){const f=d['toLowerCase'](),g=c['toLowerCase'](),h=new Set(),j=[];let k=0x0,l=![];const m=n=>{const o=n['toLowerCase']();if(o===f)return;j['push'](n),h['add'](o);if(o===g){k+=0x1;if(k>PATH_CLASS_PATH_CAP)l=!![];else e['length']<0x3&&e['push'](j['join']('→')+'\x20avoiding\x20\x27'+d+'\x27');}else for(const p of a['get'](n)??[]){if(l)break;if(h['has'](p['toLowerCase']()))continue;m(p);}j['pop'](),h['delete'](o);};for(const n of b){if(l)break;m(n);}return{'violated':k>0x0,'capped':l};}function pathClassAnchorChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0)return[];if(!b['some'](k=>(k['from']??[])['some'](l=>typeof l!=='string'&&!!l['guard_key'])))return[];const c=new Map(),d=new Map();for(const k of b){for(const l of k['from']??[]){const n=typeof l==='string'?l:l['prev'];if(!c['has'](n))c['set'](n,[]);c['get'](n)['push'](k['name']);if(n!=='')d['set'](k['name'],(d['get'](k['name'])??0x0)+0x1);}}const f=b['filter'](o=>(d['get'](o['name'])??0x0)===0x0)['map'](o=>o['name']);if(f['length']===0x0)return[];const h=[],j=new Set();for(const o of a['guards']){if(!o['key']||j['has'](o['key']))continue;if(!/history[\s\S]{0,200}next_node|next_node[\s\S]{0,200}history/i['test'](o['purpose']))continue;const p=extractHistoryAnchorLiteral(o['purpose']);if(!p)continue;if(!b['some'](z=>z['name']['toLowerCase']()===p['toLowerCase']()))continue;j['add'](o['key']);const q=[];for(const z of b){for(const A of z['from']??[]){if(typeof A==='string'||A['guard_key']!==o['key'])continue;q['push']({'u':A['prev'],'v':z['name']});}}const s=[],w=[];let x=![];const y=new Map();for(const {u:B,v:C}of q){const D=B['toLowerCase']();let E=y['get'](D);!E&&(E=enumeratePathClasses(c,f,B,p,s),y['set'](D,E));if(E['capped'])w['push'](B+'→'+C);if(E['violated'])x=!![];}if(!x)continue;h['push']({'rule_id':'PATH-CLASS-ANCHOR-01','severity':'high','title':'History-time\x20anchor\x20\x27'+p+'\x27\x20is\x20missing\x20from\x20some\x20path\x20class\x20reaching\x20guard\x20\x27'+o['key']+'\x27\x20—\x20'+'the\x20guard\x20aborts\x20(MovePrimitiveRuntimeError),\x20not\x20a\x20clean\x20false','detail':'A\x20guard\x20purpose\x20that\x20declares\x20a\x20HISTORY-time\x20anchor\x20(progress.history.time\x20...,\x20next_node=\x27'+p+'\x27,\x20'+('find=last)\x20hard-depends\x20on\x20node\x20\x27'+p+'\x27\x20being\x20present\x20in\x20the\x20order\x27s\x20history.\x20An\x20order\x20that\x20reaches\x20')+('one\x20of\x20this\x20guard\x27s\x20edges\x20via\x20a\x20path\x20class\x20that\x20never\x20visits\x20\x27'+p+'\x27\x20makes\x20that\x20repository\x20query\x20')+'return\x20W_FIELD_NOT_FOUND,\x20and\x20the\x20passport\x20validator\x20re-raises\x20it\x20as\x20a\x20MovePrimitiveRuntimeError:\x20the\x20'+'ENTIRE\x20guard\x20aborts\x20instead\x20of\x20returning\x20a\x20clean\x20predicate\x20false,\x20so\x20whatever\x20it\x20gates\x20(an\x20expiry,\x20a\x20'+'release,\x20a\x20refund\x20window)\x20never\x20evaluates\x20on\x20that\x20path\x20class.\x20Topological\x20reachability\x20(F-TPL-01)\x20is\x20'+'necessary\x20but\x20NOT\x20sufficient\x20—\x20the\x20anchor\x20must\x20DOMINATE\x20every\x20path\x20class\x20reaching\x20the\x20guarded\x20edge\x27s\x20'+('pre-node.\x20Violating\x20path\x20classes\x20(start→...→pre-node\x20avoiding\x20\x27'+p+'\x27):\x20'+s['join'](';\x20')+'.')+(w['length']>0x0?'\x20Path\x20enumeration\x20hit\x20the\x20'+PATH_CLASS_PATH_CAP+'-path\x20determinism\x20cap\x20on\x20'+w['join'](',\x20')+'\x20—\x20'+'those\x20edges\x20were\x20skipped\x20as\x20under-audited,\x20not\x20cleared.':''),'suggestion':'Anchor\x20the\x20history-time\x20leg\x20only\x20on\x20a\x20node\x20present\x20on\x20EVERY\x20path\x20class\x20that\x20can\x20reach\x20the\x20guarded\x20'+'edges\x20(the\x20dominance\x20rule)\x20—\x20e.g.\x20anchor\x20an\x20expiry\x20on\x20the\x20delivered\x20entry\x20rather\x20than\x20a\x20renewal-only\x20'+'node;\x20or\x20split\x20the\x20edge/guard\x20so\x20each\x20path\x20class\x20gets\x20its\x20own\x20anchor\x20(a\x20logic_or\x20of\x20per-class\x20anchors).'});}return h;}function siblingForwardExclusivityChecks(a){const b=a['machine_shape'];if(b['length']===0x0)return[];const d=new Map();for(const n of a['guards'])if(n['key'])d['set'](n['key'],n);const f=new Map();for(const o of a['conditional_guards']??[]){f['set'](o['param'],(f['get'](o['param'])??0x0)+0x1);}const h=new Set((a['conditional_guards']??[])['filter'](p=>(f['get'](p['param'])??0x0)>0x1)['map'](p=>p['guard_key'])),j=a['allocator']['rows']??[],k=p=>{const q=j['find'](s=>s['guard_key']===p||s['guard_key']===p+'_refund');return q?String(q['value']??q['value_from']??q['mode']):undefined;},l=p=>{if(!p)return![];const q=d['get'](p);if(!q)return![];return/time_lock/['test'](q['template_id'])||/until\b|within\b|\bdays?\b|\bhours?\b|\bwindow\b|deadline|before (?:check[- ]?in|delivery|deadline)/i['test'](q['purpose']);},m=[];for(const p of b){const q=new Map();for(const s of p['from']??[]){const w=typeof s==='string'?{'prev':s}:s;if(!w['prev'])continue;const x=w['operator']??(w['permission_index']!==undefined?'perm:'+w['permission_index']:p['operator']??'merchant'),y=q['get'](w['prev'])??[];y['push']({'guard_key':w['guard_key'],'actor':x}),q['set'](w['prev'],y);}for(const [z,A]of q){const B=A['filter'](H=>H['guard_key']!==undefined);if(B['length']<0x2)continue;const C=new Set(B['map'](H=>H['actor']));if(C['size']>0x1)continue;const D=B['filter'](H=>l(H['guard_key']));if(D['length']<0x2)continue;if(D['every'](H=>h['has'](H['guard_key'])))continue;const E=D['map'](H=>H['guard_key']),F=[...new Set(E['map'](H=>k(H))['filter'](H=>H!==undefined&&H!==''))],G=F['length']>0x1;m['push']({'rule_id':'SIBLING-FORWARD-EXCLUSIVITY','severity':G?'high':'medium','title':'Node\x20\x27'+p['name']+'\x27\x20(pair\x20from\x20\x27'+z+'\x27)\x20carries\x20'+D['length']+'\x20sibling\x20forwards\x20gated\x20by\x20'+('time-window\x20guards\x20under\x20one\x20actor\x20('+[...C]['join']('/')+')\x20—\x20no\x20on-chain\x20mutual\x20exclusion'),'detail':G?'Sibling\x20guards\x20resolve\x20to\x20DIFFERENT\x20settlement\x20amounts\x20('+F['join']('\x20vs\x20')+').\x20Sibling\x20forwards\x20on\x20one\x20'+'NodePair\x20have\x20no\x20on-chain\x20mutual\x20exclusion\x20and\x20Order.allocation\x20is\x20write-once\x20—\x20all\x20their\x20rails\x20share\x20'+'ONE\x20immutable\x20pool,\x20so\x20overlapping\x20windows\x20let\x20the\x20actor\x20fire\x20the\x20most\x20favourable\x20branch\x20(79678\x20audit\x20'+'F-01.1:\x20a\x20guest\x2040\x20days\x20out\x20can\x20satisfy\x20both\x20a\x20full-refund\x20and\x20a\x20partial-refund\x20tier).':'Sibling\x20forwards\x20on\x20one\x20NodePair\x20have\x20no\x20on-chain\x20mutual\x20exclusion;\x20if\x20their\x20time\x20windows\x20overlap,\x20the\x20'+'actor\x20picks\x20the\x20branch.\x20Verify\x20the\x20intervals\x20are\x20mutually\x20exclusive\x20by\x20construction.','suggestion':G?'Emit\x20ONE\x20forward\x20+\x20ONE\x20rail\x20per\x20selected\x20option\x20(M-T7\x20conditional\x20emission,\x20e.g.\x20user_inputs\x20cancellation_policy\x201..6),\x20'+'or\x20make\x20the\x20guards\x27\x20intervals\x20provably\x20disjoint\x20so\x20at\x20most\x20one\x20can\x20pass\x20at\x20any\x20moment.':'Make\x20the\x20sibling\x20guards\x27\x20time\x20intervals\x20provably\x20disjoint\x20(at\x20most\x20one\x20satisfiable\x20at\x20any\x20moment),\x20'+'or\x20split\x20each\x20option\x20onto\x20its\x20own\x20NodePair\x20so\x20mounting\x20is\x20a\x20build-time\x20choice.'});}}return m;}function guardHasCompiledClaimSurface(a){if(a['host']==='reward')return![];let b;if(a['root']!==undefined||a['table']!==undefined)b=[a['root']??null,a['table']??null];else{if(typeof a['template_id']==='string'&&a['template_id']['length']>0x0){const c=fillGuardTemplate(a['template_id'],a['params']??{});if(!c['ok'])return![];b=[c['root']??null,c['table']??null];}else return![];}return/claimed_by|principal_refunded/i['test'](JSON['stringify'](b));}function serialClaimWindowChecks(a){const b=a['machine_shape']['some'](m=>/claim(?!ed_by)/i['test'](m['name']))||a['guards']['some'](m=>guardHasCompiledClaimSurface(m));if(!b)return[];const c=a['allocator']['rows']??[],d=c['some'](m=>m['track']==='settlement'&&(m['mode']==='surplus'||m['mode']==='rate'&&m['value']===0x2710));if(!d)return[];const e=templateText(a),f=a['machine_shape']['some'](m=>/claim_window/i['test'](m['name'])),g=/serial claim[- ]window|claim_window.*serial|serial[- ]claim|claims? (is|are|always) adjudicated while the pool is intact|between checkout and payout|before (any )?release/i['test'](e),h=a['machine_shape']['find'](m=>/(?:claim|objection|dispute)_filed/i['test'](m['name'])),j=h?a['machine_shape']['flatMap'](m=>(m['from']??[])['flatMap'](o=>typeof o!=='string'&&o['prev']===h['name']?[o]:[])):[],k=!!h&&j['length']>0x0&&j['every'](m=>!/settle|release|complete|refund|payout/i['test'](m['forward']??'')||m['forward']==='ArbRefund')&&(h['from']??[])['some'](m=>typeof m!=='string'&&/(?:^File(?:Dispute|Claim)$)|Objection/['test'](m['forward']??'')),l=((()=>{const m=a['machine_shape']['find'](o=>/return/i['test'](o['name']));if(!m)return![];const n=(m['from']??[])['some'](o=>typeof o!=='string'&&/return_window/i['test'](o['guard_key']??'')&&a['machine_shape']['some'](p=>p['name']===o['prev']&&p['semantic_role']==='final'));return n&&/first of .{0,48}wins|to move the money wins/i['test'](e);})());if(f&&g||k||l)return[{'rule_id':'D2-SERIAL-CLAIM-WINDOW','severity':'low','title':'Serial\x20ordering\x20gates\x20the\x20full-drain\x20release\x20(ABNB2\x20window\x20or\x20case-waypoint\x20park)','detail':'The\x20template\x20carries\x20claim\x20machinery\x20AND\x20a\x20full-drain\x20settlement\x20group\x20(Rate\x2010000\x20/\x20Surplus),\x20'+'and\x20resolves\x20the\x20race\x20by\x20serial\x20ordering:\x20either\x20a\x20claim_window\x20node\x20between\x20delivery\x20'+'confirmation\x20and\x20payout\x20(the\x20release\x20fires\x20only\x20after\x20the\x20window\x20closed\x20with\x20no\x20upheld\x20claim),\x20'+'or\x20a\x20case\x20waypoint\x20PARK\x20between\x20them\x20—\x20claim_filed\x20or\x20the\x20dispute-family\x20objection_filed\x20'+'(while\x20a\x20case\x20is\x20open\x20the\x20order\x20parks\x20at\x20the\x20'+'waypoint\x20and\x20every\x20settlement\x20edge\x20fires\x20only\x20from\x20the\x20post-waypoint\x20node,\x20so\x20the\x20pool\x20is\x20'+'intact\x20whenever\x20a\x20venue\x20ruling\x20lands\x20—\x20the\x20waypoint\x27s\x20exits\x20carry\x20no\x20money\x20rail\x20of\x20their\x20own;\x20'+'the\x20canonical\x20ArbRefund\x20award\x20forward\x20rides\x20the\x20destination\x20terminal\x27s\x20node-gated\x20sweep).','suggestion':'Verify\x20the\x20release\x20guard\x20anchors\x20on\x20progress.current_time\x20of\x20the\x20claim_window\x20entry\x20'+'(witness-derived),\x20not\x20on\x20order.time\x20—\x20a\x20booking-time\x20delay\x20has\x20always\x20expired\x20before\x20'+'checkout\x20and\x20gives\x20no\x20post-delivery\x20protection.'}];return[{'rule_id':'D2-SERIAL-CLAIM-WINDOW','severity':'high','title':'Full-drain\x20release\x20can\x20fire\x20while\x20a\x20claim\x20is\x20still\x20openable\x20—\x20FCFS\x20race\x20on\x20one\x20pool\x20(FACT-ALLOC-03)','detail':'The\x20template\x20carries\x20claim\x20machinery\x20AND\x20a\x20full-drain\x20settlement\x20group\x20(Rate\x2010000\x20or\x20Surplus),\x20'+'but\x20no\x20serial\x20claim_window\x20node\x20orders\x20them:\x20the\x20payout\x20and\x20a\x20later\x20claim\x20race\x20first-come-first-served\x20'+'on\x20the\x20SAME\x20pool,\x20and\x20the\x20chain\x20has\x20no\x20holdback\x20primitive\x20(fix\x20is\x20the\x20PAID\x20sum\x20of\x20Amount\x20legs,\x20on\x20chain).\x20Once\x20the\x20release\x20fires,\x20a\x20claim\x20can\x20pay\x20nothing\x20from\x20the\x20pool.\x20'+'Airbnb\x20mainnet\x20audit\x202026-10-07:\x20the\x20parallel\x20payout/claim\x20design\x20paid\x20the\x20host\x20in\x20full\x20and\x20left\x20'+'the\x20claim\x20window\x20with\x20an\x20empty\x20pool.','suggestion':'Insert\x20a\x20SERIAL\x20claim_window\x20node\x20between\x20delivery\x20confirmation\x20and\x20payout\x20(ABNB2-validated):\x20'+'checkout\x20→\x20claim_window\x20→\x20payout,\x20with\x20exactly\x20two\x20exits\x20—\x20FileClaim\x20(inside\x20the\x20window,\x20'+'Clock\x20<=\x20current_time(claim_window)\x20+\x20claim_window_days)\x20and\x20ReleaseNoClaim\x20(window\x20elapsed).\x20'+'Gate\x20the\x20release\x20allocator\x20on\x20the\x20post-window\x20node,\x20and\x20give\x20a\x20denied\x20claim\x20its\x20own\x20release\x20'+'forward\x20so\x20no\x20stop\x20node\x20holds\x20funds.'}];}function dismissEdgeGuardChecks(a){const b=a['machine_shape']['some'](d=>/claim/i['test'](d['name']))||a['guards']['some'](d=>/claim/i['test'](d['purpose']));if(!b)return[];const c=[];for(const d of a['machine_shape']){for(const e of d['from']??[]){if(typeof e==='string')continue;if(!e['forward']||!/dismiss|denied|rejected/i['test'](e['forward']))continue;if(e['guard_key']&&e['guard_key']['trim']()!=='')continue;c['push']((e['prev']??'?')+'\x20─'+e['forward']+'→\x20'+d['name']);}}if(c['length']===0x0)return[];return[{'rule_id':'D2-DISMISS-EDGE-GUARD','severity':'high','title':'Claim-dismissal\x20edge\x20is\x20a\x20bare\x20permission\x20wire\x20—\x20the\x20platform\x20can\x20dismiss\x20and\x20release\x20with\x20no\x20ruling\x20evidence\x20(N-T2)','detail':'These\x20dismissal\x20edges\x20carry\x20permission_index\x20but\x20NO\x20guard:\x20'+c['join'](';\x20')+'.\x20The\x20holder\x20of\x20that\x20permission\x20can\x20dismiss\x20the\x20buyer\x27s\x20claim\x20and\x20fire\x20the\x20release/payout\x20in\x20one\x20'+'step,\x20with\x20nothing\x20on-chain\x20proving\x20a\x20ruling\x20ever\x20happened\x20—\x20the\x20serial\x20claim\x20window\x27s\x20time\x20'+'ordering\x20is\x20defeated\x20by\x20its\x20own\x20escape\x20hatch.','suggestion':'Gate\x20each\x20dismissal\x20edge\x20on\x20tpl_forward_arb_ruling_dismissed\x20(arb.order\x20==\x20order\x20AND\x20'+'arb.indemnity.amount\x20==\x200):\x20the\x20native\x20indemnity.amount\x20query\x20errors\x20on\x20a\x20None\x20field,\x20so\x20the\x20'+'leg\x20passes\x20ONLY\x20for\x20a\x20standing\x20Some(0)\x20ruling\x20—\x20never-ruled\x20and\x20reset/objection\x20states\x20(both\x20'+'None)\x20fail\x20closed,\x20and\x20a\x20buyer-favor\x20ruling\x20(Some(>0))\x20fails\x20the\x20equality.\x20ONE\x20INSTANCE\x20PER\x20'+'dismissal\x20edge\x20—\x20never\x20share\x20the\x20guard\x20between\x20two\x20forwards.\x20Never\x20express\x20the\x20gate\x20as\x20'+'\x27arb.indemnity\x20some\x20==\x20false\x27\x20or\x20arb.status\x20(R-X1-16).'}];}function noteNodeDriftChecks(a){const b=new Set(a['machine_shape']['map'](d=>d['name']['toLowerCase']())),c=[];for(const d of a['build_notes']??[]){for(const e of d['matchAll'](/must (?:create|add|declare|include)[^.;]*?'([a-z0-9_]+)'/gi)){const f=e[0x1]['toLowerCase']();if(!b['has'](f))c['push']('\x27'+f+'\x27');}}if(c['length']===0x0)return[];return[{'rule_id':'NOTE-NODE-DRIFT','severity':'medium','title':'A\x20build_note\x20mandates\x20a\x20node\x20the\x20machine_shape\x20does\x20not\x20contain\x20—\x20prose\x20running\x20ahead\x20of\x20structure\x20(N-T6)','detail':'These\x20node\x20names\x20appear\x20under\x20MUST-create\x20language\x20in\x20build_notes\x20but\x20are\x20absent\x20from\x20machine_shape:\x20'+c['join'](',\x20')+'.\x20The\x20generator\x20will\x20read\x20the\x20note\x20and\x20invent\x20a\x20topology\x20the\x20structural\x20audit\x20(edges,\x20reachability,\x20'+'fund-exit\x20coverage)\x20never\x20examined\x20—\x20exactly\x20how\x20unguarded\x20edges\x20and\x20orphan\x20nodes\x20escaped\x20earlier\x20audits.','suggestion':'Either\x20land\x20the\x20mandated\x20node\x20in\x20machine_shape\x20WITH\x20its\x20from-edges\x20in\x20the\x20same\x20edit\x20(a\x20spliced\x20node\x20'+'without\x20edges\x20is\x20a\x20compile\x20blocker\x20and\x20a\x20reachability\x20finding),\x20or\x20reword\x20the\x20note\x20to\x20guidance\x20'+'language\x20(\x27model\x20it\x20as\x27,\x20\x27e.g.\x27)\x20so\x20the\x20optional\x20extension\x20is\x20not\x20read\x20as\x20a\x20structural\x20mandate.'}];}function noteArbBranchDriftChecks(a){const b='tpl_forward_arb_ruling_dismissed',c=(a['guards']??[])['some'](f=>f['template_id']===b);if(c)return[];const d=/\b(?:assembl\w+|mount\w*|carr\w+|ships?|includes?|declares?|has|have)\s+(?:no|not|never|neither)\b|\b(?:no|not|never|without|absent|lacks?|lacking|omits?|unmounted)\s+(?:tpl_forward_arb_ruling_dismissed|dismiss(?:al|ed)\s+(?:leg|edge|branch|forward))\b/i,e=[];for(const f of a['build_notes']??[]){for(const g of f['matchAll'](/\barb_dismissed_resume\b|\bBF-14 branch\b/gi)){const h=Math['max'](0x0,(g['index']??0x0)-0xa0),j=Math['min'](f['length'],(g['index']??0x0)+g[0x0]['length']+0xa0);if(d['test'](f['slice'](h,j)))continue;if(!e['includes'](g[0x0]))e['push'](g[0x0]);}}if(e['length']===0x0)return[];return[{'rule_id':'NOTE-ARB-BRANCH-DRIFT','severity':'medium','title':'A\x20build_note\x20asserts\x20an\x20arbitration\x20dismissal\x20branch\x20the\x20archetype\x20does\x20not\x20assemble\x20—\x20prose\x20promising\x20a\x20re-route\x20the\x20topology\x20cannot\x20fire','detail':'build_notes\x20assert\x20the\x20merchant-favour\x20dismissal\x20branch\x20('+e['join'](',\x20')+(')\x20but\x20no\x20guards[]\x20row\x20mounts\x20'+b+'.\x20The\x20note\x20therefore\x20promises\x20an\x20automatic\x20re-route\x20on\x20a\x20')+'zero\x20or\x20below-floor\x20award;\x20the\x20real\x20shape\x20is\x20a\x20MACHINE\x20NO-OP\x20—\x20the\x20order\x20rests\x20where\x20the\x20dismissal\x20'+'left\x20it\x20and\x20the\x20merchant-favour\x20outcome\x20needs\x20the\x20ordinary\x20settle\x20forward\x20(live\x20case:\x20'+'retail/preorder-deposit\x27s\x20BF-14\x20claim,\x20v161).','suggestion':'Either\x20mount\x20'+b+'\x20as\x20a\x20guards[]\x20row\x20WITH\x20its\x20machine_shape\x20edge\x20in\x20the\x20same\x20edit,\x20or\x20reword\x20'+'the\x20note\x20to\x20state\x20the\x20real\x20shape\x20—\x20that\x20a\x20dismissed\x20award\x20fires\x20no\x20edge,\x20where\x20the\x20order\x20rests,\x20and\x20'+'which\x20existing\x20forward\x20the\x20operator\x20must\x20fire.\x20A\x20note\x20that\x20discloses\x20the\x20absence\x20is\x20correct\x20and\x20'+'stays\x20exempt.'}];}function syntheticMachine(a){const b=a['machine_shape']['map'](e=>({'name':e['name'],'description':e['role'],'operator':e['operator']})),c=[],d=(e,f)=>[{'name':e,'weight':0x1,'named_operator':f==='order_payer'?'':'order_holder'}];b['length']>0x0&&c['push']({'prev_node':'','next_node':b[0x0]['name'],'threshold':0x1,'forwards':d('enter_'+b[0x0]['name'],b[0x0]['operator'])});for(let e=0x0;e<b['length']-0x1;e++){const f=b[e]['name'],g=b[e+0x1];if(BRANCH_STATE_REGEX['test'](g['name']))continue;c['push']({'prev_node':f,'next_node':g['name'],'threshold':0x1,'forwards':d(f+'_to_'+g['name'],g['operator'])});}if(b['length']>0x0)for(const h of b){BRANCH_STATE_REGEX['test'](h['name'])&&c['push']({'prev_node':b[0x0]['name'],'next_node':h['name'],'threshold':0x1,'forwards':d('to_'+h['name'],h['operator'])});}return{'nodes':b,'pairs':c};}function singleNodeGraph(a){return{'network':ENTRYPOINT['Testnet'],'seed':a['id'],'builtAt':Date['now'](),'nodes':new Map([[a['id'],a]]),'edges':[],'out':new Map(),'inc':new Map(),'gaps':[],'truncations':[],'rpcReport':{'batches':0x0,'byChannel':{'objects':0x0,'keyedFields':0x0,'tables':0x0,'events':0x0},'dedupHits':0x0},'budgetExhausted':{}};}function analyzerFindings(a){const b=makeProposalNode('machine',syntheticMachine(a)),c=singleNodeGraph(b),d=buildViewport(c,c['seed'],'neutral');return runNodeAnalyzers(d,[machineRuleNodeAnalyzer,allocationRuleNodeAnalyzer]);}const SEVERITY_ORDER={'low':0x0,'medium':0x1,'high':0x2,'critical':0x3},ONEWAY_GATE_REGEX=/dispute[a-z]*\s*(?:count|len(?:gth)?)?[^.;:\n]{0,24}===?\s*0\b/gi,ONEWAY_NEGATION_REGEX=/\b(?:never|do\s+not|don'?t|not|avoid|instead|substitute|one-way\s+door|welds?|append-only|rather\s+than)\b/i;function onewayDisputeChecks(a){const b=[...a['guards']['map'](d=>['guard\x20'+d['template_id'],d['purpose']]),...(a['allocator']['rows']??[])['map']((d,e)=>['allocator\x20row\x20'+e,d['note']??'']),['allocator\x20description',a['allocator']['description']],...a['build_notes']['map']((d,e)=>['build\x20note\x20'+e,d]),...a['trust_mechanisms']['map']((d,e)=>['trust\x20mechanism\x20'+e,d])],c=[];for(const [d,e]of b){if(!e)continue;ONEWAY_GATE_REGEX['lastIndex']=0x0;for(let f=ONEWAY_GATE_REGEX['exec'](e);f!==null;f=ONEWAY_GATE_REGEX['exec'](e)){const g=e['slice'](Math['max'](0x0,f['index']-0x5a),f['index']+f[0x0]['length']+0x5a);if(ONEWAY_NEGATION_REGEX['test'](g))continue;c['push'](d+':\x20\x22'+f[0x0]['trim']()+'\x22');}}if(c['length']===0x0)return[];return[{'rule_id':'R-ONEWAY-DISPUTE','severity':'critical','title':'Dispute-count\x20gate\x20on\x20an\x20append-only\x20vector\x20—\x20the\x20first\x20filing\x20welds\x20the\x20rail\x20shut','detail':'Order.dispute\x20only\x20grows\x20(the\x20filing\x20entry\x20appends;\x20nothing\x20ever\x20removes).\x20A\x20guard\x20gated\x20on\x20'+'\x22dispute\x20count\x20==\x200\x22\x20is\x20monotone-false\x20after\x20the\x20first\x20case,\x20so\x20one\x20filing\x20permanently\x20closes\x20the\x20'+'gated\x20rail\x20and\x20strands\x20the\x20escrow\x20—\x20verified\x20on\x20mainnet\x20(az-mn-261007\x20T5:\x20the\x20reviewed\x20order\x20walked\x20'+'case\x20->\x20ruling\x20->\x20payout\x20and\x20its\x202.38\x20principal\x20froze\x20with\x20no\x20exit).\x20Offending\x20surfaces:\x20'+c['join'](';\x20')+'.','suggestion':'Gate\x20on\x20NODE\x20state\x20instead\x20(decision\x2011):\x20the\x20rail\x20fires\x20at\x20a\x20post-resolution\x20terminal\x20node;\x20a\x20'+'settlement\x20track\x20with\x20refund\x20exposure\x20freezes\x20NEW\x20payouts\x20with\x20logic_not[order.dispute.open]\x20'+'(query\x201576)\x20and\x20resolved-awaiting-stamp\x20flows\x20drive\x20the\x20stamp\x20with\x20order.dispute.unstamped\x20'+'(query\x201578).\x20NEVER\x20substitute\x20dispute\x20count\x20==\x200\x20(append-only\x20one-way\x20door),\x20and\x20NEVER\x20a\x20'+'claimed_by\x20leg\x20on\x20a\x20fund\x20rail\x20(R-FUND-RAIL-CLAIMED-BY\x20critical).'}];}const ARB_REFERENCE_REGEX=/\barbitration\b|\barbitrator\b|compensation[ -]fund|\barb\.|\bruling\b/i,NODE_GATE_SIGNAL_REGEX=/tpl_allocator_node_gate_(?:refund|recover|settle)|progress\.current|current\s*==\s*["']?\w+["']?|terminal|refund_node|settle_node/i;function noEscrowExitChecks(a){const b=a['allocator']['rows']??[];if(!b['some'](d=>d['track']==='refund'))return[];const c=templateText(a,b['map'](d=>d['note']??''));if(!ARB_REFERENCE_REGEX['test'](c))return[];if(NODE_GATE_SIGNAL_REGEX['test'](c))return[];return[{'rule_id':'R-NO-ESCROW-EXIT','severity':'high','title':'Refund\x20rail\x20shows\x20no\x20node-gated\x20exit\x20—\x20the\x20principal\x20can\x20strand\x20mid-flight\x20(T5\x20shape)','detail':'The\x20template\x20declares\x20an\x20order-anchored\x20refund\x20rail\x20and\x20references\x20arbitration,\x20but\x20no\x20guard\x20design,\x20'+'row\x20note,\x20or\x20build\x20note\x20declares\x20a\x20NODE-GATED\x20exit\x20(a\x20tpl_allocator_node_gate_*\x20family,\x20a\x20terminal\x20'+'node,\x20or\x20a\x20progress.current\x20gate).\x20Decision\x2011:\x20fund\x20rails\x20pay\x20strictly\x20from\x20node\x20state\x20—\x20an\x20'+'ungated\x20rail\x20has\x20no\x20terminal\x20discipline\x20and\x20the\x20escrow\x20principal\x20can\x20freeze\x20mid-flight\x20'+'(mainnet\x20az-mn-261007\x20T5:\x202.38\x20stranded\x20at\x20a\x20node\x20that\x20kept\x20no\x20exit).\x20The\x20retired\x20claimed_by\x20'+'polarity\x20pairing\x20is\x20NOT\x20the\x20fix\x20—\x20a\x20claimed_by\x20leg\x20on\x20a\x20fund\x20rail\x20is\x20the\x20R-FUND-RAIL-CLAIMED-BY\x20critical.','suggestion':'Bind\x20the\x20refund\x20row\x20to\x20tpl_allocator_node_gate_refund\x20(terminal-node-gated\x20at\x20the\x20refund\x20terminal)\x20'+'and\x20pair\x20the\x20merchant-side\x20residual\x20sweep\x20with\x20tpl_allocator_node_gate_recover\x20(terminal-node-gated).\x20'+'The\x20arbitration\x20award\x20is\x20the\x20indemnity\x20track\x27s\x20separate\x20commercial\x20payout\x20—\x20overlap\x20with\x20a\x20due\x20refund\x20'+'is\x20LEGAL\x20and\x20disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20(amz9\x20A-1).\x20FRAMING\x20CAVEAT\x20'+'(bs-mn-261022\x20F-BS-54/56):\x20order.claimed_by\x20records\x20\x27the\x20case\x20closed\x20onto\x20the\x20order\x27,\x20never\x20\x27who\x20'+'won\x27\x20—\x20present\x20any\x20post-ruling\x20recovery\x20as\x20\x27escrow\x20exits\x20to\x20the\x20seller\x20after\x20the\x20case\x20closed\x20against\x20'+'the\x20buyer\x27,\x20NEVER\x20as\x20\x27the\x20merchant\x20won\x27.'}];}const CLAIMED_FALSE_RE=/claimed_by\s*(?:is\s+)?(?:none|some\s*==\s*false)/i,CLAIMED_TRUE_RE=/claimed_by\s*(?:is\s+)?some\s*==\s*true/i;function pairingProseOnlyChecks(a){const b=a['allocator']['rows']??[];if(!b['some'](e=>e['track']==='refund'))return[];const c=templateText(a);if(!ARB_REFERENCE_REGEX['test'](c))return[];const d=[...a['guards']['filter'](e=>e['host']!=='machine'&&(CLAIMED_FALSE_RE['test'](e['purpose']??'')||CLAIMED_TRUE_RE['test'](e['purpose']??'')))['map'](e=>'guard\x20'+e['template_id']+'\x20purpose'),...a['build_notes']['map']((e,f)=>CLAIMED_FALSE_RE['test'](e)||CLAIMED_TRUE_RE['test'](e)?'build\x20note\x20'+f:undefined)['filter'](e=>e!==undefined)];if(d['length']===0x0)return[];return[{'rule_id':'R-PAIRING-PROSE-ONLY','severity':'medium','title':'Retired\x20claimed_by\x20refund/recovery\x20pairing\x20still\x20promised\x20in\x20prose\x20(decision\x2011)','detail':'The\x20claimed_by\x20none/some\x20refund/recovery\x20pairing\x20is\x20the\x20RETIRED\x20INV-C1\x20doctrine:\x20under\x20decision\x2011\x20'+'fund\x20rails\x20pay\x20strictly\x20from\x20node\x20state\x20and\x20never\x20read\x20order.claimed_by,\x20and\x20the\x20arbitration\x20award\x20'+'is\x20the\x20indemnity\x20track\x27s\x20separate\x20commercial\x20payout.\x20Surfaces\x20still\x20teaching\x20the\x20pairing:\x20'+(d['join'](';\x20')+'.\x20A\x20claimed_by\x20leg\x20on\x20a\x20fund\x20rail\x20is\x20the\x20R-FUND-RAIL-CLAIMED-BY\x20critical;\x20')+'prose-only\x20promises\x20mislead\x20the\x20builder\x20into\x20synthesizing\x20it.','suggestion':'Rewrite\x20the\x20prose\x20to\x20node-gated\x20exits:\x20the\x20refund\x20rail\x20fires\x20at\x20its\x20refund\x20terminal\x20'+'(tpl_allocator_node_gate_refund)\x20and\x20the\x20merchant-side\x20residual\x20sweep\x20at\x20the\x20recovery\x20terminals\x20'+'(tpl_allocator_node_gate_recover).\x20Overlap\x20between\x20a\x20refund\x20and\x20an\x20award\x20is\x20LEGAL\x20and\x20disclosed\x20at\x20'+'the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20(amz9\x20A-1).\x20Arb-TRACK\x20reads\x20of\x20the\x20claimed_by\x20payout\x20state\x20'+'(tpl_forward_arb_ruling_won\x20family)\x20remain\x20legal\x20on\x20the\x20arbitration\x20side.'}];}const CLAIMED_WIN_FRAME_RE=/\b(?:merchant|seller|producer|store|vendor|we)\b[^.;\n]{0,48}\b(?:win|wins|won|prevail(?:ed)?)\b/gi,CLAIMED_WIN_FRAME_ALT_RE=/\bdismiss(?:al|ed|s)?\b|\bbuyer\s+(?:lose|loses|lost)\b|\bclaw(?:ed|s)?\s+back\b/gi,CLAIMED_WIN_NEGATION_RE=/\b(?:never|do\s+not|don'?t|not|avoid|instead|rather\s+than|cannot)\b/i;function claimedDirectionVoidChecks(a){const b=[...(a['allocator']['rows']??[])['filter'](d=>d['track']!=='refund')['map']((d,e)=>['allocator\x20row\x20'+e+'\x20(track\x20'+d['track']+')',d['note']??'']),...a['guards']['map'](d=>['guard\x20\x27'+d['key']+'\x27',d['purpose']??''])],c=[];for(const [d,e]of b){if(!CLAIMED_TRUE_RE['test'](e))continue;for(const f of[CLAIMED_WIN_FRAME_RE,CLAIMED_WIN_FRAME_ALT_RE]){f['lastIndex']=0x0;for(let g=f['exec'](e);g!==null;g=f['exec'](e)){const h=e['slice'](Math['max'](0x0,g['index']-0x5a),g['index']+g[0x0]['length']+0x5a);if(CLAIMED_WIN_NEGATION_RE['test'](h))continue;c['push'](d+':\x20\x22'+g[0x0]['trim']()+'\x22');break;}if(c['some'](j=>j['startsWith'](d)))break;}}if(c['length']===0x0)return[];return[{'rule_id':'R-CLAIMED-DIRECTION-VOID','severity':'critical','title':'Recovery\x20rail\x20framed\x20as\x20winning-side\x20recovery\x20on\x20the\x20claimed_by\x20axis\x20—\x20polarity\x20voided\x20by\x20the\x20always-on\x20zero-indemnity\x20gate','detail':'order.claimed_by\x20is\x20written\x20when\x20the\x20case\x20is\x20CLOSED\x20onto\x20the\x20order\x20—\x20by\x20a\x20PAYING\x20claim\x20'+'(buyer-favoured)\x20or\x20by\x20the\x20dismissal\x20conclusion\x20(defendant-favoured,\x20always\x20on).\x20A\x20zero-indemnity\x20'+'award\x20itself\x20can\x20never\x20claim\x20(zero-indemnity\x20gate,\x20abort\x2011),\x20so\x20before\x20the\x20conclusion\x20existed\x20'+'claimed_by\x20stayed\x20none\x20after\x20a\x20dismissal.\x20The\x20axis\x20records\x20\x27the\x20case\x20closed\x20onto\x20this\x20order\x27,\x20'+'never\x20\x27who\x20won\x27:\x20some\x20==\x20true\x20covers\x20a\x20PAID\x20buyer\x20award\x20AND\x20a\x20concluded\x20dismissal.\x20A\x20rail\x20framed\x20'+'as\x20merchant-wins-recovery\x20therefore\x20pays\x20the\x20merchant\x20exactly\x20when\x20the\x20merchant\x20LOST\x20(live\x20'+'bs-mn-261022\x20O8)\x20unless\x20a\x20keeper\x20drives\x20the\x20dismissal\x20conclusion\x20at\x20ruling\x20time;\x20until\x20then\x20the\x20'+'paired\x20refund\x20leg\x20(some\x20==\x20false)\x20stays\x20open\x20and\x20the\x20buyer\x20loses\x20the\x20dispute\x20at\x20zero\x20cost\x20(O6).\x20Offending\x20surfaces:\x20'+c['join'](';\x20')+'.','suggestion':'Re-frame\x20the\x20rail\x27s\x20semantics\x20honestly:\x20claimed_by\x20some\x20==\x20true\x20means\x20\x27the\x20case\x20closed\x20onto\x20'+'the\x20order\x27\x20(a\x20buyer-favoured\x20award\x20was\x20PAID,\x20or\x20a\x20dismissal\x20was\x20concluded)\x20—\x20present\x20the\x20rail\x20as\x20'+'UPWC-K1\x20escrow-exit\x20(\x27the\x20awarded\x20order\x27s\x20escrow\x20principal\x20exits\x20to\x20the\x20seller\x20once\x20the\x20case\x20'+'closes\x27),\x20never\x20as\x20\x27the\x20merchant\x20won\x20the\x20dispute\x27.\x20Drive\x20the\x20dismissal\x20conclusion\x20at\x20ruling\x20time\x20'+'so\x20the\x20case\x20lands\x20on\x20the\x20order\x20and\x20the\x20refund\x20leg\x20closes.\x20Gating\x20on\x20ruling\x20DIRECTION\x20is\x20not\x20'+'expressible\x20on\x20this\x20axis\x20—\x20that\x20needs\x20the\x20chain-side\x20ruling-direction\x20accessor\x20(arb.winner,\x20bs-mn-261022).'}];}const TIER_PROMISE_RE=/\btiers?\b[^.!?\n]{0,120}?\b(earns?|earned|unlocks?|unlocked|receives?|received|gets?|claims?|claimed|grants?|granted)\b|\b(earns?|earned|unlocks?|unlocked|receives?|received|gets?|claims?|claimed|grants?|granted)\b[^.!?\n]{0,80}?\btiers?\b/i,REWARD_CONTEXT_RE=/\brewards?\b|\bbount(?:y|ies)\b|\bbonus(?:es)?\b|\bhonors?\b|\bperks?\b/i,PROHIBITION_RE=/\b(?:never promise|do not|don'?t|cannot|not constructible|unenforceable|unforced decoration|must be disclosed|MUST be disclosed|either add|drop the wording|word promises? to match|without a guard leg|no guard leg|impossible)\b/i,TIER_PREDICATE_RE=/\bhistor(?:y|ical)\b|\bperiod count\b|\bcount\s*>=|per-order repository|\brepository row\b|\btier predicate\b|\bstore_from_id\b/i;function disclosureEnforceabilityChecks(a){const b=[...a['build_notes'],...a['differences']??[],...a['guards']['map'](e=>e['purpose']??''),...(a['allocator']['rows']??[])['map'](e=>e['note']??'')],c=b['flatMap'](e=>e['split'](/(?<=[.!?])\s+/))['filter'](e=>TIER_PROMISE_RE['test'](e)&&REWARD_CONTEXT_RE['test'](e)&&!PROHIBITION_RE['test'](e)&&!TIER_PREDICATE_RE['test'](e));if(c['length']===0x0)return[];const d=a['guards']['some'](e=>TIER_PREDICATE_RE['test'](e['purpose']??''));if(d)return[];return[{'rule_id':'DISCLOSURE-ENFORCEABILITY','severity':'medium','title':'Tier-scoped\x20reward\x20promise\x20with\x20no\x20enforcement\x20leg\x20—\x20unenforceable\x20decoration','detail':'The\x20template\x27s\x20prose\x20promises\x20tier-scoped\x20rewards\x20('+c['slice'](0x0,0x2)['map'](e=>'\x22'+e['trim']()['slice'](0x0,0x8c)+'\x22')['join'](';\x20')+(c['length']>0x2?'\x20+'+(c['length']-0x2)+'\x20more':'')+'),\x20but\x20no\x20guard\x20design\x20reads\x20tier\x20evidence\x20(history\x20count,\x20per-order\x20repository\x20row).\x20Reward\x20objects\x20'+'are\x20Service-level\x20and\x20sales\x20rows\x20carry\x20no\x20reward\x20field,\x20so\x20the\x20claim\x20guard\x20gates\x20tier-agnostically:\x20'+'buyers\x20are\x20promised\x20a\x20tier\x20benefit\x20the\x20chain\x20cannot\x20verify\x20or\x20pay\x20selectively\x20(ptrn2-ln-261011\x20B3:\x20'+'\x27Co-Producer\x20earns\x20Veteran\x20rewards\x27\x20while\x20the\x20claim\x20guard\x20read\x20history\x20>=\x207\x20for\x20every\x20tier).','suggestion':'Either\x20add\x20the\x20predicate\x20—\x20a\x20claim-guard\x20leg\x20reading\x20per-order\x20repository\x20evidence\x20(or\x20history\x20'+'count)\x20so\x20each\x20tier\x27s\x20promise\x20is\x20actually\x20gated\x20—\x20or\x20reword\x20the\x20promise\x20to\x20match\x20what\x20the\x20guard\x20'+'leg\x20really\x20reads.\x20Never\x20ship\x20tier\x20wording\x20the\x20guard\x20cannot\x20enforce.'}];}function rewardBypassChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0)return[];const c=new Set();for(const l of a['guards']){if(l['host']!=='reward')continue;for(const [n,o]of Object['entries'](l['params']??{})){if(/^expected_.*_node$/['test'](n)&&typeof o==='string'&&o!=='')c['add'](o);}}if(c['size']===0x0)return[];const d=new Set(b['map'](p=>p['name'])),f=new Map(),h=new Map();for(const p of b){for(const q of p['from']??[]){const s=typeof q==='string'?q:q?.['prev'];if(s==='')continue;if(!f['has'](s))f['set'](s,[]);f['get'](s)['push'](p['name']);if(!h['has'](p['name']))h['set'](p['name'],[]);h['get'](p['name'])['push'](s);}}const j=[];for(const w of[...c]['sort']()){if(!d['has'](w)){j['push']('\x27'+w+'\x27\x20is\x20promised\x20by\x20reward-claim\x20machinery\x20but\x20absent\x20from\x20machine_shape\x20(dead\x20literal)');continue;}const x=h['get'](w)??[];if(x['length']!==0x1)continue;const y=f['get'](x[0x0])??[];if(y['length']<0x2)continue;const z=y['filter'](A=>A!==w)['map'](A=>'\x27'+A+'\x27')['join'](',\x20');j['push']('\x27'+w+'\x27\x20hangs\x20on\x20a\x20single\x20in-edge\x20from\x20\x27'+x[0x0]+'\x27\x20whose\x20sibling\x20forward(s)\x20('+z+')\x20let\x20the\x20order\x20leave\x20forever\x20—\x20the\x20promised\x20state\x20is\x20skippable');}if(j['length']===0x0)return[];return[{'rule_id':'R-REWARD-BYPASS','severity':'medium','title':'Reward-promise\x20node(s)\x20can\x20be\x20bypassed:\x20'+j['length']+'\x20skippable/unresolvable\x20promise(s)','detail':'ADVISORY\x20(never\x20blocks):\x20a\x20reward-host\x20guard\x20spec\x20promises\x20these\x20states\x20via\x20its\x20expected_*_node\x20'+'params,\x20but\x20the\x20topology\x20lets\x20an\x20order\x20miss\x20them\x20permanently\x20—\x20'+j['join'](';\x20')+'.\x20The\x20chain\x20has\x20no\x20scheduler:\x20once\x20the\x20order\x20advances\x20past\x20the\x20fork\x20through\x20the\x20sibling\x20forward\x20'+'(its\x20own\x20guard\x20passed,\x20or\x20a\x20keeper\x20edge\x20fired),\x20no\x20edge\x20leads\x20back\x20and\x20the\x20promised\x20state\x20—\x20and\x20'+'every\x20reward\x20gated\x20on\x20it\x20—\x20becomes\x20dead\x20for\x20that\x20order.\x20abnb14-mn\x20F01\x20(live):\x20the\x20review\x20window\x20'+'was\x20swallowed\x20by\x20the\x20claim\x20window\x20for\x20every\x20late\x20reviewer\x20because\x20`reviewed`\x20hung\x20on\x20a\x20single\x20'+'completed-only\x20entry\x20while\x20completed\x20also\x20opened\x20the\x20claim\x20window.\x20If\x20the\x20bypass\x20IS\x20the\x20design\x20'+'(a\x20genuinely\x20optional\x20reward),\x20leave\x20it\x20—\x20this\x20finding\x20exists\x20so\x20the\x20choice\x20is\x20deliberate\x20and\x20'+'documented\x20in\x20the\x20spec\x20purpose,\x20not\x20an\x20accident\x20of\x20array\x20order.','suggestion':'Give\x20the\x20promised\x20node\x20a\x20SECOND\x20entry\x20edge\x20from\x20the\x20post-fork\x20waypoint\x20(the\x20v102\x20fix:\x20reviewed\x20'+'re-entered\x20from\x20claim_window\x20via\x20the\x20same\x20forward),\x20or\x20demote\x20the\x20promise:\x20drop\x20the\x20'+'expected_*_node\x20param\x20and\x20say\x20in\x20the\x20spec\x20purpose\x20that\x20the\x20reward\x20rides\x20an\x20optional\x20state.\x20'+'A\x20promise\x20node\x20absent\x20from\x20machine_shape\x20is\x20a\x20dead\x20literal\x20—\x20fix\x20the\x20name\x20or\x20delete\x20the\x20param.'}];}function guardUnmountedChecks(a){const b=a['guards']['filter'](k=>typeof k['key']==='string'&&k['key']!=='');if(b['length']===0x0)return[];const d=new Set(['reward','repository','service']),f=new Set();for(const k of a['machine_shape']??[]){for(const l of k['from']??[]){if(typeof l!=='string'&&l?.['guard_key'])f['add'](l['guard_key']);}}for(const m of a['allocator']['rows']??[]){if(m['guard_key'])f['add'](m['guard_key']);}for(const o of a['conditional_guards']??[]){if(o['guard_key'])f['add'](o['guard_key']);}const g='COMPOSITION\x20PRESCRIPTION',h=p=>p['purpose']['startsWith'](g),j=b['filter'](p=>!d['has'](p['host'])&&!f['has'](p['key'])&&!h(p));if(j['length']===0x0)return[];return[{'rule_id':'R-GUARD-UNMOUNTED','severity':'medium','title':j['length']+'\x20guard\x20spec(s)\x20declare\x20a\x20key\x20nothing\x20mounts:\x20'+j['map'](p=>'\x27'+p['key']+'\x27')['join'](',\x20'),'detail':'ADVISORY\x20(never\x20blocks):\x20the\x20declared\x20key\x20surface\x20is\x20the\x20mounting\x20surface\x20—\x20an\x20edge\x27s\x20guard_key,\x20'+'an\x20allocator\x20row\x27s\x20guard_key,\x20or\x20a\x20conditional_guards\x20emission.\x20These\x20'+j['map'](p=>'\x27'+p['key']+'\x27\x20(host\x20'+p['host']+',\x20'+p['template_id']+')')['join'](',\x20')+'\x20are\x20referenced\x20by\x20none\x20of\x20them,\x20so\x20compile\x20never\x20collects\x20them\x20into\x20the\x20build\x20'+'(audit-261012\x20B3:\x20an\x20unbound\x20GuardSpec\x20is\x20never\x20emitted).\x20The\x20template\x20ships\x20the\x20spec\x27s\x20purpose\x20'+'as\x20a\x20promise\x20while\x20the\x20published\x20Machine\x20carries\x20no\x20such\x20guard\x20—\x20the\x20reader\x20believes\x20a\x20'+'protection\x20exists\x20that\x20does\x20not.','suggestion':'Mount\x20each\x20spec\x20by\x20binding\x20its\x20key\x20to\x20the\x20edge(s)\x20it\x20should\x20gate\x20(machine_shape\x20from[].guard_key)\x20'+'or\x20the\x20allocator\x20row(s)\x20it\x20should\x20cover\x20(allocator.rows[].guard_key);\x20if\x20the\x20protection\x20is\x20not\x20'+'wanted,\x20delete\x20the\x20spec\x20—\x20a\x20declared-but-unmounted\x20guard\x20is\x20dead\x20weight\x20that\x20inflates\x20the\x20trust\x20'+'surface.\x20reward/repository/service\x20hosts\x20need\x20no\x20key\x20reference\x20(host-mounted)\x20and\x20are\x20exempt.'}];}const NUMERIC_SEMANTIC_PARAM=/_(days|hours|minutes|ms|bps|pct|percent|ratio)$/;function specParamPlaneChecks(a){const b=[];for(const c of a['guards']){for(const [d,e]of Object['entries'](c['params']??{})){if(!NUMERIC_SEMANTIC_PARAM['test'](d))continue;const f=typeof e==='number'?e:typeof e==='string'&&e['trim']()!==''?Number(e):NaN;if(!Number['isFinite'](f)||f===0x0)continue;if(a['fee_params'][d]!==undefined)continue;if(bindingsFor(a['id'],c['key'])['some'](h=>h['to']===d))continue;b['push']('\x27'+c['key']+'\x27.'+d+'='+String(e));}}if(b['length']===0x0)return[];return[{'rule_id':'R-PARAM-PLANE-01','severity':'critical','title':b['length']+'\x20guard\x20spec\x20param(s)\x20hardcode\x20a\x20business\x20number\x20off\x20the\x20parameter\x20plane:\x20'+b['join'](',\x20'),'detail':'CRITICAL:\x20the\x20fill\x20merge\x20orders\x20spec\x20params\x20ABOVE\x20user\x20inputs,\x20so\x20a\x20numeric\x20'+'spec-local\x20literal\x20defeats\x20the\x20merchant\x27s\x20input\x20every\x20time.\x20None\x20of\x20these\x20keys\x20is\x20reachable\x20'+'from\x20the\x20parameter\x20plane\x20—\x20no\x20same-name\x20fee_param\x20and\x20no\x20fee-param-bindings\x20row\x20feeds\x20it\x20—\x20so\x20'+'the\x20shipped\x20literal\x20is\x20frozen\x20into\x20every\x20adopter\x27s\x20published\x20Machine\x20(README\x20decision\x2012:\x20all\x20'+'business\x20parameters\x20must\x20land\x20on\x20the\x20template\x20parameter\x20plane).\x20Motivating\x20defect:\x20group_buy\x20'+'shipped\x20review_window_days=15\x20this\x20way\x20and\x20no\x20merchant\x20could\x20change\x20the\x20promised\x20window.','suggestion':'Declare\x20a\x20same-name\x20fee_param\x20whose\x20default\x20equals\x20the\x20literal\x20and\x20DELETE\x20the\x20spec\x20literal\x20'+'(the\x20fee_params\x20fill\x20spread\x20delivers\x20the\x20value\x20—\x20keeping\x20the\x20literal\x20would\x20still\x20shadow\x20the\x20'+'merchant\x27s\x20input),\x20or\x20add\x20a\x20fee-param-bindings\x20row\x20if\x20an\x20existing\x20differently-named\x20fee\x20param\x20'+'should\x20feed\x20this\x20key.\x20If\x20the\x20number\x20is\x20genuinely\x20not\x20a\x20merchant\x20knob,\x20disclose\x20it\x20as\x20a\x20frozen\x20'+'constant\x20in\x20build_notes.'}];}function reviewWriteUnreachableChecks(a){const b=new Set();for(const f of a['machine_shape']??[]){for(const g of f['from']??[]){if(typeof g!=='string'&&g?.['guard_key'])b['add'](g['guard_key']);}}if(b['size']===0x0)return[];const c=(a['guards']??[])['filter'](h=>h['host']==='repository'&&typeof h['key']==='string'&&h['key']!==''&&b['has'](h['key']));if(c['length']===0x0)return[];const d=c['map'](h=>'\x27'+h['key']+'\x27')['join'](',\x20');return[{'rule_id':'REVIEW_WRITE_UNREACHABLE','severity':'medium','title':'Guard\x20spec(s)\x20'+d+'\x20mounted\x20as\x20BOTH\x20a\x20repository\x20write_guard\x20and\x20a\x20forward\x20guard\x20—\x20the\x20review\x20write\x20strands\x20once\x20the\x20order\x20advances','detail':'ADVISORY\x20(never\x20blocks;\x20the\x20hand-kit\x20trap):\x20the\x20repository\x20write_guard\x20is\x20evaluated\x20inside\x20the\x20'+'WRITE\x20transaction\x27s\x20passport\x20result,\x20never\x20at\x20declaration\x20time\x20—\x20the\x20'+'structured\x20write\x20must\x20execute\x20BEFORE\x20the\x20forward\x20that\x20advances\x20the\x20progress\x20state.\x20Mounting\x20the\x20'+'same\x20guard\x20on\x20both\x20faces\x20means:\x20on\x20the\x20FIRST\x20call\x20the\x20write_guard\x20passes\x20(pre-forward\x20state)\x20but\x20'+'the\x20forward\x20then\x20advances\x20the\x20order;\x20any\x20LATER\x20write\x20attempt\x20re-evaluates\x20the\x20same\x20guard\x20against\x20'+'the\x20ALREADY-ADVANCED\x20state,\x20and\x20a\x20progress-equality\x20leg\x20(the\x20review\x20idiom)\x20is\x20false\x20forever\x20—\x20the\x20'+'repository\x20row\x20becomes\x20unwritable\x20for\x20the\x20life\x20of\x20the\x20order\x20(live\x20rq-tn-261030-8693be\x20F-RQ-02:\x20'+'the\x20rating\x20write\x20stranded\x20after\x20`reviewed`,\x20the\x20order\x20re-run\x20from\x20scratch).\x20The\x20product\x20review\x20'+'composite\x20is\x20immune\x20(it\x20orders\x20the\x20structured\x20write\x20row\x20BEFORE\x20the\x20forward);\x20this\x20fires\x20for\x20'+'hand-written\x20kits\x20that\x20bypass\x20it.','suggestion':'Split\x20the\x20faces:\x20keep\x20the\x20repository\x20write_guard\x20holding\x20on\x20the\x20PRE-forward\x20state\x20and\x20execute\x20the\x20'+'write\x20row\x20BEFORE\x20the\x20forward\x20(the\x20product\x20composite\x27s\x20order),\x20OR\x20pin\x20the\x20write\x20guard\x20to\x20hold\x20on\x20'+'EVERY\x20node\x20reachable\x20after\x20the\x20write\x20window\x20(the\x20delivered-entry\x20history-leg\x20idiom)\x20so\x20a\x20post-'+'advance\x20write\x20still\x20passes.\x20Never\x20reuse\x20one\x20guard\x20spec\x20on\x20both\x20the\x20write\x20and\x20the\x20forward\x20face.'}];}function rewardReplayOpenChecks(a){const b=(a['guards']??[])['filter'](s=>s['host']==='reward');if(b['length']===0x0)return[];const c=templateText(a)+'\x20\x0a\x20'+(a['body']??''),d=[/\bper[ -]order\b[^.\n]{0,80}\b(reward|claim|bounty|incentive|bonus|rebate)/gi,/\b(?:reward|bounty|incentive|rebate)[^.\n]{0,60}\bper[ -]order\b/gi,/\beach[ -](?:order|booking|purchase|stay)\b[^.\n]{0,60}\b(?:earn|reward|claim)/gi],e=/store_from_id|storeFromId|once per buyer per order|order-scoped/i,f=/\b(?:state|disclose|say|declare|word|present)\b[^.;\n]{0,80}\b(?:scope|buyer|plainly|terms|language|whether)\b/i,g=/\b(?:protocol[ -]slot|slot\s*(?:254|255)|25[45])\b/i,h=/\breward_funding\b|review_reward_pool\b|expected\s+orders\b|merchant[- ]funded\b/i,j=/\b(?:query|id)[ -]?\d{3,4}\b|\b11?79\b|\b1051\b/i,k=(w,x)=>{const y=w['lastIndexOf']('.',x)+0x1,z=[w['indexOf']('.',x),w['indexOf'](';',x),w['indexOf']('\x0a',x)]['filter'](B=>B>0x0),A=z['length']>0x0?Math['min'](...z):w['length'];return w['slice'](y,A<0x0?w['length']:A);},l=[];for(const s of d){s['lastIndex']=0x0;for(const w of c['matchAll'](s)){const x=k(c,w['index']??0x0);if(f['test'](x))continue;if(g['test'](x))continue;if(h['test'](x))continue;if(j['test'](x))continue;l['push'](x);}}if(l['length']===0x0)return[];const n=/where:\s*\{\s*storeFromId/i,o=y=>{const z=c['indexOf'](y),A=z<0x0?y['length']:z+y['length'],B=c['indexOf']('\x0a',A);return y+c['slice'](A,B<0x0?undefined:B);},p=l['filter'](y=>{if(e['test'](y))return![];const z=o(y);return!(n['test'](z)&&/store_from_id/i['test'](z));}),q=b['some'](y=>y['params']!==undefined&&Object['keys'](y['params'])['some'](z=>/store_from_id/i['test'](z)));if(q||p['length']===0x0)return[];return[{'rule_id':'R-REWARD-REPLAY-OPEN','severity':'medium','title':'Reward\x20prose\x20promises\x20PER-ORDER\x20economics,\x20but\x20no\x20order-scoped\x20claim\x20stamp\x20(store_from_id)\x20is\x20declared\x20—\x20realized\x20economics\x20are\x20once\x20per\x20recipient\x20for\x20lifetime','detail':'ADVISORY\x20(never\x20blocks):\x20the\x20reward\x20once-claim\x20key\x20on-chain\x20is\x20(recipient,\x20guard,\x20store_from-'+'materialized\x20value)\x20(E_CLAIM_ALREADY_MADE\x20=\x2013).\x20The\x20'+'store_from\x20value\x20materializes\x20at\x20claim\x20time\x20from\x20the\x20submitted\x20Order\x20address\x20ONLY\x20when\x20the\x20guard\x20'+'pins\x20the\x20stamp\x20leg\x20(store_from_id\x20on\x20the\x20guard_add\x20entry\x20+\x20an\x20order-scoped\x20where:{storeFromId:...}\x20'+'record\x20query).\x20This\x20template\x20promises\x20per-order\x20rewards\x20in\x20prose\x20while\x20declaring\x20no\x20stamp\x20anywhere,\x20'+'so\x20every\x20claim\x20after\x20the\x20first\x20trips\x20the\x20SAME\x20tuple\x20and\x20aborts\x20—\x20the\x20buyer-facing\x20economics\x20are\x20'+'ONCE\x20PER\x20RECIPIENT\x20FOR\x20LIFETIME,\x20not\x20per\x20order.\x20Until\x20resolved,\x20word\x20the\x20promise\x20as\x20once-per-'+'merchant/recipient\x20(the\x20live\x20run\x27s\x20wording\x20fix),\x20not\x20per-order.\x20The\x20realized\x20economics\x20are\x20once\x20'+'per\x20recipient\x20for\x20lifetime.','suggestion':'Either\x20arm\x20the\x20stamp\x20—\x20guard_add\x20with\x20store_from_id\x20=\x20the\x20submitted-Order\x20slot\x20(conventionally\x200)\x20'+'and\x20a\x20claim-guard\x20leg\x20querying\x20reward\x20records\x20where:{storeFromId:{identifier:<slot>}}\x20—\x20and\x20keep\x20'+'the\x20per-order\x20wording,\x20or\x20keep\x20the\x20machinery\x20unstamped\x20and\x20reword\x20every\x20per-order\x20promise\x20to\x20'+'once-per-recipient.\x20A\x20per-order\x20promise\x20on\x20an\x20unstamped\x20guard\x20is\x20a\x20mis-selling\x20finding\x20waiting\x20'+'for\x20the\x20first\x20repeat\x20buyer.'}];}function declaredValueUnfundedChecks(a){const b=templateText(a)+'\x20\x0a\x20'+(a['body']??''),c=/\b(?:insur(?:ance|ed|es|e)?|guarantee[sd]?|money[ -]back|damage[ -]cover(?:age)?|compensat\w*)\b/gi,d=/\b(?:insur(?:ance|ed|es|e)?|money[ -]back|damage[ -]cover(?:age)?)\b|\bguarantee\w*\b[^.;\n]{0,60}\b(?:money|refund|satisfaction|compensat|cash)\b|\bcompensat\w*\b[^.;\n]{0,60}\b(?:loss|cash|value|damage|reimburse)/i,e=/\b(?:never|no|not|don'?t|cannot|must not|avoid|instead|rather than|without|off[ -]chain|only)\b/i,f=/compensation_fund|compensation fund|fund[- ]sizing|fund[- ]topup|insurance pool/i,g=/DECLARED-VALUE|DISCLOSURE-ONLY|SOLE-TRUTH/i,h=(o,p)=>{const q=o['lastIndexOf']('.',p)+0x1,w=[o['indexOf']('.',p),o['indexOf'](';',p),o['indexOf']('\x0a',p)]['filter'](y=>y>0x0),x=w['length']>0x0?Math['min'](...w):o['length'];return o['slice'](q,x<0x0?o['length']:x);},j=[];c['lastIndex']=0x0;for(const o of b['matchAll'](c)){const p=h(b,o['index']??0x0);if(!d['test'](p))continue;if(e['test'](p))continue;j['push'](p);}const k=Object['keys'](a['fee_params']??{})['some'](q=>/compensation|fund|insur|deposit/i['test'](q))||a['compensation_fund_policy']!==undefined,l=q=>{const w=b['indexOf'](q),x=w<0x0?q['length']:w+q['length'],y=b['indexOf']('\x0a',x);return q+b['slice'](x,y<0x0?undefined:y);},n=j['filter'](q=>{const w=l(q);return!f['test'](w)&&!g['test'](w);});if(k||n['length']===0x0)return[];return[{'rule_id':'R-DECLARED-VALUE-UNFUNDED','severity':'medium','title':'Prose\x20promises\x20compensation/insurance/guarantee\x20value,\x20but\x20the\x20template\x20declares\x20no\x20fund\x20surface\x20and\x20no\x20disclosure\x20marker','detail':'ADVISORY\x20(never\x20blocks):\x20the\x20compensation\x20promise\x20rides\x20prose\x20alone\x20—\x20no\x20compensation-fund\x20fee\x20'+'param,\x20no\x20fund-sizing/topup\x20declaration,\x20no\x20compensation_fund_policy,\x20and\x20none\x20of\x20the\x20established\x20'+'DECLARED-VALUE\x20/\x20DISCLOSURE-ONLY\x20markers.\x20At\x20quote\x20time\x20the\x20coverage\x20facet\x20self-computes\x20against\x20'+'the\x20ACTUAL\x20compensation_fund\x20balance\x20(0\x20here)\x20and\x20reports\x20covered:false,\x20so\x20the\x20buyer\x20reads\x20a\x20'+'protection\x20the\x20service\x20cannot\x20pay\x20(rq-tn-261030-8693be\x20F-RQ-08:\x20three\x20services\x20promised\x20'+'protection\x20with\x20fund\x20=\x200).\x20An\x20undisclosed\x20promise\x20is\x20a\x20trust\x20defect;\x20a\x20DISCLOSED\x20one\x20is\x20the\x20'+'established\x20design.','suggestion':'Either\x20declare\x20the\x20fund\x20surface\x20(a\x20compensation-fund\x20fee\x20param\x20+\x20fund-sizing/topup\x20build\x20note\x20so\x20'+'the\x20build\x20flow\x20funds\x20it),\x20or\x20mark\x20the\x20promise\x20DECLARED-VALUE\x20/\x20DISCLOSURE-ONLY\x20in\x20the\x20same\x20prose\x20'+'so\x20the\x20declaration-only\x20nature\x20is\x20explicit\x20at\x20quote\x20and\x20buy\x20time.'}];}function railUnboundChecks(a){const b=a['allocator']['rows']??[],c=b['map']((d,e)=>({'r':d,'i':e}))['filter'](({r:d})=>d['guard_key']===undefined);if(c['length']===0x0)return[];return[{'rule_id':'R-RAIL-UNBOUND','severity':'critical','title':c['length']+'\x20money\x20row(s)\x20bind\x20no\x20guard_key\x20—\x20the\x20rails\x20ship\x20uncovered\x20and\x20FUND-EXIT-01\x20goes\x20critical\x20at\x20generation','detail':'Allocator\x20rows\x20are\x20the\x20payload\x20compile\x20turns\x20into\x20order_allocators.\x20A\x20row\x20without\x20guard_key\x20emits\x20an\x20'+'allocator\x20carrying\x20no\x20guard\x20reference,\x20so\x20(a)\x20the\x20terminal\x20it\x20serves\x20has\x20no\x20resolved\x20allocator\x20guard\x20'+'(FUND-EXIT-01\x20critical),\x20and\x20(b)\x20no\x20pending-judgment\x20surface\x20exists\x20for\x20guard_resolutions\x20to\x20close\x20'+'(the\x20surface\x20is\x20keyed\x20by\x20row\x20guard_key\x20bindings)\x20—\x20the\x20build\x20is\x20deadlocked,\x20not\x20merely\x20warned\x20'+'(upw-ln-261011\x20TPL-01).\x20Unbound\x20rows:\x20'+c['map'](({r:d,i:e})=>'#'+e+'\x20('+d['track']+'/'+d['recipient']+')')['join'](',\x20')+'.','suggestion':'Declare\x20a\x20keyed\x20guard\x20spec\x20per\x20rail\x20and\x20bind\x20every\x20money\x20row\x20via\x20guard_key:\x20settlement\x20rides\x20'+'tpl_allocator_node_gate_settle\x20(the\x20kernel\x20auto-fills\x20it\x20—\x20service_name\x20is\x20seeded\x20from\x20the\x20plan,\x20'+'settle_node\x20defaults\x20to\x20\x27completed\x27)\x20plus\x20a\x20Rate-0\x20ORDER\x20anchor\x20row\x20sharing\x20the\x20key\x20(CR-01);\x20'+'refund/recovery\x20ride\x20pattern.progress_state_check\x20designs\x20gated\x20on\x20NODE\x20state\x20(decision\x2011:\x20fund\x20rails\x20'+'never\x20read\x20order.claimed_by\x20—\x20R-FUND-RAIL-CLAIMED-BY\x20critical).\x20Canonical\x20shapes:\x20freelance/catalog-tiers\x20(v48)\x20and\x20subscription/direct-fan-subscription.'}];}function counterpartyFundEvidenceChecks(a){const b=a['allocator']['rows']??[],c=a['guards']??[];if(b['length']===0x0||c['length']===0x0)return[];const d=k=>k==='pattern.repository_data_check'||typeof k==='string'&&k['startsWith']('tpl_repository_'),e=new Map();for(const k of c){if(k['key']&&d(k['template_id']))e['set'](k['key'],k);}if(e['size']===0x0)return[];const f=/order[- ]holder|order\.owner|co-?writ|co-?sign|both part(?:y|ies)|written by the (?:buyer|payer|order)|writer authorization|write[- ](?:authorization|policy|guard)|build[- ]time|pinned (?:at|to) (?:build|generation|publish)|value_from|fee_param|event evidence only|append[- ]only|a new row|re-?disclos/i,h=b['map']((l,m)=>({'r':l,'i':m}))['filter'](({r:l})=>{const m=l['guard_key']?e['get'](l['guard_key']):undefined;if(!m)return![];return!f['test'](m['purpose'])&&!(l['note']&&f['test'](l['note']));});if(h['length']===0x0)return[];const j=h['map'](({r:l,i:m})=>'#'+m+'\x20('+l['track']+'/'+(l['recipient_key']??l['recipient'])+'\x20->\x20\x27'+l['guard_key']+'\x27)')['join'](',\x20');return[{'rule_id':'R-COUNTERPARTY-FUND-EVIDENCE','severity':'high','title':h['length']+'\x20money\x20row(s)\x20gate\x20on\x20counterparty-mutable\x20repository\x20evidence\x20—\x20fund\x20terms\x20one\x20party\x20can\x20rewrite','detail':'Rows\x20'+j+'\x20bind\x20a\x20repository-data\x20gate,\x20and\x20repository.data\x20is\x20an\x20UPSERT\x20key-value\x20store:\x20'+'its\x20rows\x20stay\x20overwritable\x20by\x20their\x20author\x20(mainnet\x20A/B,\x20ofn-mn-261012\x20F-02)\x20and\x20an\x20overwrite\x20raises\x20'+'no\x20buyer-parseable\x20event\x20(the\x20overwrite\x20event\x20renders\x20\x27Unknown\x20event\x27).\x20Whoever\x20writes\x20the\x20evidence\x20'+'can\x20therefore\x20silently\x20re-decide\x20WHICH\x20rail\x20applies\x20or\x20WHETHER\x20the\x20gate\x20matches\x20at\x20all\x20—\x20the\x20audited\x20'+'airbnb\x20service\x20ran\x20its\x20refunds\x20through\x20gates\x20the\x20host\x20rewrote\x20AFTER\x20the\x20buyer\x20had\x20already\x20cancelled,\x20'+'down\x20to\x20zero\x20matching\x20rails\x20(abnb7-mn-261013\x20F25).\x20Neither\x20the\x20guard\x20purpose\x20nor\x20the\x20row\x20note\x20declares\x20'+'the\x20counterparty\x20discipline.','suggestion':'Pin\x20every\x20fund\x20TERM\x20at\x20build\x20time\x20—\x20amounts\x20and\x20tier\x20selection\x20ride\x20value_from\x20/\x20fee_params\x20and\x20freeze\x20'+'into\x20the\x20allocator\x20at\x20publish;\x20repository\x20rows\x20carry\x20EVENT\x20evidence\x20only\x20and\x20never\x20select\x20between\x20rails.\x20'+'If\x20a\x20repository\x20row\x20must\x20inform\x20money\x20at\x20all,\x20its\x20write\x20authorization\x20MUST\x20include\x20the\x20order\x20holder\x20'+'(co-write\x20/\x20proof\x20signed\x20by\x20the\x20order\x20holder)\x20and\x20changes\x20land\x20as\x20a\x20NEW\x20row\x20with\x20disclosure\x20visible\x20to\x20'+'the\x20counterparty\x20through\x20the\x20Messenger\x20channel\x20—\x20never\x20an\x20in-place\x20overwrite\x20(see\x20p2p-shortstay\x27s\x20'+'guest_claim_evidence\x20for\x20the\x20participation\x20form\x20and\x20its\x20FUND-TERMS\x20build\x20note\x20for\x20the\x20full\x20discipline).'}];}function allocReplayChecks(a){const b=a['allocator']['rows']??[];if(b['length']===0x0)return[];if(a['allocator']['once_per_order']===!![])return[];if(poolPeriodCount(a)!==undefined)return[];const c=new Map();for(const e of b){const f=e['guard_key']??'';c['set'](f,[...c['get'](f)??[],e]);}const d=[];for(const [h,j]of c){if(j['some'](n=>n['mode']==='surplus'))continue;const k=j['filter'](n=>n['mode']==='amount');let l=0x0;for(const n of j)if(n['mode']==='rate')l+=Number(n['value'])||0x0;if(k['length']===0x0&&l>=0x2710)continue;const m=h?'guard\x20\x27'+h+'\x27':'ungrouped\x20rows';k['length']>0x0&&d['push']('fixed-Amount\x20row(s)\x20under\x20'+m+':\x20'+k['map'](o=>o['track']+'/'+(o['recipient_key']??o['recipient']))['join'](',\x20')),l>0x0&&l<0x2710&&d['push']('Rate\x20leg\x20under\x20'+m+'\x20summing\x20'+l+'\x20<\x2010000');}if(d['length']===0x0)return[];return[{'rule_id':'R-ALLOC-REPLAY','severity':'high','title':'Residual-capable\x20rails\x20without\x20a\x20once-slot\x20—\x20replay\x20protection\x20is\x20only\x20the\x20drained-balance\x20side\x20effect','detail':'The\x20allocator\x20declares\x20'+d['join']('\x20and\x20')+'\x20but\x20sets\x20no\x20once_per_order\x20replay\x20slot.\x20The\x20trigger\x20'+'guard\x20can\x20be\x20satisfied\x20repeatedly,\x20and\x20each\x20run\x20pays\x20from\x20any\x20remaining\x20balance:\x20a\x20replayed\x20alloc\x20on\x20a\x20'+'drained\x20pool\x20aborts\x20\x27Insufficient\x20balance\x27\x20—\x20the\x20guard\x20clauses\x20themselves\x20PASS\x20(the\x20once-protection\x20is\x20'+'the\x20zero\x20balance,\x20not\x20a\x20consumed-once\x20flag).\x20Any\x20surplus\x20leg\x20that\x20leaves\x20balance,\x20or\x20a\x20later\x20re-deposit\x20'+'into\x20the\x20Allocation,\x20re-enables\x20payout\x20(mainnet\x20az-mn-261007\x20N5).','suggestion':'Declare\x20allocator.once_per_order=true\x20so\x20generation\x20registers\x20the\x20ONCE-FOR-OBJECT\x20submission\x20slot\x20'+'(identifier\x20254\x20—\x20the\x20chain\x20derives\x20the\x20slot\x20key\x20from\x20payment_info.for_object\x20and\x20a\x20replay\x20aborts\x20with\x20'+'code\x2016\x20regardless\x20of\x20submitted\x20bytes;\x20use\x20identifier\x20255\x20with\x20a\x20\x27period-<N>\x27\x20key\x20only\x20for\x20rails\x20that\x20'+'legitimately\x20run\x20once\x20per\x20period).\x20Alternatively\x20make\x20every\x20leg\x20exhaust\x20its\x20pool\x20(pure\x20Rate\x2010000\x20or\x20a\x20'+'Surplus\x20sweep)\x20so\x20no\x20residual\x20can\x20be\x20replayed.'}];}function arbDirectionSanityChecks(a){const b=[];let c=![],d=![];for(const f of a['guards']){const g=GUARD_TEMPLATES['find'](j=>j['id']===f['template_id']);if(g===undefined)continue;const h=JSON['stringify']({'example_table':g['example_table'],'example_root':g['example_root']});!c&&/arb\.status/['test'](h)&&(c=!![],b['push']({'rule_id':'R-DIR-01','severity':'critical','title':'Guard\x20gates\x20on\x20arb.status\x20—\x20a\x20transient\x20state\x20that\x20flips\x20AFTER\x20the\x20award\x20settles\x20(o10)','detail':'Guard\x20\x27'+f['template_id']+'\x27\x20(key\x20\x27'+f['key']+'\x27)\x20reads\x20arb.status.\x20The\x20status\x20vocabulary\x20'+'(0/1\x20confirming,\x202\x20voting,\x203\x20arbitrated,\x204\x20objectionable,\x205\x20finished,\x206\x20withdrawn)\x20'+'carries\x20NO\x20direction:\x20a\x20merchant-favor\x20and\x20a\x20buyer-favor\x20final\x20are\x20status-identical,\x20and\x20a\x20legitimate\x20'+'arb_withdraw\x20by\x20the\x20arbitrator\x20advances\x205\x20→\x206\x20after\x20the\x20award\x20settles\x20—\x20the\x20gate\x20flips\x20under\x20a\x20settled\x20'+'order\x20(o10:\x201.5\x20WOW\x20stranded;\x20IMMUT-001\x20forbids\x20fixing\x20the\x20guard\x20after\x20publish).','suggestion':'Gate\x20on\x20the\x20indemnity\x20legs\x20instead\x20—\x20the\x20only\x20direction-bearing,\x20transient-proof\x20signal:\x20'+'buyer-won\x20=\x20tpl_forward_arb_ruling_won\x20(arb.indemnity\x20some\x20AND\x20arb.indemnity.amount\x20!=\x200);\x20'+'merchant-favor\x20=\x20tpl_forward_arb_ruling_dismissed\x20(arb.indemnity.amount\x20==\x200).\x20Both\x20fail\x20closed\x20'+'on\x20None\x20(never-ruled\x20/\x20reset).'})),!d&&/arb\.indemnity some/['test'](h)&&!/arb\.indemnity\.amount/['test'](h)&&(d=!![],b['push']({'rule_id':'R-DIR-02','severity':'critical','title':'Won-gate\x20reads\x20indemnity\x20PRESENCE\x20only\x20—\x20a\x20Some(0)\x20merchant-favor\x20ruling\x20passes\x20as\x20buyer-won','detail':'Guard\x20\x27'+f['template_id']+'\x27\x20(key\x20\x27'+f['key']+'\x27)\x20checks\x20arb.indemnity\x20some\x20but\x20never\x20compares\x20'+'arb.indemnity.amount.\x20A\x20ruling\x20that\x20awarded\x20the\x20buyer\x20NOTHING\x20still\x20sets\x20presence\x20(Some(0)\x20—\x20'+'rex-mn-261021\x20T5),\x20so\x20this\x20gate\x20opens\x20a\x20buyer-ward\x20edge\x20on\x20a\x20merchant-favor\x20final.','suggestion':'Add\x20the\x20amount\x20leg\x20exactly\x20like\x20tpl_forward_arb_ruling_won:\x20arb.indemnity.amount\x20!=\x200\x20'+'(optionally\x20>\x20refund_amount\x20×\x20arb_indemnity_floor_bps\x20/\x2010000\x20to\x20bar\x20token\x20indemnities,\x20F-54).'}));}const e=a['allocator']['rows']??[];for(const j of e){const k=JSON['stringify']({'note':j['note']??'','guard':j['guard_key']??''});/(?<!former )claimed_by\s*(?:is\s+)?(?:none\b|some\b)(?![^.)]{0,90}\bREMOVED\b)/['test'](k)&&b['push']({'rule_id':'R-FUND-RAIL-CLAIMED-BY','severity':'critical','title':'Fund-rail\x20allocator\x20row\x20reads\x20claimed_by\x20—\x20the\x20two\x20rails\x20must\x20stay\x20independent\x20(Decision\x2011)','detail':'Row\x20\x27'+j['track']+'/'+(j['recipient_key']??j['recipient'])+'\x27\x20(guard\x20\x27'+(j['guard_key']??'?')+'\x27)\x20gates\x20the\x20'+'FUND\x20rail\x20on\x20claimed_by\x20—\x20the\x20compensation\x20rail\x27s\x20stamp.\x20Decision\x2011\x20(TWO-RAIL\x20INDEPENDENCE):\x20'+'fund\x20rails\x20are\x20NODE-GATED\x20and\x20NEVER\x20read\x20order.claimed_by\x20—\x20the\x20axis\x20records\x20THAT\x20a\x20compensation\x20'+'event\x20happened,\x20never\x20who\x20won\x20(F-AOF-1),\x20so\x20a\x20claimed_by\x20leg\x20welds\x20fund-payout\x20timing\x20to\x20a\x20'+'direction-blind\x20stamp\x20(five-report\x20P0\x20face:\x20tbpr7\x20F-V3-01,\x20pdd\x20T6,\x20ktt4\x20RT-01).\x20Refunds\x20complete\x20'+'on\x20order\x20nodes;\x20recover\x20clears\x20on\x20terminal\x20nodes;\x20the\x20arbitration\x20award\x20is\x20the\x20indemnity\x20track\x27s\x20'+'separate\x20commercial\x20payout\x20—\x20overlap\x20with\x20a\x20due\x20refund\x20is\x20LEGAL\x20and\x20disclosed\x20at\x20the\x20MCP\x20'+'dual-payout\x20confirmation\x20gate\x20(amz9\x20A-1).','suggestion':'Remove\x20every\x20claimed_by\x20leg\x20from\x20this\x20fund-rail\x20guard.\x20Refund\x20rail:\x20tpl_allocator_node_gate_refund\x20'+'(node\x20+\x20caller-authorization\x20legs,\x20order\x20owner\x20/\x20progress.current).\x20Recover\x20rail:\x20'+'tpl_allocator_node_gate_recover\x20(terminal-node-gated\x20sweep\x20+\x20order.service).\x20If\x20a\x20direction\x20'+'refinement\x20is\x20truly\x20required,\x20use\x20the\x20direction-bearing\x20indemnity\x20legs\x20'+'(tpl_forward_arb_ruling_won\x20/\x20_dismissed)\x20—\x20never\x20claimed_by\x20(K3\x20README\x20Decision\x2011).'});}for(const l of e){const m=/recover/i['test'](l['guard_key']??'')||/recover/i['test'](l['track']??''),n=/merchant-side sweep/i['test'](l['note']??'');if(m&&l['recipient']==='entity'&&!n){b['push']({'rule_id':'R-DIR-03','severity':'critical','title':'Recovery\x20row\x20sweeps\x20residual\x20principal\x20to\x20a\x20merchant-side\x20Entity\x20with\x20NO\x20stated\x20disposition\x20intent\x20(RT-01\x20face)','detail':'Row\x20\x27'+l['track']+'/'+(l['recipient_key']??l['recipient'])+'\x27\x20(guard\x20\x27'+(l['guard_key']??'?')+'\x27)\x20is\x20a\x20'+'terminal-node-gated\x20recovery\x20sweep\x20(decision\x2011:\x20node\x20state\x20only,\x20never\x20order.claimed_by)\x20that\x20'+'pays\x20the\x20residual\x20principal\x20to\x20a\x20merchant-side\x20Entity.\x20The\x20payee\x20is\x20a\x20POLICY\x20choice,\x20not\x20a\x20'+'chain-forced\x20default:\x20when\x20the\x20buyer\x20WON\x20an\x20award\x20while\x20the\x20escrow\x20principal\x20was\x20never\x20refunded,\x20'+'a\x20merchant-ward\x20sweep\x20nets\x20the\x20winner\x20a\x20loss\x20(ktt4\x20RT-01:\x20300M\x20award\x20from\x20the\x20compensation\x20pool,\x20'+'then\x20the\x20600M\x20escrow\x20principal\x20swept\x20to\x20the\x20merchant).\x20Merchant-exit\x20is\x20the\x20legal\x20never-strand\x20'+'default\x20(esln\x20E-2),\x20but\x20it\x20must\x20be\x20the\x20author\x27s\x20conscious\x20choice\x20per\x20shape\x20—\x20an\x20award\x20and\x20a\x20due\x20'+'refund\x20are\x20independent\x20rails\x20(TWO-RAIL\x20INDEPENDENCE,\x20decision\x2011)\x20and\x20their\x20overlap\x20is\x20disclosed\x20'+'at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20(amz9\x20A-1).','suggestion':'If\x20the\x20business\x20intent\x20is\x20unwind-on-buyer-win,\x20add\x20a\x20buyer-ward\x20twin\x20row\x20(recipient\x20slot\x200\x20—\x20the\x20'+'Order\x20address;\x20owner.receive\x20credits\x20the\x20buyer)\x20gated\x20on\x20the\x20same\x20terminal\x20node,\x20and\x20split\x20the\x20'+'merchant-ward\x20row\x20behind\x20a\x20dismissed-weld\x20(logic_not\x20over\x20arb.indemnity.amount\x20==\x200)\x20—\x20the\x20'+'indemnity\x20amount\x20is\x20the\x20ONLY\x20direction-bearing\x20signal\x20on\x20chain\x20(there\x20is\x20no\x20winner\x20accessor).\x20'+'CLOSE\x20THE\x20UNSTAMPED\x20WINDOW\x20IN\x20THE\x20GUARD,\x20NOT\x20ONLY\x20IN\x20DUTIES\x20(P155-01+11,\x20v139):\x20mount\x20the\x20'+'dispute-state\x20freeze\x20leg\x20logic_not[query(1576\x20order.dispute.open)]\x20on\x20the\x20refund\x20rail\x20—\x20it\x20blocks\x20'+'while\x20a\x20case\x20is\x20on\x20file\x20with\x20the\x20claim\x20slot\x20unspent\x20(live\x20AND\x20decided-unstamped\x20alike),\x20and\x20a\x20'+'keeper-driven\x20case\x20conclusion\x20(claimed_by\x20some)\x20releases\x20it\x20by\x20itself.\x20Query\x201578\x20'+'(order.dispute.unstamped)\x20then\x20tells\x20the\x20keeper\x20WHICH\x20state\x20holds:\x20in-flight\x20(wait)\x20vs\x20'+'resolved-awaiting-stamp\x20(one\x20arb_case_conclude\x20tx).\x20Dual-track\x20prescription:\x20the\x201576\x20leg\x20is\x20the\x20'+'enforcement\x20(kernel-expressible\x20as\x20of\x20protocol\x20v139,\x20flag\x20enable_order_dispute_state\x20—\x20on\x20older\x20'+'binaries\x20it\x20reads\x20false\x20and\x20the\x20leg\x20admits,\x20check\x20upgrade_check);\x20the\x20keeper\x20duty\x20'+'(arb_case_conclude\x20at\x20ruling\x20finality)\x20remains\x20mandatory\x20either\x20way.\x20If\x20merchant-exit\x20is\x20'+'intended,\x20state\x20the\x20MERCHANT-EXIT\x20POLICY\x20in\x20the\x20row\x20note\x20(the\x20canonical\x20\x27merchant-side\x20sweep\x27\x20'+'sentence)\x20so\x20the\x20scan\x20records\x20the\x20conscious\x20choice\x20and\x20stops\x20flagging\x20it.'});break;}}return b;}function disputeFreezeChecks(a){const b=/settle|\bband\b|recover|award|refund|return/i,c=/arb|indemnity|dispute|claim/i,d=h=>{const j=JSON['stringify'](h??{});return j['includes']('\x22order.dispute.open\x22')&&j['includes']('\x22logic_not\x22');},e=h=>h['template_id']['startsWith']('tpl_')?h['template_id']:/resolve with (tpl_[a-z0-9_]+)/['exec'](h['purpose'])?.[0x1],f=new Set(['tpl_allocator_node_gate_settle','tpl_allocator_node_gate_settle_nodes','tpl_allocator_node_gate_refund_renewal','tpl_allocator_serial_window_release','tpl_allocator_session_release','tpl_allocator_node_gate_claim_settle']),g=new Set();for(const h of a['allocator']['rows']??[]){const j=h['track']+'\x20'+(h['guard_key']??'');if(!b['test'](j)||c['test'](j))continue;if(h['guard_key']===undefined)continue;const k=a['guards']['find'](n=>n['key']===h['guard_key']);if(k===undefined)continue;const l=e(k);if(l===undefined)continue;if(f['has'](l))continue;const m=GUARD_TEMPLATES['find'](n=>n['id']===l);if(m===undefined)continue;if(!d(m['example_root']))g['add']('\x27'+h['guard_key']+'\x27\x20->\x20'+l);}if(g['size']===0x0)return[];return[{'rule_id':'R-DISPUTE-FREEZE-MISSING','severity':'high','title':'Fund\x20rail\x20lacks\x20the\x20dispute\x20freeze\x20leg\x20—\x20payouts\x20stay\x20driveable\x20while\x20a\x20dispute\x20case\x20is\x20on\x20file\x20(W5-14)','detail':'Row(s)\x20'+[...g]['join'](',\x20')+'\x20gate\x20a\x20settle/recover/refund\x20fund\x20rail\x20on\x20a\x20guard\x20twin\x20whose\x20root\x20'+'carries\x20NO\x20dispute\x20freeze\x20leg.\x20While\x20a\x20dispute\x20case\x20is\x20on\x20file\x20with\x20the\x20claim\x20slot\x20unspent\x20the\x20rail\x20'+'stays\x20driveable:\x20a\x20settle/recover/refund\x20can\x20fire\x20OUT\x20FROM\x20UNDER\x20an\x20open\x20—\x20or\x20decided-but-unstamped\x20—\x20'+'case,\x20and\x20the\x20award\x20then\x20lands\x20on\x20a\x20drained\x20pool\x20(ddmc4\x20B-24/B-25:\x20an\x20outsider\x20rail\x20fired\x20mid-dispute;\x20'+'h1w9\x20F-02:\x20the\x20decided-unstamped\x20window\x20was\x20the\x20release\x20hole).\x20Guards\x20are\x20immutable\x20after\x20publish\x20'+'(IMMUT-001),\x20so\x20the\x20leg\x20must\x20ship\x20BEFORE\x20the\x20service\x20goes\x20live.','suggestion':'Resolve\x20the\x20rail\x20to\x20a\x20rail\x20twin\x20that\x20ships\x20the\x20freeze\x20IN\x20its\x20root\x20(tpl_allocator_node_gate_settle_once,\x20'+'tpl_allocator_settle_band_once,\x20tpl_allocator_prize_settle_once,\x20tpl_allocator_node_gate_refund,\x20'+'tpl_allocator_node_gate_recover),\x20or\x20mount\x20the\x20leg\x20on\x20the\x20custom\x20root:\x20CLOSE\x20THE\x20UNSTAMPED\x20WINDOW\x20IN\x20'+'THE\x20GUARD,\x20NOT\x20ONLY\x20IN\x20DUTIES\x20(P155-01+11,\x20v139):\x20the\x20dispute-state\x20freeze\x20leg\x20'+'logic_not[query(1576\x20order.dispute.open)]\x20at\x20the\x20slot-0\x20Order\x20anchor\x20blocks\x20while\x20a\x20case\x20is\x20on\x20file\x20'+'with\x20the\x20claim\x20slot\x20unspent\x20(live\x20AND\x20decided-unstamped\x20alike),\x20and\x20a\x20keeper-driven\x20case\x20conclusion\x20'+'releases\x20it\x20by\x20itself.\x20Query\x201578\x20(order.dispute.unstamped)\x20tells\x20the\x20keeper\x20WHICH\x20state\x20holds:\x20'+'in-flight\x20(wait)\x20vs\x20resolved-awaiting-stamp\x20(one\x20arb_case_conclude\x20tx).\x20The\x201576\x20leg\x20is\x20the\x20'+'enforcement\x20(kernel-expressible\x20as\x20of\x20protocol\x20v139,\x20flag\x20enable_order_dispute_state\x20—\x20on\x20older\x20'+'binaries\x20it\x20reads\x20false\x20and\x20the\x20leg\x20admits,\x20check\x20upgrade_check);\x20the\x20keeper\x20duty\x20(arb_case_conclude\x20'+'at\x20ruling\x20finality)\x20remains\x20mandatory\x20either\x20way.'}];}export function refundGatePolarityChecks(a){const b=/settle|\bband\b|recover|award|refund|return/i,c=/arb|indemnity|dispute|claim/i,d=f=>f['template_id']['startsWith']('tpl_')?f['template_id']:/resolve with (tpl_[a-z0-9_]+)/['exec'](f['purpose'])?.[0x1],e=new Set();for(const f of a['allocator']['rows']??[]){const g=f['track']+'\x20'+(f['guard_key']??'');if(!b['test'](g)||c['test'](g))continue;if(f['guard_key']===undefined)continue;const h=a['guards']['find'](m=>m['key']===f['guard_key']);if(h===undefined)continue;const j=d(h);if(j===undefined)continue;const k=GUARD_TEMPLATES['find'](m=>m['id']===j);if(k===undefined)continue;const l=refundGatePolarityMix(k['example_root']);if(l!==undefined)e['add']('\x27'+f['guard_key']+'\x27\x20->\x20'+j);}if(e['size']===0x0)return[];return[{'rule_id':'R-REFUND-GATE-POLARITY','severity':'critical','title':'Fund-rail\x20guard\x20mixes\x20caller-identity\x20arms\x20with\x20NOT-state\x20arms\x20in\x20one\x20OR\x20—\x20the\x20freeze\x20becomes\x20an\x20authorization\x20(cour-mn-261102-z5t8\x20A2)','detail':'Row(s)\x20'+[...e]['join'](',\x20')+'\x20compile\x20from\x20a\x20rail\x20twin\x20whose\x20root\x20carries\x20a\x20logic_not\x20STATE\x20leg\x20as\x20a\x20DIRECT\x20'+'arm\x20of\x20the\x20same\x20logic_or\x20group\x20that\x20carries\x20the\x20caller-identity\x20arms.\x20An\x20OR\x20makes\x20every\x20arm\x20an\x20ALTERNATIVE\x20way\x20'+'to\x20pass,\x20so\x20the\x20NOT-state\x20arm\x20becomes\x20a\x20legal-caller\x20option\x20beside\x20the\x20identity\x20options:\x20whoever\x20simply\x20has\x20not\x20'+'reached\x20that\x20state\x20passes\x20as\x20a\x20caller\x20—\x20any\x20address\x20that\x20never\x20opened\x20a\x20dispute\x20can\x20sweep\x20the\x20rail\x20(mainnet\x20'+'REFUND-POLARITY:\x20the\x20buyer\x27s\x20not-in-dispute\x20state\x20was\x20compiled\x20into\x20refund_gate\x27s\x20caller\x20identity\x20options).\x20'+'A\x20negated\x20state\x20leg\x20is\x20a\x20payout\x20FREEZE,\x20never\x20an\x20authorization.\x20Guards\x20are\x20immutable\x20after\x20publish\x20(IMMUT-001).','suggestion':'Hoist\x20the\x20logic_not\x20leg\x20OUT\x20of\x20the\x20OR\x20into\x20a\x20TOP-LEVEL\x20logic_and\x20conjunction\x20—\x20'+'logic_and[\x20logic_or[<identity\x20legs>],\x20logic_not(<state\x20leg>)\x20]\x20—\x20the\x20recover_gate\x20shape\x20(etsm\x20F-04):\x20the\x20freeze\x20'+'then\x20gates\x20EVERY\x20caller\x20instead\x20of\x20widening\x20the\x20caller\x20set.\x20The\x20compile\x20face\x20hard-blocks\x20the\x20same\x20shape\x20'+'(REFUND_GATE_POLARITY_MIX)\x20once\x20the\x20root\x20is\x20resolved.'}];}export function arbRefundWithoutFundChecks(a){if((a['machine_shape']??[])['length']===0x0)return[];const b=new Map(a['guards']['map'](e=>[e['key'],e])),c=a['machine_shape']['some'](e=>{if(e['semantic_role']!=='final')return![];for(const f of e['from']??[]){if(typeof f==='string')continue;const g=f['guard_key']===undefined?undefined:b['get'](f['guard_key']);if(g?.['template_id']==='tpl_forward_arb_ruling_won')return!![];}return![];});if(!c)return[];const d=Object['entries'](a['fee_params']??{})['filter'](([e,f])=>{if(!/compensation_fund/i['test'](e))return![];const g=typeof f==='number'?f:/^\d+$/['test'](String(f)['trim']())?Number(f):undefined;return g!==undefined&&g<=0x0;});if(d['length']===0x0)return[];return[{'rule_id':'R-ARB-REFUND-WITHOUT-FUND','severity':'high','title':'Post-settlement\x20arb\x20re-route\x20with\x20a\x20zero-value\x20compensation_fund\x20—\x20an\x20unfunded\x20buyer\x20remedy\x20(etsm-mn-261102-z5r8\x20F-02)','detail':'The\x20machine\x20routes\x20an\x20arb-ruling-won\x20edge\x20out\x20of\x20a\x20settled\x20terminal\x20(escrow\x20already\x20drained),\x20so\x20the\x20'+'compensation\x20fund\x20is\x20the\x20buyer\x27s\x20ONLY\x20money\x20behind\x20that\x20ruling\x20—\x20yet\x20fee_params\x20declare\x20'+(d['map'](([e,f])=>e+'='+JSON['stringify'](f))['join'](',\x20')+':\x20the\x20funding\x20step\x20would\x20ship\x20balance\x20\x220\x22\x20')+'and\x20the\x20build-time\x20COMPENSATION_FUND_REQUIRED\x20gate\x20would\x20never\x20see\x20it\x20(input\x20presence\x20bypassed\x20the\x20gate).\x20'+'INV-4\x20family:\x20an\x20unfunded\x20promise\x20must\x20not\x20publish.\x20Guards\x20freeze\x20at\x20publish\x20(IMMUT-001).','suggestion':'Declare\x20a\x20non-zero\x20compensation_fund\x20(>=\x20the\x20largest\x20single-order\x20exposure)\x20in\x20fee_params\x20so\x20the\x20funding\x20'+'step\x20is\x20real,\x20or\x20drop\x20the\x20post-settlement\x20arb\x20re-route\x20from\x20the\x20machine\x20shape.'}];}export function rewardBelowClaimGasChecks(a){if(a['review_mode']!=='review_reward')return[];const b=(a['fee_params']??{})['review_reward_per_claim'],c=typeof b==='number'?b:typeof b==='string'&&/^\d+$/['test'](b['trim']())?Number(b['trim']()):undefined;if(c===undefined||c<=0x0||c>=0x5b8d80)return[];return[{'rule_id':'R-REWARD-BELOW-CLAIM-GAS','severity':'high','title':'Per-claim\x20bounty\x20below\x20the\x20claim\x20gas\x20floor\x20—\x20no\x20rational\x20user\x20can\x20claim\x20(cour-mn-261102-z5t8\x20C1)','detail':'fee_param\x20review_reward_per_claim\x20=\x20'+c+'\x20smallest\x20units,\x20below\x20the\x20claim\x20gas\x20floor\x20(6_000_000\x20=\x200.006\x20WOW):\x20'+'a\x20claim\x20transaction\x20costs\x20≈0.0026\x20WOW\x20on\x20mainnet\x20(cour\x20BOUNTY-BELOW-GAS,\x20etsm\x20measured),\x20so\x20claiming\x20at\x20this\x20'+'bounty\x20LOSES\x20money\x20—\x20the\x20reward\x20rail\x20is\x20a\x20dead\x20incentive\x20and\x20the\x20funded\x20pool\x27s\x20balance\x20is\x20stranded.','suggestion':'Raise\x20review_reward_per_claim\x20to\x20>=\x200.006\x20WOW\x20(6_000_000\x20smallest\x20units)\x20per\x20claim,\x20or\x20drop\x20the\x20'+'review_reward\x20track\x20(review_mode\x20\x27review\x27\x20without\x20a\x20payable\x20bounty\x20is\x20the\x20honest\x20shape).'}];}export function proseCapAdvisoryChecks(a){const b=(a['guards']??[])['map']((c,d)=>({'address':'guards['+d+'].purpose','bytes':Buffer['byteLength'](c['purpose']??'','utf8')}))['filter'](c=>c['bytes']>0x1e0)['map'](c=>c['address']+'\x20('+c['bytes']+'B)');if(b['length']===0x0)return[];return[{'rule_id':'R-PROSE-CAP-ADVISORY','severity':'low','title':'Prose\x20field\x20exceeds\x20480\x20bytes\x20—\x20the\x20500-byte\x20emission\x20cap\x20will\x20truncate\x20its\x20tail\x20(etsm-mn-261102-z5r8\x20F-09)','detail':'Field(s)\x20'+b['join'](',\x20')+'\x20ride\x20the\x20500-byte\x20UTF-8\x20emission\x20cap\x20(policy\x20descriptions\x20/\x20write_guard\x20'+'bindings\x20/\x20machine\x20prose).\x20The\x20cap\x20truncates\x20at\x20the\x20last\x20complete\x20sentence\x20(word\x20boundary\x20fallback)\x20—\x20'+'the\x20tail\x20sentences\x20are\x20DROPPED\x20at\x20emission,\x20so\x20what\x20ships\x20is\x20a\x20prefix\x20of\x20the\x20intent.','suggestion':'Tighten\x20the\x20prose\x20under\x20480\x20bytes\x20per\x20field,\x20or\x20split\x20the\x20content\x20across\x20fields\x20—\x20keep\x20the\x20on-chain\x20'+'document\x20self-contained\x20instead\x20of\x20letting\x20the\x20cap\x20decide\x20the\x20ending.'}];}export const SERVICE_SALE_FIELDS=new Set(['name','price','stock','quantity','suspension','wip','wip_hash']);export const PLAN_SALE_META_FIELDS=new Set(['incentive']);export const SERVICE_SALE_INPUT_FIELDS=new Set([...SERVICE_SALE_FIELDS,...PLAN_SALE_META_FIELDS]);export function salesVocabularyChecks(a){const b=a['sales'];if(!Array['isArray'](b))return[];const c=[];return b['forEach']((d,e)=>{const f=d;if(f===null||typeof f!=='object'||Array['isArray'](f))return;const g=Object['keys'](f)['filter'](h=>!SERVICE_SALE_INPUT_FIELDS['has'](h));if(g['length']===0x0)return;c['push']({'rule_id':'R-SALE-VOCABULARY','severity':'high','title':'Sales\x20SKU\x20field(s)\x20outside\x20the\x20executor\x27s\x20ServiceSaleSchema\x20vocabulary\x20(cour-mn-261102-z5t8\x20E2)','detail':'sales['+e+']\x20(name\x20\x27'+String(f['name']??'?')+'\x27)\x20carries\x20'+g['map'](h=>'\x27'+h+'\x27')['join'](',\x20')+'\x20—\x20'+'outside\x20the\x20executor\x27s\x20vocabulary\x20(name,\x20price,\x20stock\x20/\x20alias\x20quantity,\x20suspension,\x20wip,\x20wip_hash;\x20'+'plus\x20the\x20PLAN-METADATA\x20declaration\x20\x27incentive\x27,\x20which\x20the\x20emitter\x20strips\x20before\x20the\x20chain\x20write).\x20'+'The\x20sales\x20configure\x20rides\x20params\x20verbatim:\x20the\x20unknown\x20fields\x20abort\x20the\x20step\x20at\x20EXECUTION\x20with\x20'+'schema_mismatch\x20for\x20every\x20adopter\x20of\x20this\x20template,\x20not\x20just\x20this\x20row.','suggestion':'Rename\x20or\x20drop\x20'+g['map'](h=>'\x27'+h+'\x27')['join'](',\x20')+'\x20from\x20the\x20sales\x20row\x20—\x20the\x20executor\x27s\x20'+'ServiceSaleSchema\x20accepts\x20only\x20name,\x20price,\x20stock\x20(or\x20\x27quantity\x27),\x20suspension,\x20wip,\x20wip_hash;\x20'+'the\x20sole\x20sanctioned\x20extra\x20is\x20the\x20\x27incentive\x27\x20declaration\x20(plan\x20metadata,\x20stripped\x20at\x20emission).\x20'+'Template-authored\x20extras\x20belong\x20in\x20the\x20machine\x20prose\x20or\x20fee_params,\x20not\x20the\x20sales\x20catalog.'});}),c;}function draftVoidChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0)return[];if(!b['some'](g=>(g['from']??[])['length']>0x0))return[];const c=g=>{const h=[];for(const j of b){for(const k of j['from']??[]){const l=typeof k==='string'?k:k?.['prev'];if(l!==g)continue;const o=typeof k==='object'&&k?.['operator']?k['operator']:j['operator']??'merchant';h['push']({'target':j,'op':o});}}return h;},d=[],e=a['crowdfunding_mode']!==undefined&&a['crowdfunding_mode']!=='none',f=e?b['find'](g=>(g['from']??[])['some'](h=>typeof h!=='string'&&h['prev']===''))?.['name']:undefined;for(const g of b){if(!/escrow/i['test'](g['role']??''))continue;if(f!==undefined&&g['name']!==f)continue;if(/award|pays the (host|seller|creator|merchant|provider)/i['test'](g['role']??''))continue;if(/^(delivered|final|cancelled)$/['test'](g['semantic_role']??''))continue;const h=c(g['name']),j=h['some'](({target:k,op:l})=>l==='order_payer'&&k['semantic_role']==='cancelled');if(j)continue;d['push'](h['length']===0x0?'\x27'+g['name']+'\x27\x20has\x20NO\x20outgoing\x20forward\x20at\x20all\x20(entry\x20dead-end)':'\x27'+g['name']+'\x27\x20exits\x20only\x20via\x20'+h['map'](({target:k,op:l})=>k['name']+'['+l+']')['join'](',\x20'));}if(d['length']===0x0)return[];return[{'rule_id':'R-DRAFT-VOID','severity':'high','title':'Escrowed\x20node\x20without\x20a\x20buyer-side\x20void\x20hop\x20—\x20abandoned\x20orders\x20strand\x20the\x20escrow','detail':'Buy\x20escrows\x20atomically,\x20so\x20the\x20money\x20is\x20pooled\x20from\x20the\x20moment\x20the\x20order\x20exists.\x20'+d['join'](';\x20')+'\x20—\x20none\x20of\x20these\x20routes\x20is\x20an\x20order-payer\x20hop\x20into\x20a\x20cancelled\x20'+'endpoint,\x20so\x20a\x20buyer\x20who\x20abandons\x20or\x20fails\x20mid-order\x20(transport\x20error,\x20second\x20thoughts,\x20'+'a\x20ghost\x20order)\x20has\x20funds\x20locked\x20with\x20no\x20single-hop\x20exit\x20(mainnet\x20az-mn-261007\x20G2:\x20the\x20'+'deployed\x20machine\x27s\x20draft\x20node\x20had\x20only\x20the\x20entry\x20forward;\x20voiding\x20required\x20Enter\x20->\x20'+'CancelBeforePayment).','suggestion':'Add\x20an\x20order-payer\x20forward\x20from\x20every\x20escrowed\x20node\x20to\x20the\x20template\x27s\x20cancelled\x20endpoint\x20'+'(e.g.\x20\x27paid\x20->\x20closed_cancel\x27,\x20operator\x20\x27order_payer\x27)\x20gated\x20by\x20the\x20cancel\x20guard;\x20the\x20refund\x20'+'rail\x20must\x20stay\x20mounted\x20—\x20escrow\x20is\x20funded\x20at\x20order_new,\x20not\x20at\x20first\x20forward.'}];}const DELIVERY_SURFACE_REGEX=/\b(ship(?:s|ping|ped|ment)?|tracking|courier|parcel|pickup|check[- ]?in|hand[- ]?over|redeem(?:s|ed|ption)?)\b/i,REQINFO_SURFACE_REGEX=/required[_ ]?info|customer_required|\b1572\b|required_info_evidence_gate/i;function requiredInfoGateChecks(a){const b=a['machine_shape']['filter'](c=>DELIVERY_SURFACE_REGEX['test'](c['name']+'\x20'+c['role']))['map'](c=>'\x27'+c['name']+'\x27\x20('+c['role']+')');if(b['length']===0x0)return[];if(REQINFO_SURFACE_REGEX['test'](templateText(a)))return[];return[{'rule_id':'R-REQINFO-GATE','severity':'high','title':'Fulfilment\x20flow\x20never\x20enforces\x20buyer\x20required\x20info\x20—\x20Service.customer_required\x20is\x20declarative-only','detail':'The\x20on-chain\x20purchase\x20entry\x20never\x20reads\x20Service.customer_required,\x20so\x20an\x20order\x20that\x20skips\x20every\x20'+'required\x20field\x20still\x20creates.\x20Fulfilment\x20surfaces\x20that\x20physically\x20hand\x20over\x20goods\x20or\x20need\x20to\x20reach\x20'+'the\x20buyer\x20—\x20'+b['join'](';\x20')+'\x20—\x20are\x20the\x20only\x20points\x20where\x20that\x20obligation\x20can\x20be\x20'+'enforced\x20on\x20chain,\x20yet\x20the\x20template\x20declares\x20no\x20required_info\x20surface\x20anywhere\x20(no\x20'+'pattern.required_info_evidence_gate,\x20no\x20order.required_info\x201572\x20reference\x20in\x20any\x20guard\x20purpose\x20'+'or\x20build\x20note).','suggestion':'Mount\x20pattern.required_info_evidence_gate\x20on\x20the\x20fulfilment\x20forward:\x20gate\x20order.required_info\x20some\x20'+'(1572)\x20presence\x20FIRST\x20—\x20a\x20bare\x201573\x20value\x20read\x20aborts\x20while\x20the\x20Option\x20is\x20empty.\x20Presence-only\x20is\x20'+'the\x20right\x20default:\x20the\x20recorded\x20value\x20is\x20unvalidated\x20buyer\x20input\x20and\x20carries\x20no\x20on-chain\x20meaning,\x20'+'so\x20treat\x20the\x20merchant\x27s\x20confirming\x20forward\x20(not\x20the\x20recorded\x20address)\x20as\x20the\x20acceptance\x20basis.\x20'+'On\x20protocol\x20v141+\x20the\x20one-shot\x20kernel\x20leg\x20is\x20query\x201580\x20(order.required_info.satisfied):\x20presence\x20'+'check\x20+\x20vacuous-empty-declaration\x20in\x20one\x20Bool\x20read,\x20fail-closed\x20(aborts\x20pre-v141),\x20so\x20the\x201572+1573\x20'+'pairing\x20is\x20only\x20needed\x20on\x20older\x20binaries.\x20The\x20credential\x20VALUE\x20stays\x20the\x20attestated\x20'+'required_info_bind/Proof\x20face\x20either\x20way\x20—\x20never\x20gate\x20on\x20it.'}];}const EVIDENCE_ROW_WRITE_RE=/(data_add|repository write|writes? .{0,32}\brow|row write|contribution row|evidence row|submission row)/i,EVIDENCE_ROW_READBACK_RE=/(read-?back|1166|data has|count-?where|count_where|sum-?where|sum_where|find-?where|find_where|1173|1174|1179|1181|aggregate|existence leg|has-?leg|verif\w*\W{0,8}(the )?row|row\W{0,8}verif)/i;function evidenceRowReadbackChecks(a){const b=templateText(a);if(!EVIDENCE_ROW_WRITE_RE['test'](b))return[];if(EVIDENCE_ROW_READBACK_RE['test'](b))return[];return[{'rule_id':'R-EVIDENCE-NO-READBACK','severity':'medium','title':'Template\x20declares\x20repository\x20evidence-row\x20writes\x20but\x20no\x20read-back/forward-verification\x20leg\x20(F-32:\x20the\x20write\x20ships\x20as\x20a\x20separate\x20transaction)\x20(INV-E6)','detail':'A\x20Machine\x20edge\x20cannot\x20compile\x20a\x20repository\x20write\x20inside\x20its\x20Enter\x20action,\x20so\x20every\x20declared\x20'+'evidence/contribution-row\x20write\x20is\x20a\x20SEPARATE\x20transaction\x20—\x20skippable,\x20failable,\x20raceable.\x20The\x20'+'template\x20prose\x20declares\x20the\x20write\x20side\x20but\x20no\x20verification\x20vocabulary\x20anywhere\x20(no\x20read-back,\x20no\x20'+'1166/1173\x20existence\x20leg,\x20no\x201173-1179/1181\x20aggregate,\x20no\x20\x27verify\x20the\x20row\x27):\x20nothing\x20on\x20chain\x20stops\x20'+'the\x20workflow\x20from\x20advancing\x20past\x20an\x20unwritten\x20row.','suggestion':'Mount\x20pattern.evidence_row_forward_gate\x20on\x20the\x20NEXT\x20forward\x20edge:\x20query_repository_data_has\x20(1166,\x20'+'legacy\x20non-gated)\x20over\x20the\x20ORDER-KEYED\x20row\x20(id_from=Order\x20address,\x20never\x20wallet/clock)\x20for\x20single-row\x20'+'evidence,\x20count_where\x20(1173)\x20for\x20a\x20per-key\x20quota,\x20or\x20the\x201181\x20ALL-MODE\x20aggregate\x20for\x20threshold\x20'+'families.\x20Keep\x20the\x20keeper-duty\x20triad\x20(explicit\x20write\x20duty\x20+\x20read-back\x20+\x20this\x20advisory\x20as\x20the\x20'+'publish-time\x20completeness\x20check).\x20Do\x20NOT\x20downgrade\x20the\x20gate\x20to\x20a\x20marker\x20write\x20because\x20the\x20edge\x20'+'write\x20is\x20inexpressible\x20—\x20markers\x20are\x20zero-chain-verified\x20and\x20write-once\x20welded.'}];}function planReadinessChecks(a){const b=[],c=a['allocator']['rows']??[],d=c['some'](h=>h['track']==='refund'),e=a['allocator']['refund_track']!==undefined||/refund/i['test'](a['allocator']['description']),f=validateAllocatorRows(a);f['length']>0x0&&b['push']({'rule_id':'R-PLAN-01','severity':'critical','title':'Allocator\x20rows\x20are\x20internally\x20inconsistent\x20—\x20the\x20money\x20plan\x20cannot\x20be\x20built','detail':'Template\x20allocator\x20rows\x20are\x20internally\x20inconsistent:\x20'+f['join'](';\x20')+'.','suggestion':'Fix\x20the\x20template\x27s\x20allocator.rows\x20(they\x20are\x20the\x20authoritative\x20money\x20plan;\x20order_allocators\x20is\x20L1-frozen\x20at\x20publish).'});a['allocator']['refund_track']&&!d&&b['push']({'rule_id':'R-PLAN-02','severity':'critical','title':'Declared\x20refund\x20track\x20has\x20no\x20refund\x20row\x20—\x20the\x20plan\x20cannot\x20carry\x20the\x20promised\x20refund\x20rail','detail':'Template\x20declares\x20a\x20\x27'+a['allocator']['refund_track']+'\x27\x20refund\x20track\x20but\x20declares\x20no\x20allocator\x20row\x20with\x20'+'track=\x27refund\x27;\x20the\x20generated\x20plan\x20cannot\x20carry\x20the\x20promised\x20refund\x20rail.','suggestion':'Declare\x20a\x20refund\x20row\x20in\x20allocator.rows\x20(recipient\x20guard_identifier,\x20recipient_key\x20\x270\x27,\x20mode\x20rate,\x20value\x2010000)\x20so\x20the\x20order-anchored\x20full-refund\x20rail\x20rides\x20with\x20the\x20plan.'});if(!e)b['push']({'rule_id':'R-PLAN-03','severity':'high','title':'No\x20refund\x20track\x20declared\x20—\x20returns/refunds\x20have\x20no\x20funded\x20path\x20in\x20the\x20money\x20plan','detail':'The\x20template\x27s\x20allocator\x20declares\x20no\x20refund\x20track\x20—\x20returns/refunds\x20have\x20no\x20funded\x20path\x20in\x20the\x20money\x20plan.','suggestion':'Add\x20the\x20second\x20Allocator\x20(Rate\x2010000\x20to\x20the\x20buyer)\x20bound\x20to\x20the\x20refund\x20Guard,\x20or\x20confirm\x20with\x20the\x20merchant\x20that\x20refunds\x20are\x20out\x20of\x20scope.'});else!a['allocator']['refund_track']&&b['push']({'rule_id':'R-PLAN-04','severity':'medium','title':'Refund\x20intent\x20declared\x20in\x20prose\x20only\x20—\x20the\x20refund\x20recipient\x20is\x20not\x20order-anchored','detail':'A\x20refund\x20track\x20is\x20declared\x20but\x20not\x20order-anchored,\x20so\x20the\x20refund\x20recipient\x20is\x20resolved\x20from\x20the\x20signer/Entity\x20rather\x20than\x20the\x20paying\x20Order.','suggestion':'Gate\x20the\x20refund\x20track\x20with\x20AND[signer\x20==\x20order.owner,\x20progress.node\x20==\x20X]\x20or\x20move\x20it\x20to\x20an\x20order-anchored\x20GuardIdentifier(0)\x20recipient.'});if(c['length']===0x0){a['allocator']['mode']!=='rate'&&b['push']({'rule_id':'R-PLAN-05','severity':'critical','title':'Allocator\x20mode\x20is\x20not\x20expressible\x20as\x20a\x20percentage\x20split','detail':'Template\x20allocator\x20mode\x20is\x20\x27'+a['allocator']['mode']+'\x27,\x20which\x20a\x20percentage\x20pair\x20cannot\x20represent\x20—\x20'+'no\x20percentage\x20hint\x20can\x20be\x20emitted\x20for\x20it.','suggestion':'Declare\x20allocator.rows\x20in\x20the\x20template\x20(per-row\x20amount\x20/\x20rate\x20/\x20surplus);\x20the\x20pipeline\x20will\x20then\x20carry\x20the\x20real\x20split\x20instead\x20of\x20a\x20hint.'});if(a['allocator']['mode']==='rate'){const h=platformShareBps(a['fee_params']),j=h!==undefined&&h>0x0?0x2:0x0;a['allocator']['count']!==0x0&&a['allocator']['count']!==0x2&&b['push']({'rule_id':'R-PLAN-06','severity':'critical','title':'Declared\x20sharing\x20row\x20count\x20can\x20never\x20match\x20the\x20generated\x20percentage\x20hint','detail':'Template\x20declares\x20'+a['allocator']['count']+'\x20sharing\x20row(s)\x20but\x20the\x20generated\x20percentage\x20hint\x20can\x20'+('only\x20ever\x20carry\x20'+j+'\x20row(s)\x20(platform\x20take\x20'+(h??'none')+'\x20bps).'),'suggestion':'Build\x20the\x20Allocation\x20with\x20the\x20template\x27s\x20own\x20row\x20set\x20(order_allocators\x20is\x20L1\x20—\x20frozen\x20at\x20Service\x20publish),\x20or\x20declare\x20allocator.rows\x20in\x20the\x20template.'});}}const g=Object['keys'](a['fee_params'])['filter'](l=>/_(?:days|hours)$/['test'](l));return g['length']>0x0&&!a['time_anchors']&&b['push']({'rule_id':'R-PLAN-07','severity':'medium','title':'Business\x20windows\x20declared\x20without\x20time\x20anchors\x20—\x20release/timeout\x20steps\x20stay\x20unbuildable','detail':'fee_params\x20declares\x20business\x20windows\x20('+g['join'](',\x20')+')\x20but\x20the\x20template\x20declares\x20no\x20time_anchors.','suggestion':'Add\x20time_anchors\x20(or\x20name\x20the\x20window\x20in\x20the\x20Guard\x20set)\x20so\x20the\x20plan\x20emits\x20the\x20release/timeout\x20build\x20steps.'}),b;}function declaresAddressSubmissionSlot(a,b){const c=a;return c['identifier']===b&&c['b_submission']===!![]&&c['value_type']==='Address';}function tplSpecByKey(a,b){const c=a['guards']['find'](e=>e['key']===b);if(!c||!c['template_id']['startsWith']('tpl_'))return undefined;const d=GUARD_TEMPLATES['find'](e=>e['id']===c['template_id']);return d?{'templateId':d['id'],'exampleTable':d['example_table']}:undefined;}function taskBindingChecks(a){const b=[],c=new Set();for(const d of a['machine_shape']){for(const f of d['from']??[]){typeof f==='object'&&f!==null&&typeof f['guard_key']==='string'&&c['add'](f['guard_key']);}}for(const g of c){const h=tplSpecByKey(a,g);if(!h)continue;!h['exampleTable']['some'](j=>declaresAddressSubmissionSlot(j,TASK_BINDING_SLOT))&&b['push']({'rule_id':'TASKBIND-01','severity':'critical','title':'Guard\x20template\x20'+h['templateId']+'\x20(edge\x20key\x20\x27'+g+'\x27)\x20lacks\x20the\x20protocol\x20task-binding\x20slot\x20(254)','detail':'Every\x20guarded\x20forward\x20of\x20a\x20machine\x20running\x20on\x20an\x20order\x20Progress\x20requires\x20a\x20slot-254\x20passport\x20submission;\x20the\x20guard\x20table\x20declares\x20none,\x20so\x20the\x20forward\x20aborts\x20(code\x2011)\x20on\x20first\x20order\x20traversal.\x20Tables\x20and\x20machines\x20freeze\x20at\x20publish\x20—\x20shipping\x20now\x20strands\x20the\x20path\x20permanently.','suggestion':'Declare\x20{\x20identifier:\x20254,\x20b_submission:\x20true,\x20value_type:\x20\x27Address\x27\x20}\x20in\x20'+h['templateId']+'.example_table\x20(protocol\x20slot\x20254;\x20the\x20order\x20address\x20is\x20written\x20by\x20order\x20creation).'});}return b;}function allocLegSlotChecks(a){const b=[];for(const c of a['allocator']?.['rows']??[]){if(c['recipient']!=='guard_identifier'||!c['guard_key'])continue;const d=Number(c['recipient_key']??0x0);if(!Number['isInteger'](d)||d<0x0)continue;const e=tplSpecByKey(a,c['guard_key']);if(!e)continue;const f=e['exampleTable']['some'](h=>declaresAddressSubmissionSlot(h,d));if(f)continue;const g=e['exampleTable']['some'](h=>{const j=h;return j['identifier']===d&&j['value_type']==='Address';});b['push']({'rule_id':'TASKBIND-02','severity':'critical','title':g?'Guard\x20template\x20'+e['templateId']+'\x20slot\x20'+d+'\x20is\x20a\x20STATIC\x20Address\x20—\x20allocator\x20leg\x20\x27'+c['guard_key']+'\x27\x20needs\x20a\x20b_submission\x20declaration':'Guard\x20template\x20'+e['templateId']+'\x20never\x20declares\x20slot\x20'+d+'\x20—\x20allocator\x20leg\x20\x27'+c['guard_key']+'\x27\x20will\x20strand\x20escrow','detail':g?'A\x20static\x20Address\x20slot\x20passes\x20creation\x20but\x20fails\x20the\x20allocation\x20assertion\x20(passport\x20submission\x20==\x20payment_info.for_object):\x20the\x20distribution\x20aborts\x20and\x20escrowed\x20funds\x20stay\x20stranded,\x20because\x20the\x20table\x20froze\x20at\x20creation\x20and\x20cannot\x20gain\x20the\x20declaration\x20later\x20(N-11).':'The\x20allocation\x20assert\x20reads\x20a\x20passport\x20submission\x20at\x20this\x20slot;\x20with\x20no\x20declaration\x20the\x20assert\x20fails\x20and\x20the\x20distribution\x20aborts\x20with\x20funds\x20already\x20escrowed.','suggestion':'Declare\x20{\x20identifier:\x20'+d+',\x20b_submission:\x20true,\x20value_type:\x20\x27Address\x27,\x20object_type:\x20\x27Order\x27\x20}\x20in\x20'+e['templateId']+'.example_table\x20so\x20the\x20passing\x20order\x20address\x20is\x20captured.'});}return b;}export function isSplitFamilyFeeParam(a){return/(?:platform|commission|service_fee)[a-z_]*_bps$/['test'](a)||/^attributed_.*_bps$/['test'](a);}export function isKernelConsumedFeeParam(a){return a==='review_reward_per_claim'||a==='return_window_days'||a==='review_window_days'||a==='review_reward_pool'||a==='campaign_duration_days'||a==='campaign_duration_hours'||a==='reward_claim_opens_after_days'||a==='reward_claim_closes_after_days'||a==='experience_claim_amount'||a==='experience_claim_opens_after_days'||a==='experience_claim_closes_after_days'||a==='price_rebate_claim_amount'||a==='price_rebate_opens_after_days'||a==='price_rebate_closes_after_days'||a==='per_buyer_cap'||a==='loyalty_min_orders'||a==='sla_compensation_mode'||a==='sla_penalty_amount'||a==='sla_deadline_hours'||a==='sla_marker_version'||a['endsWith']('_ceiling_bps');}const KERNEL_LANDING_TEXT={'review_reward_per_claim':{'site':'the\x20composition\x20compiler\x27s\x20reward-claim\x20derivation\x20(4R-02)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20per-claim\x20bounty:\x20spec.params.reward_claim_amount\x20>\x20inputs.reward_claim_amount\x20>\x20this\x20fee_param\x20(override\x20with\x20the\x20reward_claim_amount\x20input)'},'return_window_days':{'site':'the\x20composition\x20compiler\x27s\x20reward-claim\x20OPENS\x20derivation\x20(tbs7\x20F-04)','excerpt':'the\x20value\x20bounds\x20when\x20the\x20bounty\x20OPENS:\x20the\x20claim\x20window\x20opens\x20after\x20this\x20after-sales\x20window\x20(+1\x20day,\x20floored\x20at\x2014\x20days)\x20so\x20a\x20bounty\x20is\x20never\x20claimable\x20while\x20a\x20return\x20can\x20still\x20draw\x20on\x20the\x20escrow'},'review_window_days':{'site':'the\x20composition\x20compiler\x27s\x20reward-claim\x20OPENS\x20derivation\x20(tbs7\x20F-04)','excerpt':'fallback\x20after-sales\x20bound\x20(after\x20return_window_days)\x20for\x20when\x20the\x20bounty\x20OPENS\x20(+1\x20day,\x20floored\x20at\x2014\x20days);\x20where\x20a\x20review_submit\x20guard\x20carries\x20the\x20same-name\x20param,\x20this\x20value\x20also\x20closes\x20the\x20review\x20rail\x20(fill\x20spread)'},'review_reward_pool':{'site':'the\x20input\x20boundary\x27s\x20reward\x20alias\x20(cour-mn-261102-z5t8\x20①②\x20census)','excerpt':'the\x20pool\x20IS\x20the\x20bounty\x20budget:\x20an\x20absent\x20reward_funding\x20input\x20falls\x20back\x20to\x20this\x20fee_param\x20(explicit\x20reward_funding\x20always\x20wins);\x20without\x20the\x20alias\x20the\x20knob\x20was\x20decorative\x20in\x20the\x20strictest\x20sense'},'campaign_duration_days':{'site':'the\x20input\x20boundary\x27s\x20deadline\x20conversion\x20(W5-22)','excerpt':'the\x20length\x20moves\x20the\x20compiled\x20constant:\x20days\x20convert\x20into\x20the\x20ABSOLUTE\x20campaign_deadline_ms\x20every\x20deadline\x20gate\x20and\x20the\x20pre-deadline\x20withdrawal\x20window\x20read\x20on\x20chain'},'campaign_duration_hours':{'site':'the\x20input\x20boundary\x27s\x20deadline\x20conversion\x20(W5-22\x20hours\x20face,\x20pdd\x20F-09)','excerpt':'short\x20pop-up\x20rounds\x20answer\x20in\x20hours;\x20the\x20conversion\x20multiplies\x20into\x20the\x20ABSOLUTE\x20campaign_deadline_ms'},'reward_claim_opens_after_days':{'site':'the\x20composition\x20compiler\x27s\x20reward-claim\x20OPENS\x20derivation\x20(4R-02)','excerpt':'the\x20value\x20sets\x20when\x20the\x20claim\x20window\x20OPENS\x20relative\x20to\x20the\x20claim-allowed\x20entry\x20(explicit\x20input\x20wins)'},'reward_claim_closes_after_days':{'site':'the\x20composition\x20compiler\x27s\x20reward-claim\x20CLOSE\x20derivation\x20(bsw4\x20F-11)','excerpt':'the\x20value\x20is\x20the\x20claimable\x20span\x20after\x20the\x20window\x20opens\x20(explicit\x20input\x20or\x20spec\x20param\x20wins)'},'experience_claim_amount':{'site':'the\x20composition\x20compiler\x27s\x20experience-compensation\x20mount\x20(C-11,\x20emit-phases.ts)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20Fixed\x20per-claim\x20tier\x20on\x20the\x20reward_experience\x20guard_add\x20(override\x20with\x20the\x20experience_claim_amount\x20input)'},'experience_claim_opens_after_days':{'site':'the\x20composition\x20compiler\x27s\x20experience-claim\x20OPENS\x20derivation\x20(C-11,\x20guard-fill.ts)','excerpt':'the\x20value\x20sets\x20when\x20the\x20goodwill\x20claim\x20window\x20OPENS\x20(derived:\x20after-sales\x20return\x20window\x20lapsed\x20+\x201d;\x20explicit\x20input\x20wins)'},'experience_claim_closes_after_days':{'site':'the\x20composition\x20compiler\x27s\x20experience-claim\x20CLOSE\x20derivation\x20(C-11,\x20guard-fill.ts)','excerpt':'the\x20value\x20is\x20the\x20claimable\x20span\x20after\x20the\x20goodwill\x20window\x20opens\x20(default\x207\x20days;\x20explicit\x20input\x20wins)'},'price_rebate_claim_amount':{'site':'the\x20composition\x20compiler\x27s\x20price-rebate\x20mount\x20(stage2\x20#1\x20P-11,\x20emit-phases.ts)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20Fixed\x20per-claim\x20tier\x20on\x20the\x20reward_price_rebate\x20guard_add\x20(override\x20with\x20the\x20price_rebate_claim_amount\x20input)'},'price_rebate_opens_after_days':{'site':'the\x20composition\x20compiler\x27s\x20price-rebate\x20claim\x20OPENS\x20derivation\x20(stage2\x20#1\x20P-11,\x20guard-fill.ts)','excerpt':'the\x20value\x20sets\x20when\x20the\x20rebate\x20claim\x20window\x20OPENS\x20after\x20the\x20claim-allowed\x20terminal\x20entry\x20(default\x200;\x20explicit\x20input\x20wins)'},'price_rebate_closes_after_days':{'site':'the\x20composition\x20compiler\x27s\x20price-rebate\x20claim\x20CLOSE\x20derivation\x20(stage2\x20#1\x20P-11,\x20guard-fill.ts)','excerpt':'the\x20value\x20is\x20the\x20claimable\x20span\x20after\x20the\x20rebate\x20window\x20opens\x20(default\x207\x20days;\x20explicit\x20input\x20wins)'},'per_buyer_cap':{'site':'the\x20service_quote\x20per-buyer-cap\x20preflight\x20(probeBuyerCap,\x20kernel\x20query\x201183\x20owner-filtered\x20mode)','excerpt':'the\x20value\x20IS\x20the\x20cap\x20the\x20quote\x20enforces\x20pre-order:\x20the\x20probe\x20counts\x20the\x20predicate-matching\x20rows\x20the\x20buyer\x20authored\x20under\x20the\x20campaign\x20key\x20(query\x201183,\x20value>0\x20—\x20withdrawn\x20zeroed\x20rows\x20excluded)\x20and\x20refuses\x20the\x20basket\x20at/over\x20this\x20count.\x20Default\x200\x20=\x20unlimited.\x20ADVISORY-ONLY\x20—\x20the\x20on-chain\x20purchase\x20entry\x20has\x20no\x20cap\x20hook\x20yet\x20(buy\x20pre-hook\x20pending\x20a\x20separate\x20board\x20decision);\x20the\x20chain\x20does\x20not\x20refuse\x20an\x20over-cap\x20pledge\x20today'},'loyalty_min_orders':{'site':'the\x20composition\x20compiler\x27s\x20loyalty\x20gate\x20mount\x20(emit-phases.ts\x20emitLoyaltyGate,\x20buy-face\x20guard)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20threshold:\x20the\x20buy\x20guard\x20requires\x20query\x202251\x20(entity_order.entity\x20count\x20over\x20the\x20genesis\x20singleton\x20@0xaa8)\x20>=\x20this\x20count.\x20Protocol-maintained\x20counter\x20—\x20zero\x20keeper.\x20Disclosure\x20rides\x20the\x20machine\x20notes:\x202251\x20counts\x20PARTICIPATION\x20(all\x20roles,\x20all\x20statuses,\x20this\x20order\x20included),\x20so\x20the\x20gate\x20is\x20\x27>=\x20N\x20orders\x20participated\x27,\x20never\x20\x27>=\x20N\x20completed\x27'},'sla_compensation_mode':{'site':'the\x20composition\x20compiler\x27s\x20SLA\x20compensation\x20mount\x20(emit-phases.ts\x20emitSlaCompensation,\x20machine\x20shape)','excerpt':'\x27proactive_payment\x27\x20splices\x20the\x20breach->compensated\x20rail\x20into\x20the\x20machine\x20(sla_breach\x20waypoint\x20parks\x20the\x20order\x20with\x20funds\x20intact;\x20the\x20six-leg\x20tpl_forward_penalty_payment\x20guard\x20verifies\x20and\x20burns\x20the\x20compensation\x20Payment\x20on\x20the\x20255\x20once-slot;\x20ResumeAfterCompensation\x20re-enters\x20the\x20settlement\x20rail)\x20+\x20one\x20keyed\x20keeper\x20duty;\x20\x27ladder\x27\x20is\x20an\x20alias\x20that\x20must\x20find\x20the\x20D5\x20cancel_tier_N_*\x20carrier\x20(no\x20second\x20ladder\x20mechanism,\x20N-08);\x20\x27none\x27/absent\x20=\x20silent'},'sla_penalty_amount':{'site':'the\x20composition\x20compiler\x27s\x20SLA\x20compensation\x20mount\x20(emit-phases.ts\x20emitSlaCompensation)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20penalty\x20constant:\x20the\x20penalty\x20guard\x27s\x20logic_as_u256_greater_or_equal\x20leg\x20compares\x20the\x20Payment\x20amount\x20against\x20it\x20(base\x20units)\x20and\x20the\x20marker\x20encodes\x20it\x20into\x20the\x20clause\x20nonce'},'sla_deadline_hours':{'site':'the\x20composition\x20compiler\x27s\x20SLA\x20compensation\x20mount\x20(emit-phases.ts\x20emitSlaCompensation)','excerpt':'the\x20value\x20names\x20the\x20promise\x20window:\x20it\x20rides\x20the\x20penalty\x20marker\x20(\x27sla-<h>h-v<ver>\x27)\x20and\x20the\x20keyed\x20keeper\x20duty\x27s\x20window_param\x20(timeout_intermediate\x20breach\x20check\x20anchored\x20past\x20fulfillment)\x20—\x20it\x20does\x20NOT\x20compile\x20a\x20punctuality\x20leg\x20(delivered-vs-deadline\x20comparison\x20has\x20no\x20two-history-time\x20primitive;\x20honest\x20disclosure,\x20U-05\x20neighbor)'},'sla_marker_version':{'site':'the\x20composition\x20compiler\x27s\x20SLA\x20compensation\x20mount\x20(emit-phases.ts\x20emitSlaCompensation)','excerpt':'the\x20clause\x20nonce\x20(default\x201):\x20bumping\x20it\x20changes\x20the\x20penalty\x20marker\x20so\x20payments\x20minted\x20against\x20an\x20older\x20clause\x20can\x20no\x20longer\x20satisfy\x20the\x20guard\x20—\x20old\x20proofs\x20must\x20not\x20pay\x20a\x20new\x20amount'}};function isLandingRequired(a,b){return typeof a['fee_params'][b]==='number';}function feeParamLandingRegex(a){return new RegExp('\x5cb'+a['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&')+'\x5cb');}function directiveLanding(a,b){const c=[['build_notes',a['build_notes']],['user_input_specs',a['user_input_specs']?.['map'](d=>d['question']+'\x20'+d['param_key']+'\x20'+(d['note']??''))??[]],['user_inputs',a['user_inputs']],['allocator.description',[a['allocator']['description']]],['trust_mechanisms',a['trust_mechanisms']],['machine_shape',a['machine_shape']['map'](d=>d['name']+'\x20'+d['role'])]];for(const [d,e]of c){const f=e['find'](g=>b['test'](g));if(f!==undefined)return{'surface':'directive','site':d,'excerpt':f};}return undefined;}export function collectFeeParamLandings(a){const b=new Map();for(const c of Object['keys'](a['fee_params']??{})){const d=[],e=feeParamLandingRegex(c);for(const f of a['guards']){if(e['test'](f['purpose']))d['push']({'surface':'guard','site':f['key']??f['template_id'],'excerpt':f['purpose']});}for(const h of a['allocator']['rows']??[]){const j=h['note']??'',k=h['value_from_complement'];if(e['test'](j)||h['value_from']===c||k===c){const l=h['recipient_key'];d['push']({'surface':'allocator_row','site':h['track']+'/'+(l??h['recipient']),'excerpt':j||(k===c?'value_from_complement:\x20'+c:'value_from:\x20'+String(h['value_from'])),'recipient_blank':l===undefined||String(l)['trim']()===''});}}for(const [m,n]of Object['entries'](a['time_anchors']??{})){if(e['test'](n))d['push']({'surface':'time_anchor','site':m,'excerpt':n});}if(isKernelConsumedFeeParam(c)){const o=KERNEL_LANDING_TEXT[c]??(c['endsWith']('_ceiling_bps')?{'site':'the\x20settle\x20band\x20ladder\x20(R-RATE-TIER-GAP,\x20T-D)','excerpt':'the\x20value\x20IS\x20the\x20exclusive\x20partition\x20ceiling\x20the\x20band\x20ladder\x20and\x20the\x20settle\x20guard\x27s\x20band\x20predicates\x20consume\x20—\x20a\x20boundary,\x20not\x20a\x20rate\x20(validated\x20in\x20[0,\x2010001]\x20bps)'}:undefined);if(o)d['push']({'surface':'kernel','site':o['site'],'excerpt':o['excerpt']});}if(d['length']===0x0){const p=directiveLanding(a,e);if(p)d['push'](p);}b['set'](c,d);}return b;}const COMPILED_WINDOW_MS_MIN=0x3e8,COMPILED_WINDOW_MS_MAX=0x1f*0x5265c00,MS_INSTANT_FLOOR=0xe8d4a51000,MS_PER_HOUR=0x36ee80,MS_PER_DAY=0x5265c00;export function collectCompiledWindowConstants(a){const b=new Set(),c=k=>{if(typeof k!=='number'||!Number['isInteger'](k))return;if(k<COMPILED_WINDOW_MS_MIN||k>COMPILED_WINDOW_MS_MAX)return;b['add'](k);},e=k=>{const l=k['value'],m=typeof l==='number'?l:typeof l==='string'?Number(l):NaN;return Number['isFinite'](m)?m:undefined;},f=k=>l=>{if(typeof l==='number')return Number['isFinite'](l)?l:undefined;if(!l||typeof l!=='object'||Array['isArray'](l))return undefined;const m=l;if(m['type']==='identifier'&&typeof m['identifier']==='number'){const o=k['get'](m['identifier']);return o!==undefined?e(o):undefined;}return e(m);},g=l=>{const m=[];for(const n of['nodes','and','or','left','right']){const o=l[n];if(Array['isArray'](o))m['push'](...o);else{if(o!==undefined)m['push'](o);}}return m;},h=(k,l)=>{if(!k||typeof k!=='object'||Array['isArray'](k))return;const m=k;if(m['type']==='calc_number_multiply'&&Array['isArray'](m['nodes'])&&m['nodes']['length']===0x2){const [n,o]=m['nodes'],p=l(n),q=l(o);if(p!==undefined&&q!==undefined){if(p===MS_PER_DAY||q===MS_PER_DAY)c((p===MS_PER_DAY?q:p)*MS_PER_DAY);else{if(p===MS_PER_HOUR||q===MS_PER_HOUR)c((p===MS_PER_HOUR?q:p)*MS_PER_HOUR);}}}for(const s of g(m))h(s,l);},j=l=>{if(Array['isArray'](l)){for(const m of l)j(m);return;}if(!l||typeof l!=='object')return;for(const [n,o]of Object['entries'](l)){if(n['endsWith']('_ms'))c(o);else j(o);}};for(const k of a['steps']){if(k['op']!=='create')continue;const l=k['params'];if(!l||typeof l!=='object')continue;if(k['object']==='guard'){const m=new Map(),n=Array['isArray'](l['table'])?l['table']:[];for(const o of n){if(!o||typeof o!=='object'||Array['isArray'](o))continue;const p=o,q=typeof p['name']==='string'?p['name']:'';if(/(^|_)(ms|millis)/i['test'](q)&&!/per[_\s]?(day|hour)/i['test'](q))c(p['value']);if(typeof p['identifier']==='number')m['set'](p['identifier'],p);}h(l['root'],f(m));}j(l);}for(const s of a['derived_params']??[]){if(typeof s?.['param']==='string'&&s['param']['endsWith']('_ms'))c(s['value']);}return[...b]['sort']((t,w)=>t-w);}function isWindowParamKey(a){return/(_days|_hours|_ms)$/['test'](a)||/window|deadline|duration/i['test'](a);}function declaredWindowMs(a,b){if(typeof b!=='number'||!Number['isFinite'](b)||b<=0x0)return undefined;if(a['endsWith']('_days'))return b*MS_PER_DAY;if(a['endsWith']('_hours'))return b*MS_PER_HOUR;if(a['endsWith']('_ms'))return b;return undefined;}export function annotateCompiledWindows(a,b){const c=[...new Set(b)]['sort']((f,g)=>f-g),d=[],e=a['map'](f=>{const g=isWindowParamKey(f['param'])?declaredWindowMs(f['param'],f['value']):undefined,h=g!==undefined&&g<MS_INSTANT_FLOOR,j=h&&c['length']>0x0?c['includes'](g):null;return j===![]&&d['push']({'param':f['param'],'declared':f['value'],'declared_ms':g}),{...f,...g!==undefined?{'declared_ms':g}:{},'compiled_match':j};});return{'rows':e,'compiled_windows_ms':c,...d['length']>0x0?{'declaration_compiled_diff':{'entries':d,'note':'DECLARATION/COMPILED\x20WINDOW\x20DRIFT\x20(UCAT-261109\x20batch\x202,\x20etsy-clone-audit-r7k2m):\x20these\x20declared\x20'+'window\x20params\x20are\x20NOT\x20the\x20lengths\x20the\x20chain\x20will\x20run\x20—\x20the\x20compiled\x20plan\x20is\x20authoritative.\x20'+'Materialize\x20window\x20constants\x20from\x20the\x20compiled\x20guard\x20tables\x20inside\x20guide.plan\x20(compiled_windows_ms),\x20'+'never\x20from\x20the\x20declared\x20catalog\x20defaults:\x20the\x20declaration\x20is\x20directory\x20default\x20only,\x20and\x20the\x20incident\x20'+'shipped\x20a\x2014-day\x20declaration\x20over\x20180s/300s/120s\x20on-chain\x20windows\x20because\x20the\x20landing\x20table\x20showed\x20'+'only\x20the\x20declaration\x20side.'}}:{}};}export function buildFeeParamLandingTable(a,b){const c=collectFeeParamLandings(a);return Object['entries'](b)['map'](([d,e])=>({'param':d,'value':e,'split_family':isSplitFamilyFeeParam(d),'landings':c['get'](d)??[]}));}function feeParamLandingChecks(a){const b=[];for(const [c,d]of collectFeeParamLandings(a)){if(d['length']>0x0||isSplitFamilyFeeParam(c)||!isLandingRequired(a,c))continue;b['push']({'rule_id':'R-FEEPARAM-LANDING','severity':'medium','title':'fee_param\x20\x27'+c+'\x27\x20is\x20declared\x20but\x20lands\x20nowhere','detail':'template_generate\x20will\x20print\x20'+c+'='+String(a['fee_params'][c])+',\x20but\x20no\x20guard\x20purpose,\x20allocator\x20row\x20note\x20or\x20time\x20anchor\x20names\x20it\x20—\x20the\x20value\x20has\x20no\x20chain\x20landing,\x20so\x20whoever\x20materializes\x20the\x20template\x20hand-fills\x20the\x20constant\x20and\x20the\x20two\x20drift\x20(the\x20measured\x205-minute\x20/\x2030-day\x20window\x20mismatch\x20class).\x20Dead\x20parameters\x20also\x20mislead\x20the\x20migration\x20questionnaire,\x20which\x20presents\x20them\x20as\x20tunable.','suggestion':'Name\x20\x27'+c+'\x27\x20verbatim\x20at\x20its\x20landing\x20rung\x20—\x20the\x20purpose\x20of\x20the\x20guard\x20that\x20compiles\x20it\x20into\x20a\x20constant\x20(strongest),\x20an\x20allocator\x20row\x20note,\x20a\x20time\x20anchor,\x20or\x20at\x20minimum\x20its\x20directive\x20entry\x20(build_notes\x20/\x20user_inputs).\x20E.g.\x20\x27window\x20=\x20'+c+'\x27.\x20If\x20the\x20parameter\x20has\x20no\x20consumer\x20at\x20all,\x20delete\x20it\x20from\x20fee_params.'});}return b;}function repositoryKeyDriftChecks(a){const b=[],c=new Set(a['guards']['map'](d=>d['policy']?.['name'])['filter'](d=>typeof d==='string'&&d['length']>0x0));for(const d of a['guards']){const e=d;for(const [f,h]of Object['entries'](e['params']??{})){if(f!=='row_name'&&!f['endsWith']('_policy_key'))continue;if(typeof h!=='string'||h['length']===0x0)continue;if(h['includes']('${'))continue;if(c['has'](h))continue;b['push']({'rule_id':'R-REPO-KEY-DRIFT','severity':'medium','title':'evidence\x20gate\x20\x27'+e['key']+'\x27\x20reads\x20policy\x20key\x20\x27'+h+'\x27\x20that\x20no\x20repository\x20write\x20policy\x20in\x20this\x20template\x20creates\x20(AR-3\x20/\x20BSX-F01)','detail':'Guard\x20\x27'+e['key']+'\x27\x20('+(e['template_id']??'spec')+')\x20reads\x20rows\x20under\x20the\x20policy\x20key\x20\x27'+h+'\x27\x20'+('(param\x20\x27'+f+'\x27),\x20but\x20the\x20template\x27s\x20')+('host:\x22repository\x22\x20write\x20guards\x20create\x20policies:\x20'+([...c]['map'](j=>'\x27'+j+'\x27')['join'](',\x20')||'(none)')+'.\x20')+'A\x20read\x20over\x20a\x20key\x20the\x20repository\x20never\x20declared\x20finds\x20NO\x20rows\x20and\x20the\x20leg\x20evaluates\x20FALSE\x20—\x20it\x20does\x20not\x20'+'abort\x20and\x20does\x20not\x20report:\x20the\x20not-found\x20abort\x20(7)\x20belongs\x20to\x20the\x20WRITE\x20path,\x20so\x20the\x20failure\x20is\x20silent\x20while\x20'+'the\x20gated\x20forward\x20never\x20'+'opens\x20and\x20every\x20order\x20freezes\x20mid-rail.\x20Policies\x20are\x20NOT\x20chain-frozen:\x20the\x20repository\x27s\x20policy-management\x20'+'permission\x20(index\x20102)\x20can\x20add\x20the\x20missing\x20policy\x20in\x20place\x20after\x20publish,\x20and\x20already-written\x20rows\x20stay\x20'+'bound\x20by\x20write_once/write_guard\x20—\x20but\x20a\x20template\x20must\x20ship\x20the\x20PAIRED\x20name,\x20not\x20a\x20repair\x20instruction.\x20'+'Live\x20face:\x20BeatStars\x27\x20delivery\x20gate\x20read\x20\x27license_grant\x27\x20while\x20the\x20repository\x20stored\x20\x27grant\x27\x20(bsx\x20BSX-F01).','suggestion':'Make\x20the\x20gate\x27s\x20\x27'+f+'\x27\x20EQUAL\x20the\x20write\x20policy\x27s\x20name\x20verbatim\x20(case-sensitive)\x20—\x20ONE\x20name\x20for\x20the\x20write\x20'+'side\x20and\x20the\x20read\x20side.\x20If\x20the\x20repository\x20is\x20intentionally\x20caller-supplied\x20(repository_policies\x20input),\x20'+'document\x20the\x20required\x20policy\x20name\x20in\x20the\x20gate\x27s\x20purpose\x20so\x20the\x20reader\x20can\x20satisfy\x20the\x20pairing.'});}}return b;}export function evidencePolicyCollisions(a){const b=new Set((a['conditional_guards']??[])['map'](e=>e['guard_key'])['filter'](e=>typeof e==='string')),c=new Map();for(const e of a['guards']){const f=e;if(!f['key']||b['has'](f['key']))continue;let h=f['params']?.['row_name'],j=f['params']?.['evidence_marker'];if(typeof h!=='string'||h['length']===0x0){const m=lookupBinding({'template_id':f['template_id']??'','key':f['key']},{'id':a['id']});h=m?.['params']['row_name'],j=m?.['params']['evidence_marker'];}if(typeof h!=='string'||h['length']===0x0)continue;if(typeof j!=='string'||j['length']===0x0)continue;let k=c['get'](h);!k&&(k=new Map(),c['set'](h,k));const l=k['get'](j)??[];l['push'](f['key']+'\x20('+(f['template_id']??'spec')+')'),k['set'](j,l);}const d=[];for(const [n,o]of c){if(o['size']<0x2)continue;const p=[...o['keys']()],q=p['flatMap'](s=>(o['get'](s)??[])['map'](w=>w+'\x20—\x20marker\x20\x27'+s+'\x27'));d['push']({'row_name':n,'markers':p,'members':q});}return d;}function evidencePolicyCollisionChecks(a){return evidencePolicyCollisions(a)['map'](b=>({'rule_id':'R-EVIDENCE-POLICY-COLLISION','severity':'critical','title':'policy\x20\x27'+b['row_name']+'\x27\x20is\x20shared\x20by\x20'+b['markers']['length']+'\x20evidence\x20kinds\x20('+b['markers']['map'](d=>'\x27'+d+'\x27')['join'](',\x20')+')\x20—\x20the\x20later\x20kind\x27s\x20write\x20destroys\x20or\x20dead-locks\x20the\x20earlier\x20stage\x20(F-12)','detail':'The\x20repository\x20ledger\x20keys\x20each\x20row\x20by\x20(policy\x20name,\x20row\x20id);\x20order-scoped\x20rows\x20pin\x20the\x20row\x20id\x20to\x20the\x20order\x20address,\x20so\x20'+('every\x20kind\x20writing\x20under\x20policy\x20\x27'+b['row_name']+'\x27\x20lands\x20on\x20the\x20SAME\x20row\x20per\x20order.\x20With\x20write_once\x20the\x20second\x20')+'kind\x27s\x20write\x20aborts\x20with\x20the\x20write-once\x20conflict\x20(E_POLICY_WRITE_ONCE_CONFLICT)\x20and\x20the\x20machine\x20bricks\x20mid-flow\x20(delivery/restaurant-'+'marketplace\x20PickupOrder,\x20group_buy/platform-supplied-pickup\x20ConfirmPickup);\x20without\x20it\x20the\x20later\x20row\x20silently\x20'+'OVERWRITES\x20the\x20earlier\x20stage\x27s\x20evidence\x20(mainnet-proven:\x20delivery/on-demand-errand\x20HandOver\x20over\x20PickUpOrder,\x20'+'created=0;\x20retail\x20ship/RMA/lost\x20family).\x20Doctrine:\x20ONE\x20EVIDENCE\x20KIND\x20PER\x20POLICY\x20(W5-13/pdd\x20F-04).\x20'+('Colliding\x20guards:\x20'+b['members']['join'](';\x20')+'.'),'suggestion':'Split\x20the\x20kinds\x20into\x20per-kind\x20policies\x20(evidence_<kind>)\x20with\x20write_once:true\x20each:\x20one\x20write\x20guard\x20per\x20policy\x20'+'(host:\x22repository\x22),\x20and\x20re-point\x20every\x20reader\x27s\x20row_name/binding\x20derive\x20to\x20its\x20own\x20policy\x20name.\x20Reader-side\x20'+'marker\x20selectors\x20alone\x20do\x20NOT\x20separate\x20rows\x20—\x20the\x20marker\x20only\x20gates\x20the\x20read,\x20the\x20(policy,\x20id)\x20key\x20decides\x20what\x20'+'is\x20stored.'}));}export function feeParamCouplingMismatches(a){const b=[],c=a['fee_params']??{},d=/fee[\s_-]?params?\s+([a-z_][a-z0-9_]*)/gi;for(const e of a['guards']){const f=e;if(typeof f['purpose']!=='string'||typeof f['key']!=='string')continue;if(!f['template_id']?.['startsWith']('tpl_'))continue;const h=new Set();for(const k of f['purpose']['matchAll'](d)){const l=k[0x1];if(typeof c[l]==='number')h['add'](l);}if(h['size']===0x0)continue;const j=Object['values'](f['params']??{})['filter'](n=>typeof n==='number'&&Number['isFinite'](n));for(const n of h){const o=c[n];if(j['some'](s=>s===o))continue;const p=a['defaults']??c,q=p[n];if(typeof q==='number'&&j['some'](s=>s===q))continue;b['push']({'key':f['key'],'template_id':String(f['template_id']),'param':n,'declared':o,'literals':j});}}return b;}export function settleBandLadderViolations(a){const c=[],d=(a['guards']??[])['filter'](h=>h['template_id']==='tpl_allocator_settle_band_once');if(d['length']===0x0)return c;const e=[],f=new Set();for(const h of d){const j=h['params']??{},k=String(j['decision_policy_key']??'triage_band');f['add'](k);const l=String(j['band_min']??''),m=String(j['band_max']??''),n=Number(l),o=Number(m);if(!Number['isInteger'](n)||!Number['isInteger'](o)||n<0x1||o<=n){c['push']({'kind':'bad_bounds','key':String(h['key']??h['template_id']),'band_min':l,'band_max':m,'reason':!Number['isInteger'](n)||!Number['isInteger'](o)?'band\x20bounds\x20must\x20be\x20plain\x20integer\x20numbers\x20(U64)':n<0x1?'band_min\x20must\x20be\x20>=\x201\x20(band\x200\x20=\x20no\x20severity\x20recorded,\x20never\x20a\x20valid\x20payout)':'band_max\x20must\x20be\x20strictly\x20greater\x20than\x20band_min\x20(the\x20band\x20is\x20[min,\x20max))'});continue;}e['push']({'key':String(h['key']??h['template_id']),'policy_key':k,'min':n,'max':o,'raw_min':l,'raw_max':m});}d['length']>0x1&&f['size']>0x1&&c['push']({'kind':'split_keys','policy_keys':[...f]['sort'](),'guards':d['length']});const g=new Map();for(const q of e){const s=g['get'](q['policy_key'])??[];s['push'](q),g['set'](q['policy_key'],s);}for(const [w,x]of g){const y=[...x]['sort']((z,A)=>z['min']-A['min']||z['max']-A['max']);for(let z=0x1;z<y['length'];z++){const A=y[z-0x1],B=y[z];if(B['min']<A['max'])c['push']({'kind':'overlap','policy_key':w,'a':A['key'],'b':B['key'],'a_range':'['+A['raw_min']+','+A['raw_max']+')','b_range':'['+B['raw_min']+','+B['raw_max']+')'});else B['min']>A['max']&&c['push']({'kind':'gap','policy_key':w,'a':A['key'],'b':B['key'],'prev_max':A['max'],'next_min':B['min']});}}return c;}function settleBandLadderChecks(a){return settleBandLadderViolations(a)['map'](b=>{if(b['kind']==='bad_bounds')return{'rule_id':'R-SETTLE-BAND-LADDER','severity':'high','title':'settle-band\x20guard\x20\x27'+b['key']+'\x27\x20has\x20invalid\x20band\x20bounds\x20['+b['band_min']+','+b['band_max']+')\x20—\x20'+b['reason'],'detail':'tpl_allocator_settle_band_once\x20ranges\x20a\x20U64\x20triage\x20band\x20over\x20the\x20[band_min,\x20band_max)\x20interval\x20with\x20an\x20EXCLUSIVE\x20upper\x20bound.\x20Invalid\x20bounds\x20make\x20the\x20tier\x20either\x20never\x20passable\x20(a\x20stranded\x20severity\x20whose\x20escrow\x20waits\x20for\x20manual\x20resolution)\x20or\x20trivially\x20passable\x20—\x20both\x20break\x20the\x20ladder\x20contract\x20the\x20guard\x20purposes\x20promise\x20(h1z9-tn\x20T-07:\x20band\x20semantics\x20that\x20live\x20only\x20in\x20prose).','suggestion':'Set\x20band_min/band_max\x20to\x20plain\x20integers\x20with\x201\x20<=\x20band_min\x20<\x20band_max,\x20and\x20make\x20the\x20ladder\x20tile\x20seamlessly\x20(e.g.\x20[1,2)/[2,3)/[3,4)/[4,5)).'};if(b['kind']==='split_keys')return{'rule_id':'R-SETTLE-BAND-LADDER','severity':'high','title':'settle-band\x20ladder\x20is\x20split\x20across\x20'+b['policy_keys']['length']+'\x20decision\x20policy\x20keys\x20('+b['policy_keys']['join'](',\x20')+')\x20over\x20'+b['guards']+'\x20guards','detail':'The\x20single-key\x20design\x20IS\x20the\x20ladder\x27s\x20mutual\x20exclusion:\x20per-order\x20write_once\x20on\x20ONE\x20decision\x20policy\x20key\x20blocks\x20a\x20re-grade\x20(E_POLICY_WRITE_ONCE_CONFLICT)\x20and\x20every\x20band\x20guard\x20reading\x20the\x20SAME\x20key\x20makes\x20a\x20key\x20swap\x20impossible.\x20Splitting\x20the\x20ladder\x20across\x20keys\x20reinstates\x20the\x20O13\x20re-key\x20upgrade\x20(h1z9-tn:\x20a\x20re-keyed\x20band\x20row\x20upgraded\x20a\x20paid\x20order\x20for\x200.0044\x20gas)\x20—\x20each\x20key\x27s\x20write_once\x20protects\x20only\x20its\x20own\x20track.','suggestion':'Point\x20every\x20band\x20guard\x27s\x20decision_policy_key\x20at\x20the\x20SAME\x20policy\x20(the\x20write\x20guard\x27s\x20policy\x20name\x20must\x20equal\x20it\x20verbatim),\x20and\x20differentiate\x20tiers\x20ONLY\x20by\x20the\x20disjoint\x20[min,max)\x20constants.'};if(b['kind']==='overlap')return{'rule_id':'R-SETTLE-BAND-LADDER','severity':'high','title':'settle-band\x20guards\x20\x27'+b['a']+'\x27\x20'+b['a_range']+'\x20and\x20\x27'+b['b']+'\x27\x20'+b['b_range']+'\x20OVERLAP\x20on\x20policy\x20\x27'+b['policy_key']+'\x27','detail':'Overlapping\x20bands\x20let\x20ONE\x20triage\x20value\x20satisfy\x20TWO\x20tiers,\x20so\x20one\x20report\x20can\x20pay\x20twice\x20through\x20sibling\x20rails\x20(each\x20tier\x20is\x20its\x20own\x20allocator;\x20the\x20254\x20once\x20key\x20is\x20per-guard,\x20not\x20per-ladder).\x20The\x20ladder\x20contract\x20requires\x20exactly\x20one\x20band\x20guard\x20passable\x20per\x20order.','suggestion':'Shrink\x20one\x20band\x20so\x20adjacent\x20ranges\x20share\x20an\x20edge\x20without\x20crossing\x20(e.g.\x20[1,2)\x20and\x20[2,3)\x20tile;\x20[1,3)\x20and\x20[2,4)\x20overlap).'};return{'rule_id':'R-SETTLE-BAND-LADDER','severity':'high','title':'settle-band\x20ladder\x20has\x20a\x20GAP\x20on\x20policy\x20\x27'+b['policy_key']+'\x27:\x20guard\x20\x27'+b['a']+'\x27\x20ends\x20at\x20'+b['prev_max']+'\x20but\x20\x27'+b['b']+'\x27\x20starts\x20at\x20'+b['next_min'],'detail':'Severity\x20values\x20in\x20['+b['prev_max']+',\x20'+b['next_min']+')\x20match\x20NO\x20band\x20guard,\x20so\x20a\x20report\x20triaged\x20into\x20that\x20range\x20has\x20NO\x20payable\x20branch\x20—\x20the\x20escrow\x20waits\x20for\x20manual\x20resolution\x20(h1z9-tn\x20build-note:\x20a\x20missing\x20band\x20strands\x20its\x20orders\x27\x20payouts).\x20The\x20bands\x20must\x20tile\x20seamlessly\x20over\x20the\x20whole\x20severity\x20domain.','suggestion':'Extend\x20one\x20band\x20or\x20insert\x20the\x20missing\x20tier\x20so\x20adjacent\x20ranges\x20share\x20an\x20edge\x20(next\x20band_min\x20==\x20prev\x20band_max)\x20with\x20no\x20hole\x20between\x20them.'};});}const LEG_PROMISE_REPO_SCAN_RE=/\b(find_where|keys_where|range[- ]scan|severity[- ]band|triage band)\b/i,LEG_PROMISE_SIGNER_BINDING_RE=/\bsigner[- ]binding\b/i;function guardTemplateRoot(a){const b=GUARD_TEMPLATES['find'](c=>c['id']===a);if(!b)return undefined;return b['example_root'];}function serializedTree(a){return JSON['stringify'](a??null);}function rootEquipsSignerBinding(a){const b=serializedTree(a);return b['includes']('query_repository_data')&&/"context":"Signer"/['test'](b);}export function guardLegPromiseBreaches(a){const b=[];for(const c of a){const d=String(c['template_id']??'');if(!d['startsWith']('tpl_'))continue;const e=String(c['purpose']??'');if(!e)continue;const f=guardTemplateRoot(d);if(f===undefined)continue;if(LEG_PROMISE_REPO_SCAN_RE['test'](e)){const g=serializedTree(f);if(!g['includes']('query_repository_data_find_where')&&!g['includes']('query_repository_data_keys_where')){b['push']({'key':String(c['key']??d),'template_id':d,'promised':'repo-scan'});continue;}}LEG_PROMISE_SIGNER_BINDING_RE['test'](e)&&!rootEquipsSignerBinding(f)&&b['push']({'key':String(c['key']??d),'template_id':d,'promised':'signer-binding'});}return b;}function guardLegPromiseChecks(a){return guardLegPromiseBreaches(a['guards'])['map'](c=>({'rule_id':'GUARD-LEG-PROMISE-01','severity':'high','title':c['promised']==='repo-scan'?'guard\x20\x27'+c['key']+'\x27\x20purpose\x20promises\x20an\x20evidence-scan\x20leg\x20(find_where/keys_where/range-scan/severity-band)\x20but\x20template\x20\x27'+c['template_id']+'\x27\x20has\x20NO\x20repository\x20query\x20in\x20its\x20root':'guard\x20\x27'+c['key']+'\x27\x20purpose\x20promises\x20a\x20SIGNER-BINDING\x20leg\x20but\x20template\x20\x27'+c['template_id']+'\x27\x20binds\x20no\x20record\x20to\x20the\x20chain\x20Signer\x20in\x20its\x20root','detail':c['promised']==='repo-scan'?'The\x20purpose\x20text\x20promises\x20the\x20guard\x20reads\x20a\x20repository\x20(an\x20evidence/band\x20scan),\x20but\x20the\x20resolved\x20template\x27s\x20example_root\x20contains\x20no\x20query_repository_data_find_where/keys_where\x20node\x20—\x20the\x20compiled\x20Guard\x20CANNOT\x20evaluate\x20that\x20leg,\x20so\x20the\x20promise\x20is\x20prose\x20only\x20(h1z9-tn\x20card\x2011:\x20four\x20settle\x20purposes\x20promised\x20a\x20severity-band\x20scan\x20that\x20never\x20existed;\x20the\x20emitted\x20guards\x20were\x20bare\x20node\x20gates\x20and\x20ANYONE\x20could\x20sign\x20ANY\x20payout).\x20Machine-read\x20purpose\x20text\x20is\x20the\x20contract\x20the\x20builder\x20buys.':'The\x20purpose\x20text\x20promises\x20the\x20claimant\x20is\x20bound\x20to\x20an\x20on-chain\x20record\x20(signer\x20==\x20a\x20recorded\x20row/holder),\x20but\x20the\x20resolved\x20template\x27s\x20root\x20has\x20no\x20repository-data\x20query\x20AND\x20no\x20Signer-pinned\x20comparison\x20beyond\x20caller\x20authorization\x20—\x20order.owner==Signer\x20is\x20NOT\x20evidence\x20binding\x20(h1z9-tn\x20T-03/T-05:\x20the\x20wide\x20identity\x20let\x20the\x20funder\x20sign\x20the\x20payout).\x20The\x20compiled\x20Guard\x20cannot\x20prove\x20the\x20claimant\x20is\x20the\x20record\x27s\x20author.','suggestion':c['promised']==='repo-scan'?'Either\x20re-point\x20the\x20spec\x20at\x20a\x20template\x20that\x20ships\x20the\x20scan\x20leg\x20(e.g.\x20tpl_allocator_settle_band_once\x20for\x20severity-band\x20settlement)\x20and\x20pass\x20its\x20repository/policy/band\x20params,\x20or\x20rewrite\x20the\x20purpose\x20to\x20state\x20only\x20what\x20the\x20root\x20actually\x20evaluates.\x20Never\x20leave\x20a\x20leg\x20promise\x20the\x20template\x20data\x20cannot\x20keep.':'Either\x20re-point\x20at\x20a\x20template\x20whose\x20root\x20binds\x20a\x20repository\x20record\x20to\x20context(Signer)\x20(e.g.\x20tpl_allocator_settle_band_once\x27s\x20signer\x20leg),\x20or\x20strip\x20the\x20SIGNER-BINDING\x20wording\x20and\x20disclose\x20the\x20weaker\x20identity\x20face\x20that\x20actually\x20ships.'}));}function machineAdjacency(a){const b=new Map();for(const c of a['machine_shape']??[]){for(const d of c['from']??[]){const f=typeof d==='string'?d:d?.['prev'];if(!f)continue;const g=b['get'](f)??[];g['push'](c['name']),b['set'](f,g);}}return b;}function descTreeConsistencyChecks(a){const d=[],h=new Map();for(const B of findLoopCycles(machineAdjacency(a))){const C=classifyLoopCycle(B['cycle']);for(const D of B['cycle']){const E=h['get'](D)??new Set();E['add'](C),h['set'](D,E);}}const j=F=>{const G=h['get'](F);return G!==undefined&&(G['has']('renewal')||G['has']('charge'));},l=new Map();for(const F of a['machine_shape']??[]){for(const G of F['from']??[]){if(typeof G!=='object'||G===null)continue;const H=G['guard_key'];if(typeof H!=='string')continue;const I=l['get'](H)??new Set();I['add']((G['prev']??'')+'->'+F['name']+':'+(G['forward']??'')),l['set'](H,I);}}const o=Object['keys'](a['fee_params']??{})['filter'](J=>J['length']>=0x4),q=new Map(GUARD_TEMPLATES['map'](J=>[J['id'],J])),s=new Map(),w=(J,K)=>{if(typeof J!=='string')return undefined;const L=/^\$\{([a-z0-9_]+)\}$/['exec'](J);if(L!==null){const M=K[L[0x1]];return typeof M==='string'||typeof M==='number'?String(M):undefined;}return J;},x=(J,K)=>{if(typeof J==='string'){for(const L of J['matchAll'](/\$\{([a-z0-9_]+)\}/g))K['add'](L[0x1]);}else{if(Array['isArray'](J))J['forEach'](M=>x(M,K));else J!==null&&typeof J==='object'&&Object['values'](J)['forEach'](M=>x(M,K));}},y=new Set(['campaign_duration_days','campaign_duration_hours','campaign_deadline_ms','review_reward_pool','reward_funding']),z=a['conditional_guards']??[];for(const J of z)if(typeof J['param']==='string')y['add'](J['param']);for(const K of a['settlement_window_merge']??[]){y['add'](K);}for(const L of FEE_PARAM_BINDINGS){if(L['template']!==a['id'])continue;y['add'](L['param']);if(L['plus']!==undefined){for(const M of typeof L['plus']==='string'?[L['plus']]:L['plus'])y['add'](M);}}const A=(N,O)=>{const P=q['get'](O);return{'root':N['root']??P?.['example_root'],'table':N['table']??P?.['example_table']};};for(const N of a['guards']??[]){const O=typeof N['key']==='string'?N['key']:'',P=A(N,typeof N['template_id']==='string'?N['template_id']:'');x(P['root'],y),x(P['table'],y),x(N['params'],y),void O;}for(const Q of a['guards']??[]){const R=typeof Q['key']==='string'?Q['key']:'',S=typeof Q['template_id']==='string'?Q['template_id']:'',T=q['get'](S),U={...a['fee_params'],...Q['params']??{}},V=Q['root']??T?.['example_root'],W=Q['table']??T?.['example_table'],X=typeof Q['purpose']==='string'?Q['purpose']:'',Y=new Set([...Object['keys'](U),...y,...(T?.['parameters']??[])['map'](a1=>a1['name'])['filter'](a1=>typeof a1==='string')]),Z=a1=>{if(typeof a1==='string'){for(const a2 of a1['matchAll'](/\$\{([a-z0-9_]+)\}/g)){const a3=a2[0x1];!Y['has'](a3)&&d['push']({'rule_id':'R-GUARD-PLACEHOLDER','severity':'critical','title':'guard\x20\x27'+R+'\x27\x20carries\x20placeholder\x20\x27${'+a3+'}\x27\x20that\x20resolves\x20from\x20NO\x20declared\x20param\x20surface','detail':'The\x20resolved\x20spec\x20references\x20${'+a3+'},\x20but\x20it\x20is\x20absent\x20from\x20fee_params,\x20this\x20guard\x27s\x20params,\x20'+'FEE_PARAM_BINDINGS,\x20and\x20every\x20selector/merge-list\x20surface\x20—\x20the\x20compile\x20cannot\x20fill\x20it\x20and\x20the\x20'+'remnant\x20travels\x20into\x20the\x20immutable\x20guard\x20as\x20a\x20literal\x20(ddmc3\x20F-TPL-01;\x20the\x20plan\x20face\x20hard-blocks\x20'+'this\x20same\x20shape\x20at\x20generate).','suggestion':'Declare\x20\x27'+a3+'\x27\x20in\x20the\x20guard\x27s\x20params\x20or\x20fee_params\x20(or\x20add\x20an\x20author-literal\x20'+'FEE_PARAM_BINDINGS\x20row),\x20or\x20strip\x20the\x20reference\x20from\x20the\x20spec.'});}a1['includes']('WRITER_ACCOUNT_ADDRESS')&&d['push']({'rule_id':'R-GUARD-PLACEHOLDER','severity':'critical','title':'guard\x20\x27'+R+'\x27\x20carries\x20the\x20LITERAL\x20sentinel\x20\x27WRITER_ACCOUNT_ADDRESS\x27\x20—\x20an\x20unfilled\x20stand-in,\x20never\x20a\x20value','detail':'algr12\x20P0-5:\x20this\x20literal\x20published\x20to\x20mainnet\x20as\x20a\x20VecAddress\x20allowlist\x20row\x20and\x20locked\x20every\x20'+'writer\x20out\x20of\x20evidence\x20writes.\x20A\x20sentinel\x20string\x20is\x20an\x20unfilled\x20placeholder\x20exactly\x20like\x20a\x20'+'${param}\x20remnant.','suggestion':'Replace\x20with\x20a\x20declared\x20param\x20(${...}\x20form)\x20that\x20the\x20merchant\x20fills\x20with\x20REAL\x20address(es)\x20at\x20'+'build\x20time\x20—\x20never\x20ship\x20the\x20sentinel\x20literal.'});return;}if(Array['isArray'](a1)){a1['forEach'](Z);return;}if(a1!==null&&typeof a1==='object')Object['values'](a1)['forEach'](Z);};Z(V);for(const a1 of W??[]){if(a1===null||typeof a1!=='object')continue;const a2=a1;a2['value']===''&&d['push']({'rule_id':'R-GUARD-EMPTY-VALUE','severity':'critical','title':'guard\x20\x27'+R+'\x27\x20table\x20row\x20'+String(a2['identifier'])+'\x20carries\x20an\x20EMPTY\x20value','detail':'An\x20empty\x20string\x20serializes\x20to\x20zero\x20bytes\x20and\x20the\x20chain\x20aborts\x20the\x20Guard\x20create\x20with\x20'+'E_TABLE_ITEM_VALUE_EMPTY=14\x20(the\x20guard-table\x20validator\x20rejects\x20a\x20zero-byte\x20value)\x20—\x20the\x20shape\x20survives\x20compile\x20but\x20dies\x20at\x20the\x20call.','suggestion':'Set\x20a\x20real\x20value\x20(or\x20a\x20${param}\x20reference\x20that\x20resolves),\x20or\x20omit\x20the\x20row.'}),(a2['value_type']==='VecAddress'||a2['value_type']===0xa)&&Array['isArray'](a2['value'])&&a2['value']['some'](a3=>typeof a3==='string'&&/^0x0+$/i['test'](a3))&&d['push']({'rule_id':'R-GUARD-ZERO-ADDR','severity':'critical','title':'guard\x20\x27'+R+'\x27\x20table\x20row\x20'+String(a2['identifier'])+'\x20(VecAddress)\x20carries\x20a\x20ZERO-ADDRESS\x20placeholder','detail':'ddmc4\x20B-04:\x20a\x20zero\x20address\x20is\x20NOT\x20\x22no\x20list\x22\x20—\x20the\x20created\x20guard\x20LIES\x20(\x22address\x200\x20is\x20allowed\x22).\x20'+'It\x20never\x20aborts,\x20so\x20it\x20ships.','suggestion':'Arm\x20the\x20list\x20with\x20real\x20addresses\x20(or\x20a\x20resolving\x20${param}),\x20or\x20omit\x20the\x20guard\x20via\x20'+'guard_resolutions\x20{kind:\x22omit\x22}\x20when\x20\x22no\x20list\x22\x20is\x20the\x20intended\x20polarity.'}),Z(a2['value']);}if(V!==undefined&&h['size']>0x0){const a3=new Set(),a4=a5=>{if(!a5||typeof a5!=='object'||a3['has'](R))return;if(Array['isArray'](a5)){a5['forEach'](a4);return;}const a6=a5,a7=typeof a6['type']==='string'?a6['type']:'',a8=a6['where']??null;if(a7['startsWith']('query_progress_history_time')&&a6['find']==='first'&&a8!==null&&typeof a8==='object'){const a9=w(a8['nextNode'],U);if(a9!==undefined&&j(a9)){a3['add'](R);const aa=/\bper[- ]period\b|\bthis period\b|\beach period\b|\bevery period\b|\u6bcf\u671f|\u5f53\u671f|\u672c\u671f/i['test'](X);d['push']({'rule_id':'R-FIND-POLARITY','severity':aa?'critical':'low','title':'guard\x20\x27'+R+'\x27\x20anchors\x20a\x20history\x20clock\x20at\x20find:\x22first\x22\x20on\x20PERIODIC\x20node\x20\x27'+a9+'\x27\x20'+'(re-enters\x20per\x20billed\x20period)'+(aa?'\x20while\x20its\x20purpose\x20claims\x20per-period\x20semantics\x20—\x20period\x202+\x20reads\x20the\x20FIRST\x20visit\x27s\x20timestamp\x20(ofnz8\x20F-61)':'\x20—\x20intentional\x20once-per-life\x20gate,\x20or\x20the\x20stale-anchor\x20defect\x20(ofnz8\x20F-61)?'),'detail':'The\x20resolved\x20root\x20reads\x20query_progress_history_time{where.nextNode:\x27'+a9+'\x27},\x20find:\x22first\x22,\x20and\x20'+('\x27'+a9+'\x27\x20lies\x20on\x20a\x20renewal/charge\x20loop\x20in\x20this\x20template\x27s\x20machine\x20graph.\x20On\x20period\x202\x20the\x20FIRST\x20')+'visit\x27s\x20clock\x20is\x20the\x20anchor,\x20so\x20a\x20window\x20measured\x20from\x20it\x20is\x20already\x20closed\x20(or\x20already\x20open)\x20'+'the\x20moment\x20the\x20second\x20period\x20begins.\x20Guards\x20freeze\x20at\x20publish;\x20the\x20polarity\x20cannot\x20be\x20repaired\x20'+'on\x20a\x20live\x20shop.'+(aa?'\x20The\x20purpose\x20text\x20promises\x20per-period\x20behavior\x20the\x20find:\x22first\x22\x20anchor\x20cannot\x20deliver.':'\x20The\x20purpose\x20text\x20does\x20NOT\x20claim\x20per-period\x20semantics,\x20so\x20this\x20is\x20most\x20likely\x20the\x20intended\x20once-per-life\x20polarity\x20(e.g.\x20a\x20one-time\x20bounty\x20claimable\x20N\x20days\x20after\x20the\x20FIRST\x20review)\x20—\x20confirm,\x20then\x20ignore\x20this\x20disclosure.'),'suggestion':aa?'Anchor\x20the\x20leg\x20with\x20find:\x22last\x22\x20(the\x20schema\x27s\x20stated\x20polarity\x20for\x20re-entrant\x20anchors),\x20or\x20'+'re-point\x20the\x20where\x20at\x20a\x20node\x20each\x20period\x20enters\x20exactly\x20once\x20—\x20or\x20rewrite\x20the\x20purpose\x20to\x20'+'state\x20the\x20once-per-life\x20semantics\x20the\x20anchor\x20actually\x20enforces.':'No\x20action\x20needed\x20if\x20the\x20once-per-life\x20reading\x20is\x20intended;\x20otherwise\x20anchor\x20with\x20find:\x22last\x22.'});}}for(const ab of Object['values'](a6))a4(ab);};a4(V);}if(X!==''&&o['length']>0x0){const a5=o['filter'](a6=>new RegExp('\x5cb'+a6+'\x5cb')['test'](X));for(const a6 of a5){if(!/_days$|_hours$|_minutes$/['test'](a6))continue;if(/_claim_closes_after_days$/['test'](a6))continue;!y['has'](a6)&&d['push']({'rule_id':'R-DESC-TREE-DRIFT','severity':'high','title':'guard\x20\x27'+R+'\x27\x20purpose\x20names\x20fee_param\x20\x27'+a6+'\x27\x20but\x20NO\x20leg,\x20table\x20row,\x20or\x20binding\x20row\x20lands\x20it\x20'+'(ofnz8\x20F-73:\x20grace_days\x20compiled\x20nowhere\x20and\x20the\x20chain\x20enforced\x20the\x20grace\x20period\x20as\x200)','detail':'The\x20purpose\x20text\x20of\x20guard\x20\x27'+R+'\x27\x20promises\x20\x27'+a6+'\x27,\x20but\x20the\x20resolved\x20spec\x20has\x20no\x20${'+a6+'}\x20'+('reference,\x20no\x20inline\x20params\x20entry,\x20and\x20no\x20FEE_PARAM_BINDINGS\x20row\x20for\x20('+a['id']+',\x20\x27'+R+'\x27,\x20\x27'+a6+'\x27).\x20')+'A\x20merchant\x20who\x20sets\x20the\x20knob\x20changes\x20nothing\x20on\x20chain\x20—\x20the\x20description\x20is\x20the\x20contract\x20the\x20'+'builder\x20buys,\x20and\x20the\x20compiled\x20Guard\x20cannot\x20evaluate\x20a\x20leg\x20it\x20does\x20not\x20have.','suggestion':'Add\x20the\x20landing:\x20an\x20author-literal\x20FEE_PARAM_BINDINGS\x20row\x20({template,\x20guard_key:\x20\x27'+R+'\x27,\x20'+('param:\x20\x27'+a6+'\x27,\x20to:\x20<slot>,\x20scale?})\x20if\x20the\x20value\x20belongs\x20in\x20this\x20guard\x27s\x20table,\x20an\x20explicit\x20')+'params\x20entry,\x20or\x20a\x20second\x20duration\x20term\x20in\x20the\x20root\x20(the\x20period_days\x20+\x20grace_days\x20sum).\x20'+('Otherwise\x20strip\x20the\x20\x27'+a6+'\x27\x20wording\x20from\x20the\x20purpose\x20so\x20the\x20prose\x20states\x20only\x20what\x20ships.')});}}const a0=equalityFaceCheck(R,X,V);a0!==null&&d['push']({'rule_id':'R-DESC-TREE-DRIFT','severity':'high','title':a0['title'],'detail':a0['detail'],'suggestion':a0['suggestion']});for(const a7 of thresholdLiteralCheck(R,W)){d['push']({'rule_id':'R-THRESHOLD-LITERAL','severity':'high','title':a7['title'],'detail':a7['detail'],'suggestion':a7['suggestion']});}for(const a8 of setCollapseCheck(R,W)){d['push']({'rule_id':'R-SET-COLLAPSE','severity':'medium','title':a8['title'],'detail':a8['detail'],'suggestion':a8['suggestion']});}for(const a9 of abortSafeVerbCheck(R,V)){d['push']({'rule_id':'R-GUARD-ABORT-SAFE','severity':'critical','title':a9['title'],'detail':a9['detail'],'suggestion':a9['suggestion']});}if(Q['root']===undefined&&Q['table']===undefined&&R!==''){const aa=fillGuardTemplate(Q['template_id'],Q['params']??{}),ab=aa['ok']?'fill\x00'+JSON['stringify']([aa['root']??null,aa['table']??null]):S+'\x00'+JSON['stringify'](Q['params']??null),ac=s['get'](ab)??{'tplIds':new Set(),'keys':[]};ac['tplIds']['add'](S),ac['keys']['push'](R),s['set'](ab,ac);}}for(const [,ad]of s){const {keys:ae,tplIds:af}=ad;if(ae['length']<0x2)continue;const ag=new Set();for(const ah of ae)for(const ai of l['get'](ah)??[])ag['add'](ai);if(ag['size']<0x2)continue;d['push']({'rule_id':'R-EDGE-GUARD-ALIAS','severity':'medium','title':'guards\x20'+ae['map'](aj=>'\x27'+aj+'\x27')['join']('\x20and\x20')+'\x20compile\x20to\x20IDENTICAL\x20guard\x20enforcement\x20'+('(template'+(af['size']>0x1?'s':'')+'\x20'+[...af]['join']('\x20/\x20')+'\x20—\x20same\x20filled\x20tree\x20and\x20table)\x20')+'mounted\x20on\x20different\x20edges\x20—\x20one\x20edge\x27s\x20designed\x20behavior\x20is\x20an\x20ALIAS\x20of\x20the\x20other\x20'+'(ofnz8\x20F-87:\x20expire_after_review\x20emitted\x20as\x20an\x20expire\x20twin\x20with\x20no\x20after-review\x20leg)','detail':'The\x20compiled\x20enforcement\x20shapes\x20are\x20byte-identical\x20(fillGuardTemplate\x20instantiation:\x20template\x20'+'defaults\x20+\x20params\x20—\x20the\x20SAME\x20normalization\x20the\x20build\x20uses,\x20UCAT-261109\x20③\x20batch\x20A),\x20yet\x20the\x20keys\x20mount\x20'+('on\x20'+ag['size']+'\x20distinct\x20machine\x20edges.\x20Whatever\x20the\x20edge\x20name\x20promises\x20beyond\x20the\x20shared\x20')+'compiled\x20shape\x20(a\x20different\x20anchor\x20node,\x20a\x20longer\x20window,\x20an\x20extra\x20leg)\x20does\x20not\x20exist\x20on\x20chain.\x20'+'Edge\x20names\x20become\x20prose;\x20the\x20tree\x20cannot\x20keep\x20the\x20distinction.','suggestion':'Differentiate\x20the\x20two\x20guards\x20with\x20explicit\x20params\x20(a\x20different\x20anchor\x20node\x20/\x20window\x20row\x20/\x20extra\x20leg),\x20'+'or\x20resolve\x20one\x20of\x20them\x20to\x20its\x20own\x20template\x20or\x20inline\x20table\x20—\x20or\x20rename\x20the\x20edge\x20to\x20state\x20the\x20shared\x20'+'enforcement\x20truthfully.'});}return d;}function feeParamCouplingChecks(a){return feeParamCouplingMismatches(a)['map'](b=>({'rule_id':'R-FEE-PARAM-COUPLING','severity':'medium','title':'guard\x20\x27'+b['key']+'\x27\x20claims\x20to\x20mirror\x20fee_param\x20\x27'+b['param']+'\x27\x20('+b['declared']+')\x20but\x20carries\x20no\x20matching\x20'+('numeric\x20literal\x20(params:\x20'+(b['literals']['length']>0x0?b['literals']['join'](',\x20'):'none')+')\x20(rex5\x20T-02)'),'detail':'The\x20purpose\x20of\x20guard\x20\x27'+b['key']+'\x27\x20('+b['template_id']+')\x20names\x20fee_param\x20\x27'+b['param']+'\x27,\x20but\x20none\x20of\x20'+('its\x20numeric\x20params\x20equals\x20the\x20fee-table\x20value\x20'+b['declared']+'.\x20The\x20numbers\x20are\x20maintained\x20by\x20hand\x20and\x20')+'the\x20guard\x20literal\x20is\x20the\x20ONLY\x20one\x20that\x20becomes\x20on-chain\x20—\x20the\x20fee\x20param\x20the\x20merchant\x20sets\x20stays\x20'+'decorative\x20(rex5-tn-261028\x20T-02:\x20fee_overrides.inspection_window_days\x20=\x201\x20shipped\x20while\x20all\x20'+'three\x20window\x20guards\x20kept\x20the\x20hardcoded\x207).','suggestion':'Re-sync\x20the\x20guard\x20param\x20literal\x20with\x20fee_param\x20\x27'+b['param']+'\x27\x20(keep\x20the\x20purpose\x27s\x20\x22keep\x20in\x20sync\x22\x20note),\x20'+'or\x20drop\x20the\x20fee_param\x20mention\x20from\x20the\x20purpose\x20if\x20the\x20values\x20are\x20intentionally\x20independent.\x20'+'Build-time\x20propagation\x20(fee_overrides\x20reaching\x20guards[].params)\x20is\x20tracked\x20separately\x20(rex5\x205R).'}));}const UNLANDED_REMEDY='zero\x20the\x20knob\x20(direct\x20sales\x20default),\x20wire\x20the\x20allocator\x20rows\x20to\x20it\x20explicitly\x20'+'(value_from\x20/\x20value_from_complement\x20naming\x20the\x20key),\x20or\x20declare\x20an\x20author-literal\x20'+'FEE_PARAM_BINDINGS\x20row\x20so\x20the\x20value\x20provably\x20lands';let guardTemplateParamRefsCache;const NO_REFS=new Set();function guardTemplateParamRefs(a){if(guardTemplateParamRefsCache===undefined){const b=new Map();for(const c of GUARD_TEMPLATES){const d=new Set(),e=f=>{if(typeof f==='string'){for(const g of f['matchAll'](/\$\{([a-z0-9_]+)\}/g))d['add'](g[0x1]);}else{if(Array['isArray'](f)){for(const h of f)e(h);}else{if(f!==null&&typeof f==='object'){for(const j of Object['values'](f))e(j);}}}};e(c['example_table']),e(c['example_root']),b['set'](c['id'],d);}guardTemplateParamRefsCache=b;}return guardTemplateParamRefsCache['get'](a)??NO_REFS;}export function feeParamUnlanded(a,b,c){const d=[],e=new Set(),f=new Set();for(const q of a['allocator']['rows']??[]){const s=q;if(typeof s['value_from']==='string'&&s['value_from']!=='')e['add'](s['value_from']);if(typeof s['value_from_complement']==='string'&&s['value_from_complement']!=='')e['add'](s['value_from_complement']);const w=typeof s['value']==='number'?s['value']:typeof s['value']==='string'?Number(s['value']):NaN;if(Number['isFinite'](w))f['add'](w);}for(const x of a['guards']??[]){for(const y of Object['values'](x['params']??{})){if(typeof y==='number'&&Number['isFinite'](y))f['add'](y);}}const h=new Set();for(const z of a['guards']??[]){if(typeof z['template_id']==='string'&&z['template_id']['startsWith']('tpl_'))h['add'](z['template_id']);}for(const A of Object['values'](c??{})){const B=A?.['kind']==='template'?A['template_id']??A['template']:undefined;if(typeof B==='string'&&B!=='')h['add'](B);}let j=new Set();for(const C of h){for(const D of guardTemplateParamRefs(C))j['add'](D);}const l=new Set(FEE_PARAM_BINDINGS['filter'](E=>E['template']===a['id'])['map'](E=>E['param'])),m=new Set((a['conditional_guards']??[])['map'](E=>E['param'])),o=new Set();for(const E of TIME_GUARD_INSTANTIATIONS){if(E['template']!==a['id'])continue;if(E['days']!==undefined)o['add'](E['days']);if(E['hours']!==undefined)o['add'](E['hours']);for(const F of Array['isArray'](E['plus_days'])?E['plus_days']:E['plus_days']!==undefined?[E['plus_days']]:[]){o['add'](F);}}const p=new Set(a['settlement_window_merge']??[]);for(const [G,H]of Object['entries'](b)){if(typeof H!=='number'||!Number['isFinite'](H)||H===0x0)continue;if(PLATFORM_TAKE_KEY['test'](G))continue;if(l['has'](G))continue;if(e['has'](G))continue;if(isKernelConsumedFeeParam(G))continue;if(GENERATION_SHAPE_KEYS['has'](G))continue;if(EXTERNAL_CARRIER_KEYS['has'](G))continue;if(classifyFeeParam(G,H,m['has'](G))['disclosure']!=='knob')continue;if(j['has'](G))continue;if(f['has'](H))continue;if(o['has'](G))continue;if(p['has'](G))continue;d['push']({'param':G,'value':H,'reason':'non-zero\x20effective\x20fee_param\x20with\x20no\x20live\x20landing:\x20no\x20platform-take\x20landing,\x20no\x20FEE_PARAM_BINDINGS\x20row,\x20'+'no\x20allocator\x20value_from/value_from_complement\x20wiring,\x20no\x20mounted\x20guard-template\x20placeholder,\x20'+'no\x20registered\x20kernel/consumer,\x20no\x20time-instantiation\x20or\x20merged-lock\x20knob,\x20and\x20no\x20identical\x20frozen\x20'+('constant\x20in\x20the\x20shipped\x20shape\x20—\x20the\x20compiled\x20plan\x20ignores\x20it.\x20Fix\x20ONE\x20way:\x20'+UNLANDED_REMEDY+'.')});}return d;}function feeParamUnlandedChecks(a){return feeParamUnlanded(a,a['fee_params'])['map'](b=>({'rule_id':'R-FEE-PARAM-UNLANDED','severity':'high','title':'fee_param\x20\x27'+b['param']+'\x27\x20=\x20'+b['value']+'\x20lands\x20nowhere\x20—\x20a\x20non-zero\x20knob\x20the\x20money\x20shape\x20ignores\x20(cour-mn-261102-z5t8\x20①②)','detail':'The\x20template\x20ships\x20\x27'+b['param']+'\x27\x20=\x20'+b['value']+'\x20but\x20nothing\x20consumes\x20it:\x20no\x20commission-landing\x20take\x20key,\x20no\x20'+'fee-param\x20binding\x20row,\x20no\x20allocator\x20value_from/value_from_complement,\x20no\x20kernel\x20consumer,\x20and\x20the\x20param\x20is\x20'+'registered\x20as\x20an\x20editable\x20knob\x20(not\x20prose/benchmark).\x20Whoever\x20sets\x20it\x20—\x20the\x20merchant\x20via\x20fee_overrides\x20or\x20'+'the\x20shipped\x20default\x20itself\x20—\x20changes\x20nothing\x20on\x20chain\x20while\x20the\x20settings\x20face\x20advertises\x20an\x20effect.','suggestion':UNLANDED_REMEDY+'.'}));}const SETTLE_WINDOW_RE=/^(?:settle|settlement)[a-z0-9_]*(?:_days|_hours)$/,BUYER_WINDOW_RE=/^(?:return|refund|claim)[a-z0-9_]*(?:_days|_hours)$/;function windowToMs(a,b){if(a['endsWith']('_days'))return b*0x5265c00;if(a['endsWith']('_hours'))return b*0x36ee80;return undefined;}export function windowMathMismatches(a){const c=[],d=a['fee_params']??{},e=new Set(a['settlement_window_merge']??[]),f=[],g=[];for(const [j,k]of Object['entries'](d)){if(typeof k!=='number'||!Number['isFinite'](k))continue;if(SETTLE_WINDOW_RE['test'](j))f['push']({'name':j,'value':k});else{if(BUYER_WINDOW_RE['test'](j))g['push']({'name':j,'value':k});}}const h=[...e]['map'](l=>({'name':l,'ms':windowToMs(l,Number(d[l]))}))['filter'](l=>Number['isFinite'](l['ms']));if(h['length']>0x0&&e['size']>0x0&&f['some'](l=>e['has'](l['name']))){const l=h['reduce']((m,n)=>m+n['ms'],0x0);l<=0x0&&c['push']({'settle_param':h['map'](m=>m['name'])['join']('+'),'settle_value':l,'violates':'non_positive','rule':'R-WINDOW-MATH-ZERO'});for(const m of g){if(e['has'](m['name']))continue;const n=windowToMs(m['name'],m['value']);if(n===undefined||l>=n)continue;c['push']({'settle_param':h['map'](o=>o['name'])['join']('+'),'settle_value':l,'violates':m['name']+'\x20('+m['value']+')','rule':'R-WINDOW-MATH-UNDERCUT'});}return c;}for(const o of f){o['value']<=0x0&&c['push']({'settle_param':o['name'],'settle_value':o['value'],'violates':'non_positive','rule':'R-WINDOW-MATH-ZERO'});}for(const p of f){if(p['value']<=0x0)continue;const q=windowToMs(p['name'],p['value']);if(q===undefined)continue;for(const w of g){const x=windowToMs(w['name'],w['value']);if(x===undefined)continue;q<x&&c['push']({'settle_param':p['name'],'settle_value':p['value'],'violates':w['name']+'\x20('+w['value']+')','rule':'R-WINDOW-MATH-UNDERCUT'});}}return c;}function windowMathChecks(a){return windowMathMismatches(a)['map'](b=>({'rule_id':b['rule'],'severity':'critical','title':b['rule']==='R-WINDOW-MATH-ZERO'?'Settlement\x20window\x20\x27'+b['settle_param']+'\x27\x20=\x20'+b['settle_value']+'\x20—\x20the\x20escrow\x20releases\x20instantly\x20and\x20every\x20buyer\x20window\x20is\x20structurally\x20dead':'Settlement\x20window\x20\x27'+b['settle_param']+'\x27\x20('+b['settle_value']+')\x20opens\x20the\x20release\x20before\x20buyer\x20window\x20'+b['violates']+'\x20closes\x20—\x20the\x20refund\x20rail\x20is\x20structurally\x20dead\x20from\x20the\x20release\x20moment','detail':'Settlement\x20moves\x20the\x20escrow\x20balance\x20to\x200;\x20every\x20refund\x20leg\x20evaluated\x20after\x20the\x20release\x20'+'aborts\x20on\x20empty\x20balance\x20(ktt3\x20F-05:\x20settle\x201h\x20vs\x20return\x20window\x2048h\x20—\x20the\x20advertised\x20return\x20'+'policy\x20was\x20unenforceable;\x20ksk4\x20F-35:\x20settlement\x20delay\x200\x20killed\x20the\x20return\x20window\x20from\x20day\x20one).\x20'+'The\x20settlement\x20time-lock\x20and\x20the\x20buyer\x20windows\x20are\x20maintained\x20by\x20hand\x20in\x20fee_params,\x20so\x20the\x20'+'drift\x20ships\x20silently\x20without\x20this\x20generation-time\x20assert.','suggestion':'Raise\x20the\x20settlement\x20window\x20to\x20>=\x20the\x20largest\x20buyer\x20window\x20(return/refund/claim\x20family),\x20'+'or\x20shorten\x20the\x20buyer\x20window\x20to\x20fit\x20inside\x20the\x20settlement\x20schedule\x20—\x20whichever\x20matches\x20the\x20'+'store\x27s\x20actual\x20after-sales\x20policy.\x20Remember\x20the\x20guard\x20literal\x20is\x20what\x20compiles\x20on-chain:\x20'+'re-sync\x20guards[].params\x20with\x20the\x20new\x20fee_params\x20value\x20(R-FEE-PARAM-COUPLING).'}));}const RATING_FLOOR_SHAPES=[/\brating\b[^.\n]{0,24}?>=\s*([1-5])\b/gi,/\b([1-5])\s*(?:to|-|–|—)\s*([1-5])\s*stars?\b/gi,/\bmin(?:imum)?[\s_-]*rating\b[^.\n]{0,16}?\b([1-5])\b/gi,/\b(?:rated?|rating)\s+([1-5])(?:\s+stars?)?\s+or\s+(?:better|higher|more)\b/gi],PRAISE_FLOOR_SHAPES=[/\b(?:praise|positive|favorable|highly[- ]rated)\s+(?:review|feedback|rating|bounty|rebate|reward)\b/gi,/\bgood\s+(?:review|feedback|rating)\s+(?:bounty|rebate|reward|incentive)\b/gi,/\b(?:good|great|positive)\s+review\b[^.\n]{0,40}?\b(?:reward|bounty|rebate|cashback|incentive)\b/gi,/\u597d\u8bc4(?:\u8fd4\u73b0|\u5956\u52b1|\u8d4f\u91d1|\u7ea2\u5305|\u793c)|\u6b63\u9762\u8bc4\u4ef7(?:\u5956\u52b1|\u8fd4\u73b0)|\u597d\u8bc4(?:\u53ef)?\u5f97(?:\u5956|\u8d4f|\u7ea2\u5305)/gi];export function incentiveRatingFloorClaims(a){const b=[],c=[['build_notes',a['build_notes']],['trust_mechanisms',a['trust_mechanisms']],['key_risk',a['key_risk']],['user_input_specs',a['user_input_specs']?.['map'](d=>d['question']+'\x20'+d['param_key']+'\x20'+(d['note']??''))],['user_inputs',a['user_inputs']],['differences',a['differences']]];for(const [d,e]of c){const f=typeof e==='string'?[e]:e??[];for(const g of f){if(typeof g!=='string')continue;for(const h of RATING_FLOOR_SHAPES){for(const j of g['matchAll'](h)){b['push']({'field':d,'claimed':Number(j[0x1]),'excerpt':j[0x0]['trim'](),'kind':'numeric'});}}for(const k of PRAISE_FLOOR_SHAPES){for(const l of g['matchAll'](k)){b['push']({'field':d,'claimed':0x4,'excerpt':l[0x0]['trim'](),'kind':'praise'});}}}}return b;}const REWARD_WINDOW_SHAPES=[/\b(\d+)\s*[-\s]?\s*days?\s+to\s+claim\b/gi,/\bclaim(?:able)?\s+within\s+(\d+)\s+days?\b/gi,/\b(\d+)\s*[-\s]?\s*day\s+claim\s+window\b/gi,/\bclaimable\s+for\s+(\d+)\s+days?\b/gi];export function rewardWindowDayClaims(a){const b=[],c=[['build_notes',a['build_notes']],['trust_mechanisms',a['trust_mechanisms']],['key_risk',a['key_risk']],['user_input_specs',a['user_input_specs']?.['map'](d=>d['question']+'\x20'+d['param_key']+'\x20'+(d['note']??''))],['user_inputs',a['user_inputs']],['differences',a['differences']]];for(const [d,e]of c){const f=typeof e==='string'?[e]:e??[];for(const g of f){if(typeof g!=='string')continue;for(const h of REWARD_WINDOW_SHAPES){for(const j of g['matchAll'](h)){b['push']({'field':d,'claimed':Number(j[0x1]),'excerpt':j[0x0]['trim']()});}}}}return b;}function incentiveRatingFloorChecks(a){const b=incentiveRatingFloorClaims(a);if(b['length']===0x0)return[];const c=[...new Set(b['map'](e=>'\x27'+e['excerpt']+'\x27\x20('+e['field']+')'))]['join'](',\x20'),d=b['some'](e=>e['kind']==='praise')?'\x20Praise-shaped\x20wording\x20(S14)\x20derives\x20to\x20floor\x204\x20(good\x20==\x204+)\x20—\x20the\x20review_reward\x20default\x20now\x20arms\x204,\x20so\x20a\x20build\x20only\x20fails\x20this\x20rule\x20when\x20reward_rating_floor:\x200\x20(explicit\x20opt-out)\x20or\x20a\x20spec\x20without\x20rating_floor\x20drops\x20the\x20leg.':'';return[{'rule_id':'R-INCENTIVE-RATING-FLOOR','severity':'medium','title':'Incentive\x20prose\x20promises\x20a\x20rating\x20floor\x20('+c+')\x20—\x20the\x20reward\x20track\x20must\x20arm\x20it\x20at\x20build\x20time\x20(S12-T1)','detail':'The\x20promise\x20is\x20free\x20text;\x20the\x20on-chain\x20floor\x20is\x20the\x20reward_rating_floor\x20build\x20input\x20compiled\x20into\x20'+'the\x20claim\x20guard\x27s\x20rating\x20leg.\x20Nothing\x20else\x20couples\x20them\x20—\x20a\x20build\x20that\x20skips\x20the\x20input\x20ships\x20a\x20'+'plain\x20praise\x20bounty\x20that\x20pays\x20even\x20at\x20rating\x201\x20while\x20the\x20store\x20page\x20advertises\x20the\x20floor\x20'+'(ktt3\x20F02/F12\x20residual).'+d,'suggestion':'Either\x20scope\x20the\x20prose\x20to\x20what\x20the\x20chain\x20enforces\x20(name\x20reward_rating_floor\x20as\x20a\x20build\x20input\x20the\x20'+'merchant\x20must\x20set\x20to\x20the\x20promised\x20value),\x20or\x20ship\x20a\x20host:\x22reward\x22\x20spec\x20whose\x20params\x20pin\x20'+'rating_floor\x20to\x20the\x20promised\x20value\x20so\x20every\x20build\x20arms\x20it.\x20The\x20compile\x20gate\x20enforces\x20'+'armed\x20floor\x20===\x20promised\x20on\x20every\x20review_reward\x20build\x20(numeric\x20exact;\x20praise\x20>=\x204,\x20S14).'}];}const THRESHOLD_RELEASE_TPL='tpl_crowdfunding_threshold_gate',THRESHOLD_REFUND_TPL='tpl_crowdfunding_threshold_gate_refund',REFUND_SURFACE_RE=/refund|missed|abandon/i;function arbitrationPolarityChecks(a){const b=[],c=new Map();for(const e of a['guards']??[]){const f=String(e['template_id']??'');(f===THRESHOLD_RELEASE_TPL||f===THRESHOLD_REFUND_TPL)&&c['set'](String(e['key']??''),f);}if(c['size']===0x0)return b;const d=(h,j,k,l)=>{const m=l?THRESHOLD_RELEASE_TPL:THRESHOLD_REFUND_TPL,o=l?THRESHOLD_REFUND_TPL:THRESHOLD_RELEASE_TPL,p=l?'RELEASE\x20polarity\x20(aggregate\x20>=)':'REFUND\x20polarity\x20(aggregate\x20<)',q=l?'a\x20MET\x20goal\x20refunds\x20and\x20a\x20MISSED\x20goal\x20strands\x20(ktt2\x20F-02)':'a\x20MISSED\x20goal\x20releases\x20and\x20a\x20MET\x20goal\x20double-pays\x20(ktt2\x20F-01)';b['push']({'rule_id':'R-ARB-POLARITY-PIN','severity':'high','title':'guard\x20\x27'+h+'\x27\x20binds\x20the\x20'+p+'\x20to\x20'+k+'\x20—\x20'+q,'detail':'fillGuardTemplate\x20has\x20no\x20root\x20swap:\x20the\x20polarity\x20IS\x20the\x20template\x20id.\x20\x27'+m+'\x27\x20compiles\x20the\x20'+(p+'\x20root\x20byte-for-byte\x20wherever\x20it\x20is\x20bound.\x20The\x20ktt2\x20live\x20run\x20bound\x20the\x20release\x20id\x20to\x20both\x20')+'settlement\x20forwards\x20and\x20got\x20two\x20byte-identical\x20>=\x20guards\x20(ThresholdMet\x20and\x20RefundOnMissed\x20verified\x20the\x20'+'same\x20root)\x20—\x20the\x20met\x20round\x20refunded,\x20the\x20missed\x20round\x20stranded.\x20Guards\x20are\x20immutable\x20data,\x20so\x20nothing\x20'+'downstream\x20can\x20flip\x20the\x20comparison.','suggestion':'Bind\x20\x27'+o+'\x27\x20to\x20'+k+'\x20instead\x20and\x20keep\x20\x27'+m+'\x27\x20on\x20its\x20polarity\x20twin\x20surface.\x20'+'Polarity\x20is\x20picked\x20at\x20BIND\x20time\x20—\x20verify\x20the\x20first\x20root\x20leaf\x20after\x20fill:\x20greater_or_equal\x20=\x20release,\x20'+'lesser\x20=\x20refund.'});};for(const h of a['machine_shape']??[]){for(const j of h['from']??[]){if(typeof j==='string')continue;const k=j,l=k['guard_key']===undefined?undefined:c['get'](k['guard_key']);if(l===undefined)continue;const m=String(k['forward']??'');if(m==='')continue;l===THRESHOLD_RELEASE_TPL&&REFUND_SURFACE_RE['test'](m)&&d(String(k['guard_key']),l,'the\x20refund-named\x20forward\x20\x27'+m+'\x27',!![]),l===THRESHOLD_REFUND_TPL&&!REFUND_SURFACE_RE['test'](m)&&d(String(k['guard_key']),l,'the\x20non-refund\x20forward\x20\x27'+m+'\x27',![]);}}for(const o of a['allocator']?.['rows']??[]){const p=c['get'](String(o['guard_key']??''));if(p===undefined)continue;p===THRESHOLD_RELEASE_TPL&&o['track']==='refund'&&d(String(o['guard_key']),p,'a\x20refund-track\x20allocator\x20row',!![]),p===THRESHOLD_REFUND_TPL&&o['track']==='settlement'&&d(String(o['guard_key']),p,'a\x20settlement-track\x20allocator\x20row',![]);}return b;}const DISPUTE_FILING_NODE_RE=/claim_filed/i,DISPUTE_FILING_FORWARD_RE=/dispute/i;function disputeFilingExposureChecks(a){const b=[];for(const d of a['machine_shape']??[]){(DISPUTE_FAMILY_NODE_REGEX['test'](d['name'])||DISPUTE_FILING_NODE_RE['test'](d['name']))&&b['push']('node\x20\x27'+d['name']+'\x27');for(const e of d['from']??[]){const f=typeof e==='string'?'':String(e['forward']??'');f!==''&&DISPUTE_FILING_FORWARD_RE['test'](f)&&b['push']('forward\x20\x27'+f+'\x27');}}if(b['length']===0x0)return[];const c=b['slice'](0x0,0x4)['join'](',\x20')+(b['length']>0x4?',\x20+'+(b['length']-0x4)+'\x20more':'');return[{'rule_id':'R-DISPUTE-FILING-EXPOSURE','severity':'low','title':'DISCLOSURE\x20(ddmc2\x20F-02\x20—\x20not\x20a\x20defect\x20of\x20this\x20build):\x20the\x20dispute\x20filing\x20surface\x20('+c+')\x20rides\x20the\x20chain\x27s\x20case-free\x20dispute\x20edge','detail':'The\x20protocol\x27s\x20dispute\x20advance\x20validates\x20ONLY\x20the\x20filing\x20edge\x27s\x20guard\x20—\x20the\x20chain\x20does\x20NOT\x20require\x20an\x20'+'on-chain\x20arbitration\x20case\x20to\x20exist\x20for\x20the\x20order\x20(ddmc2\x20F-02,\x20PROTOCOL-LEVEL\x20gap;\x20the\x20MCP\x20layer\x20cannot\x20'+'fix\x20it).\x20Any\x20signer\x20who\x20passes\x20the\x20edge\x20guard\x20can\x20advance\x20an\x20order\x20into\x20the\x20dispute\x20node\x20—\x20an\x20'+'APPEND-ONLY\x20state\x20with\x20no\x20clearing\x20primitive\x20—\x20wedging\x20the\x20settlement\x20rails\x20until\x20the\x20buyer\x20withdraws\x20'+'the\x20claim\x20or\x20a\x20real\x20arbitration\x20case\x20resolves.\x20The\x20ddmc2\x20live\x20run\x20(o5):\x20a\x20NON-PARTY\x20account\x20advanced\x20'+'an\x20order\x20to\x20claim_filed\x20with\x20ZERO\x20cases\x20on\x20chain\x20—\x20SettleAfterWindow\x20dead,\x20ArbRefund\x20unusable,\x20'+'refund_full\x20unreachable;\x20a\x20zero-cost\x20escrow-stranding\x20DoS.','suggestion':'Keep\x20PARTY\x20identity\x20legs\x20on\x20the\x20filing\x20edge\x20(order.owner/agent\x20==\x20Signer\x20—\x20a\x20bare\x20time-window\x20or\x20'+'node-pin\x20guard\x20admits\x20any\x20third\x20party).\x20Disclose\x20the\x20exposure\x20to\x20buyers\x20pre-buy\x20(service_quote\x20'+'carries\x20it).\x20Re-audit\x20the\x20filing\x20edge\x20when\x20the\x20chain\x20lands\x20the\x20case-existence\x20precondition\x20'+'(protocol\x20train,\x20ruling\x20three\x20stage\x202).'}];}function templateProseDisclosureChecks(a){const b=findSourceCoordinates(JSON['stringify'](a));if(b['length']===0x0)return[];return[{'rule_id':'R-PROSE-01','severity':'low','title':'Template\x20text\x20cites\x20internal\x20source\x20coordinates','detail':'Template\x20text\x20references\x20internal\x20source\x20coordinates\x20('+b['join'](',\x20')+').\x20'+'Source\x20files/lines\x20are\x20not\x20shipped\x20and\x20users\x20cannot\x20act\x20on\x20them.','suggestion':'Describe\x20the\x20enforced\x20behaviour\x20(what\x20the\x20contract/SDK\x20does,\x20plus\x20the\x20error\x20code)\x20'+'instead\x20of\x20naming\x20a\x20file,\x20directory,\x20function\x20or\x20line\x20number.'}];}export const SCAN_RULE_BUDGET_MS=0x7d0;export function ruleOvertimes(a,b=SCAN_RULE_BUDGET_MS){return a['filter'](c=>c['ms']>b);}function timedFindings(a,b,c){return timed(a,b,c);}function timed(a,b,c){const d=performance['now'](),e=c();return a['push']({'rule':b,'ms':performance['now']()-d}),e;}const OVERTIME_RULE_ID='R-SCAN-RULE-OVERTIME';export function scanTemplate(a){const b=a,c={...a,'build_notes':b['build_notes']??[],'trust_mechanisms':b['trust_mechanisms']??[],'guards':b['guards']??[],'machine_shape':b['machine_shape']??[],'fee_params':b['fee_params']??{},'allocator':b['allocator']??{'description':'','recipient':'entity','refund_track':'order_anchored','count':0x0,'rows':[]}},d=[],e=timedFindings(d,'machineProseFindings',()=>machineProseFindings(c));let g=canonicalizeMachineProse(c);try{const m=(g['machine_shape']??[])['some'](o=>o['segment']!==undefined);if(m){const n=expandShapeSegments({'template':g,'shape':g['machine_shape'],'inputs':g['fee_params']??{}});n['blockers']['length']===0x0&&(g={...g,'machine_shape':n['shape']});}}catch{}const h=timed(d,'oracleCoverageFindings',()=>oracleCoverageFindings(g)),j=[...e,...timedFindings(d,'templateProseDisclosureChecks',()=>templateProseDisclosureChecks(g)),...timedFindings(d,'staticChecks',()=>staticChecks(g)),...timedFindings(d,'guardRefChecks',()=>guardRefChecks(g)),...timedFindings(d,'buyKeyDeclarationChecks',()=>buyKeyDeclarationChecks(g)),...timedFindings(d,'docExpressionDriftChecks',()=>docExpressionDriftChecks(g)),...timedFindings(d,'taskBindingChecks',()=>taskBindingChecks(g)),...timedFindings(d,'repositoryKeyDriftChecks',()=>repositoryKeyDriftChecks(g)),...timedFindings(d,'evidencePolicyCollisionChecks',()=>evidencePolicyCollisionChecks(g)),...timedFindings(d,'feeParamCouplingChecks',()=>feeParamCouplingChecks(g)),...timedFindings(d,'feeParamUnlandedChecks',()=>feeParamUnlandedChecks(g)),...timedFindings(d,'settleBandLadderChecks',()=>settleBandLadderChecks(g)),...timedFindings(d,'guardLegPromiseChecks',()=>guardLegPromiseChecks(g)),...timedFindings(d,'descTreeConsistencyChecks',()=>descTreeConsistencyChecks(g)),...timedFindings(d,'windowMathChecks',()=>windowMathChecks(g)),...timedFindings(d,'incentiveRatingFloorChecks',()=>incentiveRatingFloorChecks(g)),...timedFindings(d,'arbitrationPolarityChecks',()=>arbitrationPolarityChecks(g)),...timedFindings(d,'disputeFilingExposureChecks',()=>disputeFilingExposureChecks(g)),...timedFindings(d,'allocLegSlotChecks',()=>allocLegSlotChecks(g)),...timedFindings(d,'fundAnchorChecks',()=>fundAnchorChecks(g)),...timedFindings(d,'periodicReleaseChecks',()=>periodicReleaseChecks(g)),...timedFindings(d,'timeWindowAnchorChecks',()=>timeWindowAnchorChecks(g)),...timedFindings(d,'signerRefundChecks',()=>signerRefundChecks(g)),...timedFindings(d,'orderAnchorDeclarationChecks',()=>orderAnchorDeclarationChecks(g)),...timedFindings(d,'topologyChecks',()=>topologyChecks(g)),...timedFindings(d,'reachabilityChecks',()=>reachabilityChecks(g)),...timedFindings(d,'rewardReachabilityChecks',()=>rewardReachabilityChecks(g)),...timedFindings(d,'loyaltyClaimNoLegChecks',()=>loyaltyClaimNoLegChecks(g)),...timedFindings(d,'keeperDutyUnkeyedChecks',()=>keeperDutyUnkeyedChecks(g)),...timedFindings(d,'thirdPartyNoRemedyChecks',()=>thirdPartyNoRemedyChecks(g)),...timedFindings(d,'shapeKeyCountChecks',()=>shapeKeyCountChecks(g)),...timedFindings(d,'ladderMonotonicChecks',()=>ladderMonotonicChecks(g)),...timedFindings(d,'pairNoSharedRepoChecks',()=>pairNoSharedRepoChecks(g)),...timedFindings(d,'slaPromiseNoLegChecks',()=>slaPromiseNoLegChecks(g)),...timedFindings(d,'demandNoAwardFactChecks',()=>demandNoAwardFactChecks(g)),...timedFindings(d,'deadEndLockChecks',()=>deadEndLockChecks(g)),...timedFindings(d,'exceptionExitChecks',()=>exceptionExitChecks(g)),...timedFindings(d,'evidenceMarkerEchoChecks',()=>evidenceMarkerEchoChecks(g)),...timedFindings(d,'arbZeroExitChecks',()=>arbZeroExitChecks(g)),...timedFindings(d,'reviewNoRaceChecks',()=>reviewNoRaceChecks(g)),...timedFindings(d,'afterSalesRailChecks',()=>afterSalesRailChecks(g)),...timedFindings(d,'acceptanceModeChecks',()=>acceptanceModeChecks(g)),...timedFindings(d,'revisionLoopChecks',()=>revisionLoopChecks(g)),...timedFindings(d,'exclusivityRegistryChecks',()=>exclusivityRegistryChecks(g)),...timedFindings(d,'rateTierClosureChecks',()=>rateTierClosureChecks(g)),...timedFindings(d,'piiCommitmentChecks',()=>piiCommitmentChecks(g)),...timedFindings(d,'installmentModeChecks',()=>installmentModeChecks(g)),...timedFindings(d,'fundRailUnboundRecipientChecks',()=>fundRailUnboundRecipientChecks(g)),...timedFindings(d,'recoverCoversRefundTerminalChecks',()=>recoverCoversRefundTerminalChecks(g)),...timedFindings(d,'arbVotingGateConstantTrueChecks',()=>arbVotingGateConstantTrueChecks(g)),...timedFindings(d,'proseBodyOnceChecks',()=>proseBodyOnceChecks(g)),...timedFindings(d,'affiliateModeChecks',()=>affiliateModeChecks(g)),...timedFindings(d,'crowdfundingModeChecks',()=>crowdfundingModeChecks(g)),...timedFindings(d,'logisticsModeChecks',()=>logisticsModeChecks(g)),...timedFindings(d,'groupBuyBlockerChecks',()=>groupBuyBlockerChecks(g)),...timedFindings(d,'rewardReplayChecks',()=>rewardReplayChecks(g)),...timedFindings(d,'rewardZeroOrderChecks',()=>rewardZeroOrderChecks(g)),...timedFindings(d,'rewardScaleChecks',()=>rewardScaleChecks(g)),...timedFindings(d,'rewardFundedChecks',()=>rewardFundedChecks(g)),...timedFindings(d,'proseCapabilityChecks',()=>proseCapabilityChecks(g,a)),...timedFindings(d,'rewardRatingKeyChecks',()=>rewardRatingKeyChecks(g)),...timedFindings(d,'loopFundChecks',()=>loopFundChecks(g)),...timedFindings(d,'terminalRailCoverageChecks',()=>terminalRailCoverageChecks(g)),...timedFindings(d,'railNodeDriftChecks',()=>railNodeDriftChecks(g)),...timedFindings(d,'pathClassAnchorChecks',()=>pathClassAnchorChecks(g)),...timedFindings(d,'siblingForwardExclusivityChecks',()=>siblingForwardExclusivityChecks(g)),...timedFindings(d,'compoundPayoutChecks',()=>compoundPayoutChecks(g)),...timedFindings(d,'surplusTrackChecks',()=>surplusTrackChecks(g)),...timedFindings(d,'amountDeadlockChecks',()=>amountDeadlockChecks(g)),...timedFindings(d,'discountRailScaleChecks',()=>discountRailScaleChecks(g)),...timedFindings(d,'cancelCoverageChecks',()=>cancelCoverageChecks(g)),...timedFindings(d,'redundGuardObjectMismatchChecks',()=>redundGuardObjectMismatchChecks(g)),...timedFindings(d,'zeroAmountGuardChecks',()=>zeroAmountGuardChecks(g)),...timedFindings(d,'serialClaimWindowChecks',()=>serialClaimWindowChecks(g)),...timedFindings(d,'dismissEdgeGuardChecks',()=>dismissEdgeGuardChecks(g)),...timedFindings(d,'noteNodeDriftChecks',()=>noteNodeDriftChecks(g)),...timedFindings(d,'noteArbBranchDriftChecks',()=>noteArbBranchDriftChecks(g)),...timedFindings(d,'onewayDisputeChecks',()=>onewayDisputeChecks(g)),...timedFindings(d,'noEscrowExitChecks',()=>noEscrowExitChecks(g)),...timedFindings(d,'pairingProseOnlyChecks',()=>pairingProseOnlyChecks(g)),...timedFindings(d,'claimedDirectionVoidChecks',()=>claimedDirectionVoidChecks(g)),...timedFindings(d,'arbDirectionSanityChecks',()=>arbDirectionSanityChecks(g)),...timedFindings(d,'disputeFreezeChecks',()=>disputeFreezeChecks(g)),...timedFindings(d,'refundGatePolarityChecks',()=>refundGatePolarityChecks(g)),...timedFindings(d,'arbRefundWithoutFundChecks',()=>arbRefundWithoutFundChecks(g)),...timedFindings(d,'rewardBelowClaimGasChecks',()=>rewardBelowClaimGasChecks(g)),...timedFindings(d,'proseCapAdvisoryChecks',()=>proseCapAdvisoryChecks(g)),...timedFindings(d,'salesVocabularyChecks',()=>salesVocabularyChecks(g)),...timedFindings(d,'railUnboundChecks',()=>railUnboundChecks(g)),...timedFindings(d,'rewardBypassChecks',()=>rewardBypassChecks(g)),...timedFindings(d,'guardUnmountedChecks',()=>guardUnmountedChecks(g)),...timedFindings(d,'specParamPlaneChecks',()=>specParamPlaneChecks(g)),...timedFindings(d,'reviewWriteUnreachableChecks',()=>reviewWriteUnreachableChecks(g)),...timedFindings(d,'rewardReplayOpenChecks',()=>rewardReplayOpenChecks(g)),...timedFindings(d,'declaredValueUnfundedChecks',()=>declaredValueUnfundedChecks(g)),...timedFindings(d,'counterpartyFundEvidenceChecks',()=>counterpartyFundEvidenceChecks(g)),...timedFindings(d,'repoWriteOnceIdiomChecks',()=>repoWriteOnceIdiomChecks(g)),...timedFindings(d,'disclosureEnforceabilityChecks',()=>disclosureEnforceabilityChecks(g)),...timedFindings(d,'allocReplayChecks',()=>allocReplayChecks(g)),...timedFindings(d,'draftVoidChecks',()=>draftVoidChecks(g)),...timedFindings(d,'requiredInfoGateChecks',()=>requiredInfoGateChecks(g)),...timedFindings(d,'evidenceRowReadbackChecks',()=>evidenceRowReadbackChecks(g)),...timedFindings(d,'planReadinessChecks',()=>planReadinessChecks(g)),...timedFindings(d,'feeParamLandingChecks',()=>feeParamLandingChecks(g)),...h['findings']['map'](o=>({'rule_id':o['rule_id'],'severity':o['severity']==='info'?'low':o['severity'],'title':o['title'],'detail':o['detail'],'suggestion':o['suggestion']}))];for(const o of timed(d,'analyzerFindings',()=>analyzerFindings(g))){const p=o['severity']==='info'?'low':o['severity'];j['push']({'rule_id':o['ruleId'],'severity':p,'title':o['title'],'detail':o['detail'],'suggestion':o['suggestion']});}for(const q of ruleOvertimes(d)){j['push']({'rule_id':OVERTIME_RULE_ID,'severity':'medium','title':'scan\x20rule\x20\x27'+q['rule']+'\x27\x20overran\x20the\x20'+SCAN_RULE_BUDGET_MS+'ms\x20budget\x20('+Math['round'](q['ms'])+'ms)','detail':'Rule\x20\x27'+q['rule']+'\x27\x20took\x20'+Math['round'](q['ms'])+'ms\x20on\x20template\x20\x27'+g['id']+'\x27\x20—\x20over\x20the\x20'+SCAN_RULE_BUDGET_MS+'ms\x20per-rule\x20wall-clock\x20budget.\x20Slow-burn\x20backtracking\x20class:\x20the\x20rule\x20RETURNED,\x20but\x20a\x20cost\x20explosion\x20here\x20on\x20a\x20bigger\x20template\x20degrades\x20toward\x20the\x20F-SCAN-LOOP\x20hang.','suggestion':'Profile\x20\x27'+q['rule']+'\x27\x20against\x20this\x20template\x20shape;\x20suspect\x20an\x20unbounded\x20regex\x20or\x20an\x20O(n²)\x20shape\x20walk.\x20Lexical\x20rules\x20must\x20stay\x20linear\x20(HARNESS-RULES\x20词法面处方:\x20/g\x20flags\x20on\x20exec\x20loops,\x20terminable\x20negative\x20paths).'});}j['sort']((s,w)=>SEVERITY_ORDER[w['severity']]-SEVERITY_ORDER[s['severity']]);const k=j['length']>0x0?j[0x0]['severity']:'low',l=j['filter'](s=>s['severity']==='critical')['map'](s=>''+(s['rule_id']?s['rule_id']+':\x20':'')+s['title']);return{'template_id':g['id'],'risk_level':k,'passed':l['length']===0x0,'findings':j,'red_flags':l,...h['coverage']?{'oracle_coverage':h['coverage']}:{}};}
1
+ import{ENTRYPOINT}from'@wowok/wowok';import{expandShapeSegments}from'../composition/shape-expand.js';import{buildViewport,runNodeAnalyzers}from'../graph/onchain/index.js';import{makeProposalNode}from'../graph/onchain/proposal-graph.js';import{machineRuleNodeAnalyzer,allocationRuleNodeAnalyzer}from'./rule-node-analyzers.js';import{GUARD_TEMPLATES,fillGuardTemplate,getTemplateById}from'./guard-templates.js';import{validateQuerySignatures}from'./chain-query-registry.js';import{refundGatePolarityMix}from'./allocator-rail-verifier.js';import{TASK_BINDING_SLOT,ONCE_SLOT_BYTES}from'./onchain-constants.js';import{GUARD_DESIGN_PATTERNS}from'./guard-design-patterns.js';import{lookupBinding,BINDING_ROWS}from'./guard-binding-table.js';import{unannotatedBuyerActionNodes}from'./scenario-modes.js';import{findLoopCycles,lintForwardAmbiguity,edgeOperatorRail}from'./machine-topology.js';import{TWO_TX_RENEW_RECIPE,RENEWAL_WITNESS_RECIPE}from'./protocol-facts.js';import{DIRECT_SALES_INVARIANT,ENTITY_RECIPIENT_RULE_ID}from'./entity-recipient-guard.js';import{DISPUTE_FAMILY_NODE_REGEX,FUND_TERMINAL_NODE_REGEX,classifyLoopCycle,declaresTaskBindingSlot,isRenewalFundingDesign,REFUND_RAIL_NODE_REGEX}from'./audit-rules.js';import{isRenewalLoopEdge}from'../participation/radar-core.js';import{bindingsFor,FEE_PARAM_BINDINGS}from'./fee-param-bindings.js';import{classifyFeeParam,EXTERNAL_CARRIER_KEYS,GENERATION_SHAPE_KEYS}from'./param-tiers.js';import{TIME_GUARD_INSTANTIATIONS}from'./pattern-resolutions.js';import{findSourceCoordinates}from'./template-validation.js';import{PLATFORM_TAKE_KEY,platformShareBps,validateAllocatorRows}from'./template-loader.js';import{canonicalizeMachineProse,machineProseFields,machineProseFindings,proseClaim}from'./template-prose.js';import{oracleCoverageFindings}from'./path-oracle/index.js';import{abortSafeVerbCheck,equalityFaceCheck,setCollapseCheck,thresholdLiteralCheck}from'./guard-quality.js';export{PLATFORM_TAKE_KEY};const MERCHANT_SHARE_KEY=/^(?:host|property|partner|institution|landlord|freelancer|creator|seller|instructor)_rate_bps$/,SYBIL_CLAIM_KEY_REGEX=/^experience_claim_amount$/;function directSalesEconomyChecks(a){const b=[],c=a['fee_params'],d=Object['keys'](c)['filter'](H=>PLATFORM_TAKE_KEY['test'](H)&&typeof c[H]==='number'&&c[H]!==0x0);d['length']>0x0&&b['push']({'rule_id':'R-ECON-01','severity':'critical','title':'Template\x20mandates\x20a\x20platform\x20commission\x20('+d['map'](H=>H+'='+c[H])['join'](',\x20')+')','detail':'WoWok\x20is\x20DIRECT\x20SALES:\x20the\x20protocol\x20never\x20extracts\x20and\x20a\x20merchant\x20pays\x20only\x20gas,\x20so\x20the\x20merchant-side\x20share\x20must\x20default\x20to\x20the\x20whole\x20sale.\x20A\x20non-zero\x20platform\x20take\x20is\x20(a)\x20an\x20extraction\x20the\x20platform\x20has\x20no\x20right\x20to,\x20and\x20(b)\x20an\x20UNALLOCATED\x20liability\x20—\x20no\x20template\x20declares\x20a\x20platform\x20address,\x20so\x20at\x20build\x20time\x20it\x20resolves\x20to\x20the\x20deploying\x20merchant\x20itself\x20(a\x20blank\x20slot\x20→\x20the\x20account\x20that\x20deployed\x20the\x20service),\x20to\x20the\x20keeper\x20(a\x20Signer\x20recipient\x20→\x20the\x20transaction\x20sender),\x20or\x20back\x20to\x20the\x20buyer\x20(a\x20guard-identifier\x20recipient).\x20None\x20of\x20those\x20is\x20revenue.','suggestion':'Set\x20'+d['join'](',\x20')+'\x20to\x200\x20and\x20give\x20the\x20merchant\x20the\x20whole\x20sale\x20(single\x20Rate\x2010000\x20leg).\x20If\x20the\x20merchant\x20IS\x20the\x20aggregator\x20and\x20genuinely\x20charges\x20a\x20fee,\x20declare\x20it\x20via\x20merchant_service_fee_bps\x20with\x20an\x20EXPLICIT\x20non-empty\x20recipient\x20Entity.'});const e=a['allocator']['description'],f=e['split'](/[.;]/)['filter'](H=>!/\b(?:never|no|not|don'?t|cannot|must not|avoid|prohibit\w*|forbid\w*|instead of|rather than|previously)\b/i['test'](H))['join']('\x20.\x20'),h=/(?:commission|take|platform|remainder|share)\s*(?:=|:)\s*order\s*total\s*-\s*(?:segment|sum)/i['test'](f),j=(a['allocator']['rows']??[])['some'](H=>H['mode']==='surplus')||a['allocator']['mode']==='surplus',k=j&&/(?:platform|commission|fee|take)[^.;]{0,120}\bsurplus\b|\bsurplus\b[^.;]{0,120}(?:platform|commission|fee|take)/i['test'](f);h&&b['push']({'rule_id':'R-ECON-02','severity':'critical','title':'Take\x20is\x20an\x20implicit\x20remainder\x20(not\x20computable\x20before\x20ordering)','detail':'The\x20allocator\x20describes\x20the\x20platform\x20share\x20as\x20\x22order\x20total\x20-\x20segment\x20sums\x22,\x20so\x20the\x20amount\x20taken\x20depends\x20on\x20the\x20segment\x20configuration\x20rather\x20than\x20a\x20declared\x20rate.\x20A\x20buyer\x20(or\x20their\x20AI)\x20cannot\x20compute\x20the\x20take\x20BEFORE\x20ordering,\x20which\x20defeats\x20pre-order\x20evaluation\x20—\x20and\x20an\x20unbounded\x20remainder\x20off\x20a\x20transit\x20pool\x20is\x20unbounded\x20extraction.','suggestion':'Pin\x20every\x20share\x20to\x20an\x20EXPLICIT\x20Rate\x20(or\x20an\x20Amount\x20derived\x20from\x20a\x20declared\x20rate).\x20A\x20supplier\x20fee\x20belongs\x20in\x20its\x20own\x20explicitly-priced\x20segment\x20order,\x20never\x20as\x20a\x20residual\x20share.'});k&&b['push']({'rule_id':'R-ECON-02','severity':'high','title':'Fee\x20appears\x20to\x20be\x20taken\x20by\x20a\x20Surplus\x20leg','detail':'A\x20Surplus\x20sharing\x20entry\x20allocates\x20the\x20WHOLE\x20remaining\x20balance\x20(withdraw-all\x20semantics\x20on\x20the\x20on-chain\x20allocation),\x20so\x20it\x20cannot\x20express\x20\x22take\x2015%\x22:\x20it\x20doubles\x20as\x20draining\x20the\x20pool.','suggestion':'Use\x20Rate\x20(or\x20RateGross)\x20for\x20any\x20proportional\x20share.\x20Reserve\x20Surplus\x20for\x20an\x20explicitly-bounded\x20residual\x20whose\x20recipient\x20and\x20cap\x20are\x20stated.'});const l=/\{\s*(?:who|Entity|Signer|GuardIdentifier)\s*:/['test'](e)||/recipient\s*[:=]/i['test'](e),m=/^(?:merchant_service_fee_bps|digital_product_fee_bps|logistics_rate_bps|service_fee_rate_bps)$/,n=Object['keys'](c)['some'](H=>m['test'](H)&&typeof c[H]==='number'&&c[H]!==0x0);if(n&&!l&&d['length']===0x0){const H=collectFeeParamLandings(a),I=Object['keys'](c)['filter'](L=>m['test'](L)&&typeof c[L]==='number'&&c[L]!==0x0),J=I['some'](L=>(H['get'](L)??[])['some'](M=>M['surface']==='guard'||M['surface']==='allocator_row'&&M['recipient_blank']!==!![])),K=!J&&I['some'](L=>(H['get'](L)??[])['some'](M=>M['surface']==='directive'));!J?b['push']({'rule_id':'R-ECON-03','severity':'high','title':K?'Fee-bearing\x20template\x20is\x20a\x20DIRECTIVE\x20only\x20—\x20the\x20share\x20has\x20no\x20on-chain\x20carrier':'Fee-bearing\x20template\x20names\x20no\x20recipient\x20slot\x20for\x20the\x20non-merchant\x20share','detail':K?'fee_params\x20carry\x20fee-shaped\x20keys\x20('+I['join'](',\x20')+')\x20whose\x20only\x20landing\x20is\x20directive\x20prose\x20—\x20no\x20allocator\x20row\x20or\x20guard\x20consumes\x20them.\x20On-chain\x20NOTHING\x20carries\x20the\x20fee:\x20whoever\x20materializes\x20the\x20template\x20computes\x20the\x20cut\x20themselves\x20(and\x20the\x20promised\x20clamps\x20live\x20only\x20in\x20text),\x20so\x20two\x20builders\x20can\x20take\x20different\x20shares\x20with\x20nothing\x20to\x20verify\x20against.':'fee_params\x20carry\x20fee-shaped\x20keys\x20but\x20the\x20allocator\x20names\x20no\x20recipient\x20for\x20them.\x20On-chain\x20each\x20Rate\x20lands\x20in\x20ITS\x20OWN\x20recipient\x20slot;\x20an\x20unnamed\x20one\x20resolves\x20to\x20the\x20deploying\x20account,\x20to\x20the\x20keeper\x20(a\x20Signer\x20recipient),\x20or\x20back\x20to\x20the\x20buyer.\x20The\x20share\x20is\x20then\x20an\x20unallocated\x20liability\x20rather\x20than\x20revenue.','suggestion':'State\x20the\x20recipient\x20per\x20share\x20in\x20the\x20allocator\x20description\x20and\x20bind\x20it\x20to\x20an\x20explicit\x20NON-EMPTY\x20Entity\x20the\x20buyer\x20can\x20see\x20before\x20ordering.\x20Never\x20leave\x20it\x20blank.'}):b['push']({'rule_id':'R-ECON-03','severity':'low','title':'Fee\x20share\x20has\x20a\x20declared\x20landing\x20—\x20keep\x20its\x20recipient\x20explicit\x20and\x20visible\x20pre-order','detail':'The\x20fee-shaped\x20keys\x20('+I['join'](',\x20')+')\x20land\x20in\x20allocator\x20rows/guards;\x20the\x20allocator\x20prose\x20names\x20no\x20recipient\x20slot,\x20so\x20the\x20binding\x20relies\x20on\x20the\x20row\x20declarations.\x20Keep\x20every\x20recipient\x20an\x20explicit\x20NON-EMPTY\x20Entity\x20the\x20buyer\x20can\x20see\x20before\x20ordering.','suggestion':'Re-check\x20at\x20template_scan\x20after\x20edits\x20that\x20the\x20fee\x20keys\x20still\x20land\x20in\x20rows\x20whose\x20recipient\x20is\x20explicit.'});}const o=/(?:layer-?1|service-?level|pool)[^.]*settles? the full amount|full amount to the (?:platform|organizer) pool/i['test'](e);o&&b['push']({'rule_id':'R-ECON-04','severity':'medium','title':'Escrow\x20transits\x20an\x20organizer\x20pool\x20before\x20reaching\x20the\x20merchant','detail':'The\x20full\x20order\x20amount\x20settles\x20into\x20a\x20platform/organizer\x20pool\x20first\x20and\x20is\x20then\x20redistributed.\x20That\x20contradicts\x20the\x20direct-sales\x20promise\x20(\x22money\x20moves\x20only\x20between\x20the\x20two\x20parties\x22)\x20and\x20makes\x20the\x20organizer\x20a\x20waypoint\x20on\x20every\x20payout,\x20including\x20every\x20refund.','suggestion':'Release\x20supplier\x20segments\x20directly\x20from\x20the\x20order\x27s\x20own\x20Allocation,\x20and\x20make\x20the\x20organizer\x20a\x20named\x20party\x20rather\x20than\x20a\x20transit\x20node.'});const p=Object['keys'](c)['find'](L=>/^attributed_.*_bps$/['test'](L)&&typeof c[L]==='number'),q=Object['keys'](c)['find'](L=>/^(?:base_)?commission_rate_bps$/['test'](L)&&typeof c[L]==='number');p&&q&&c[p]>c[q]&&b['push']({'rule_id':'R-ECON-05','severity':'medium','title':'Attribution-priced\x20take:\x20a\x20cheaper\x20acquisition\x20channel\x20is\x20charged\x20MORE','detail':p+'='+c[p]+'\x20exceeds\x20'+q+'='+c[q]+'.\x20Charging\x20more\x20for\x20attributed\x20orders\x20means\x20the\x20merchant\x27s\x20cheap\x20channels\x20(KOC,\x20social,\x20repeat\x20buyers)\x20are\x20penalised\x20—\x20the\x20opposite\x20of\x20what\x20direct\x20sales\x20should\x20reward.','suggestion':'Price\x20every\x20channel\x20identically.\x20Attribution\x20may\x20change\x20RANKING,\x20never\x20the\x20take.'});if(a['allocator']['mode']==='rate'){const L=Object['keys'](c)['filter'](O=>MERCHANT_SHARE_KEY['test'](O)&&typeof c[O]==='number'),M=Object['keys'](c)['filter'](O=>PLATFORM_TAKE_KEY['test'](O)&&typeof c[O]==='number'),N=[...L,...M];if(L['length']>0x0&&M['length']>0x0){const O=N['map'](R=>c[R])['filter'](R=>typeof R==='number'),P=O['reduce']((R,S)=>R+S,0x0),Q=/surplus/i['test'](e);P!==0x2710&&!Q&&b['push']({'rule_id':'R-ECON-06','severity':'critical','title':'Rate\x20shares\x20sum\x20to\x20'+P+',\x20not\x2010000','detail':'Declared\x20rate\x20shares\x20('+N['map']((R,S)=>R+'='+O[S])['join']('\x20+\x20')+')\x20total\x20'+P+'.\x20With\x20no\x20Surplus\x20recipient\x20the\x20remainder\x20is\x20not\x20protected:\x20the\x20chain\x20records\x20no\x20\x22already\x20triggered\x22\x20flag,\x20so\x20a\x20balance\x20left\x20behind\x20after\x20a\x20partial\x20split\x20can\x20be\x20claimed\x20REPEATEDLY\x20by\x20anyone\x20passing\x20the\x20same\x20Guard.\x20This\x20is\x20exactly\x20what\x20happens\x20when\x20a\x20platform\x20leg\x20is\x20zeroed\x20without\x20recomputing\x20the\x20merchant\x20leg.','suggestion':'Make\x20the\x20shares\x20sum\x20to\x20exactly\x2010000,\x20or\x20declare\x20an\x20explicit\x20Surplus\x20recipient\x20for\x20the\x20residual.'});}}a['review_mode']==='review_reward'&&b['push']({'rule_id':'R-ECON-07','severity':'low','title':'Reward\x20pool\x20has\x20no\x20natural\x20reclaim\x20—\x20unclaimed\x20balance\x20stays\x20escrowed','detail':'This\x20template\x20arms\x20a\x20merchant-funded\x20reward/bounty\x20pool.\x20When\x20the\x20claim\x20window\x20closes,\x20an\x20unclaimed\x20balance\x20does\x20NOT\x20return\x20to\x20the\x20merchant\x20automatically:\x20the\x20sole\x20exit\x20is\x20the\x20owner-side\x20permission-158\x20reward\x20withdraw,\x20a\x20separate\x20governance\x20transaction\x20this\x20build\x20does\x20not\x20emit.\x20Per\x20store\x20the\x20residue\x20is\x20small,\x20but\x20across\x20campaigns\x20it\x20is\x20a\x20permanent\x20escrowed\x20float\x20the\x20merchant\x20may\x20mistake\x20for\x20spent\x20budget.','suggestion':'Either\x20plan\x20an\x20explicit\x20post-window\x20sweep\x20step\x20(permission-158\x20reward\x20withdraw\x20back\x20to\x20the\x20merchant\x20account)\x20in\x20the\x20campaign\x20runbook,\x20or\x20book\x20the\x20armed\x20pool\x20as\x20operating\x20cost\x20upfront\x20and\x20size\x20it\x20to\x20expected\x20claims.'});const s=Object['keys'](c)['find'](R=>SYBIL_CLAIM_KEY_REGEX['test'](R)&&typeof c[R]==='number'),w=s!==undefined?c[s]:undefined,x=Object['keys'](c)['find'](R=>MIN_PRICE_KEY_REGEX['test'](R)&&typeof c[R]==='number'),y=x!==undefined?c[x]:undefined;w!==undefined&&y!==undefined&&y>0x0&&w>y*0.2&&b['push']({'rule_id':'R-ECON-08','severity':'high','title':'Per-claim\x20'+s+'\x20=\x20'+w+'\x20exceeds\x2020%\x20of\x20the\x20lowest\x20SKU\x20price\x20('+y+')\x20—\x20sybil-farm\x20shape','detail':'The\x20goodwill/reward\x20per-claim\x20draw\x20is\x20more\x20than\x201/5\x20of\x20the\x20cheapest\x20SKU:\x20a\x20farm\x20of\x20bot\x20accounts\x20'+'earns\x20more\x20by\x20mass-claiming\x20the\x20compensation/review\x20bounty\x20than\x20a\x20real\x20after-sale\x20event\x20costs\x20—\x20'+'the\x20classic\x20sybil-arbitrage\x20shape\x20(sso7-mn-261104\x20F-31:\x20a\x20shipped\x20default\x20paid\x202.0x\x20the\x20lowest\x20'+'SKU\x20price\x20per\x20claim).\x20The\x20pre-funded\x20pool\x20drains\x20on\x20autopilot\x20and\x20the\x20claim/review\x20traffic\x20it\x20'+'buys\x20is\x20worthless\x20signal\x20—\x20batch-farmed\x20reviews\x20and\x20goodwill\x20claims\x20out-earn\x20genuine\x20'+'after-sales\x20cost.','suggestion':'Couple\x20the\x20draw\x20to\x20the\x20catalog:\x20keep\x20the\x20per-claim\x20amount\x20at\x20<=\x2020%\x20of\x20the\x20LOWEST\x20SKU\x20price\x20'+('(here\x20<=\x20'+Math['floor'](y*0.2)+'),\x20and\x20add\x20sybil\x20friction\x20before\x20a\x20claim\x20lands\x20—\x20a\x20')+'minimum\x20activity\x20row\x20count\x20(min_rows)\x20or\x20a\x20minimum\x20rating\x20threshold\x20—\x20with\x20the\x20claim\x20window\x20'+'parameterized\x20as\x20a\x20fee\x20param,\x20not\x20a\x20hard-coded\x20constant.'});const z=(a['allocator']['rows']??[])['map']((R,S)=>({'r':R,'i':S})),A=z['filter'](({r:R})=>R['recipient']==='entity'&&!(R['recipient_key']??'')['trim']());A['length']>0x0&&b['push']({'rule_id':ENTITY_RECIPIENT_RULE_ID,'severity':'critical','title':'Allocator\x20row(s)\x20'+A['map'](({i:R})=>'#'+R)['join'](',\x20')+'\x20name\x20no\x20Entity\x20recipient\x20—\x20the\x20share\x20silently\x20pays\x20the\x20deploying\x20merchant','detail':A['map'](({i:R})=>'rows['+R+']')['join'](',\x20')+'\x20declare\x20recipient=\x27entity\x27\x20with\x20no\x20recipient_key,\x20which\x20builds\x20as\x20'+'{\x20who:\x20{\x20Entity:\x20{\x20name_or_address:\x20\x22\x22\x20}\x20}\x20}.\x20That\x20is\x20NOT\x20a\x20no-op:\x20the\x20SDK\x20resolver\x20substitutes\x20the\x20DEFAULT\x20LOCAL\x20ACCOUNT\x20before\x20the\x20'+'address\x20reaches\x20Move,\x20so\x20the\x20order\x20escrow\x20pays\x20whoever\x20ran\x20the\x20deploy\x20—\x20the\x20\x27platform\x27\x20share\x20the\x20template\x20left\x20unnamed\x20becomes\x20the\x20merchant\x27s\x20'+('own\x20take.\x20'+DIRECT_SALES_INVARIANT),'suggestion':'Give\x20the\x20row\x20an\x20explicit\x20`recipient_key`\x20naming\x20the\x20party\x20(a\x20mark\x20name\x20or\x20a\x200x\x20address\x20the\x20buyer\x20can\x20see\x20BEFORE\x20ordering).\x20If\x20the\x20whole\x20sale\x20goes\x20'+'to\x20the\x20merchant,\x20do\x20not\x20declare\x20an\x20entity\x20row\x20at\x20all:\x20use\x20ONE\x20full-share\x20row\x20to\x20the\x20merchant\x27s\x20own\x20account\x20({\x20who:\x20{\x20Signer:\x20\x22signer\x22\x20}\x20}\x20when\x20'+'the\x20merchant\x20is\x20always\x20the\x20triggering\x20party,\x20or\x20an\x20explicit\x20Entity\x20row).\x20A\x20{\x20who:\x20{\x20GuardIdentifier:\x200\x20}\x20}\x20leg\x20pays\x20the\x20order\x20anchor,\x20not\x20the\x20'+'merchant\x20—\x20reserve\x20it\x20for\x20refunds\x20(see\x20the\x20order-anchored\x20refund\x20convention).\x20The\x20scalar\x20'+'`allocator.recipient:\x20\x22entity\x22`\x20form\x20is\x20auditable\x20too:\x20it\x20must\x20carry\x20a\x20`recipient_key`\x20(or\x20a\x20`rows[]`\x20array)\x20when\x20no\x20rows\x20narrow\x20it.'});!a['allocator']['rows']&&a['allocator']['recipient']==='entity'&&!(a['allocator']['recipient_key']??'')['trim']()&&b['push']({'rule_id':ENTITY_RECIPIENT_RULE_ID,'severity':'critical','title':'Allocator\x20names\x20no\x20Entity\x20recipient\x20(scalar\x20form,\x20no\x20rows)\x20—\x20the\x20share\x20silently\x20pays\x20the\x20deploying\x20merchant','detail':'The\x20allocator\x20declares\x20scalar\x20recipient=\x27entity\x27\x20with\x20no\x20recipient_key\x20and\x20no\x20rows[],\x20which\x20builds\x20as\x20'+'{\x20who:\x20{\x20Entity:\x20{\x20name_or_address:\x20\x22\x22\x20}\x20}\x20}.\x20That\x20is\x20NOT\x20a\x20no-op:\x20the\x20SDK\x20resolver\x20substitutes\x20the\x20DEFAULT\x20LOCAL\x20ACCOUNT\x20before\x20the\x20'+'address\x20reaches\x20Move,\x20so\x20the\x20order\x20escrow\x20pays\x20whoever\x20ran\x20the\x20deploy\x20—\x20the\x20share\x20the\x20template\x20left\x20unnamed\x20becomes\x20the\x20merchant\x27s\x20'+('own\x20take.\x20'+DIRECT_SALES_INVARIANT),'suggestion':'Declare\x20the\x20destination\x20machine-checkably:\x20set\x20`recipient_key`\x20on\x20the\x20allocator\x20(a\x20mark\x20name\x20or\x20a\x200x\x20address\x20the\x20buyer\x20can\x20see\x20BEFORE\x20ordering),\x20'+'or\x20add\x20a\x20`rows[]`\x20array\x20carrying\x20the\x20on-chain\x20`who`\x20shape.\x20If\x20the\x20whole\x20sale\x20goes\x20to\x20the\x20merchant,\x20use\x20ONE\x20row\x20naming\x20the\x20merchant\x27s\x20own\x20account\x20'+'({\x20recipient:\x20\x27entity\x27,\x20recipient_key:\x20\x27<merchant>\x27\x20}\x20or\x20{\x20recipient:\x20\x27signer\x27\x20}\x20when\x20the\x20merchant\x20is\x20always\x20the\x20triggering\x20party);\x20a\x20'+'{\x20recipient:\x20\x27guard_identifier\x27\x20}\x20row\x20pays\x20the\x20order\x20anchor\x20(refund\x20semantics),\x20not\x20the\x20merchant.'});const B=z['filter'](({r:R})=>R['recipient']==='entity'&&/^0x0*$/i['test']((R['recipient_key']??'')['trim']()));B['length']>0x0&&b['push']({'rule_id':ENTITY_RECIPIENT_RULE_ID,'severity':'high','title':'Allocator\x20row(s)\x20'+B['map'](({i:R})=>'#'+R)['join'](',\x20')+'\x20name\x20the\x20zero\x20address\x20as\x20Entity\x20recipient','detail':B['map'](({i:R})=>'rows['+R+']')['join'](',\x20')+'\x20carry\x20recipient_key=\x270x0\x27\x20(or\x20an\x20all-zero\x20literal).\x20The\x20chain\x20does\x20NOT\x20reject\x20it:\x20'+'the\x20on-chain\x20allocation\x20swallows\x20Recipient::Entity\x20in\x20a\x20(_)\x20catch-all\x20at\x20declaration\x20time,\x20and\x20forwards\x20the\x20raw\x20'+'address\x20straight\x20to\x20the\x20payout\x20constructor.\x20The\x20allocation\x20is\x20accepted\x20and\x20the\x20share\x20is\x20silently\x20transferred\x20to\x200x0\x20and\x20permanently\x20burned\x20—\x20'+'this\x20scan\x20is\x20the\x20only\x20defence.','suggestion':'Replace\x20the\x20zero\x20literal\x20with\x20the\x20real\x20recipient\x20address\x20(a\x20mark\x20name\x20or\x20a\x200x\x20address),\x20or\x20drop\x20the\x20row\x20if\x20the\x20share\x20is\x20not\x20owed.'});const C=R=>R['recipient']+':'+(R['recipient_key']??'')['trim']()['toLowerCase'](),D=/^(recover_gate|awarded_recover|terminal_settlement_recover)$/,E=R=>R['guard_key']??'\x00unkeyed',F=new Map();for(const R of a['allocator']['rows']??[]){if(R['mode']!=='rate'||D['test'](R['guard_key']??''))continue;const S=E(R),T=F['get'](S);if(T===undefined)F['set'](S,new Set([C(R)]));else T['add'](C(R));}const G=z['filter'](({r:U})=>U['mode']==='surplus'&&(F['get'](E(U))?.['has'](C(U))??![]));return G['length']>0x0&&b['push']({'rule_id':'R-RECIPIENT-04','severity':'critical','title':'Surplus\x20row(s)\x20'+G['map'](({i:U})=>'#'+U)['join'](',\x20')+'\x20pay\x20a\x20recipient\x20a\x20Rate\x20leg\x20already\x20pays\x20—\x20the\x20remainder\x20swallows\x20an\x20undeclared\x20share','detail':G['map'](({i:U})=>'rows['+U+']')['join'](',\x20')+'\x20duplicate\x20a\x20Rate\x20leg\x27s\x20recipient.\x20The\x20chain\x20pays\x20every\x20Rate\x20leg\x20its\x20declared\x20basis\x20points\x20'+'and\x20then\x20pays\x20the\x20ENTIRE\x20remainder\x20to\x20the\x20Surplus\x20recipient,\x20so\x20this\x20party\x20quietly\x20receives\x20rate%\x20+\x20100%\x20of\x20the\x20residual\x20and\x20any\x20leg\x20the\x20'+'author\x20intended\x20but\x20omitted\x20(commission,\x20payment\x20fee,\x20platform\x20take)\x20is\x20never\x20created.\x20The\x20Rate-sum\x20rule\x20passes\x20because\x20the\x20sum\x20is\x20legal\x20—\x20'+'the\x20misroute\x20is\x20invisible\x20there,\x20and\x20order_allocators\x20freezes\x20permanently\x20at\x20publish.\x20Mainnet\x20precedent\x20(Booking\x20replica,\x202026-10-06):\x20the\x20'+'property\x20took\x20100%\x20(Rate\x208350\x20+\x20Surplus),\x20the\x2015%\x20commission\x20and\x201.5%\x20payment-fee\x20legs\x20never\x20existed,\x20and\x20the\x20published\x20Service\x20had\x20to\x20be\x20abandoned.','suggestion':'Point\x20the\x20Surplus\x20row\x20at\x20the\x20party\x20meant\x20to\x20absorb\x20the\x20remainder\x20(usually\x20the\x20merchant),\x20distinct\x20from\x20every\x20Rate\x20leg\x20—\x20or,\x20if\x20the\x20duplicated\x20'+'recipient\x20is\x20truly\x20intended\x20to\x20take\x20rate%\x20+\x20remainder,\x20collapse\x20the\x20two\x20rows\x20into\x20ONE\x20rate\x20row\x20so\x20the\x20declared\x20split\x20equals\x20the\x20actual\x20split.\x20'+'Every\x20intended\x20payee\x20must\x20be\x20its\x20own\x20explicit\x20row.'}),b;}const KNOWN_GUARD_REF_IDS=new Set([...GUARD_DESIGN_PATTERNS['map'](a=>a['id']),...GUARD_TEMPLATES['map'](a=>a['id'])]);function guardRefChecks(a){const b=[];for(const c of a['guards']){if(!/^(pattern\.[a-z0-9_]+|tpl_[a-z0-9_]+)$/['test'](c['template_id'])){b['push']({'rule_id':'R-REF-01','severity':'high','title':'Guard\x20reference\x20\x27'+c['template_id']+'\x27\x20is\x20not\x20a\x20resolvable\x20id','detail':'Guard\x20references\x20must\x20name\x20a\x20guard\x20design\x20pattern\x20(\x27pattern.*\x27,\x20'+GUARD_DESIGN_PATTERNS['length']+'\x20available)\x20or\x20a\x20guard\x20template\x20(\x27tpl_*\x27,\x20'+GUARD_TEMPLATES['length']+'\x20available).\x20Bare\x20prose\x20ids\x20dangle:\x20no\x20builder\x20can\x20resolve\x20them,\x20so\x20the\x20AI\x20invents\x20guard\x20logic\x20at\x20build\x20time.','suggestion':'Replace\x20with\x20the\x20semantically\x20nearest\x20pattern.*/tpl_*\x20id\x20(compose\x20multi-condition\x20logic\x20in\x20the\x20purpose\x20text).'});continue;}!KNOWN_GUARD_REF_IDS['has'](c['template_id'])&&b['push']({'rule_id':'R-REF-02','severity':'high','title':'Guard\x20reference\x20\x27'+c['template_id']+'\x27\x20does\x20not\x20exist\x20in\x20any\x20guard\x20catalog','detail':'The\x20id\x20is\x20namespaced\x20correctly\x20but\x20matches\x20no\x20guard\x20design\x20pattern\x20nor\x20guard\x20template\x20—\x20a\x20dangling\x20reference\x20the\x20AI\x20cannot\x20resolve.','suggestion':'Fix\x20the\x20id\x20(typo)\x20or\x20point\x20it\x20at\x20the\x20nearest\x20existing\x20pattern.*/tpl_*\x20entry.'});}return b;}function staticChecks(a){const b=[],c=l=>{const m=new RegExp('\x5cb'+l['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&')+'\x5cb','i');for(const n of a['allocator']?.['rows']??[]){if(n['track']!=='refund'||!n['guard_key'])continue;const o=a['guards']['find'](q=>q['key']===n['guard_key']);if(o&&m['test']((o['key']??'')+'\x20'+o['purpose']))return!![];}return![];};for(const l of a['machine_shape']){const m=DISPUTE_FAMILY_NODE_REGEX['test'](l['name']),n=!m&&FUND_TERMINAL_NODE_REGEX['test'](l['name']);if(m||n&&!c(l['name']))b['push']({'rule_id':'R-M1-11','severity':'critical','title':'Machine\x20node\x20\x27'+l['name']+'\x27\x20models\x20dispute/refund\x20flow','detail':'Disputes\x20are\x20independent\x20of\x20the\x20Machine\x20workflow;\x20refunds\x20route\x20via\x20Allocators\x20triggered\x20by\x20business\x20states.','suggestion':'Remove\x20the\x20node;\x20route\x20refunds\x20via\x20Allocator\x20states\x20(closed_cancel/cancel_requested)\x20and\x20disputes\x20via\x20the\x20Arbitration\x20object.'});else{if(n){const o=/record[ -]waypoint|accepted-node set|money never moves/i['test'](l['role']??'');!o&&b['push']({'rule_id':'R-M1-11','severity':'low','title':'Machine\x20node\x20\x27'+l['name']+'\x27\x20reuses\x20a\x20fund-terminal\x20name\x20(guard-anchored,\x20exempt)','detail':'The\x20refund-track\x20allocator\x20consumes\x20a\x20guard\x20anchored\x20to\x20\x27'+l['name']+'\x27\x20—\x20the\x20guard\x20moves\x20the\x20funds,\x20so\x20the\x20node\x20is\x20a\x20routing\x20state,\x20not\x20a\x20money\x20move.','suggestion':'Prefer\x20a\x20routing-state\x20name\x20(closed_cancel/cancel_requested)\x20so\x20the\x20intent\x20is\x20self-evident\x20without\x20the\x20guard\x20chain.'});}}}for(const q of a['machine_shape']){for(const s of q['from']??[]){const w=typeof s==='string'?{'prev':s}:s;typeof w['prev']==='string'&&w['prev']!==''&&w['prev']===q['name']&&b['push']({'rule_id':'R-EDGE-SELF-LOOP','severity':'high','title':'Machine\x20edge\x20\x27'+(w['forward']??'(unnamed)')+'\x27\x20on\x20node\x20\x27'+q['name']+'\x27\x20is\x20a\x20SELF-loop','detail':'The\x20edge\x20is\x20mounted\x20in\x20its\x20own\x20target\x27s\x20from-list\x20(prev\x20==\x20the\x20owning\x20node).\x20A\x20same-node\x20forward\x20never\x20moves\x20progress.current\x20—\x20the\x20chain\x20records\x20the\x20tap\x20but\x20the\x20order\x20stays\x20on\x20the\x20node,\x20so\x20the\x20buyer/merchant\x20re-taps\x20it,\x20burns\x20gas,\x20and\x20every\x20path\x20that\x20leaves\x20the\x20node\x20stays\x20unreachable\x20(mainnet\x20B-01:\x20the\x20buyer\x27s\x20withdraw-return\x20spun\x20on\x20return_requested\x20while\x20the\x20guard\x20purpose\x20said\x20`return_requested\x20->\x20delivered`).','suggestion':'Mount\x20the\x20edge\x20in\x20the\x20TARGET\x20node\x27s\x20from-list\x20instead\x20(move\x20`{\x20prev:\x20\x27'+q['name']+'\x27,\x20forward:\x20...\x20}`\x20under\x20node\x20\x27<target>\x27),\x20or\x20delete\x20the\x20edge\x20if\x20no\x20movement\x20was\x20intended.'});}}{const x=(a['machine_shape']??[])['map'](z=>{const A=new Map();for(const B of z['from']??[]){const C=typeof B==='string'?{'prev':B}:B,D=typeof C['prev']==='string'?C['prev']:'',E=typeof C['forward']==='string'?C['forward']:'';if(E==='')continue;const F=A['get'](D)??[];F['push']({'name':E}),A['set'](D,F);}return{'name':z['name'],'pairs':[...A['entries']()]['map'](([G,H])=>({'prev_node':G,'forwards':H}))};}),y=lintForwardAmbiguity(x,'template\x20\x27'+a['id']+'\x27');for(const z of y['critical']){b['push']({'rule_id':'R-FORWARD-DEST-AMBIGUITY','severity':'critical','title':'Forward\x20ambiguity\x20blocks\x20every\x20generate\x20of\x20\x27'+a['id']+'\x27\x20(P0-6)','detail':z+'\x20—\x20the\x20compile/plan\x20faces\x20hard-block\x20this\x20shape\x20(P0-6:\x20the\x20caller\x20picks\x20next_node,\x20so\x20a\x20forked\x20(prev,\x20forward)\x20name\x20can\x20land\x20the\x20order\x20—\x20and\x20its\x20escrow\x20direction\x20—\x20on\x20the\x20WRONG\x20node;\x20test/10\x20P0-6\x20stranded\x20129,000,000).\x20A\x20template\x20whose\x20generate\x20is\x20BLOCKED\x20is\x20a\x20first-deploy\x20completeness\x20violation:\x20template_scan\x20must\x20catch\x20what\x20template_generate\x20blocks\x20(hiswkp\x20F-01).','suggestion':'Give\x20each\x20destination\x20its\x20own\x20forward\x20name\x20(destination-honest\x20fork\x20naming,\x20e.g.\x20WithdrawClaim\x20→\x20WithdrawClaimReturn\x20on\x20the\x20return\x20branch),\x20then\x20re-scan.'});}for(const A of y['warnings']){b['push']({'rule_id':'R-FORWARD-DEST-AMBIGUITY','severity':'medium','title':'Forward\x20fork\x20in\x20\x27'+a['id']+'\x27\x20needs\x20destination-unique\x20names','detail':''+A,'suggestion':'Prefer\x20destination-unique\x20forward\x20names\x20unless\x20the\x20fork\x20is\x20intentional\x20and\x20the\x20caller-facing\x20duty\x20names\x20the\x20choice.'});}}const d=new Map();for(const B of a['guards']??[]){const C=B&&typeof B['params']==='object'&&B['params']!==null?B['params']['expected_node']:undefined;typeof B?.['key']==='string'&&typeof C==='string'&&C!==''&&d['set'](B['key'],C);}if(d['size']>0x0){const D=new Map();for(const E of a['machine_shape']){for(const F of E['from']??[]){const G=typeof F==='string'?{'prev':F,'guard_key':undefined}:F;if(typeof G['guard_key']==='string'&&d['has'](G['guard_key'])){const H=D['get'](G['guard_key'])??new Set();H['add'](typeof G['prev']==='string'?G['prev']:''),D['set'](G['guard_key'],H);}}}for(const [I,J]of d){const K=D['get'](I);if(K===undefined||K['size']===0x1&&K['has'](J))continue;b['push']({'rule_id':'R-NODE-GATE-SOURCE','severity':'high','title':'Guard\x20\x27'+I+'\x27\x20pins\x20expected_node\x20\x27'+J+'\x27\x20but\x20no\x20mount\x20fires\x20from\x20that\x20node','detail':'progress.current\x20at\x20tap\x20time\x20equals\x20the\x20edge\x27s\x20prev;\x20a\x20node-check\x20guard\x20whose\x20expected_node\x20(\x27'+J+'\x27)\x20differs\x20from\x20its\x20mount\x20prev\x20('+(K?[...K]['map'](L=>'\x27'+(L||'(entry)')+'\x27')['join'](',\x20'):'none')+')\x20evaluates\x20FALSE\x20on\x20every\x20tap\x20—\x20the\x20forward\x20aborts\x20in\x20guard\x20verification,\x20a\x20paid\x20no-op\x20that\x20strands\x20the\x20order\x20on\x20the\x20source\x20node\x20(B-01\x20family).','suggestion':'Mount\x20the\x20edge\x20in\x20the\x20gated\x20node\x27s\x20from-list\x20(prev\x20=\x20expected_node),\x20or\x20re-point\x20the\x20guard\x27s\x20expected_node\x20to\x20the\x20mount\x27s\x20prev.\x20One\x20of\x20the\x20two\x20must\x20name\x20the\x20other\x27s\x20node.'});}}const e=new Map();for(const L of a['guards']){if(/time_lock|order_holder|progress_state/['test'](L['template_id'])&&!/order\.service|project bind|service binding/i['test'](L['purpose'])){const M=e['get'](L['template_id'])??[];M['push'](L['key']??'(no\x20key)'),e['set'](L['template_id'],M);}}for(const [N,O]of e){b['push']({'rule_id':'R-C3-05','severity':'low','title':'Guard\x20\x27'+N+'\x27\x20consumes\x20a\x20submitted\x20Order\x20without\x20project\x20binding\x20('+O['length']+'x:\x20'+O['join'](',\x20')+')\x20—\x20advisory\x20(v148\x20backstop)','detail':'Passport\x20submissions\x20are\x20caller-built;\x20without\x20logic_equal[order.service,\x20<service>]\x20a\x20stale\x20order\x20from\x20another\x20project\x20could\x20satisfy\x20the\x20guard\x20for\x20a\x20fresh\x20order.\x20Since\x20protocol\x20v148\x20the\x20Progress\x20layer\x20itself\x20rejects\x20cross-order\x20submissions\x20(the\x20chain-side\x20task-binding\x20check),\x20so\x20this\x20is\x20now\x20defense-in-depth:\x20the\x20window\x20is\x20closed\x20at\x20the\x20chain,\x20the\x20template\x20binding\x20only\x20shortens\x20the\x20failure\x20distance.','suggestion':'Optionally\x20state\x20the\x20project\x20binding\x20in\x20the\x20guard\x20purpose\x20AND\x20include\x20it\x20in\x20the\x20guard\x20root\x20at\x20build\x20time\x20(fails\x20earlier,\x20closer\x20to\x20the\x20cause).\x20No\x20longer\x20a\x20publish\x20blocker.'});}const f=new Map();for(const P of a['guards']){if(P['host']==='reward')continue;if(/order\.service/i['test'](P['purpose'])){const Q=f['get'](P['template_id'])??[];Q['push'](P['key']??'(no\x20key)'),f['set'](P['template_id'],Q);}}for(const [R,S]of f){b['push']({'rule_id':'R-C3-05-REDUNDANT','severity':'low','title':'Guard\x20\x27'+R+'\x27\x20still\x20declares\x20the\x20order.service\x20host-binding\x20leg\x20('+S['length']+'x:\x20'+S['join'](',\x20')+')\x20—\x20redundant\x20since\x20v148','detail':'The\x20catalog\x20sweep\x20(bsw4\x20F-06)\x20removed\x20the\x20order.service\x20==\x20<service>\x20leg\x20from\x20every\x20guard\x20template:\x20protocol\x20v148\x27s\x20chain-side\x20task-binding\x20check\x20already\x20rejects\x20cross-order\x20submissions,\x20and\x20the\x20leg\x20pinned\x20the\x20Machine\x20to\x20ONE\x20Service\x20instance\x20—\x20republishing\x20the\x20Service\x20stranded\x20the\x20Machine\x20and\x20every\x20forward\x20guard.\x20The\x20only\x20legitimate\x20order.service\x20comparison\x20is\x20the\x20cross-service\x20rule\x20against\x20the\x20MAIN\x20service\x20address\x20(tpl_buy_guard_order_holder),\x20which\x20is\x20not\x20a\x20host\x20pin.','suggestion':'Drop\x20the\x20leg\x20(guard_resolutions\x20entry\x20{\x20kind:\x20\x22omit\x22\x20})\x20or\x20rewrite\x20the\x20guard\x20purpose;\x20keep\x20an\x20order.service\x20leg\x20only\x20when\x20it\x20compares\x20against\x20a\x20DIFFERENT\x20service\x27s\x20address\x20(cross-service\x20business\x20rule,\x20not\x20the\x20host).'});}a['machine_shape']['length']===0x0&&b['push']({'rule_id':'R-M1-01','severity':'critical','title':'machine_shape\x20is\x20empty','detail':'No\x20entry\x20node\x20—\x20the\x20Machine\x20cannot\x20start.','suggestion':'Add\x20at\x20least\x20one\x20entry\x20node\x20representing\x20the\x20escrowed\x20state.'});const h=a['guards']['some'](T=>/refund|cancel/i['test'](T['template_id'])||/refund|cancel/i['test'](T['purpose']))||/refund/i['test'](a['allocator']['description']);!h&&b['push']({'rule_id':'R1','severity':'high','title':'No\x20refund\x20path\x20detected','detail':'No\x20refund/cancel\x20guard\x20and\x20no\x20refund\x20route\x20in\x20the\x20allocator\x20description.','suggestion':'Add\x20a\x20refund/cancel\x20guard\x20or\x20an\x20allocator\x20refund\x20route\x20before\x20publishing.'});const j=a['guards']['some'](T=>T['host']==='arbitration')||a['trust_mechanisms']['some'](T=>T['startsWith']('R2'));!j&&b['push']({'rule_id':'R2','severity':'high','title':'No\x20independent\x20Arbitration\x20reference\x20detected','detail':'The\x20template\x20carries\x20no\x20arbitration-hosted\x20guard\x20and\x20no\x20R2\x20trust\x20mechanism.','suggestion':'Mount\x20an\x20independent\x20Arbitration\x20object\x20with\x20its\x20own\x20Permission.'});a['keeper_dependencies']['length']===0x0&&b['push']({'rule_id':'R9','severity':'medium','title':'No\x20keeper\x20dependencies\x20declared','detail':'Time-driven\x20transitions\x20only\x20ALLOW\x20advancement\x20—\x20someone\x20must\x20run\x20the\x20keepers.','suggestion':'Declare\x20the\x20keeper\x20operations\x20(timeouts,\x20window\x20expiries,\x20settlement\x20triggers).'});b['push'](...directSalesEconomyChecks(a));const k=unannotatedBuyerActionNodes(a['machine_shape']);k['length']>0x0&&b['push']({'rule_id':'R-OPER-01','severity':'medium','title':'Buyer-side\x20node(s)\x20without\x20an\x20operator\x20annotation','detail':'Node(s)\x20'+k['map'](T=>'\x27'+T+'\x27')['join'](',\x20')+'\x20look\x20like\x20order-payer\x20actions\x20but\x20carry\x20no\x20operator\x20field.\x20At\x20build\x20time\x20they\x20default\x20to\x20a\x20merchant\x20permission\x20slot,\x20and\x20the\x20order\x20payer\x20cannot\x20advance\x20them\x20(E_PERMISSION_DENIED).','suggestion':'Annotate\x20true\x20buyer\x20actions\x20with\x20operator:\x20\x22order_payer\x22\x20(an\x20EMPTY\x20namedOperator\x20—\x20the\x20on-chain\x20check\x20resolves\x20it\x20to\x20the\x20order\x20payer);\x20rename\x20merchant-side\x20states\x20(e.g.\x20\x27cancelled\x27\x20->\x20\x27merchant_cancelled\x27)\x20when\x20the\x20actor\x20is\x20NOT\x20the\x20buyer.'});a['review_mode']&&a['review_mode']!=='none'&&b['push']({'rule_id':'R-REVIEW-WRITE-ONCE','severity':'low','title':'Reviews\x20are\x20write-once\x20—\x20a\x20mis-rating\x20cannot\x20be\x20edited,\x20deleted\x20or\x20followed\x20up','detail':'This\x20template\x20mounts\x20a\x20buyer\x20review\x20rail\x20whose\x20rating\x20+\x20comment\x20rows\x20are\x20write-once\x20(row\x20id\x20=\x20the\x20order).\x20There\x20is\x20NO\x20on-chain\x20update,\x20delete\x20or\x20follow-up-review\x20edge:\x20a\x20mistyped\x20rating\x20or\x20comment\x20is\x20permanent,\x20and\x20extortion-by-bad-review\x20has\x20no\x20negotiated-retraction\x20buffer\x20(the\x20repository\x20protocol\x20exposes\x20no\x20tombstone\x20semantics).','suggestion':'State\x20the\x20irreversibility\x20in\x20the\x20storefront\x20copy\x20and\x20any\x20pre-review\x20confirmation\x20step;\x20do\x20not\x20promise\x20\x27edit\x20your\x20review\x27\x20to\x20buyers.\x20A\x20negotiated\x20goodwill\x20remedy\x20must\x20ride\x20arbitration\x20or\x20a\x20refund,\x20not\x20a\x20review\x20edit.'});for(const T of a['guards']??[]){const U=T['template_id']?.['startsWith']('tpl_')?T['template_id']:undefined;if(U===undefined)continue;const V={...a['fee_params'],...T['params']};let W=fillGuardTemplate(U,V);if(!W['ok']){const Y=getTemplateById(U);if(Y===undefined)continue;const Z={...V};for(const a0 of Y['parameters']){if(a0['required']&&!(a0['name']in Z))Z[a0['name']]=a0['type']==='number'?0x1:'__scan_probe_'+a0['name']+'__';}W=fillGuardTemplate(U,Z);if(!W['ok'])continue;}const X=validateQuerySignatures(W['root'],U,T['key']);X!==undefined&&b['push']({'rule_id':'R-QUERY-SIGNATURE','severity':'critical','title':'Guard\x20\x27'+T['key']+'\x27\x20('+U+')\x20ships\x20a\x20root\x20the\x20SDK/chain\x20will\x20reject','detail':X+'\x20The\x20SDK\x20rejects\x20such\x20roots\x20at\x20guard-create\x20time\x20and\x20the\x20chain\x20at\x20verification\x20time\x20—\x20publishing\x20the\x20template\x20would\x20guarantee\x20a\x20mid-order\x20hard\x20failure\x20on\x20this\x20rail.','suggestion':'Fix\x20the\x20guard\x20template\x27s\x20example_root\x20(parameter\x20count\x20per\x20chain-query-registry;\x20logic_equal\x20operand\x20order\x20—\x20typed\x20operand\x20first,\x20dynamic\x20Value\x20second)\x20or\x20supply\x20the\x20missing\x20parameter\x20at\x20the\x20guard\x20spec\x20params.'});}return b;}const PERIOD_COUNT_KEY_REGEX=/^(monthly_allocators|term_count|session_count|segment_count|periods|cycles|installments)$/;function poolPeriodCount(a){for(const [b,c]of Object['entries'](a['fee_params'])){if(PERIOD_COUNT_KEY_REGEX['test'](b)&&typeof c==='number'&&c>=0x2)return c;}return undefined;}function periodicReleaseChecks(a){const b=poolPeriodCount(a);if(b===undefined)return[];const c=[a['allocator']['description'],...a['build_notes'],...a['trust_mechanisms'],...a['guards']['map'](h=>h['purpose'])]['join']('\x20\x0a\x20'),d=[];/surplus/i['test'](c)&&!/no surplus|surplus[^.\n]*(disabled|forbidden|disallowed)|amount mode only|single surplus/i['test'](c)&&d['push']({'rule_id':'R-PER-01','severity':'high','title':'Multi-period\x20pool\x20('+b+'\x20periods)\x20declares\x20Surplus\x20without\x20a\x20terminal-only\x20qualifier','detail':'A\x20Surplus\x20allocator\x20entry\x20runs\x20a\x20withdraw-all\x20release\x20(the\x20on-chain\x20allocation\x20withdraws\x20the\x20whole\x20remaining\x20balance).\x20In\x20a\x20pool\x20pre-funded\x20for\x20'+b+'\x20periods\x20it\x20drains\x20every\x20future\x20release,\x20not\x20just\x20the\x20remainder.','suggestion':'Release\x20each\x20period\x20with\x20Amount;\x20if\x20the\x20pool\x20remainder\x20settles\x20in\x20one\x20entry,\x20declare\x20it\x20explicitly\x20as\x20the\x20SINGLE\x20terminal\x20Surplus\x20at\x20the\x20settlement\x20node,\x20or\x20disable\x20Surplus\x20outright.'});const e=a['guards']['map'](h=>[h['key'],h['template_id'],h['purpose']]['filter'](Boolean)['join']('\x20'))['join']('\x20\x0a\x20'),f=c+'\x20\x0a\x20'+e,g=/per[- ](month|period|term|session|cycle|segment)|one per (rent )?period|release-sequence lock/i['test'](f)||/(?:month|period|term|week|session)_\d+_(?:release|unlock|guard)|release_\d+/i['test'](e);return!g&&d['push']({'rule_id':'R-PER-02','severity':'high','title':'Multi-period\x20pool\x20('+b+'\x20periods)\x20declares\x20no\x20per-period\x20release\x20Guard','detail':'the\x20on-chain\x20alloc\x20entry\x20has\x20no\x20consumed/nonce\x20flag:\x20two\x20releases\x20bound\x20to\x20the\x20SAME\x20Guard\x20can\x20both\x20fire\x20the\x20same\x20day\x20and\x20drain\x20the\x20pool.\x20The\x20cadence\x20gate\x20must\x20be\x20one\x20Guard\x20per\x20period.','suggestion':'Declare\x20one\x20release\x20Guard\x20per\x20period\x20(per-month/per-term\x20time-lock\x20Guards,\x20each\x20keyed\x20to\x20its\x20own\x20period\x20window)\x20in\x20the\x20guard\x20set.'}),!/threshold[^.\n]*(one|single|per[- ]|month|period|term|session|=\s*0\b|\b0\b|must be 0)/i['test'](c)&&d['push']({'rule_id':'R-PER-03','severity':'medium','title':'Multi-period\x20pool\x20('+b+'\x20periods)\x20does\x20not\x20pin\x20threshold\x20to\x20one\x20period','detail':'the\x20on-chain\x20alloc\x20asserts\x20balance\x20>=\x20threshold\x20before\x20EVERY\x20release.\x20A\x20threshold\x20sized\x20to\x20the\x20total\x20pool\x20passes\x20the\x20first\x20release\x20and\x20then\x20locks\x20all\x20remaining\x20periods.','suggestion':'State\x20in\x20the\x20allocator\x20description\x20or\x20build\x20notes\x20that\x20threshold\x20=\x20one\x20period\x27s\x20release\x20amount\x20(never\x20the\x20pre-funded\x20total).'}),d;}const MIN_PRICE_KEY_REGEX=/^(?:min_[a-z0-9_]*?(?:price|amount|usd|value)|price_floor)$/,FLOOR_TEXT_REGEX=/fixed (?:fee|charge)[^.\n]*(?:<|less than|below) [^.\n]*(?:lowest|minimum|min)|minimum (?:sku|order|item|unit) (?:price|amount)|(?:below|under|<=)\s*the\s+smallest[^.\n]*(?:order|escrow|booking|price)/i,FIXED_FEE_TEXT_REGEX=/\bamount mode\b|fixed (?:fee|fulfillment|fulfilment|per[- ]order) (?:fee|charge)|\bAmount\b[^.\n]*(?:fee|charge)/i;function fundAnchorChecks(a){const b=[],c=[a['allocator']['description'],...a['build_notes'],...a['trust_mechanisms'],...a['guards']['map'](h=>h['template_id']+'\x20'+h['purpose'])]['join']('\x20\x0a\x20'),d=a['allocator']['refund_track']==='order_anchored'||/allocator_order_anchor/['test'](c)||/guardidentifier\(0\)|order[- ]anchored|for_object/i['test'](c);!d&&b['push']({'rule_id':'R-ANCHOR-01','severity':'critical','title':'Allocator\x20has\x20no\x20order\x20anchor\x20—\x20its\x20Guard\x20cannot\x20bind\x20the\x20paying\x20Order','detail':'Every\x20recipient\x20of\x20this\x20allocator\x20is\x20a\x20fixed\x20party\x20(recipient=\x27'+a['allocator']['recipient']+'\x27,\x20no\x20GuardIdentifier\x20row),\x20so\x20nothing\x20in\x20the\x20Guard\x27s\x20verification\x20context\x20names\x20the\x20Order\x20being\x20settled:\x20Recipient::Entity/Signer\x20are\x20resolved\x20without\x20any\x20submission\x20check\x20(on-chain\x20allocation)\x20and\x20the\x20Allocation\x20itself\x20never\x20enters\x20the\x20Guard\x20context.\x20Testnet\x20proved\x20the\x20consequence:\x20a\x20passport\x20built\x20from\x20an\x20ALREADY-SETTLED\x20order\x20of\x20the\x20same\x20Service\x20drained\x20a\x20different\x20order\x27s\x20escrow\x20(CR-01).\x20The\x20identifier-255\x20once-slot\x20does\x20not\x20help\x20—\x20it\x20is\x20stored\x20per\x20Allocation,\x20so\x20a\x20fresh\x20pool\x20has\x20no\x20record.','suggestion':'Adopt\x20pattern.allocator_order_anchor:\x20add\x20one\x20{GuardIdentifier:\x200}\x20row\x20with\x20Rate\x200\x20(pays\x20nothing,\x20makes\x20the\x20submitted\x20Order\x20the\x20Guard\x27s\x20binding\x20target),\x20declare\x20refund_track:\x20\x22order_anchored\x22,\x20and\x20pin\x20the\x20Guard\x20expression\x20to\x20that\x20identifier\x20plus\x20logic_equal[order.service,\x20<this\x20service>].'});const e=a['allocator']['mode']==='amount',f=e||FIXED_FEE_TEXT_REGEX['test'](c),g=Object['keys'](a['fee_params'])['some'](h=>MIN_PRICE_KEY_REGEX['test'](h))||FLOOR_TEXT_REGEX['test'](c);f&&!g&&b['push']({'rule_id':'R-FIXFEE-01','severity':e?'critical':'high','title':'Fixed\x20Amount\x20fee\x20with\x20no\x20minimum\x20order\x20value\x20—\x20sub-fee\x20orders\x20deadlock\x20permanently','detail':'the\x20on-chain\x20allocation\x20asserts\x20balance\x20>=\x20fix\x20before\x20distributing:\x20an\x20order\x20escrowed\x20BELOW\x20the\x20fixed\x20fee\x20can\x20never\x20settle,\x20and\x20the\x20terminal\x20nodes\x20(completed/closed_cancel)\x20leave\x20no\x20refund\x20path\x20for\x20it,\x20so\x20buyer\x20funds\x20and\x20the\x20order\x20strand\x20forever\x20(testnet\x20CR-02,\x20reproduced\x20on\x20a\x200.001\x20WOW\x20SKU\x20against\x20a\x200.15\x20WOW\x20fee).','suggestion':'Declare\x20a\x20minimum\x20listing/order\x20value\x20above\x20every\x20fixed\x20leg\x20in\x20fee_params\x20(e.g.\x20min_sku_price)\x20and\x20state\x20it\x20in\x20the\x20allocator\x20description,\x20or\x20model\x20the\x20per-order\x20fee\x20as\x20Rate/RateGross\x20instead\x20of\x20a\x20fixed\x20Amount.'});a['allocator']['once_per_order']===!![]&&!/per[- ]allocation|per[- ]pool|not cross[- ]order|within (a|the) (pool|allocation)/i['test'](c)&&b['push']({'rule_id':'R-ONCE-SCOPE-01','severity':'medium','title':'once_per_order\x20claim\x20does\x20not\x20state\x20its\x20per-Allocation\x20scope','detail':'The\x20identifier-255\x20once-slot\x20is\x20keyed\x20(guard,\x20allocator,\x20submission)\x20ON\x20ONE\x20Allocation,\x20so\x20replay\x20immunity\x20holds\x20within\x20a\x20single\x20pool\x20only;\x20a\x20second\x20Allocation\x20of\x20the\x20same\x20Service\x20starts\x20with\x20no\x20record.\x20Presenting\x20ONCE\x20as\x20general\x20idempotency\x20is\x20what\x20let\x20testnet\x20CR-01\x20read\x20as\x20\x27already\x20protected\x27.','suggestion':'Say\x20explicitly\x20that\x20255\x20protects\x20one\x20pool,\x20and\x20pair\x20it\x20with\x20the\x20order\x20anchor\x20(R-ANCHOR-01)\x20for\x20cross-order\x20safety.'});if(a['allocator']['once_per_order']===!![]){const h=new Set((a['allocator']['rows']??[])['map'](n=>n['guard_key'])['filter'](n=>typeof n==='string'&&n['length']>0x0)),j=h['size']>0x0?a['guards']['filter'](n=>n['key']!=null&&h['has'](n['key'])):a['guards'],k=j['map'](n=>n['key']??n['template_id']),l=j['some'](n=>{if(!n['template_id']['startsWith']('tpl_'))return![];const o=GUARD_TEMPLATES['find'](p=>p['id']===n['template_id']);return Array['isArray'](o?.['example_table'])&&o['example_table']['some'](p=>p?.['identifier']===TASK_BINDING_SLOT||p?.['identifier']===ONCE_SLOT_BYTES);}),m=/\bidentifier[- ]?25[45]\b/['test'](c)||/\b25[45]\b[^.\n]{0,80}\bb_submission\b/i['test'](c)||/ONCE-FOR-OBJECT/['test'](c);!l&&!m&&b['push']({'rule_id':'R-ONCE-ARM','severity':'critical','title':'once-slot\x20NOT\x20armed\x20—\x20once_per_order\x20is\x20claimed\x20but\x20no\x20254/255\x20submission\x20slot\x20is\x20declared\x20anywhere','detail':'once_per_order\x20has\x20NO\x20automatic\x20on-chain\x20wiring:\x20the\x20chain\x20only\x20sees\x20a\x20replay\x20defense\x20if\x20the\x20BUILT\x20Guard\x20table\x20declares\x20the\x20ONCE\x20submission\x20slot\x20(identifier\x20254\x20ONCE-FOR-OBJECT\x20for\x20settlement/claim\x20rails,\x20255\x20byte-keyed\x20for\x20per-period\x20repeats)\x20and\x20the\x20trigger\x20passport\x20submits\x20it.\x20This\x20template\x20sets\x20once_per_order=true,\x20yet\x20neither\x20a\x20tpl_*\x20guard\x20table\x20nor\x20the\x20build\x20notes\x20declare\x20the\x20slot\x20for\x20any\x20allocator-bound\x20guard\x20—\x20the\x20advertised\x20replay\x20protection\x20does\x20not\x20exist\x20on-chain.','suggestion':'Arm\x20the\x20SETTLEMENT\x20allocator-bound\x20guard\x20row(s)\x20['+(k['join'](',\x20')||'<none\x20—\x20template\x20declares\x20no\x20guards>')+']:\x20add\x20the\x20arming\x20build_note\x20\x27Generation\x20must\x20add\x20a\x20submission\x20entry\x20{identifier:254,\x20b_submission:true,\x20value_type:\x22Address\x22,\x20object_type:\x22Order\x22}\x20to\x20each\x20SETTLEMENT\x20allocator\x20Guard\x20(never\x20a\x20refund\x20rail\x20—\x20a\x20refund\x20pays\x20the\x20Order\x20through\x20user\x20slot\x200\x20and\x20a\x20later\x20re-entry\x20would\x20abort\x2016,\x20OFN\x20#P-04)\x20and\x20submit\x20identifier\x20254\x20in\x20the\x20trigger\x20Passport\x27\x20(255\x20with\x20a\x20per-period\x20key\x20instead,\x20for\x20rails\x20that\x20legitimately\x20repeat),\x20or\x20reference\x20a\x20tpl_*\x20guard\x20whose\x20example_table\x20already\x20declares\x20the\x20slot\x20—\x20or\x20set\x20once_per_order=false\x20if\x20replay\x20protection\x20is\x20not\x20intended.'});}return b;}function templateText(a,b=[]){return[a['allocator']['description'],...a['build_notes'],...a['trust_mechanisms'],...a['guards']['map'](c=>c['template_id']+'\x20'+c['purpose']),...a['machine_shape']['map'](c=>c['name']+'\x20'+c['role']),...Object['entries'](a['time_anchors']??{})['map'](([c,d])=>c+'\x20'+d),...b]['join']('\x20\x0a\x20');}const BUY_GATE_CLAIM_REGEX=/\b(buy[\s-]?gate|purchase[\s-]?gate|age[\s-]?verification|age[\s-]?gate|adult[\s-]?verification|kyc[\s-]?gate|identity[\s-]?gate)\b/i;function buyKeyDeclarationChecks(a){const b=[];if(a['guards']['some'](c=>c['host']==='service'&&c['key']==='buy'))return b;return BUY_GATE_CLAIM_REGEX['test'](templateText(a))&&b['push']({'rule_id':'R-BUYKEY-01','severity':'critical','title':'A\x20purchase/buy\x20gate\x20is\x20declared\x20but\x20no\x20service\x20guard\x20carries\x20key\x20\x22buy\x22\x20—\x20the\x20gate\x20never\x20mounts','detail':'The\x20template\x20prose\x20declares\x20a\x20buy/purchase\x20gate\x20(age\x20verification,\x20KYC,\x20identity\x20gate\x20or\x20similar),\x20but\x20the\x20compiler\x20mounts\x20the\x20Service\x20buy\x20guard\x20ONLY\x20from\x20a\x20guard\x20spec\x20with\x20host=\x27service\x27\x20AND\x20key=\x27buy\x27.\x20No\x20such\x20spec\x20exists,\x20so\x20the\x20service\x20would\x20publish\x20with\x20NO\x20purchase\x20gate\x20while\x20trust_mechanisms\x20still\x20claim\x20one.','suggestion':'Add\x20key:\x20\x22buy\x22\x20to\x20the\x20service-host\x20guard\x20spec\x20that\x20implements\x20the\x20gate\x20(host\x20stays\x20\x27service\x27),\x20or\x20drop\x20the\x20gate\x20claim\x20from\x20the\x20prose\x20if\x20no\x20gate\x20is\x20intended.'}),b;}const CLAIM_BEARING_ARB_RE=/^tpl_forward_arb_ruling_(won|dismissed)$/,NO_CLAIMED_BY_OCCURRENCE_RE=/no\s+claimed_by[\s-]+leg/gi,DENIAL_RAIL_SCOPING_RE=/node[\s-]?gated|decision\s*11|caller-authorization|caller[\s-]?auth/i,RULING_SURFACE_RE=/ruling|award|arb[_ -]?(refund|won|dismissed)/i;function rulingEdgeDenial(a){NO_CLAIMED_BY_OCCURRENCE_RE['lastIndex']=0x0;let b;while((b=NO_CLAIMED_BY_OCCURRENCE_RE['exec'](a))!==null){const c=a['slice'](Math['max'](0x0,b['index']-0x3c),b['index']);if(DENIAL_RAIL_SCOPING_RE['test'](c))continue;const d=a['slice'](Math['max'](0x0,b['index']-0x50),b['index']+b[0x0]['length']+0x50);if(RULING_SURFACE_RE['test'](d))return!![];}return![];}const TWO_TRACK_DISCLOSURE_RE=/two[\s-]rail independence|independent\s+(channel|channels|rail|rails|track|tracks|fund|commercial)|sequencing seal|\u6392\u5e8f\u5c01\u5370|dual[\s-]?payout|\u53cc\u62ff|acknowledge_dual_payout|\u4e24\u6761\u72ec\u7acb|\u72ec\u7acb\u8d44\u91d1|independent commerce|claim aborts|code 27|keeper conclude/i;function docExpressionDriftChecks(a){const b=[],c=a['guards']['some'](h=>CLAIM_BEARING_ARB_RE['test'](h['template_id'])),d=templateText(a);c&&rulingEdgeDenial(d)&&b['push']({'rule_id':'R-DOC-EXPR-DRIFT','severity':'high','title':'Prose\x20denies\x20a\x20claimed_by\x20leg\x20ON\x20THE\x20RULING\x20EDGE\x20while\x20the\x20mounted\x20arb-ruling\x20guard\x20ships\x20one\x20(ddmq\x20F-22\x20drift\x20family,\x20PG-DOC-TRUTH)','detail':'This\x20template\x20mounts\x20tpl_forward_arb_ruling_won/_dismissed,\x20whose\x20award\x20edge\x20carries\x20the\x204R-03b\x20'+'claimed_by\x20SEQUENCING\x20SEAL\x20(the\x20edge\x20advances\x20only\x20after\x20the\x20award\x20claim\x20or\x20a\x20keeper\x20conclude).\x20'+'Yet\x20the\x20prose\x20ties\x20a\x20\x27no\x20claimed_by\x20leg\x27\x20denial\x20to\x20the\x20ruling/award\x20surface\x20itself.\x20A\x20user,\x20merchant,\x20'+'or\x20arbitrator\x20reading\x20that\x20prose\x20would\x20mispredict\x20the\x20ruling-edge\x20behaviour\x20—\x20exactly\x20the\x20'+'transparency\x20failure\x20the\x20two-independent-fund-chains\x20doctrine\x20forbids\x20(ddmq\x20F-22\x20mainnet).','suggestion':'Scope\x20the\x20prose\x20honestly\x20per\x20the\x20doctrine:\x20the\x20ORDER-MONEY\x20(escrow)\x20rail\x20is\x20node-gated\x20and\x20never\x20'+'reads\x20claimed_by\x20(decision\x2011\x20—\x20two\x20independent\x20fund\x20chains);\x20the\x20ARBITRATION\x20award\x20is\x20a\x20separate\x20'+'commercial\x20track\x20whose\x20claim\x20stamps\x20claimed_by\x20(a\x20sequencing\x20seal,\x20not\x20a\x20funding\x20gate\x20—\x20an\x20empty\x20'+'compensation\x20pool\x20aborts\x20the\x20claim\x20with\x20code\x2027,\x20and\x20a\x20keeper\x20CONCLUDE\x20stamps\x20it\x20without\x20any\x20fund).\x20'+'Rail-scoped\x20denials\x20are\x20doctrine-true;\x20ruling-edge-scoped\x20denials\x20are\x20the\x20lie.'});c&&!TWO_TRACK_DISCLOSURE_RE['test'](d)&&b['push']({'rule_id':'R-DOC-EXPR-DRIFT','severity':'medium','title':'Build\x20mounts\x20an\x20arb-ruling\x20edge\x20but\x20its\x20prose\x20never\x20teaches\x20the\x20two-independent-fund-chains\x20fact\x20(transparency\x20floor,\x20PG-DOC-TRUTH)','detail':'The\x20mounted\x20ruling\x20edge\x20moves\x20award\x20money\x20on\x20the\x20ARBITRATION\x20fund\x20chain\x20(the\x20service\x20compensation\x20'+'pool)\x20while\x20the\x20escrow\x20moves\x20order\x20money\x20—\x20two\x20independent\x20chains\x20ordered\x20by\x20business\x20rules,\x20not\x20'+'chain-enforced\x20netting.\x20The\x20doctrine\x20requires\x20FULL\x20transparency\x20to\x20buyer,\x20merchant,\x20and\x20arbitrator;\x20'+'this\x20template\x27s\x20prose\x20surfaces\x20never\x20state\x20the\x20two-track\x20fact,\x20the\x20sequencing\x20seal,\x20or\x20the\x20'+'dual-payout\x20confirmation\x20—\x20a\x20reader\x20cannot\x20predict\x20that\x20a\x20buyer\x20may\x20collect\x20both\x20the\x20award\x20and\x20an\x20'+'escrow\x20refund,\x20or\x20that\x20the\x20award\x20claim\x20aborts\x20(code\x2027)\x20on\x20an\x20unfunded\x20pool.','suggestion':'Add\x20a\x20TWO\x20INDEPENDENT\x20FUND\x20CHAINS\x20disclosure\x20sentence\x20to\x20allocator\x20description\x20or\x20build_notes:\x20\x27the\x20'+'arbitration\x20award\x20pays\x20from\x20the\x20compensation\x20fund\x20as\x20an\x20INDEPENDENT\x20commercial\x20track\x20—\x20it\x20never\x20'+'moves\x20the\x20order\x20escrow;\x20a\x20buyer\x20may\x20collect\x20BOTH\x20the\x20award\x20and\x20an\x20escrow\x20refund\x20(the\x20dual-payout\x20'+'confirmation\x20gate\x20governs\x20that\x20combination);\x20the\x20ruling\x20edge\x20advances\x20only\x20after\x20the\x20award\x20claim\x20'+'(aborts\x20code\x2027\x20if\x20the\x20pool\x20is\x20empty)\x20or\x20a\x20keeper\x20conclude.\x27'});const e=/\barb_dismissed_resume\b|dismissed[\s-]+(resume|twin|branch|forward)|tpl_forward_arb_ruling_dismissed/i,f=/machine[ -]no-?op|ordinary settle|settle_window_gate|edge addition at plan time|no dismissed (?:edge|branch|forward)|assembles? no tpl_forward_arb_ruling_dismissed/i,g=a['guards']['some'](h=>h['template_id']==='tpl_forward_arb_ruling_dismissed');return!g&&e['test'](templateText(a))&&!f['test'](templateText(a))&&b['push']({'rule_id':'R-DOC-EXPR-DRIFT','severity':'high','title':'Prose\x20promises\x20a\x20dismissed/resume\x20arbitration\x20branch\x20the\x20build\x20never\x20assembles\x20(ddmq\x20F-24\x20drift\x20family,\x20PG-DOC-TRUTH)','detail':'The\x20prose\x20names\x20a\x20dismissed-ruling\x20branch\x20(arb_dismissed_resume\x20or\x20the\x20tpl_forward_arb_ruling_dismissed\x20'+'twin),\x20but\x20no\x20guard\x20spec\x20in\x20this\x20template\x20mounts\x20that\x20template\x20—\x20a\x20merchant\x20reading\x20the\x20prose\x20expects\x20a\x20'+'dismissed-ruling\x20re-route\x20that\x20does\x20not\x20exist\x20on\x20chain.','suggestion':'Either\x20mount\x20tpl_forward_arb_ruling_dismissed\x20on\x20the\x20sanctioned\x20exit,\x20or\x20reword\x20the\x20prose\x20to\x20the\x20real\x20'+'shape\x20(F-54\x20cure):\x20a\x20dismissed/zero\x20award\x20is\x20a\x20machine\x20no-op\x20—\x20the\x20order\x20rests\x20where\x20it\x20was\x20and\x20the\x20'+'merchant-favour\x20outcome\x20rides\x20the\x20ordinary\x20settle\x20edge;\x20a\x20machine-recorded\x20dismissal\x20is\x20an\x20edge\x20'+'addition\x20at\x20plan\x20time.'}),b;}const STAY_DATE_REGEX=/check[\s-]?in|check[\s-]?out|departure\s+date|arrival\s+date|booking\s+date|checkin|checkout|stay\s+date|stay_nights|\bstay\s+nights?\b|\bper\s+night\b/i,CHAIN_CLOCK_REGEX=/order\.time|progress\.current_time|\border\s+time\b|witness/i,REPOSITORY_DATE_SOURCE_REGEX=/(?:write|writes|written|storing|store|stores|persist|persisted|record|records|read|reads)\b[^.\n]{0,90}repositor|repositor\w*\b[^.\n]{0,90}(?:stay|check[\s-]?in|check[\s-]?out|departure|arrival|date)/i;function timeWindowAnchorChecks(a){const b=templateText(a);if(!STAY_DATE_REGEX['test'](b))return[];if(CHAIN_CLOCK_REGEX['test'](b)||REPOSITORY_DATE_SOURCE_REGEX['test'](b))return[];const c=b['match'](new RegExp(STAY_DATE_REGEX['source'],'gi'))??[],d=/\d+\s*[-–]\s*\d+\s*h(?:ours?|rs?)?\s*(?:adjustable|tunable|configurable)|\badjustable\b|\btunable\b/i['test'](b);return[{'rule_id':'R-WIN-ANCHOR-01','severity':'high','title':'Per-order\x20time\x20window(s)\x20anchored\x20to\x20a\x20stay\x20date\x20that\x20does\x20not\x20exist\x20on\x20chain\x20('+Array['from'](new Set(c))['slice'](0x0,0x5)['join'](',\x20')+')','detail':'The\x20template\x27s\x20windows\x20are\x20relative\x20to\x20a\x20check-in\x20/\x20check-out\x20/\x20departure\x20/\x20night\x20date.\x20No\x20such\x20field\x20exists\x20on\x20chain:\x20'+'The\x20order\x20items\x20vector\x20is\x20`vector<SaleItem>`\x20with\x20`SaleItem\x20{\x20item,\x20price,\x20quantity,\x20wip_hash\x20}`\x20and\x20the\x20purchasable\x20'+'`Sale\x20{\x20name,\x20price,\x20stock,\x20suspension,\x20wip,\x20wip_hash\x20}`\x20carries\x20no\x20schedule;\x20the\x20only\x20per-order\x20clock\x20is\x20'+'`Order.time`,\x20the\x20CREATION\x20timestamp.\x20`Progress.current_time`\x20is\x20overwritten\x20on\x20every\x20forward\x20'+'and\x20`Progress.history`\x20records\x20node\x20visits,\x20so\x20neither\x20is\x20a\x20business\x20date.\x20A\x20window\x20declared\x20relative\x20to\x20the\x20'+'stay\x20calendar\x20is\x20therefore\x20UNREACHABLE\x20—\x20every\x20published\x20Guard\x20silently\x20measures\x20from\x20booking\x20time\x20instead,\x20and\x20for\x20a\x20lead\x20time\x20of\x20'+'days-to-weeks\x20that\x20is\x20a\x20material\x20semantic\x20loss,\x20not\x20a\x20rounding\x20error.'+(d?'\x20The\x20window\x20is\x20also\x20advertised\x20as\x20adjustable,\x20which\x20is\x20doubly\x20unreachable:\x20a\x20Guard\x20is\x20frozen\x20at\x20creation\x20'+'(transfer::freeze_object)\x20and\x20Machine\x20forwards\x20are\x20immutable\x20after\x20publish\x20(the\x20not-published\x20guard),\x20so\x20an\x20\x27N-Mh\x20adjustable\x27\x20window\x20means\x20one\x20separately\x20published\x20Guard\x20per\x20window\x20value,\x20never\x20a\x20tunable\x20one.':''),'suggestion':'Express\x20every\x20window\x20relative\x20to\x20`order.time`\x20(or\x20`order.time\x20+\x20<window>`),\x20and\x20if\x20the\x20business\x20promise\x20is\x20genuinely\x20a\x20stay-date\x20'+'deadline,\x20write\x20the\x20stay\x20dates\x20into\x20a\x20Repository\x20at\x20buy\x20time,\x20pin\x20that\x20Repository\x20address\x20as\x20a\x20table\x20constant,\x20and\x20read\x20them\x20in\x20the\x20'+'Guard\x20(`query\x20repository.data`).\x20State\x20the\x20residual\x20semantic\x20loss\x20in\x20build_notes\x20rather\x20than\x20declaring\x20a\x20calendar-relative\x20window.'}];}function signerRefundChecks(a){const b=[],c=a['allocator']['rows']??[],d=c['find'](k=>k['recipient']==='signer'&&k['track']==='refund'),e=templateText(a),f=/Recipient::Signer[^;]{0,200}(?:tx_context::sender|tx[_ ]sender|signer-binding|pins? that claim|identity-bound)/i['test'](e),g=a['allocator']['recipient']==='signer'&&!f;if(!d&&!g)return b;const h=/refund|chargeback|repay|(?:pay(?:ment|out)?|release|send|transfer|settle)\w*[^.\n]{0,40}to the (?:buyer|order|customer)/i['test'](e);if(!h)return b;const j=d?'allocator\x20row\x20'+d['track']+'/'+(d['recipient_key']??'?'):'allocator.recipient=\x27signer\x27';return b['push']({'rule_id':'R-SIGNER-02','severity':'high','title':'Refund\x20leg\x20pays\x20Recipient::Signer\x20—\x20the\x20keeper,\x20not\x20the\x20buyer\x20('+j+')','detail':'`Recipient::Signer`\x20resolves\x20to\x20`tx_context::sender(ctx)`,\x20i.e.\x20whoever\x20signed\x20the\x20transaction\x20that\x20triggered\x20'+'`alloc`.\x20Time-driven\x20refunds\x20are\x20keeper-triggered\x20by\x20construction,\x20so\x20this\x20leg\x20pays\x20the\x20KEEPER,\x20and\x20because\x20the\x20allocation\x20records\x20no\x20'+'consumed\x20flag\x20for\x20the\x20recipient,\x20first-come-first-served.\x20Only\x20`Recipient::GuardIdentifier`\x20(resolved\x20through\x20the\x20Guard\x20submission)\x20or\x20an\x20explicit\x20`Entity`\x20is\x20safe\x20for\x20a\x20refund.','suggestion':'Replace\x20the\x20Signer\x20refund\x20row\x20with\x20a\x20`{GuardIdentifier:\x200}`\x20row\x20(the\x20submission\x20for\x20a\x20Service-created\x20Allocation\x20is\x20pinned\x20to\x20the\x20paying\x20'+'Order,\x20so\x20only\x20`order.owner`\x20can\x20receive\x20it)\x20and\x20bind\x20the\x20Guard\x20to\x20`order.owner`\x20+\x20`progress.current\x20==\x20<refund\x20node>`.'}),b;}function orderAnchorDeclarationChecks(a){const b=templateText(a),c=a['allocator']['refund_track']==='order_anchored'||/order[\s-]anchored|order anchor|refund recipient is the order|anchor row|guardidentifier\s*\(\s*0\s*\)|for_object/i['test'](b);if(!c)return[];const d=(a['allocator']['rows']??[])['some'](g=>g['recipient']==='guard_identifier'||g['recipient']==='guard_identifier_to_order'),e=a['guards']['some'](h=>h['template_id']==='pattern.allocator_order_anchor');if(d||e)return[];const f=a['allocator']['recipient']??'?';return[{'rule_id':'R-RECIPIENT-02','severity':'high','title':'Order-anchored\x20refund\x20recipient\x20is\x20asserted\x20in\x20prose\x20but\x20declared\x20nowhere\x20machine-checkable','detail':'The\x20template\x20claims\x20an\x20order-anchored\x20escrow\x20/\x20refund\x20recipient\x20while\x20its\x20machine-readable\x20allocator\x20says\x20recipient=\x27'+f+'\x27\x20'+'with\x20no\x20`guard_identifier`\x20row\x20and\x20no\x20`pattern.allocator_order_anchor`\x20Guard\x20reference.\x20Two\x20on-chain\x20facts\x20make\x20the\x20claim\x20as\x20written\x20'+'unbuildable:\x20(1)\x20`Recipient`\x20has\x20only\x20`GuardIdentifier(u8)`\x20/\x20`Entity(address)`\x20/\x20`Signer`\x20—\x20there\x20is\x20NO\x20'+'`Order`\x20variant,\x20so\x20\x27the\x20refund\x20recipient\x20is\x20the\x20order\x20object\x27\x20can\x20only\x20be\x20written\x20as\x20a\x20`GuardIdentifier`\x20row;\x20(2)\x20recipients\x20that\x20are\x20'+'all\x20fixed\x20`Entity`\x20rows\x20resolve\x20without\x20the\x20passport\x20submission\x20and\x20the\x20Allocation\x20never\x20enters\x20the\x20Guard\x20'+'context,\x20so\x20the\x20Guard\x20has\x20no\x20order\x20to\x20bind\x20at\x20all\x20—\x20the\x20CR-01\x20drain\x20shape.\x20A\x20build\x20agent\x20reading\x20the\x20prose\x20instead\x20of\x20the\x20schema\x20will\x20'+'emit\x20an\x20Entity\x20refund\x20leg\x20to\x20the\x20merchant,\x20or\x20a\x20Signer\x20leg\x20to\x20the\x20keeper.','suggestion':'Declare\x20the\x20anchor\x20machine-checkably:\x20one\x20`{\x20recipient:\x20\x27guard_identifier\x27,\x20recipient_key:\x20\x270\x27,\x20mode:\x20\x27rate\x27,\x20value:\x200\x20}`\x20row\x20(the\x20'+'pattern.allocator_order_anchor\x20convention)\x20plus\x20`refund_track:\x20\x27order_anchored\x27`,\x20and\x20reference\x20`pattern.allocator_order_anchor`\x20in\x20the\x20'+'guard\x20set\x20with\x20the\x20`logic_equal[order.service,\x20<this\x20service>]`\x20binding\x20stated\x20in\x20its\x20purpose.'}];}const EDGE_DEPENDENCY_REGEX=/\b(?:incoming|outgoing|arb_refund)\s+edge\b|\bstop[\s-]node\b|\bedges?\b|\bpairs?\b|\bforwards?\b|one pair|two pairs/i;function topologyChecks(a){const b=[],c=templateText(a);if(a['machine_shape']['some'](j=>(j['from']??[])['length']>0x0))return b;EDGE_DEPENDENCY_REGEX['test'](c)&&b['push']({'rule_id':'R-TOPO-01','severity':'high','title':'machine_shape\x20ships\x20nodes\x20only\x20—\x20no\x20Pair/forward\x20list,\x20so\x20stop-node\x20fund-exit\x20coverage\x20is\x20unauditable','detail':'This\x20template\x27s\x20correctness\x20depends\x20on\x20Machine\x20edges\x20(its\x20own\x20notes\x20reason\x20about\x20incoming/outgoing\x20edges,\x20pairs\x20and\x20stop-node\x20'+'fund-exit\x20coverage),\x20but\x20`machine_shape`\x20carries\x20NO\x20edges:\x20an\x20edge\x20on\x20chain\x20is\x20`Node[target].pairs\x20=\x20{\x20prev_node,\x20threshold,\x20'+'forwards[]\x20}`,\x20which\x20this\x20schema\x20cannot\x20express.\x20The\x20scanner\x20therefore\x20has\x20to\x20invent\x20a\x20linear\x20chain,\x20and\x20the\x20mandatory\x20'+'stop-node\x20walk\x20(R-M5-03\x20/\x20R-M5-09:\x20every\x20rest\x20state\x20needs\x20a\x20defined\x20withdrawal\x20AND\x20refund\x20rule,\x20satisfiable\x20in\x20both\x20directions)\x20'+'cannot\x20be\x20performed\x20—\x20an\x20uncovered\x20stop\x20node\x20strands\x20escrow\x20permanently\x20once\x20Machine\x20+\x20Allocator\x20are\x20frozen\x20at\x20publish.','suggestion':'Either\x20state\x20the\x20edges\x20explicitly\x20in\x20build_notes\x20as\x20`prev\x20─forward(op,w)→\x20next`\x20with\x20the\x20Pair\x20grouping,\x20or\x20declare\x20a\x20machine-readable\x20'+'edge\x20list\x20so\x20the\x20scanner\x20can\x20audit\x20stop-node\x20coverage\x20and\x20prev_node\x20uniqueness\x20instead\x20of\x20guessing.'});const d=a['machine_shape']['map'](j=>j['name']);if(d['length']===0x0)return b;const e=d['filter'](j=>BRANCH_STATE_REGEX['test'](j));if(e['length']===0x0)return b;const f=d[0x0],g=!BRANCH_STATE_REGEX['test'](d[0x1]),h=(g?0x1:0x0)+e['length'];if(h<=0x1)return b;return b['push']({'rule_id':'R-TOPO-02','severity':'medium','title':'Node\x20\x27'+f+'\x27\x20has\x20'+h+'\x20outgoing\x20rails\x20—\x20declare\x20the\x20Pair\x20grouping\x20(E_DUPLICATE_NODE_PREV\x20is\x20per\x20TARGET\x20node,\x20not\x20per\x20source)','detail':'From\x20\x27'+f+'\x27\x20the\x20declared\x20node\x20set\x20requires\x20'+h+'\x20distinct\x20rails\x20'+('('+(g?'the\x20linear\x20rail\x20to\x20\x27'+d[0x1]+'\x27,\x20':''))+(e['map'](j=>'the\x20branch\x20to\x20\x27'+j+'\x27')['join'](',\x20')+').\x20These\x20are\x20LEGAL\x20and\x20must\x20NOT\x20be\x20merged:\x20an\x20edge\x20A→B\x20is\x20')+'stored\x20in\x20`Node[B].pairs\x20=\x20{\x20prev_node:\x20A,\x20threshold,\x20forwards[]\x20}`,\x20and\x20the\x20chain\x20rejects\x20only\x20the\x20SAME\x20`prev_node`\x20appearing\x20'+'twice\x20inside\x20ONE\x20node\x27s\x20pairs\x20(`assert!(!vector::contains(&res,\x20&pair.prev_node),\x20E_DUPLICATE_NODE_PREV)`,\x20on\x20chain).\x20Rails\x20into\x20different\x20targets\x20occupy\x20different\x20nodes,\x20so\x20each\x20`prev_node`\x20still\x20appears\x20exactly\x20once\x20per\x20node.\x20'+'THE\x20HAZARD\x20IS\x20THE\x20MIRROR\x20IMAGE:\x20two\x20forwards\x20from\x20the\x20SAME\x20source\x20into\x20the\x20SAME\x20target\x20must\x20be\x20ONE\x20Pair\x20carrying\x20both\x20forwards\x20—\x20'+'a\x20builder\x20that\x20emits\x20one\x20Pair\x20per\x20forward\x20duplicates\x20`prev_node`\x20and\x20ABORTS\x20at\x20publish,\x20after\x20Machine\x20+\x20Guard\x20are\x20frozen.\x20Note\x20'+'also\x20that\x20one\x20forward\x20cannot\x20satisfy\x20two\x20operators:\x20each\x20forward\x20contributes\x20its\x20weight\x20at\x20most\x20once\x20(locked\x20by\x20its\x20first\x20operator),\x20'+'so\x20a\x20dual-confirmation\x20step\x20needs\x20`threshold\x20=\x202`\x20with\x20two\x20DISTINCT\x20forwards.\x20A\x20node\x20list\x20cannot\x20distinguish\x20'+'these\x20cases,\x20which\x20is\x20why\x20this\x20is\x20advisory\x20and\x20not\x20a\x20proven\x20defect.','suggestion':'Do\x20NOT\x20merge\x20the\x20rails.\x20Instead\x20declare\x20the\x20grouping\x20explicitly\x20in\x20build_notes\x20as\x20'+'`prev\x20─forward(op,w)→\x20next`,\x20marking\x20which\x20forwards\x20SHARE\x20one\x20target\x20and\x20therefore\x20belong\x20in\x20ONE\x20Pair,\x20and\x20state\x20each\x20Pair\x27s\x20'+'`threshold`\x20(2\x20with\x20two\x20distinct\x20forwards\x20when\x20two\x20different\x20operators\x20must\x20act).\x20This\x20also\x20lets\x20the\x20scanner\x20audit\x20prev_node\x20'+'uniqueness\x20instead\x20of\x20guessing.\x20Related:\x20R-TOPO-01\x20(high)\x20is\x20the\x20finding\x20that\x20records\x20that\x20edges\x20are\x20unauditable\x20at\x20all.'}),b;}function reachabilityChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0)return[];if(!b['some'](C=>(C['from']??[])['length']>0x0))return[];const c=new Map(),d=new Map(),f=[],g=new Map();for(const C of b){const D=C['segment'];if(D&&typeof D['id']==='string')g['set'](D['id'],C['name']);}const h=E=>{if(typeof E!=='string')return E;const F=E['match'](/^\{(.+)\.(?:last|all)\}$/);return F&&g['has'](F[0x1])?g['get'](F[0x1]):E;};for(const E of b){for(const F of E['from']??[]){const G=h(typeof F==='string'?F:F?.['prev']);if(G==='')f['push'](E['name']);else{if(!c['has'](G))c['set'](G,[]);c['get'](G)['push'](E['name']);if(!d['has'](G))d['set'](G,[]);d['get'](G)['push']({'prev':G,'operator':typeof F==='string'?undefined:F?.['operator']});}}}const j=[];f['length']===0x0&&j['push']('no\x20entry\x20edge\x20(prev:\x20\x22\x22)\x20—\x20the\x20Machine\x20has\x20no\x20starting\x20Pair\x20and\x20orders\x20can\x20never\x20begin');const k=new Set(f),l=[...f];while(l['length']>0x0){const H=l['pop']();for(const I of c['get'](H)??[]){!k['has'](I)&&(k['add'](I),l['push'](I));}}const n=b['filter'](J=>!k['has'](J['name']))['map'](J=>'\x27'+J['name']+'\x27');n['length']>0x0&&j['push']('unreachable\x20from\x20the\x20entry\x20(declared\x20but\x20dead):\x20'+n['join'](',\x20'));const o=J=>J['semantic_role']==='final'||J['semantic_role']==='cancelled',p=new Map();for(const [J,K]of c){for(const L of K){if(!p['has'](L))p['set'](L,[]);p['get'](L)['push'](J);}}const s=new Set(),w=b['filter'](o)['map'](M=>M['name']);w['forEach'](M=>s['add'](M));while(w['length']>0x0){const M=w['pop']();for(const N of p['get'](M)??[]){!s['has'](N)&&(s['add'](N),w['push'](N));}}const x=b['filter'](O=>!o(O)&&!s['has'](O['name'])&&(c['get'](O['name'])??[])['length']>0x0)['map'](O=>{const P='exits\x20lead\x20only\x20to\x20'+[...new Set(c['get'](O['name'])??[])]['map'](Q=>'\x27'+Q+'\x27')['join'](',\x20')+',\x20none\x20of\x20which\x20reaches\x20a\x20settlement\x20or\x20refund\x20endpoint';return'\x27'+O['name']+'\x27\x20('+(O['semantic_role']??'no\x20semantic_role')+')\x20—\x20'+P;});x['length']>0x0&&j['push']('no\x20path\x20to\x20a\x20terminal\x20(final/cancelled):\x20'+x['join'](';\x20'));const y=new Map(b['map'](O=>[O['name'],O])),z=[];for(const O of new Set(f)){const P=d['get'](O)??[];if(P['length']===0x0)continue;const Q=P['map'](R=>edgeOperatorRail(R,y['get'](O),R['prev']));if(Q['every'](R=>R==='order_payer'))z['push'](O);}z['length']>0x0&&j['push']('entry\x20role-strand\x20—\x20buyer-signature-only\x20exits:\x20'+z['map'](R=>'\x27'+R+'\x27')['join'](',\x20')+'\x20'+'(every\x20out-edge\x20of\x20the\x20entry\x20landing\x20node\x20rides\x20the\x20order_payer\x20rail;\x20an\x20absent\x20buyer\x20locks\x20the\x20escrow\x20at\x20genesis\x20—\x20give\x20the\x20node\x20a\x20merchant/keeper\x20entry\x20pair,\x20e.g.\x20an\x20opening-window\x20timeout\x20into\x20a\x20refund-covered\x20terminal)');const A=new Set();for(const R of b){const S=new Set(),T=[...c['get'](R['name'])??[]];while(T['length']>0x0){const U=T['pop']();if(S['has'](U))continue;S['add'](U),T['push'](...c['get'](U)??[]);}if(S['has'](R['name']))A['add'](R['name']);}const B=[];for(const V of b){if(!A['has'](V['name'])||!REFUND_RAIL_NODE_REGEX['test'](V['name']))continue;for(const W of V['from']??[]){const X=typeof W==='string'?undefined:W?.['guard_key'];if(typeof X!=='string'||X==='')continue;const Y=getTemplateById(X);if(Y&&declaresTaskBindingSlot(Y['example_table']))B['push'](X);}}B['length']>0x0&&j['push']('refund-replay\x20once-slot\x20—\x20re-enterable\x20refund\x20node(s)\x20on\x20a\x20cycle\x20armed\x20with\x20guard\x20template(s)\x20'+([...new Set(B)]['map'](Z=>'\x27'+Z+'\x27')['join'](',\x20')+'\x20that\x20declare\x20the\x20254\x20task-binding\x20row\x20')+'(first-period\x20release\x20consumes\x20the\x20ONCE_FOR_OBJECT\x20key;\x20every\x20later-period\x20release\x20on\x20the\x20same\x20order\x20'+'aborts\x20E_ONCE_TRIGGERED(16)\x20forever\x20—\x20use\x20the\x20identifier-255\x20period-key\x20design\x20instead)');if(j['length']===0x0)return[];return[{'rule_id':'R-TOPO-03','severity':'high','title':'Machine\x20edge\x20graph\x20breaks\x20reachability\x20—\x20declared\x20semantics\x20can\x20never\x20execute\x20or\x20never\x20end','detail':'Auditing\x20the\x20structured\x20from-edges:\x20'+j['join'](';\x20')+'.\x20Every\x20declared\x20node\x20must\x20be\x20'+'reachable\x20from\x20the\x20entry\x20Pair(s),\x20and\x20every\x20non-terminal\x20node\x20must\x20reach\x20a\x20final/cancelled\x20'+'endpoint\x20—\x20buy\x20escrows\x20ATOMICALLY,\x20so\x20a\x20node\x20from\x20which\x20the\x20world\x20cannot\x20end\x20strands\x20the\x20pool.\x20'+'Machine\x20topology\x20is\x20frozen\x20at\x20publish\x20(IMMUT-001),\x20so\x20these\x20defects\x20are\x20unfixable\x20after\x20the\x20fact;\x20'+'the\x20only\x20remedy\x20is\x20correcting\x20the\x20template\x20BEFORE\x20the\x20Machine\x20is\x20built.\x20Zero-exit\x20leaves\x20are\x20'+'reported\x20by\x20R-DEAD-END\x20(an\x20`optional:\x20true`\x20mark\x20does\x20not\x20rescue\x20them);\x20this\x20finding\x20covers\x20nodes\x20'+'WITH\x20exits\x20whose\x20exits\x20never\x20reach\x20an\x20endpoint,\x20and\x20entry\x20landing\x20nodes\x20whose\x20every\x20exit\x20is\x20'+'buyer-signed\x20(case\x204).','suggestion':'Fix\x20the\x20edge\x20data:\x20give\x20every\x20non-entry\x20node\x20a\x20from-edge\x20chain\x20back\x20to\x20the\x20entry,\x20give\x20every\x20mandatory\x20'+'state\x20at\x20least\x20one\x20forward\x20path\x20into\x20a\x20final/cancelled\x20endpoint,\x20and\x20mark\x20genuinely\x20skippable\x20side\x20'+'actions\x20`optional:\x20true`\x20(which\x20exempts\x20them\x20from\x20THIS\x20audit\x27s\x20mandatory-flow\x20reading\x20only\x20—\x20a\x20'+'zero-exit\x20optional\x20leaf\x20is\x20still\x20an\x20R-DEAD-END\x20lockup).\x20Multiple\x20entry\x20pairs\x20(prev:\x20\x22\x22)\x20ARE\x20'+'chain-legal\x20(E_DUPLICATE_NODE_PREV\x20is\x20per\x20target\x20node)\x20—\x20but\x20an\x20entry\x20landing\x20node\x20must\x20carry\x20at\x20'+'least\x20one\x20NON-buyer\x20exit\x20(operator:\x20\x22merchant\x22\x20/\x20permission_index\x20keeper\x20rail,\x20e.g.\x20an\x20'+'opening-window\x20abandon\x20timeout).'}];}function rewardReachabilityChecks(a){const b=a['experience_compensation_mode']==='reward'||(a['guards']??[])['some'](o=>o['host']==='reward');if(!b)return[];const c=a['machine_shape']??[];if(c['length']===0x0)return[];if(!c['some'](o=>(o['from']??[])['length']>0x0))return[];const d=new Map(),f=[];for(const o of c){for(const p of o['from']??[]){const q=typeof p==='string'?p:p?.['prev'];if(q==='')f['push'](o['name']);else{const s=resolveSegmentToken(a,q);if(!d['has'](s))d['set'](s,[]);d['get'](s)['push'](o['name']);}}}const g=new Set(f),h=[...f];while(h['length']>0x0){const w=h['pop']();for(const x of d['get'](w)??[]){!g['has'](x)&&(g['add'](x),h['push'](x));}}const j=/deliver|complet|receiv|fulfil|finish|compensat|graduat|certif/i,k=c['some'](y=>j['test'](y['name'])&&g['has'](y['name'])),l=[];!k&&l['push']({'rule_id':'R-UNREACHABLE-REWARD','severity':'high','title':'Reward\x20pool\x20emitted\x20with\x20no\x20reachable\x20claim\x20state\x20—\x20funds\x20stuck\x20at\x20birth\x20(F-049)','detail':'The\x20template\x20emits\x20a\x20goodwill\x20Reward\x20(experience_compensation_mode=\x22reward\x22\x20or\x20a\x20reward-host\x20'+'guard)\x20but\x20the\x20machine\x20edge\x20graph\x20offers\x20NO\x20reachable\x20claim-face\x20node\x20(delivery/fulfilment\x20'+'completion\x20or\x20a\x20compensat-class\x20marker)\x20—\x20the\x20pre-funded\x20pool\x20can\x20never\x20be\x20drawn\x20by\x20any\x20order\x20'+'(mtw-mainnet\x20F-049:\x20the\x20money\x20went\x20in,\x20no\x20edge\x20could\x20trigger\x20it\x20out).\x20Machine\x20topology\x20freezes\x20'+'at\x20publish\x20(IMMUT-001),\x20so\x20the\x20pool\x20would\x20strand\x20permanently.','suggestion':'Add\x20a\x20claim-face\x20state\x20to\x20the\x20graph\x20that\x20an\x20order\x20can\x20actually\x20reach\x20(e.g.\x20a\x20compensat-class\x20'+'marker\x20fed\x20by\x20an\x20evidence-gated\x20edge\x20—\x20tpl_forward_late_delivery_gate),\x20or\x20set\x20'+'experience_compensation_mode\x20to\x20\x22none\x22\x20and\x20drop\x20the\x20pool.'});const n=c['some'](y=>{if(!/compensat/i['test'](y['name'])||!g['has'](y['name']))return![];return(y['from']??[])['some'](z=>typeof z!=='string'&&!!z?.['guard_key']);});return k&&!n&&l['push']({'rule_id':'R-UNREACHABLE-REWARD','severity':'medium','title':'Reward\x20claim\x20anchors\x20on\x20bare\x20fulfillment\x20states\x20—\x20no\x20on-chain\x20lateness\x20evidence\x20(disclosure)','detail':'The\x20goodwill\x20pool\x20is\x20claimable\x20from\x20delivery/completion\x20states\x20only;\x20nothing\x20in\x20the\x20machine\x20'+'records\x20WHY\x20an\x20order\x20deserved\x20compensation,\x20so\x20the\x20payout\x20is\x20a\x20trust-based\x20gesture\x20rather\x20'+'than\x20an\x20evidence-gated\x20claim.\x20Disclosed,\x20not\x20blocked\x20—\x20the\x20C-11\x20delivered-anchored\x20claim\x20is\x20a\x20'+'sanctioned\x20design\x20(F-049\x27s\x20cure\x20in\x20the\x20delivery\x20archetype\x20was\x20the\x20compensated\x20marker\x20fed\x20by\x20'+'tpl_forward_late_delivery_gate).','suggestion':'Optionally\x20add\x20a\x20compensat-class\x20marker\x20whose\x20incoming\x20edge\x20carries\x20a\x20late-evidence\x20guard\x20'+'(tpl_forward_late_delivery_gate:\x20delivered-minus-picked_up\x20history\x20delta\x20>=\x20the\x20promised\x20'+'window)\x20so\x20the\x20claim\x20state\x20itself\x20is\x20the\x20on-chain\x20proof.'}),l;}function loyaltyClaimNoLegChecks(a){const b=new RegExp(['\x5cb(?:repeat(?:ed)?|returning)\x5cs+(?:customers?|buyers?|purchas\x5cw+|orders?)\x5cb[^.]{0,60}?\x5cb(?:get|gets|receive|receives|enjoy|enjoys|unlock|unlocks|pay|pays|qualify|qualifies|skip|skips|save|saves)\x5cb','\x5cb(?:discount|deal|price|pricing|rate|rebate)\x5cb[^.]{0,40}?\x5cbfor\x5cb\x5cs+(?:repeat(?:ed)?|returning)\x5cb','\x5cb(?:repeat|returning)[-\x5cs]?(?:customer|buyer)s?\x5cs+(?:discount|price|pricing|rate)\x5cb','\x5cbloyalty\x5cs+(?:discount|price|pricing|rate|tier|eligib\x5cw*)\x5cb']['join']('|'),'i'),c=[a['body']??'',...a['build_notes']??[],...a['trust_mechanisms']??[],...a['differences']??[],a['key_risk']??'']['join']('\x0a');if(!b['test'](c))return[];const d=a['fee_params']['loyalty_min_orders'],e=typeof d==='number'?d>=0x1:typeof d==='string'&&Number(d['replace'](/^[^0-9]*/,''))>=0x1;if(e)return[];return[{'rule_id':'R-LOYALTY-CLAIM-NO-LEG','severity':'medium','title':'History-gated\x20benefit\x20promised\x20with\x20no\x20cross-order\x20leg\x20—\x20disclosure-only\x20claim\x20(U-19a/N-12)','detail':'The\x20prose\x20promises\x20a\x20repeat-customer\x20/\x20history-gated\x20benefit\x20(returning-buyer\x20pricing,\x20membership-level\x20'+'access)\x20but\x20no\x20`loyalty_min_orders`\x20fee_param\x20is\x20armed\x20—\x20the\x20chain\x20cannot\x20enforce\x20the\x20claim,\x20so\x20it\x20is\x20'+'disclosure-only.\x20The\x20expressible\x20form\x20exists:\x20query\x202251\x20(entity_order.entity\x20count,\x20genesis\x20singleton\x20'+'@0xaa8)\x20counts\x20a\x20buyer\x20address\x27s\x20PARTICIPATED\x20orders\x20across\x20all\x20roles\x20and\x20statuses\x20—\x20'+'\x27>=\x20N\x20orders\x20participated\x27,\x20never\x20\x27>=\x20N\x20completed\x27.','suggestion':'Arm\x20the\x20knob:\x20set\x20fee_param\x20loyalty_min_orders\x20to\x20the\x20minimum\x20order\x20count\x20(>=\x201).\x20The\x20compiler\x20mounts\x20'+'the\x202251\x20gate\x20on\x20the\x20buy\x20face\x20automatically\x20(emitLoyaltyGate)\x20and\x20emits\x20the\x20participation-scope\x20'+'disclosure.\x20Keep\x20the\x20prose\x20scope-matched:\x20say\x20\x27orders\x20placed\x27,\x20not\x20\x27orders\x20completed\x27.'}];}function slaPromiseNoLegChecks(a){const b=new RegExp(['\x5cb(?:late|lateness|delay(?:ed|s)?|on[-\x20]time|ontime|punctual\x5cw*|ship[-\x20]by|SLA)\x5cb[^.!?]{0,80}?\x5cb(?:penalt\x5cw+|compensat\x5cw+|refund\x5cw*|reimburse\x5cw+|money[-\x20]back|guarantee\x5cw*)\x5cb','\x5cb(?:penalt\x5cw+|compensat\x5cw+|refund\x5cw*|reimburse\x5cw+|money[-\x20]back|guarantee\x5cw*)\x5cb[^.!?]{0,80}?\x5cb(?:late|lateness|delay(?:ed|s)?|on[-\x20]time|ontime|punctual\x5cw*|ship[-\x20]by|SLA)\x5cb']['join']('|'),'i'),c=/\b(?:off[- ]?chain|disclos\w+|never|no|not|cannot|can'?t|won'?t|isn'?t|aren'?t|without|voluntar\w+|unenforce\w+|advisory|safe harbor|stall(?:ed|s|ing)?|strand\w*|beyond the (?:chain|machine|protocol)|outside the (?:chain|machine))\b/i,d=[a['body']??'',...a['build_notes']??[],...a['trust_mechanisms']??[],...a['differences']??[],a['key_risk']??'']['join']('\x0a')['split'](/(?<=[.!?])\s+/),e=d['find'](h=>b['test'](h)&&!c['test'](h));if(e===undefined)return[];const f=a['fee_params']??{},g=f['sla_compensation_mode']==='proactive_payment'||f['sla_compensation_mode']==='ladder'||Object['keys'](f)['some'](h=>/^cancel_tier_\d+_boundary_hours$/['test'](h))||JSON['stringify'](a['conditional_guards']??[])['includes']('tpl_forward_penalty_payment');if(g)return[];return[{'rule_id':'R-SLA-PROMISE-NO-LEG','severity':'high','title':'Lateness\x20remedy\x20promised\x20with\x20no\x20compensation\x20leg\x20—\x20false-commitment\x20risk\x20(U-01/N-01)','detail':'The\x20prose\x20promises\x20a\x20lateness\x20remedy\x20(\x22'+e['trim']()['slice'](0x0,0x78)+'\x22)\x20but\x20no\x20expressible\x20compensation\x20face\x20is\x20armed\x20—\x20the\x20chain\x20has\x20NO\x20auto-debit\x20primitive\x20'+'(U-01:\x20no\x20function\x20moves\x20another\x20party\x27s\x20Balance),\x20so\x20the\x20promise\x20is\x20a\x20false\x20commitment,\x20not\x20a\x20'+'disclosure.\x20The\x20closest\x20wrong\x20way\x20is\x20exactly\x20this\x20wording:\x20an\x20\x22automatic\x20late\x20fine\x22\x20reads\x20as\x20an\x20automatic\x20'+'fine\x20the\x20chain\x20cannot\x20execute.\x20(U-01\x20chain\x20truth:\x20the\x20only\x20money\x20primitives\x20are\x20voluntary\x20'+'Payments\x20a\x20payer\x20signs\x20—\x20no\x20function\x20moves\x20another\x20party\x27s\x20Balance.)','suggestion':'Arm\x20the\x20face:\x20fee_param\x20sla_compensation_mode\x20=\x20\x22proactive_payment\x22\x20with\x20sla_penalty_amount\x20/\x20'+'sla_deadline_hours\x20/\x20sla_marker_version\x20—\x20the\x20compiler\x20splices\x20the\x20breach->compensated\x20rail\x20'+'(tpl_forward_penalty_payment:\x20order-bound\x20payment\x20proof,\x20255\x20once-slot,\x20settle-after-compensation\x20'+'second\x20inbound\x20edge).\x20For\x20tiered\x20ladders\x20arm\x20the\x20D5\x20cancel_tier_N_*\x20knobs.\x20Keep\x20the\x20prose\x20honest:\x20'+'say\x20\x22late\x20=>\x20we\x20compensate,\x20or\x20settlement\x20stays\x20parked\x22,\x20never\x20\x22automatic\x20fine\x22.'}];}function keeperDutyUnkeyedChecks(a){const b=a['keeper_duty']??[];if(b['length']===0x0)return[];const c=b['filter'](e=>e['duty_kind']!==undefined&&e['detector']!==undefined&&e['anchor']!==undefined&&e['window_param']!==undefined),d=b['length']-c['length'];if(d===0x0)return[];return[{'rule_id':'R-KEEPER-DUTY-UNKEYED','severity':'medium','title':d+'\x20of\x20'+b['length']+'\x20keeper\x20duties\x20are\x20prose-only\x20—\x20scheduleable\x20keying\x20missing\x20(N-05)','detail':d+'\x20keeper_duty\x20row(s)\x20carry\x20no\x20machine\x20keys\x20(duty_kind\x20/\x20detector\x20/\x20anchor\x20/\x20window_param).\x20They\x20render\x20as\x20'+'runbook\x20lines\x20but\x20cannot\x20be\x20scheduled:\x20the\x20chain\x20has\x20no\x20time-triggered\x20execution,\x20and\x20an\x20unkeyed\x20duty\x20is\x20a\x20'+'manual\x20obligation\x20invisible\x20to\x20the\x20keeper\x20detectors.\x20Migration\x20gauge:\x20this\x20template\x27s\x20keyed\x20share\x20is\x20'+(c['length']+'/'+b['length']+'.'),'suggestion':'Add\x20the\x20four\x20machine\x20keys\x20to\x20each\x20duty\x20row:\x20duty_kind\x20(semantic\x20id),\x20detector\x20(payment_unclaimed\x20/\x20'+'progress_actionable\x20/\x20settlement_pending\x20/\x20timeout_intermediate),\x20anchor\x20(the\x20machine\x20node\x20the\x20duty\x20'+'watches),\x20window_param\x20(the\x20fee_params\x20key\x20carrying\x20the\x20window).\x20Compile\x20then\x20emits\x20the\x20row\x20into\x20the\x20'+'plan\x27s\x20keeper_duties\x20receipt\x20and\x20the\x20keeper\x20schedules\x20it.\x20Auto-execution\x20NEVER\x20widens\x20by\x20keying\x20—\x20'+'payment_unclaimed\x20stays\x20the\x20only\x20auto-executable\x20detector.'}];}const SHAPE_COUNT_NODE_FAMILIES=[{'key':'session_count','prefix':'session_','label':'session'},{'key':'term_count','prefix':'semester_','label':'semester'},{'key':'segment_count','prefix':'segment_','label':'segment'}];function resolveSegmentToken(a,b){const c=/^\{([a-z0-9_]+)\.(?:all|last|first|\d+)\}$/['exec'](b);if(!c)return b;const d=(a['machine_shape']??[])['find'](e=>e['segment']?.['id']===c[0x1]);return d?d['name']:b;}function shapeKeyCountChecks(a){const b=a['fee_params']??{},c=a['machine_shape'],d=Array['isArray'](c)?c:c?.['nodes']??[],e=[],f=new Set(d['map'](g=>g['segment'])['filter'](g=>typeof g?.['count_from']==='string')['map'](g=>g['count_from']));for(const g of d){const h=g['segment'];if(h===undefined)continue;const j=g['name'],k=typeof j!=='string'||!j['includes']('{i}'),l=typeof h['count_from']!=='string'||typeof b[h['count_from']]!=='number';if(!k&&!l)continue;e['push']({'rule_id':'R-SEGMENT-PROTOTYPE-INVALID','severity':'critical','title':'segment\x20prototype\x20\x27'+String(h['id']??j)+'\x27\x20cannot\x20be\x20expanded\x20('+(k?'name\x20lacks\x20{i}':'count_from\x20\x27'+String(h['count_from'])+'\x27\x20is\x20not\x20a\x20numeric\x20fee_param')+')','detail':'A\x20machine_shape\x20node\x20with\x20a\x20segment\x20declaration\x20is\x20a\x20BUILD-TIME\x20prototype:\x20the\x20kernel\x27s\x20segment\x20expander\x20replaces\x20it\x20with\x20'+'effective(count_from)\x20concrete\x20instances\x20at\x20compile.\x20The\x20prototype\x20name\x20must\x20contain\x20\x22{i}\x22\x20and\x20count_from\x20must\x20name\x20a\x20'+'numeric\x20fee_param,\x20otherwise\x20compile\x20is\x20BLOCKED\x20(SEGMENT_DECLARATION_INVALID)\x20and\x20no\x20order\x20can\x20advance\x20past\x20it.','suggestion':'Rename\x20the\x20prototype\x20to\x20\x22<prefix>_{i}\x22\x20and\x20point\x20count_from\x20at\x20the\x20declared\x20GENERATION_SHAPE_KEY\x20(session_count\x20/\x20term_count\x20/\x20segment_count).'});}for(const m of SHAPE_COUNT_NODE_FAMILIES){const o=b[m['key']];if(typeof o!=='number')continue;if(f['has'](m['key']))continue;const p=d['filter'](q=>typeof q['name']==='string'&&new RegExp('^'+m['prefix']+'[\x5cw-]+$')['test'](q['name']))['length'];if(p===o)continue;e['push']({'rule_id':'R-SHAPE-COUNT-MISMATCH','severity':'critical','title':m['key']+'\x20declares\x20'+o+'\x20but\x20machine_shape\x20authors\x20'+p+'\x20'+m['label']+'\x20node(s)\x20—\x20first\x20deploy\x20would\x20deliver\x20'+p+'\x20(K3\x20R19)','detail':'The\x20\x22'+m['key']+':\x20'+o+'\x22\x20fee_param\x20is\x20a\x20GENERATION_SHAPE_KEY\x20(authoring-time\x20fact\x20—\x20compile\x20never\x20'+('re-reads\x20it\x20to\x20grow\x20the\x20machine),\x20while\x20machine_shape\x20carries\x20exactly\x20'+p+'\x20node(s)\x20matching\x20')+('\x22'+m['prefix']+'<n>\x22.\x20Every\x20deployment\x20of\x20this\x20template\x20as\x20written\x20would\x20sell\x20'+o+'\x20'+m['label']+'s\x20')+('and\x20deliver\x20'+p+':\x20release\x20rails,\x20refund\x20segments\x20and\x20numeric\x20floor\x20derivations\x20that\x20multiply\x20by\x20')+(m['key']+'\x20all\x20inherit\x20the\x20divergence\x20(live\x20yfd-mn-26108-k7m2:\x20session_count\x2020\x20over\x203\x20nodes,\x20buyer\x20')+'paid\x204\x20sessions,\x20machine\x20could\x20only\x20advance\x203).\x20Shape\x20keys\x20are\x20not\x20live\x20dials\x20—\x20post-publish\x20cure\x20is\x20'+'impossible\x20(Machine\x20nodes\x20immutable,\x20Allocation\x20rows\x20snapshot\x20at\x20buy).','suggestion':'Make\x20the\x20declaration\x20true:\x20either\x20(a)\x20set\x20the\x20fee_param\x20to\x20the\x20authored\x20node\x20count\x20and\x20re-derive\x20every\x20'+'expression\x20that\x20multiplies\x20by\x20it\x20(floors,\x20pools,\x20refund\x20segments),\x20or\x20(b)\x20author\x20the\x20missing\x20'+(m['prefix']+'<n>\x20nodes\x20with\x20their\x20release\x20rails/guards\x20so\x20machine_shape\x20really\x20carries\x20'+o+'.\x20')+'A\x20build-time\x20expander\x20may\x20replace\x20(b)\x20later\x20—\x20this\x20rule\x20then\x20proves\x20its\x20expansion.'});}return e;}function thirdPartyNoRemedyChecks(a){if(a['logistics_mode']!=='courier')return[];const b=a['allocator']?.['rows']??[],c=b['some'](e=>(e['recipient']==='entity'||e['recipient']==='signer')&&e['recipient_key']!==undefined&&e['recipient_key']!=='merchant'),d=b['some'](e=>e['track']==='reward')||Object['keys'](a['fee_params']??{})['some'](e=>/reward/['test'](e));if(c||d)return[];return[{'rule_id':'R-THIRD-PARTY-NO-REMEDY','severity':'critical','title':'Courier\x20fulfilment\x20with\x20no\x20third-party\x20payout\x20rail\x20—\x20a\x20ruling\x20for\x20the\x20runner\x20is\x20unexecutable\x20(U-03/N-03)','detail':'This\x20template\x20models\x20third-party\x20fulfilment\x20(logistics_mode\x20courier)\x20but\x20its\x20allocator\x20carries\x20no\x20'+'non-merchant\x20Entity/Signer\x20leg\x20(platform\x20/\x20third_party\x20named\x20rail)\x20and\x20no\x20Reward\x20pool.\x20'+'the\x20compensation\x20rail\x20pays\x20order.owner\x20ONLY\x20(hard-bound\x20to\x20the\x20order\x20owner)\x20and\x20Allocation\x20rows\x20are\x20'+'append-only\x20after\x20publish\x20—\x20once\x20published,\x20NO\x20on-chain\x20path\x20can\x20pay\x20the\x20fulfilment\x20party,\x20ever.','suggestion':'Pre-set\x20one\x20of\x20two\x20rails\x20before\x20publish:\x20(a)\x20an\x20arbitration-triggered\x20sharing\x20leg\x20with\x20a\x20'+'Recipient::Entity/Signer\x20row\x20named\x20for\x20the\x20fulfilment\x20party\x20(platform\x20/\x20third_party\x20key\x20—\x20those\x20legs\x20'+'are\x20not\x20payment_info.for_object-constrained\x20and\x20can\x20pay\x20a\x20non-owner);\x20or\x20(b)\x20a\x20Reward\x20pool\x20the\x20runner\x20'+'claims\x20directly\x20(claim\x20asserts\x20recipient\x20==\x20tx\x20sender\x20—\x20the\x20only\x20permissionless\x20third-party\x20channel),\x20'+'pinned\x20store_from\x20so\x20one\x20fulfilment\x20pays\x20once.\x20Note:\x20the\x20merchant\x27s\x20OWN\x20Entity\x20leg\x20does\x20not\x20count\x20—\x20'+'it\x20cannot\x20carry\x20the\x20runner\x27s\x20money.'}];}function ladderMonotonicChecks(a){const b=a['fee_params']??{},c=Object['keys'](b)['filter'](l=>/^cancel_tier_\d+_boundary_hours$/['test'](l))['sort']((k,l)=>k['localeCompare'](l));if(c['length']<0x2)return[];const d=[],e=k=>typeof k==='number'?k:undefined,f=c['map'](l=>({'key':l,'tier':Number(l['match'](/\d+/)[0x0]),'v':e(b[l])}));if(f['some'](k=>k['v']===undefined))d['push'](highFinding(a,'R-LADDER-MONOTONIC-01','ladder\x20boundary\x20knob\x20is\x20not\x20a\x20number',c['join'](',')));else for(let k=0x1;k<f['length'];k++){f[k]['v']>=f[k-0x1]['v']&&d['push'](highFinding(a,'R-LADDER-MONOTONIC-01','ladder\x20boundaries\x20not\x20strictly\x20decreasing',f[k]['key']+'\x20('+f[k]['v']+')\x20must\x20be\x20<\x20'+f[k-0x1]['key']+'\x20('+f[k-0x1]['v']+')\x20—\x20tier\x20'+f[k]['tier']+'\x20fires\x20closer\x20to\x20the\x20start\x20than\x20tier\x20'+f[k-0x1]['tier']+',\x20an\x20inverted\x20or\x20flat\x20pair\x20double-charges\x20the\x20overlap'));}const g=Object['keys'](b)['filter'](l=>/^cancel_tier_\d+_charge_bps$/['test'](l))['sort']((l,m)=>l['localeCompare'](m));if(g['length']>=0x2){const l=g['map'](m=>({'key':m,'v':e(b[m])}));if(l['some'](m=>m['v']===undefined))d['push'](highFinding(a,'R-LADDER-MONOTONIC-01','ladder\x20charge\x20knob\x20is\x20not\x20a\x20number',g['join'](',')));else for(let m=0x1;m<l['length'];m++){l[m]['v']<=l[m-0x1]['v']&&d['push'](highFinding(a,'R-LADDER-MONOTONIC-01','ladder\x20charges\x20not\x20strictly\x20increasing',l[m]['key']+'\x20('+l[m]['v']+')\x20must\x20be\x20>\x20'+l[m-0x1]['key']+'\x20('+l[m-0x1]['v']+')\x20—\x20later\x20cancellation\x20must\x20cost\x20more,\x20an\x20inverted\x20charge\x20makes\x20the\x20cheapest\x20band\x20the\x20priciest'));}}const h=(a['allocator']?.['rows']??[])['filter'](n=>typeof n['guard_key']==='string'&&/^cancel_tier_\d+_alloc$/['test'](n['guard_key'])),j=new Map();for(const n of h)j['set'](n['guard_key'],[...j['get'](n['guard_key'])??[],n]);for(const [o,p]of[...j['entries']()]['sort']()){let q=0x0;for(const s of p){if(typeof s['value']==='number')q+=s['value'];else{if(typeof s['value_from']==='string')q+=e(b[s['value_from']])??NaN;else{if(typeof s['value_from_complement']==='string'){const w=e(b[s['value_from_complement']]);q+=w===undefined?NaN:0x2710-w;}else q=NaN;}}}(Number['isNaN'](q)||q!==0x2710)&&d['push'](highFinding(a,'R-LADDER-MONOTONIC-01','tier\x20allocator\x20group\x20does\x20not\x20close\x20at\x2010000',o+':\x20legs\x20sum\x20to\x20'+q+'\x20(literal\x20rates,\x20value_from\x20defaults,\x20and\x20value_from_complement\x20=\x2010000-x)\x20—\x20a\x20stranded\x20remainder\x20or\x20an\x20over-draw'));}return d;}function highFinding(a,b,c,d){return void a,{'rule_id':b,'severity':'high','title':c,'detail':d,'suggestion':'fix\x20the\x20template\x27s\x20ladder\x20defaults\x20—\x20the\x20rails\x20compile\x20either\x20way,\x20so\x20a\x20mis-formed\x20ladder\x20only\x20shows\x20up\x20as\x20mis-charged\x20orders'};}function pairNoSharedRepoChecks(a){if(a['logistics_mode']!=='courier'&&a['logistics_mode']!=='carrier')return[];const b=a['guards']??[],c=b['some'](d=>d['template_id']==='tpl_repository_row_equals_order_field'||/fulfilment order|rendezvous|supply.chain|paired/['test'](d['purpose']??''))||/supply.chain|rendezvous|fulfilment order|procured (courier|delivery|fulfilment)|paired ledger/i['test']([a['body']??'',...a['build_notes']??[],...a['trust_mechanisms']??[],...a['differences']??[],a['key_risk']??'']['join']('\x0a'));if(c)return[];return[{'rule_id':'R-PAIR-NO-SHARED-REPO','severity':'medium','title':'Merchant-procured\x20fulfilment\x20with\x20no\x20cross-order\x20pairing\x20leg\x20—\x20the\x20sub-order\x20link\x20is\x20disclosure-only\x20(N-06)','detail':'logistics_mode\x20\x27'+String(a['logistics_mode'])+'\x27\x20declares\x20the\x20merchant_procured\x20axis\x20(a\x20third\x20party\x20fulfils,\x20P1..P5\x20expected),\x20but\x20no\x20guard\x20reads\x20a\x20'+'foreign\x20fulfilment\x20order\x20and\x20no\x20supply-chain\x20pairing\x20is\x20declared:\x20nothing\x20on\x20chain\x20ties\x20the\x20sub-order\x20'+'to\x20this\x20one,\x20so\x20the\x20composition\x20claim\x20(courier/carrier\x20fulfilment\x20the\x20main\x20order\x27s\x20settlement\x20depends\x20'+'on)\x20cannot\x20be\x20verified\x20by\x20a\x20third\x20party\x20—\x20the\x20fulfilment\x20story\x20settles\x20on\x20prose\x20alone.','suggestion':'Declare\x20the\x20supply-chain\x20promise\x20at\x20build\x20time\x20(P1\x20shared-Repository\x20rendezvous:\x20the\x20ledger\x20is\x20created\x20'+'once,\x20injected\x20into\x20both\x20Services,\x20policies\x20write_once\x20so\x20neither\x20side\x20can\x20re-point\x20the\x20fact\x20—\x20the\x20'+'emitter\x20also\x20arms\x20the\x20N-10\x20removal\x20pins),\x20or\x20disclose\x20that\x20fulfilment\x20is\x20an\x20off-chain\x20arrangement\x20'+'with\x20no\x20on-chain\x20pairing\x20fact.'}];}function demandNoAwardFactChecks(a){const b=/\b(?:winn\w*|award\w*|selected|won)\b[^.]{0,60}?\b(?:start\w*|begin\w*|commenc\w*|kick[\s-]?off|open\w*\s+the\s+order)\b|\b(?:start\w*|begin\w*|commenc\w*)\b[^.]{0,60}?\b(?:award\w*|winn\w+|winner)\b/i,c=[a['body']??'',...a['build_notes']??[],...a['trust_mechanisms']??[],...a['differences']??[],a['key_risk']??'']['join']('\x0a');if(!b['test'](c))return[];const d=(a['guards']??[])['some'](e=>e['template_id']==='tpl_demand_award_gate')||/demand_award|award row|award fact|repository\.data has/['test'](c);if(d)return[];return[{'rule_id':'R-DEMAND-NO-AWARD-FACT','severity':'medium','title':'Award-gated\x20start\x20promised\x20with\x20no\x20award\x20fact\x20in\x20the\x20machine\x20graph\x20—\x20disclosure-only\x20claim\x20(U-11/U-13/N-07)','detail':'The\x20prose\x20promises\x20that\x20the\x20award\x20selection\x20gates\x20starting\x20the\x20resulting\x20order,\x20but\x20no\x20award\x20fact\x20'+'reaches\x20the\x20machine\x20graph:\x20Demand.present\x20only\x20registers\x20a\x20table\x20entry\x20and\x20nothing\x20'+'on\x20chain\x20links\x20the\x20award\x20to\x20the\x20order\x20(composition-truth\x20S8)\x20—\x20the\x20claim\x20is\x20disclosure-only\x20and\x20any\x20'+'presenter\x20can\x20self-start\x20the\x20order.','suggestion':'Bind\x20the\x20award\x20fact:\x20mount\x20tpl_demand_award_gate\x20on\x20the\x20machine\x27s\x20first\x20forward\x20(query\x201166\x20'+'repository.data\x20has\x20over\x20a\x20write-guarded,\x20write_once\x20award\x20policy\x20—\x20the\x20demander\x27s\x20tooling\x20files\x20a\x20'+'row\x20whose\x20ID\x20is\x20the\x20winner\x27s\x20address),\x20and\x20disclose\x20that\x20the\x20Demand->Order\x20linkage\x20is\x20tooling-side\x20'+'(never\x20describe\x20the\x20award\x20as\x20an\x20on-chain\x20contract\x20formation\x20—\x20S8\x20disclosureObligation).'}];}function loopFundChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0||!b['some'](A=>(A['from']??[])['length']>0x0))return[];const c=new Map(),d=[];for(const A of b){for(const B of A['from']??[]){const C=typeof B==='string'?B:B?.['prev'];if(typeof C!=='string'||C==='')continue;if(!c['has'](C))c['set'](C,[]);c['get'](C)['push'](A['name']),d['push']({'prev':C,'target':A['name'],'guardKey':typeof B==='string'?undefined:B?.['guard_key']});}}const f=findLoopCycles(c);if(f['length']===0x0)return[];const h=[],j=a['reentry_kind']&&a['reentry_kind']!=='none'?a['reentry_kind']:undefined,k=f['filter'](D=>classifyLoopCycle(D['cycle'],j)==='remedy');k['length']>0x0&&h['push']({'rule_id':'R-LOOP-FUND','severity':'low','title':'Remedy\x20loop\x20cycle(s)\x20'+k['map'](D=>'['+D['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+'\x20—\x20same-order\x20revisit,\x20no\x20new\x20charge\x20implied','detail':'A\x20revision/review/rework/refund/cancel/claim-family\x20cycle\x20re-enters\x20work\x20states\x20WITHIN\x20one\x20paid\x20order,\x20so\x20it\x20needs\x20'+'no\x20fund\x20gate\x20while\x20the\x20revisit\x20is\x20free\x20(crs\x20P2-3\x20visibility).\x20If\x20the\x20business\x20EVER\x20intends\x20a\x20revisit\x20'+'to\x20cost\x20money,\x20that\x20fee\x20IS\x20enforceable\x20via\x20the\x20allocation.balance\x20Guard\x20query\x20(1051,\x20witness\x20'+'OrderAllocation\x20109)\x20—\x20but\x20that\x20reshapes\x20the\x20cycle\x20into\x20the\x20charge\x20tier\x20below.','suggestion':'Keep\x20remedy\x20loops\x20single-charge\x20(one\x20paid\x20order,\x20revisions\x20included)\x20—\x20or,\x20if\x20each\x20revisit\x20'+'must\x20be\x20paid,\x20declare\x20the\x20guard-layer\x20fund\x20gate\x20convention\x20(see\x20the\x20charge\x20tier)\x20or\x20replace\x20the\x20loop\x20'+'with\x20per-period\x20NEW\x20Orders\x20(REUSE\x20pattern\x20—\x20a\x20fresh\x20order\x20per\x20period\x20instead\x20of\x20an\x20in-order\x20loop\x20that\x20replays\x20its\x20forwards\x20every\x20lap).'});const l=templateText(a),n=/order_renew/i['test'](l)&&/atomic|re-fund/i['test'](l),o=f['filter'](D=>classifyLoopCycle(D['cycle'],j)==='renewal'),p=new Map();for(const D of a['guards']??[]){typeof D?.['key']==='string'&&typeof D?.['template_id']==='string'&&!p['has'](D['key'])&&p['set'](D['key'],D['template_id']);}const q=(E,F)=>{const G=d['filter'](H=>H['prev']===E&&H['target']===F);return G['length']>0x0&&G['every'](H=>isRenewalFundingDesign(H['guardKey']===undefined?undefined:p['get'](H['guardKey'])));},s=E=>{for(let F=0x0;F<E['cycle']['length'];F++){const G=E['cycle'][F],H=E['cycle'][(F+0x1)%E['cycle']['length']];if(isRenewalLoopEdge(G,H)&&!q(G,H))return![];}return!![];},w=o['filter'](E=>!n&&!s(E)),x=f['filter'](E=>classifyLoopCycle(E['cycle'],j)==='charge'),y=[...x,...w];if(y['length']===0x0)return h;const z=x['length']===0x0?'the\x20atomic\x20order_renew\x20funding\x20convention\x20is\x20not\x20declared\x20in\x20the\x20template\x20prose':w['length']===0x0?'a\x20cycle\x20implies\x20a\x20per-revisit\x20charge\x20(retake\x20/\x20session-card\x20shape)\x20whose\x20fund\x20gate\x20is\x20not\x20declared\x20in\x20the\x20template\x20prose':'a\x20cycle\x20implies\x20a\x20per-revisit\x20charge\x20with\x20no\x20declared\x20fund\x20gate,\x20AND\x20the\x20renewal-shaped\x20cycles\x20lack\x20the\x20declared\x20order_renew\x20convention';return h['push']({'rule_id':'R-LOOP-FUND','severity':'critical','title':'Loop\x20cycle(s)\x20'+y['map'](E=>'['+E['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+'\x20—\x20revisit\x20funding\x20is\x20not\x20declared\x20at\x20the\x20template\x20layer','detail':'A\x20cycle\x20lets\x20an\x20order\x20revisit\x20nodes,\x20and\x20the\x20contract\x20never\x20verifies\x20that\x20a\x20revisit\x20re-funds\x20the\x20'+'Allocation\x20—\x20every\x20charge-bearing\x20loop\x20forward\x20MUST\x20carry\x20the\x20new-period\x20payment\x20atomically\x20or\x20the\x20loop\x20allows\x20'+'zero-value\x20re-delivery\x20cycles\x20(test/11\x20R2-F3,\x20crs\x20P2-3).\x20The\x20allocation.balance\x20Guard\x20query\x20(1051,\x20witness\x20'+'OrderAllocation\x20109)\x20makes\x20the\x20fee\x20enforceable\x20at\x20the\x20guard\x20layer,\x20but\x20this\x20template\x20does\x20not\x20DECLARE\x20that\x20'+('convention,\x20and\x20here\x20'+z+'.'),'suggestion':(w['length']>0x0?'For\x20the\x20renewal-shaped\x20cycle(s)\x20'+w['map'](E=>'['+E['cycle']['join']('\x20->\x20')+']')['join'](',\x20')+':\x20declare\x20the\x20'+'order_renew\x20re-fund\x20convention\x20in\x20build_notes\x20—\x20\x27use\x20the\x20order\x20call\x27s\x20`order_renew`\x20field:\x20ONE\x20PTB\x20pays\x20'+'the\x20period\x20amount\x20into\x20the\x20Allocation\x20and\x20advances\x20the\x20renew\x20forward\x20(fund\x20+\x20record\x20+\x20'+'advance,\x20no\x20unfunded-advance\x20window);\x20NEVER\x20bind\x20an\x20allocation.balance\x20gate\x20on\x20this\x20forward\x20—\x20guards\x20read\x20the\x20COMMITTED\x20pre-transaction\x20balance,\x20so\x20the\x20same-PTB\x20payment\x20is\x20invisible\x20to\x20them\x20(esound-mn-261021\x20B-1;\x20HIS-35\x202026-11-09\x20re-verification\x20kept\x20the\x20doctrine)\x27.\x20'+'Or\x20(D-N2,\x20machine-checkable\x20—\x20no\x20prose\x20needed)\x20bind\x20tpl_forward_renewal_payment_witness\x20on\x20the\x20renew\x20forward:\x20a\x20per-step\x20Payment\x20receipt\x20(info.for\x20==\x20order\x20+\x20info.index\x20==\x20progress.history\x20count\x20+\x20info.remark\x20==\x20progress.current,\x20no\x20protocol-255\x20slot)\x20with\x20the\x20committed-balance\x20leg\x20as\x20the\x20anti-forgery\x20half,\x20executed\x20via\x20the\x20two-transaction\x20recipe:\x20'+RENEWAL_WITNESS_RECIPE+'\x20':'')+'For\x20charge-bearing\x20cycles\x20that\x20are\x20not\x20renewal-shaped,\x20declare\x20the\x20guard-layer\x20fund\x20gate\x20in\x20build_notes\x20—\x20'+'\x27the\x20revisit\x20forward\x20carries\x20a\x20Guard:\x20constant\x20=\x20order\x20address,\x20convert_witness\x20OrderAllocation(109),\x20'+'allocation.balance\x20(query\x201051)\x20>=\x20revisit\x20fee\x27\x20—\x20or\x20replace\x20the\x20loop\x20'+'with\x20per-period\x20NEW\x20Orders\x20(REUSE\x20pattern\x20—\x20a\x20fresh\x20order\x20per\x20period)\x20or\x20remove\x20the\x20back-edge\x20—\x20rework\x20the\x20business\x20'+'flow\x20so\x20re-entry\x20is\x20a\x20fresh\x20order,\x20not\x20a\x20node\x20revisit.'}),h;}function deadEndLockChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0||!b['some'](k=>(k['from']??[])['length']>0x0))return[];const c=new Map(),d=[];for(const k of b){for(const l of k['from']??[]){const n=typeof l==='string'?l:l?.['prev'];if(n==='')d['push'](k['name']);else{const o=resolveSegmentToken(a,n);if(!c['has'](o))c['set'](o,[]);c['get'](o)['push'](k['name']);}}}const f=new Set(d),g=[...d];while(g['length']>0x0){const p=g['pop']();for(const q of c['get'](p)??[]){!f['has'](q)&&(f['add'](q),g['push'](q));}}const h=s=>/pool is empty|pool drains?ed|drains? in full|already (?:released|paid)|escrow (?:is )?(?:empty|drained)/i['test'](s),j=b['filter'](s=>s['semantic_role']!=='final'&&s['semantic_role']!=='cancelled')['filter'](s=>f['has'](s['name'])&&(c['get'](s['name'])??[])['length']===0x0)['filter'](s=>!h(s['role']))['map'](s=>'\x27'+s['name']+'\x27\x20('+(s['semantic_role']??'no\x20semantic_role')+(s['optional']===!![]?',\x20optional':'')+')');if(j['length']===0x0)return[];return[{'rule_id':'R-DEAD-END','severity':'high','title':'Dead-end\x20node(s)\x20'+j['join'](',\x20')+'\x20—\x20taking\x20the\x20forward\x20locks\x20the\x20order\x20and\x20its\x20escrow\x20forever','detail':'A\x20reachable\x20node\x20with\x20no\x20outgoing\x20forward\x20strands\x20the\x20order\x20the\x20moment\x20someone\x20advances\x20into\x20it:\x20'+'Machine\x20topology\x20freezes\x20at\x20publish,\x20so\x20there\x20is\x20no\x20later\x20repair,\x20and\x20`optional:\x20true`\x20does\x20NOT\x20help\x20—\x20'+'the\x20buyer\x20can\x20still\x20take\x20the\x20optional\x20forward,\x20and\x20the\x20order\x20then\x20stands\x20at\x20a\x20node\x20from\x20which\x20no\x20Pair\x20'+'exists\x20(Etsy\x20mainnet\x20ets1_o2\x20stopped\x20exactly\x20there:\x20delivered\x20→\x20reviewed,\x20history\x20ends,\x20no\x20rail\x20can\x20'+'ever\x20anchor\x20that\x20state\x20again).\x20Buy\x20escrows\x20ATOMICALLY,\x20so\x20the\x20full\x20pool\x20rides\x20into\x20the\x20dead\x20end\x20'+'unless\x20a\x20rail\x20drained\x20it\x20upstream.\x20This\x20is\x20the\x20defect\x20class\x20the\x20old\x20optional-leaf\x20exemption\x20in\x20'+'R-TOPO-03\x20let\x20ship\x20into\x20two\x20builtin\x20templates.','suggestion':'Wire\x20an\x20exit\x20edge\x20back\x20into\x20the\x20live\x20flow\x20(review\x20re-joins\x20the\x20settlement\x20rail,\x20e.g.\x20reviewed\x20'+'─settle→\x20completed)\x20or\x20remove\x20the\x20node\x20from\x20machine_shape\x20and\x20keep\x20the\x20action\x20off-Machine\x20'+'(Repository\x20/\x20Reward).\x20If\x20the\x20node\x20is\x20genuinely\x20a\x20record\x20state\x20whose\x20pool\x20already\x20drained\x20upstream,\x20'+'say\x20so\x20in\x20its\x20role\x20(\x27pool\x20is\x20empty\x27)\x20so\x20this\x20rule\x20and\x20TERMINAL-NO-RAIL\x20exempt\x20it.'}];}const EXCEPTION_NODE_REGEX=/exception|damaged|disputed|denied|broken/i,ALLOCATOR_GATE_TEMPLATE_REGEX=/allocator_node_gate|progress_state_check/;function exceptionExitChecks(a){const b=a['machine_shape'],c=b['filter'](j=>EXCEPTION_NODE_REGEX['test'](j['name']));if(c['length']===0x0)return[];const d=new Set(b['map'](j=>j['name'])),e=new Map();for(const j of a['guards']){if(j['host']!=='machine'||!ALLOCATOR_GATE_TEMPLATE_REGEX['test'](j['template_id']))continue;for(const k of Object['values'](j['params']??{})){if(typeof k==='string'&&d['has'](k)){if(!e['has'](k))e['set'](k,new Set());if(j['key']!==undefined)e['get'](k)['add'](j['key']);}}}const f=new Set((a['allocator']['rows']??[])['filter'](l=>l['track']==='refund')['map'](l=>l['guard_key'])['filter'](l=>typeof l==='string'&&l['length']>0x0)),h=[];for(const l of c){const m=[...e['get'](l['name'])??[]];if(m['length']===0x0)continue;if(m['some'](o=>f['has'](o)))continue;h['push']({'rule_id':'R-EXCEPTION-EXIT','severity':'high','title':'Exception\x20node\x20\x27'+l['name']+'\x27\x20carries\x20money\x20but\x20has\x20NO\x20buyer-ward\x20(refund)\x20exit\x20—\x20the\x20escrow\x20principal\x20is\x20merchant-ward\x20only','detail':'A\x20machine-host\x20allocator\x20rail\x20fires\x20while\x20the\x20order\x20rests\x20at\x20\x27'+l['name']+'\x27\x20(guarded\x20by\x20'+m['join'](',\x20')+'),\x20'+'and\x20none\x20of\x20the\x20rows\x20on\x20those\x20rails\x20is\x20a\x20refund\x20track.\x20The\x20exception\x20entry\x20is\x20typically\x20a\x20one-way\x20door\x20'+'past\x20the\x20return-request\x20edges,\x20so\x20after\x20reporting\x20the\x20problem\x20the\x20buyer\x20can\x20neither\x20return\x20(the\x20return\x20'+'rail\x20is\x20topologically\x20gone)\x20nor\x20claw\x20back\x20the\x20principal\x20(no\x20refund\x20rail\x20fires\x20here)\x20—\x20the\x20merchant-ward\x20'+'rail\x20is\x20the\x20ONLY\x20money\x20exit\x20(ksk4\x20live\x20o10:\x2050M\x20escrow,\x2010M\x20indemnity\x20to\x20the\x20buyer,\x20the\x2050M\x20principal\x20'+'swept\x20to\x20the\x20merchant).\x20Machine\x20+\x20Allocator\x20freeze\x20at\x20publish\x20(IMMUT-001)\x20—\x20there\x20is\x20no\x20later\x20repair.','suggestion':'Give\x20\x27'+l['name']+'\x27\x20the\x20refund/recover\x20DUAL\x20exit:\x20(a)\x20a\x20track\x20\x22refund\x22\x20allocator\x20row\x20(order-anchored\x20'+('GuardIdentifier(0)\x20recipient)\x20gated\x20by\x20tpl_allocator_node_gate_refund\x20over\x20\x27'+l['name']+'\x27\x20(node-gated\x20')+'fund\x20rail,\x20decision\x2011)\x20—\x20the\x20buyer\x20recovers\x20the\x20principal\x20at\x20the\x20refund\x20terminal;\x20'+'(b)\x20a\x20merchant-recovery\x20row\x20gated\x20by\x20tpl_allocator_node_gate_recover\x20(terminal-node-gated\x20sweep)\x20so\x20'+'the\x20principal\x20still\x20exits\x20after\x20a\x20merchant-favored\x20ruling.\x20NEVER\x20add\x20a\x20claimed_by\x20leg\x20to\x20either\x20'+'fund\x20rail\x20(R-FUND-RAIL-CLAIMED-BY\x20critical);\x20an\x20award\x20never\x20silences\x20a\x20due\x20refund\x20—\x20overlap\x20is\x20legal\x20'+'and\x20disclosed\x20at\x20the\x20dual-payout\x20gate.\x20Keep\x20each\x20allocator\x27s\x20Rate\x20sum\x20at\x20exactly\x2010000,\x20'+'and\x20keep\x20the\x20return\x20rail\x20reachable:\x20either\x20enter\x20the\x20exception\x20node\x20from\x20a\x20state\x20that\x20retains\x20its\x20'+'return\x20exits,\x20or\x20mount\x20the\x20refund\x20rail\x20directly\x20on\x20the\x20exception\x20node\x20as\x20above.'});}return h;}const RULING_TEMPLATES=new Set(['tpl_forward_arb_ruling_won','tpl_forward_arb_ruling_dismissed']);function arbZeroExitChecks(a){const b=new Set(a['guards']['filter'](h=>RULING_TEMPLATES['has'](h['template_id'])&&h['host']==='machine'&&typeof h['key']==='string')['map'](h=>h['key']));if(b['size']===0x0)return[];const c=new Map(a['machine_shape']['map'](g=>[g['name'],g['semantic_role']])),d=new Map();for(const g of a['machine_shape']){for(const h of g['from']??[]){if(typeof h==='string'){if(h['length']===0x0)continue;if(!d['has'](h))d['set'](h,[]);d['get'](h)['push']({'forward':h+'_to_'+g['name'],'guardKey':undefined});continue;}if(typeof h!=='object'||h===null)continue;const j=h;if(typeof j['prev']!=='string'||j['prev']['length']===0x0)continue;const k=typeof j['forward']==='string'&&j['forward']['length']>0x0?j['forward']:j['prev']+'_to_'+g['name'];if(!d['has'](j['prev']))d['set'](j['prev'],[]);d['get'](j['prev'])['push']({'forward':k,'guardKey':typeof j['guard_key']==='string'?j['guard_key']:undefined});}}const f=[];for(const [l,m]of d){const o=c['get'](l);if(o==='final'||o==='cancelled')continue;if(!m['some'](w=>w['guardKey']!==undefined&&b['has'](w['guardKey'])))continue;const p=m['find'](w=>w['guardKey']===undefined||!b['has'](w['guardKey']));if(p!==undefined)continue;const q=m['some'](w=>w['guardKey']!==undefined&&a['guards']['some'](x=>x['template_id']==='tpl_forward_arb_ruling_dismissed'&&x['host']==='machine'&&x['key']===w['guardKey'])),s=q?'a\x20case\x20that\x20NEVER\x20rules\x20(withdrawn\x20via\x20arb_withdraw,\x20reset,\x20or\x20abandoned\x20—\x20both\x20ruling\x20roots\x20fail-closed\x20on\x20the\x20None\x20indemnity)':'a\x20merchant-favor\x20(zero-award)\x20ruling\x20AND\x20any\x20case\x20that\x20never\x20rules';f['push']({'rule_id':'R-ARB-ZERO-EXIT','severity':'medium','title':'Dispute\x20waypoint\x20\x27'+l+'\x27\x20has\x20ONLY\x20ruling-keyed\x20exits\x20—\x20'+s+'\x20strands\x20the\x20order\x20with\x20no\x20edge\x20at\x20all','detail':'Every\x20exit\x20from\x20\x27'+l+'\x27\x20is\x20guarded\x20by\x20an\x20arbitration-ruling\x20template\x20('+m['filter'](w=>w['guardKey']!==undefined&&b['has'](w['guardKey']))['map'](w=>w['guardKey'])['join'](',\x20')+'),\x20and\x20the\x20dismissed\x20root\x20errors\x20on\x20the\x20None\x20indemnity\x20field\x20(fail-closed).\x20'+('Under\x20'+s+',\x20NOTHING\x20fires:\x20the\x20order\x20rests\x20at\x20\x27'+l+'\x27\x20permanently\x20—\x20Machine\x20+\x20Allocator\x20')+'freeze\x20at\x20publish\x20(IMMUT-001)\x20and\x20there\x20is\x20no\x20later\x20repair\x20(ddmc4\x20B-29\x20zero-payout\x20deadlock\x20family).','suggestion':'Route\x20the\x20never-ruling\x20case\x20to\x20a\x20ruling\x20instead\x20of\x20stranding\x20it\x20—\x20a\x20filed\x20claim\x20CANNOT\x20be\x20'+'withdrawn\x20(D2\x20no-withdraw\x20doctrine,\x202026-11-10;\x20the\x20former\x20WithdrawClaim\x20void\x20escape\x20is\x20BANNED,\x20'+'DISPUTE-WITHDRAW-BANNED\x20at\x20the\x20publish\x20gate).\x20Sanctioned\x20cures:\x20a\x20ForceSettleExpired\x20clock\x20edge\x20'+'that\x20routes\x20buyer-ward\x20(refund\x20to\x20the\x20payer)\x20into\x20the\x20cancelled\x20terminal,\x20or\x20keep\x20ONLY\x20the\x20ruling\x20'+'exits\x20and\x20drive\x20the\x20venue\x20case\x20to\x20a\x20stamped\x20ruling\x20(conclude/compensate).\x20Decision\x2011\x20KEEP\x20face\x20'+'stands:\x20never\x20add\x20a\x20claimed_by\x20leg\x20to\x20the\x20fund\x20rail\x20itself,\x20R-FUND-RAIL-CLAIMED-BY.'});}return f;}function evidenceMarkerEchoChecks(a){const b=[];for(const c of a['guards']){if(c['template_id']!=='tpl_repository_row_present'||c['host']!=='machine'||c['key']===undefined)continue;const d=c['params']?.['evidence_marker'];if(typeof d!=='string'||d['length']===0x0)continue;const f=new Set();for(const k of a['machine_shape']){for(const l of k['from']??[]){if(typeof l!=='object'||l===null)continue;const m=l;m['guard_key']===c['key']&&typeof m['forward']==='string'&&m['forward']['length']>0x0&&f['add'](m['forward']);}}if(f['size']===0x0)continue;const h=[...f]['some'](o=>{const p=o['toLowerCase'](),q=d['toLowerCase']();return p['includes'](q)||q['includes'](p);});if(h)continue;const j=[...f]['map'](o=>'\x27'+o+'\x27')['join'](',\x20');b['push']({'rule_id':'R-EVIDENCE-MARKER-ECHO','severity':'medium','title':'Evidence\x20marker\x20\x27'+d+'\x27\x20(guard\x20\x27'+c['key']+'\x27)\x20is\x20not\x20derivable\x20from\x20its\x20mounting\x20forward\x20name(s)\x20'+j,'detail':'The\x20guard\x20requires\x20a\x20repository\x20row\x20whose\x20value\x20contains\x20the\x20constant\x20\x27'+d+'\x27,\x20but\x20the\x20write-time\x20'+('failure\x20surfaces\x20no\x20expected\x20value\x20and\x20the\x20mounting\x20forward\x20name(s)\x20'+j+'\x20share\x20no\x20substring\x20')+'with\x20it\x20—\x20a\x20builder\x20writing\x20the\x20evidence\x20row\x20can\x20only\x20discover\x20the\x20marker\x20by\x20reading\x20the\x20plan\x27s\x20raw\x20'+'value\x20bytes\x20(dmcx\x20live:\x20the\x20builder\x20wrote\x20\x27CompensateBadItem\x27,\x20the\x20guard\x20wanted\x20\x27BadItemCompensation\x27,\x20'+'the\x20forward\x20died\x20off-chain\x20with\x20a\x20bare\x20\x22guard\x20not\x20passed\x22).','suggestion':'Rename\x20the\x20mount\x27s\x20evidence_marker\x20to\x20its\x20forward\x20name\x20(catalog\x20convention:\x20marker\x20==\x20forward,\x20e.g.\x20'+('evidence_marker\x20\x27'+[...f][0x0]+'\x27\x20for\x20guard\x20\x27'+c['key']+'\x27),\x20or\x20at\x20minimum\x20echo\x20the\x20expected\x20marker\x20')+'verbatim\x20in\x20every\x20build/plan\x20surface\x20that\x20names\x20this\x20guard\x20—\x20never\x20let\x20the\x20row-value\x20tag\x20be\x20a\x20'+'free-standing\x20constant\x20with\x20no\x20derivation\x20from\x20the\x20mount.'});}return b;}function reviewNoRaceChecks(a){const b=a['machine_shape'];if(b['length']===0x0)return[];const c=[],d=k=>/review(ed|ing)?\b/i['test'](k)&&!/un|no |not |without |expire/i['test'](k),f=k=>/unreviewed|no[_ -]?review|not[_ -]?reviewed|without[_ -]?review|review[^.;]{0,40}expire|expire[^.;]{0,40}review|review[_ -]?timeout|auto[_ -]?accept[^.;]{0,30}review/i['test'](k),g=k=>/\b(accept(ed|ance)?|approv(ed|e|al)|place(ment|d)?|rul(ed|ing)|valid(ated)?|award(ed)?|winner)\b/i['test'](k)&&!/timeout|expire|auto[_ -]?accept|un|no |not |without |reject|denied|dismiss/i['test'](k),h=k=>/accept(ance)?[_ -]?timeout|auto[_ -]?accept|judge[_ -]?timeout|ruling[_ -]?timeout|decision[_ -]?timeout|placement[_ -]?timeout|accept[^.;]{0,30}expire|expire[^.;]{0,30}accept|appeal[^.;]{0,20}expire/i['test'](k),j=new Map();for(const k of b){const l=new Set();for(const m of k['from']??[]){const o=typeof m==='string'?{'prev':m}:m;if(!o['prev']||l['has'](o['prev']))continue;l['add'](o['prev']);const p=j['get'](o['prev'])??[];p['push']({'name':k['name'],'role':k['role']??''}),j['set'](o['prev'],p);}}for(const [q,s]of j){const w=s['find'](C=>d(C['name']+'\x20'+C['role'])),x=s['find'](C=>C['name']!==w?.['name']&&(f(C['name'])||/(expire|timeout|deadline|window|clock|after|day|hour|auto)/i['test'](C['role'])&&f(C['name']+'\x20'+C['role']))),y=s['find'](C=>g(C['name']+'\x20'+C['role'])),z=s['find'](C=>C['name']!==y?.['name']&&h(C['name']+'\x20'+C['role'])),A=w??y,B=w!==undefined&&x!==undefined?x:y!==undefined&&z!==undefined?z:undefined;if(A===undefined||B===undefined)continue;c['push']({'rule_id':'R-REVIEW-NORACE','severity':'high','title':'Node\x20\x27'+q+'\x27\x20fans\x20out\x20\x27'+A['name']+'\x27\x20and\x20its\x20complement\x20\x27'+B['name']+'\x27\x20as\x20SIBLING\x20outgoing\x20edges\x20—\x20complementary\x20conditions\x20race\x20(F-REVIEW-BLOCK)','detail':'Sibling\x20forwards\x20on\x20one\x20NodePair\x20have\x20no\x20on-chain\x20mutual\x20exclusion.\x20Reviewed/unreviewed\x20(or\x20accepted/acceptance-timeout)\x20'+'as\x20parallel\x20edges\x20race\x20on\x20their\x20time\x20conditions:\x20in\x20an\x20overlap\x20BOTH\x20fire\x20(double\x20movement),\x20in\x20a\x20gap\x20NEITHER\x20fires\x20—\x20and\x20with\x20'+'topology\x20frozen\x20at\x20publish\x20the\x20neither-gap\x20is\x20a\x20permanent\x20deadlock\x20that\x20no\x20later\x20repair\x20can\x20close.','suggestion':'Fold\x20the\x20complement\x20into\x20ONE\x20release\x20guard\x20as\x20a\x20logic_or\x20time\x20variant\x20(\x27reviewed\x20OR\x20unreviewed\x20after\x20T\x27\x20/\x20\x27accepted\x20OR\x20'+'auto-accept\x20after\x20T\x27)\x20on\x20a\x20single\x20edge\x20—\x20REVIEW-GATED\x20RELEASE\x20in\x20guard-design-patterns\x20—\x20or\x20give\x20each\x20sibling\x20its\x20own\x20NodePair\x20'+'so\x20the\x20choice\x20is\x20a\x20build-time\x20topology\x20decision,\x20not\x20a\x20runtime\x20race.'});}return c;}export function afterSalesRailRegex(a){return a==='return'?/return|refund/i:a==='exchange'?/exchange|replace|reship|swap/i:/warranty|repair|claim/i;}export function afterSalesRailNodeMatches(a,b){if(!afterSalesRailRegex(a)['test'](b))return![];return!/missed|withdraw|pre_deadline|goal/i['test'](b);}function afterSalesRailChecks(a){const b=a['after_sales_mode'];if(b===undefined||b==='none')return[];const c=a['machine_shape'],d=afterSalesRailRegex(b);if(c['some'](e=>afterSalesRailNodeMatches(b,e['name'])))return[];return[{'rule_id':'R-AFTER-SALES-RAIL','severity':'high','title':'after_sales_mode\x20\x27'+b+'\x27\x20declares\x20a\x20buyer\x20remedy\x20but\x20machine_shape\x20has\x20no\x20backing\x20rail\x20(no\x20node\x20matching\x20'+d+')','detail':'A\x20declared\x20after-sales\x20capability\x20the\x20topology\x20cannot\x20walk\x20is\x20a\x20false\x20promise\x20at\x20quote\x20time.\x20compile\x20hard-blocks\x20'+'this\x20(AFTER_SALES_RAIL_MISSING);\x20the\x20scanner\x20surfaces\x20it\x20at\x20authoring\x20time.\x20The\x20money-safety\x20invariants\x20'+'(node-gated\x20fund\x20rail\x20with\x20NO\x20claimed_by\x20leg\x20(decision\x2011),\x20delivered-entry\x20window\x20anchor,\x20dual-payout\x20'+'disclosure)\x20are\x20separate\x20generic\x20rules\x20and\x20are\x20NOT\x20re-checked\x20here.','suggestion':'Add\x20the\x20\x27'+b+'\x27\x20node\x20family\x20(e.g.\x20return_requested\x20->\x20returned\x20for\x20\x27return\x27)\x20as\x20a\x20node-gated\x20fund\x20rail\x20'+'(decision\x2011:\x20NEVER\x20a\x20claimed_by\x20polarity\x20leg\x20—\x20R-FUND-RAIL-CLAIMED-BY\x20critical)\x20anchored\x20on\x20the\x20delivered\x20'+'ENTRY\x20time\x20(INV-C2);\x20refund\x20and\x20award\x20are\x20independent\x20tracks\x20and\x20any\x20overlap\x20is\x20disclosed\x20at\x20the\x20'+'dual-payout\x20gate\x20(DUAL-RAIL-01)\x20—\x20or\x20set\x20after_sales_mode\x20\x27none\x27.'}];}function acceptanceModeChecks(a){const b=a['acceptance_mode'];if(b===undefined||b==='none')return[];const c=[],d=b==='contest'||b==='bounty'||b==='agent';d&&a['arbitration_mode']!=='third_party'&&c['push']({'rule_id':'R-ACCEPTANCE-JUDGE','severity':'high','title':'acceptance_mode\x20\x27'+b+'\x27\x20is\x20judge-decided\x20but\x20arbitration_mode\x20is\x20\x27'+(a['arbitration_mode']??'none')+'\x27,\x20not\x20\x27third_party\x27\x20(INV-A3)','detail':'A\x20judge-decided\x20acceptance\x20(contest\x20ranking\x20/\x20bounty\x20triage\x20/\x20agent\x20evaluator)\x20lets\x20a\x20third\x20party\x20rule\x20on\x20whether\x20the\x20'+'escrow\x20releases.\x20If\x20that\x20decider\x20is\x20not\x20independent\x20of\x20the\x20party\x20owing\x20the\x20payout,\x20the\x20merchant\x20self-adjudicates\x20its\x20own\x20'+'obligation.\x20compile\x20hard-blocks\x20this\x20(ACCEPTANCE_JUDGE_NOT_INDEPENDENT);\x20the\x20scanner\x20surfaces\x20it\x20at\x20authoring\x20time.\x20The\x20'+'publish-gate\x20controller-disjointness\x20half\x20is\x20checkArbitrationNeutrality,\x20which\x20already\x20gates\x20every\x20build.','suggestion':'Set\x20arbitration_mode\x20\x27third_party\x27\x20so\x20an\x20independent\x20venue/judge\x20Permission\x20rules\x20(R2),\x20or\x20use\x20acceptance_mode\x20\x27milestone\x27\x20'+'if\x20the\x20buyer\x20genuinely\x20self-adjudicates\x20the\x20delivery.'});const e=a['fee_params']?.['revision_rounds_max'],f=typeof e==='number'||typeof e==='string'&&e['trim']()!==''&&/^\d+$/['test'](e['trim']());if(f){const g=(a['guards']??[])['some'](h=>h['host']==='repository'||/repository/i['test'](h['template_id']??''));!g&&c['push']({'rule_id':'R-ACCEPTANCE-REVISION','severity':'high','title':'acceptance_mode\x20\x27'+b+'\x27\x20declares\x20a\x20finite\x20revision\x20cap\x20(revision_rounds_max\x20=\x20'+String(e)+')\x20with\x20no\x20counter-backed\x20Repository\x20guard\x20(INV-A1)','detail':'the\x20chain\x20caps\x20EDGE\x20count\x20(MAX_FORWARD\x20/\x20MAX_NODE_PAIR),\x20never\x20VISIT\x20count,\x20so\x20a\x20revision\x20loop\x20can\x20be\x20re-entered\x20any\x20'+'number\x20of\x20times.\x20A\x20finite\x20revision_rounds_max\x20written\x20in\x20fee_params\x20alone\x20is\x20a\x20promise\x20the\x20chain\x20cannot\x20keep\x20—\x20compile\x20'+'hard-blocks\x20it\x20(ACCEPTANCE_REVISION_UNBOUNDED).\x20This\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Declare\x20revision_rounds_max\x20\x27unlimited\x27\x20(the\x20honest\x20form\x20—\x20the\x20loop\x20is\x20then\x20genuinely\x20unbounded),\x20or\x20mount\x20a\x20counter-backed\x20'+'Repository\x20guard\x20(pattern.repository_data_check\x20reading\x20a\x20per-order\x20revision\x20tally\x20written\x20via\x20'+'pattern.repository_write_authorization)\x20that\x20gates\x20redelivery\x20once\x20the\x20tally\x20reaches\x20the\x20cap.'});}return c;}function revisionLoopChecks(a){const b=a['machine_shape']??[],c=new Set(b['map'](h=>h['name'])),d=b['some'](h=>(h['from']??[])['some'](j=>{if(typeof j==='string')return![];return/needs_info|info_requested|revision/i['test'](j['prev']??'')&&c['has'](j['prev']??'')&&/provide|resubmit|revis|redeliver/i['test'](j['forward']??'');}));if(!d)return[];const e=a['fee_params']?.['revision_rounds_max'],f=typeof e==='number'||typeof e==='string'&&e['trim']()!==''&&/^\d+$/['test'](e['trim']());if(!f)return[];const g=(a['guards']??[])['some'](h=>h['host']==='repository'||/repository/i['test'](h['template_id']??''));if(g)return[];return[{'rule_id':'R-REVISION-LOOP-NO-COUNTER','severity':'high','title':'machine_shape\x20ships\x20a\x20revision\x20loop\x20(a\x20provide/resubmit/revise/redeliver\x20return\x20edge\x20from\x20a\x20needs-info/revision\x20waypoint)\x20with\x20a\x20finite\x20revision_rounds_max\x20('+String(e)+')\x20and\x20no\x20counter-backed\x20Repository\x20guard\x20(INV-A1)','detail':'the\x20chain\x20caps\x20EDGE\x20count\x20(MAX_FORWARD\x20/\x20MAX_NODE_PAIR),\x20never\x20VISIT\x20count,\x20so\x20this\x20loop\x27s\x20return\x20edge\x20can\x20be\x20walked\x20'+'any\x20number\x20of\x20times.\x20The\x20declared\x20twin\x20(R-ACCEPTANCE-REVISION)\x20only\x20covers\x20templates\x20that\x20DECLARE\x20an\x20acceptance\x20mode;\x20'+'this\x20graph-face\x20twin\x20catches\x20the\x20loop\x20STRUCTURE\x20itself.\x20A\x20finite\x20revision_rounds_max\x20over\x20an\x20ungated\x20loop\x20is\x20a\x20promise\x20'+'the\x20contract\x20cannot\x20enforce.','suggestion':'Declare\x20revision_rounds_max\x20\x27unlimited\x27\x20(the\x20honest\x20form),\x20or\x20gate\x20the\x20loop\x27s\x20return\x20edge\x20with\x20the\x20counter-backed\x20'+'tpl_repository_revision_gate\x20(request/provided\x20marker-count\x20tally\x20pair,\x20per-side\x20write\x20guards\x20binding\x20the\x20tally\x20to\x20'+'the\x20party\x20the\x20cap\x20constrains\x20—\x20see\x20freelance/bug-bounty\x27s\x20revision_gate\x20mount)\x20or\x20a\x20pattern.repository_data_check\x20'+'tally\x20written\x20via\x20pattern.repository_write_authorization.'}];}function exclusivityRegistryChecks(a){const b=templateText(a),c=/\bexclusive[- ](license|tier|grant|sale)s?\b|\bexclusively licen[cs]ed\b/i['test'](b);if(!c)return[];const d=(a['guards']??[])['some'](e=>e['policy']?.['name']==='claimed_subjects'||/claim_registry/i['test'](e['key']??'')||/tpl_buy_guard_exclusive_subject/i['test'](e['template_id']??''));if(d)return[];return[{'rule_id':'R-EXCLUSIVITY-NO-REGISTRY','severity':'medium','title':'the\x20template\x20discloses\x20EXCLUSIVITY\x20(an\x20exclusive\x20license/tier/grant/sale)\x20but\x20ships\x20no\x20claimed-subject\x20registry\x20—\x20the\x20uniqueness\x20claim\x20has\x20no\x20on-chain\x20proof\x20or\x20refusal\x20path','detail':'an\x20exclusive\x20premium\x20is\x20only\x20worth\x20what\x20proves\x20the\x20subject\x20was\x20not\x20sold\x20twice.\x20Without\x20a\x20write_once\x20claimed-subject\x20'+'registry\x20(claim\x20rows\x20keyed\x20by\x20the\x20listing\x27s\x20Service\x20address,\x20written\x20at\x20first\x20grant\x20settlement),\x20a\x20re-sold\x20exclusive\x20'+'is\x20undetectable\x20on\x20chain\x20and\x20the\x20arbitration\x20face\x20has\x20no\x20already-transferred\x20proof\x20to\x20read.','suggestion':'Mount\x20the\x20exclusivity\x20registry:\x20a\x20tpl_repository_write_allowlist\x20guard\x20over\x20a\x20write_once\x20\x27claimed_subjects\x27\x20policy\x20'+'(SERVICE-keyed\x20rows,\x20one\x20claim\x20row\x20written\x20at\x20first\x20grant\x20settlement)\x20plus\x20—\x20when\x20the\x20listing\x20is\x20dedicated\x20to\x20the\x20'+'exclusive\x20tier\x20—\x20the\x20drop-in\x20tpl_buy_guard_exclusive_subject\x20buy\x20gate\x20(logic_not\x20over\x20query_repository_data_has,\x20the\x20'+'negated\x20read\x20of\x20the\x20same\x20registry).\x20Disclose\x20the\x20settlement-window\x20face:\x20the\x20gate\x20opens\x20for\x20buys\x20between\x20purchase\x20and\x20'+'claim-row\x20write,\x20so\x20single-flight\x20sales\x20are\x20part\x20of\x20the\x20posture.'}];}function rateTierClosureChecks(a){const b=Object['keys'](a['fee_params']??{})['find'](f=>/_bands$/['test'](f));if(!b)return[];const c=a['fee_params']?.[b];if(typeof c!=='string')return[];const d=[];for(const f of c['split'](';')){const g=/^(\d+)-(\d+):(\d+)$/['exec'](f['trim']());if(!g)return[{'rule_id':'R-RATE-TIER-GAP','severity':'high','title':'fee_params.'+b+'\x20(\x22'+c+'\x22)\x20is\x20malformed\x20—\x20tiers\x20must\x20be\x20\x22floor-ceiling:buyer_refund_bps\x22\x20separated\x20by\x20\x27;\x27\x20(R-RATE-TIER-GAP)','detail':'an\x20unparseable\x20band\x20declaration\x20cannot\x20be\x20mirrored\x20into\x20band-guard\x20params,\x20so\x20the\x20on-chain\x20bands\x20and\x20the\x20declared\x20tiers\x20can\x20drift\x20apart\x20silently.','suggestion':'Fix\x20the\x20tier\x20syntax\x20in\x20fee_params.'+b+'\x20(e.g.\x20\x220-5000:10000;5000-9000:5000;9000-10001:1000\x22)\x20and\x20keep\x20the\x20cancel_band_*\x20guard\x20params\x20and\x20allocator\x20rows\x20in\x20sync.'}];d['push']({'floor':Number(g[0x1]),'ceiling':Number(g[0x2]),'bps':Number(g[0x3])});}d['sort']((h,j)=>h['floor']-j['floor']);const e=h=>({'rule_id':'R-RATE-TIER-GAP','severity':'high','title':'fee_params.'+b+'\x20(\x22'+c+'\x22)\x20fails\x20the\x20tier-closure\x20contract:\x20'+h+'\x20—\x20a\x20mid-band\x20ratio\x20passes\x20NO\x20band\x20guard\x20(stranded\x20funds)\x20or\x20TWO\x20(double-pay)','detail':'the\x20band\x20allocators\x20partition\x20[0,\x2010001)\x20only\x20when\x20the\x20declared\x20tiers\x20are\x20HALF-OPEN\x20ADJACENT\x20from\x200\x20and\x20reach\x20past\x2010000\x20'+'(ceiling_k\x20==\x20floor_{k+1},\x20lowest\x20floor\x200,\x20last\x20ceiling\x20>=\x2010001\x20with\x20the\x20exclusive-ceiling\x20convention).\x20A\x20gap\x20strands\x20the\x20'+'allocation\x20(no\x20guard\x20passes);\x20an\x20overlap\x20double-pays\x20(two\x20guards\x20pass,\x20two\x20allocators\x20drain);\x20an\x20unowned\x20end\x20leaves\x20a\x20'+'fresh\x20order\x20(no\x20row,\x20falls\x20to\x20the\x200-floor\x20band)\x20or\x20a\x20fully-delivered\x20ratio\x20(10000)\x20outside\x20every\x20band.','suggestion':'Fix\x20the\x20tiers\x20so\x20they\x20tile\x20the\x20axis:\x20start\x20at\x20floor\x200,\x20make\x20each\x20tier\x27s\x20ceiling\x20the\x20next\x20tier\x27s\x20floor,\x20end\x20with\x20a\x20ceiling\x20'+'>=\x2010001,\x20and\x20keep\x20every\x20band\x20allocator\x27s\x20internal\x20ERATE\x20sum\x20at\x2010000.'});if(d['length']===0x0)return[e('zero\x20tiers')];if(d[0x0]['floor']!==0x0)return[e('the\x20lowest\x20tier\x20starts\x20at\x20'+d[0x0]['floor']+',\x20not\x200')];if(d[d['length']-0x1]['ceiling']<0x2711)return[e('the\x20highest\x20tier\x20ends\x20at\x20'+d[d['length']-0x1]['ceiling']+',\x20leaving\x20['+d[d['length']-0x1]['ceiling']+',\x2010000]\x20unowned')];for(let h=0x0;h<d['length'];h++){if(d[h]['ceiling']<=d[h]['floor'])return[e('tier\x20'+h+'\x20('+d[h]['floor']+'-'+d[h]['ceiling']+')\x20is\x20empty\x20or\x20inverted')];if(h>0x0&&d[h]['floor']<d[h-0x1]['ceiling'])return[e('tier\x20'+h+'\x20(floor\x20'+d[h]['floor']+')\x20OVERLAPS\x20tier\x20'+(h-0x1)+'\x20(ceiling\x20'+d[h-0x1]['ceiling']+')')];if(h>0x0&&d[h]['floor']>d[h-0x1]['ceiling'])return[e('tier\x20'+h+'\x20(floor\x20'+d[h]['floor']+')\x20leaves\x20['+d[h-0x1]['ceiling']+',\x20'+d[h]['floor']+')\x20unowned\x20after\x20tier\x20'+(h-0x1))];}return[];}function piiCommitmentChecks(a){const b=templateText(a),c=/\b(id[- ]?verification|identity verification|id document|passport (?:no\.?|number)|national id|driver'?s licen[cs]e|real[- ]?name|kyc|know[- ]your[- ]customer|guest identity|tenant identity|member roster|guest roster|contact (?:details|info(?:rmation)?)|whatsapp|phone number|home address|pickup contact|emergency contact|personal data|personal information)\b/i,d=/\b(zero PII|no PII|PII commitment|presence[- ]only|E2EE|off[- ]chain encrypted|encrypted (?:conversation|channel|Messenger)|never as (?:public )?on[- ]chain|never (?:in|to) a public on[- ]chain|never stored on[- ]chain|chain records? (?:only )?the (?:presence|proof|hash))\b/i;if(!c['test'](b))return[];if(d['test'](b))return[];return[{'rule_id':'R-PII-NO-COMMITMENT','severity':'medium','title':'PII-handling\x20prose\x20with\x20no\x20on-chain-zero\x20commitment','detail':'The\x20template\x27s\x20prose\x20discusses\x20personal\x20information\x20(identity\x20verification,\x20contact\x20exchange,\x20or\x20a\x20roster)\x20but\x20never\x20declares\x20the\x20publicity\x20boundary.\x20The\x20chain\x20is\x20a\x20PUBLIC\x20ledger:\x20a\x20phone\x20number,\x20home\x20address\x20or\x20ID\x20document\x20written\x20into\x20a\x20repository\x20row,\x20a\x20progress\x20message\x20or\x20WIP\x20text\x20is\x20publicly\x20readable\x20forever\x20(U-09),\x20and\x20there\x20is\x20no\x20delete.\x20The\x20kernel\x27s\x20ONE\x20privacy\x20primitive\x20is\x20presence-only\x20—\x20plaintext\x20must\x20ride\x20the\x20E2EE\x20Messenger\x20conversation\x20while\x20the\x20chain\x20records\x20the\x20proof.','suggestion':'Add\x20a\x20disclosure\x20note\x20(build_note\x20or\x20user_inputs\x20note)\x20declaring\x20the\x20commitment:\x20\x22ON-CHAIN\x20ZERO\x20PII\x20—\x20names,\x20phones,\x20addresses\x20and\x20ID\x20documents\x20NEVER\x20enter\x20on-chain\x20fields;\x20plaintext\x20travels\x20only\x20the\x20E2EE\x20Messenger\x20conversation,\x20the\x20chain\x20records\x20the\x20presence\x20proof\x22\x20(the\x20batch7\x20T-A\x20zero-chain\x20approximation\x20—\x20the\x20disclosure\x20is\x20the\x20control).'}];}function installmentModeChecks(a){const b=a['installment_mode'];if(b===undefined||b==='none')return[];const c=a['machine_shape']??[];if(c['length']===0x0||!c['some'](z=>(z['from']??[])['length']>0x0))return[];const d=/(due|owed|owing|unpaid|awaiting|pending)/i,f=/(paid|captured|funded|settled)/i,h=/(deposit|down_?pay|balance_due|balance_owed|awaiting|installment|milestone)/i,j=/(refund|cancel|exit|forfeit|kill|void|abandon|release|expire|lapse)/i,k=[];for(const z of c){for(const A of z['from']??[]){if(typeof A==='string')k['push']({'prev':A,'target':z['name']});else k['push']({'prev':A?.['prev']??'','target':z['name'],'guardKey':A?.['guard_key']});}}const l=[],n=k['filter'](B=>d['test'](B['prev'])&&f['test'](B['target'])&&(B['guardKey']===undefined||B['guardKey']['trim']()===''));n['length']>0x0&&l['push']({'rule_id':'R-INSTALLMENT-FUNDING','severity':'high','title':'installment_mode\x20\x27'+b+'\x27\x20has\x20an\x20ungated\x20funding\x20forward\x20('+n['map'](B=>'\x27'+B['prev']+'\x27\x20→\x20\x27'+B['target']+'\x27')['join'](',\x20')+')\x20—\x20a\x20bare\x20advance\x20is\x20a\x20zero-value\x20capture\x20(INV-B1)','detail':'A\x20capture\x20forward\x20(a\x20DUE\x20state\x20advancing\x20into\x20a\x20PAID\x20state)\x20with\x20no\x20guard_key\x20lets\x20the\x20Machine\x20advance\x20WITHOUT\x20the\x20'+'later\x20payment\x20landing\x20in\x20the\x20Allocation\x20—\x20the\x20balance\x20is\x20recorded\x20paid\x20on\x20a\x20zero-value\x20advance\x20(H4).\x20compile\x20hard-blocks\x20'+'this\x20(INSTALLMENT_FUNDING_UNGATED);\x20the\x20scanner\x20surfaces\x20it\x20at\x20authoring\x20time.\x20Whether\x20the\x20bound\x20Guard\x20actually\x20reads\x20'+'allocation.balance\x20is\x20R-LOOP-FUND\x27s\x20job,\x20not\x20this\x20rule\x27s.','suggestion':'Bind\x20a\x20fund-gate\x20Guard\x20on\x20each\x20capture\x20forward\x20(constant\x20=\x20order\x20address,\x20convert_witness\x20OrderAllocation(109),\x20'+'allocation.balance\x20query\x201051\x20>=\x20the\x20capture\x20amount).\x20PRE-STATE\x20CONSTRAINT\x20(esound-mn-261021\x20B-1,\x20mainnet-verified):\x20'+'the\x20gate\x20reads\x20the\x20COMMITTED\x20pre-transaction\x20balance\x20—\x20the\x20one-PTB\x20order_renew\x20payment\x20is\x20INVISIBLE\x20to\x20it,\x20so\x20a\x20'+'balance-gated\x20capture\x20advanced\x20by\x20order_renew\x20ALWAYS\x20aborts.\x20'+TWO_TX_RENEW_RECIPE+'\x20Pair\x20the\x20balance\x20gate\x20with\x20'+'the\x20once\x20slot\x20(H5\x20—\x20the\x20fund\x20gate\x20is\x20a\x20STATE\x20READ,\x20not\x20a\x20once).'});const o=new Set((a['allocator']['rows']??[])['filter'](B=>B['track']==='refund'||B['track']==='settlement')['map'](B=>B['guard_key'])['filter'](B=>typeof B==='string'&&B['trim']()!=='')),p=new Set(c['map'](B=>B['name'])),q=new Map(c['map'](B=>[B['name'],B['semantic_role']])),s=new Set();for(const B of a['guards']??[]){if(B['host']!=='machine'||!/allocator_node_gate|progress_state_check/['test'](B['template_id']))continue;if(!o['has'](B['key']))continue;for(const C of Object['values'](B['params']??{})){if(typeof C==='string'&&p['has'](C))s['add'](C);}}const w=new Map();for(const D of k){const E=w['get'](D['prev'])??[];E['push'](D['target']),w['set'](D['prev'],E);}const x=F=>{const G=new Set([F]),H=[...w['get'](F)??[]];while(H['length']>0x0){const I=H['pop']();if(s['has'](I))return!![];const J=q['get'](I);if(J==='final'||J==='cancelled')return!![];if(G['has'](I))continue;G['add'](I);for(const K of w['get'](I)??[])if(!G['has'](K))H['push'](K);}return![];},y=[];for(const F of c){if(!h['test'](F['name']))continue;const G=k['filter'](H=>H['prev']===F['name']);if(G['length']===0x0||!x(F['name'])){const H=G['filter'](I=>j['test'](I['target']))['map'](I=>'\x27'+I['target']+'\x27');y['push'](H['length']>0x0?F['name']+'\x20(keyword-named\x20target(s)\x20'+H['join'](',\x20')+'\x20reach\x20no\x20refund/settlement\x20rail\x20and\x20no\x20final/cancelled\x20state\x20—\x20the\x20NAME\x20alone\x20is\x20not\x20an\x20exit)':F['name']);}}return y['length']>0x0&&l['push']({'rule_id':'R-INSTALLMENT-DEPOSIT','severity':'high','title':'installment_mode\x20\x27'+b+'\x27\x20holds\x20buyer\x20funds\x20at\x20'+y['map'](I=>'\x27'+I+'\x27')['join'](',\x20')+'\x20with\x20no\x20deposit-exit\x20rail\x20(INV-B2)','detail':'There\x20is\x20no\x20on-chain\x20obligation\x20to\x20pay\x20the\x20balance\x20(H1).\x20A\x20deposit-held\x20state\x20whose\x20only\x20outgoing\x20edges\x20go\x20forward\x20(pay\x20'+'more)\x20strands\x20the\x20already-paid\x20portion\x20when\x20the\x20buyer\x20walks\x20away\x20—\x20Machine\x20+\x20Allocator\x20are\x20immutable\x20(IMMUT-001),\x20so\x20it\x20is\x20'+'a\x20permanent\x20stranding,\x20not\x20a\x20fixable\x20typo.\x20compile\x20hard-blocks\x20this\x20(INSTALLMENT_DEPOSIT_STRANDED);\x20this\x20is\x20the\x20'+'authoring-time\x20twin.','suggestion':'Add\x20a\x20deposit-exit\x20rail\x20from\x20each\x20held\x20state\x20—\x20a\x20refund/cancel\x20forward\x20into\x20an\x20exit\x20node\x20whose\x20allocator\x20returns\x20the\x20held\x20'+'funds\x20to\x20the\x20order\x20payer\x20(GuardIdentifier(0))\x20or\x20applies\x20the\x20declared\x20deposit_exit_policy\x20(full\x20refund\x20vs\x20a\x20kill\x20fee\x20'+'compensating\x20the\x20merchant\x20for\x20the\x20reserved\x20capacity).'}),l;}const CALLER_LEG_TPL_WHITELIST=new Set(['tpl_allocator_node_gate_settle','tpl_allocator_node_gate_settle_nodes','tpl_allocator_node_gate_settle_once','tpl_allocator_settle_band_once','tpl_allocator_prize_settle_once','tpl_allocator_node_gate_settle_tier_small','tpl_allocator_node_gate_settle_tier_large','tpl_allocator_node_gate_refund','tpl_allocator_node_gate_refund_renewal','tpl_allocator_node_gate_claim_settle','tpl_allocator_session_release','tpl_repository_band_gate']);function fundRailUnboundRecipientChecks(a){const b=[],c=new Set((a['allocator']['rows']??[])['filter'](d=>d['track']==='refund'||d['track']==='settlement')['map'](d=>d['guard_key'])['filter'](d=>typeof d==='string'&&d['trim']()!==''));if(c['size']===0x0)return b;for(const d of a['guards']??[]){if(d['host']!=='machine'||!c['has'](d['key']))continue;if(!d['template_id']['startsWith']('tpl_'))continue;if(CALLER_LEG_TPL_WHITELIST['has'](d['template_id']))continue;if(d['identity_leg_exempt'])continue;b['push']({'rule_id':'R-FUND-RAIL-UNBOUND-RECIPIENT','severity':'critical','title':'fund\x20rail\x20\x27'+d['key']+'\x27\x20('+d['template_id']+')\x20pays\x20a\x20fixed\x20recipient\x20with\x20NO\x20caller-authorization\x20leg\x20—\x20any\x20address\x20that\x20satisfies\x20the\x20node/condition\x20legs\x20can\x20fire\x20the\x20payout','detail':'alloc_by_guard\x20has\x20NO\x20chain-side\x20caller\x20check\x20(gf30\x20A2):\x20a\x20refund/recover/settlement\x20rail\x20whose\x20guard\x20ships\x20no\x20'+'signer==order.owner\x20/\x20permission-dynamic\x20/\x20allowlist\x20leg\x20is\x20a\x20PERMISSIONLESS\x20payout\x20on\x20a\x20standing\x20pot\x20—\x20the\x20ks11\x20'+'live\x20incident\x20(an\x20unexpected\x20account\x20swept\x20a\x20merchant-recovery\x20payout).\x20The\x20compile\x20face\x20'+'(RAIL_NO_CALLER_IDENTITY_BOUND)\x20hard-blocks\x20this\x20at\x20build\x20time;\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Re-point\x20the\x20rail\x20at\x20a\x20tpl_*\x20that\x20ships\x20the\x20caller-authorization\x20leg\x20in\x20its\x20root\x20('+[...CALLER_LEG_TPL_WHITELIST]['join'](',\x20')+'),\x20'+'or\x20declare\x20identity_leg_exempt\x20on\x20the\x20spec\x20with\x20the\x20business\x20justification\x20—\x20permissionless\x20entity\x20payouts\x20are\x20never\x20publishable.'});}return b;}function recoverCoversRefundTerminalChecks(a){const b=[],c=new Set((a['machine_shape']??[])['map'](d=>d['name']));for(const d of a['guards']??[]){if(d['host']!=='machine')continue;const e=Object['entries'](d['params']??{}),f=d['template_id']==='tpl_allocator_node_gate_recover'||e['some'](([l])=>/^recover_node/['test'](l));if(!f)continue;const h=e['filter'](([l,m])=>/^recover_node/['test'](l)&&typeof m==='string'&&c['has'](m))['map'](([,k])=>k),j=h['filter'](k=>/^(closed_cancel|cancelled)$/i['test'](k));if(j['length']===0x0)continue;b['push']({'rule_id':'R-RECOVER-COVERS-REFUND-TERMINAL','severity':'critical','title':'recover\x20rail\x20\x27'+d['key']+'\x27\x20covers\x20the\x20buyer\x20refund\x20terminal(s)\x20'+j['map'](k=>'\x27'+k+'\x27')['join'](',\x20')+'\x20—\x20'+'an\x20ALREADY-REFUNDED\x20order\x20can\x20be\x20swept\x20again\x20by\x20the\x20merchant\x20recover\x20rail\x20(C-F01,\x20mainnet\x20ks11\x20live\x20deduction)','detail':'The\x20refund\x20rail\x20is\x20the\x20authorized\x20exit\x20at\x20the\x20buyer\x20refund\x20terminal;\x20the\x20recover\x20twin\x20fires\x20WITHOUT\x20a\x20caller\x20leg\x20'+'(deliberately\x20keeper-reachable),\x20so\x20covering\x20the\x20refund\x20terminal\x20means\x20a\x20refunded\x20order\x27s\x20residual\x20—\x20or\x20a\x20refund\x20'+'the\x20recover\x20rail\x20races\x20—\x20can\x20be\x20re-swept\x20to\x20the\x20merchant\x20entity.\x20Node-gate\x20partition:\x20recover\x20and\x20refund\x20rails\x20'+'must\x20stay\x20disjoint\x20at\x20the\x20buyer\x20refund\x20terminal.','suggestion':'remove\x20the\x20refund\x20terminal\x20from\x20the\x20recover\x20set;\x20the\x20refund\x20rail\x20is\x20the\x20only\x20authorized\x20exit\x20there\x20(C-F01)'});}return b;}function arbVotingGateConstantTrueChecks(a){const b=[],c=(a['guards']??[])['some'](d=>d['host']==='arbitration'&&d['template_id']==='tpl_voting_guard_open_vote');if(!c)return b;return b['push']({'rule_id':'R-ARB-VOTING-GATE-CONSTANT-TRUE','severity':'critical','title':'factory\x20voting\x20gate\x20is\x20an\x20open\x20surface\x20(only\x20the\x20dispute\x20parties\x20excluded)\x20—\x20'+'configure\x20a\x20roster+threshold\x20voting_guard\x20before\x20publishing','detail':'tpl_voting_guard_open_vote\x27s\x20canonical\x20root\x20is\x20the\x20HIS-50\x20three-leg\x20form\x20(always-true\x20core\x20+\x20buyer\x20'+'self-vote\x20exclusion\x20+\x20arb.order==order\x20case\x20pin\x20—\x20mainnet\x2031uLR2nh:\x20under\x20the\x20bare\x20always-true\x20shape\x20a\x20'+'buyer\x20self-voted\x20their\x20own\x20case\x20and\x20the\x20refund\x20swung;\x20the\x20merchant\x20side\x20stays\x20in-expressible\x20in-guard).\x20'+'The\x20mounted\x20surface\x20still\x20admits\x20EVERY\x20non-party\x20passport\x20holder:\x20sanctioned\x20only\x20as\x20the\x20one-click\x20'+'unblocking\x20default\x20(crs9-F-36);\x20a\x20template\x20that\x20'+'mounts\x20it\x20deliberately\x20must\x20say\x20so\x20and\x20should\x20move\x20to\x20a\x20roster\x20form\x20before\x20real\x20disputes\x20arrive.','suggestion':'Declare\x20tpl_voting_guard_party_only\x20(party\x20panel)\x20or\x20tpl_voting_guard_numeric_weight\x20(roster+threshold)\x20instead;\x20'+'at\x20build\x20time\x20pass\x20arbitration_vote_policy:\x27party_panel\x27\x20to\x20opt\x20out\x20of\x20the\x20kernel\x27s\x20open-vote\x20injection\x20entirely.'}),b;}const PROSE_ALL_RAILS_ONCE_RE=/(?<!not |no |never )\b(every|all|each)\b[^.]{0,40}\b(rail|track)\b[^.]{0,80}(255|once)|\barms? (the )?identifier-?255\b/i;function proseBodyOnceChecks(a){const b=[],c=a['allocator']?.['description'],d=[...a['build_notes']??[],...typeof c==='string'?[c]:[]],e=d['filter'](l=>PROSE_ALL_RAILS_ONCE_RE['test'](l));if(e['length']===0x0)return b;const f=[...d,...(a['guards']??[])['map'](l=>l['purpose']??''),...a['differences']??[]]['some'](l=>/refund_renewal|_renewal.*255|renewal-safe/i['test'](l)),g=new Set((a['allocator']['rows']??[])['filter'](l=>l['track']==='refund')['map'](l=>l['guard_key'])['filter'](l=>typeof l==='string'&&l['trim']()!=='')),h=[...new Set((a['guards']??[])['filter'](l=>g['has'](l['key'])&&/refund/i['test'](l['template_id']))['map'](l=>l['template_id']))];if(h['length']===0x0)return b;const j=h['filter'](l=>/_renewal$/['test'](l)||/255/['test'](l)),k=j['length']*0x2>h['length'];if(k||f)return b;return b['push']({'rule_id':'R-PROSE-BODY-ONCE','severity':'high','title':'prose\x20claims\x20X\x20but\x20the\x20guard\x20bodies\x20disagree\x20—\x20fix\x20the\x20prose\x20or\x20the\x20bodies\x20before\x20publish','detail':'The\x20prose\x20declares\x20the\x20identifier-255/once\x20discipline\x20for\x20the\x20rails,\x20but\x20the\x20refund-class\x20guard\x20bodies\x20do\x20NOT\x20carry\x20it\x20'+('in\x20majority:\x20renewal/255-form\x20'+j['length']+'/'+h['length']+'.\x20Claim\x20sentence(s):\x20'+e['map'](l=>'\x27'+l['slice'](0x0,0xa0)+(l['length']>0xa0?'…':'')+'\x27')['join'](';\x20')+'.\x20Actual\x20refund-class\x20guard\x20templates:\x20'+h['join'](',\x20')+'.'),'suggestion':'Either\x20fix\x20the\x20prose\x20to\x20stop\x20claiming\x20the\x20once/255\x20discipline,\x20or\x20re-point\x20the\x20refund-class\x20rails\x20at\x20'+'tpl_allocator_node_gate_refund_renewal\x20(the\x20255\x20epoch\x20form)\x20so\x20the\x20bodies\x20carry\x20what\x20the\x20prose\x20promises.'}),b;}function affiliateModeChecks(a){const b=a['affiliate_mode'];if(b===undefined||b==='none')return[];const c=[],d=/(commission|affiliate|referr|attribut|partner_?payout)/i,e=a['machine_shape']??[],f=e['some'](l=>d['test'](l['name'])),g=a['allocator']?.['rows']??[],h=g['some'](l=>d['test'](l['value_from']??'')||d['test'](l['recipient_key']??''));!f&&!h&&c['push']({'rule_id':'R-AFFILIATE-RAIL','severity':'high','title':'affiliate_mode\x20\x27'+b+'\x27\x20declares\x20a\x20commission\x20overlay\x20with\x20no\x20commission\x20node\x20and\x20no\x20commission\x20allocator\x20row\x20(INV-D3)','detail':'A\x20declared\x20referral/affiliate\x20commission\x20with\x20no\x20rail\x20to\x20walk\x20it\x20is\x20a\x20false\x20promise\x20at\x20quote\x20time.\x20compile\x20hard-blocks\x20this\x20'+'(AFFILIATE_RAIL_MISSING);\x20the\x20scanner\x20surfaces\x20it\x20at\x20authoring\x20time.\x20The\x20commission\x20leg\x20MUST\x20be\x20INDEPENDENT\x20of\x20the\x20goods\x20escrow\x20'+'(anti-grab\x20pool)\x20—\x20that\x20money-safety\x20half\x20rides\x20the\x20generic\x20DUAL-RAIL-01\x20+\x20once/order-anchor\x20audits,\x20not\x20this\x20rule.','suggestion':'Add\x20an\x20INDEPENDENT\x20commission\x20leg:\x20a\x20Rate\x20row\x20off\x20a\x20dedicated\x20commission\x20pool\x20(never\x20a\x20Surplus/Rate\x20drain\x20of\x20the\x20buyer\x27s\x20goods\x20'+'escrow)\x20to\x20an\x20explicit\x20non-empty\x20partner\x20Entity,\x20gated\x20by\x20a\x20window-anchored\x20claim\x20guard\x20(INV-D1\x20rides\x20TIME-ANCHOR-01)\x20so\x20the\x20'+'commission\x20is\x20claimable\x20only\x20after\x20the\x20attribution/refund\x20window\x20closes.\x20Name\x20the\x20node\x20or\x20the\x20row\x20recipient_key/value_from\x20'+'with\x20a\x20commission-family\x20token\x20so\x20the\x20rail\x20is\x20machine-detectable\x20(a\x20free-text\x20note\x20is\x20NOT\x20a\x20detection\x20signal\x20—\x20direct-sales\x20'+'templates\x20carry\x20\x270%\x20commission\x27\x20negation\x20notes).'});const j=/(post-?lock|clawback|unrecoverable|irrevocab|no\s*(?:revers|recov|clawback)|cannot be reversed|once released|released commission)/i,k=(a['build_notes']??[])['some'](l=>j['test'](l));return!k&&c['push']({'rule_id':'R-AFFILIATE-DISCLOSURE','severity':'high','title':'affiliate_mode\x20\x27'+b+'\x27\x20has\x20no\x20build_note\x20disclosing\x20the\x20post-lock\x20no-clawback\x20truth\x20(INV-D2)','detail':'SOLE\x20TRUTH:\x20Allocation\x20distribute\x20is\x20a\x20ONE-WAY\x20outflow\x20(no\x20debit/clawback\x20primitive,\x20§11.0\x20G2),\x20so\x20once\x20a\x20commission\x20is\x20RELEASED\x20it\x20'+'CANNOT\x20be\x20reversed\x20on\x20chain\x20—\x20a\x20refund/chargeback\x20after\x20the\x20attribution\x20window\x20leaves\x20the\x20affiliate\x20commission\x20unrecoverable.\x20A\x20'+'template\x20that\x20declares\x20the\x20overlay\x20without\x20disclosing\x20this\x20implies\x20a\x20recovery\x20capability\x20the\x20chain\x20does\x20not\x20have\x20(L-04/D-5).\x20'+'compile\x20hard-blocks\x20it\x20(AFFILIATE_CLAWBACK_UNDISCLOSED);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Add\x20a\x20build_note\x20stating\x20the\x20post-lock\x20truth\x20honestly,\x20e.g.\x20\x22post-lock:\x20a\x20released\x20affiliate\x20commission\x20is\x20unrecoverable\x20/\x20'+'Non-recoverable\x20—\x20refunds\x20after\x20the\x20attribution\x20window\x20do\x20NOT\x20claw\x20back\x20the\x20partner\x20payout.\x22\x20Pair\x20with\x20the\x20INV-D1\x20window\x20anchor\x20so\x20the\x20'+'commission\x20is\x20only\x20claimable\x20once\x20the\x20refund\x20window\x20has\x20closed,\x20minimizing\x20the\x20unrecoverable\x20surface.'}),c;}function crowdfundingModeChecks(a){const b=a['crowdfunding_mode'];if(b===undefined||b==='none')return[];const c=[],d=/(releas|settle|funded|disburs|project)/i,f=/(refund|missed|unmet|return|reimburse)/i,g=a['machine_shape']??[],h=a['allocator']?.['rows']??[],j=g['some'](E=>d['test'](E['name'])),k=h['some'](E=>E['track']==='settlement'&&(d['test'](E['guard_key']??'')||d['test'](E['recipient_key']??''))),l=g['some'](E=>f['test'](E['name'])),n=h['some'](E=>E['track']==='refund'||f['test'](E['guard_key']??''));!j&&!k&&c['push']({'rule_id':'R-CROWDFUNDING-RAIL','severity':'high','title':'crowdfunding_mode\x20\x27'+b+'\x27\x20declares\x20a\x20campaign\x20with\x20no\x20release/settlement\x20node\x20and\x20no\x20settlement\x20allocator\x20row\x20(INV-E1)','detail':'A\x20declared\x20campaign\x20with\x20no\x20exit\x20rail\x20strands\x20the\x20escrowed\x20contributions\x20at\x20the\x20deadline.\x20compile\x20hard-blocks\x20this\x20'+'(CROWDFUNDING_THRESHOLD_GATE_MISSING);\x20the\x20scanner\x20surfaces\x20it\x20at\x20authoring\x20time.\x20The\x20money-safety\x20half\x20(node-gated\x20'+'fund\x20rails\x20with\x20NO\x20claimed_by\x20leg,\x20decision\x2011)\x20rides\x20the\x20generic\x20DUAL-RAIL-01\x20+\x20R-FUND-RAIL-CLAIMED-BY\x20audits,\x20not\x20this\x20rule.','suggestion':'Add\x20a\x20release\x20leg:\x20a\x20Rate\x2010000\x20row\x20to\x20a\x20NON-EMPTY\x20project\x20Entity,\x20gated\x20at\x20the\x20campaign-deadline\x20settlement\x20terminal.\x20Name\x20'+'the\x20node\x20or\x20the\x20row\x20guard_key/recipient_key\x20with\x20a\x20release-family\x20token\x20so\x20the\x20rail\x20is\x20machine-detectable\x20(a\x20free-text\x20note\x20'+'is\x20NOT\x20a\x20detection\x20signal).'});b==='threshold'&&!l&&!n&&c['push']({'rule_id':'R-CROWDFUNDING-RAIL','severity':'high','title':'crowdfunding_mode\x20\x27threshold\x27\x20declares\x20an\x20all-or-nothing\x20campaign\x20with\x20no\x20refund-family\x20node/row\x20(INV-E1\x20/\x20D-BUG-2)','detail':'A\x20missed\x20goal\x20would\x20strand\x20every\x20contribution\x20instead\x20of\x20returning\x20it.\x20compile\x20hard-blocks\x20this\x20'+'(CROWDFUNDING_THRESHOLD_GATE_MISSING).\x20The\x20release\x20and\x20refund\x20legs\x20are\x20mutually\x20exclusive\x20on\x20the\x20same\x20aggregate\x20'+'(D-BUG-2\x20escrow-exit\x20polarity):\x20aggregate\x20>=\x20goal\x20→\x20release;\x20aggregate\x20<\x20goal\x20→\x20refund.','suggestion':'Add\x20the\x20refund\x20leg\x20as\x20the\x20release\x20leg\x27s\x20escrow-exit\x20twin:\x20a\x20per-contributor\x20refund\x20row\x20(order-anchored\x20user\x20slot\x200\x20—\x20'+'the\x20submitted\x20Order,\x20extracted\x20by\x20the\x20Order\x27s\x20owner-claim\x20entry;\x20NEVER\x20slot\x20254\x20on\x20a\x20refund\x20rail:\x20254\x20is\x20the\x20ONCE-FOR-OBJECT\x20slot,\x20'+'so\x20a\x20refund\x20node\x20re-entered\x20in\x20a\x20later\x20period\x20aborts\x20E_ONCE_TRIGGERED(16),\x20OFN\x20#P-04;\x20node-gated\x20at\x20the\x20refund\x20terminal,\x20'+'decision\x2011\x20—\x20NEVER\x20a\x20claimed_by\x20leg,\x20R-FUND-RAIL-CLAIMED-BY\x20critical)\x20on\x20a\x20\x27refund\x27\x20'+'track\x20or\x20a\x20refund-family\x20guard_key,\x20plus\x20a\x20terminal-node-gated\x20recover_gate\x20rail\x20(tpl_allocator_node_gate_recover)\x20so\x20an\x20'+'arbitration-awarded\x20order\x27s\x20residual\x20still\x20exits.'});const o=g['find'](E=>(E['from']??[])['some'](F=>typeof F!=='string'&&F['prev']===''))?.['name'],p=[];for(const E of g){if(!/cancel/i['test'](E['name'])||E['semantic_role']!=='cancelled')continue;for(const F of E['from']??[]){if(typeof F==='string')continue;if(F['operator']!=='order_payer')continue;if(o!==undefined&&F['prev']===o)continue;p['push']((F['prev']||'(entry)')+'\x20--'+(F['forward']??'advance')+'-->\x20'+E['name']);}}p['length']>0x0&&c['push']({'rule_id':'R-CROWDFUNDING-CANCEL-RAIL','severity':'high','title':'crowdfunding_mode\x20\x27'+b+'\x27\x20anchors\x20a\x20buyer-cancel\x20rail\x20AFTER\x20the\x20pledge\x20entry\x20('+p['length']+'\x20edge(s):\x20'+p['join'](',\x20')+')\x20—\x20post-goal\x20escrow\x20drain\x20(ksr-tn-261026\x20Q8-F02)','detail':'The\x20campaign\x20goal\x20is\x20a\x20commitment\x20snapshot\x20taken\x20at\x20the\x20deadline:\x20once\x20the\x20goal\x20decision\x20passes,\x20a\x20backer\x20can\x20no\x20longer\x20'+'cancel\x20their\x20pledge.\x20In\x20a\x20threshold\x20campaign\x20every\x20node\x20below\x20the\x20entry\x20is\x20reachable\x20only\x20AFTER\x20the\x20deadline\x20(the\x20goal\x20'+'decision\x20requires\x20Clock\x20>=\x20deadline),\x20so\x20an\x20order_payer\x20cancel\x20edge\x20from\x20a\x20non-entry\x20prev\x20opens\x20a\x2030-day-style\x20'+'hist(<goal-node>)+N\x20drain\x20window\x20on\x20an\x20already-met\x20campaign\x20—\x20the\x20project\x20schedules\x20production\x20against\x20a\x20total\x20the\x20'+'backer\x20can\x20then\x20claw\x20back.\x20This\x20is\x20the\x20exact\x20face\x20the\x20ksr-tn-261026\x20run\x20proved\x20live\x20(CancelPledge\x20after\x20funded_released\x20'+'moved\x200.05\x20WOW\x20of\x20escrow\x20back\x20to\x20the\x20backer).','suggestion':'Remove\x20the\x20post-goal\x20cancel\x20rail\x20(node\x20+\x20forwards\x20+\x20its\x20refund\x20allocator\x20row).\x20Keep\x20ONE\x20buyer-cancellation\x20path:\x20the\x20'+'PRE-DEADLINE\x20withdrawal\x20from\x20the\x20entry\x20node,\x20gated\x20by\x20lte(context(Clock),\x20identifier[N](campaign_deadline_ms))\x20—\x20the\x20'+'ABSOLUTE\x20shared\x20deadline,\x20the\x20ksrq8-g-withdraw\x20form.\x20After\x20the\x20goal\x20decision\x20the\x20buyer\x27s\x20only\x20remedies\x20are\x20the\x20'+'post-delivery\x20return\x20rail\x20and\x20arbitration.\x20If\x20a\x20variant\x20genuinely\x20needs\x20a\x20cooling-off\x20window,\x20anchor\x20it\x20at\x20'+'min(deadline,\x20release+24h)\x20and\x20disclose\x20it\x20—\x20never\x20a\x20default\x20post-goal\x20window.'});const q=[];for(const G of g){for(const H of G['from']??[]){if(typeof H==='string')continue;if(!/cancel/i['test'](H['forward']??''))continue;const I=H['operator']==='merchant'||typeof H['permission_index']==='number';if(!I)continue;if(!f['test'](G['name'])&&G['semantic_role']!=='cancelled')continue;q['push']((H['prev']||'(entry)')+'\x20--'+(H['forward']??'cancel')+'-->\x20'+G['name']);}}q['length']===0x0&&c['push']({'rule_id':'R-CROWD-CANCEL-NO-RAIL','severity':'high','title':'crowdfunding_mode\x20\x27'+b+'\x27\x20declares\x20a\x20campaign\x20with\x20no\x20permission-gated\x20organizer-cancel\x20rail\x20(batch7\x20T-L)','detail':'Every\x20shipped\x20crowdfunding\x20archetype\x20carries\x20a\x20CREATOR-side\x20cancel\x20rail\x20(CancelCampaign\x20/\x20CancelByLeader,\x20'+'merchant\x20on\x20the\x20dedicated\x20refund-rail\x20slot\x201001,\x20tpl_forward_node_check\x20on\x20the\x20source)\x20that\x20refunds\x20still-escrowed\x20'+'pledges\x20IN\x20FULL\x20through\x20the\x20SAME\x20node-gated\x20refund\x20rail\x20—\x20an\x20absent\x20creator\x20can\x20no\x20longer\x20let\x20the\x20settle_clock\x20'+'auto-release\x20pay\x20an\x20absent\x20project\x20(INV-KTT-LEADERCANCEL)\x20and\x20a\x20backer\x20is\x20never\x20trapped\x20waiting\x20for\x20the\x20creator\x20'+'to\x20act.\x20The\x20rail\x20pays\x20the\x20BACKER\x20(slot\x200),\x20so\x20the\x20creator\x20gains\x20nothing\x20by\x20cancelling\x20—\x20no\x20Q8-F02\x20drain\x20'+'(the\x20buyer-side\x20post-goal\x20cancel\x20face\x20stays\x20covered\x20by\x20R-CROWDFUNDING-CANCEL-RAIL).','suggestion':'Mount\x20an\x20organizer-cancel\x20forward\x20from\x20the\x20campaign\x27s\x20entry/active\x20node(s)\x20into\x20the\x20refund\x20terminal:\x20forward\x20'+'CancelCampaign\x20(or\x20CancelByLeader\x20post-goal),\x20operator\x20merchant\x20+\x20permission_index\x201001\x20(the\x20refund\x20rail,\x20never\x20'+'the\x20settle\x20bucket,\x20W5-14),\x20guard\x20tpl_forward_node_check\x20{\x20expected_node:\x20<source>\x20},\x20landing\x20in\x20the\x20EXISTING\x20'+'node-gated\x20refund\x20terminal\x20—\x20an\x20equivalent\x20exit,\x20not\x20a\x20new\x20refund\x20channel.\x20Mount\x20post-goal\x20exits\x20wherever\x20an\x20'+'active\x20node\x20auto-releases\x20to\x20the\x20project\x20(funded_released\x20/\x20fulfilling),\x20so\x20an\x20absent\x20creator\x20cannot\x20collect.'});if(b==='threshold'){const J=a['guards']??[],K=J['filter'](N=>N['host']==='repository'||/repository_write/i['test'](N['template_id'])),L=K['length']>0x0,M=K['some'](N=>{const O=(N['policy']?.['id_from']??'')['toLowerCase']();return O==='signer'||O==='clock';});if(!L)c['push']({'rule_id':'R-CROWDFUNDING-AGGREGATE','severity':'high','title':'crowdfunding_mode\x20\x27threshold\x27\x20gates\x20release\x20on\x20an\x20aggregate\x20with\x20no\x20write-bound\x20Repository\x20policy\x20(INV-E2)','detail':'The\x20threshold\x20total\x20is\x20an\x20escrow-bound\x20repository\x20sum\x20(query\x201179\x20→\x20U256,\x20per-row\x20min(row,\x20order.amount,\x20LIVE\x20allocation.balance)\x20—\x20v140\x20live\x20cap)\x20over\x20'+'ORDER-keyed\x20contribution\x20rows.\x20With\x20NO\x20write-bound\x20policy\x20the\x20rows\x20are\x20unauthenticated\x20—\x20anyone\x20could\x20inflate\x20'+'the\x20total\x20and\x20fake\x20a\x20\x27goal\x20met\x27\x20(R-X1-17\x20existence-is-not-trust).\x20compile\x20hard-blocks\x20it\x20'+'(CROWDFUNDING_AGGREGATE_UNBOUND);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Mount\x20a\x20host:\x22repository\x22\x20guard\x20resolving\x20pattern.repository_write_authorization\x20with\x20an\x20identity\x20write_guard\x20'+'(order.owner==Signer\x20/\x20order.agent\x20has\x20Signer)\x20and\x20key\x20the\x20contribution\x20rows\x20by\x20the\x20funder\x27s\x20ORDER\x20(policy\x20'+'id_from\x20unset;\x20row\x20id\x20=\x20the\x20Order\x20address).\x20The\x20on-chain\x20policy\x20store\x20only\x20asserts\x20the\x20write_guard\x20LIST\x20is\x20non-empty\x20'+'(E_POLICY_WRITE_GUARD_REQUIRED=22),\x20never\x20what\x20a\x20listed\x20guard\x20proves\x20—\x20a\x20placeholder\x20that\x20returns\x20true\x20is\x20an\x20'+'OPEN\x20write.'});else{if(M){const N=K['filter'](O=>{const P=(O['policy']?.['id_from']??'')['toLowerCase']();return P==='signer'||P==='clock';})['map'](O=>'\x27'+O['key']+'\x27')['join'](',\x20');c['push']({'rule_id':'R-CROWDFUNDING-AGGREGATE','severity':'high','title':'crowdfunding_mode\x20\x27threshold\x27\x20keys\x20contribution\x20rows\x20by\x20the\x20WALLET\x20(id_from\x20signer/clock)\x20on\x20'+N+'\x20—\x20the\x20pre-migration\x20shape\x20(INV-E2,\x20ksc-tn-261024\x20F-01/F-05)','detail':'Wallet-keyed\x20rows\x20feed\x20the\x20escrow-bound\x20sum\x20(query\x201179,\x20per-row\x20min(row,\x20order.amount,\x20LIVE\x20allocation.balance\x20—\x20v140\x20live\x20cap))\x20ZERO\x20—\x20the\x20goal\x20gate\x20'+'silently\x20bricks\x20—\x20and\x20the\x20free-form\x20sum-where\x20(1174)\x20stays\x20self-reported,\x20so\x20a\x20backer\x20can\x20record\x201.0\x20for\x20a\x200.1\x20'+'pledge.\x20compile\x20hard-blocks\x20it\x20(CROWDFUNDING_SIGNER_KEYED_ROWS);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Key\x20the\x20contribution\x20rows\x20by\x20the\x20funder\x27s\x20ORDER:\x20policy\x20id_from\x20unset,\x20the\x20backer\x27s\x20tooling\x20submits\x20the\x20row\x20id\x20=\x20'+'their\x20Order\x20address\x20through\x20the\x20passport-bearing\x20data\x20write,\x20and\x20the\x20gate\x20passes\x20those\x20ORDER\x20addresses\x20as\x20the\x20aggregate\x27s\x20'+'candidate\x20ids.\x20Pair\x20the\x20gate\x20with\x20the\x20live-escrow\x20leg\x20(allocation.balance\x20query\x201051\x20via\x20convert_witness\x20'+'OrderAllocation\x20109,\x20>=\x20order.amount)\x20so\x20a\x20refunded/never-funded\x20order\x20can\x20neither\x20count\x20toward\x20the\x20goal\x20nor\x20be\x20'+'settled.\x20The\x20withdrawal\x20flow\x20should\x20still\x20ZERO\x20the\x20row\x20value\x20(an\x20upsert\x20of\x200\x20through\x20the\x20same\x20write\x20guard)\x20so\x20the\x20'+'valueMin:1\x20aggregate\x20predicate\x20stops\x20counting\x20it\x20—\x20v140\x20live\x20cap\x20already\x20zeroes\x20a\x20drained\x20row\x27s\x20contribution\x20on\x20'+'chain,\x20so\x20zeroing\x20is\x20attestation\x20hygiene,\x20not\x20correctness.'});}}}const s=a['build_notes']??[],w=/(attest|keeper|aggregate trust|read-?only sum|not a chain-?verified|independent recomputation)/i,x=/(not investment|non-?investment|no (?:investment )?return|never promise)/i,y=/(kyc|aml|securities|money-?transmission|regulatory|cross-border|compliance)/i,z=/(no-?refund|non-?refundable|keep-?it-?all)/i,A=[];if(b==='threshold'&&!s['some'](O=>w['test'](O)))A['push']('the\x20aggregate-trust\x20boundary\x20(the\x20funding\x20total\x20is\x20a\x20keeper-attested\x20Repository\x20sum,\x20NOT\x20a\x20chain-verified\x20money\x20oracle)');if(!s['some'](O=>x['test'](O)))A['push']('the\x20L-01\x20non-investment\x20statement\x20(never\x20promise\x20returns\x20/\x20promote\x20coin\x20price;\x20not\x20investment\x20advice\x20or\x20a\x20return\x20promise)');if(!s['some'](O=>y['test'](O)))A['push']('the\x20L-05\x20KYC/AML\x20+\x20cross-border\x20regulatory\x20caution\x20(HIGH\x20intensity)');if(b==='flexible'&&!s['some'](O=>z['test'](O)))A['push']('the\x20flexible\x20keep-it-all\x20NO-REFUND\x20posture\x20(contributions\x20non-refundable\x20once\x20the\x20deadline\x20passes;\x20no\x20refunds)');A['length']>0x0&&c['push']({'rule_id':'R-CROWDFUNDING-DISCLOSURE','severity':'high','title':'crowdfunding_mode\x20\x27'+b+'\x27\x20has\x20build_notes\x20missing\x20honest\x20disclosure(s):\x20'+A['length']+'\x20(INV-E3)','detail':'Missing:\x20'+A['join'](';\x20')+'.\x20A\x20campaign\x20that\x20declares\x20the\x20overlay\x20without\x20these\x20disclosures\x20implies\x20a\x20chain-verified\x20'+'custody\x20proof,\x20an\x20investment\x20return,\x20or\x20a\x20refund\x20the\x20model\x20does\x20not\x20have\x20(L-04/L-01/L-05).\x20compile\x20hard-blocks\x20it\x20'+'(CROWDFUNDING_DISCLOSURE_MISSING);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Add\x20build_notes\x20stating\x20each\x20honestly:\x20the\x20aggregate\x20is\x20a\x20read-only\x20sum\x20over\x20keeper-attested\x20writer-bound\x20rows\x20(not\x20an\x20'+'independent\x20re-computation\x20of\x20every\x20escrow\x20balance);\x20a\x20threshold/flexible\x20raise\x20is\x20NOT\x20an\x20investment\x20(never\x20promise\x20returns\x20or\x20'+'promote\x20coin\x20price);\x20pooled\x20cross-border\x20fundraising\x20is\x20HIGH\x20regulatory\x20intensity\x20(KYC/AML);\x20and\x20for\x20a\x20flexible\x20model,\x20'+'contributions\x20are\x20non-refundable\x20once\x20the\x20deadline\x20passes.'});const B=[...(a['machine_shape']??[])['map'](O=>(O['role']??'')+'\x20'+(O['from']??[])['map'](P=>typeof P==='string'?P:'')['join']('\x20')),...(a['guards']??[])['map'](O=>O['purpose']??''),...a['build_notes']??[],...a['trust_mechanisms']??[],...a['keeper_dependencies']??[],...(a['keeper_duty']??[])['map'](O=>(O['when']??'')+'\x20'+(O['action']??'')),a['allocator']?.['description']??'',a['key_risk']??'']['join']('\x0a'),C=/sum-where|sum_where|1179|1174|escrow-bound aggregate/i['test'](B),D=/1181|sum_where_bound_all|sum-where-BOUND-ALL|ALL-MODE|all-mode/i['test'](B);return b==='threshold'&&C&&!D&&c['push']({'rule_id':'R-ROSTER-IDS-AGGREGATE','severity':'medium','title':'crowdfunding_mode\x20\x27threshold\x27\x20aggregates\x20over\x20a\x20SUBMITTER-controlled\x20candidate\x20roster\x20(1179/1174\x20+\x20b_submission\x20ids)\x20—\x20migrate\x20to\x20the\x20v141\x20ALL-MODE\x20aggregate\x20(ks13\x20ROSTER-01,\x20INV-E4)','detail':'The\x20sum-where\x20forms\x20(query\x201174\x20self-reported\x20/\x201179\x20escrow-bound)\x20read\x20a\x20caller-supplied\x20candidate-ids\x20list\x20'+'(b_submission\x20VecAddress\x20replaced\x20by\x20submission\x20bytes\x20at\x20forward\x20time):\x20whoever\x20advances\x20the\x20gate\x20controls\x20the\x20'+'roster\x20and\x20can\x20understate\x20the\x20raise\x20by\x20omitting\x20live\x20rows\x20—\x20an\x20order_payer\x20abandon\x20edge\x20lets\x20a\x20backer\x20abandon\x20a\x20'+'genuinely\x20funded\x20campaign\x20(the\x20ks13\x20ROSTER-01\x20face).\x20The\x20v141\x20ALL-MODE\x20aggregate\x20(query\x201181,\x20'+'query_repository_data_sum_where_bound_all)\x20derives\x20the\x20candidate\x20set\x20on-chain\x20from\x20the\x20per-key\x20RowRosterKey\x20'+'roster\x20the\x20framework\x20maintains\x20at\x20every\x20data\x20write\x20—\x20omission\x20is\x20structurally\x20impossible\x20and\x20the\x20W5-04\x20pin\x20'+'retires\x20with\x20the\x20ids\x20leg.','suggestion':'Migrate\x20the\x20aggregate\x20leg\x20to\x20query_repository_data_sum_where_bound_all\x20(query\x201181):\x20drop\x20the\x20ids\x20table\x20row\x20and\x20'+'the\x20vec_contains_address\x20pin,\x20keep\x20the\x20per-row\x20clamp\x20and\x20the\x20live-escrow\x20leg.\x20Disclose\x20the\x20three\x20boundaries:\x20'+'VERSION\x20PREREQUISITE\x20(enable_repository_data_sum_bound_all,\x20protocol\x20v141\x20—\x20the\x20query\x20aborts\x20fail-closed\x20while\x20'+'the\x20flag\x20is\x20off),\x20ROSTER\x20CAP\x20(>100\x20rows\x20per\x20key\x20aborts\x20fail-closed),\x20PRE-FLAG\x20ROWS\x20(rows\x20written\x20before\x20the\x20'+'roster\x20shipped\x20contribute\x200\x20—\x20an\x20understate,\x20never\x20an\x20overstate).'}),D&&!(/enable_repository_data_sum_bound_all/i['test'](B)&&/v141|protocol\s+v?141/i['test'](B))&&c['push']({'rule_id':'R-ALLMODE-VERSION-DISCLOSURE','severity':'critical','title':'template\x20references\x20the\x201181\x20ALL-MODE\x20aggregate\x20without\x20disclosing\x20the\x20flag\x20prerequisite\x20(enable_repository_data_sum_bound_all\x20/\x20protocol\x20v141)\x20(INV-E5)','detail':'query\x201181\x20(sum_where_bound_all)\x20is\x20flag-gated:\x20on\x20any\x20binary\x20with\x20enable_repository_data_sum_bound_all\x20OFF\x20'+'(pre-v141\x20protocol)\x20the\x20query\x20ABORTS\x20—\x20every\x20gate\x20built\x20on\x20it\x20fails\x20closed\x20at\x20runtime.\x20A\x20template\x20that\x20'+'references\x20the\x20all-mode\x20aggregate\x20without\x20the\x20version-prerequisite\x20disclosure\x20ships\x20a\x20settlement\x20brick\x20that\x20'+'no\x20authoring-time\x20check\x20catches.','suggestion':'State\x20the\x20prerequisite\x20in\x20the\x20template\x20prose\x20(guard\x20purpose,\x20machine\x20role,\x20build_notes\x20or\x20trust_mechanisms):\x20'+'\x27the\x201181\x20all-mode\x20aggregate\x20is\x20gated\x20by\x20enable_repository_data_sum_bound_all\x20(protocol\x20v141)\x20and\x20aborts\x20'+'fail-closed\x20while\x20the\x20flag\x20is\x20off\x20—\x20verify\x20build_stamp.chain_stamp\x20via\x20upgrade_check\x20before\x20shipping\x27,\x20plus\x20'+'the\x20roster-cap\x20(>100\x20rows\x20per\x20key\x20aborts)\x20and\x20pre-flag-rows\x20(contribute\x200)\x20boundaries.'}),c;}function logisticsModeChecks(a){const b=a['logistics_mode'];if(b===undefined||b==='none')return[];const c=[],d=a['machine_shape']??[],e=d['some'](g=>g['named_operator']!==undefined||(g['from']??[])['some'](h=>typeof h!=='string'&&h['named_operator']!==undefined)),f=a['allocator']?.['rows']??[];if(b==='courier'){if(!e)c['push']({'rule_id':'R-LOGISTICS-COURIER','severity':'high','title':'logistics_mode\x20\x27courier\x27\x20declares\x20dispatched\x20riders\x20with\x20no\x20named_operator\x20handover\x20rail','detail':'A\x20dispatched\x20rider\x20is\x20NEITHER\x20a\x20permission\x20entity\x20NOR\x20the\x20buyer\x20—\x20the\x20only\x20forward\x20they\x20can\x20ever\x20pass\x20is\x20a\x20'+'namedOperator\x20roster\x20rail\x20(roster\x20written\x20per\x20order\x20by\x20the\x20dispatch\x20keeper\x20via\x20permission\x20index\x20221).\x20compile\x20'+'hard-blocks\x20the\x20missing\x20rail\x20(LOGISTICS_COURIER_RAIL_MISSING);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Bind\x20the\x20handover\x20forwards\x20(merchant→courier\x20pickup,\x20courier→buyer\x20drop-off)\x20with\x20named_operator\x20\x27<namespace>\x27\x20'+'and\x20disclose\x20the\x20roster\x20duty\x20in\x20a\x20build_note.\x20For\x20EXCLUSIVE\x20admission\x20—\x20non-roster\x20addresses\x20actually\x20BARRED,\x20not\x20'+'merely\x20members\x20authorized\x20—\x20also\x20mount\x20the\x20kernel\x20roster-membership\x20predicate\x20(query\x201575,\x20protocol\x20v138\x20flag)\x20on\x20'+'both\x20handover\x20edges\x20(template\x20tpl_forward_roster_member_gate);\x20the\x20rail\x20alone\x20AUTHORIZES\x20without\x20denying.\x20Also\x20keep\x20'+'the\x20delivery\x20fee\x20OFF\x20the\x20goods\x20pool:\x20a\x20SURPLUS\x20row\x20in\x20a\x20delivery-fee\x20family\x20drains\x20the\x20buyer\x27s\x20escrow\x20(compile\x20'+'LOGISTICS_COURIER_FEE_POOLED)\x20—\x20use\x20an\x20independent\x20Amount/Rate\x20leg\x20(the\x20fee\x20is\x20known\x20at\x20order\x20time).'});else{const g=/(deliver|courier|shipping|freight|ride|dispatch|logistic)/i,h=f['some'](j=>j['mode']==='surplus'&&g['test']((j['value_from']??'')+'\x20'+(j['recipient_key']??'')));h&&c['push']({'rule_id':'R-LOGISTICS-COURIER','severity':'high','title':'logistics_mode\x20\x27courier\x27\x20has\x20a\x20delivery-fee\x20SURPLUS\x20row\x20draining\x20the\x20goods\x20pool','detail':'A\x20surplus\x20leg\x20takes\x20the\x20remainder\x20of\x20the\x20pool\x20it\x20hangs\x20on\x20—\x20for\x20a\x20courier\x20build\x20that\x20pool\x20IS\x20the\x20buyer\x27s\x20goods\x20'+'escrow\x20(the\x20grab-pool\x20shape\x20the\x20affiliate\x20INV-D3\x20family\x20bans).\x20compile\x20hard-blocks\x20it\x20'+'(LOGISTICS_COURIER_FEE_POOLED);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Make\x20the\x20delivery\x20fee\x20an\x20INDEPENDENT\x20leg:\x20a\x20fixed\x20Amount\x20row\x20(the\x20buyer\x20sees\x20and\x20pays\x20the\x20fee\x20before\x20dispatch)\x20'+'or\x20a\x20Rate\x20row\x20off\x20a\x20dedicated\x20delivery-fee\x20pool\x20funded\x20separately\x20—\x20never\x20a\x20Surplus\x20drain\x20of\x20the\x20goods\x20pool.'});}}if(b==='pickup_point'){const j=(a['guards']??[])['some'](l=>l['template_id']==='pattern.time_lock_absolute'||l['template_id']==='tpl_time_lock_absolute_ms'),k=(a['guards']??[])['some'](l=>l['template_id']==='pattern.time_window_upper_bound'||l['template_id']==='tpl_time_window_upper'||l['template_id']==='tpl_time_window_upper_absolute_ms');(!j||!k)&&c['push']({'rule_id':'R-LOGISTICS-CUTOFF','severity':'high','title':'logistics_mode\x20\x27pickup_point\x27\x20is\x20missing\x20'+(!j?'the\x20absolute\x20batch-cutoff\x20gate':'')+(!j&&!k?'\x20and\x20':'')+(!k?'the\x20unclaimed-goods\x20exit\x20window':''),'detail':'Consolidation\x20batch\x20semantics\x20need\x20BOTH:\x20releases\x20anchor\x20on\x20the\x20SAME\x20shared\x20cutoff\x20clock\x20(per-order\x20entry+duration\x20'+'is\x20not\x20a\x20batch),\x20and\x20goods\x20never\x20picked\x20up\x20must\x20refund/return\x20at\x20a\x20bounded\x20deadline\x20(never\x20hold\x20open-ended).\x20compile\x20'+'hard-blocks\x20it\x20(LOGISTICS_PICKUP_CUTOFF_MISSING);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Add\x20a\x20pattern.time_lock_absolute\x20guard\x20on\x20the\x20batch\x20release\x20forward\x20AND\x20a\x20pattern.time_window_upper_bound\x20guard\x20on\x20'+'the\x20unclaimed-goods\x20refund/return\x20exit.'});}if(b==='carrier'){const l=/(track|shipping evidence|waybill|airbill|carrier record|parcel evidence)/i,m=(a['guards']??[])['some'](n=>n['host']==='machine'&&l['test']((n['key']??'')+'\x20'+n['purpose']));!m&&c['push']({'rule_id':'R-LOGISTICS-EVIDENCE','severity':'high','title':'logistics_mode\x20\x27carrier\x27\x20binds\x20no\x20shipping/tracking\x20evidence\x20guard','detail':'A\x20carrier\x20shipment\x20with\x20no\x20evidence\x20binding\x20has\x20no\x20dispute-ready\x20record\x20of\x20what\x20was\x20shipped\x20and\x20when.\x20The\x20retail\x20'+'idiom\x20(a\x20tracking-hash\x20repository_data_check\x20on\x20the\x20ship\x20forward,\x20written\x20by\x20an\x20authorized\x20writer)\x20is\x20the\x20MANDATORY\x20'+'floor.\x20compile\x20hard-blocks\x20it\x20(LOGISTICS_CARRIER_EVIDENCE_MISSING);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Add\x20a\x20pattern.repository_data_check\x20guard\x20on\x20the\x20ship\x20forward\x20keyed\x20to\x20a\x20tracking-hash\x20row;\x20pair\x20it\x20with\x20'+'pattern.repository_write_authorization\x20so\x20a\x20counterparty\x20cannot\x20pre-write\x20the\x20tracking\x20row.'});}{const n=/(lost|loss|damag|theft)/i,o=w=>w['replace'](/permanently lost/gi,''),p=/(transit loss|lost (?:parcel|package|goods|in transit)|in[- ]transit loss|carrier lost|loss (?:is |)remed|loss route|lost shipment)/i,q=d['some'](w=>n['test'](w['name'])||n['test'](w['role']))||(a['guards']??[])['some'](w=>w['host']==='machine'&&n['test'](o((w['key']??'')+'\x20'+w['purpose']))),s=(a['build_notes']??[])['some'](w=>p['test'](w));!q&&!s&&c['push']({'rule_id':'R-LOGISTICS-TRANSIT','severity':'high','title':'logistics_mode\x20\x27'+b+'\x27\x20has\x20no\x20in-transit\x20loss\x20rail\x20and\x20no\x20loss-remedy\x20disclosure','detail':'Goods\x20can\x20be\x20lost\x20or\x20damaged\x20between\x20handover\x20and\x20acceptance\x20in\x20EVERY\x20physical\x20mode\x20—\x20silence\x20means\x20the\x20buyer\x27s\x20funds\x20'+'strand\x20behind\x20an\x20undeliverable\x20order\x20with\x20no\x20taught\x20route\x20(the\x20STOP-NODE-FUND-EXIT-COVERAGE\x20logistics\x20specialization).\x20'+'compile\x20hard-blocks\x20it\x20(LOGISTICS_TRANSIT_LOSS_UNCOVERED);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Either\x20express\x20the\x20loss\x20waypoint\x20(a\x20lost-parcel\x20record\x20node,\x20or\x20a\x20loss-evidence\x20machine\x20guard)\x20or\x20add\x20a\x20build_note\x20'+'disclosing\x20the\x20remedy\x20route\x20(e.g.\x20the\x20buyer\x27s\x20arbitration\x20path\x20into\x20the\x20refund\x20rail;\x20the\x20carrier\x20claim\x20is\x20an\x20'+'off-chain\x20recovery).'});}if(b==='courier'||b==='pickup_point'){const w=/(dispatch|schedul|no.{0,24}oracle|no on-chain.{0,24}(dispatch|scheduler)|off-chain keeper|keeper.{0,40}dispatch|roster|named.?operator|permission.{0,12}221)/i,x=(a['build_notes']??[])['some'](y=>w['test'](y));!x&&c['push']({'rule_id':'R-LOGISTICS-DISCLOSURE','severity':'high','title':'logistics_mode\x20\x27'+b+'\x27\x20discloses\x20neither\x20dispatch\x20boundary','detail':'The\x20chain\x20has\x20NO\x20dispatch/scheduling\x20primitive\x20(dispatch\x20is\x20an\x20OFF-CHAIN\x20keeper\x20duty;\x20the\x20roster\x20rides\x20permission\x20'+'index\x20221)\x20and\x20NO\x20distance/weight/weather\x20oracle\x20(ETA,\x20route,\x20and\x20dynamic\x20pricing\x20are\x20NOT\x20chain-verifiable).\x20'+'Undisclosed,\x20a\x20builder\x20assumes\x20on-chain\x20dispatch\x20exists\x20and\x20designs\x20a\x20silent\x20brick.\x20compile\x20hard-blocks\x20it\x20'+'(LOGISTICS_DISPATCH_UNDISCLOSED);\x20this\x20is\x20the\x20authoring-time\x20twin.','suggestion':'Add\x20a\x20build_note\x20stating\x20WHO\x20dispatches\x20(the\x20keeper),\x20WHAT\x20the\x20keeper\x20writes\x20(the\x20namedOperator\x20roster,\x20per\x20'+'order/shift,\x20via\x20permission\x20index\x20221),\x20and\x20that\x20ETA/pricing\x20live\x20off-chain.'});}return c;}function allocatorRecipientId(a){return(a['recipient']??'?')+'/'+(a['recipient_key']??'');}function groupBuyBlockerChecks(a){const b=[],c=a['build_notes']??[],d=[...c,a['allocator']?.['description']??'',a['key_risk']??'',...(a['machine_shape']??[])['map'](E=>E['role']??''),...(a['guards']??[])['map'](E=>E['purpose'])],f=a['allocator']?.['rows']??[],g=a['machine_shape']??[],h=numericFeeParam(a['fee_params']??{},/^platform_(commission|take|fee)_bps$/)===0x0||numericFeeParam(a['fee_params']??{},/^(courier_|platform_)?retention_bps$/)===0x2710,j=d['some'](E=>/(?:zero|0%|no)\s+(?:platform\s+)?(?:commission|take|cut|rate)/i['test'](E)),k=f['some'](E=>{if(E['recipient']!=='entity')return![];if(!/^(platform|tool.?fee)/i['test'](E['recipient_key']??''))return![];return typeof E['value']==='number'&&E['value']>0x0;}),l=d['some'](E=>/(?:membership|admission|joining|access)\s+fee|traffic\s+compensat|separately\s+priced|separate\s+fee\s+service/i['test'](E));(h||j)&&k&&!l&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'ZERO_TAKE_RATE_HIDDEN_FEE:\x20a\x20zero-take\x20claim\x20coexists\x20with\x20a\x20positive\x20platform\x20leg\x20and\x20no\x20admission/traffic-compensation\x20disclosure','detail':'The\x20template\x20claims\x20the\x20platform\x20takes\x20nothing\x20while\x20an\x20allocator\x20row\x20still\x20pays\x20a\x20platform\x20Entity\x20—\x20the\x20\x27zero\x20take\x27\x20'+'is\x20only\x20honest\x20when\x20the\x20platform\x27s\x20real\x20income\x20lives\x20on\x20a\x20SEPARATE,\x20separately-priced\x20surface\x20(a\x20membership/admission-fee\x20'+'Service)\x20or\x20is\x20compensated\x20another\x20way\x20(disclosed\x20traffic\x20compensation).\x20Silence\x20here\x20is\x20the\x20hidden-fee\x20pattern\x20the\x20'+'UU\x20errand\x20dossier\x20defined\x20blocker\x20#1\x20for.\x20The\x20shipped\x20benchmark\x20shapes\x20do\x20not\x20fire:\x20their\x20platform\x20legs\x20carry\x20value\x200.','suggestion':'Either\x20zero\x20the\x20platform\x20leg,\x20or\x20add\x20a\x20build_note\x20disclosing\x20WHERE\x20the\x20platform\x27s\x20income\x20comes\x20from\x20(a\x20separately-priced\x20'+'membership/admission-fee\x20Service,\x20or\x20an\x20explicit\x20traffic-compensation\x20arrangement)\x20so\x20the\x20zero-take\x20claim\x20is\x20auditable.'});const n=numericFeeParam(a['fee_params']??{},/^(min|minimum)_order(_price)?$/),o=numericFeeParam(a['fee_params']??{},/^supply(_unit)?_price$/);n!==undefined&&o!==undefined&&o>=n&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'SUPPLY_PRICE_ABOVE_MIN_ORDER:\x20supply_price\x20('+o+')\x20>=\x20min_order_price\x20('+n+')\x20—\x20the\x20reseller\x20margin\x20is\x20negative\x20or\x20zero\x20by\x20construction','detail':'A\x20reseller\x20whose\x20supply\x20price\x20is\x20at\x20or\x20above\x20their\x20minimum-order\x20floor\x20earns\x20nothing\x20on\x20every\x20admissible\x20order,\x20and\x20any\x20'+'fixed\x20fulfillment\x20leg\x20then\x20hard-subtracts\x20past\x20the\x20balance\x20(alloc()\x20asserts\x20balance\x20>=\x20fix,\x20EINSUFFICIENT_BALANCE)\x20—\x20the\x20'+'order\x20can\x20neither\x20settle\x20nor\x20refund.\x20This\x20is\x20the\x20kuaituantuan\x20challenger\x27s\x20CR-02\x20deadlock\x20as\x20a\x20template-data\x20check.','suggestion':'Set\x20supply_price\x20strictly\x20BELOW\x20min_order_price,\x20or\x20drop\x20the\x20reseller\x20overlay\x20—\x20the\x20margin\x20must\x20live\x20strictly\x20between\x20'+'the\x20two\x20numbers.'});const q=numericFeeParam(a['fee_params']??{},/^total_(take|fee|commission)_bps$/),s=numericFeeParam(a['fee_params']??{},/^leader_commission_bps$/),w=numericFeeParam(a['fee_params']??{},/^(platform_fee|platform_commission|platform_tool_fee)_bps$/);if(q!==undefined&&s!==undefined&&w!==undefined){const E=s+w;E!==q&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'TIER_COMMISSION_SUM_MISMATCH:\x20leader_commission_bps\x20('+s+')\x20+\x20platform\x20fee\x20bps\x20('+w+')\x20=\x20'+E+'\x20!=\x20total_take_bps\x20('+q+')','detail':'The\x20tier\x20split\x20(leader\x20share\x20+\x20platform\x20share)\x20is\x20declared\x20as\x20ONE\x20total\x20take;\x20when\x20the\x20two\x20legs\x20do\x20not\x20sum\x20to\x20it,\x20the\x20'+'generation\x20rebalance\x20cannot\x20hold\x20the\x20declared\x20economics\x20and\x20one\x20leg\x20silently\x20drifts.\x20The\x20tier\x20difference\x20is\x20WHO\x20gets\x20'+'how\x20much\x20of\x20the\x20SAME\x20total\x20—\x20never\x20two\x20independent\x20rates.','suggestion':'Make\x20leader_commission_bps\x20+\x20platform_fee_bps\x20equal\x20total_take_bps\x20(or\x20drop\x20total_take_bps\x20and\x20declare\x20the\x20two\x20legs\x20'+'independently\x20with\x20a\x20build_note\x20stating\x20their\x20declared\x20sum).'});}if(n!==undefined){const F=f['filter'](G=>G['track']==='settlement'&&G['mode']==='amount'&&typeof G['value']==='number'&&G['value']>=n);F['length']>0x0&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'FIXED_LEG_EXCEEDS_MIN_ORDER:\x20'+F['length']+'\x20fixed\x20Amount\x20settlement\x20leg(s)\x20>=\x20min_order_price\x20('+n+')\x20—\x20hard\x20deadlock','detail':'A\x20fixed\x20Amount\x20leg\x20at\x20or\x20above\x20the\x20order\x20floor\x20subtracts\x20the\x20WHOLE\x20(or\x20more\x20than\x20the)\x20escrowed\x20total:\x20alloc()\x20asserts\x20'+'balance\x20>=\x20fix,\x20so\x20an\x20order\x20at\x20the\x20floor\x20can\x20neither\x20settle\x20NOR\x20refund\x20—\x20every\x20admissible\x20order\x20deadlocks.\x20This\x20is\x20the\x20'+'taocaicai\x20absolute\x20gate;\x20it\x20precedes\x20the\x20ratio\x20check\x20(#6),\x20which\x20governs\x20sustainability,\x20not\x20liveness.','suggestion':'Reduce\x20the\x20fixed\x20leg\x20strictly\x20below\x20min_order_price\x20(the\x20FULFILLMENT_FIXED_LEG_RATIO\x20bar\x20adds\x20the\x2025-30%\x20'+'sustainability\x20ceiling\x20on\x20top\x20of\x20this\x20liveness\x20floor),\x20or\x20convert\x20it\x20to\x20a\x20Rate\x20leg.'});}if(f['length']>0x0){const G=new Map();for(const I of f){const J=(I['guard_key']??'?')+'::'+allocatorRecipientId(I),K=G['get'](J)??new Set();if(I['mode']==='rate'||I['mode']==='surplus')K['add'](I['mode']);G['set'](J,K);}const H=[...G['entries']()]['filter'](([,L])=>L['has']('rate')&&L['has']('surplus'))['map'](([L])=>L);H['length']>0x0&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'COMMISSION_AND_SURPLUS_COEXIST:\x20recipient(s)\x20'+H['join'](',\x20')+'\x20hold\x20BOTH\x20a\x20Rate\x20leg\x20and\x20a\x20Surplus\x20leg\x20in\x20the\x20SAME\x20allocator','detail':'Rate\x20and\x20Surplus\x20are\x20two\x20different\x20claims\x20on\x20the\x20SAME\x20money:\x20a\x20recipient\x20holding\x20both\x20is\x20paid\x20its\x20rate\x20share\x20AND\x20'+'the\x20residual\x20—\x20the\x20jd-pingpin\x20double-pay.\x20A\x20recipient\x27s\x20claim\x20shape\x20is\x20ONE\x20of\x20the\x20two;\x20the\x20residual\x20either\x20goes\x20to\x20'+'them\x20or\x20it\x20does\x20not.','suggestion':'Split\x20the\x20recipient\x20into\x20two\x20identities\x20(a\x20commission\x20Entity\x20and\x20a\x20residual\x20Entity)\x20or\x20drop\x20one\x20of\x20the\x20legs\x20—\x20never\x20'+'let\x20one\x20identity\x20draw\x20both\x20claim\x20shapes\x20in\x20the\x20same\x20allocator.'});}if(s!==undefined&&w!==undefined){const L=s+w,M=[a['variant'],...c,a['allocator']?.['description']??'']['join']('\x20'),N=[[/fresh|grocery|produce|vegetable|fruit|cold.?chain/i,0xdac,'fresh\x20grocery'],[/prepared|ready.?to.?eat|hot\s?food|deli/i,0x1388,'prepared\x20food'],[/packaged|snack|canned|dry\s?goods|standard goods/i,0x1770,'packaged\x20goods'],[/errand|cleaning|repair|installation/i,0x1f40,'services']];for(const [O,P,Q]of N){if(!O['test'](M))continue;L>P&&b['push']({'rule_id':'R-GB-ALLOC-CONSISTENCY','severity':'high','title':'COMMISSION_EXCEEDS_CATEGORY_MARGIN:\x20leader_commission_bps\x20+\x20platform\x20fee\x20bps\x20=\x20'+L+'\x20>\x20'+P+'\x20('+Q+'\x20ceiling)','detail':'The\x20combined\x20take\x20exceeds\x20the\x20category\x27s\x20margin\x20ceiling\x20—\x20the\x20Meituan\x20Youxuan\x20failure\x20mode:\x20a\x20fulfillment\x20cost\x20'+'structure\x20the\x20take\x20rate\x20cannot\x20carry,\x20so\x20every\x20order\x20LOSES\x20money\x20and\x20volume\x20only\x20accelerates\x20the\x20loss.\x20The\x20ceiling\x20'+'table\x20comes\x20from\x20the\x20dossier\x27s\x20cross-sample\x20margin\x20study\x20(fresh\x203500\x20/\x20prepared\x205000\x20/\x20packaged\x206000\x20/\x20service\x208000).','suggestion':'Bring\x20the\x20combined\x20take\x20to\x20<=\x20'+P+'\x20bps\x20for\x20a\x20'+Q+'\x20build,\x20or\x20move\x20the\x20cost\x20structure\x20(fixed\x20legs,\x20logistics\x20mode)\x20until\x20the\x20unit\x20economics\x20close.'});break;}}const x=f['some'](R=>/leader/i['test'](R['recipient_key']??''));if(a['archetype']==='challenger'&&x){const R=d['some'](S=>{const T=/(?:1002|settl\w+)/i['test'](S)&&/(?:1000|leader)/i['test'](S);if(!T)return![];return/different|distinct|separate|differ|not the same|another address|own address|must not be the same/i['test'](S);});!R&&b['push']({'rule_id':'R-GB-EXIT-AVAILABILITY','severity':'high','title':'CHALLENGER_SETTLER_IS_LEADER:\x20a\x20challenger\x20leader\x20build\x20discloses\x20no\x20distinct-address\x20requirement\x20between\x20the\x20settlement\x20slot\x20and\x20the\x20leader\x20slot','detail':'In\x20the\x20challenger\x20shape\x20the\x20LEADER\x20sources\x20and\x20fulfills;\x20the\x20settlement\x20executor\x20(permission\x20index\x201002)\x20is\x20the\x20'+'counterweight\x20that\x20drives\x20the\x20buyer\x27s\x20two\x20fund\x20exits\x20(the\x20unclaimed/missed\x20refund\x20and\x20the\x20arbitration\x20refund).\x20If\x20'+'the\x20builder\x20binds\x201002\x20to\x20the\x20leader\x27s\x20own\x20address\x20(1000),\x20BOTH\x20exits\x20depend\x20on\x20one\x20party\x27s\x20goodwill\x20—\x20the\x20leader\x20'+'walks\x20away\x20and\x20every\x20buyer\x27s\x20money\x20locks.\x20The\x20template\x20must\x20TEACH\x20the\x20distinctness;\x20it\x20cannot\x20be\x20expressed\x20as\x20a\x20'+'guard\x20(the\x20two\x20slots\x20bind\x20different\x20Permission\x20entities\x20at\x20build\x20time).','suggestion':'Add\x20a\x20build_note:\x20\x27the\x20settling\x20permission\x20slot\x20(1002)\x20MUST\x20be\x20bound\x20to\x20a\x20DIFFERENT\x20address\x20from\x20the\x20leader\x20slot\x20'+'(1000)\x20—\x20bind\x20it\x20to\x20the\x20platform\x27s\x20settlement\x20keeper\x20or\x20an\x20independent\x20operator,\x20never\x20the\x20leader\x27.'});}const y=[];for(const S of g){for(const T of S['from']??[]){if(typeof T==='string')continue;if(!T['named_operator'])continue;const U=T['forward']??'';(/hand.?over/i['test'](U)||/hand.?over/i['test'](S['name']))&&y['push']((T['prev']||'(entry)')+'\x20--'+(U||'advance')+'-->\x20'+S['name']);}}const z=g['some'](V=>(V['from']??[])['some'](W=>typeof W!=='string'&&W['operator']==='order_payer'&&/collect|pick.?up|receipt|confirm/i['test'](W['forward']??V['name'])));y['length']>0x0&&!z&&b['push']({'rule_id':'R-GB-EXIT-AVAILABILITY','severity':'high','title':'LEADER_SELF_HANDOVER_EDGE:\x20'+y['length']+'\x20handover\x20edge(s)\x20with\x20NO\x20buyer-signed\x20collect/receipt\x20edge\x20—\x20the\x20handover\x20signature\x20is\x20the\x20only\x20proof','detail':'A\x20third-party\x20handover\x20whose\x20ONLY\x20evidence\x20is\x20the\x20handover\x20signer\x27s\x20own\x20signature\x20proves\x20nothing\x20when\x20that\x20signer\x20is\x20the\x20'+'party\x20that\x20loses\x20money\x20by\x20admitting\x20a\x20failed\x20handover\x20(the\x20leader\x20self-certifying\x20their\x20own\x20delivery).\x20The\x20narrowed\x20rule\x20'+'(the\x20Amazon\x20Hub\x20Locker\x20correction)\x20fires\x20only\x20when\x20no\x20buyer-signed\x20collect\x20edge\x20exists:\x20with\x20the\x20buyer\x27s\x20own\x20'+'confirmation\x20edge\x20present,\x20the\x20buyer\x27s\x20signature\x20is\x20the\x20STRONGER\x20evidence\x20and\x20the\x20handover\x20edge\x20is\x20auxiliary.','suggestion':'Add\x20a\x20buyer-signed\x20collect/receipt\x20edge\x20(operator\x20order_payer\x20+\x20an\x20identity_check_order_holder\x20guard)\x20from\x20the\x20handover\x20'+'node,\x20or\x20switch\x20the\x20arrival\x20design\x20to\x20the\x20automated/locker\x20variant\x20where\x20the\x20buyer\x27s\x20access-code\x20retrieval\x20is\x20the\x20receipt.'});const A=a['logistics_mode']==='pickup_point'||g['some'](V=>/at_point|pickup|self.?pick/i['test'](V['name'])),B=g['some'](V=>/unclaimed|abandon|refund|withdraw|cancel/i['test'](V['name'])||(V['from']??[])['some'](W=>typeof W!=='string'&&/unclaimed|abandon|refund|withdraw|cancel/i['test'](W['forward']??'')));A&&!B&&b['push']({'rule_id':'R-GB-EXIT-AVAILABILITY','severity':'medium','title':'ABANDON_EXIT_MISSING:\x20a\x20pickup-point\x20fulfillment\x20shape\x20with\x20no\x20abandon-family\x20node/edge','detail':'Goods\x20sitting\x20at\x20a\x20pickup\x20point\x20with\x20no\x20unclaimed-refund\x20/\x20abandon-self-heal\x20exit\x20strand\x20silently:\x20the\x20buyer\x20who\x20never\x20'+'comes,\x20never\x20refunds,\x20and\x20the\x20escrow\x20waits\x20on\x20a\x20keeper\x20timeout\x20this\x20shape\x20does\x20not\x20declare.\x20The\x20GF2-30\x20idiom\x20(the\x20'+'buyer\x20refunds\x20THEMSELVES\x20while\x20the\x20pickup\x20window\x20is\x20open)\x20is\x20the\x20benchmark\x20self-heal;\x20a\x20keeper\x20timeout\x20exit\x20is\x20the\x20'+'fallback.','suggestion':'Add\x20an\x20unclaimed/abandon\x20exit:\x20a\x20buyer\x20self-serve\x20refund\x20edge\x20(order_payer,\x20time_window_upper_bound\x20on\x20the\x20pickup-node\x20'+'entry)\x20or\x20a\x20keeper\x20timeout\x20advance,\x20disclosed\x20in\x20a\x20build_note.'});if(n!==undefined&&n>0x0){const V=f['filter'](Z=>Z['track']==='settlement'&&Z['mode']==='amount'&&typeof Z['value']==='number')['reduce']((Z,a0)=>Z+a0['value'],0x0),W=V/n,X=d['some'](Z=>/overseas|cross.?border|international/i['test'](Z)),Y=X?0.25:0.3;W>Y&&W<=0x1&&b['push']({'rule_id':'R-GB-UNIT-ECONOMICS','severity':W>0.3?'high':'medium','title':'FULFILLMENT_FIXED_LEG_RATIO:\x20fixed\x20Amount\x20settlement\x20legs\x20sum\x20to\x20'+V+'\x20=\x20'+(W*0x64)['toFixed'](0x1)+'%\x20of\x20min_order_price\x20('+n+')\x20>\x20'+(Y*0x64)['toFixed'](0x0)+'%\x20bar','detail':'The\x20fixed\x20fulfillment\x20cost\x20per\x20order\x20exceeds\x20the\x20sustainable\x20share\x20of\x20the\x20order\x20floor\x20—\x20the\x20Meituan\x20Youxuan\x20failure\x20'+'mode\x20at\x20template\x20time:\x20volume\x20scales\x20the\x20LOSS.\x2030%\x20is\x20the\x20domestic\x20bar;\x20an\x20overseas\x20build\x20(cross-border\x20fulfillment\x20'+'costs)\x20carries\x20the\x20tighter\x2025%\x20bar,\x20detected\x20from\x20the\x20template\x27s\x20own\x20overseas\x20disclosure.\x20The\x20absolute\x20liveness\x20gate\x20'+'(FIXED_LEG_EXCEEDS_MIN_ORDER)\x20covers\x20ratio\x20>=\x201;\x20this\x20rule\x20governs\x20the\x20band\x20below\x20it.','suggestion':'Cut\x20the\x20fixed\x20legs\x20below\x20'+(Y*0x64)['toFixed'](0x0)+'%\x20of\x20the\x20floor\x20(subsume\x20them\x20into\x20the\x20goods\x20price\x20as\x20a\x20Rate\x20split),\x20or\x20raise\x20min_order_price\x20to\x20carry\x20them.'});}const C=/\b(never|no|not|don'?t|cannot|must not|avoid|prohibit\w*|forbid\w*|absent|impossible|unenforceable|inexpressible|instead of|rather than|without|discard\w*|drop\w*|refut\w*|considered and DISCARDED)\b/i,D=[];for(const Z of d){for(const a0 of Z['split'](/[.;]/)){if(C['test'](a0))continue;const a1=/\b(multi.?(level|layer|tier)|pyramid|mlm|headhunt\w*|downline|recruit\w*)\b/i['test'](a0)&&/\b(reward|bonus|commission|incentive|rebate|payout)\b/i['test'](a0),a2=/\b(cumulat\w*|accumulat\w*|points?|badges?)\b/i['test'](a0)&&/\b(reward|bonus|payout|earn)\b/i['test'](a0)&&/\b(across|per|every|each|total|count)\b/i['test'](a0),a3=/\b(?:per|for each|every)\s+\d+\s+(?:orders?|referrals?|members?|invites?|signups?|heads?)\b/i['test'](a0);if(a1||a2||a3)D['push'](a0['trim']()['slice'](0x0,0xa0));}}return D['length']>0x0&&b['push']({'rule_id':'R-GB-UNIT-ECONOMICS','severity':'high','title':'TIERED_INCENTIVE_ON_CHAIN:\x20'+D['length']+'\x20affirmative\x20tiered/cumulative/per-head\x20incentive\x20claim(s)\x20the\x20chain\x20cannot\x20express','detail':'The\x20chain\x20expresses\x20a\x20commission\x20as\x20ONE\x20layer,\x20per-order,\x20fixed-ratio\x20(Rate\x20legs).\x20A\x20multi-tier\x20ladder,\x20a\x20cross-order\x20'+'cumulative\x20counter,\x20or\x20a\x20per-head-count\x20payment\x20needs\x20either\x20a\x20cross-order\x20aggregate\x20as\x20a\x20PAYMENT\x20condition\x20(the\x20read-only\x20'+'repository\x20aggregates\x20gate\x20nothing\x20as\x20a\x20payment\x20condition\x20—\x20a\x20guard\x20built\x20on\x20one\x20is\x20permanently\x20unsatisfiable\x20and\x20strands\x20'+'the\x20funding)\x20or\x20cross-order\x20identity\x20bookkeeping\x20no\x20primitive\x20provides.\x20Affirmative\x20claims\x20found:\x20'+D['slice'](0x0,0x3)['join']('\x20|\x20'),'suggestion':'Restructure\x20the\x20incentive\x20to\x20a\x20single-layer\x20per-order\x20Rate\x20leg\x20or\x20a\x20per-order\x20claim\x20Reward;\x20keep\x20multi-tier/cumulative\x20'+'incentives\x20OFF\x20the\x20machine\x20as\x20an\x20off-chain\x20loyalty\x20program,\x20disclosed\x20as\x20such.'}),b;}export function rootHasRewardRecordGate(a){if(a===null||typeof a!=='object')return![];const b=a;if(b['type']==='query_reward_record_exists')return!![];if(b['type']==='query'&&typeof b['query']==='string'&&/^reward\.record[ .](has|count|find|exists_where)/i['test'](b['query']))return!![];if(b['type']==='query'&&typeof b['query']==='number'&&[0x64c,0x64d,0x65a,0x65d]['includes'](b['query']))return!![];for(const c of b['nodes']??[])if(rootHasRewardRecordGate(c))return!![];for(const d of b['and']??[])if(rootHasRewardRecordGate(d))return!![];for(const e of b['or']??[])if(rootHasRewardRecordGate(e))return!![];if(b['node']!==undefined&&rootHasRewardRecordGate(b['node']))return!![];return![];}function subtreeHasOrderAmount(a){if(Array['isArray'](a))return a['some'](subtreeHasOrderAmount);if(a===null||typeof a!=='object')return![];const b=a;if(b['type']==='query'&&b['query']==='order.amount')return!![];if(b['type']==='query'&&b['query']===0x619)return!![];return(b['nodes']??[])['some'](subtreeHasOrderAmount);}export function rootHasPositiveAmountLeg(a){if(a===null||typeof a!=='object')return![];const b=a;if(typeof b['type']==='string'&&/^logic_as_u256_greater/['test'](b['type'])&&subtreeHasOrderAmount(b))return!![];for(const c of b['nodes']??[])if(rootHasPositiveAmountLeg(c))return!![];for(const d of b['and']??[])if(rootHasPositiveAmountLeg(d))return!![];for(const e of b['or']??[])if(rootHasPositiveAmountLeg(e))return!![];if(b['node']!==undefined&&rootHasPositiveAmountLeg(b['node']))return!![];return![];}function rewardZeroOrderChecks(a){const b=(a['guards']??[])['filter'](h=>h['host']==='reward');if(b['length']===0x0)return[];const c=b['some'](h=>{if(!h['template_id']['startsWith']('tpl_'))return![];const j=GUARD_TEMPLATES['find'](k=>k['id']===h['template_id']);return rootHasPositiveAmountLeg(j?.['example_root']);}),d=templateText(a),e=/order\.amount/i['test'](d)&&/positive[- ]amount|zero[- ]?(total|value)|0[- ]?value/i['test'](d);if(c||e)return[];const f=b['map'](h=>h['key']??h['template_id']);return[{'rule_id':'R-REWARD-ZERO-ORDER','severity':'medium','title':'Reward-claim\x20guard(s)\x20['+f['join'](',\x20')+']\x20not\x20positive-amount\x20gated\x20—\x20a\x20zero-total\x20order\x20can\x20mint\x20a\x20reward\x20claim','detail':'A\x20coupon\x20that\x20zeroes\x20the\x20basket\x20(MINUS\x20value\x20>=\x20the\x20SKU\x20price,\x20RATES\x2010000)\x20creates\x20a\x20ZERO-VALUE\x20order:\x20'+'the\x20escrow\x20holds\x200\x20while\x20the\x20order\x20still\x20walks\x20the\x20machine\x20nodes.\x20A\x20claim\x20guard\x20without\x20a\x20positive-amount\x20'+'leg\x20lets\x20that\x20free\x20buy\x20clear\x20the\x20review\x20node\x20and\x20collect\x20the\x20bounty\x20—\x20zero-cost\x20incentive\x20arbitrage\x20'+'(bkmn\x20F-M39/T6).\x20Reward\x20guards\x20are\x20immutable\x20once\x20the\x20Reward\x20object\x20is\x20published,\x20so\x20the\x20leg\x20must\x20be\x20in\x20'+'the\x20design\x20BEFORE\x20publish.\x20The\x20coupon\x20side\x20is\x20floored\x20at\x20issuance\x20(zeroing\x20coupons\x20are\x20blocked\x20'+'unconditionally\x20—\x20BSX-F07:\x20allow_zero_total\x20waives\x20nothing);\x20this\x20leg\x20is\x20the\x20claim-side\x20half\x20of\x20the\x20pair.','suggestion':'Add\x20to\x20every\x20reward\x20claim\x20root,\x20wrapped\x20in\x20logic_and\x20with\x20the\x20identity\x20+\x20replay\x20legs:\x20'+'logic_as_u256_greater_or_equal[query(order.amount),\x20identifier[N](1)]\x20(declare\x20slot\x20N\x20as\x20a\x20static\x20U64\x20'+'value\x201\x20—\x20see\x20tpl_reward_one_time_claim\x20v55\x20notes);\x20or\x20reference\x20a\x20tpl_*\x20guard\x20whose\x20example_root\x20already\x20'+'carries\x20the\x20positive-amount\x20leg;\x20or\x20declare\x20the\x20requirement\x20verbatim\x20in\x20the\x20build\x20notes\x20'+'(order.amount\x20+\x20positive-amount\x20phrasing)\x20so\x20the\x20generated\x20root\x20includes\x20it.'}];}function rewardReplayChecks(a){const b=(a['guards']??[])['filter'](f=>f['host']==='reward');if(b['length']===0x0)return[];const c=b['some'](f=>{if(!f['template_id']['startsWith']('tpl_'))return![];const h=GUARD_TEMPLATES['find'](j=>j['id']===f['template_id']);return rootHasRewardRecordGate(h?.['example_root']);}),d=/query_reward_record_exists/i['test'](templateText(a))||/reward\.record[ .](has|count|find|exists_where)/i['test'](templateText(a))||/reward[ -]record[ -]gate/i['test'](templateText(a));if(c||d)return[];const e=b['map'](f=>f['key']??f['template_id']);return[{'rule_id':'R-REWARD-REPLAY','severity':'high','title':'Reward-claim\x20guard(s)\x20['+e['join'](',\x20')+']\x20not\x20record-gated\x20—\x20the\x20replay\x20defense\x20this\x20template\x20implies\x20does\x20not\x20exist\x20on-chain','detail':'Reward.claim\x20pays\x20Recipient::Signer\x20with\x20no\x20order\x20binding\x20of\x20its\x20own:\x20the\x20armed\x20rail\x20is\x20the\x20record\x20gate\x20—\x20'+'logic_not(query_reward_record_exists(...))\x20inside\x20the\x20claim\x20guard\x20root,\x20forced\x20together\x20with\x20an\x20identity\x20leg\x20'+'(Signer\x20==\x20order.owner).\x20The\x20PRIMARY\x20form\x20is\x20ORDER-SCOPED\x20(where.storeFromId\x20=\x20the\x20submitted\x20Order\x20address\x20slot,\x20'+'the\x20same\x20slot\x20the\x20guard_add\x20entry\x20stamps;\x20azx7-mn-261014\x20live\x20T8)\x20=\x20once\x20per\x20buyer\x20per\x20order;\x20the\x20EMPTY-where\x20'+'variant\x20is\x20the\x20deliberate\x20once-per-buyer-FOR-LIFE\x20choice\x20(upw\x20F-48:\x20it\x20silently\x20kills\x20the\x20buyer\x27s\x20second\x20order).\x20'+'The\x20ofn-mn-261012\x20F-01\x20\x27storeFromId\x20filter\x20is\x20a\x20silent\x20no-op\x27\x20verdict\x20described\x20UNSTAMPED/legacy\x20rewards\x20only\x20—\x20'+'records\x20written\x20without\x20the\x20guard_add\x20entry\x20stamp\x20carry\x20store_from\x20=\x20none\x20and\x20match\x20no\x20storeFromId\x20predicate;\x20the\x20'+'MCP\x20stamp\x20gate\x20(UPW-K7)\x20now\x20rejects\x20unstamped\x20record-consuming\x20entries.\x20This\x20template\x20'+'mounts\x20host:\x22reward\x22\x20claim\x20machinery\x20yet\x20arms\x20it\x20nowhere:\x20no\x20tpl_*\x20guard\x20whose\x20example_root\x20carries\x20the\x20record\x20gate,\x20'+'no\x20prose\x20declaring\x20the\x20idiom.\x20reward_claim_policy\x20is\x20a\x20documentation\x20field\x20with\x20no\x20compile\x20wiring\x20and\x20does\x20NOT\x20arm\x20'+'anything\x20(same\x20ruling\x20as\x20once_per_order\x20/\x20R-ONCE-ARM)\x20—\x20a\x20funded\x20pool\x20behind\x20an\x20un-armed\x20claim\x20guard\x20is\x20a\x20drainable\x20target.','suggestion':'Arm\x20the\x20claim\x20guard\x20root:\x20add,\x20wrapped\x20in\x20logic_and\x20with\x20the\x20identity\x20leg\x20(Signer\x20==\x20order.owner)\x20and\x20the\x20existing\x20'+'state\x20checks,\x20logic_not(query_reward_record_exists(object=<reward\x20object>,\x20where:{storeFromId:{identifier:<order\x20slot>}}))\x20'+'—\x20the\x20SV-2\x20ORDER-SCOPED\x20form\x20(once\x20per\x20buyer\x20per\x20order;\x20swap\x20to\x20an\x20EMPTY\x20where\x20ONLY\x20for\x20a\x20deliberate\x20'+'one-bounty-per-buyer\x20design).\x20The\x20reward.guard_add\x20store_from_id\x20STAMP\x20is\x20the\x20separate,\x20mandatory\x20field:\x20a\x20'+'record-consuming\x20guard\x20must\x20be\x20added\x20with\x20store_from_id\x20=\x20the\x20per-order\x20stamp\x20slot\x20(the\x20submitted\x20Order\x20address,\x20'+'conventionally\x20slot\x200)\x20or\x20the\x20MCP\x20stamp\x20gate\x20rejects\x20the\x20entry.\x20Reference\x20a\x20tpl_*\x20guard\x20whose\x20example_root\x20already\x20'+'carries\x20the\x20order-scoped\x20gate;\x20or\x20declare\x20the\x20idiom\x20verbatim\x20in\x20the\x20'+'build\x20notes\x20so\x20the\x20generated\x20guard\x20root\x20includes\x20it\x20(guard-risk\x20R-X1-14\x20then\x20audits\x20the\x20built\x20guard\x20and\x20flags\x20the\x20'+'un-wrapped\x20pseudo-protection\x20form).\x20Until\x20armed,\x20keep\x20the\x20Reward\x20pool\x20unfunded\x20—\x20an\x20unfunded\x20incentive\x20promise\x20is\x20'+'already\x20blocked\x20at\x20compile\x20(INV-4\x20reward_funding).'}];}function rewardScaleChecks(a){const b=(a['guards']??[])['filter'](d=>d['host']==='reward');if(b['length']===0x0)return[];const c=b['filter'](d=>d['params']!==undefined&&d['params']['reward_claim_amount']!==undefined)['map'](d=>d['key']??d['template_id']);if(c['length']===0x0)return[];return[{'rule_id':'R-REWARD-SCALE','severity':'medium','title':'Reward-claim\x20guard(s)\x20['+c['join'](',\x20')+']\x20hard-pin\x20the\x20per-claim\x20bounty\x20(reward_claim_amount)\x20in\x20template\x20data','detail':'A\x20spec-level\x20reward_claim_amount\x20pin\x20DEFEATS\x20the\x20T-02\x20compile\x20derivation\x20(2%\x20of\x20the\x20cheapest\x20'+'positive\x20SKU,\x20floored\x20at\x201\x20smallest\x20unit)\x20—\x20spec\x20params\x20beat\x20build\x20inputs,\x20so\x20every\x20adopter\x20gets\x20'+'the\x20same\x20fixed\x20bounty\x20regardless\x20of\x20their\x20SKU\x20prices.\x20The\x20shipped\x20templates\x27\x20former\x201000000000\x20'+'pin\x20was\x2050x\x20a\x200.02-WOW\x20SKU:\x20every\x20claimed\x20order\x20paid\x20out\x20more\x20than\x20the\x20sale\x20earned,\x20and\x20no\x20audit\x20'+'flagged\x20it\x20(bsn7-tn-261026).\x20Template-level\x20pins\x20must\x20be\x20conscious\x20economics\x20rulings,\x20not\x20defaults.','suggestion':'Remove\x20the\x20reward_claim_amount\x20param\x20from\x20the\x20guard\x20spec\x20and\x20let\x20compile\x20derive\x20the\x20bounty\x20from\x20'+'the\x20adopter\x27s\x20sales\x20catalog;\x20if\x20a\x20fixed\x20bounty\x20is\x20the\x20template\x27s\x20deliberate\x20economics\x20(e.g.\x20a\x20'+'denominated\x20loyalty\x20point),\x20restate\x20the\x20pin\x20in\x20the\x20build\x20notes\x20WITH\x20the\x20ratio\x20rationale\x20—\x20the\x20'+'plan\x20audit\x20(PLAN-REWARD-SCALE-01)\x20still\x20judges\x20the\x20resulting\x20ratio\x20against\x20the\x20catalog.'}];}function rewardFundedChecks(a){if(a['review_mode']!=='review_reward')return[];const b=Object['keys'](a['fee_params']??{}),c=b['some'](d=>/review_reward_pool|reward_pool/i['test'](d))||/review_reward_pool|reward_pool/i['test'](templateText(a))||a['reward_claim_policy']?.['max_total_per_recipient']!==undefined;if(c)return[];return[{'rule_id':'R-REWARD-FUNDED','severity':'high','title':'review_reward\x20template\x20declares\x20no\x20reward\x20pool\x20surface\x20—\x20an\x20unfunded\x20incentive\x20promise\x20must\x20not\x20publish\x20(INV-4)','detail':'review_mode\x20\x27review_reward\x27\x20promises\x20buyers\x20a\x20claim\x20reward,\x20but\x20the\x20template\x20declares\x20neither\x20a\x20pool\x20'+'fee_param\x20(review_reward_pool)\x20nor\x20a\x20pool-sizing\x20reward_claim_policy\x20cap.\x20At\x20compile\x20the\x20reward_funding\x20'+'input\x20hard-gates\x20the\x20build,\x20so\x20the\x20promise\x20dies\x20at\x20build\x20time\x20—\x20surface\x20the\x20pool\x20plan\x20in\x20the\x20template\x20'+'so\x20the\x20wizard\x20can\x20ask\x20the\x20funding\x20question\x20with\x20real\x20numbers.','suggestion':'Declare\x20a\x20review_reward_pool\x20fee_param\x20(>=\x20expected\x20orders\x20x\x20per-order\x20reward)\x20and\x20fund\x20it\x20at\x20build\x20time\x20'+'via\x20the\x20reward_funding\x20input\x20(sale-time\x20planning:\x20the\x20buyer\x20perceives\x20the\x20funded\x20reward\x20at\x20quote/buy),\x20'+'or\x20set\x20a\x20reward_claim_policy\x20max_total_per_recipient\x20that\x20sizes\x20the\x20pool.'}];}const PROSE_REVIEW_MODE_CLAIM=/(?<!inputs\.)\breview_mode\s*[=:]\s*["']?(none|review|review_reward)\b/gi,PROSE_OFFERING_CONTEXT=/inputs?\b|addable|per[ -]?build|opt[ -]?in|via the input|override/i;function phantomReviewModeFinding(a,b){return{'rule_id':'PROSE-CAPABILITY-01','severity':'high','title':'Build\x20prose\x20claims\x20review_mode=\x27'+a+'\x27\x20but\x20the\x20template\x20declares\x20\x27'+b+'\x27\x20'+'(phantom\x20capability)','detail':'The\x20compiled\x20service\x20is\x20built\x20from\x20the\x20DECLARED\x20review_mode\x20(\x27'+b+'\x27),\x20so\x20a\x20prose\x20'+('claim\x20of\x20\x27'+a+'\x27\x20ships\x20a\x20service\x20without\x20the\x20promised\x20review\x20rail\x20while\x20the\x20build\x20')+'notes\x20tell\x20the\x20merchant\x20(and\x20through\x20them\x20the\x20buyer)\x20it\x20exists\x20—\x20a\x20template-level\x20false\x20'+'promise\x20(bstn-tn-261024\x20F-01:\x20the\x20licensing\x20build\x20note\x20promised\x20a\x20review\x20route\x20the\x20shape\x20'+'could\x20never\x20carry).\x20Compile\x20gates\x20the\x20reviewed\x20node\x20against\x20the\x20declared\x20mode\x20only\x20'+'(REVIEW_NODE_MISSING);\x20it\x20cannot\x20see\x20prose.','suggestion':'Make\x20the\x20prose\x20tell\x20the\x20truth:\x20either\x20set\x20the\x20template\x27s\x20review_mode\x20to\x20\x27'+a+'\x27\x20AND\x20'+'ship\x20the\x20matching\x20shape\x20(reviewed\x20node\x20+\x20rail,\x20reward\x20guards\x20when\x20review_reward),\x20or\x20'+'rewrite\x20the\x20claim\x20as\x20per-build\x20availability\x20—\x20e.g.\x20\x22addable\x20per-build\x20via\x20'+('inputs.review_mode=\x27'+a+'\x27\x22\x20—\x20only\x20where\x20the\x20shape\x20actually\x20supports\x20the\x20addition.')};}function proseCapabilityChecks(a,b=a){const c=a['review_mode']??'none';for(const f of machineProseFields(b)){const g=proseClaim(b,f['address'],'review_mode');if(typeof g==='string'&&g!==c)return[phantomReviewModeFinding(g,c)];}const d=[],e=[...a['build_notes']??[],a['allocator']['description'],...a['trust_mechanisms']??[]];for(const h of e){for(const j of h['split'](/[;\n]/)){const k=[...j['matchAll'](PROSE_REVIEW_MODE_CLAIM)];if(k['length']===0x0||PROSE_OFFERING_CONTEXT['test'](j))continue;for(const l of k){const n=l[0x1]['toLowerCase']();if(n===c)continue;d['push'](phantomReviewModeFinding(n,c));break;}if(d['length']>0x0)return d;}}return d;}function ratingKeyRowIsSubmittedOrder(a){return!!a&&a['value_type']==='Address'&&a['b_submission']===!![];}function ratingKeyIdViolation(a,b){if(a===null||typeof a!=='object')return'row-id\x20parameter\x20missing\x20or\x20malformed';const c=a;if(c['type']==='context'&&c['context']==='Signer')return'row-id\x20keyed\x20on\x20context\x20Signer\x20(the\x20Signer-keyed\x20display\x20row\x20never\x20carries\x20the\x20per-order\x20rating)';if((c['type']==='identifier'||c['type']===undefined)&&typeof c['identifier']==='number'){const d=b['find'](e=>e['identifier']===c['identifier']);if(!ratingKeyRowIsSubmittedOrder(d)){if(!d)return'row-id\x20references\x20table\x20slot\x20'+c['identifier']+'\x20which\x20the\x20table\x20does\x20not\x20declare\x20(dangling\x20read\x20—\x20fails\x20closed)';if(d['value_type']!=='Address')return'row-id\x20resolves\x20to\x20table\x20slot\x20'+c['identifier']+'\x20typed\x20'+d['value_type']+'\x20(a\x20display/text\x20row)\x20instead\x20of\x20the\x20Address-typed\x20submitted\x20order';return'row-id\x20resolves\x20to\x20static\x20table\x20slot\x20'+c['identifier']+'\x20(b_submission=false)\x20—\x20the\x20same\x20row\x20is\x20read\x20for\x20EVERY\x20claim\x20instead\x20of\x20the\x20submitted\x20order';}return null;}return'row-id\x20parameter\x20type\x20\x22'+(c['type']??'unknown')+'\x22\x20is\x20neither\x20the\x20Signer\x20context\x20nor\x20a\x20table\x20identifier';}function ratingKeyReads(a,b,c,d){if(Array['isArray'](a)){for(const f of a)ratingKeyReads(f,b,c,d);return;}if(a===null||typeof a!=='object')return;const e=a;if(e['type']==='vec_contains_address')d['value']=!![];if(e['type']==='query'&&typeof e['query']==='string'&&/^repository\.data( has)?$/i['test'](e['query'])){const g=Array['isArray'](e['parameters'])?e['parameters'][0x1]:undefined,h=ratingKeyIdViolation(g,c);if(h)b['push'](e['query']+':\x20'+h);}if(e['type']==='query_repository_data_keys_where'){const j=e['where']!==null&&typeof e['where']==='object'&&Object['keys'](e['where'])['length']===0x0;if(j)b['push']('query_repository_data_keys_where:\x20EMPTY\x20where\x20—\x20a\x20presence\x20probe\x20with\x20no\x20floor\x20predicate\x20gates\x20presence,\x20not\x20rating');else{const k=ratingKeyIdViolation(e['id'],c);if(k)b['push']('query_repository_data_keys_where:\x20'+k);}}if(e['type']==='query_repository_data_count_where'||e['type']==='query_repository_data_find_where'||e['type']==='query_repository_data_sum_where'||e['type']==='query_repository_data_sum_where_bound'){if(!d['value']){const l=e['ids'],m=l&&typeof l['identifier']==='number'?c['find'](o=>o['identifier']===l['identifier']):undefined;m&&m['b_submission']===!![]&&b['push'](e['type']+':\x20buyer-submitted\x20candidate\x20ids\x20with\x20NO\x20vec_contains_address\x20pin\x20—\x20a\x20padded\x20candidate\x20list\x20borrows\x20another\x20order\x27s\x20row\x20(pin\x20the\x20matched\x20set\x20to\x20the\x20submitted\x20order)');}}for(const o of e['nodes']??[])ratingKeyReads(o,b,c,d);if(e['node']!==undefined)ratingKeyReads(e['node'],b,c,d);}function treeHasVecAddressPin(a){if(Array['isArray'](a))return a['some'](c=>treeHasVecAddressPin(c));if(a===null||typeof a!=='object')return![];const b=a;if(b['type']==='vec_contains_address')return!![];if((b['nodes']??[])['some'](c=>treeHasVecAddressPin(c)))return!![];return b['node']!==undefined&&treeHasVecAddressPin(b['node']);}export function auditRewardRootRatingKey(a,b){const c=[],d={'value':treeHasVecAddressPin(a)};return ratingKeyReads(a,c,b,d),c['map'](e=>String(e));}function rewardRatingKeyChecks(a){const b=(a['guards']??[])['filter'](e=>e['host']==='reward');if(b['length']===0x0)return[];const c=[];for(const e of b){const f=e['template_id'];if(!f?.['startsWith']('tpl_'))continue;const h=GUARD_TEMPLATES['find'](j=>j['id']===f);if(!h?.['example_root'])continue;for(const j of auditRewardRootRatingKey(h['example_root'],h['example_table']??[])){c['push']('['+f+']\x20'+j);}}if(c['length']===0x0)return[];const d=b['map'](k=>k['key']??k['template_id']);return[{'rule_id':'R-REWARD-RATING-KEY','severity':'critical','title':'Reward-claim\x20guard(s)\x20['+d['join'](',\x20')+']\x20gate\x20on\x20wrongly-keyed\x20repository\x20reads\x20—\x20a\x20rating\x20gate\x20that\x20never\x20reads\x20THIS\x20order\x27s\x20rating\x20row\x20(upwk-mn-261017\x20F-62)','detail':'A\x20minimum-rating\x20bounty\x20is\x20ENFORCEABLE\x20only\x20by\x20the\x20CLAIM\x20guard\x20reading\x20the\x20ORDER-KEYED\x20U64\x20rating\x20row\x20'+'(id\x20=\x20the\x20submitted\x20order\x20address,\x20under\x20the\x20compile-emitted\x20\x27rating\x27\x20policy\x20the\x20buyer\x20writes\x20at\x20review\x20'+'time).\x20A\x20Signer-keyed\x20review\x20TEXT\x20row\x20(custom\x20policies;\x20the\x20compile-emitted\x20\x27review\x27\x20default\x20is\x20'+'order-keyed\x20since\x20F09,\x20yfd-ln-261024)\x20is\x20display-only:\x20keying\x20the\x20gate\x20on\x20it\x20either\x20gates\x20nothing\x20'+'(presence\x20of\x20any\x20review)\x20or\x20dead-locks\x20the\x20claim\x20fail-closed\x20(F-62\x20four-layer\x20break:\x20adjudication\x20right,\x20'+'data\x20row\x20missing,\x20template\x20leg\x20missing,\x20scanner\x20blind\x20—\x20this\x20rule\x20closes\x20layer\x204).\x20Violations:\x0a'+c['map'](k=>'\x20\x20-\x20'+k)['join']('\x0a'),'suggestion':'Replace\x20the\x20wrongly-keyed\x20read\x20with\x20the\x20canonical\x20rating\x20leg\x20(tpl_reward_one_time_claim\x20v1.14.0):\x20'+'logic_as_u256_greater_or_equal[query(repository.data,\x20object=<plan-bound\x20\x27_review\x27\x20repository>,\x20'+'parameters=[<rating\x20policy\x20name\x20row>,\x20<SUBMITTED\x20order\x20Address\x20row>]),\x20<floor\x20U64\x20row>]\x20—\x20the\x20row\x20id\x20IS\x20'+'the\x20submitted\x20order\x20(b_submission\x20Address\x20slot);\x20membership\x20probes\x20must\x20carry\x20the\x20floor\x20predicate\x20in\x20'+'their\x20where;\x20candidate-list\x20forms\x20must\x20carry\x20a\x20vec_contains_address\x20pin\x20on\x20the\x20submitted\x20order.\x20Emit\x20'+'the\x20order-keyed\x20rating\x20ROW\x20(compile\x20review\x20component)\x20and\x20this\x20LEG\x20as\x20a\x20pair,\x20or\x20ship\x20neither\x20—\x20a\x20leg\x20'+'without\x20its\x20data\x20row\x20dead-locks\x20the\x20bounty.'}];}function repoDataHasRef(a){if(a['type']==='query'){const c=a['query'];if(typeof c==='string'&&c['trim']()['toLowerCase']()==='repository.data\x20has')return!![];if(c===0x48e||c==='1166')return!![];}const b=a['type'];return typeof b==='string'&&b['toLowerCase']()==='query_repository_data_has';}function subtreeRefsRepoDataHas(a){if(Array['isArray'](a))return a['some'](subtreeRefsRepoDataHas);if(typeof a!=='object'||a===null)return![];const b=a;if(repoDataHasRef(b))return!![];return Object['values'](b)['some'](subtreeRefsRepoDataHas);}export function rootNegatesRepoDataHasTemplateRoot(a){if(Array['isArray'](a))return a['some'](rootNegatesRepoDataHasTemplateRoot);if(typeof a!=='object'||a===null)return![];const b=a;if(b['type']==='logic_not'&&subtreeRefsRepoDataHas(b['node']))return!![];return Object['values'](b)['some'](rootNegatesRepoDataHasTemplateRoot);}function repoWriteOnceIdiomChecks(a){const b=a['guards']??[],c=[];for(const d of b){if(d['host']!=='repository')continue;if(!d['template_id']?.['startsWith']('tpl_'))continue;const e=GUARD_TEMPLATES['find'](f=>f['id']===d['template_id']);if(!e?.['example_root'])continue;rootNegatesRepoDataHasTemplateRoot(e['example_root'])&&c['push']('\x27'+(d['key']??d['template_id'])+'\x27\x20->\x20'+d['template_id']);}if(c['length']===0x0)return[];return[{'rule_id':'R-REPO-WRITE-ONCE-INEFFECTIVE','severity':'critical','title':'Repository\x20write\x20guard(s)\x20['+c['join'](',\x20')+']\x20negate\x20the\x20row-existence\x20probe\x20—\x20the\x20write-once\x20leg\x20is\x20INEFFECTIVE\x20and\x20must\x20not\x20publish','detail':'The\x20write\x20guard\x20is\x20verified\x20INSIDE\x20the\x20same\x20PTB\x20as\x20the\x20write,\x20before\x20the\x20row\x20exists:\x20a\x20logic_not\x20over\x20'+'\x22repository.data\x20has\x22\x20(1166)\x20always\x20evaluates\x20the\x20PRE-write\x20state,\x20so\x20the\x20leg\x20cannot\x20enforce\x20write-once.\x20'+'Mainnet\x20A/B\x20(ofn-mn-261012\x20F-02):\x20the\x20identical\x20guard\x20minus\x20the\x20leg\x20succeeded,\x20and\x20the\x20author\x20then\x20'+'overwrote\x20their\x20own\x205-star\x20review\x20with\x201\x20star.\x20A\x20defence\x20that\x20cannot\x20be\x20enforced\x20is\x20worse\x20than\x20none\x20—\x20'+'the\x20publish\x20gate\x20flags\x20it\x20INEFFECTIVE\x20instead\x20of\x20accepting\x20it.','suggestion':'Drop\x20the\x20negated-existence\x20leg\x20and\x20enforce\x20write-once\x20with\x20a\x20primitive\x20that\x20actually\x20binds:\x20'+'PolicyRule.write_once=true\x20on\x20the\x20target\x20policy\x20(a\x20second\x20write\x20to\x20the\x20same\x20id\x20aborts\x20with\x20repository\x20'+'error\x2024,\x20E_POLICY_WRITE_ONCE_CONFLICT,\x20live-verified\x20amz9-ln-261023),\x20or\x20scope\x20the\x20ONCE(255)\x20submission\x20'+'slot\x20(per\x20guard-pool\x20—\x20pair\x20with\x20the\x20order\x20anchor\x20R-ANCHOR-01)\x20/\x20the\x20254\x20task-binding\x20slot\x20for\x20'+'order-bound\x20rails.'}];}function compoundPayoutChecks(a){const b=templateText(a),c=a['allocator']['rows']??[],d=a['allocator']['refund_track']!==undefined||c['some'](j=>j['track']==='refund')||/refund/i['test'](a['allocator']['description']);if(!d)return[];const e=a['guards']['some'](j=>j['host']==='arbitration')||a['trust_mechanisms']['some'](j=>/^R2\b/['test'](j))||/compensation[_ ]fund/i['test'](b);if(!e)return[];const f=new Set(c['filter'](j=>j['track']==='refund'&&typeof j['guard_key']==='string')['map'](j=>j['guard_key'])),g=j=>j['split'](/[.;]/)['some'](k=>/\brefund/i['test'](k)&&/allocator\s+gate/i['test'](k)),h=a['guards']['filter'](j=>j['key']!==undefined&&f['has'](j['key'])||g(j['purpose']))['map'](j=>j['key']??j['template_id'])['filter']((j,l,m)=>m['indexOf'](j)===l)['join'](',\x20');return[{'rule_id':'R-COMPOUND-01','severity':'low','title':'Dual\x20buyer-remedy\x20rails\x20(escrow\x20refund\x20+\x20compensation\x20fund)\x20—\x20independent\x20tracks,\x20dual\x20payout\x20disclosed\x20(decision\x2011)','detail':'This\x20template\x20carries\x20BOTH\x20buyer-remedy\x20channels:\x20a\x20refund\x20Allocator\x20paying\x20out\x20of\x20the\x20order\x20escrow\x20AND\x20a\x20bound\x20Arbitration\x20'+'paying\x20out\x20of\x20the\x20Service\x27s\x20compensation\x20fund.\x20Decision\x2011:\x20the\x20two\x20tracks\x20are\x20INDEPENDENT\x20—\x20the\x20fund\x20rail\x20pays\x20strictly\x20'+'from\x20node\x20state\x20and\x20never\x20reads\x20order.claimed_by,\x20and\x20the\x20award\x20is\x20the\x20indemnity\x20track\x27s\x20separate\x20commercial\x20payout\x20—\x20so\x20a\x20'+'buyer\x20collecting\x20BOTH\x20is\x20a\x20LEGAL\x20commercial\x20outcome,\x20not\x20a\x20defect:\x20the\x20merchant\x20chose\x20the\x20arbitrator,\x20and\x20the\x20arbitrator\x20'+'rules\x20on\x20the\x20full\x20fund\x20picture.\x20The\x20overlap\x20is\x20disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20(amz9\x20A-1).'+(h!==''?'\x20Refund\x20rail\x20guard(s):\x20['+h+'].':'')+'\x20A\x20claimed_by\x20polarity\x20leg\x20on\x20the\x20fund\x20rail\x20is\x20BANNED\x20(R-FUND-RAIL-CLAIMED-BY\x20critical)\x20—\x20an\x20award\x20must\x20never\x20silence\x20a\x20due\x20escrow\x20refund.','suggestion':'No\x20structural\x20change\x20required.\x20Keep\x20the\x20operational\x20rule:\x20arbitrators\x20read\x20order_fund_facts\x20before\x20finalizing\x20the\x20indemnity,\x20and\x20the\x20'+'netting\x20is\x20release-bound\x20(rex5\x20B-66)\x20—\x20net\x20against\x20payouts\x20released\x20TO\x20THE\x20ORDER\x20(buyer-side\x20refund\x20rail,\x20per\x20Payment\x20record\x20'+'recipients);\x20payouts\x20released\x20to\x20merchant/Entity\x20recipients\x20leave\x20the\x20same\x20deficit\x20while\x20the\x20buyer\x20receives\x20nothing,\x20so\x20the\x20award\x20'+'must\x20NOT\x20be\x20reduced\x20by\x20those.\x20If\x20a\x20template\x20intends\x20a\x20non-monetary\x20remedy\x20instead,\x20say\x20so\x20explicitly\x20in\x20the\x20arbitration\x20proposition\x20wording.'}];}function surplusTrackChecks(a){const b=a['allocator']['rows']??[],c=[],d=b['filter'](h=>h['track']==='refund'&&h['mode']==='surplus'),e=b['filter'](h=>h['track']==='settlement'&&h['mode']==='amount');d['length']>0x0&&e['length']>0x0&&c['push']({'rule_id':'R-SURPLUS-01','severity':'critical','title':'Refund-track\x20Surplus\x20sweeps\x20UNPAID\x20settlement\x20Amounts\x20out\x20of\x20the\x20shared\x20pool','detail':'An\x20order\x20funds\x20ONE\x20pool\x20—\x20`track`\x20is\x20a\x20build-time\x20grouping\x20the\x20chain\x20never\x20sees.\x20The\x20refund\x20row\x20'+'runs\x20Surplus\x20mode,\x20which\x20pays\x20the\x20ENTIRE\x20remaining\x20balance\x20(the\x20on-chain\x20surplus\x20release;\x20template\x20rows\x20cannot\x20set\x20'+'`Allocator.max`,\x20so\x20the\x20sweep\x20is\x20uncapped),\x20while\x20the\x20settlement\x20track\x20still\x20carries\x20fixed\x20Amount\x20obligations\x20'+('('+e['map'](h=>h['recipient_key']??h['recipient'])['join'](',\x20')+').\x20Track\x20guards\x20are\x20independent\x20—\x20a\x20')+'time-locked\x20deposit\x20release\x20does\x20not\x20wait\x20for\x20month-gated\x20rent\x20—\x20so\x20when\x20the\x20refund\x20fires\x20first,\x20the\x20sweep\x20hands\x20'+'the\x20unpaid\x20Amounts\x20to\x20the\x20refund\x20recipient.\x20VERIFIED\x20LIVE\x20on\x20ziroom\x20mainnet\x20T-05:\x20the\x20deposit_back\x20Surplus\x20paid\x20'+'the\x20tenant\x20the\x20deposit\x20PLUS\x20the\x20unreleased\x20rent\x20(585/525\x20in\x20full);\x20the\x20landlord\x20received\x200.','suggestion':'Size\x20the\x20refund\x20leg\x20explicitly:\x20an\x20Amount\x20row\x20pinned\x20to\x20the\x20deposit\x20value\x20(value/value_from),\x20so\x20the\x20payout\x20can\x20'+'never\x20exceed\x20its\x20own\x20scope\x20—\x20or\x20split\x20the\x20two\x20fund\x20scopes\x20into\x20separate\x20Allocation\x20objects\x20so\x20a\x20sweep\x20can\x20only\x20'+'reach\x20its\x20own\x20pool.\x20If\x20an\x20uncapped\x20sweep\x20is\x20truly\x20intended,\x20gate\x20it\x20on\x20a\x20node\x20that\x20provably\x20follows\x20the\x20FINAL\x20'+'settlement\x20release,\x20and\x20state\x20in\x20the\x20template\x20that\x20any\x20obligation\x20unpaid\x20by\x20then\x20is\x20forfeit.'});const f=b['filter'](h=>h['track']==='settlement'&&h['mode']==='surplus'),g=b['filter'](h=>h['track']==='refund'&&h['mode']==='amount');return f['length']>0x0&&g['length']>0x0&&c['push']({'rule_id':'R-SURPLUS-02','severity':'high','title':'Settlement-track\x20Surplus\x20can\x20drain\x20the\x20pool\x20ahead\x20of\x20a\x20fixed-Amount\x20refund','detail':'The\x20settlement\x20sweep\x20(Surplus,\x20uncapped\x20on\x20the\x20on-chain\x20allocation)\x20pays\x20the\x20merchant\x20the\x20entire\x20remainder\x20while\x20'+('the\x20refund\x20track\x20still\x20owes\x20fixed\x20Amounts\x20('+g['map'](h=>h['recipient_key']??h['recipient'])['join'](',\x20')+').\x20')+'If\x20the\x20settlement\x20guard\x20fires\x20while\x20a\x20refund\x20obligation\x20is\x20still\x20open\x20(the\x20tracks\x20are\x20gated\x20independently),\x20the\x20'+'pool\x20is\x20empty\x20when\x20the\x20refund\x20fires\x20and\x20the\x20release\x20aborts\x20on\x20insufficient\x20balance\x20—\x20the\x20buyer\x20'+'remedy\x20is\x20bricked\x20and\x20the\x20merchant\x20keeps\x20money\x20the\x20template\x20declared\x20refundable.','suggestion':'Make\x20the\x20two\x20tracks\x20mutually\x20exclusive\x20by\x20construction\x20(refund\x20fires\x20only\x20from\x20cancel\x20nodes\x20the\x20settlement\x20'+'guard\x20can\x20never\x20reach,\x20and\x20vice\x20versa),\x20or\x20size\x20the\x20refund\x20as\x20a\x20Rate\x20so\x20it\x20degrades\x20to\x20a\x20share\x20instead\x20of\x20'+'aborting.\x20NOTE:\x20there\x20is\x20no\x20on-chain\x20holdback\x20(FACT-ALLOC-03)\x20—\x20do\x20NOT\x20try\x20to\x20\x27reserve\x27\x20the\x20refund\x20Amount\x20'+'via\x20a\x20fix\x20value;\x20split\x20the\x20two\x20fund\x20scopes\x20into\x20separate\x20Allocation\x20objects\x20if\x20isolation\x20is\x20required.'}),c;}const BRANCH_STATE_REGEX=/(cancel|return|withdraw|exit|expired)/i;function amountDeadlockChecks(a){const b=a['allocator']['rows']??[],c=b['filter'](f=>f['track']==='settlement');if(c['length']===0x0||!c['every'](f=>f['mode']==='amount'))return[];const d=[a['allocator']['description'],...a['build_notes'],...a['trust_mechanisms'],...a['guards']['map'](f=>f['template_id']+'\x20'+f['purpose'])]['join']('\x20\x0a\x20'),e=Object['keys'](a['fee_params'])['some'](f=>MIN_PRICE_KEY_REGEX['test'](f))||FLOOR_TEXT_REGEX['test'](d);if(e)return[];return[{'rule_id':'R-DEADLOCK-01','severity':'medium','title':'Settlement\x20track\x20is\x20ALL\x20fixed\x20Amount\x20—\x20an\x20under-funded\x20pool\x20deadlocks\x20permanently','detail':'Every\x20settlement\x20row\x20is\x20mode\x20\x27amount\x27\x20('+c['length']+'\x20row(s));\x20each\x20asserts\x20balance\x20>=\x20fix\x20at\x20release\x20'+'(the\x20on-chain\x20balance\x20assert).\x20When\x20the\x20pool\x20is\x20smaller\x20than\x20the\x20pinned\x20leg\x20—\x20a\x20discount\x20code,\x20a\x20low-price\x20SKU,\x20a\x20'+'partially-funded\x20order\x20—\x20the\x20call\x20aborts\x20and\x20NO\x20later\x20call\x20can\x20settle\x20a\x20smaller\x20amount:\x20the\x20merchant\x27s\x20payout\x20'+'path\x20is\x20bricked\x20for\x20that\x20order\x20(ziroom\x20CR-02:\x20fixed\x20Amount\x20legs\x20+\x20a\x20cheap\x20SKU\x20=\x20permanent\x20settlement\x20abort).\x20'+'Rate\x20and\x20Surplus\x20legs\x20degrade\x20to\x20whatever\x20the\x20pool\x20actually\x20holds;\x20Amount\x20legs\x20cannot.','suggestion':'Carry\x20at\x20least\x20one\x20Rate/Surplus\x20leg\x20as\x20the\x20degradation\x20path\x20(e.g.\x20the\x20merchant\x20remainder\x20as\x20Rate).\x20'+'If\x20the\x20fixed\x20legs\x20are\x20the\x20design\x20(staged\x20tuition,\x20per-session\x20releases),\x20the\x20BUY\x20path\x20already\x20enforces\x20'+'order\x20>=\x20the\x20fixed-leg\x20SUM\x20per\x20order\x20(the\x20b6-11-family\x20fixed-leg\x20gate,\x20error\x20'+'order_below_fixed_leg_sum\x20—\x20a\x20discounted\x20order\x20is\x20rejected\x20before\x20any\x20money\x20moves),\x20so\x20the\x20template-side\x20'+'duty\x20narrows\x20to\x20pricing\x20every\x20SKU\x20at\x20or\x20above\x20the\x20fixed-leg\x20sum\x20(state\x20that\x20floor\x20in\x20fee_params)\x20—\x20a\x20SKU\x20'+'below\x20the\x20floor\x20could\x20never\x20complete\x20a\x20sale.'}];}const DISCOUNT_FIXED_KEY_REGEX=/(?:discount|coupon)[a-z0-9_]*(?:value|amount)/i,DISCOUNT_RATE_KEY_REGEX=/(?:discount|coupon)[a-z0-9_]*(?:rate_bps|bps|percent)/i,DISCOUNT_ISSUANCE_PROSE_REGEX=/create a discount|discount object|coupon handoff|run promotions|(?:mint|issue)\s+(?:a\s+|the\s+)?coupon|first-order discount/i,TIER_VARIANT_REGEX=/\btiers?\b|\bvariants?\b|\bpackages?\b|\bplans?\b/i;function numericFeeParam(a,b){const c=Object['keys'](a)['find'](d=>b['test'](d)&&typeof a[d]==='number');return c!==undefined?a[c]:undefined;}function railValue(a,b){if(typeof a['value']==='number')return a['value'];if(typeof a['value']==='string'&&/^\d+(\.\d+)?$/['test'](a['value']['trim']()))return Number(a['value']);if(a['value_from']!==undefined){const d=b[a['value_from']];if(typeof d==='number')return d;if(typeof d==='string'&&/^\d+(\.\d+)?$/['test'](d['trim']()))return Number(d);}const c=a['value_from_complement'];if(c!==undefined){const e=b[c],f=typeof e==='number'?e:typeof e==='string'&&/^\d+(\.\d+)?$/['test'](e['trim']())?Number(e):NaN;if(Number['isFinite'](f))return 0x2710-f;}return null;}function railRepeats(a,b){const c=a['repeat_from'];if(c===undefined)return 0x1;const d=b[c],e=typeof d==='number'?d:typeof d==='string'&&/^\d+$/['test'](d['trim']())?Number(d):NaN;return Number['isInteger'](e)&&e>0x0?e:null;}function discountRailScaleChecks(a){const b=a['fee_params'],c=(a['allocator']['rows']??[])['filter'](n=>n['track']==='settlement'&&n['mode']==='amount');if(c['length']===0x0)return[];const d=numericFeeParam(b,DISCOUNT_FIXED_KEY_REGEX),e=numericFeeParam(b,DISCOUNT_RATE_KEY_REGEX),f=DISCOUNT_ISSUANCE_PROSE_REGEX['test'](templateText(a));if(d===undefined&&e===undefined&&!f)return[];const h=Object['keys'](b)['find'](n=>MIN_PRICE_KEY_REGEX['test'](n)&&typeof b[n]==='number'),j=h!==undefined?b[h]:undefined;let k;if(j!==undefined&&d!==undefined)k=Math['max'](0x0,j-d);else{if(j!==undefined&&e!==undefined)k=j*(0x2710-Math['min'](e,0x2710))/0x2710;}const l=n=>TIER_VARIANT_REGEX['test']((n['note']??'')+'\x20'+(n['guard_key']??'')),m=new Map();if(c['length']>=0x2&&c['every'](l))for(const n of c){const o=n['guard_key']??n['recipient_key']??'row/'+n['recipient'],p=m['get'](o)??{'label':o,'sum':0x0,'resolvable':!![]},q=railValue(n,b),s=railRepeats(n,b);if(q===null||s===null)p['resolvable']=![];else p['sum']+=q*s;m['set'](o,p);}else{let w=0x0,x=!![];for(const y of c){const z=railValue(y,b),A=railRepeats(y,b);if(z===null||A===null)x=![];else w+=z*A;}m['set']('settlement',{'label':'settlement','sum':w,'resolvable':x});}if(k!==undefined){const B=[...m['values']()]['filter'](C=>C['resolvable']&&C['sum']>k);if(B['length']>0x0)return[{'rule_id':'R-FAMT-SCALE','severity':'critical','title':'Absolute\x20Amount\x20rails\x20exceed\x20the\x20minimum\x20post-discount\x20payable\x20('+B['map'](C=>C['label']+':\x20'+C['sum']+'\x20>\x20'+k)['join'](';\x20')+')','detail':'This\x20template\x20combines\x20ABSOLUTE\x20Amount\x20rails\x20with\x20a\x20discount\x20configuration,\x20and\x20the\x20arithmetic\x20is\x20'+('resolvable\x20at\x20build\x20time:\x20minimum\x20order\x20value\x20'+j+'\x20('+h+')\x20minus\x20the\x20discount\x20leaves\x20'+k+',\x20')+'while\x20the\x20settlement\x20Amount\x20rail(s)\x20named\x20above\x20sum\x20to\x20more\x20(a\x20leg\x20declaring\x20repeat_from\x20counts\x20once\x20per\x20'+'unit\x20—\x20the\x20tail\x20fire\x20is\x20the\x20one\x20that\x20strands).\x20On\x20chain\x20the\x20order\x20escrows\x20the\x20POST-discount\x20'+'total\x20(the\x20on-chain\x20discounted-quote\x20computation)\x20and\x20every\x20Amount\x20leg\x20asserts\x20balance\x20>=\x20fix\x20at\x20release\x20'+'on\x20chain\x20—\x20the\x20LAST\x20rail\x20to\x20fire\x20aborts\x20mid-workflow\x20and\x20the\x20order\x20strands\x20with\x20its\x20remaining\x20'+'pool.\x20Machines\x20and\x20allocators\x20are\x20immutable\x20after\x20publish:\x20no\x20late\x20repair\x20exists.\x20Offending\x20rail\x20'+('scope(s)\x20(each\x20tier\x20judged\x20on\x20its\x20own\x20selected\x20variant,\x20not\x20the\x20first\x20row):\x20'+B['map'](C=>C['label'])['join'](',\x20')+'.'),'suggestion':'Shrink\x20the\x20rails\x20to\x20fit\x20the\x20discounted\x20floor\x20('+B['map'](C=>C['label']+'\x20<=\x20'+k)['join'](',\x20')+'),\x20or\x20'+'express\x20the\x20rails\x20as\x20Rate/RateGross\x20legs\x20which\x20degrade\x20to\x20whatever\x20the\x20discounted\x20pool\x20actually\x20holds.\x20A\x20'+'percentage\x20discount\x20keeps\x20rails\x20payable\x20only\x20when\x20the\x20rails\x20are\x20percentage-based\x20too.'}];if([...m['values']()]['every'](C=>C['resolvable']))return[];}return[{'rule_id':'R-FAMT-SCALE','severity':'medium','title':'Absolute\x20Amount\x20rails\x20combined\x20with\x20a\x20discount\x20—\x20the\x20tail\x20rail\x20can\x20strand\x20when\x20the\x20discounted\x20total\x20undercuts\x20the\x20rails','detail':'This\x20template\x20directs\x20the\x20build\x20to\x20attach\x20a\x20Service-side\x20discount\x20(coupon)\x20while\x20its\x20settlement\x20track\x20carries\x20fixed\x20'+'Amount\x20rails.\x20The\x20order\x20escrows\x20the\x20POST-discount\x20total\x20(the\x20on-chain\x20discounted-quote\x20computation)\x20and\x20every\x20'+'Amount\x20leg\x20asserts\x20balance\x20>=\x20fix\x20at\x20release\x20(on-chain\x20balance\x20assert),\x20so\x20whenever\x20the\x20discounted\x20payable\x20falls\x20below\x20'+'the\x20rail\x20sum\x20the\x20LAST\x20rail\x20aborts\x20and\x20the\x20order\x20strands\x20—\x20unrepairable\x20after\x20publish.\x20The\x20minimum\x20post-discount\x20'+'payable\x20cannot\x20be\x20resolved\x20at\x20build\x20time\x20here\x20(the\x20order\x20value\x20is\x20a\x20merchant\x20runtime\x20input\x20such\x20as\x20the\x20SKU\x20price,\x20'+'or\x20the\x20discount\x20magnitude\x20is\x20declared\x20only\x20in\x20prose,\x20or\x20a\x20repeated\x20release\x20names\x20a\x20count\x20key\x20that\x20does\x20not\x20'+'resolve\x20to\x20a\x20positive\x20integer),\x20so\x20the\x20scale\x20cannot\x20be\x20proven\x20safe\x20statically.\x20RUNTIME\x20'+'ENFORCEMENT\x20FACE:\x20this\x20advisory\x20does\x20NOT\x20mean\x20the\x20shape\x20ships\x20unguarded\x20—\x20the\x20buy\x20path\x20carries\x20the\x20fixed-leg\x20'+'completion\x20gate\x20(order_below_fixed_leg_sum,\x20b6-11\x20family):\x20it\x20computes\x20the\x20minimum\x20completion-route\x20fixed-leg\x20'+'sum\x20for\x20THIS\x20machine\x20(completion\x20routes\x20only\x20—\x20refund/cancel\x20early-exit\x20routes\x20are\x20excluded,\x20yfd-ln-261024\x20F04)\x20'+'and\x20rejects\x20the\x20buy\x20before\x20any\x20money\x20moves\x20when\x20the\x20discounted\x20payable\x20cannot\x20cover\x20it.\x20With\x20that\x20gate\x20live\x20the\x20'+'residual\x20exposure\x20is\x20buy-time\x20rejections\x20(a\x20coupon\x20priced\x20below\x20the\x20rail\x20sum\x20makes\x20orders\x20unbuyable\x20—\x20a\x20merchant\x20'+'UX\x20problem),\x20not\x20escrow\x20stranding;\x20the\x20MCP-side\x20gate\x20is\x20an\x20enforcement\x20courtesy,\x20not\x20a\x20chain\x20invariant,\x20so\x20a\x20'+'build\x20that\x20bypasses\x20the\x20buy\x20tool\x20face\x20still\x20strands.','suggestion':'Prefer\x20percentage-based\x20rails:\x20express\x20the\x20settlement\x20legs\x20as\x20Rate/RateGross\x20(which\x20degrade\x20to\x20whatever\x20the\x20'+'discounted\x20pool\x20holds)\x20instead\x20of\x20fixed\x20Amounts\x20—\x20or\x20pin\x20BOTH\x20sides\x20machine-checkably\x20(a\x20numeric\x20min_*\x20'+'order-value\x20floor\x20in\x20fee_params\x20plus\x20a\x20numeric\x20discount\x20magnitude\x20key)\x20so\x20the\x20build-time\x20scale\x20check\x20can\x20run.\x20'+'Otherwise\x20keep\x20the\x20discount\x20budget\x20documented\x20so\x20the\x20merchant\x20prices\x20coupons\x20above\x20the\x20rail\x20sum\x20(the\x20buy-path\x20'+'order_below_fixed_leg_sum\x20gate\x20will\x20otherwise\x20reject\x20discounted\x20orders\x20one\x20by\x20one\x20—\x20correct,\x20but\x20the\x20merchant\x20'+'should\x20learn\x20it\x20from\x20this\x20report,\x20not\x20from\x20failed\x20buys).'}];}function cancelCoverageChecks(a){const b=a['allocator']['rows']??[];if(b['some'](d=>d['track']==='refund'))return[];if(a['allocator']['refund_track']!==undefined)return[];const c=a['machine_shape']['find'](d=>BRANCH_STATE_REGEX['test'](d['name']));if(!c)return[];return[{'rule_id':'R-CANCEL-01','severity':'high','title':'Machine\x20models\x20\x27'+c['name']+'\x27\x20but\x20the\x20allocator\x20has\x20NO\x20refund-track\x20rows\x20—\x20money\x20locks\x20on\x20that\x20path','detail':'The\x20machine\x20shape\x20carries\x20a\x20cancel/return/exit\x20state,\x20yet\x20no\x20allocator\x20row\x20pays\x20on\x20the\x20refund\x20track.\x20Text-level\x20'+'claims\x20(guard\x20purposes,\x20allocator\x20description)\x20may\x20still\x20say\x20\x27refund\x27,\x20but\x20on\x20chain\x20only\x20rows\x20move\x20money:\x20an\x20'+'order\x20that\x20reaches\x20this\x20state\x20keeps\x20its\x20escrow\x20with\x20no\x20rail\x20out\x20(ofn\x20#P-02:\x20the\x20subscription\x20template\x27s\x20refund\x20'+'rails\x20missed\x20closed_cancel\x20and\x200.5\x20WOW\x20locked\x20permanently;\x20verified\x20live).','suggestion':'Add\x20refund-track\x20rows\x20covering\x20EVERY\x20cancel-ish\x20terminal\x20(order-anchored\x20GuardIdentifier(0)\x20recipient,\x20'+'Rate-sized\x20with\x20the\x20group\x20summing\x2010000),\x20or\x20remove\x20the\x20state\x20from\x20the\x20machine\x20so\x20orders\x20can\x20never\x20enter\x20it.'}];}function redundGuardObjectMismatchChecks(a){const b=a['allocator']['rows']??[],c=b['filter'](h=>h['track']==='refund'&&h['recipient']==='guard_identifier');if(c['length']===0x0)return[];const d=new Set(c['map'](h=>h['guard_key'])['filter'](h=>typeof h==='string')),e=a['guards']['some'](h=>h['key']!==undefined&&d['has'](h['key'])&&(/arb/i['test'](h['template_id'])||/arb\.(?:indemnity|order|winner|status|ruling|case)/i['test'](h['purpose'])));if(!e)return[];const f=templateText(a),g=/two[- ]slot|slot\s*0.*order|slot\s*1.*arb|arb\.order.*==|for_object.*binding/i['test'](f);if(g)return[{'rule_id':'REDUND-GUARD-OBJECT-MISMATCH','severity':'low','title':'Arb-refund\x20guard\x20uses\x20two-slot\x20design\x20(Order\x20+\x20Arb)\x20—\x20self-certifying\x20pair','detail':'The\x20template\x20carries\x20a\x20refund\x20allocator\x20row\x20with\x20a\x20GuardIdentifier\x20recipient\x20AND\x20an\x20arbitration-ruling\x20guard.\x20'+'The\x20two-slot\x20design\x20(slot\x200\x20=\x20Order\x20for\x20the\x20allocator\x20recipient,\x20slot\x201\x20=\x20Arb\x20for\x20the\x20ruling\x20state)\x20is\x20the\x20'+'correct\x20resolution\x20of\x20the\x20F-02\x20slot\x20conflict:\x20the\x20allocator\x20reads\x20slot\x200\x20(payment_info.for_object\x20binding),\x20'+'the\x20forward\x20reads\x20slot\x201\x20(arb.indemnity\x20state),\x20and\x20the\x20binding\x20assertion\x20query(\x22arb.order\x22,\x20slot1)\x20==\x20slot0\x20'+'makes\x20the\x20pair\x20self-certifying\x20against\x20redirect\x20attacks.','suggestion':'Verify\x20the\x20guard\x20is\x20tpl_forward_arb_ruling_won\x20(two-slot\x20form)\x20or\x20an\x20equivalent\x20custom\x20guard\x20with\x20the\x20same\x20'+'slot\x20layout\x20and\x20binding\x20assertion.\x20Single-slot\x20arb-refund\x20guards\x20are\x20unreachable\x20(F-02).'}];return[{'rule_id':'REDUND-GUARD-OBJECT-MISMATCH','severity':'high','title':'Arb-refund\x20guard\x20may\x20use\x20a\x20SINGLE\x20slot\x20—\x20unreachable\x20rail\x20(F-02)','detail':'The\x20template\x20carries\x20a\x20refund\x20allocator\x20row\x20with\x20a\x20GuardIdentifier\x20recipient\x20AND\x20an\x20arbitration-ruling\x20guard,\x20'+'but\x20the\x20template\x20text\x20does\x20not\x20mention\x20the\x20two-slot\x20design.\x20A\x20single-slot\x20guard\x20cannot\x20satisfy\x20both\x20consumers:\x20'+'the\x20forward\x20needs\x20the\x20Arb\x20object\x20(to\x20read\x20arb.indemnity),\x20while\x20the\x20allocator\x20recipient\x20GuardIdentifier(0)\x20needs\x20'+'the\x20Order\x20object\x20(payment_info.for_object\x20binding).\x20F-02\x20verified\x20live:\x20Order\x20address\x20→\x20forward\x20aborts;\x20Arb\x20address\x20'+'→\x20allocation\x20aborts\x2015\x20(ERECIPIENT_NOT_FOR_OBJECT).\x20The\x20escrow\x20strands\x20permanently\x20with\x20no\x20on-chain\x20exit.','suggestion':'Use\x20tpl_forward_arb_ruling_won\x20(two-slot\x20form:\x20slot\x200\x20=\x20Order,\x20slot\x201\x20=\x20Arb,\x20with\x20arb.order\x20==\x20order\x20binding),\x20'+'or\x20document\x20the\x20two-slot\x20design\x20explicitly\x20in\x20the\x20template\x20build_notes.\x20A\x20single-slot\x20arb-refund\x20guard\x20is\x20'+'unreachable\x20by\x20construction\x20(F-02).'}];}function zeroAmountGuardChecks(a){const b=templateText(a),c=/zero[- ]amount|0[ -]?amount|free[^a-z]|price\s*=\s*0|amount\s*>\s*0|min_booking_amount/i['test'](b)||/no[- ]charge|gratis|complimentary/i['test'](b);if(c)return[];const d=new Set((a['allocator']['rows']??[])['map'](f=>f['guard_key'])['filter'](f=>typeof f==='string')),e=a['guards']['some'](f=>f['host']==='machine'&&!(f['key']!==undefined&&d['has'](f['key']))&&(/claimed_by|allocation|payment\s|alloc\b/i['test'](f['template_id'])||/claimed_by|allocation|payment\s|alloc\b/i['test'](f['purpose']))&&!/refund|pro-?rata|staged[_ -]?release|recovery|polarity/i['test'](f['template_id']+'\x20'+f['purpose']));if(!e)return[];return[{'rule_id':'D7-ZERO-AMOUNT-GUARD','severity':'medium','title':'Machine\x20progress\x20guards\x20may\x20depend\x20on\x20allocator\x20events\x20—\x20zero-amount\x20orders\x20deadlock','detail':'The\x20protocol\x20does\x20NOT\x20create\x20an\x20Allocation\x20for\x20a\x20zero-amount\x20order\x20(amount\x20>\x200\x20is\x20required).\x20'+'A\x20zero-amount\x20order\x20therefore\x20has\x20NO\x20claimed_by,\x20NO\x20payment\x20history,\x20and\x20NO\x20allocation\x20balance.\x20'+'This\x20template\x20carries\x20machine\x20guards\x20that\x20reference\x20allocator-dependent\x20state\x20(claimed_by\x20/\x20allocation\x20/\x20payment),\x20'+'but\x20the\x20template\x20does\x20NOT\x20explicitly\x20exclude\x20zero-amount\x20items.\x20A\x20zero-amount\x20order\x20can\x20never\x20satisfy\x20such\x20a\x20guard\x20'+'and\x20deadlocks\x20at\x20the\x20node\x20with\x20no\x20exit.','suggestion':'Either\x20(a)\x20exclude\x20zero-amount\x20items\x20explicitly\x20(e.g.\x20min_booking_amount,\x20amount\x20>\x200\x20in\x20build_notes),\x20or\x20'+'(b)\x20redesign\x20progress\x20guards\x20to\x20use\x20order-native\x20signals\x20(order.time,\x20signer,\x20progress.current,\x20Repository\x20data)\x20'+'instead\x20of\x20allocator-derived\x20state,\x20so\x20zero-amount\x20orders\x20can\x20still\x20advance.'}];}function terminalRailCoverageChecks(a){const b=a['machine_shape'];if(b['length']===0x0||!b['some'](y=>(y['from']??[])['length']>0x0))return[];const c=a['allocator']['rows']??[];if(c['length']===0x0)return[];const d=[...a['guards']['map'](y=>y['purpose']),...c['map'](y=>y['note']??'')];if(!d['some'](y=>/current\s*==/i['test'](y)))return[];const f=a['allocator']['description']??'',g=new Set();for(const y of b){for(const z of y['from']??[]){const A=typeof z==='string'?z:z?.['prev'];if(A)g['add'](resolveSegmentToken(a,A));}}const h=b['filter'](B=>!g['has'](B['name']));if(h['length']===0x0)return[];const j=B=>B['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),k=B=>{const C=new RegExp('current\x5cs*==\x5cs*[\x22\x27]?'+j(B)+'\x5cb','i');if(a['guards']['some'](E=>C['test'](E['purpose'])))return!![];if(c['some'](E=>E['note']!==undefined&&C['test'](E['note'])))return!![];const D=new RegExp('\x5cb'+j(B)+'\x5cb','i');if(a['guards']['some'](E=>D['test'](E['purpose'])))return!![];if(c['some'](E=>E['note']!==undefined&&D['test'](E['note'])))return!![];return D['test'](f);},l=B=>/pool is empty|pool drains?ed|drains? in full|already (?:released|paid)|escrow (?:is )?(?:empty|drained)/i['test'](B),n=h['filter'](B=>!k(B['name'])&&!l(B['role']))['map'](B=>'\x27'+B['name']+'\x27'),o=/cancel|refund|return|withdraw|compensat/i,p=/refund|repay|chargeback|compensat/i,q=B=>B['semantic_role']==='cancelled'||o['test'](B['name']),s=B=>{const C=new RegExp('current\x5cs*==\x5cs*[\x22\x27]?'+j(B)+'\x5cb','i'),D=new RegExp('\x5cb'+j(B)+'\x5cb','i');if(c['some'](E=>E['track']==='refund'&&(C['test'](E['note']??'')||D['test'](E['note']??''))))return!![];return a['guards']['some'](E=>(C['test'](E['purpose'])||D['test'](E['purpose']))&&p['test'](E['template_id']+'\x20'+E['purpose']));},w=h['filter'](B=>q(B)&&k(B['name'])&&!s(B['name'])&&!l(B['role']))['map'](B=>'\x27'+B['name']+'\x27'),x=[];return n['length']>0x0&&x['push']({'rule_id':'TERMINAL-NO-RAIL','severity':'critical','title':'Terminal\x20node(s)\x20'+n['join'](',\x20')+'\x20have\x20no\x20allocator\x20rail\x20—\x20escrow\x20strands\x20permanently\x20(publish\x20blocked)','detail':'An\x20order\x20that\x20reaches\x20a\x20terminal\x20node\x20moves\x20no\x20money\x20by\x20itself:\x20settlement\x20is\x20a\x20separate\x20keeper\x20'+'submit\x20against\x20an\x20allocator\x20whose\x20guard\x20anchors\x20that\x20node\x20(progress.current\x20==\x20<terminal>).\x20'+'A\x20terminal\x20without\x20a\x20rail\x20publishes\x20into\x20a\x20permanent\x20strand\x20—\x20the\x20escrow\x20of\x20every\x20order\x20that\x20stops\x20'+'there\x20is\x20unrecoverable\x20(mainnet\x20az-mn-261007:\x200.299\x20stranded;\x20ofshop:\x200.25\x20stranded\x20at\x20\x27expired\x27),\x20'+'and\x20topology\x20+\x20allocators\x20are\x20both\x20immutable\x20after\x20publish.\x20Either\x20this\x20terminal\x20needs\x20its\x20own\x20'+'settlement/refund\x20rail\x20(canonical\x20guard\x20designs:\x20tpl_allocator_node_gate_settle\x20/\x20'+'tpl_allocator_node_gate_refund,\x20M-T12),\x20or\x20the\x20pool\x20legitimately\x20drains\x20at\x20an\x20EARLIER\x20node\x20—\x20in\x20'+'which\x20case\x20document\x20that\x20in\x20the\x20terminal\x27s\x20role\x20(e.g.\x20\x27pool\x20is\x20empty\x27)\x20so\x20this\x20rule\x20can\x20exempt\x20it.','suggestion':'For\x20each\x20listed\x20terminal:\x20add\x20an\x20allocator\x20row\x20whose\x20guard\x20purpose\x20anchors\x20progress.current\x20==\x20<terminal>,\x20'+'or\x20state\x20in\x20the\x20node\x20role\x20that\x20the\x20pool\x20is\x20already\x20empty\x20when\x20the\x20terminal\x20is\x20reached.'}),w['length']>0x0&&x['push']({'rule_id':'TERMINAL-WRONG-RAIL','severity':'critical','title':'Refund\x20terminal(s)\x20'+w['join'](',\x20')+'\x20anchored\x20ONLY\x20by\x20the\x20settlement\x20track\x20—\x20the\x20refund\x20pays\x20the\x20merchant\x20(publish\x20blocked)','detail':'A\x20cancel-flavored\x20terminal\x20must\x20drain\x20through\x20the\x20REFUND\x20track\x20(order-anchored\x20GuardIdentifier\x20rows):\x20'+'the\x20only\x20anchor\x20that\x20currently\x20covers\x20it\x20lives\x20on\x20a\x20settlement\x20row\x20or\x20a\x20guard\x20with\x20no\x20refund\x20intent,\x20'+'and\x20a\x20settlement\x20rail\x20resolves\x20its\x20recipients\x20to\x20the\x20merchant\x20side.\x20Triggered\x20that\x20way,\x20the\x20buyer\x27s\x20'+'refund\x20is\x20paid\x20to\x20the\x20counterparty\x20—\x20same\x20irreversibility\x20class\x20as\x20a\x20missing\x20rail\x20(topology\x20and\x20'+'allocators\x20are\x20immutable\x20after\x20publish).','suggestion':'For\x20each\x20listed\x20terminal:\x20add\x20refund-track\x20rows\x20anchored\x20to\x20it\x20(progress.current\x20==\x20<terminal>\x20on\x20a\x20'+'track:\x22refund\x22\x20row\x20note,\x20or\x20a\x20guard\x20purpose\x20that\x20names\x20both\x20the\x20node\x20and\x20the\x20refund\x20intent),\x20or\x20state\x20'+'in\x20the\x20node\x20role\x20that\x20the\x20pool\x20is\x20already\x20empty\x20when\x20the\x20terminal\x20is\x20reached.'}),x;}function railNodeDriftChecks(a){const b=a['machine_shape'];if(b['length']===0x0)return[];const c=a['allocator']['rows']??[],d=[...a['guards']['map'](h=>h['purpose']),...c['map'](h=>h['note']??'')];if(!d['some'](h=>/current\s*==|current_time\s+of/i['test'](h)))return[];d['push'](a['allocator']['description']??'');const e=new Set(b['map'](h=>h['name']['toLowerCase']())),f=new Set(),g=h=>{const j=(h[0x1]??h[0x2]??'')['trim']();if(j===''||/^<.*>$/['test'](j))return;if(!/^[A-Za-z0-9_]+$/['test'](j))return;if(!e['has'](j['toLowerCase']()))f['add']('\x27'+j+'\x27');};for(const h of d){for(const j of h['matchAll'](/current\s*==\s*(?:"([^"]+)"|'([^']+)')/gi))g(j);for(const k of h['matchAll'](/current_time\s+of\s+(?:"([^"]+)"|'([^']+)')/gi))g(k);}if(f['size']===0x0)return[];return[{'rule_id':'RAIL-NODE-DRIFT','severity':'high','title':'Progress\x20anchor(s)\x20'+[...f]['join'](',\x20')+'\x20name\x20no\x20machine_shape\x20node\x20—\x20the\x20rail\x20can\x20never\x20fire','detail':'These\x20progress\x20anchors\x20(current\x20==\x20\x27X\x27\x20/\x20current_time\x20of\x20\x27X\x27)\x20reference\x20node\x20names\x20absent\x20from\x20'+'machine_shape,\x20so\x20the\x20guard\x20can\x20never\x20match\x20a\x20real\x20progress\x20state\x20and\x20whatever\x20the\x20rail\x20drains\x20'+'(settlement,\x20refund,\x20compensation)\x20strands\x20permanently.\x20The\x20usual\x20cause\x20is\x20a\x20node\x20rename\x20that\x20did\x20'+'not\x20propagate:\x20rails\x20pinned\x20\x27cancelled\x27\x20while\x20the\x20node\x20shipped\x20as\x20\x27guest_cancelled\x27\x20killed\x20every\x20'+'refund\x20path\x20on\x20a\x20live\x20store.\x20Chain\x20publishability\x20does\x20NOT\x20compare\x20anchor\x20literals\x20against\x20the\x20'+'node\x20set\x20—\x20this\x20prose-drift\x20is\x20only\x20visible\x20to\x20a\x20scan.','suggestion':'Align\x20each\x20listed\x20anchor\x20with\x20the\x20actual\x20machine_shape\x20node\x20name\x20(preferred:\x20update\x20the\x20guard\x20'+'purpose\x20/\x20allocator\x20note\x20to\x20the\x20current\x20node\x20name),\x20or\x20restore\x20the\x20node\x20name\x20in\x20machine_shape\x20'+'if\x20the\x20anchor\x20was\x20correct\x20and\x20the\x20shape\x20drifted.'}];}const PATH_CLASS_PATH_CAP=0x1388;function extractHistoryAnchorLiteral(a){for(const b of a['matchAll'](/next_node\s*=\s*["']([A-Za-z0-9_]+)["']/g)){const c=a['slice'](Math['max'](0x0,b['index']-0x40),b['index']);if(/progress\.history\.time[\s\S]{0,48}$/i['test'](c))return b[0x1];}return undefined;}function enumeratePathClasses(a,b,c,d,e){const f=d['toLowerCase'](),g=c['toLowerCase'](),h=new Set(),j=[];let k=0x0,l=![];const m=n=>{const o=n['toLowerCase']();if(o===f)return;j['push'](n),h['add'](o);if(o===g){k+=0x1;if(k>PATH_CLASS_PATH_CAP)l=!![];else e['length']<0x3&&e['push'](j['join']('→')+'\x20avoiding\x20\x27'+d+'\x27');}else for(const p of a['get'](n)??[]){if(l)break;if(h['has'](p['toLowerCase']()))continue;m(p);}j['pop'](),h['delete'](o);};for(const n of b){if(l)break;m(n);}return{'violated':k>0x0,'capped':l};}function pathClassAnchorChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0)return[];if(!b['some'](k=>(k['from']??[])['some'](l=>typeof l!=='string'&&!!l['guard_key'])))return[];const c=new Map(),d=new Map();for(const k of b){for(const l of k['from']??[]){const n=typeof l==='string'?l:l['prev'];if(!c['has'](n))c['set'](n,[]);c['get'](n)['push'](k['name']);if(n!=='')d['set'](k['name'],(d['get'](k['name'])??0x0)+0x1);}}const f=b['filter'](o=>(d['get'](o['name'])??0x0)===0x0)['map'](o=>o['name']);if(f['length']===0x0)return[];const h=[],j=new Set();for(const o of a['guards']){if(!o['key']||j['has'](o['key']))continue;if(!/history[\s\S]{0,200}next_node|next_node[\s\S]{0,200}history/i['test'](o['purpose']))continue;const p=extractHistoryAnchorLiteral(o['purpose']);if(!p)continue;if(!b['some'](z=>z['name']['toLowerCase']()===p['toLowerCase']()))continue;j['add'](o['key']);const q=[];for(const z of b){for(const A of z['from']??[]){if(typeof A==='string'||A['guard_key']!==o['key'])continue;q['push']({'u':A['prev'],'v':z['name']});}}const s=[],w=[];let x=![];const y=new Map();for(const {u:B,v:C}of q){const D=B['toLowerCase']();let E=y['get'](D);!E&&(E=enumeratePathClasses(c,f,B,p,s),y['set'](D,E));if(E['capped'])w['push'](B+'→'+C);if(E['violated'])x=!![];}if(!x)continue;h['push']({'rule_id':'PATH-CLASS-ANCHOR-01','severity':'high','title':'History-time\x20anchor\x20\x27'+p+'\x27\x20is\x20missing\x20from\x20some\x20path\x20class\x20reaching\x20guard\x20\x27'+o['key']+'\x27\x20—\x20'+'the\x20guard\x20aborts\x20(MovePrimitiveRuntimeError),\x20not\x20a\x20clean\x20false','detail':'A\x20guard\x20purpose\x20that\x20declares\x20a\x20HISTORY-time\x20anchor\x20(progress.history.time\x20...,\x20next_node=\x27'+p+'\x27,\x20'+('find=last)\x20hard-depends\x20on\x20node\x20\x27'+p+'\x27\x20being\x20present\x20in\x20the\x20order\x27s\x20history.\x20An\x20order\x20that\x20reaches\x20')+('one\x20of\x20this\x20guard\x27s\x20edges\x20via\x20a\x20path\x20class\x20that\x20never\x20visits\x20\x27'+p+'\x27\x20makes\x20that\x20repository\x20query\x20')+'return\x20W_FIELD_NOT_FOUND,\x20and\x20the\x20passport\x20validator\x20re-raises\x20it\x20as\x20a\x20MovePrimitiveRuntimeError:\x20the\x20'+'ENTIRE\x20guard\x20aborts\x20instead\x20of\x20returning\x20a\x20clean\x20predicate\x20false,\x20so\x20whatever\x20it\x20gates\x20(an\x20expiry,\x20a\x20'+'release,\x20a\x20refund\x20window)\x20never\x20evaluates\x20on\x20that\x20path\x20class.\x20Topological\x20reachability\x20(F-TPL-01)\x20is\x20'+'necessary\x20but\x20NOT\x20sufficient\x20—\x20the\x20anchor\x20must\x20DOMINATE\x20every\x20path\x20class\x20reaching\x20the\x20guarded\x20edge\x27s\x20'+('pre-node.\x20Violating\x20path\x20classes\x20(start→...→pre-node\x20avoiding\x20\x27'+p+'\x27):\x20'+s['join'](';\x20')+'.')+(w['length']>0x0?'\x20Path\x20enumeration\x20hit\x20the\x20'+PATH_CLASS_PATH_CAP+'-path\x20determinism\x20cap\x20on\x20'+w['join'](',\x20')+'\x20—\x20'+'those\x20edges\x20were\x20skipped\x20as\x20under-audited,\x20not\x20cleared.':''),'suggestion':'Anchor\x20the\x20history-time\x20leg\x20only\x20on\x20a\x20node\x20present\x20on\x20EVERY\x20path\x20class\x20that\x20can\x20reach\x20the\x20guarded\x20'+'edges\x20(the\x20dominance\x20rule)\x20—\x20e.g.\x20anchor\x20an\x20expiry\x20on\x20the\x20delivered\x20entry\x20rather\x20than\x20a\x20renewal-only\x20'+'node;\x20or\x20split\x20the\x20edge/guard\x20so\x20each\x20path\x20class\x20gets\x20its\x20own\x20anchor\x20(a\x20logic_or\x20of\x20per-class\x20anchors).'});}return h;}function siblingForwardExclusivityChecks(a){const b=a['machine_shape'];if(b['length']===0x0)return[];const d=new Map();for(const n of a['guards'])if(n['key'])d['set'](n['key'],n);const f=new Map();for(const o of a['conditional_guards']??[]){f['set'](o['param'],(f['get'](o['param'])??0x0)+0x1);}const h=new Set((a['conditional_guards']??[])['filter'](p=>(f['get'](p['param'])??0x0)>0x1)['map'](p=>p['guard_key'])),j=a['allocator']['rows']??[],k=p=>{const q=j['find'](s=>s['guard_key']===p||s['guard_key']===p+'_refund');return q?String(q['value']??q['value_from']??q['mode']):undefined;},l=p=>{if(!p)return![];const q=d['get'](p);if(!q)return![];return/time_lock/['test'](q['template_id'])||/until\b|within\b|\bdays?\b|\bhours?\b|\bwindow\b|deadline|before (?:check[- ]?in|delivery|deadline)/i['test'](q['purpose']);},m=[];for(const p of b){const q=new Map();for(const s of p['from']??[]){const w=typeof s==='string'?{'prev':s}:s;if(!w['prev'])continue;const x=w['operator']??(w['permission_index']!==undefined?'perm:'+w['permission_index']:p['operator']??'merchant'),y=q['get'](w['prev'])??[];y['push']({'guard_key':w['guard_key'],'actor':x}),q['set'](w['prev'],y);}for(const [z,A]of q){const B=A['filter'](H=>H['guard_key']!==undefined);if(B['length']<0x2)continue;const C=new Set(B['map'](H=>H['actor']));if(C['size']>0x1)continue;const D=B['filter'](H=>l(H['guard_key']));if(D['length']<0x2)continue;if(D['every'](H=>h['has'](H['guard_key'])))continue;const E=D['map'](H=>H['guard_key']),F=[...new Set(E['map'](H=>k(H))['filter'](H=>H!==undefined&&H!==''))],G=F['length']>0x1;m['push']({'rule_id':'SIBLING-FORWARD-EXCLUSIVITY','severity':G?'high':'medium','title':'Node\x20\x27'+p['name']+'\x27\x20(pair\x20from\x20\x27'+z+'\x27)\x20carries\x20'+D['length']+'\x20sibling\x20forwards\x20gated\x20by\x20'+('time-window\x20guards\x20under\x20one\x20actor\x20('+[...C]['join']('/')+')\x20—\x20no\x20on-chain\x20mutual\x20exclusion'),'detail':G?'Sibling\x20guards\x20resolve\x20to\x20DIFFERENT\x20settlement\x20amounts\x20('+F['join']('\x20vs\x20')+').\x20Sibling\x20forwards\x20on\x20one\x20'+'NodePair\x20have\x20no\x20on-chain\x20mutual\x20exclusion\x20and\x20Order.allocation\x20is\x20write-once\x20—\x20all\x20their\x20rails\x20share\x20'+'ONE\x20immutable\x20pool,\x20so\x20overlapping\x20windows\x20let\x20the\x20actor\x20fire\x20the\x20most\x20favourable\x20branch\x20(79678\x20audit\x20'+'F-01.1:\x20a\x20guest\x2040\x20days\x20out\x20can\x20satisfy\x20both\x20a\x20full-refund\x20and\x20a\x20partial-refund\x20tier).':'Sibling\x20forwards\x20on\x20one\x20NodePair\x20have\x20no\x20on-chain\x20mutual\x20exclusion;\x20if\x20their\x20time\x20windows\x20overlap,\x20the\x20'+'actor\x20picks\x20the\x20branch.\x20Verify\x20the\x20intervals\x20are\x20mutually\x20exclusive\x20by\x20construction.','suggestion':G?'Emit\x20ONE\x20forward\x20+\x20ONE\x20rail\x20per\x20selected\x20option\x20(M-T7\x20conditional\x20emission,\x20e.g.\x20user_inputs\x20cancellation_policy\x201..6),\x20'+'or\x20make\x20the\x20guards\x27\x20intervals\x20provably\x20disjoint\x20so\x20at\x20most\x20one\x20can\x20pass\x20at\x20any\x20moment.':'Make\x20the\x20sibling\x20guards\x27\x20time\x20intervals\x20provably\x20disjoint\x20(at\x20most\x20one\x20satisfiable\x20at\x20any\x20moment),\x20'+'or\x20split\x20each\x20option\x20onto\x20its\x20own\x20NodePair\x20so\x20mounting\x20is\x20a\x20build-time\x20choice.'});}}return m;}function guardHasCompiledClaimSurface(a){if(a['host']==='reward')return![];let b;if(a['root']!==undefined||a['table']!==undefined)b=[a['root']??null,a['table']??null];else{if(typeof a['template_id']==='string'&&a['template_id']['length']>0x0){const c=fillGuardTemplate(a['template_id'],a['params']??{});if(!c['ok'])return![];b=[c['root']??null,c['table']??null];}else return![];}return/claimed_by|principal_refunded/i['test'](JSON['stringify'](b));}function serialClaimWindowChecks(a){const b=a['machine_shape']['some'](m=>/claim(?!ed_by)/i['test'](m['name']))||a['guards']['some'](m=>guardHasCompiledClaimSurface(m));if(!b)return[];const c=a['allocator']['rows']??[],d=c['some'](m=>m['track']==='settlement'&&(m['mode']==='surplus'||m['mode']==='rate'&&m['value']===0x2710));if(!d)return[];const e=templateText(a),f=a['machine_shape']['some'](m=>/claim_window/i['test'](m['name'])),g=/serial claim[- ]window|claim_window.*serial|serial[- ]claim|claims? (is|are|always) adjudicated while the pool is intact|between checkout and payout|before (any )?release/i['test'](e),h=a['machine_shape']['find'](m=>/(?:claim|objection|dispute)_filed/i['test'](m['name'])),j=h?a['machine_shape']['flatMap'](m=>(m['from']??[])['flatMap'](o=>typeof o!=='string'&&o['prev']===h['name']?[o]:[])):[],k=!!h&&j['length']>0x0&&j['every'](m=>!/settle|release|complete|refund|payout/i['test'](m['forward']??'')||m['forward']==='ArbRefund')&&(h['from']??[])['some'](m=>typeof m!=='string'&&/(?:^File(?:Dispute|Claim)$)|Objection/['test'](m['forward']??'')),l=((()=>{const m=a['machine_shape']['find'](o=>/return/i['test'](o['name']));if(!m)return![];const n=(m['from']??[])['some'](o=>typeof o!=='string'&&/return_window/i['test'](o['guard_key']??'')&&a['machine_shape']['some'](p=>p['name']===o['prev']&&p['semantic_role']==='final'));return n&&/first of .{0,48}wins|to move the money wins/i['test'](e);})());if(f&&g||k||l)return[{'rule_id':'D2-SERIAL-CLAIM-WINDOW','severity':'low','title':'Serial\x20ordering\x20gates\x20the\x20full-drain\x20release\x20(ABNB2\x20window\x20or\x20case-waypoint\x20park)','detail':'The\x20template\x20carries\x20claim\x20machinery\x20AND\x20a\x20full-drain\x20settlement\x20group\x20(Rate\x2010000\x20/\x20Surplus),\x20'+'and\x20resolves\x20the\x20race\x20by\x20serial\x20ordering:\x20either\x20a\x20claim_window\x20node\x20between\x20delivery\x20'+'confirmation\x20and\x20payout\x20(the\x20release\x20fires\x20only\x20after\x20the\x20window\x20closed\x20with\x20no\x20upheld\x20claim),\x20'+'or\x20a\x20case\x20waypoint\x20PARK\x20between\x20them\x20—\x20claim_filed\x20or\x20the\x20dispute-family\x20objection_filed\x20'+'(while\x20a\x20case\x20is\x20open\x20the\x20order\x20parks\x20at\x20the\x20'+'waypoint\x20and\x20every\x20settlement\x20edge\x20fires\x20only\x20from\x20the\x20post-waypoint\x20node,\x20so\x20the\x20pool\x20is\x20'+'intact\x20whenever\x20a\x20venue\x20ruling\x20lands\x20—\x20the\x20waypoint\x27s\x20exits\x20carry\x20no\x20money\x20rail\x20of\x20their\x20own;\x20'+'the\x20canonical\x20ArbRefund\x20award\x20forward\x20rides\x20the\x20destination\x20terminal\x27s\x20node-gated\x20sweep).','suggestion':'Verify\x20the\x20release\x20guard\x20anchors\x20on\x20progress.current_time\x20of\x20the\x20claim_window\x20entry\x20'+'(witness-derived),\x20not\x20on\x20order.time\x20—\x20a\x20booking-time\x20delay\x20has\x20always\x20expired\x20before\x20'+'checkout\x20and\x20gives\x20no\x20post-delivery\x20protection.'}];return[{'rule_id':'D2-SERIAL-CLAIM-WINDOW','severity':'high','title':'Full-drain\x20release\x20can\x20fire\x20while\x20a\x20claim\x20is\x20still\x20openable\x20—\x20FCFS\x20race\x20on\x20one\x20pool\x20(FACT-ALLOC-03)','detail':'The\x20template\x20carries\x20claim\x20machinery\x20AND\x20a\x20full-drain\x20settlement\x20group\x20(Rate\x2010000\x20or\x20Surplus),\x20'+'but\x20no\x20serial\x20claim_window\x20node\x20orders\x20them:\x20the\x20payout\x20and\x20a\x20later\x20claim\x20race\x20first-come-first-served\x20'+'on\x20the\x20SAME\x20pool,\x20and\x20the\x20chain\x20has\x20no\x20holdback\x20primitive\x20(fix\x20is\x20the\x20PAID\x20sum\x20of\x20Amount\x20legs,\x20on\x20chain).\x20Once\x20the\x20release\x20fires,\x20a\x20claim\x20can\x20pay\x20nothing\x20from\x20the\x20pool.\x20'+'Airbnb\x20mainnet\x20audit\x202026-10-07:\x20the\x20parallel\x20payout/claim\x20design\x20paid\x20the\x20host\x20in\x20full\x20and\x20left\x20'+'the\x20claim\x20window\x20with\x20an\x20empty\x20pool.','suggestion':'Insert\x20a\x20SERIAL\x20claim_window\x20node\x20between\x20delivery\x20confirmation\x20and\x20payout\x20(ABNB2-validated):\x20'+'checkout\x20→\x20claim_window\x20→\x20payout,\x20with\x20exactly\x20two\x20exits\x20—\x20FileClaim\x20(inside\x20the\x20window,\x20'+'Clock\x20<=\x20current_time(claim_window)\x20+\x20claim_window_days)\x20and\x20ReleaseNoClaim\x20(window\x20elapsed).\x20'+'Gate\x20the\x20release\x20allocator\x20on\x20the\x20post-window\x20node,\x20and\x20give\x20a\x20denied\x20claim\x20its\x20own\x20release\x20'+'forward\x20so\x20no\x20stop\x20node\x20holds\x20funds.'}];}function dismissEdgeGuardChecks(a){const b=a['machine_shape']['some'](d=>/claim/i['test'](d['name']))||a['guards']['some'](d=>/claim/i['test'](d['purpose']));if(!b)return[];const c=[];for(const d of a['machine_shape']){for(const e of d['from']??[]){if(typeof e==='string')continue;if(!e['forward']||!/dismiss|denied|rejected/i['test'](e['forward']))continue;if(e['guard_key']&&e['guard_key']['trim']()!=='')continue;c['push']((e['prev']??'?')+'\x20─'+e['forward']+'→\x20'+d['name']);}}if(c['length']===0x0)return[];return[{'rule_id':'D2-DISMISS-EDGE-GUARD','severity':'high','title':'Claim-dismissal\x20edge\x20is\x20a\x20bare\x20permission\x20wire\x20—\x20the\x20platform\x20can\x20dismiss\x20and\x20release\x20with\x20no\x20ruling\x20evidence\x20(N-T2)','detail':'These\x20dismissal\x20edges\x20carry\x20permission_index\x20but\x20NO\x20guard:\x20'+c['join'](';\x20')+'.\x20The\x20holder\x20of\x20that\x20permission\x20can\x20dismiss\x20the\x20buyer\x27s\x20claim\x20and\x20fire\x20the\x20release/payout\x20in\x20one\x20'+'step,\x20with\x20nothing\x20on-chain\x20proving\x20a\x20ruling\x20ever\x20happened\x20—\x20the\x20serial\x20claim\x20window\x27s\x20time\x20'+'ordering\x20is\x20defeated\x20by\x20its\x20own\x20escape\x20hatch.','suggestion':'Gate\x20each\x20dismissal\x20edge\x20on\x20tpl_forward_arb_ruling_dismissed\x20(arb.order\x20==\x20order\x20AND\x20'+'arb.indemnity.amount\x20==\x200):\x20the\x20native\x20indemnity.amount\x20query\x20errors\x20on\x20a\x20None\x20field,\x20so\x20the\x20'+'leg\x20passes\x20ONLY\x20for\x20a\x20standing\x20Some(0)\x20ruling\x20—\x20never-ruled\x20and\x20reset/objection\x20states\x20(both\x20'+'None)\x20fail\x20closed,\x20and\x20a\x20buyer-favor\x20ruling\x20(Some(>0))\x20fails\x20the\x20equality.\x20ONE\x20INSTANCE\x20PER\x20'+'dismissal\x20edge\x20—\x20never\x20share\x20the\x20guard\x20between\x20two\x20forwards.\x20Never\x20express\x20the\x20gate\x20as\x20'+'\x27arb.indemnity\x20some\x20==\x20false\x27\x20or\x20arb.status\x20(R-X1-16).'}];}function noteNodeDriftChecks(a){const b=new Set(a['machine_shape']['map'](d=>d['name']['toLowerCase']())),c=[];for(const d of a['build_notes']??[]){for(const e of d['matchAll'](/must (?:create|add|declare|include)[^.;]*?'([a-z0-9_]+)'/gi)){const f=e[0x1]['toLowerCase']();if(!b['has'](f))c['push']('\x27'+f+'\x27');}}if(c['length']===0x0)return[];return[{'rule_id':'NOTE-NODE-DRIFT','severity':'medium','title':'A\x20build_note\x20mandates\x20a\x20node\x20the\x20machine_shape\x20does\x20not\x20contain\x20—\x20prose\x20running\x20ahead\x20of\x20structure\x20(N-T6)','detail':'These\x20node\x20names\x20appear\x20under\x20MUST-create\x20language\x20in\x20build_notes\x20but\x20are\x20absent\x20from\x20machine_shape:\x20'+c['join'](',\x20')+'.\x20The\x20generator\x20will\x20read\x20the\x20note\x20and\x20invent\x20a\x20topology\x20the\x20structural\x20audit\x20(edges,\x20reachability,\x20'+'fund-exit\x20coverage)\x20never\x20examined\x20—\x20exactly\x20how\x20unguarded\x20edges\x20and\x20orphan\x20nodes\x20escaped\x20earlier\x20audits.','suggestion':'Either\x20land\x20the\x20mandated\x20node\x20in\x20machine_shape\x20WITH\x20its\x20from-edges\x20in\x20the\x20same\x20edit\x20(a\x20spliced\x20node\x20'+'without\x20edges\x20is\x20a\x20compile\x20blocker\x20and\x20a\x20reachability\x20finding),\x20or\x20reword\x20the\x20note\x20to\x20guidance\x20'+'language\x20(\x27model\x20it\x20as\x27,\x20\x27e.g.\x27)\x20so\x20the\x20optional\x20extension\x20is\x20not\x20read\x20as\x20a\x20structural\x20mandate.'}];}function noteArbBranchDriftChecks(a){const b='tpl_forward_arb_ruling_dismissed',c=(a['guards']??[])['some'](f=>f['template_id']===b);if(c)return[];const d=/\b(?:assembl\w+|mount\w*|carr\w+|ships?|includes?|declares?|has|have)\s+(?:no|not|never|neither)\b|\b(?:no|not|never|without|absent|lacks?|lacking|omits?|unmounted)\s+(?:tpl_forward_arb_ruling_dismissed|dismiss(?:al|ed)\s+(?:leg|edge|branch|forward))\b/i,e=[];for(const f of a['build_notes']??[]){for(const g of f['matchAll'](/\barb_dismissed_resume\b|\bBF-14 branch\b/gi)){const h=Math['max'](0x0,(g['index']??0x0)-0xa0),j=Math['min'](f['length'],(g['index']??0x0)+g[0x0]['length']+0xa0);if(d['test'](f['slice'](h,j)))continue;if(!e['includes'](g[0x0]))e['push'](g[0x0]);}}if(e['length']===0x0)return[];return[{'rule_id':'NOTE-ARB-BRANCH-DRIFT','severity':'medium','title':'A\x20build_note\x20asserts\x20an\x20arbitration\x20dismissal\x20branch\x20the\x20archetype\x20does\x20not\x20assemble\x20—\x20prose\x20promising\x20a\x20re-route\x20the\x20topology\x20cannot\x20fire','detail':'build_notes\x20assert\x20the\x20merchant-favour\x20dismissal\x20branch\x20('+e['join'](',\x20')+(')\x20but\x20no\x20guards[]\x20row\x20mounts\x20'+b+'.\x20The\x20note\x20therefore\x20promises\x20an\x20automatic\x20re-route\x20on\x20a\x20')+'zero\x20or\x20below-floor\x20award;\x20the\x20real\x20shape\x20is\x20a\x20MACHINE\x20NO-OP\x20—\x20the\x20order\x20rests\x20where\x20the\x20dismissal\x20'+'left\x20it\x20and\x20the\x20merchant-favour\x20outcome\x20needs\x20the\x20ordinary\x20settle\x20forward\x20(live\x20case:\x20'+'retail/preorder-deposit\x27s\x20BF-14\x20claim,\x20v161).','suggestion':'Either\x20mount\x20'+b+'\x20as\x20a\x20guards[]\x20row\x20WITH\x20its\x20machine_shape\x20edge\x20in\x20the\x20same\x20edit,\x20or\x20reword\x20'+'the\x20note\x20to\x20state\x20the\x20real\x20shape\x20—\x20that\x20a\x20dismissed\x20award\x20fires\x20no\x20edge,\x20where\x20the\x20order\x20rests,\x20and\x20'+'which\x20existing\x20forward\x20the\x20operator\x20must\x20fire.\x20A\x20note\x20that\x20discloses\x20the\x20absence\x20is\x20correct\x20and\x20'+'stays\x20exempt.'}];}function syntheticMachine(a){const b=a['machine_shape']['map'](e=>({'name':e['name'],'description':e['role'],'operator':e['operator']})),c=[],d=(e,f)=>[{'name':e,'weight':0x1,'named_operator':f==='order_payer'?'':'order_holder'}];b['length']>0x0&&c['push']({'prev_node':'','next_node':b[0x0]['name'],'threshold':0x1,'forwards':d('enter_'+b[0x0]['name'],b[0x0]['operator'])});for(let e=0x0;e<b['length']-0x1;e++){const f=b[e]['name'],g=b[e+0x1];if(BRANCH_STATE_REGEX['test'](g['name']))continue;c['push']({'prev_node':f,'next_node':g['name'],'threshold':0x1,'forwards':d(f+'_to_'+g['name'],g['operator'])});}if(b['length']>0x0)for(const h of b){BRANCH_STATE_REGEX['test'](h['name'])&&c['push']({'prev_node':b[0x0]['name'],'next_node':h['name'],'threshold':0x1,'forwards':d('to_'+h['name'],h['operator'])});}return{'nodes':b,'pairs':c};}function singleNodeGraph(a){return{'network':ENTRYPOINT['Testnet'],'seed':a['id'],'builtAt':Date['now'](),'nodes':new Map([[a['id'],a]]),'edges':[],'out':new Map(),'inc':new Map(),'gaps':[],'truncations':[],'rpcReport':{'batches':0x0,'byChannel':{'objects':0x0,'keyedFields':0x0,'tables':0x0,'events':0x0},'dedupHits':0x0},'budgetExhausted':{}};}function analyzerFindings(a){const b=makeProposalNode('machine',syntheticMachine(a)),c=singleNodeGraph(b),d=buildViewport(c,c['seed'],'neutral');return runNodeAnalyzers(d,[machineRuleNodeAnalyzer,allocationRuleNodeAnalyzer]);}const SEVERITY_ORDER={'low':0x0,'medium':0x1,'high':0x2,'critical':0x3},ONEWAY_GATE_REGEX=/dispute[a-z]*\s*(?:count|len(?:gth)?)?[^.;:\n]{0,24}===?\s*0\b/gi,ONEWAY_NEGATION_REGEX=/\b(?:never|do\s+not|don'?t|not|avoid|instead|substitute|one-way\s+door|welds?|append-only|rather\s+than)\b/i;function onewayDisputeChecks(a){const b=[...a['guards']['map'](d=>['guard\x20'+d['template_id'],d['purpose']]),...(a['allocator']['rows']??[])['map']((d,e)=>['allocator\x20row\x20'+e,d['note']??'']),['allocator\x20description',a['allocator']['description']],...a['build_notes']['map']((d,e)=>['build\x20note\x20'+e,d]),...a['trust_mechanisms']['map']((d,e)=>['trust\x20mechanism\x20'+e,d])],c=[];for(const [d,e]of b){if(!e)continue;ONEWAY_GATE_REGEX['lastIndex']=0x0;for(let f=ONEWAY_GATE_REGEX['exec'](e);f!==null;f=ONEWAY_GATE_REGEX['exec'](e)){const g=e['slice'](Math['max'](0x0,f['index']-0x5a),f['index']+f[0x0]['length']+0x5a);if(ONEWAY_NEGATION_REGEX['test'](g))continue;c['push'](d+':\x20\x22'+f[0x0]['trim']()+'\x22');}}if(c['length']===0x0)return[];return[{'rule_id':'R-ONEWAY-DISPUTE','severity':'critical','title':'Dispute-count\x20gate\x20on\x20an\x20append-only\x20vector\x20—\x20the\x20first\x20filing\x20welds\x20the\x20rail\x20shut','detail':'Order.dispute\x20only\x20grows\x20(the\x20filing\x20entry\x20appends;\x20nothing\x20ever\x20removes).\x20A\x20guard\x20gated\x20on\x20'+'\x22dispute\x20count\x20==\x200\x22\x20is\x20monotone-false\x20after\x20the\x20first\x20case,\x20so\x20one\x20filing\x20permanently\x20closes\x20the\x20'+'gated\x20rail\x20and\x20strands\x20the\x20escrow\x20—\x20verified\x20on\x20mainnet\x20(az-mn-261007\x20T5:\x20the\x20reviewed\x20order\x20walked\x20'+'case\x20->\x20ruling\x20->\x20payout\x20and\x20its\x202.38\x20principal\x20froze\x20with\x20no\x20exit).\x20Offending\x20surfaces:\x20'+c['join'](';\x20')+'.','suggestion':'Gate\x20on\x20NODE\x20state\x20instead\x20(decision\x2011):\x20the\x20rail\x20fires\x20at\x20a\x20post-resolution\x20terminal\x20node;\x20a\x20'+'settlement\x20track\x20with\x20refund\x20exposure\x20freezes\x20NEW\x20payouts\x20with\x20logic_not[order.dispute.open]\x20'+'(query\x201576)\x20and\x20resolved-awaiting-stamp\x20flows\x20drive\x20the\x20stamp\x20with\x20order.dispute.unstamped\x20'+'(query\x201578).\x20NEVER\x20substitute\x20dispute\x20count\x20==\x200\x20(append-only\x20one-way\x20door),\x20and\x20NEVER\x20a\x20'+'claimed_by\x20leg\x20on\x20a\x20fund\x20rail\x20(R-FUND-RAIL-CLAIMED-BY\x20critical).'}];}const ARB_REFERENCE_REGEX=/\barbitration\b|\barbitrator\b|compensation[ -]fund|\barb\.|\bruling\b/i,NODE_GATE_SIGNAL_REGEX=/tpl_allocator_node_gate_(?:refund|recover|settle)|progress\.current|current\s*==\s*["']?\w+["']?|terminal|refund_node|settle_node/i;function noEscrowExitChecks(a){const b=a['allocator']['rows']??[];if(!b['some'](d=>d['track']==='refund'))return[];const c=templateText(a,b['map'](d=>d['note']??''));if(!ARB_REFERENCE_REGEX['test'](c))return[];if(NODE_GATE_SIGNAL_REGEX['test'](c))return[];return[{'rule_id':'R-NO-ESCROW-EXIT','severity':'high','title':'Refund\x20rail\x20shows\x20no\x20node-gated\x20exit\x20—\x20the\x20principal\x20can\x20strand\x20mid-flight\x20(T5\x20shape)','detail':'The\x20template\x20declares\x20an\x20order-anchored\x20refund\x20rail\x20and\x20references\x20arbitration,\x20but\x20no\x20guard\x20design,\x20'+'row\x20note,\x20or\x20build\x20note\x20declares\x20a\x20NODE-GATED\x20exit\x20(a\x20tpl_allocator_node_gate_*\x20family,\x20a\x20terminal\x20'+'node,\x20or\x20a\x20progress.current\x20gate).\x20Decision\x2011:\x20fund\x20rails\x20pay\x20strictly\x20from\x20node\x20state\x20—\x20an\x20'+'ungated\x20rail\x20has\x20no\x20terminal\x20discipline\x20and\x20the\x20escrow\x20principal\x20can\x20freeze\x20mid-flight\x20'+'(mainnet\x20az-mn-261007\x20T5:\x202.38\x20stranded\x20at\x20a\x20node\x20that\x20kept\x20no\x20exit).\x20The\x20retired\x20claimed_by\x20'+'polarity\x20pairing\x20is\x20NOT\x20the\x20fix\x20—\x20a\x20claimed_by\x20leg\x20on\x20a\x20fund\x20rail\x20is\x20the\x20R-FUND-RAIL-CLAIMED-BY\x20critical.','suggestion':'Bind\x20the\x20refund\x20row\x20to\x20tpl_allocator_node_gate_refund\x20(terminal-node-gated\x20at\x20the\x20refund\x20terminal)\x20'+'and\x20pair\x20the\x20merchant-side\x20residual\x20sweep\x20with\x20tpl_allocator_node_gate_recover\x20(terminal-node-gated).\x20'+'The\x20arbitration\x20award\x20is\x20the\x20indemnity\x20track\x27s\x20separate\x20commercial\x20payout\x20—\x20overlap\x20with\x20a\x20due\x20refund\x20'+'is\x20LEGAL\x20and\x20disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20(amz9\x20A-1).\x20FRAMING\x20CAVEAT\x20'+'(bs-mn-261022\x20F-BS-54/56):\x20order.claimed_by\x20records\x20\x27the\x20case\x20closed\x20onto\x20the\x20order\x27,\x20never\x20\x27who\x20'+'won\x27\x20—\x20present\x20any\x20post-ruling\x20recovery\x20as\x20\x27escrow\x20exits\x20to\x20the\x20seller\x20after\x20the\x20case\x20closed\x20against\x20'+'the\x20buyer\x27,\x20NEVER\x20as\x20\x27the\x20merchant\x20won\x27.'}];}const CLAIMED_FALSE_RE=/claimed_by\s*(?:is\s+)?(?:none|some\s*==\s*false)/i,CLAIMED_TRUE_RE=/claimed_by\s*(?:is\s+)?some\s*==\s*true/i;function pairingProseOnlyChecks(a){const b=a['allocator']['rows']??[];if(!b['some'](e=>e['track']==='refund'))return[];const c=templateText(a);if(!ARB_REFERENCE_REGEX['test'](c))return[];const d=[...a['guards']['filter'](e=>e['host']!=='machine'&&(CLAIMED_FALSE_RE['test'](e['purpose']??'')||CLAIMED_TRUE_RE['test'](e['purpose']??'')))['map'](e=>'guard\x20'+e['template_id']+'\x20purpose'),...a['build_notes']['map']((e,f)=>CLAIMED_FALSE_RE['test'](e)||CLAIMED_TRUE_RE['test'](e)?'build\x20note\x20'+f:undefined)['filter'](e=>e!==undefined)];if(d['length']===0x0)return[];return[{'rule_id':'R-PAIRING-PROSE-ONLY','severity':'medium','title':'Retired\x20claimed_by\x20refund/recovery\x20pairing\x20still\x20promised\x20in\x20prose\x20(decision\x2011)','detail':'The\x20claimed_by\x20none/some\x20refund/recovery\x20pairing\x20is\x20the\x20RETIRED\x20INV-C1\x20doctrine:\x20under\x20decision\x2011\x20'+'fund\x20rails\x20pay\x20strictly\x20from\x20node\x20state\x20and\x20never\x20read\x20order.claimed_by,\x20and\x20the\x20arbitration\x20award\x20'+'is\x20the\x20indemnity\x20track\x27s\x20separate\x20commercial\x20payout.\x20Surfaces\x20still\x20teaching\x20the\x20pairing:\x20'+(d['join'](';\x20')+'.\x20A\x20claimed_by\x20leg\x20on\x20a\x20fund\x20rail\x20is\x20the\x20R-FUND-RAIL-CLAIMED-BY\x20critical;\x20')+'prose-only\x20promises\x20mislead\x20the\x20builder\x20into\x20synthesizing\x20it.','suggestion':'Rewrite\x20the\x20prose\x20to\x20node-gated\x20exits:\x20the\x20refund\x20rail\x20fires\x20at\x20its\x20refund\x20terminal\x20'+'(tpl_allocator_node_gate_refund)\x20and\x20the\x20merchant-side\x20residual\x20sweep\x20at\x20the\x20recovery\x20terminals\x20'+'(tpl_allocator_node_gate_recover).\x20Overlap\x20between\x20a\x20refund\x20and\x20an\x20award\x20is\x20LEGAL\x20and\x20disclosed\x20at\x20'+'the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20(amz9\x20A-1).\x20Arb-TRACK\x20reads\x20of\x20the\x20claimed_by\x20payout\x20state\x20'+'(tpl_forward_arb_ruling_won\x20family)\x20remain\x20legal\x20on\x20the\x20arbitration\x20side.'}];}const CLAIMED_WIN_FRAME_RE=/\b(?:merchant|seller|producer|store|vendor|we)\b[^.;\n]{0,48}\b(?:win|wins|won|prevail(?:ed)?)\b/gi,CLAIMED_WIN_FRAME_ALT_RE=/\bdismiss(?:al|ed|s)?\b|\bbuyer\s+(?:lose|loses|lost)\b|\bclaw(?:ed|s)?\s+back\b/gi,CLAIMED_WIN_NEGATION_RE=/\b(?:never|do\s+not|don'?t|not|avoid|instead|rather\s+than|cannot)\b/i;function claimedDirectionVoidChecks(a){const b=[...(a['allocator']['rows']??[])['filter'](d=>d['track']!=='refund')['map']((d,e)=>['allocator\x20row\x20'+e+'\x20(track\x20'+d['track']+')',d['note']??'']),...a['guards']['map'](d=>['guard\x20\x27'+d['key']+'\x27',d['purpose']??''])],c=[];for(const [d,e]of b){if(!CLAIMED_TRUE_RE['test'](e))continue;for(const f of[CLAIMED_WIN_FRAME_RE,CLAIMED_WIN_FRAME_ALT_RE]){f['lastIndex']=0x0;for(let g=f['exec'](e);g!==null;g=f['exec'](e)){const h=e['slice'](Math['max'](0x0,g['index']-0x5a),g['index']+g[0x0]['length']+0x5a);if(CLAIMED_WIN_NEGATION_RE['test'](h))continue;c['push'](d+':\x20\x22'+g[0x0]['trim']()+'\x22');break;}if(c['some'](j=>j['startsWith'](d)))break;}}if(c['length']===0x0)return[];return[{'rule_id':'R-CLAIMED-DIRECTION-VOID','severity':'critical','title':'Recovery\x20rail\x20framed\x20as\x20winning-side\x20recovery\x20on\x20the\x20claimed_by\x20axis\x20—\x20polarity\x20voided\x20by\x20the\x20always-on\x20zero-indemnity\x20gate','detail':'order.claimed_by\x20is\x20written\x20when\x20the\x20case\x20is\x20CLOSED\x20onto\x20the\x20order\x20—\x20by\x20a\x20PAYING\x20claim\x20'+'(buyer-favoured)\x20or\x20by\x20the\x20dismissal\x20conclusion\x20(defendant-favoured,\x20always\x20on).\x20A\x20zero-indemnity\x20'+'award\x20itself\x20can\x20never\x20claim\x20(zero-indemnity\x20gate,\x20abort\x2011),\x20so\x20before\x20the\x20conclusion\x20existed\x20'+'claimed_by\x20stayed\x20none\x20after\x20a\x20dismissal.\x20The\x20axis\x20records\x20\x27the\x20case\x20closed\x20onto\x20this\x20order\x27,\x20'+'never\x20\x27who\x20won\x27:\x20some\x20==\x20true\x20covers\x20a\x20PAID\x20buyer\x20award\x20AND\x20a\x20concluded\x20dismissal.\x20A\x20rail\x20framed\x20'+'as\x20merchant-wins-recovery\x20therefore\x20pays\x20the\x20merchant\x20exactly\x20when\x20the\x20merchant\x20LOST\x20(live\x20'+'bs-mn-261022\x20O8)\x20unless\x20a\x20keeper\x20drives\x20the\x20dismissal\x20conclusion\x20at\x20ruling\x20time;\x20until\x20then\x20the\x20'+'paired\x20refund\x20leg\x20(some\x20==\x20false)\x20stays\x20open\x20and\x20the\x20buyer\x20loses\x20the\x20dispute\x20at\x20zero\x20cost\x20(O6).\x20Offending\x20surfaces:\x20'+c['join'](';\x20')+'.','suggestion':'Re-frame\x20the\x20rail\x27s\x20semantics\x20honestly:\x20claimed_by\x20some\x20==\x20true\x20means\x20\x27the\x20case\x20closed\x20onto\x20'+'the\x20order\x27\x20(a\x20buyer-favoured\x20award\x20was\x20PAID,\x20or\x20a\x20dismissal\x20was\x20concluded)\x20—\x20present\x20the\x20rail\x20as\x20'+'UPWC-K1\x20escrow-exit\x20(\x27the\x20awarded\x20order\x27s\x20escrow\x20principal\x20exits\x20to\x20the\x20seller\x20once\x20the\x20case\x20'+'closes\x27),\x20never\x20as\x20\x27the\x20merchant\x20won\x20the\x20dispute\x27.\x20Drive\x20the\x20dismissal\x20conclusion\x20at\x20ruling\x20time\x20'+'so\x20the\x20case\x20lands\x20on\x20the\x20order\x20and\x20the\x20refund\x20leg\x20closes.\x20Gating\x20on\x20ruling\x20DIRECTION\x20is\x20not\x20'+'expressible\x20on\x20this\x20axis\x20—\x20that\x20needs\x20the\x20chain-side\x20ruling-direction\x20accessor\x20(arb.winner,\x20bs-mn-261022).'}];}const TIER_PROMISE_RE=/\btiers?\b[^.!?\n]{0,120}?\b(earns?|earned|unlocks?|unlocked|receives?|received|gets?|claims?|claimed|grants?|granted)\b|\b(earns?|earned|unlocks?|unlocked|receives?|received|gets?|claims?|claimed|grants?|granted)\b[^.!?\n]{0,80}?\btiers?\b/i,REWARD_CONTEXT_RE=/\brewards?\b|\bbount(?:y|ies)\b|\bbonus(?:es)?\b|\bhonors?\b|\bperks?\b/i,PROHIBITION_RE=/\b(?:never promise|do not|don'?t|cannot|not constructible|unenforceable|unforced decoration|must be disclosed|MUST be disclosed|either add|drop the wording|word promises? to match|without a guard leg|no guard leg|impossible)\b/i,TIER_PREDICATE_RE=/\bhistor(?:y|ical)\b|\bperiod count\b|\bcount\s*>=|per-order repository|\brepository row\b|\btier predicate\b|\bstore_from_id\b/i;function disclosureEnforceabilityChecks(a){const b=[...a['build_notes'],...a['differences']??[],...a['guards']['map'](e=>e['purpose']??''),...(a['allocator']['rows']??[])['map'](e=>e['note']??'')],c=b['flatMap'](e=>e['split'](/(?<=[.!?])\s+/))['filter'](e=>TIER_PROMISE_RE['test'](e)&&REWARD_CONTEXT_RE['test'](e)&&!PROHIBITION_RE['test'](e)&&!TIER_PREDICATE_RE['test'](e));if(c['length']===0x0)return[];const d=a['guards']['some'](e=>TIER_PREDICATE_RE['test'](e['purpose']??''));if(d)return[];return[{'rule_id':'DISCLOSURE-ENFORCEABILITY','severity':'medium','title':'Tier-scoped\x20reward\x20promise\x20with\x20no\x20enforcement\x20leg\x20—\x20unenforceable\x20decoration','detail':'The\x20template\x27s\x20prose\x20promises\x20tier-scoped\x20rewards\x20('+c['slice'](0x0,0x2)['map'](e=>'\x22'+e['trim']()['slice'](0x0,0x8c)+'\x22')['join'](';\x20')+(c['length']>0x2?'\x20+'+(c['length']-0x2)+'\x20more':'')+'),\x20but\x20no\x20guard\x20design\x20reads\x20tier\x20evidence\x20(history\x20count,\x20per-order\x20repository\x20row).\x20Reward\x20objects\x20'+'are\x20Service-level\x20and\x20sales\x20rows\x20carry\x20no\x20reward\x20field,\x20so\x20the\x20claim\x20guard\x20gates\x20tier-agnostically:\x20'+'buyers\x20are\x20promised\x20a\x20tier\x20benefit\x20the\x20chain\x20cannot\x20verify\x20or\x20pay\x20selectively\x20(ptrn2-ln-261011\x20B3:\x20'+'\x27Co-Producer\x20earns\x20Veteran\x20rewards\x27\x20while\x20the\x20claim\x20guard\x20read\x20history\x20>=\x207\x20for\x20every\x20tier).','suggestion':'Either\x20add\x20the\x20predicate\x20—\x20a\x20claim-guard\x20leg\x20reading\x20per-order\x20repository\x20evidence\x20(or\x20history\x20'+'count)\x20so\x20each\x20tier\x27s\x20promise\x20is\x20actually\x20gated\x20—\x20or\x20reword\x20the\x20promise\x20to\x20match\x20what\x20the\x20guard\x20'+'leg\x20really\x20reads.\x20Never\x20ship\x20tier\x20wording\x20the\x20guard\x20cannot\x20enforce.'}];}function rewardBypassChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0)return[];const c=new Set();for(const l of a['guards']){if(l['host']!=='reward')continue;for(const [n,o]of Object['entries'](l['params']??{})){if(/^expected_.*_node$/['test'](n)&&typeof o==='string'&&o!=='')c['add'](o);}}if(c['size']===0x0)return[];const d=new Set(b['map'](p=>p['name'])),f=new Map(),h=new Map();for(const p of b){for(const q of p['from']??[]){const s=typeof q==='string'?q:q?.['prev'];if(s==='')continue;if(!f['has'](s))f['set'](s,[]);f['get'](s)['push'](p['name']);if(!h['has'](p['name']))h['set'](p['name'],[]);h['get'](p['name'])['push'](s);}}const j=[];for(const w of[...c]['sort']()){if(!d['has'](w)){j['push']('\x27'+w+'\x27\x20is\x20promised\x20by\x20reward-claim\x20machinery\x20but\x20absent\x20from\x20machine_shape\x20(dead\x20literal)');continue;}const x=h['get'](w)??[];if(x['length']!==0x1)continue;const y=f['get'](x[0x0])??[];if(y['length']<0x2)continue;const z=y['filter'](A=>A!==w)['map'](A=>'\x27'+A+'\x27')['join'](',\x20');j['push']('\x27'+w+'\x27\x20hangs\x20on\x20a\x20single\x20in-edge\x20from\x20\x27'+x[0x0]+'\x27\x20whose\x20sibling\x20forward(s)\x20('+z+')\x20let\x20the\x20order\x20leave\x20forever\x20—\x20the\x20promised\x20state\x20is\x20skippable');}if(j['length']===0x0)return[];return[{'rule_id':'R-REWARD-BYPASS','severity':'medium','title':'Reward-promise\x20node(s)\x20can\x20be\x20bypassed:\x20'+j['length']+'\x20skippable/unresolvable\x20promise(s)','detail':'ADVISORY\x20(never\x20blocks):\x20a\x20reward-host\x20guard\x20spec\x20promises\x20these\x20states\x20via\x20its\x20expected_*_node\x20'+'params,\x20but\x20the\x20topology\x20lets\x20an\x20order\x20miss\x20them\x20permanently\x20—\x20'+j['join'](';\x20')+'.\x20The\x20chain\x20has\x20no\x20scheduler:\x20once\x20the\x20order\x20advances\x20past\x20the\x20fork\x20through\x20the\x20sibling\x20forward\x20'+'(its\x20own\x20guard\x20passed,\x20or\x20a\x20keeper\x20edge\x20fired),\x20no\x20edge\x20leads\x20back\x20and\x20the\x20promised\x20state\x20—\x20and\x20'+'every\x20reward\x20gated\x20on\x20it\x20—\x20becomes\x20dead\x20for\x20that\x20order.\x20abnb14-mn\x20F01\x20(live):\x20the\x20review\x20window\x20'+'was\x20swallowed\x20by\x20the\x20claim\x20window\x20for\x20every\x20late\x20reviewer\x20because\x20`reviewed`\x20hung\x20on\x20a\x20single\x20'+'completed-only\x20entry\x20while\x20completed\x20also\x20opened\x20the\x20claim\x20window.\x20If\x20the\x20bypass\x20IS\x20the\x20design\x20'+'(a\x20genuinely\x20optional\x20reward),\x20leave\x20it\x20—\x20this\x20finding\x20exists\x20so\x20the\x20choice\x20is\x20deliberate\x20and\x20'+'documented\x20in\x20the\x20spec\x20purpose,\x20not\x20an\x20accident\x20of\x20array\x20order.','suggestion':'Give\x20the\x20promised\x20node\x20a\x20SECOND\x20entry\x20edge\x20from\x20the\x20post-fork\x20waypoint\x20(the\x20v102\x20fix:\x20reviewed\x20'+'re-entered\x20from\x20claim_window\x20via\x20the\x20same\x20forward),\x20or\x20demote\x20the\x20promise:\x20drop\x20the\x20'+'expected_*_node\x20param\x20and\x20say\x20in\x20the\x20spec\x20purpose\x20that\x20the\x20reward\x20rides\x20an\x20optional\x20state.\x20'+'A\x20promise\x20node\x20absent\x20from\x20machine_shape\x20is\x20a\x20dead\x20literal\x20—\x20fix\x20the\x20name\x20or\x20delete\x20the\x20param.'}];}function guardUnmountedChecks(a){const b=a['guards']['filter'](k=>typeof k['key']==='string'&&k['key']!=='');if(b['length']===0x0)return[];const d=new Set(['reward','repository','service']),f=new Set();for(const k of a['machine_shape']??[]){for(const l of k['from']??[]){if(typeof l!=='string'&&l?.['guard_key'])f['add'](l['guard_key']);}}for(const m of a['allocator']['rows']??[]){if(m['guard_key'])f['add'](m['guard_key']);}for(const o of a['conditional_guards']??[]){if(o['guard_key'])f['add'](o['guard_key']);}const g='COMPOSITION\x20PRESCRIPTION',h=p=>p['purpose']['startsWith'](g),j=b['filter'](p=>!d['has'](p['host'])&&!f['has'](p['key'])&&!h(p));if(j['length']===0x0)return[];return[{'rule_id':'R-GUARD-UNMOUNTED','severity':'medium','title':j['length']+'\x20guard\x20spec(s)\x20declare\x20a\x20key\x20nothing\x20mounts:\x20'+j['map'](p=>'\x27'+p['key']+'\x27')['join'](',\x20'),'detail':'ADVISORY\x20(never\x20blocks):\x20the\x20declared\x20key\x20surface\x20is\x20the\x20mounting\x20surface\x20—\x20an\x20edge\x27s\x20guard_key,\x20'+'an\x20allocator\x20row\x27s\x20guard_key,\x20or\x20a\x20conditional_guards\x20emission.\x20These\x20'+j['map'](p=>'\x27'+p['key']+'\x27\x20(host\x20'+p['host']+',\x20'+p['template_id']+')')['join'](',\x20')+'\x20are\x20referenced\x20by\x20none\x20of\x20them,\x20so\x20compile\x20never\x20collects\x20them\x20into\x20the\x20build\x20'+'(audit-261012\x20B3:\x20an\x20unbound\x20GuardSpec\x20is\x20never\x20emitted).\x20The\x20template\x20ships\x20the\x20spec\x27s\x20purpose\x20'+'as\x20a\x20promise\x20while\x20the\x20published\x20Machine\x20carries\x20no\x20such\x20guard\x20—\x20the\x20reader\x20believes\x20a\x20'+'protection\x20exists\x20that\x20does\x20not.','suggestion':'Mount\x20each\x20spec\x20by\x20binding\x20its\x20key\x20to\x20the\x20edge(s)\x20it\x20should\x20gate\x20(machine_shape\x20from[].guard_key)\x20'+'or\x20the\x20allocator\x20row(s)\x20it\x20should\x20cover\x20(allocator.rows[].guard_key);\x20if\x20the\x20protection\x20is\x20not\x20'+'wanted,\x20delete\x20the\x20spec\x20—\x20a\x20declared-but-unmounted\x20guard\x20is\x20dead\x20weight\x20that\x20inflates\x20the\x20trust\x20'+'surface.\x20reward/repository/service\x20hosts\x20need\x20no\x20key\x20reference\x20(host-mounted)\x20and\x20are\x20exempt.'}];}function residualSweepRaceChecks(a){const b=a['allocator']['rows']??[],c=b['filter'](f=>f['track']==='refund'&&f['mode']==='rate'&&Number(f['value'])===0x2710);if(c['length']===0x0)return[];const d=b['filter'](f=>f['track']==='settlement'&&f['mode']==='amount');if(d['length']<0x2)return[];const e=(a['build_notes']??[])['join']('\x0a');if(/KEEPER RELEASE CHECKLIST|before the (terminal )?(residual )?sweep|fire .*every served/i['test'](e))return[];return[{'rule_id':'R-SHARE-ZERO','severity':'medium','title':'Full\x20residual\x20sweep\x20('+c['map'](f=>'\x27'+(f['guard_key']??'?')+'\x27')['join'](',\x20')+')\x20races\x20'+d['length']+'\x20bounded\x20Amount\x20release(s)\x20with\x20no\x20keeper-ordering\x20disclosure','detail':'ADVISORY\x20(never\x20blocks):\x20a\x20refund-track\x20Rate-10000\x20row\x20sweeps\x20the\x20CURRENT\x20pool\x20balance,\x20so\x20the\x20'+'fire\x20order\x20vs\x20the\x20staged\x20Amount\x20releases\x20decides\x20who\x20gets\x20the\x20residue\x20—\x20a\x20sweep\x20fired\x20first\x20'+'drains\x20the\x20pool\x20and\x20every\x20unfired\x20release\x20aborts\x20EINSUFFICIENT_BALANCE\x20permanently\x20(guards\x20are\x20'+'frozen;\x20there\x20is\x20no\x20re-fire).\x20With\x20staged\x20releases\x20whose\x20windows\x20may\x20still\x20be\x20open\x20at\x20the\x20sweep\x27s\x20'+'terminal\x20(early\x20exit\x20/\x20keeper\x20sweep\x20timing),\x20the\x20residual\x20share\x20dominates\x20the\x20dispute\x20economics\x20'+'(the\x20RETURN-STRAND\x20family,\x20mn-261019).\x20No\x20build\x20note\x20discloses\x20the\x20fire-order\x20duty.','suggestion':'Add\x20a\x20KEEPER\x20RELEASE\x20CHECKLIST\x20build\x20note:\x20fire\x20every\x20served-but-unfired\x20release\x20BEFORE\x20the\x20'+'residual\x20sweep\x20/\x20terminal\x20refund;\x20the\x20sweep\x20carries\x20only\x20the\x20true\x20remainder.\x20Prefer\x20release\x20'+'rails\x20anchored\x20across\x20the\x20lifecycle\x20family\x20(tpl_allocator_node_family_window_release)\x20so\x20a\x20node\x20'+'advance\x20cannot\x20weld\x20the\x20served\x20releases.'}];}function damageCapChecks(a){const b=a['fee_params']??{},c=Number(b['damage_max_amount']);if(!Number['isFinite'](c)||c<=0x0)return[];const d=Number(b['deposit_amount']),e=(a['build_notes']??[])['join']('\x0a'),f=/damage.{0,80}(arbitration|compensation fund)|(arbitration|compensation fund).{0,80}damage/i['test'](e),g=[];return Number['isFinite'](d)&&d>0x0&&c>d&&g['push']({'rule_id':'R-DAMAGE-CAP','severity':'critical','title':'damage_max_amount\x20('+c+')\x20exceeds\x20deposit_amount\x20('+d+')\x20—\x20the\x20deduction\x20cap\x20is\x20uncollectable\x20past\x20the\x20pool','detail':'HARD\x20INVARIANT\x20VIOLATION:\x20a\x20damage\x20deduction\x20is\x20bounded\x20by\x20the\x20deposit\x20—\x20the\x20Amount\x20leg\x20draws\x20'+'from\x20the\x20escrow\x20pool,\x20and\x20damages\x20beyond\x20it\x20have\x20NO\x20on-chain\x20collection\x20rail\x20(they\x20route\x20to\x20'+'arbitration\x20+\x20the\x20compensation\x20fund,\x20award\x20cap\x203x\x20order).\x20A\x20declared\x20cap\x20above\x20the\x20deposit\x20'+'promises\x20a\x20remedy\x20the\x20pool\x20structurally\x20cannot\x20pay\x20past\x20the\x20deposit\x20floor.','suggestion':'Set\x20damage_max_amount\x20<=\x20deposit_amount;\x20move\x20the\x20beyond-deposit\x20exposure\x20to\x20the\x20arbitration\x20'+'award\x20(3x\x20order\x20cap)\x20and\x20disclose\x20the\x20route\x20in\x20the\x20build\x20notes.'}),!f&&g['push']({'rule_id':'R-DAMAGE-CAP','severity':'medium','title':'damage_max_amount\x20declared\x20with\x20no\x20beyond-cap\x20route\x20disclosure','detail':'ADVISORY\x20(never\x20blocks):\x20the\x20pinned\x20damage\x20cap\x20is\x20the\x20POOL-bounded\x20worst\x20case,\x20not\x20the\x20merchant\x27s\x20'+'total\x20exposure\x20—\x20damages\x20beyond\x20it\x20collect\x20only\x20through\x20arbitration\x20+\x20the\x20compensation\x20fund\x20'+'(award\x20cap\x203x\x20the\x20order\x20amount,\x20frozen\x20at\x20buy\x20time).\x20No\x20build\x20note\x20states\x20the\x20route,\x20so\x20the\x20'+'reader\x20can\x20mistake\x20the\x20cap\x20for\x20the\x20ceiling\x20of\x20recoverable\x20damages.','suggestion':'Add\x20the\x20DAMAGE\x20INVARIANT\x20build\x20note:\x20damage_max_amount\x20<=\x20deposit_amount;\x20larger\x20losses\x20route\x20'+'to\x20arbitration\x20+\x20the\x20compensation\x20fund\x20(award\x20cap\x203x\x20order).'}),g;}const NUMERIC_SEMANTIC_PARAM=/_(days|hours|minutes|ms|bps|pct|percent|ratio)$/;function specParamPlaneChecks(a){const b=[];for(const c of a['guards']){for(const [d,e]of Object['entries'](c['params']??{})){if(!NUMERIC_SEMANTIC_PARAM['test'](d))continue;const f=typeof e==='number'?e:typeof e==='string'&&e['trim']()!==''?Number(e):NaN;if(!Number['isFinite'](f)||f===0x0)continue;if(a['fee_params'][d]!==undefined)continue;if(bindingsFor(a['id'],c['key'])['some'](h=>h['to']===d))continue;b['push']('\x27'+c['key']+'\x27.'+d+'='+String(e));}}if(b['length']===0x0)return[];return[{'rule_id':'R-PARAM-PLANE-01','severity':'critical','title':b['length']+'\x20guard\x20spec\x20param(s)\x20hardcode\x20a\x20business\x20number\x20off\x20the\x20parameter\x20plane:\x20'+b['join'](',\x20'),'detail':'CRITICAL:\x20the\x20fill\x20merge\x20orders\x20spec\x20params\x20ABOVE\x20user\x20inputs,\x20so\x20a\x20numeric\x20'+'spec-local\x20literal\x20defeats\x20the\x20merchant\x27s\x20input\x20every\x20time.\x20None\x20of\x20these\x20keys\x20is\x20reachable\x20'+'from\x20the\x20parameter\x20plane\x20—\x20no\x20same-name\x20fee_param\x20and\x20no\x20fee-param-bindings\x20row\x20feeds\x20it\x20—\x20so\x20'+'the\x20shipped\x20literal\x20is\x20frozen\x20into\x20every\x20adopter\x27s\x20published\x20Machine\x20(README\x20decision\x2012:\x20all\x20'+'business\x20parameters\x20must\x20land\x20on\x20the\x20template\x20parameter\x20plane).\x20Motivating\x20defect:\x20group_buy\x20'+'shipped\x20review_window_days=15\x20this\x20way\x20and\x20no\x20merchant\x20could\x20change\x20the\x20promised\x20window.','suggestion':'Declare\x20a\x20same-name\x20fee_param\x20whose\x20default\x20equals\x20the\x20literal\x20and\x20DELETE\x20the\x20spec\x20literal\x20'+'(the\x20fee_params\x20fill\x20spread\x20delivers\x20the\x20value\x20—\x20keeping\x20the\x20literal\x20would\x20still\x20shadow\x20the\x20'+'merchant\x27s\x20input),\x20or\x20add\x20a\x20fee-param-bindings\x20row\x20if\x20an\x20existing\x20differently-named\x20fee\x20param\x20'+'should\x20feed\x20this\x20key.\x20If\x20the\x20number\x20is\x20genuinely\x20not\x20a\x20merchant\x20knob,\x20disclose\x20it\x20as\x20a\x20frozen\x20'+'constant\x20in\x20build_notes.'}];}function reviewWriteUnreachableChecks(a){const b=new Set();for(const f of a['machine_shape']??[]){for(const g of f['from']??[]){if(typeof g!=='string'&&g?.['guard_key'])b['add'](g['guard_key']);}}if(b['size']===0x0)return[];const c=(a['guards']??[])['filter'](h=>h['host']==='repository'&&typeof h['key']==='string'&&h['key']!==''&&b['has'](h['key']));if(c['length']===0x0)return[];const d=c['map'](h=>'\x27'+h['key']+'\x27')['join'](',\x20');return[{'rule_id':'REVIEW_WRITE_UNREACHABLE','severity':'medium','title':'Guard\x20spec(s)\x20'+d+'\x20mounted\x20as\x20BOTH\x20a\x20repository\x20write_guard\x20and\x20a\x20forward\x20guard\x20—\x20the\x20review\x20write\x20strands\x20once\x20the\x20order\x20advances','detail':'ADVISORY\x20(never\x20blocks;\x20the\x20hand-kit\x20trap):\x20the\x20repository\x20write_guard\x20is\x20evaluated\x20inside\x20the\x20'+'WRITE\x20transaction\x27s\x20passport\x20result,\x20never\x20at\x20declaration\x20time\x20—\x20the\x20'+'structured\x20write\x20must\x20execute\x20BEFORE\x20the\x20forward\x20that\x20advances\x20the\x20progress\x20state.\x20Mounting\x20the\x20'+'same\x20guard\x20on\x20both\x20faces\x20means:\x20on\x20the\x20FIRST\x20call\x20the\x20write_guard\x20passes\x20(pre-forward\x20state)\x20but\x20'+'the\x20forward\x20then\x20advances\x20the\x20order;\x20any\x20LATER\x20write\x20attempt\x20re-evaluates\x20the\x20same\x20guard\x20against\x20'+'the\x20ALREADY-ADVANCED\x20state,\x20and\x20a\x20progress-equality\x20leg\x20(the\x20review\x20idiom)\x20is\x20false\x20forever\x20—\x20the\x20'+'repository\x20row\x20becomes\x20unwritable\x20for\x20the\x20life\x20of\x20the\x20order\x20(live\x20rq-tn-261030-8693be\x20F-RQ-02:\x20'+'the\x20rating\x20write\x20stranded\x20after\x20`reviewed`,\x20the\x20order\x20re-run\x20from\x20scratch).\x20The\x20product\x20review\x20'+'composite\x20is\x20immune\x20(it\x20orders\x20the\x20structured\x20write\x20row\x20BEFORE\x20the\x20forward);\x20this\x20fires\x20for\x20'+'hand-written\x20kits\x20that\x20bypass\x20it.','suggestion':'Split\x20the\x20faces:\x20keep\x20the\x20repository\x20write_guard\x20holding\x20on\x20the\x20PRE-forward\x20state\x20and\x20execute\x20the\x20'+'write\x20row\x20BEFORE\x20the\x20forward\x20(the\x20product\x20composite\x27s\x20order),\x20OR\x20pin\x20the\x20write\x20guard\x20to\x20hold\x20on\x20'+'EVERY\x20node\x20reachable\x20after\x20the\x20write\x20window\x20(the\x20delivered-entry\x20history-leg\x20idiom)\x20so\x20a\x20post-'+'advance\x20write\x20still\x20passes.\x20Never\x20reuse\x20one\x20guard\x20spec\x20on\x20both\x20the\x20write\x20and\x20the\x20forward\x20face.'}];}function rewardReplayOpenChecks(a){const b=(a['guards']??[])['filter'](s=>s['host']==='reward');if(b['length']===0x0)return[];const c=templateText(a)+'\x20\x0a\x20'+(a['body']??''),d=[/\bper[ -]order\b[^.\n]{0,80}\b(reward|claim|bounty|incentive|bonus|rebate)/gi,/\b(?:reward|bounty|incentive|rebate)[^.\n]{0,60}\bper[ -]order\b/gi,/\beach[ -](?:order|booking|purchase|stay)\b[^.\n]{0,60}\b(?:earn|reward|claim)/gi],e=/store_from_id|storeFromId|once per buyer per order|order-scoped/i,f=/\b(?:state|disclose|say|declare|word|present)\b[^.;\n]{0,80}\b(?:scope|buyer|plainly|terms|language|whether)\b/i,g=/\b(?:protocol[ -]slot|slot\s*(?:254|255)|25[45])\b/i,h=/\breward_funding\b|review_reward_pool\b|expected\s+orders\b|merchant[- ]funded\b/i,j=/\b(?:query|id)[ -]?\d{3,4}\b|\b11?79\b|\b1051\b/i,k=(w,x)=>{const y=w['lastIndexOf']('.',x)+0x1,z=[w['indexOf']('.',x),w['indexOf'](';',x),w['indexOf']('\x0a',x)]['filter'](B=>B>0x0),A=z['length']>0x0?Math['min'](...z):w['length'];return w['slice'](y,A<0x0?w['length']:A);},l=[];for(const s of d){s['lastIndex']=0x0;for(const w of c['matchAll'](s)){const x=k(c,w['index']??0x0);if(f['test'](x))continue;if(g['test'](x))continue;if(h['test'](x))continue;if(j['test'](x))continue;l['push'](x);}}if(l['length']===0x0)return[];const n=/where:\s*\{\s*storeFromId/i,o=y=>{const z=c['indexOf'](y),A=z<0x0?y['length']:z+y['length'],B=c['indexOf']('\x0a',A);return y+c['slice'](A,B<0x0?undefined:B);},p=l['filter'](y=>{if(e['test'](y))return![];const z=o(y);return!(n['test'](z)&&/store_from_id/i['test'](z));}),q=b['some'](y=>y['params']!==undefined&&Object['keys'](y['params'])['some'](z=>/store_from_id/i['test'](z)));if(q||p['length']===0x0)return[];return[{'rule_id':'R-REWARD-REPLAY-OPEN','severity':'medium','title':'Reward\x20prose\x20promises\x20PER-ORDER\x20economics,\x20but\x20no\x20order-scoped\x20claim\x20stamp\x20(store_from_id)\x20is\x20declared\x20—\x20realized\x20economics\x20are\x20once\x20per\x20recipient\x20for\x20lifetime','detail':'ADVISORY\x20(never\x20blocks):\x20the\x20reward\x20once-claim\x20key\x20on-chain\x20is\x20(recipient,\x20guard,\x20store_from-'+'materialized\x20value)\x20(E_CLAIM_ALREADY_MADE\x20=\x2013).\x20The\x20'+'store_from\x20value\x20materializes\x20at\x20claim\x20time\x20from\x20the\x20submitted\x20Order\x20address\x20ONLY\x20when\x20the\x20guard\x20'+'pins\x20the\x20stamp\x20leg\x20(store_from_id\x20on\x20the\x20guard_add\x20entry\x20+\x20an\x20order-scoped\x20where:{storeFromId:...}\x20'+'record\x20query).\x20This\x20template\x20promises\x20per-order\x20rewards\x20in\x20prose\x20while\x20declaring\x20no\x20stamp\x20anywhere,\x20'+'so\x20every\x20claim\x20after\x20the\x20first\x20trips\x20the\x20SAME\x20tuple\x20and\x20aborts\x20—\x20the\x20buyer-facing\x20economics\x20are\x20'+'ONCE\x20PER\x20RECIPIENT\x20FOR\x20LIFETIME,\x20not\x20per\x20order.\x20Until\x20resolved,\x20word\x20the\x20promise\x20as\x20once-per-'+'merchant/recipient\x20(the\x20live\x20run\x27s\x20wording\x20fix),\x20not\x20per-order.\x20The\x20realized\x20economics\x20are\x20once\x20'+'per\x20recipient\x20for\x20lifetime.','suggestion':'Either\x20arm\x20the\x20stamp\x20—\x20guard_add\x20with\x20store_from_id\x20=\x20the\x20submitted-Order\x20slot\x20(conventionally\x200)\x20'+'and\x20a\x20claim-guard\x20leg\x20querying\x20reward\x20records\x20where:{storeFromId:{identifier:<slot>}}\x20—\x20and\x20keep\x20'+'the\x20per-order\x20wording,\x20or\x20keep\x20the\x20machinery\x20unstamped\x20and\x20reword\x20every\x20per-order\x20promise\x20to\x20'+'once-per-recipient.\x20A\x20per-order\x20promise\x20on\x20an\x20unstamped\x20guard\x20is\x20a\x20mis-selling\x20finding\x20waiting\x20'+'for\x20the\x20first\x20repeat\x20buyer.'}];}function declaredValueUnfundedChecks(a){const b=templateText(a)+'\x20\x0a\x20'+(a['body']??''),c=/\b(?:insur(?:ance|ed|es|e)?|guarantee[sd]?|money[ -]back|damage[ -]cover(?:age)?|compensat\w*)\b/gi,d=/\b(?:insur(?:ance|ed|es|e)?|money[ -]back|damage[ -]cover(?:age)?)\b|\bguarantee\w*\b[^.;\n]{0,60}\b(?:money|refund|satisfaction|compensat|cash)\b|\bcompensat\w*\b[^.;\n]{0,60}\b(?:loss|cash|value|damage|reimburse)/i,e=/\b(?:never|no|not|don'?t|cannot|must not|avoid|instead|rather than|without|off[ -]chain|only)\b/i,f=/compensation_fund|compensation fund|fund[- ]sizing|fund[- ]topup|insurance pool/i,g=/DECLARED-VALUE|DISCLOSURE-ONLY|SOLE-TRUTH/i,h=(o,p)=>{const q=o['lastIndexOf']('.',p)+0x1,w=[o['indexOf']('.',p),o['indexOf'](';',p),o['indexOf']('\x0a',p)]['filter'](y=>y>0x0),x=w['length']>0x0?Math['min'](...w):o['length'];return o['slice'](q,x<0x0?o['length']:x);},j=[];c['lastIndex']=0x0;for(const o of b['matchAll'](c)){const p=h(b,o['index']??0x0);if(!d['test'](p))continue;if(e['test'](p))continue;j['push'](p);}const k=Object['keys'](a['fee_params']??{})['some'](q=>/compensation|fund|insur|deposit/i['test'](q))||a['compensation_fund_policy']!==undefined,l=q=>{const w=b['indexOf'](q),x=w<0x0?q['length']:w+q['length'],y=b['indexOf']('\x0a',x);return q+b['slice'](x,y<0x0?undefined:y);},n=j['filter'](q=>{const w=l(q);return!f['test'](w)&&!g['test'](w);});if(k||n['length']===0x0)return[];return[{'rule_id':'R-DECLARED-VALUE-UNFUNDED','severity':'medium','title':'Prose\x20promises\x20compensation/insurance/guarantee\x20value,\x20but\x20the\x20template\x20declares\x20no\x20fund\x20surface\x20and\x20no\x20disclosure\x20marker','detail':'ADVISORY\x20(never\x20blocks):\x20the\x20compensation\x20promise\x20rides\x20prose\x20alone\x20—\x20no\x20compensation-fund\x20fee\x20'+'param,\x20no\x20fund-sizing/topup\x20declaration,\x20no\x20compensation_fund_policy,\x20and\x20none\x20of\x20the\x20established\x20'+'DECLARED-VALUE\x20/\x20DISCLOSURE-ONLY\x20markers.\x20At\x20quote\x20time\x20the\x20coverage\x20facet\x20self-computes\x20against\x20'+'the\x20ACTUAL\x20compensation_fund\x20balance\x20(0\x20here)\x20and\x20reports\x20covered:false,\x20so\x20the\x20buyer\x20reads\x20a\x20'+'protection\x20the\x20service\x20cannot\x20pay\x20(rq-tn-261030-8693be\x20F-RQ-08:\x20three\x20services\x20promised\x20'+'protection\x20with\x20fund\x20=\x200).\x20An\x20undisclosed\x20promise\x20is\x20a\x20trust\x20defect;\x20a\x20DISCLOSED\x20one\x20is\x20the\x20'+'established\x20design.','suggestion':'Either\x20declare\x20the\x20fund\x20surface\x20(a\x20compensation-fund\x20fee\x20param\x20+\x20fund-sizing/topup\x20build\x20note\x20so\x20'+'the\x20build\x20flow\x20funds\x20it),\x20or\x20mark\x20the\x20promise\x20DECLARED-VALUE\x20/\x20DISCLOSURE-ONLY\x20in\x20the\x20same\x20prose\x20'+'so\x20the\x20declaration-only\x20nature\x20is\x20explicit\x20at\x20quote\x20and\x20buy\x20time.'}];}function railUnboundChecks(a){const b=a['allocator']['rows']??[],c=b['map']((d,e)=>({'r':d,'i':e}))['filter'](({r:d})=>d['guard_key']===undefined);if(c['length']===0x0)return[];return[{'rule_id':'R-RAIL-UNBOUND','severity':'critical','title':c['length']+'\x20money\x20row(s)\x20bind\x20no\x20guard_key\x20—\x20the\x20rails\x20ship\x20uncovered\x20and\x20FUND-EXIT-01\x20goes\x20critical\x20at\x20generation','detail':'Allocator\x20rows\x20are\x20the\x20payload\x20compile\x20turns\x20into\x20order_allocators.\x20A\x20row\x20without\x20guard_key\x20emits\x20an\x20'+'allocator\x20carrying\x20no\x20guard\x20reference,\x20so\x20(a)\x20the\x20terminal\x20it\x20serves\x20has\x20no\x20resolved\x20allocator\x20guard\x20'+'(FUND-EXIT-01\x20critical),\x20and\x20(b)\x20no\x20pending-judgment\x20surface\x20exists\x20for\x20guard_resolutions\x20to\x20close\x20'+'(the\x20surface\x20is\x20keyed\x20by\x20row\x20guard_key\x20bindings)\x20—\x20the\x20build\x20is\x20deadlocked,\x20not\x20merely\x20warned\x20'+'(upw-ln-261011\x20TPL-01).\x20Unbound\x20rows:\x20'+c['map'](({r:d,i:e})=>'#'+e+'\x20('+d['track']+'/'+d['recipient']+')')['join'](',\x20')+'.','suggestion':'Declare\x20a\x20keyed\x20guard\x20spec\x20per\x20rail\x20and\x20bind\x20every\x20money\x20row\x20via\x20guard_key:\x20settlement\x20rides\x20'+'tpl_allocator_node_gate_settle\x20(the\x20kernel\x20auto-fills\x20it\x20—\x20service_name\x20is\x20seeded\x20from\x20the\x20plan,\x20'+'settle_node\x20defaults\x20to\x20\x27completed\x27)\x20plus\x20a\x20Rate-0\x20ORDER\x20anchor\x20row\x20sharing\x20the\x20key\x20(CR-01);\x20'+'refund/recovery\x20ride\x20pattern.progress_state_check\x20designs\x20gated\x20on\x20NODE\x20state\x20(decision\x2011:\x20fund\x20rails\x20'+'never\x20read\x20order.claimed_by\x20—\x20R-FUND-RAIL-CLAIMED-BY\x20critical).\x20Canonical\x20shapes:\x20freelance/catalog-tiers\x20(v48)\x20and\x20subscription/direct-fan-subscription.'}];}function counterpartyFundEvidenceChecks(a){const b=a['allocator']['rows']??[],c=a['guards']??[];if(b['length']===0x0||c['length']===0x0)return[];const d=k=>k==='pattern.repository_data_check'||typeof k==='string'&&k['startsWith']('tpl_repository_'),e=new Map();for(const k of c){if(k['key']&&d(k['template_id']))e['set'](k['key'],k);}if(e['size']===0x0)return[];const f=/order[- ]holder|order\.owner|co-?writ|co-?sign|both part(?:y|ies)|written by the (?:buyer|payer|order)|writer authorization|write[- ](?:authorization|policy|guard)|build[- ]time|pinned (?:at|to) (?:build|generation|publish)|value_from|fee_param|event evidence only|append[- ]only|a new row|re-?disclos/i,h=b['map']((l,m)=>({'r':l,'i':m}))['filter'](({r:l})=>{const m=l['guard_key']?e['get'](l['guard_key']):undefined;if(!m)return![];return!f['test'](m['purpose'])&&!(l['note']&&f['test'](l['note']));});if(h['length']===0x0)return[];const j=h['map'](({r:l,i:m})=>'#'+m+'\x20('+l['track']+'/'+(l['recipient_key']??l['recipient'])+'\x20->\x20\x27'+l['guard_key']+'\x27)')['join'](',\x20');return[{'rule_id':'R-COUNTERPARTY-FUND-EVIDENCE','severity':'high','title':h['length']+'\x20money\x20row(s)\x20gate\x20on\x20counterparty-mutable\x20repository\x20evidence\x20—\x20fund\x20terms\x20one\x20party\x20can\x20rewrite','detail':'Rows\x20'+j+'\x20bind\x20a\x20repository-data\x20gate,\x20and\x20repository.data\x20is\x20an\x20UPSERT\x20key-value\x20store:\x20'+'its\x20rows\x20stay\x20overwritable\x20by\x20their\x20author\x20(mainnet\x20A/B,\x20ofn-mn-261012\x20F-02)\x20and\x20an\x20overwrite\x20raises\x20'+'no\x20buyer-parseable\x20event\x20(the\x20overwrite\x20event\x20renders\x20\x27Unknown\x20event\x27).\x20Whoever\x20writes\x20the\x20evidence\x20'+'can\x20therefore\x20silently\x20re-decide\x20WHICH\x20rail\x20applies\x20or\x20WHETHER\x20the\x20gate\x20matches\x20at\x20all\x20—\x20the\x20audited\x20'+'airbnb\x20service\x20ran\x20its\x20refunds\x20through\x20gates\x20the\x20host\x20rewrote\x20AFTER\x20the\x20buyer\x20had\x20already\x20cancelled,\x20'+'down\x20to\x20zero\x20matching\x20rails\x20(abnb7-mn-261013\x20F25).\x20Neither\x20the\x20guard\x20purpose\x20nor\x20the\x20row\x20note\x20declares\x20'+'the\x20counterparty\x20discipline.','suggestion':'Pin\x20every\x20fund\x20TERM\x20at\x20build\x20time\x20—\x20amounts\x20and\x20tier\x20selection\x20ride\x20value_from\x20/\x20fee_params\x20and\x20freeze\x20'+'into\x20the\x20allocator\x20at\x20publish;\x20repository\x20rows\x20carry\x20EVENT\x20evidence\x20only\x20and\x20never\x20select\x20between\x20rails.\x20'+'If\x20a\x20repository\x20row\x20must\x20inform\x20money\x20at\x20all,\x20its\x20write\x20authorization\x20MUST\x20include\x20the\x20order\x20holder\x20'+'(co-write\x20/\x20proof\x20signed\x20by\x20the\x20order\x20holder)\x20and\x20changes\x20land\x20as\x20a\x20NEW\x20row\x20with\x20disclosure\x20visible\x20to\x20'+'the\x20counterparty\x20through\x20the\x20Messenger\x20channel\x20—\x20never\x20an\x20in-place\x20overwrite\x20(see\x20p2p-shortstay\x27s\x20'+'guest_claim_evidence\x20for\x20the\x20participation\x20form\x20and\x20its\x20FUND-TERMS\x20build\x20note\x20for\x20the\x20full\x20discipline).'}];}function allocReplayChecks(a){const b=a['allocator']['rows']??[];if(b['length']===0x0)return[];if(a['allocator']['once_per_order']===!![])return[];if(poolPeriodCount(a)!==undefined)return[];const c=new Map();for(const e of b){const f=e['guard_key']??'';c['set'](f,[...c['get'](f)??[],e]);}const d=[];for(const [h,j]of c){if(j['some'](n=>n['mode']==='surplus'))continue;const k=j['filter'](n=>n['mode']==='amount');let l=0x0;for(const n of j)if(n['mode']==='rate')l+=Number(n['value'])||0x0;if(k['length']===0x0&&l>=0x2710)continue;const m=h?'guard\x20\x27'+h+'\x27':'ungrouped\x20rows';k['length']>0x0&&d['push']('fixed-Amount\x20row(s)\x20under\x20'+m+':\x20'+k['map'](o=>o['track']+'/'+(o['recipient_key']??o['recipient']))['join'](',\x20')),l>0x0&&l<0x2710&&d['push']('Rate\x20leg\x20under\x20'+m+'\x20summing\x20'+l+'\x20<\x2010000');}if(d['length']===0x0)return[];return[{'rule_id':'R-ALLOC-REPLAY','severity':'high','title':'Residual-capable\x20rails\x20without\x20a\x20once-slot\x20—\x20replay\x20protection\x20is\x20only\x20the\x20drained-balance\x20side\x20effect','detail':'The\x20allocator\x20declares\x20'+d['join']('\x20and\x20')+'\x20but\x20sets\x20no\x20once_per_order\x20replay\x20slot.\x20The\x20trigger\x20'+'guard\x20can\x20be\x20satisfied\x20repeatedly,\x20and\x20each\x20run\x20pays\x20from\x20any\x20remaining\x20balance:\x20a\x20replayed\x20alloc\x20on\x20a\x20'+'drained\x20pool\x20aborts\x20\x27Insufficient\x20balance\x27\x20—\x20the\x20guard\x20clauses\x20themselves\x20PASS\x20(the\x20once-protection\x20is\x20'+'the\x20zero\x20balance,\x20not\x20a\x20consumed-once\x20flag).\x20Any\x20surplus\x20leg\x20that\x20leaves\x20balance,\x20or\x20a\x20later\x20re-deposit\x20'+'into\x20the\x20Allocation,\x20re-enables\x20payout\x20(mainnet\x20az-mn-261007\x20N5).','suggestion':'Declare\x20allocator.once_per_order=true\x20so\x20generation\x20registers\x20the\x20ONCE-FOR-OBJECT\x20submission\x20slot\x20'+'(identifier\x20254\x20—\x20the\x20chain\x20derives\x20the\x20slot\x20key\x20from\x20payment_info.for_object\x20and\x20a\x20replay\x20aborts\x20with\x20'+'code\x2016\x20regardless\x20of\x20submitted\x20bytes;\x20use\x20identifier\x20255\x20with\x20a\x20\x27period-<N>\x27\x20key\x20only\x20for\x20rails\x20that\x20'+'legitimately\x20run\x20once\x20per\x20period).\x20Alternatively\x20make\x20every\x20leg\x20exhaust\x20its\x20pool\x20(pure\x20Rate\x2010000\x20or\x20a\x20'+'Surplus\x20sweep)\x20so\x20no\x20residual\x20can\x20be\x20replayed.'}];}function arbDirectionSanityChecks(a){const b=[];let c=![],d=![];for(const f of a['guards']){const g=GUARD_TEMPLATES['find'](j=>j['id']===f['template_id']);if(g===undefined)continue;const h=JSON['stringify']({'example_table':g['example_table'],'example_root':g['example_root']});!c&&/arb\.status/['test'](h)&&(c=!![],b['push']({'rule_id':'R-DIR-01','severity':'critical','title':'Guard\x20gates\x20on\x20arb.status\x20—\x20a\x20transient\x20state\x20that\x20flips\x20AFTER\x20the\x20award\x20settles\x20(o10)','detail':'Guard\x20\x27'+f['template_id']+'\x27\x20(key\x20\x27'+f['key']+'\x27)\x20reads\x20arb.status.\x20The\x20status\x20vocabulary\x20'+'(0/1\x20confirming,\x202\x20voting,\x203\x20arbitrated,\x204\x20objectionable,\x205\x20finished,\x206\x20withdrawn)\x20'+'carries\x20NO\x20direction:\x20a\x20merchant-favor\x20and\x20a\x20buyer-favor\x20final\x20are\x20status-identical,\x20and\x20a\x20legitimate\x20'+'arb_withdraw\x20by\x20the\x20arbitrator\x20advances\x205\x20→\x206\x20after\x20the\x20award\x20settles\x20—\x20the\x20gate\x20flips\x20under\x20a\x20settled\x20'+'order\x20(o10:\x201.5\x20WOW\x20stranded;\x20IMMUT-001\x20forbids\x20fixing\x20the\x20guard\x20after\x20publish).','suggestion':'Gate\x20on\x20the\x20indemnity\x20legs\x20instead\x20—\x20the\x20only\x20direction-bearing,\x20transient-proof\x20signal:\x20'+'buyer-won\x20=\x20tpl_forward_arb_ruling_won\x20(arb.indemnity\x20some\x20AND\x20arb.indemnity.amount\x20!=\x200);\x20'+'merchant-favor\x20=\x20tpl_forward_arb_ruling_dismissed\x20(arb.indemnity.amount\x20==\x200).\x20Both\x20fail\x20closed\x20'+'on\x20None\x20(never-ruled\x20/\x20reset).'})),!d&&/arb\.indemnity some/['test'](h)&&!/arb\.indemnity\.amount/['test'](h)&&(d=!![],b['push']({'rule_id':'R-DIR-02','severity':'critical','title':'Won-gate\x20reads\x20indemnity\x20PRESENCE\x20only\x20—\x20a\x20Some(0)\x20merchant-favor\x20ruling\x20passes\x20as\x20buyer-won','detail':'Guard\x20\x27'+f['template_id']+'\x27\x20(key\x20\x27'+f['key']+'\x27)\x20checks\x20arb.indemnity\x20some\x20but\x20never\x20compares\x20'+'arb.indemnity.amount.\x20A\x20ruling\x20that\x20awarded\x20the\x20buyer\x20NOTHING\x20still\x20sets\x20presence\x20(Some(0)\x20—\x20'+'rex-mn-261021\x20T5),\x20so\x20this\x20gate\x20opens\x20a\x20buyer-ward\x20edge\x20on\x20a\x20merchant-favor\x20final.','suggestion':'Add\x20the\x20amount\x20leg\x20exactly\x20like\x20tpl_forward_arb_ruling_won:\x20arb.indemnity.amount\x20!=\x200\x20'+'(optionally\x20>\x20refund_amount\x20×\x20arb_indemnity_floor_bps\x20/\x2010000\x20to\x20bar\x20token\x20indemnities,\x20F-54).'}));}const e=a['allocator']['rows']??[];for(const j of e){const k=JSON['stringify']({'note':j['note']??'','guard':j['guard_key']??''});/(?<!former )claimed_by\s*(?:is\s+)?(?:none\b|some\b)(?![^.)]{0,90}\bREMOVED\b)/['test'](k)&&b['push']({'rule_id':'R-FUND-RAIL-CLAIMED-BY','severity':'critical','title':'Fund-rail\x20allocator\x20row\x20reads\x20claimed_by\x20—\x20the\x20two\x20rails\x20must\x20stay\x20independent\x20(Decision\x2011)','detail':'Row\x20\x27'+j['track']+'/'+(j['recipient_key']??j['recipient'])+'\x27\x20(guard\x20\x27'+(j['guard_key']??'?')+'\x27)\x20gates\x20the\x20'+'FUND\x20rail\x20on\x20claimed_by\x20—\x20the\x20compensation\x20rail\x27s\x20stamp.\x20Decision\x2011\x20(TWO-RAIL\x20INDEPENDENCE):\x20'+'fund\x20rails\x20are\x20NODE-GATED\x20and\x20NEVER\x20read\x20order.claimed_by\x20—\x20the\x20axis\x20records\x20THAT\x20a\x20compensation\x20'+'event\x20happened,\x20never\x20who\x20won\x20(F-AOF-1),\x20so\x20a\x20claimed_by\x20leg\x20welds\x20fund-payout\x20timing\x20to\x20a\x20'+'direction-blind\x20stamp\x20(five-report\x20P0\x20face:\x20tbpr7\x20F-V3-01,\x20pdd\x20T6,\x20ktt4\x20RT-01).\x20Refunds\x20complete\x20'+'on\x20order\x20nodes;\x20recover\x20clears\x20on\x20terminal\x20nodes;\x20the\x20arbitration\x20award\x20is\x20the\x20indemnity\x20track\x27s\x20'+'separate\x20commercial\x20payout\x20—\x20overlap\x20with\x20a\x20due\x20refund\x20is\x20LEGAL\x20and\x20disclosed\x20at\x20the\x20MCP\x20'+'dual-payout\x20confirmation\x20gate\x20(amz9\x20A-1).','suggestion':'Remove\x20every\x20claimed_by\x20leg\x20from\x20this\x20fund-rail\x20guard.\x20Refund\x20rail:\x20tpl_allocator_node_gate_refund\x20'+'(node\x20+\x20caller-authorization\x20legs,\x20order\x20owner\x20/\x20progress.current).\x20Recover\x20rail:\x20'+'tpl_allocator_node_gate_recover\x20(terminal-node-gated\x20sweep\x20+\x20order.service).\x20If\x20a\x20direction\x20'+'refinement\x20is\x20truly\x20required,\x20use\x20the\x20direction-bearing\x20indemnity\x20legs\x20'+'(tpl_forward_arb_ruling_won\x20/\x20_dismissed)\x20—\x20never\x20claimed_by\x20(K3\x20README\x20Decision\x2011).'});}for(const l of e){const m=/recover/i['test'](l['guard_key']??'')||/recover/i['test'](l['track']??''),n=/merchant-side sweep/i['test'](l['note']??'');if(m&&l['recipient']==='entity'&&!n){b['push']({'rule_id':'R-DIR-03','severity':'critical','title':'Recovery\x20row\x20sweeps\x20residual\x20principal\x20to\x20a\x20merchant-side\x20Entity\x20with\x20NO\x20stated\x20disposition\x20intent\x20(RT-01\x20face)','detail':'Row\x20\x27'+l['track']+'/'+(l['recipient_key']??l['recipient'])+'\x27\x20(guard\x20\x27'+(l['guard_key']??'?')+'\x27)\x20is\x20a\x20'+'terminal-node-gated\x20recovery\x20sweep\x20(decision\x2011:\x20node\x20state\x20only,\x20never\x20order.claimed_by)\x20that\x20'+'pays\x20the\x20residual\x20principal\x20to\x20a\x20merchant-side\x20Entity.\x20The\x20payee\x20is\x20a\x20POLICY\x20choice,\x20not\x20a\x20'+'chain-forced\x20default:\x20when\x20the\x20buyer\x20WON\x20an\x20award\x20while\x20the\x20escrow\x20principal\x20was\x20never\x20refunded,\x20'+'a\x20merchant-ward\x20sweep\x20nets\x20the\x20winner\x20a\x20loss\x20(ktt4\x20RT-01:\x20300M\x20award\x20from\x20the\x20compensation\x20pool,\x20'+'then\x20the\x20600M\x20escrow\x20principal\x20swept\x20to\x20the\x20merchant).\x20Merchant-exit\x20is\x20the\x20legal\x20never-strand\x20'+'default\x20(esln\x20E-2),\x20but\x20it\x20must\x20be\x20the\x20author\x27s\x20conscious\x20choice\x20per\x20shape\x20—\x20an\x20award\x20and\x20a\x20due\x20'+'refund\x20are\x20independent\x20rails\x20(TWO-RAIL\x20INDEPENDENCE,\x20decision\x2011)\x20and\x20their\x20overlap\x20is\x20disclosed\x20'+'at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20(amz9\x20A-1).','suggestion':'If\x20the\x20business\x20intent\x20is\x20unwind-on-buyer-win,\x20add\x20a\x20buyer-ward\x20twin\x20row\x20(recipient\x20slot\x200\x20—\x20the\x20'+'Order\x20address;\x20owner.receive\x20credits\x20the\x20buyer)\x20gated\x20on\x20the\x20same\x20terminal\x20node,\x20and\x20split\x20the\x20'+'merchant-ward\x20row\x20behind\x20a\x20dismissed-weld\x20(logic_not\x20over\x20arb.indemnity.amount\x20==\x200)\x20—\x20the\x20'+'indemnity\x20amount\x20is\x20the\x20ONLY\x20direction-bearing\x20signal\x20on\x20chain\x20(there\x20is\x20no\x20winner\x20accessor).\x20'+'CLOSE\x20THE\x20UNSTAMPED\x20WINDOW\x20IN\x20THE\x20GUARD,\x20NOT\x20ONLY\x20IN\x20DUTIES\x20(P155-01+11,\x20v139):\x20mount\x20the\x20'+'dispute-state\x20freeze\x20leg\x20logic_not[query(1576\x20order.dispute.open)]\x20on\x20the\x20refund\x20rail\x20—\x20it\x20blocks\x20'+'while\x20a\x20case\x20is\x20on\x20file\x20with\x20the\x20claim\x20slot\x20unspent\x20(live\x20AND\x20decided-unstamped\x20alike),\x20and\x20a\x20'+'keeper-driven\x20case\x20conclusion\x20(claimed_by\x20some)\x20releases\x20it\x20by\x20itself.\x20Query\x201578\x20'+'(order.dispute.unstamped)\x20then\x20tells\x20the\x20keeper\x20WHICH\x20state\x20holds:\x20in-flight\x20(wait)\x20vs\x20'+'resolved-awaiting-stamp\x20(one\x20arb_case_conclude\x20tx).\x20Dual-track\x20prescription:\x20the\x201576\x20leg\x20is\x20the\x20'+'enforcement\x20(kernel-expressible\x20as\x20of\x20protocol\x20v139,\x20flag\x20enable_order_dispute_state\x20—\x20on\x20older\x20'+'binaries\x20it\x20reads\x20false\x20and\x20the\x20leg\x20admits,\x20check\x20upgrade_check);\x20the\x20keeper\x20duty\x20'+'(arb_case_conclude\x20at\x20ruling\x20finality)\x20remains\x20mandatory\x20either\x20way.\x20If\x20merchant-exit\x20is\x20'+'intended,\x20state\x20the\x20MERCHANT-EXIT\x20POLICY\x20in\x20the\x20row\x20note\x20(the\x20canonical\x20\x27merchant-side\x20sweep\x27\x20'+'sentence)\x20so\x20the\x20scan\x20records\x20the\x20conscious\x20choice\x20and\x20stops\x20flagging\x20it.'});break;}}return b;}function disputeFreezeChecks(a){const b=/settle|\bband\b|recover|award|refund|return/i,c=/arb|indemnity|dispute|claim/i,d=h=>{const j=JSON['stringify'](h??{});return j['includes']('\x22order.dispute.open\x22')&&j['includes']('\x22logic_not\x22');},e=h=>h['template_id']['startsWith']('tpl_')?h['template_id']:/resolve with (tpl_[a-z0-9_]+)/['exec'](h['purpose'])?.[0x1],f=new Set(['tpl_allocator_node_gate_settle','tpl_allocator_node_gate_settle_nodes','tpl_allocator_node_gate_refund_renewal','tpl_allocator_serial_window_release','tpl_allocator_session_release','tpl_allocator_node_gate_claim_settle']),g=new Set();for(const h of a['allocator']['rows']??[]){const j=h['track']+'\x20'+(h['guard_key']??'');if(!b['test'](j)||c['test'](j))continue;if(h['guard_key']===undefined)continue;const k=a['guards']['find'](n=>n['key']===h['guard_key']);if(k===undefined)continue;const l=e(k);if(l===undefined)continue;if(f['has'](l))continue;const m=GUARD_TEMPLATES['find'](n=>n['id']===l);if(m===undefined)continue;if(!d(m['example_root']))g['add']('\x27'+h['guard_key']+'\x27\x20->\x20'+l);}if(g['size']===0x0)return[];return[{'rule_id':'R-DISPUTE-FREEZE-MISSING','severity':'high','title':'Fund\x20rail\x20lacks\x20the\x20dispute\x20freeze\x20leg\x20—\x20payouts\x20stay\x20driveable\x20while\x20a\x20dispute\x20case\x20is\x20on\x20file\x20(W5-14)','detail':'Row(s)\x20'+[...g]['join'](',\x20')+'\x20gate\x20a\x20settle/recover/refund\x20fund\x20rail\x20on\x20a\x20guard\x20twin\x20whose\x20root\x20'+'carries\x20NO\x20dispute\x20freeze\x20leg.\x20While\x20a\x20dispute\x20case\x20is\x20on\x20file\x20with\x20the\x20claim\x20slot\x20unspent\x20the\x20rail\x20'+'stays\x20driveable:\x20a\x20settle/recover/refund\x20can\x20fire\x20OUT\x20FROM\x20UNDER\x20an\x20open\x20—\x20or\x20decided-but-unstamped\x20—\x20'+'case,\x20and\x20the\x20award\x20then\x20lands\x20on\x20a\x20drained\x20pool\x20(ddmc4\x20B-24/B-25:\x20an\x20outsider\x20rail\x20fired\x20mid-dispute;\x20'+'h1w9\x20F-02:\x20the\x20decided-unstamped\x20window\x20was\x20the\x20release\x20hole).\x20Guards\x20are\x20immutable\x20after\x20publish\x20'+'(IMMUT-001),\x20so\x20the\x20leg\x20must\x20ship\x20BEFORE\x20the\x20service\x20goes\x20live.','suggestion':'Resolve\x20the\x20rail\x20to\x20a\x20rail\x20twin\x20that\x20ships\x20the\x20freeze\x20IN\x20its\x20root\x20(tpl_allocator_node_gate_settle_once,\x20'+'tpl_allocator_settle_band_once,\x20tpl_allocator_prize_settle_once,\x20tpl_allocator_node_gate_refund,\x20'+'tpl_allocator_node_gate_recover),\x20or\x20mount\x20the\x20leg\x20on\x20the\x20custom\x20root:\x20CLOSE\x20THE\x20UNSTAMPED\x20WINDOW\x20IN\x20'+'THE\x20GUARD,\x20NOT\x20ONLY\x20IN\x20DUTIES\x20(P155-01+11,\x20v139):\x20the\x20dispute-state\x20freeze\x20leg\x20'+'logic_not[query(1576\x20order.dispute.open)]\x20at\x20the\x20slot-0\x20Order\x20anchor\x20blocks\x20while\x20a\x20case\x20is\x20on\x20file\x20'+'with\x20the\x20claim\x20slot\x20unspent\x20(live\x20AND\x20decided-unstamped\x20alike),\x20and\x20a\x20keeper-driven\x20case\x20conclusion\x20'+'releases\x20it\x20by\x20itself.\x20Query\x201578\x20(order.dispute.unstamped)\x20tells\x20the\x20keeper\x20WHICH\x20state\x20holds:\x20'+'in-flight\x20(wait)\x20vs\x20resolved-awaiting-stamp\x20(one\x20arb_case_conclude\x20tx).\x20The\x201576\x20leg\x20is\x20the\x20'+'enforcement\x20(kernel-expressible\x20as\x20of\x20protocol\x20v139,\x20flag\x20enable_order_dispute_state\x20—\x20on\x20older\x20'+'binaries\x20it\x20reads\x20false\x20and\x20the\x20leg\x20admits,\x20check\x20upgrade_check);\x20the\x20keeper\x20duty\x20(arb_case_conclude\x20'+'at\x20ruling\x20finality)\x20remains\x20mandatory\x20either\x20way.'}];}export function refundGatePolarityChecks(a){const b=/settle|\bband\b|recover|award|refund|return/i,c=/arb|indemnity|dispute|claim/i,d=f=>f['template_id']['startsWith']('tpl_')?f['template_id']:/resolve with (tpl_[a-z0-9_]+)/['exec'](f['purpose'])?.[0x1],e=new Set();for(const f of a['allocator']['rows']??[]){const g=f['track']+'\x20'+(f['guard_key']??'');if(!b['test'](g)||c['test'](g))continue;if(f['guard_key']===undefined)continue;const h=a['guards']['find'](m=>m['key']===f['guard_key']);if(h===undefined)continue;const j=d(h);if(j===undefined)continue;const k=GUARD_TEMPLATES['find'](m=>m['id']===j);if(k===undefined)continue;const l=refundGatePolarityMix(k['example_root']);if(l!==undefined)e['add']('\x27'+f['guard_key']+'\x27\x20->\x20'+j);}if(e['size']===0x0)return[];return[{'rule_id':'R-REFUND-GATE-POLARITY','severity':'critical','title':'Fund-rail\x20guard\x20mixes\x20caller-identity\x20arms\x20with\x20NOT-state\x20arms\x20in\x20one\x20OR\x20—\x20the\x20freeze\x20becomes\x20an\x20authorization\x20(cour-mn-261102-z5t8\x20A2)','detail':'Row(s)\x20'+[...e]['join'](',\x20')+'\x20compile\x20from\x20a\x20rail\x20twin\x20whose\x20root\x20carries\x20a\x20logic_not\x20STATE\x20leg\x20as\x20a\x20DIRECT\x20'+'arm\x20of\x20the\x20same\x20logic_or\x20group\x20that\x20carries\x20the\x20caller-identity\x20arms.\x20An\x20OR\x20makes\x20every\x20arm\x20an\x20ALTERNATIVE\x20way\x20'+'to\x20pass,\x20so\x20the\x20NOT-state\x20arm\x20becomes\x20a\x20legal-caller\x20option\x20beside\x20the\x20identity\x20options:\x20whoever\x20simply\x20has\x20not\x20'+'reached\x20that\x20state\x20passes\x20as\x20a\x20caller\x20—\x20any\x20address\x20that\x20never\x20opened\x20a\x20dispute\x20can\x20sweep\x20the\x20rail\x20(mainnet\x20'+'REFUND-POLARITY:\x20the\x20buyer\x27s\x20not-in-dispute\x20state\x20was\x20compiled\x20into\x20refund_gate\x27s\x20caller\x20identity\x20options).\x20'+'A\x20negated\x20state\x20leg\x20is\x20a\x20payout\x20FREEZE,\x20never\x20an\x20authorization.\x20Guards\x20are\x20immutable\x20after\x20publish\x20(IMMUT-001).','suggestion':'Hoist\x20the\x20logic_not\x20leg\x20OUT\x20of\x20the\x20OR\x20into\x20a\x20TOP-LEVEL\x20logic_and\x20conjunction\x20—\x20'+'logic_and[\x20logic_or[<identity\x20legs>],\x20logic_not(<state\x20leg>)\x20]\x20—\x20the\x20recover_gate\x20shape\x20(etsm\x20F-04):\x20the\x20freeze\x20'+'then\x20gates\x20EVERY\x20caller\x20instead\x20of\x20widening\x20the\x20caller\x20set.\x20The\x20compile\x20face\x20hard-blocks\x20the\x20same\x20shape\x20'+'(REFUND_GATE_POLARITY_MIX)\x20once\x20the\x20root\x20is\x20resolved.'}];}export function arbRefundWithoutFundChecks(a){if((a['machine_shape']??[])['length']===0x0)return[];const b=new Map(a['guards']['map'](e=>[e['key'],e])),c=a['machine_shape']['some'](e=>{if(e['semantic_role']!=='final')return![];for(const f of e['from']??[]){if(typeof f==='string')continue;const g=f['guard_key']===undefined?undefined:b['get'](f['guard_key']);if(g?.['template_id']==='tpl_forward_arb_ruling_won')return!![];}return![];});if(!c)return[];const d=Object['entries'](a['fee_params']??{})['filter'](([e,f])=>{if(!/compensation_fund/i['test'](e))return![];const g=typeof f==='number'?f:/^\d+$/['test'](String(f)['trim']())?Number(f):undefined;return g!==undefined&&g<=0x0;});if(d['length']===0x0)return[];return[{'rule_id':'R-ARB-REFUND-WITHOUT-FUND','severity':'high','title':'Post-settlement\x20arb\x20re-route\x20with\x20a\x20zero-value\x20compensation_fund\x20—\x20an\x20unfunded\x20buyer\x20remedy\x20(etsm-mn-261102-z5r8\x20F-02)','detail':'The\x20machine\x20routes\x20an\x20arb-ruling-won\x20edge\x20out\x20of\x20a\x20settled\x20terminal\x20(escrow\x20already\x20drained),\x20so\x20the\x20'+'compensation\x20fund\x20is\x20the\x20buyer\x27s\x20ONLY\x20money\x20behind\x20that\x20ruling\x20—\x20yet\x20fee_params\x20declare\x20'+(d['map'](([e,f])=>e+'='+JSON['stringify'](f))['join'](',\x20')+':\x20the\x20funding\x20step\x20would\x20ship\x20balance\x20\x220\x22\x20')+'and\x20the\x20build-time\x20COMPENSATION_FUND_REQUIRED\x20gate\x20would\x20never\x20see\x20it\x20(input\x20presence\x20bypassed\x20the\x20gate).\x20'+'INV-4\x20family:\x20an\x20unfunded\x20promise\x20must\x20not\x20publish.\x20Guards\x20freeze\x20at\x20publish\x20(IMMUT-001).','suggestion':'Declare\x20a\x20non-zero\x20compensation_fund\x20(>=\x20the\x20largest\x20single-order\x20exposure)\x20in\x20fee_params\x20so\x20the\x20funding\x20'+'step\x20is\x20real,\x20or\x20drop\x20the\x20post-settlement\x20arb\x20re-route\x20from\x20the\x20machine\x20shape.'}];}export function rewardBelowClaimGasChecks(a){if(a['review_mode']!=='review_reward')return[];const b=(a['fee_params']??{})['review_reward_per_claim'],c=typeof b==='number'?b:typeof b==='string'&&/^\d+$/['test'](b['trim']())?Number(b['trim']()):undefined;if(c===undefined||c<=0x0||c>=0x5b8d80)return[];return[{'rule_id':'R-REWARD-BELOW-CLAIM-GAS','severity':'high','title':'Per-claim\x20bounty\x20below\x20the\x20claim\x20gas\x20floor\x20—\x20no\x20rational\x20user\x20can\x20claim\x20(cour-mn-261102-z5t8\x20C1)','detail':'fee_param\x20review_reward_per_claim\x20=\x20'+c+'\x20smallest\x20units,\x20below\x20the\x20claim\x20gas\x20floor\x20(6_000_000\x20=\x200.006\x20WOW):\x20'+'a\x20claim\x20transaction\x20costs\x20≈0.0026\x20WOW\x20on\x20mainnet\x20(cour\x20BOUNTY-BELOW-GAS,\x20etsm\x20measured),\x20so\x20claiming\x20at\x20this\x20'+'bounty\x20LOSES\x20money\x20—\x20the\x20reward\x20rail\x20is\x20a\x20dead\x20incentive\x20and\x20the\x20funded\x20pool\x27s\x20balance\x20is\x20stranded.','suggestion':'Raise\x20review_reward_per_claim\x20to\x20>=\x200.006\x20WOW\x20(6_000_000\x20smallest\x20units)\x20per\x20claim,\x20or\x20drop\x20the\x20'+'review_reward\x20track\x20(review_mode\x20\x27review\x27\x20without\x20a\x20payable\x20bounty\x20is\x20the\x20honest\x20shape).'}];}export function proseCapAdvisoryChecks(a){const b=(a['guards']??[])['map']((c,d)=>({'address':'guards['+d+'].purpose','bytes':Buffer['byteLength'](c['purpose']??'','utf8')}))['filter'](c=>c['bytes']>0x1e0)['map'](c=>c['address']+'\x20('+c['bytes']+'B)');if(b['length']===0x0)return[];return[{'rule_id':'R-PROSE-CAP-ADVISORY','severity':'low','title':'Prose\x20field\x20exceeds\x20480\x20bytes\x20—\x20the\x20500-byte\x20emission\x20cap\x20will\x20truncate\x20its\x20tail\x20(etsm-mn-261102-z5r8\x20F-09)','detail':'Field(s)\x20'+b['join'](',\x20')+'\x20ride\x20the\x20500-byte\x20UTF-8\x20emission\x20cap\x20(policy\x20descriptions\x20/\x20write_guard\x20'+'bindings\x20/\x20machine\x20prose).\x20The\x20cap\x20truncates\x20at\x20the\x20last\x20complete\x20sentence\x20(word\x20boundary\x20fallback)\x20—\x20'+'the\x20tail\x20sentences\x20are\x20DROPPED\x20at\x20emission,\x20so\x20what\x20ships\x20is\x20a\x20prefix\x20of\x20the\x20intent.','suggestion':'Tighten\x20the\x20prose\x20under\x20480\x20bytes\x20per\x20field,\x20or\x20split\x20the\x20content\x20across\x20fields\x20—\x20keep\x20the\x20on-chain\x20'+'document\x20self-contained\x20instead\x20of\x20letting\x20the\x20cap\x20decide\x20the\x20ending.'}];}export const SERVICE_SALE_FIELDS=new Set(['name','price','stock','quantity','suspension','wip','wip_hash']);export const PLAN_SALE_META_FIELDS=new Set(['incentive']);export const SERVICE_SALE_INPUT_FIELDS=new Set([...SERVICE_SALE_FIELDS,...PLAN_SALE_META_FIELDS]);export function salesVocabularyChecks(a){const b=a['sales'];if(!Array['isArray'](b))return[];const c=[];return b['forEach']((d,e)=>{const f=d;if(f===null||typeof f!=='object'||Array['isArray'](f))return;const g=Object['keys'](f)['filter'](h=>!SERVICE_SALE_INPUT_FIELDS['has'](h));if(g['length']===0x0)return;c['push']({'rule_id':'R-SALE-VOCABULARY','severity':'high','title':'Sales\x20SKU\x20field(s)\x20outside\x20the\x20executor\x27s\x20ServiceSaleSchema\x20vocabulary\x20(cour-mn-261102-z5t8\x20E2)','detail':'sales['+e+']\x20(name\x20\x27'+String(f['name']??'?')+'\x27)\x20carries\x20'+g['map'](h=>'\x27'+h+'\x27')['join'](',\x20')+'\x20—\x20'+'outside\x20the\x20executor\x27s\x20vocabulary\x20(name,\x20price,\x20stock\x20/\x20alias\x20quantity,\x20suspension,\x20wip,\x20wip_hash;\x20'+'plus\x20the\x20PLAN-METADATA\x20declaration\x20\x27incentive\x27,\x20which\x20the\x20emitter\x20strips\x20before\x20the\x20chain\x20write).\x20'+'The\x20sales\x20configure\x20rides\x20params\x20verbatim:\x20the\x20unknown\x20fields\x20abort\x20the\x20step\x20at\x20EXECUTION\x20with\x20'+'schema_mismatch\x20for\x20every\x20adopter\x20of\x20this\x20template,\x20not\x20just\x20this\x20row.','suggestion':'Rename\x20or\x20drop\x20'+g['map'](h=>'\x27'+h+'\x27')['join'](',\x20')+'\x20from\x20the\x20sales\x20row\x20—\x20the\x20executor\x27s\x20'+'ServiceSaleSchema\x20accepts\x20only\x20name,\x20price,\x20stock\x20(or\x20\x27quantity\x27),\x20suspension,\x20wip,\x20wip_hash;\x20'+'the\x20sole\x20sanctioned\x20extra\x20is\x20the\x20\x27incentive\x27\x20declaration\x20(plan\x20metadata,\x20stripped\x20at\x20emission).\x20'+'Template-authored\x20extras\x20belong\x20in\x20the\x20machine\x20prose\x20or\x20fee_params,\x20not\x20the\x20sales\x20catalog.'});}),c;}function draftVoidChecks(a){const b=a['machine_shape']??[];if(b['length']===0x0)return[];if(!b['some'](g=>(g['from']??[])['length']>0x0))return[];const c=g=>{const h=[];for(const j of b){for(const k of j['from']??[]){const l=typeof k==='string'?k:k?.['prev'];if(l!==g)continue;const o=typeof k==='object'&&k?.['operator']?k['operator']:j['operator']??'merchant';h['push']({'target':j,'op':o});}}return h;},d=[],e=a['crowdfunding_mode']!==undefined&&a['crowdfunding_mode']!=='none',f=e?b['find'](g=>(g['from']??[])['some'](h=>typeof h!=='string'&&h['prev']===''))?.['name']:undefined;for(const g of b){if(!/escrow/i['test'](g['role']??''))continue;if(f!==undefined&&g['name']!==f)continue;const h=(g['from']??[])['some'](l=>typeof l==='object'&&l!==null&&/file|objection|appeal|dispute|walk_claim/i['test'](l['forward']??''));if(h)continue;if(/award|pays the (host|seller|creator|merchant|provider)/i['test'](g['role']??''))continue;if(/^(delivered|final|cancelled)$/['test'](g['semantic_role']??''))continue;const j=c(g['name']),k=j['some'](({target:l,op:m})=>m==='order_payer'&&l['semantic_role']==='cancelled');if(k)continue;d['push'](j['length']===0x0?'\x27'+g['name']+'\x27\x20has\x20NO\x20outgoing\x20forward\x20at\x20all\x20(entry\x20dead-end)':'\x27'+g['name']+'\x27\x20exits\x20only\x20via\x20'+j['map'](({target:l,op:m})=>l['name']+'['+m+']')['join'](',\x20'));}if(d['length']===0x0)return[];return[{'rule_id':'R-DRAFT-VOID','severity':'high','title':'Escrowed\x20node\x20without\x20a\x20buyer-side\x20void\x20hop\x20—\x20abandoned\x20orders\x20strand\x20the\x20escrow','detail':'Buy\x20escrows\x20atomically,\x20so\x20the\x20money\x20is\x20pooled\x20from\x20the\x20moment\x20the\x20order\x20exists.\x20'+d['join'](';\x20')+'\x20—\x20none\x20of\x20these\x20routes\x20is\x20an\x20order-payer\x20hop\x20into\x20a\x20cancelled\x20'+'endpoint,\x20so\x20a\x20buyer\x20who\x20abandons\x20or\x20fails\x20mid-order\x20(transport\x20error,\x20second\x20thoughts,\x20'+'a\x20ghost\x20order)\x20has\x20funds\x20locked\x20with\x20no\x20single-hop\x20exit\x20(mainnet\x20az-mn-261007\x20G2:\x20the\x20'+'deployed\x20machine\x27s\x20draft\x20node\x20had\x20only\x20the\x20entry\x20forward;\x20voiding\x20required\x20Enter\x20->\x20'+'CancelBeforePayment).','suggestion':'Add\x20an\x20order-payer\x20forward\x20from\x20every\x20escrowed\x20node\x20to\x20the\x20template\x27s\x20cancelled\x20endpoint\x20'+'(e.g.\x20\x27paid\x20->\x20closed_cancel\x27,\x20operator\x20\x27order_payer\x27)\x20gated\x20by\x20the\x20cancel\x20guard;\x20the\x20refund\x20'+'rail\x20must\x20stay\x20mounted\x20—\x20escrow\x20is\x20funded\x20at\x20order_new,\x20not\x20at\x20first\x20forward.'}];}const DELIVERY_SURFACE_REGEX=/\b(ship(?:s|ping|ped|ment)?|tracking|courier|parcel|pickup|check[- ]?in|hand[- ]?over|redeem(?:s|ed|ption)?)\b/i,REQINFO_SURFACE_REGEX=/required[_ ]?info|customer_required|\b1572\b|required_info_evidence_gate/i;function requiredInfoGateChecks(a){const b=a['machine_shape']['filter'](c=>DELIVERY_SURFACE_REGEX['test'](c['name']+'\x20'+c['role']))['map'](c=>'\x27'+c['name']+'\x27\x20('+c['role']+')');if(b['length']===0x0)return[];if(REQINFO_SURFACE_REGEX['test'](templateText(a)))return[];return[{'rule_id':'R-REQINFO-GATE','severity':'high','title':'Fulfilment\x20flow\x20never\x20enforces\x20buyer\x20required\x20info\x20—\x20Service.customer_required\x20is\x20declarative-only','detail':'The\x20on-chain\x20purchase\x20entry\x20never\x20reads\x20Service.customer_required,\x20so\x20an\x20order\x20that\x20skips\x20every\x20'+'required\x20field\x20still\x20creates.\x20Fulfilment\x20surfaces\x20that\x20physically\x20hand\x20over\x20goods\x20or\x20need\x20to\x20reach\x20'+'the\x20buyer\x20—\x20'+b['join'](';\x20')+'\x20—\x20are\x20the\x20only\x20points\x20where\x20that\x20obligation\x20can\x20be\x20'+'enforced\x20on\x20chain,\x20yet\x20the\x20template\x20declares\x20no\x20required_info\x20surface\x20anywhere\x20(no\x20'+'pattern.required_info_evidence_gate,\x20no\x20order.required_info\x201572\x20reference\x20in\x20any\x20guard\x20purpose\x20'+'or\x20build\x20note).','suggestion':'Mount\x20pattern.required_info_evidence_gate\x20on\x20the\x20fulfilment\x20forward:\x20gate\x20order.required_info\x20some\x20'+'(1572)\x20presence\x20FIRST\x20—\x20a\x20bare\x201573\x20value\x20read\x20aborts\x20while\x20the\x20Option\x20is\x20empty.\x20Presence-only\x20is\x20'+'the\x20right\x20default:\x20the\x20recorded\x20value\x20is\x20unvalidated\x20buyer\x20input\x20and\x20carries\x20no\x20on-chain\x20meaning,\x20'+'so\x20treat\x20the\x20merchant\x27s\x20confirming\x20forward\x20(not\x20the\x20recorded\x20address)\x20as\x20the\x20acceptance\x20basis.\x20'+'On\x20protocol\x20v141+\x20the\x20one-shot\x20kernel\x20leg\x20is\x20query\x201580\x20(order.required_info.satisfied):\x20presence\x20'+'check\x20+\x20vacuous-empty-declaration\x20in\x20one\x20Bool\x20read,\x20fail-closed\x20(aborts\x20pre-v141),\x20so\x20the\x201572+1573\x20'+'pairing\x20is\x20only\x20needed\x20on\x20older\x20binaries.\x20The\x20credential\x20VALUE\x20stays\x20the\x20attestated\x20'+'required_info_bind/Proof\x20face\x20either\x20way\x20—\x20never\x20gate\x20on\x20it.'}];}const EVIDENCE_ROW_WRITE_RE=/(data_add|repository write|writes? .{0,32}\brow|row write|contribution row|evidence row|submission row)/i,EVIDENCE_ROW_READBACK_RE=/(read-?back|1166|data has|count-?where|count_where|sum-?where|sum_where|find-?where|find_where|1173|1174|1179|1181|aggregate|existence leg|has-?leg|verif\w*\W{0,8}(the )?row|row\W{0,8}verif)/i;function evidenceRowReadbackChecks(a){const b=templateText(a);if(!EVIDENCE_ROW_WRITE_RE['test'](b))return[];if(EVIDENCE_ROW_READBACK_RE['test'](b))return[];return[{'rule_id':'R-EVIDENCE-NO-READBACK','severity':'medium','title':'Template\x20declares\x20repository\x20evidence-row\x20writes\x20but\x20no\x20read-back/forward-verification\x20leg\x20(F-32:\x20the\x20write\x20ships\x20as\x20a\x20separate\x20transaction)\x20(INV-E6)','detail':'A\x20Machine\x20edge\x20cannot\x20compile\x20a\x20repository\x20write\x20inside\x20its\x20Enter\x20action,\x20so\x20every\x20declared\x20'+'evidence/contribution-row\x20write\x20is\x20a\x20SEPARATE\x20transaction\x20—\x20skippable,\x20failable,\x20raceable.\x20The\x20'+'template\x20prose\x20declares\x20the\x20write\x20side\x20but\x20no\x20verification\x20vocabulary\x20anywhere\x20(no\x20read-back,\x20no\x20'+'1166/1173\x20existence\x20leg,\x20no\x201173-1179/1181\x20aggregate,\x20no\x20\x27verify\x20the\x20row\x27):\x20nothing\x20on\x20chain\x20stops\x20'+'the\x20workflow\x20from\x20advancing\x20past\x20an\x20unwritten\x20row.','suggestion':'Mount\x20pattern.evidence_row_forward_gate\x20on\x20the\x20NEXT\x20forward\x20edge:\x20query_repository_data_has\x20(1166,\x20'+'legacy\x20non-gated)\x20over\x20the\x20ORDER-KEYED\x20row\x20(id_from=Order\x20address,\x20never\x20wallet/clock)\x20for\x20single-row\x20'+'evidence,\x20count_where\x20(1173)\x20for\x20a\x20per-key\x20quota,\x20or\x20the\x201181\x20ALL-MODE\x20aggregate\x20for\x20threshold\x20'+'families.\x20Keep\x20the\x20keeper-duty\x20triad\x20(explicit\x20write\x20duty\x20+\x20read-back\x20+\x20this\x20advisory\x20as\x20the\x20'+'publish-time\x20completeness\x20check).\x20Do\x20NOT\x20downgrade\x20the\x20gate\x20to\x20a\x20marker\x20write\x20because\x20the\x20edge\x20'+'write\x20is\x20inexpressible\x20—\x20markers\x20are\x20zero-chain-verified\x20and\x20write-once\x20welded.'}];}function planReadinessChecks(a){const b=[],c=a['allocator']['rows']??[],d=c['some'](h=>h['track']==='refund'),e=a['allocator']['refund_track']!==undefined||/refund/i['test'](a['allocator']['description']),f=validateAllocatorRows(a);f['length']>0x0&&b['push']({'rule_id':'R-PLAN-01','severity':'critical','title':'Allocator\x20rows\x20are\x20internally\x20inconsistent\x20—\x20the\x20money\x20plan\x20cannot\x20be\x20built','detail':'Template\x20allocator\x20rows\x20are\x20internally\x20inconsistent:\x20'+f['join'](';\x20')+'.','suggestion':'Fix\x20the\x20template\x27s\x20allocator.rows\x20(they\x20are\x20the\x20authoritative\x20money\x20plan;\x20order_allocators\x20is\x20L1-frozen\x20at\x20publish).'});a['allocator']['refund_track']&&!d&&b['push']({'rule_id':'R-PLAN-02','severity':'critical','title':'Declared\x20refund\x20track\x20has\x20no\x20refund\x20row\x20—\x20the\x20plan\x20cannot\x20carry\x20the\x20promised\x20refund\x20rail','detail':'Template\x20declares\x20a\x20\x27'+a['allocator']['refund_track']+'\x27\x20refund\x20track\x20but\x20declares\x20no\x20allocator\x20row\x20with\x20'+'track=\x27refund\x27;\x20the\x20generated\x20plan\x20cannot\x20carry\x20the\x20promised\x20refund\x20rail.','suggestion':'Declare\x20a\x20refund\x20row\x20in\x20allocator.rows\x20(recipient\x20guard_identifier,\x20recipient_key\x20\x270\x27,\x20mode\x20rate,\x20value\x2010000)\x20so\x20the\x20order-anchored\x20full-refund\x20rail\x20rides\x20with\x20the\x20plan.'});if(!e)b['push']({'rule_id':'R-PLAN-03','severity':'high','title':'No\x20refund\x20track\x20declared\x20—\x20returns/refunds\x20have\x20no\x20funded\x20path\x20in\x20the\x20money\x20plan','detail':'The\x20template\x27s\x20allocator\x20declares\x20no\x20refund\x20track\x20—\x20returns/refunds\x20have\x20no\x20funded\x20path\x20in\x20the\x20money\x20plan.','suggestion':'Add\x20the\x20second\x20Allocator\x20(Rate\x2010000\x20to\x20the\x20buyer)\x20bound\x20to\x20the\x20refund\x20Guard,\x20or\x20confirm\x20with\x20the\x20merchant\x20that\x20refunds\x20are\x20out\x20of\x20scope.'});else!a['allocator']['refund_track']&&b['push']({'rule_id':'R-PLAN-04','severity':'medium','title':'Refund\x20intent\x20declared\x20in\x20prose\x20only\x20—\x20the\x20refund\x20recipient\x20is\x20not\x20order-anchored','detail':'A\x20refund\x20track\x20is\x20declared\x20but\x20not\x20order-anchored,\x20so\x20the\x20refund\x20recipient\x20is\x20resolved\x20from\x20the\x20signer/Entity\x20rather\x20than\x20the\x20paying\x20Order.','suggestion':'Gate\x20the\x20refund\x20track\x20with\x20AND[signer\x20==\x20order.owner,\x20progress.node\x20==\x20X]\x20or\x20move\x20it\x20to\x20an\x20order-anchored\x20GuardIdentifier(0)\x20recipient.'});if(c['length']===0x0){a['allocator']['mode']!=='rate'&&b['push']({'rule_id':'R-PLAN-05','severity':'critical','title':'Allocator\x20mode\x20is\x20not\x20expressible\x20as\x20a\x20percentage\x20split','detail':'Template\x20allocator\x20mode\x20is\x20\x27'+a['allocator']['mode']+'\x27,\x20which\x20a\x20percentage\x20pair\x20cannot\x20represent\x20—\x20'+'no\x20percentage\x20hint\x20can\x20be\x20emitted\x20for\x20it.','suggestion':'Declare\x20allocator.rows\x20in\x20the\x20template\x20(per-row\x20amount\x20/\x20rate\x20/\x20surplus);\x20the\x20pipeline\x20will\x20then\x20carry\x20the\x20real\x20split\x20instead\x20of\x20a\x20hint.'});if(a['allocator']['mode']==='rate'){const h=platformShareBps(a['fee_params']),j=h!==undefined&&h>0x0?0x2:0x0;a['allocator']['count']!==0x0&&a['allocator']['count']!==0x2&&b['push']({'rule_id':'R-PLAN-06','severity':'critical','title':'Declared\x20sharing\x20row\x20count\x20can\x20never\x20match\x20the\x20generated\x20percentage\x20hint','detail':'Template\x20declares\x20'+a['allocator']['count']+'\x20sharing\x20row(s)\x20but\x20the\x20generated\x20percentage\x20hint\x20can\x20'+('only\x20ever\x20carry\x20'+j+'\x20row(s)\x20(platform\x20take\x20'+(h??'none')+'\x20bps).'),'suggestion':'Build\x20the\x20Allocation\x20with\x20the\x20template\x27s\x20own\x20row\x20set\x20(order_allocators\x20is\x20L1\x20—\x20frozen\x20at\x20Service\x20publish),\x20or\x20declare\x20allocator.rows\x20in\x20the\x20template.'});}}const g=Object['keys'](a['fee_params'])['filter'](l=>/_(?:days|hours)$/['test'](l));return g['length']>0x0&&!a['time_anchors']&&b['push']({'rule_id':'R-PLAN-07','severity':'medium','title':'Business\x20windows\x20declared\x20without\x20time\x20anchors\x20—\x20release/timeout\x20steps\x20stay\x20unbuildable','detail':'fee_params\x20declares\x20business\x20windows\x20('+g['join'](',\x20')+')\x20but\x20the\x20template\x20declares\x20no\x20time_anchors.','suggestion':'Add\x20time_anchors\x20(or\x20name\x20the\x20window\x20in\x20the\x20Guard\x20set)\x20so\x20the\x20plan\x20emits\x20the\x20release/timeout\x20build\x20steps.'}),b;}function declaresAddressSubmissionSlot(a,b){const c=a;return c['identifier']===b&&c['b_submission']===!![]&&c['value_type']==='Address';}function tplSpecByKey(a,b){const c=a['guards']['find'](e=>e['key']===b);if(!c||!c['template_id']['startsWith']('tpl_'))return undefined;const d=GUARD_TEMPLATES['find'](e=>e['id']===c['template_id']);return d?{'templateId':d['id'],'exampleTable':d['example_table']}:undefined;}function taskBindingChecks(a){const b=[],c=new Set();for(const d of a['machine_shape']){for(const f of d['from']??[]){typeof f==='object'&&f!==null&&typeof f['guard_key']==='string'&&c['add'](f['guard_key']);}}for(const g of c){const h=tplSpecByKey(a,g);if(!h)continue;!h['exampleTable']['some'](j=>declaresAddressSubmissionSlot(j,TASK_BINDING_SLOT))&&b['push']({'rule_id':'TASKBIND-01','severity':'critical','title':'Guard\x20template\x20'+h['templateId']+'\x20(edge\x20key\x20\x27'+g+'\x27)\x20lacks\x20the\x20protocol\x20task-binding\x20slot\x20(254)','detail':'Every\x20guarded\x20forward\x20of\x20a\x20machine\x20running\x20on\x20an\x20order\x20Progress\x20requires\x20a\x20slot-254\x20passport\x20submission;\x20the\x20guard\x20table\x20declares\x20none,\x20so\x20the\x20forward\x20aborts\x20(code\x2011)\x20on\x20first\x20order\x20traversal.\x20Tables\x20and\x20machines\x20freeze\x20at\x20publish\x20—\x20shipping\x20now\x20strands\x20the\x20path\x20permanently.','suggestion':'Declare\x20{\x20identifier:\x20254,\x20b_submission:\x20true,\x20value_type:\x20\x27Address\x27\x20}\x20in\x20'+h['templateId']+'.example_table\x20(protocol\x20slot\x20254;\x20the\x20order\x20address\x20is\x20written\x20by\x20order\x20creation).'});}return b;}function allocLegSlotChecks(a){const b=[];for(const c of a['allocator']?.['rows']??[]){if(c['recipient']!=='guard_identifier'||!c['guard_key'])continue;const d=Number(c['recipient_key']??0x0);if(!Number['isInteger'](d)||d<0x0)continue;const e=tplSpecByKey(a,c['guard_key']);if(!e)continue;const f=e['exampleTable']['some'](h=>declaresAddressSubmissionSlot(h,d));if(f)continue;const g=e['exampleTable']['some'](h=>{const j=h;return j['identifier']===d&&j['value_type']==='Address';});b['push']({'rule_id':'TASKBIND-02','severity':'critical','title':g?'Guard\x20template\x20'+e['templateId']+'\x20slot\x20'+d+'\x20is\x20a\x20STATIC\x20Address\x20—\x20allocator\x20leg\x20\x27'+c['guard_key']+'\x27\x20needs\x20a\x20b_submission\x20declaration':'Guard\x20template\x20'+e['templateId']+'\x20never\x20declares\x20slot\x20'+d+'\x20—\x20allocator\x20leg\x20\x27'+c['guard_key']+'\x27\x20will\x20strand\x20escrow','detail':g?'A\x20static\x20Address\x20slot\x20passes\x20creation\x20but\x20fails\x20the\x20allocation\x20assertion\x20(passport\x20submission\x20==\x20payment_info.for_object):\x20the\x20distribution\x20aborts\x20and\x20escrowed\x20funds\x20stay\x20stranded,\x20because\x20the\x20table\x20froze\x20at\x20creation\x20and\x20cannot\x20gain\x20the\x20declaration\x20later\x20(N-11).':'The\x20allocation\x20assert\x20reads\x20a\x20passport\x20submission\x20at\x20this\x20slot;\x20with\x20no\x20declaration\x20the\x20assert\x20fails\x20and\x20the\x20distribution\x20aborts\x20with\x20funds\x20already\x20escrowed.','suggestion':'Declare\x20{\x20identifier:\x20'+d+',\x20b_submission:\x20true,\x20value_type:\x20\x27Address\x27,\x20object_type:\x20\x27Order\x27\x20}\x20in\x20'+e['templateId']+'.example_table\x20so\x20the\x20passing\x20order\x20address\x20is\x20captured.'});}return b;}export function isSplitFamilyFeeParam(a){return/(?:platform|commission|service_fee)[a-z_]*_bps$/['test'](a)||/^attributed_.*_bps$/['test'](a);}export function isKernelConsumedFeeParam(a){return a==='review_reward_per_claim'||a==='return_window_days'||a==='review_window_days'||a==='review_reward_pool'||a==='campaign_duration_days'||a==='campaign_duration_hours'||a==='reward_claim_opens_after_days'||a==='reward_claim_closes_after_days'||a==='experience_claim_amount'||a==='experience_claim_opens_after_days'||a==='experience_claim_closes_after_days'||a==='price_rebate_claim_amount'||a==='price_rebate_opens_after_days'||a==='price_rebate_closes_after_days'||a==='per_buyer_cap'||a==='loyalty_min_orders'||a==='sla_compensation_mode'||a==='sla_penalty_amount'||a==='sla_deadline_hours'||a==='sla_marker_version'||a==='keeper_release_after_days'||a['endsWith']('_ceiling_bps');}const KERNEL_LANDING_TEXT={'review_reward_per_claim':{'site':'the\x20composition\x20compiler\x27s\x20reward-claim\x20derivation\x20(4R-02)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20per-claim\x20bounty:\x20spec.params.reward_claim_amount\x20>\x20inputs.reward_claim_amount\x20>\x20this\x20fee_param\x20(override\x20with\x20the\x20reward_claim_amount\x20input)'},'return_window_days':{'site':'the\x20composition\x20compiler\x27s\x20reward-claim\x20OPENS\x20derivation\x20(tbs7\x20F-04)','excerpt':'the\x20value\x20bounds\x20when\x20the\x20bounty\x20OPENS:\x20the\x20claim\x20window\x20opens\x20after\x20this\x20after-sales\x20window\x20(+1\x20day,\x20floored\x20at\x2014\x20days)\x20so\x20a\x20bounty\x20is\x20never\x20claimable\x20while\x20a\x20return\x20can\x20still\x20draw\x20on\x20the\x20escrow'},'review_window_days':{'site':'the\x20composition\x20compiler\x27s\x20reward-claim\x20OPENS\x20derivation\x20(tbs7\x20F-04)','excerpt':'fallback\x20after-sales\x20bound\x20(after\x20return_window_days)\x20for\x20when\x20the\x20bounty\x20OPENS\x20(+1\x20day,\x20floored\x20at\x2014\x20days);\x20where\x20a\x20review_submit\x20guard\x20carries\x20the\x20same-name\x20param,\x20this\x20value\x20also\x20closes\x20the\x20review\x20rail\x20(fill\x20spread)'},'review_reward_pool':{'site':'the\x20input\x20boundary\x27s\x20reward\x20alias\x20(cour-mn-261102-z5t8\x20①②\x20census)','excerpt':'the\x20pool\x20IS\x20the\x20bounty\x20budget:\x20an\x20absent\x20reward_funding\x20input\x20falls\x20back\x20to\x20this\x20fee_param\x20(explicit\x20reward_funding\x20always\x20wins);\x20without\x20the\x20alias\x20the\x20knob\x20was\x20decorative\x20in\x20the\x20strictest\x20sense'},'keeper_release_after_days':{'site':'the\x20composition\x20compiler\x27s\x20segment-rail\x20expander\x20(shape-expand.ts\x20buildSegmentRails,\x20D-①)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20auto-release\x20window:\x20the\x20generated\x20node-set\x20rail\x20carries\x20a\x20U64\x20window\x20row\x20and\x20the\x20keeper\x20leg\x27s\x20timeout\x20predicate\x20(Clock\x20>=\x20node-entry\x20+\x20window)\x20reads\x20it\x20—\x20inside\x20the\x20window\x20the\x20buyer\x27s\x20signature\x20is\x20the\x20sole\x20key,\x20past\x20it\x20the\x20merchant-or-keeper\x20permission\x20may\x20fire\x20the\x20release;\x200/negative\x20turns\x20the\x20keeper\x20leg\x20OFF\x20(pure\x20buyer\x20rail)'},'campaign_duration_days':{'site':'the\x20input\x20boundary\x27s\x20deadline\x20conversion\x20(W5-22)','excerpt':'the\x20length\x20moves\x20the\x20compiled\x20constant:\x20days\x20convert\x20into\x20the\x20ABSOLUTE\x20campaign_deadline_ms\x20every\x20deadline\x20gate\x20and\x20the\x20pre-deadline\x20withdrawal\x20window\x20read\x20on\x20chain'},'campaign_duration_hours':{'site':'the\x20input\x20boundary\x27s\x20deadline\x20conversion\x20(W5-22\x20hours\x20face,\x20pdd\x20F-09)','excerpt':'short\x20pop-up\x20rounds\x20answer\x20in\x20hours;\x20the\x20conversion\x20multiplies\x20into\x20the\x20ABSOLUTE\x20campaign_deadline_ms'},'reward_claim_opens_after_days':{'site':'the\x20composition\x20compiler\x27s\x20reward-claim\x20OPENS\x20derivation\x20(4R-02)','excerpt':'the\x20value\x20sets\x20when\x20the\x20claim\x20window\x20OPENS\x20relative\x20to\x20the\x20claim-allowed\x20entry\x20(explicit\x20input\x20wins)'},'reward_claim_closes_after_days':{'site':'the\x20composition\x20compiler\x27s\x20reward-claim\x20CLOSE\x20derivation\x20(bsw4\x20F-11)','excerpt':'the\x20value\x20is\x20the\x20claimable\x20span\x20after\x20the\x20window\x20opens\x20(explicit\x20input\x20or\x20spec\x20param\x20wins)'},'experience_claim_amount':{'site':'the\x20composition\x20compiler\x27s\x20experience-compensation\x20mount\x20(C-11,\x20emit-phases.ts)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20Fixed\x20per-claim\x20tier\x20on\x20the\x20reward_experience\x20guard_add\x20(override\x20with\x20the\x20experience_claim_amount\x20input)'},'experience_claim_opens_after_days':{'site':'the\x20composition\x20compiler\x27s\x20experience-claim\x20OPENS\x20derivation\x20(C-11,\x20guard-fill.ts)','excerpt':'the\x20value\x20sets\x20when\x20the\x20goodwill\x20claim\x20window\x20OPENS\x20(derived:\x20after-sales\x20return\x20window\x20lapsed\x20+\x201d;\x20explicit\x20input\x20wins)'},'experience_claim_closes_after_days':{'site':'the\x20composition\x20compiler\x27s\x20experience-claim\x20CLOSE\x20derivation\x20(C-11,\x20guard-fill.ts)','excerpt':'the\x20value\x20is\x20the\x20claimable\x20span\x20after\x20the\x20goodwill\x20window\x20opens\x20(default\x207\x20days;\x20explicit\x20input\x20wins)'},'price_rebate_claim_amount':{'site':'the\x20composition\x20compiler\x27s\x20price-rebate\x20mount\x20(stage2\x20#1\x20P-11,\x20emit-phases.ts)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20Fixed\x20per-claim\x20tier\x20on\x20the\x20reward_price_rebate\x20guard_add\x20(override\x20with\x20the\x20price_rebate_claim_amount\x20input)'},'price_rebate_opens_after_days':{'site':'the\x20composition\x20compiler\x27s\x20price-rebate\x20claim\x20OPENS\x20derivation\x20(stage2\x20#1\x20P-11,\x20guard-fill.ts)','excerpt':'the\x20value\x20sets\x20when\x20the\x20rebate\x20claim\x20window\x20OPENS\x20after\x20the\x20claim-allowed\x20terminal\x20entry\x20(default\x200;\x20explicit\x20input\x20wins)'},'price_rebate_closes_after_days':{'site':'the\x20composition\x20compiler\x27s\x20price-rebate\x20claim\x20CLOSE\x20derivation\x20(stage2\x20#1\x20P-11,\x20guard-fill.ts)','excerpt':'the\x20value\x20is\x20the\x20claimable\x20span\x20after\x20the\x20rebate\x20window\x20opens\x20(default\x207\x20days;\x20explicit\x20input\x20wins)'},'per_buyer_cap':{'site':'the\x20service_quote\x20per-buyer-cap\x20preflight\x20(probeBuyerCap,\x20kernel\x20query\x201183\x20owner-filtered\x20mode)','excerpt':'the\x20value\x20IS\x20the\x20cap\x20the\x20quote\x20enforces\x20pre-order:\x20the\x20probe\x20counts\x20the\x20predicate-matching\x20rows\x20the\x20buyer\x20authored\x20under\x20the\x20campaign\x20key\x20(query\x201183,\x20value>0\x20—\x20withdrawn\x20zeroed\x20rows\x20excluded)\x20and\x20refuses\x20the\x20basket\x20at/over\x20this\x20count.\x20Default\x200\x20=\x20unlimited.\x20ADVISORY-ONLY\x20—\x20the\x20on-chain\x20purchase\x20entry\x20has\x20no\x20cap\x20hook\x20yet\x20(buy\x20pre-hook\x20pending\x20a\x20separate\x20board\x20decision);\x20the\x20chain\x20does\x20not\x20refuse\x20an\x20over-cap\x20pledge\x20today'},'loyalty_min_orders':{'site':'the\x20composition\x20compiler\x27s\x20loyalty\x20gate\x20mount\x20(emit-phases.ts\x20emitLoyaltyGate,\x20buy-face\x20guard)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20threshold:\x20the\x20buy\x20guard\x20requires\x20query\x202251\x20(entity_order.entity\x20count\x20over\x20the\x20genesis\x20singleton\x20@0xaa8)\x20>=\x20this\x20count.\x20Protocol-maintained\x20counter\x20—\x20zero\x20keeper.\x20Disclosure\x20rides\x20the\x20machine\x20notes:\x202251\x20counts\x20PARTICIPATION\x20(all\x20roles,\x20all\x20statuses,\x20this\x20order\x20included),\x20so\x20the\x20gate\x20is\x20\x27>=\x20N\x20orders\x20participated\x27,\x20never\x20\x27>=\x20N\x20completed\x27'},'sla_compensation_mode':{'site':'the\x20composition\x20compiler\x27s\x20SLA\x20compensation\x20mount\x20(emit-phases.ts\x20emitSlaCompensation,\x20machine\x20shape)','excerpt':'\x27proactive_payment\x27\x20splices\x20the\x20breach->compensated\x20rail\x20into\x20the\x20machine\x20(sla_breach\x20waypoint\x20parks\x20the\x20order\x20with\x20funds\x20intact;\x20the\x20six-leg\x20tpl_forward_penalty_payment\x20guard\x20verifies\x20and\x20burns\x20the\x20compensation\x20Payment\x20on\x20the\x20255\x20once-slot;\x20ResumeAfterCompensation\x20re-enters\x20the\x20settlement\x20rail)\x20+\x20one\x20keyed\x20keeper\x20duty;\x20\x27ladder\x27\x20is\x20an\x20alias\x20that\x20must\x20find\x20the\x20D5\x20cancel_tier_N_*\x20carrier\x20(no\x20second\x20ladder\x20mechanism,\x20N-08);\x20\x27none\x27/absent\x20=\x20silent'},'sla_penalty_amount':{'site':'the\x20composition\x20compiler\x27s\x20SLA\x20compensation\x20mount\x20(emit-phases.ts\x20emitSlaCompensation)','excerpt':'the\x20value\x20IS\x20the\x20compiled\x20penalty\x20constant:\x20the\x20penalty\x20guard\x27s\x20logic_as_u256_greater_or_equal\x20leg\x20compares\x20the\x20Payment\x20amount\x20against\x20it\x20(base\x20units)\x20and\x20the\x20marker\x20encodes\x20it\x20into\x20the\x20clause\x20nonce'},'sla_deadline_hours':{'site':'the\x20composition\x20compiler\x27s\x20SLA\x20compensation\x20mount\x20(emit-phases.ts\x20emitSlaCompensation)','excerpt':'the\x20value\x20names\x20the\x20promise\x20window:\x20it\x20rides\x20the\x20penalty\x20marker\x20(\x27sla-<h>h-v<ver>\x27)\x20and\x20the\x20keyed\x20keeper\x20duty\x27s\x20window_param\x20(timeout_intermediate\x20breach\x20check\x20anchored\x20past\x20fulfillment)\x20—\x20it\x20does\x20NOT\x20compile\x20a\x20punctuality\x20leg\x20(delivered-vs-deadline\x20comparison\x20has\x20no\x20two-history-time\x20primitive;\x20honest\x20disclosure,\x20U-05\x20neighbor)'},'sla_marker_version':{'site':'the\x20composition\x20compiler\x27s\x20SLA\x20compensation\x20mount\x20(emit-phases.ts\x20emitSlaCompensation)','excerpt':'the\x20clause\x20nonce\x20(default\x201):\x20bumping\x20it\x20changes\x20the\x20penalty\x20marker\x20so\x20payments\x20minted\x20against\x20an\x20older\x20clause\x20can\x20no\x20longer\x20satisfy\x20the\x20guard\x20—\x20old\x20proofs\x20must\x20not\x20pay\x20a\x20new\x20amount'}};function isLandingRequired(a,b){const c=a['fee_params'][b];if(typeof c!=='number')return![];if(classifyFeeParam(b,c,![])['disclosure']!=='knob')return![];return!![];}function feeParamLandingRegex(a){return new RegExp('\x5cb'+a['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&')+'\x5cb');}function directiveLanding(a,b){const c=[['build_notes',a['build_notes']],['user_input_specs',a['user_input_specs']?.['map'](d=>d['question']+'\x20'+d['param_key']+'\x20'+(d['note']??''))??[]],['user_inputs',a['user_inputs']],['allocator.description',[a['allocator']['description']]],['trust_mechanisms',a['trust_mechanisms']],['machine_shape',a['machine_shape']['map'](d=>d['name']+'\x20'+d['role'])]];for(const [d,e]of c){const f=e['find'](g=>b['test'](g));if(f!==undefined)return{'surface':'directive','site':d,'excerpt':f};}return undefined;}export function collectFeeParamLandings(a){const b=new Map();for(const c of Object['keys'](a['fee_params']??{})){const e=[],f=feeParamLandingRegex(c);for(const h of a['guards']){if(f['test'](h['purpose']))e['push']({'surface':'guard','site':h['key']??h['template_id'],'excerpt':h['purpose']});}for(const j of a['guards']){if(!j['template_id']?.['startsWith']('tpl_'))continue;const k=getTemplateById(j['template_id']);k!==undefined&&k['parameters']['some'](l=>l['name']===c)&&e['push']({'surface':'guard','site':(j['key']??j['template_id'])+'\x20(tpl\x20param)','excerpt':'template\x20'+j['template_id']+'\x20declares\x20\x27'+c+'\x27\x20as\x20a\x20fill\x20parameter\x20—\x20the\x20value\x20flows\x20the\x20tpl\x20fill\x20merge\x20(fee_params\x20<\x20inputs\x20<\x20spec.params),\x20never\x20prose'});}for(const l of BINDING_ROWS){if(l['site']===undefined||l['site']['template']!==a['id'])continue;const m=(l['derive']??[])['find'](n=>n['from']==='fee_params'&&n['key']===c);m!==undefined&&e['push']({'surface':'kernel','site':l['site']['key']??l['id'],'excerpt':'binding\x20row\x20'+l['id']+'\x20derives\x20\x27'+m['param']+'\x27\x20from\x20fee_params.'+c+'\x20—\x20a\x20kernel-authored\x20landing\x20(the\x20row\x20IS\x20the\x20reviewed-data\x20carrier)'});}for(const n of a['allocator']['rows']??[]){const o=n['note']??'',p=n['value_from_complement'];if(f['test'](o)||n['value_from']===c||p===c){const q=n['recipient_key'];e['push']({'surface':'allocator_row','site':n['track']+'/'+(q??n['recipient']),'excerpt':o||(p===c?'value_from_complement:\x20'+c:'value_from:\x20'+String(n['value_from'])),'recipient_blank':q===undefined||String(q)['trim']()===''});}}for(const [s,w]of Object['entries'](a['time_anchors']??{})){if(f['test'](w))e['push']({'surface':'time_anchor','site':s,'excerpt':w});}if(isKernelConsumedFeeParam(c)){const x=KERNEL_LANDING_TEXT[c]??(c['endsWith']('_ceiling_bps')?{'site':'the\x20settle\x20band\x20ladder\x20(R-RATE-TIER-GAP,\x20T-D)','excerpt':'the\x20value\x20IS\x20the\x20exclusive\x20partition\x20ceiling\x20the\x20band\x20ladder\x20and\x20the\x20settle\x20guard\x27s\x20band\x20predicates\x20consume\x20—\x20a\x20boundary,\x20not\x20a\x20rate\x20(validated\x20in\x20[0,\x2010001]\x20bps)'}:undefined);if(x)e['push']({'surface':'kernel','site':x['site'],'excerpt':x['excerpt']});}if(e['length']===0x0){const y=directiveLanding(a,f);if(y)e['push'](y);}b['set'](c,e);}return b;}const COMPILED_WINDOW_MS_MIN=0x3e8,COMPILED_WINDOW_MS_MAX=0x1f*0x5265c00,MS_INSTANT_FLOOR=0xe8d4a51000,MS_PER_HOUR=0x36ee80,MS_PER_DAY=0x5265c00;export function collectCompiledWindowConstants(a){const b=new Set(),c=k=>{if(typeof k!=='number'||!Number['isInteger'](k))return;if(k<COMPILED_WINDOW_MS_MIN||k>COMPILED_WINDOW_MS_MAX)return;b['add'](k);},e=k=>{const l=k['value'],m=typeof l==='number'?l:typeof l==='string'?Number(l):NaN;return Number['isFinite'](m)?m:undefined;},f=k=>l=>{if(typeof l==='number')return Number['isFinite'](l)?l:undefined;if(!l||typeof l!=='object'||Array['isArray'](l))return undefined;const m=l;if(m['type']==='identifier'&&typeof m['identifier']==='number'){const o=k['get'](m['identifier']);return o!==undefined?e(o):undefined;}return e(m);},g=l=>{const m=[];for(const n of['nodes','and','or','left','right']){const o=l[n];if(Array['isArray'](o))m['push'](...o);else{if(o!==undefined)m['push'](o);}}return m;},h=(k,l)=>{if(!k||typeof k!=='object'||Array['isArray'](k))return;const m=k;if(m['type']==='calc_number_multiply'&&Array['isArray'](m['nodes'])&&m['nodes']['length']===0x2){const [n,o]=m['nodes'],p=l(n),q=l(o);if(p!==undefined&&q!==undefined){if(p===MS_PER_DAY||q===MS_PER_DAY)c((p===MS_PER_DAY?q:p)*MS_PER_DAY);else{if(p===MS_PER_HOUR||q===MS_PER_HOUR)c((p===MS_PER_HOUR?q:p)*MS_PER_HOUR);}}}for(const s of g(m))h(s,l);},j=l=>{if(Array['isArray'](l)){for(const m of l)j(m);return;}if(!l||typeof l!=='object')return;for(const [n,o]of Object['entries'](l)){if(n['endsWith']('_ms'))c(o);else j(o);}};for(const k of a['steps']){if(k['op']!=='create')continue;const l=k['params'];if(!l||typeof l!=='object')continue;if(k['object']==='guard'){const m=new Map(),n=Array['isArray'](l['table'])?l['table']:[];for(const o of n){if(!o||typeof o!=='object'||Array['isArray'](o))continue;const p=o,q=typeof p['name']==='string'?p['name']:'';if(/(^|_)(ms|millis)/i['test'](q)&&!/per[_\s]?(day|hour)/i['test'](q))c(p['value']);if(typeof p['identifier']==='number')m['set'](p['identifier'],p);}h(l['root'],f(m));}j(l);}for(const s of a['derived_params']??[]){if(typeof s?.['param']==='string'&&s['param']['endsWith']('_ms'))c(s['value']);}return[...b]['sort']((t,w)=>t-w);}function isWindowParamKey(a){return/(_days|_hours|_ms)$/['test'](a)||/window|deadline|duration/i['test'](a);}function declaredWindowMs(a,b){if(typeof b!=='number'||!Number['isFinite'](b)||b<=0x0)return undefined;if(a['endsWith']('_days'))return b*MS_PER_DAY;if(a['endsWith']('_hours'))return b*MS_PER_HOUR;if(a['endsWith']('_ms'))return b;return undefined;}export function annotateCompiledWindows(a,b){const c=[...new Set(b)]['sort']((f,g)=>f-g),d=[],e=a['map'](f=>{const g=isWindowParamKey(f['param'])?declaredWindowMs(f['param'],f['value']):undefined,h=g!==undefined&&g<MS_INSTANT_FLOOR,j=h&&c['length']>0x0?c['includes'](g):null;return j===![]&&d['push']({'param':f['param'],'declared':f['value'],'declared_ms':g}),{...f,...g!==undefined?{'declared_ms':g}:{},'compiled_match':j};});return{'rows':e,'compiled_windows_ms':c,...d['length']>0x0?{'declaration_compiled_diff':{'entries':d,'note':'DECLARATION/COMPILED\x20WINDOW\x20DRIFT\x20(UCAT-261109\x20batch\x202,\x20etsy-clone-audit-r7k2m):\x20these\x20declared\x20'+'window\x20params\x20are\x20NOT\x20the\x20lengths\x20the\x20chain\x20will\x20run\x20—\x20the\x20compiled\x20plan\x20is\x20authoritative.\x20'+'Materialize\x20window\x20constants\x20from\x20the\x20compiled\x20guard\x20tables\x20inside\x20guide.plan\x20(compiled_windows_ms),\x20'+'never\x20from\x20the\x20declared\x20catalog\x20defaults:\x20the\x20declaration\x20is\x20directory\x20default\x20only,\x20and\x20the\x20incident\x20'+'shipped\x20a\x2014-day\x20declaration\x20over\x20180s/300s/120s\x20on-chain\x20windows\x20because\x20the\x20landing\x20table\x20showed\x20'+'only\x20the\x20declaration\x20side.'}}:{}};}export function buildFeeParamLandingTable(a,b){const c=collectFeeParamLandings(a);return Object['entries'](b)['map'](([d,e])=>({'param':d,'value':e,'split_family':isSplitFamilyFeeParam(d),'landings':c['get'](d)??[],'landing_required':isLandingRequired(a,d)}));}function feeParamLandingChecks(a){const b=[];for(const [c,d]of collectFeeParamLandings(a)){if(d['length']>0x0||isSplitFamilyFeeParam(c)||!isLandingRequired(a,c))continue;b['push']({'rule_id':'R-FEEPARAM-LANDING','severity':'medium','title':'fee_param\x20\x27'+c+'\x27\x20is\x20declared\x20but\x20lands\x20nowhere','detail':'template_generate\x20will\x20print\x20'+c+'='+String(a['fee_params'][c])+',\x20but\x20no\x20guard\x20purpose,\x20allocator\x20row\x20note\x20or\x20time\x20anchor\x20names\x20it\x20—\x20the\x20value\x20has\x20no\x20chain\x20landing,\x20so\x20whoever\x20materializes\x20the\x20template\x20hand-fills\x20the\x20constant\x20and\x20the\x20two\x20drift\x20(the\x20measured\x205-minute\x20/\x2030-day\x20window\x20mismatch\x20class).\x20Dead\x20parameters\x20also\x20mislead\x20the\x20migration\x20questionnaire,\x20which\x20presents\x20them\x20as\x20tunable.','suggestion':'Name\x20\x27'+c+'\x27\x20verbatim\x20at\x20its\x20landing\x20rung\x20—\x20the\x20purpose\x20of\x20the\x20guard\x20that\x20compiles\x20it\x20into\x20a\x20constant\x20(strongest),\x20an\x20allocator\x20row\x20note,\x20a\x20time\x20anchor,\x20or\x20at\x20minimum\x20its\x20directive\x20entry\x20(build_notes\x20/\x20user_inputs).\x20E.g.\x20\x27window\x20=\x20'+c+'\x27.\x20If\x20the\x20parameter\x20has\x20no\x20consumer\x20at\x20all,\x20delete\x20it\x20from\x20fee_params.'});}return b;}function repositoryKeyDriftChecks(a){const b=[],c=new Set(a['guards']['map'](d=>d['policy']?.['name'])['filter'](d=>typeof d==='string'&&d['length']>0x0));for(const d of a['guards']){const e=d;for(const [f,h]of Object['entries'](e['params']??{})){if(f!=='row_name'&&!f['endsWith']('_policy_key'))continue;if(typeof h!=='string'||h['length']===0x0)continue;if(h['includes']('${'))continue;if(c['has'](h))continue;b['push']({'rule_id':'R-REPO-KEY-DRIFT','severity':'medium','title':'evidence\x20gate\x20\x27'+e['key']+'\x27\x20reads\x20policy\x20key\x20\x27'+h+'\x27\x20that\x20no\x20repository\x20write\x20policy\x20in\x20this\x20template\x20creates\x20(AR-3\x20/\x20BSX-F01)','detail':'Guard\x20\x27'+e['key']+'\x27\x20('+(e['template_id']??'spec')+')\x20reads\x20rows\x20under\x20the\x20policy\x20key\x20\x27'+h+'\x27\x20'+('(param\x20\x27'+f+'\x27),\x20but\x20the\x20template\x27s\x20')+('host:\x22repository\x22\x20write\x20guards\x20create\x20policies:\x20'+([...c]['map'](j=>'\x27'+j+'\x27')['join'](',\x20')||'(none)')+'.\x20')+'A\x20read\x20over\x20a\x20key\x20the\x20repository\x20never\x20declared\x20finds\x20NO\x20rows\x20and\x20the\x20leg\x20evaluates\x20FALSE\x20—\x20it\x20does\x20not\x20'+'abort\x20and\x20does\x20not\x20report:\x20the\x20not-found\x20abort\x20(7)\x20belongs\x20to\x20the\x20WRITE\x20path,\x20so\x20the\x20failure\x20is\x20silent\x20while\x20'+'the\x20gated\x20forward\x20never\x20'+'opens\x20and\x20every\x20order\x20freezes\x20mid-rail.\x20Policies\x20are\x20NOT\x20chain-frozen:\x20the\x20repository\x27s\x20policy-management\x20'+'permission\x20(index\x20102)\x20can\x20add\x20the\x20missing\x20policy\x20in\x20place\x20after\x20publish,\x20and\x20already-written\x20rows\x20stay\x20'+'bound\x20by\x20write_once/write_guard\x20—\x20but\x20a\x20template\x20must\x20ship\x20the\x20PAIRED\x20name,\x20not\x20a\x20repair\x20instruction.\x20'+'Live\x20face:\x20BeatStars\x27\x20delivery\x20gate\x20read\x20\x27license_grant\x27\x20while\x20the\x20repository\x20stored\x20\x27grant\x27\x20(bsx\x20BSX-F01).','suggestion':'Make\x20the\x20gate\x27s\x20\x27'+f+'\x27\x20EQUAL\x20the\x20write\x20policy\x27s\x20name\x20verbatim\x20(case-sensitive)\x20—\x20ONE\x20name\x20for\x20the\x20write\x20'+'side\x20and\x20the\x20read\x20side.\x20If\x20the\x20repository\x20is\x20intentionally\x20caller-supplied\x20(repository_policies\x20input),\x20'+'document\x20the\x20required\x20policy\x20name\x20in\x20the\x20gate\x27s\x20purpose\x20so\x20the\x20reader\x20can\x20satisfy\x20the\x20pairing.'});}}return b;}export function evidencePolicyCollisions(a){const b=new Set((a['conditional_guards']??[])['map'](e=>e['guard_key'])['filter'](e=>typeof e==='string')),c=new Map();for(const e of a['guards']){const f=e;if(!f['key']||b['has'](f['key']))continue;let h=f['params']?.['row_name'],j=f['params']?.['evidence_marker'];if(typeof h!=='string'||h['length']===0x0){const m=lookupBinding({'template_id':f['template_id']??'','key':f['key']},{'id':a['id']});h=m?.['params']['row_name'],j=m?.['params']['evidence_marker'];}if(typeof h!=='string'||h['length']===0x0)continue;if(typeof j!=='string'||j['length']===0x0)continue;let k=c['get'](h);!k&&(k=new Map(),c['set'](h,k));const l=k['get'](j)??[];l['push'](f['key']+'\x20('+(f['template_id']??'spec')+')'),k['set'](j,l);}const d=[];for(const [n,o]of c){if(o['size']<0x2)continue;const p=[...o['keys']()],q=p['flatMap'](s=>(o['get'](s)??[])['map'](w=>w+'\x20—\x20marker\x20\x27'+s+'\x27'));d['push']({'row_name':n,'markers':p,'members':q});}return d;}function evidencePolicyCollisionChecks(a){return evidencePolicyCollisions(a)['map'](b=>({'rule_id':'R-EVIDENCE-POLICY-COLLISION','severity':'critical','title':'policy\x20\x27'+b['row_name']+'\x27\x20is\x20shared\x20by\x20'+b['markers']['length']+'\x20evidence\x20kinds\x20('+b['markers']['map'](d=>'\x27'+d+'\x27')['join'](',\x20')+')\x20—\x20the\x20later\x20kind\x27s\x20write\x20destroys\x20or\x20dead-locks\x20the\x20earlier\x20stage\x20(F-12)','detail':'The\x20repository\x20ledger\x20keys\x20each\x20row\x20by\x20(policy\x20name,\x20row\x20id);\x20order-scoped\x20rows\x20pin\x20the\x20row\x20id\x20to\x20the\x20order\x20address,\x20so\x20'+('every\x20kind\x20writing\x20under\x20policy\x20\x27'+b['row_name']+'\x27\x20lands\x20on\x20the\x20SAME\x20row\x20per\x20order.\x20With\x20write_once\x20the\x20second\x20')+'kind\x27s\x20write\x20aborts\x20with\x20the\x20write-once\x20conflict\x20(E_POLICY_WRITE_ONCE_CONFLICT)\x20and\x20the\x20machine\x20bricks\x20mid-flow\x20(delivery/restaurant-'+'marketplace\x20PickupOrder,\x20group_buy/platform-supplied-pickup\x20ConfirmPickup);\x20without\x20it\x20the\x20later\x20row\x20silently\x20'+'OVERWRITES\x20the\x20earlier\x20stage\x27s\x20evidence\x20(mainnet-proven:\x20delivery/on-demand-errand\x20HandOver\x20over\x20PickUpOrder,\x20'+'created=0;\x20retail\x20ship/RMA/lost\x20family).\x20Doctrine:\x20ONE\x20EVIDENCE\x20KIND\x20PER\x20POLICY\x20(W5-13/pdd\x20F-04).\x20'+('Colliding\x20guards:\x20'+b['members']['join'](';\x20')+'.'),'suggestion':'Split\x20the\x20kinds\x20into\x20per-kind\x20policies\x20(evidence_<kind>)\x20with\x20write_once:true\x20each:\x20one\x20write\x20guard\x20per\x20policy\x20'+'(host:\x22repository\x22),\x20and\x20re-point\x20every\x20reader\x27s\x20row_name/binding\x20derive\x20to\x20its\x20own\x20policy\x20name.\x20Reader-side\x20'+'marker\x20selectors\x20alone\x20do\x20NOT\x20separate\x20rows\x20—\x20the\x20marker\x20only\x20gates\x20the\x20read,\x20the\x20(policy,\x20id)\x20key\x20decides\x20what\x20'+'is\x20stored.'}));}export function feeParamCouplingMismatches(a){const b=[],c=a['fee_params']??{},d=/fee[\s_-]?params?\s+([a-z_][a-z0-9_]*)/gi;for(const e of a['guards']){const f=e;if(typeof f['purpose']!=='string'||typeof f['key']!=='string')continue;if(!f['template_id']?.['startsWith']('tpl_'))continue;const h=new Set();for(const k of f['purpose']['matchAll'](d)){const l=k[0x1];if(typeof c[l]==='number')h['add'](l);}if(h['size']===0x0)continue;const j=Object['values'](f['params']??{})['filter'](n=>typeof n==='number'&&Number['isFinite'](n));for(const n of h){const o=c[n];if(j['some'](s=>s===o))continue;const p=a['defaults']??c,q=p[n];if(typeof q==='number'&&j['some'](s=>s===q))continue;b['push']({'key':f['key'],'template_id':String(f['template_id']),'param':n,'declared':o,'literals':j});}}return b;}export function settleBandLadderViolations(a){const c=[],d=(a['guards']??[])['filter'](h=>h['template_id']==='tpl_allocator_settle_band_once');if(d['length']===0x0)return c;const e=[],f=new Set();for(const h of d){const j=h['params']??{},k=String(j['decision_policy_key']??'triage_band');f['add'](k);const l=String(j['band_min']??''),m=String(j['band_max']??''),n=Number(l),o=Number(m);if(!Number['isInteger'](n)||!Number['isInteger'](o)||n<0x1||o<=n){c['push']({'kind':'bad_bounds','key':String(h['key']??h['template_id']),'band_min':l,'band_max':m,'reason':!Number['isInteger'](n)||!Number['isInteger'](o)?'band\x20bounds\x20must\x20be\x20plain\x20integer\x20numbers\x20(U64)':n<0x1?'band_min\x20must\x20be\x20>=\x201\x20(band\x200\x20=\x20no\x20severity\x20recorded,\x20never\x20a\x20valid\x20payout)':'band_max\x20must\x20be\x20strictly\x20greater\x20than\x20band_min\x20(the\x20band\x20is\x20[min,\x20max))'});continue;}e['push']({'key':String(h['key']??h['template_id']),'policy_key':k,'min':n,'max':o,'raw_min':l,'raw_max':m});}d['length']>0x1&&f['size']>0x1&&c['push']({'kind':'split_keys','policy_keys':[...f]['sort'](),'guards':d['length']});const g=new Map();for(const q of e){const s=g['get'](q['policy_key'])??[];s['push'](q),g['set'](q['policy_key'],s);}for(const [w,x]of g){const y=[...x]['sort']((z,A)=>z['min']-A['min']||z['max']-A['max']);for(let z=0x1;z<y['length'];z++){const A=y[z-0x1],B=y[z];if(B['min']<A['max'])c['push']({'kind':'overlap','policy_key':w,'a':A['key'],'b':B['key'],'a_range':'['+A['raw_min']+','+A['raw_max']+')','b_range':'['+B['raw_min']+','+B['raw_max']+')'});else B['min']>A['max']&&c['push']({'kind':'gap','policy_key':w,'a':A['key'],'b':B['key'],'prev_max':A['max'],'next_min':B['min']});}}return c;}function settleBandLadderChecks(a){return settleBandLadderViolations(a)['map'](b=>{if(b['kind']==='bad_bounds')return{'rule_id':'R-SETTLE-BAND-LADDER','severity':'high','title':'settle-band\x20guard\x20\x27'+b['key']+'\x27\x20has\x20invalid\x20band\x20bounds\x20['+b['band_min']+','+b['band_max']+')\x20—\x20'+b['reason'],'detail':'tpl_allocator_settle_band_once\x20ranges\x20a\x20U64\x20triage\x20band\x20over\x20the\x20[band_min,\x20band_max)\x20interval\x20with\x20an\x20EXCLUSIVE\x20upper\x20bound.\x20Invalid\x20bounds\x20make\x20the\x20tier\x20either\x20never\x20passable\x20(a\x20stranded\x20severity\x20whose\x20escrow\x20waits\x20for\x20manual\x20resolution)\x20or\x20trivially\x20passable\x20—\x20both\x20break\x20the\x20ladder\x20contract\x20the\x20guard\x20purposes\x20promise\x20(h1z9-tn\x20T-07:\x20band\x20semantics\x20that\x20live\x20only\x20in\x20prose).','suggestion':'Set\x20band_min/band_max\x20to\x20plain\x20integers\x20with\x201\x20<=\x20band_min\x20<\x20band_max,\x20and\x20make\x20the\x20ladder\x20tile\x20seamlessly\x20(e.g.\x20[1,2)/[2,3)/[3,4)/[4,5)).'};if(b['kind']==='split_keys')return{'rule_id':'R-SETTLE-BAND-LADDER','severity':'high','title':'settle-band\x20ladder\x20is\x20split\x20across\x20'+b['policy_keys']['length']+'\x20decision\x20policy\x20keys\x20('+b['policy_keys']['join'](',\x20')+')\x20over\x20'+b['guards']+'\x20guards','detail':'The\x20single-key\x20design\x20IS\x20the\x20ladder\x27s\x20mutual\x20exclusion:\x20per-order\x20write_once\x20on\x20ONE\x20decision\x20policy\x20key\x20blocks\x20a\x20re-grade\x20(E_POLICY_WRITE_ONCE_CONFLICT)\x20and\x20every\x20band\x20guard\x20reading\x20the\x20SAME\x20key\x20makes\x20a\x20key\x20swap\x20impossible.\x20Splitting\x20the\x20ladder\x20across\x20keys\x20reinstates\x20the\x20O13\x20re-key\x20upgrade\x20(h1z9-tn:\x20a\x20re-keyed\x20band\x20row\x20upgraded\x20a\x20paid\x20order\x20for\x200.0044\x20gas)\x20—\x20each\x20key\x27s\x20write_once\x20protects\x20only\x20its\x20own\x20track.','suggestion':'Point\x20every\x20band\x20guard\x27s\x20decision_policy_key\x20at\x20the\x20SAME\x20policy\x20(the\x20write\x20guard\x27s\x20policy\x20name\x20must\x20equal\x20it\x20verbatim),\x20and\x20differentiate\x20tiers\x20ONLY\x20by\x20the\x20disjoint\x20[min,max)\x20constants.'};if(b['kind']==='overlap')return{'rule_id':'R-SETTLE-BAND-LADDER','severity':'high','title':'settle-band\x20guards\x20\x27'+b['a']+'\x27\x20'+b['a_range']+'\x20and\x20\x27'+b['b']+'\x27\x20'+b['b_range']+'\x20OVERLAP\x20on\x20policy\x20\x27'+b['policy_key']+'\x27','detail':'Overlapping\x20bands\x20let\x20ONE\x20triage\x20value\x20satisfy\x20TWO\x20tiers,\x20so\x20one\x20report\x20can\x20pay\x20twice\x20through\x20sibling\x20rails\x20(each\x20tier\x20is\x20its\x20own\x20allocator;\x20the\x20254\x20once\x20key\x20is\x20per-guard,\x20not\x20per-ladder).\x20The\x20ladder\x20contract\x20requires\x20exactly\x20one\x20band\x20guard\x20passable\x20per\x20order.','suggestion':'Shrink\x20one\x20band\x20so\x20adjacent\x20ranges\x20share\x20an\x20edge\x20without\x20crossing\x20(e.g.\x20[1,2)\x20and\x20[2,3)\x20tile;\x20[1,3)\x20and\x20[2,4)\x20overlap).'};return{'rule_id':'R-SETTLE-BAND-LADDER','severity':'high','title':'settle-band\x20ladder\x20has\x20a\x20GAP\x20on\x20policy\x20\x27'+b['policy_key']+'\x27:\x20guard\x20\x27'+b['a']+'\x27\x20ends\x20at\x20'+b['prev_max']+'\x20but\x20\x27'+b['b']+'\x27\x20starts\x20at\x20'+b['next_min'],'detail':'Severity\x20values\x20in\x20['+b['prev_max']+',\x20'+b['next_min']+')\x20match\x20NO\x20band\x20guard,\x20so\x20a\x20report\x20triaged\x20into\x20that\x20range\x20has\x20NO\x20payable\x20branch\x20—\x20the\x20escrow\x20waits\x20for\x20manual\x20resolution\x20(h1z9-tn\x20build-note:\x20a\x20missing\x20band\x20strands\x20its\x20orders\x27\x20payouts).\x20The\x20bands\x20must\x20tile\x20seamlessly\x20over\x20the\x20whole\x20severity\x20domain.','suggestion':'Extend\x20one\x20band\x20or\x20insert\x20the\x20missing\x20tier\x20so\x20adjacent\x20ranges\x20share\x20an\x20edge\x20(next\x20band_min\x20==\x20prev\x20band_max)\x20with\x20no\x20hole\x20between\x20them.'};});}const LEG_PROMISE_REPO_SCAN_RE=/\b(find_where|keys_where|range[- ]scan|severity[- ]band|triage band)\b/i,LEG_PROMISE_SIGNER_BINDING_RE=/\bsigner[- ]binding\b/i;function guardTemplateRoot(a){const b=GUARD_TEMPLATES['find'](c=>c['id']===a);if(!b)return undefined;return b['example_root'];}function serializedTree(a){return JSON['stringify'](a??null);}function rootEquipsSignerBinding(a){const b=serializedTree(a);return b['includes']('query_repository_data')&&/"context":"Signer"/['test'](b);}export function guardLegPromiseBreaches(a){const b=[];for(const c of a){const d=String(c['template_id']??'');if(!d['startsWith']('tpl_'))continue;const e=String(c['purpose']??'');if(!e)continue;const f=guardTemplateRoot(d);if(f===undefined)continue;if(LEG_PROMISE_REPO_SCAN_RE['test'](e)){const g=serializedTree(f);if(!g['includes']('query_repository_data_find_where')&&!g['includes']('query_repository_data_keys_where')){b['push']({'key':String(c['key']??d),'template_id':d,'promised':'repo-scan'});continue;}}LEG_PROMISE_SIGNER_BINDING_RE['test'](e)&&!rootEquipsSignerBinding(f)&&b['push']({'key':String(c['key']??d),'template_id':d,'promised':'signer-binding'});}return b;}function guardLegPromiseChecks(a){return guardLegPromiseBreaches(a['guards'])['map'](c=>({'rule_id':'GUARD-LEG-PROMISE-01','severity':'high','title':c['promised']==='repo-scan'?'guard\x20\x27'+c['key']+'\x27\x20purpose\x20promises\x20an\x20evidence-scan\x20leg\x20(find_where/keys_where/range-scan/severity-band)\x20but\x20template\x20\x27'+c['template_id']+'\x27\x20has\x20NO\x20repository\x20query\x20in\x20its\x20root':'guard\x20\x27'+c['key']+'\x27\x20purpose\x20promises\x20a\x20SIGNER-BINDING\x20leg\x20but\x20template\x20\x27'+c['template_id']+'\x27\x20binds\x20no\x20record\x20to\x20the\x20chain\x20Signer\x20in\x20its\x20root','detail':c['promised']==='repo-scan'?'The\x20purpose\x20text\x20promises\x20the\x20guard\x20reads\x20a\x20repository\x20(an\x20evidence/band\x20scan),\x20but\x20the\x20resolved\x20template\x27s\x20example_root\x20contains\x20no\x20query_repository_data_find_where/keys_where\x20node\x20—\x20the\x20compiled\x20Guard\x20CANNOT\x20evaluate\x20that\x20leg,\x20so\x20the\x20promise\x20is\x20prose\x20only\x20(h1z9-tn\x20card\x2011:\x20four\x20settle\x20purposes\x20promised\x20a\x20severity-band\x20scan\x20that\x20never\x20existed;\x20the\x20emitted\x20guards\x20were\x20bare\x20node\x20gates\x20and\x20ANYONE\x20could\x20sign\x20ANY\x20payout).\x20Machine-read\x20purpose\x20text\x20is\x20the\x20contract\x20the\x20builder\x20buys.':'The\x20purpose\x20text\x20promises\x20the\x20claimant\x20is\x20bound\x20to\x20an\x20on-chain\x20record\x20(signer\x20==\x20a\x20recorded\x20row/holder),\x20but\x20the\x20resolved\x20template\x27s\x20root\x20has\x20no\x20repository-data\x20query\x20AND\x20no\x20Signer-pinned\x20comparison\x20beyond\x20caller\x20authorization\x20—\x20order.owner==Signer\x20is\x20NOT\x20evidence\x20binding\x20(h1z9-tn\x20T-03/T-05:\x20the\x20wide\x20identity\x20let\x20the\x20funder\x20sign\x20the\x20payout).\x20The\x20compiled\x20Guard\x20cannot\x20prove\x20the\x20claimant\x20is\x20the\x20record\x27s\x20author.','suggestion':c['promised']==='repo-scan'?'Either\x20re-point\x20the\x20spec\x20at\x20a\x20template\x20that\x20ships\x20the\x20scan\x20leg\x20(e.g.\x20tpl_allocator_settle_band_once\x20for\x20severity-band\x20settlement)\x20and\x20pass\x20its\x20repository/policy/band\x20params,\x20or\x20rewrite\x20the\x20purpose\x20to\x20state\x20only\x20what\x20the\x20root\x20actually\x20evaluates.\x20Never\x20leave\x20a\x20leg\x20promise\x20the\x20template\x20data\x20cannot\x20keep.':'Either\x20re-point\x20at\x20a\x20template\x20whose\x20root\x20binds\x20a\x20repository\x20record\x20to\x20context(Signer)\x20(e.g.\x20tpl_allocator_settle_band_once\x27s\x20signer\x20leg),\x20or\x20strip\x20the\x20SIGNER-BINDING\x20wording\x20and\x20disclose\x20the\x20weaker\x20identity\x20face\x20that\x20actually\x20ships.'}));}function machineAdjacency(a){const b=new Map();for(const c of a['machine_shape']??[]){for(const d of c['from']??[]){const f=typeof d==='string'?d:d?.['prev'];if(!f)continue;const g=b['get'](f)??[];g['push'](c['name']),b['set'](f,g);}}return b;}function descTreeConsistencyChecks(a){const d=[],h=new Map();for(const B of findLoopCycles(machineAdjacency(a))){const C=classifyLoopCycle(B['cycle']);for(const D of B['cycle']){const E=h['get'](D)??new Set();E['add'](C),h['set'](D,E);}}const j=F=>{const G=h['get'](F);return G!==undefined&&(G['has']('renewal')||G['has']('charge'));},l=new Map();for(const F of a['machine_shape']??[]){for(const G of F['from']??[]){if(typeof G!=='object'||G===null)continue;const H=G['guard_key'];if(typeof H!=='string')continue;const I=l['get'](H)??new Set();I['add']((G['prev']??'')+'->'+F['name']+':'+(G['forward']??'')),l['set'](H,I);}}const o=Object['keys'](a['fee_params']??{})['filter'](J=>J['length']>=0x4),q=new Map(GUARD_TEMPLATES['map'](J=>[J['id'],J])),s=new Map(),w=(J,K)=>{if(typeof J!=='string')return undefined;const L=/^\$\{([a-z0-9_]+)\}$/['exec'](J);if(L!==null){const M=K[L[0x1]];return typeof M==='string'||typeof M==='number'?String(M):undefined;}return J;},x=(J,K)=>{if(typeof J==='string'){for(const L of J['matchAll'](/\$\{([a-z0-9_]+)\}/g))K['add'](L[0x1]);}else{if(Array['isArray'](J))J['forEach'](M=>x(M,K));else J!==null&&typeof J==='object'&&Object['values'](J)['forEach'](M=>x(M,K));}},y=new Set(['campaign_duration_days','campaign_duration_hours','campaign_deadline_ms','review_reward_pool','reward_funding']),z=a['conditional_guards']??[];for(const J of z)if(typeof J['param']==='string')y['add'](J['param']);for(const K of a['settlement_window_merge']??[]){y['add'](K);}for(const L of FEE_PARAM_BINDINGS){if(L['template']!==a['id'])continue;y['add'](L['param']);if(L['plus']!==undefined){for(const M of typeof L['plus']==='string'?[L['plus']]:L['plus'])y['add'](M);}}const A=(N,O)=>{const P=q['get'](O);return{'root':N['root']??P?.['example_root'],'table':N['table']??P?.['example_table']};};for(const N of a['guards']??[]){const O=typeof N['key']==='string'?N['key']:'',P=A(N,typeof N['template_id']==='string'?N['template_id']:'');x(P['root'],y),x(P['table'],y),x(N['params'],y),void O;}for(const Q of a['guards']??[]){const R=typeof Q['key']==='string'?Q['key']:'',S=typeof Q['template_id']==='string'?Q['template_id']:'',T=q['get'](S),U={...a['fee_params'],...Q['params']??{}},V=Q['root']??T?.['example_root'],W=Q['table']??T?.['example_table'],X=typeof Q['purpose']==='string'?Q['purpose']:'',Y=new Set([...Object['keys'](U),...y,...(T?.['parameters']??[])['map'](a1=>a1['name'])['filter'](a1=>typeof a1==='string')]),Z=a1=>{if(typeof a1==='string'){for(const a2 of a1['matchAll'](/\$\{([a-z0-9_]+)\}/g)){const a3=a2[0x1];!Y['has'](a3)&&d['push']({'rule_id':'R-GUARD-PLACEHOLDER','severity':'critical','title':'guard\x20\x27'+R+'\x27\x20carries\x20placeholder\x20\x27${'+a3+'}\x27\x20that\x20resolves\x20from\x20NO\x20declared\x20param\x20surface','detail':'The\x20resolved\x20spec\x20references\x20${'+a3+'},\x20but\x20it\x20is\x20absent\x20from\x20fee_params,\x20this\x20guard\x27s\x20params,\x20'+'FEE_PARAM_BINDINGS,\x20and\x20every\x20selector/merge-list\x20surface\x20—\x20the\x20compile\x20cannot\x20fill\x20it\x20and\x20the\x20'+'remnant\x20travels\x20into\x20the\x20immutable\x20guard\x20as\x20a\x20literal\x20(ddmc3\x20F-TPL-01;\x20the\x20plan\x20face\x20hard-blocks\x20'+'this\x20same\x20shape\x20at\x20generate).','suggestion':'Declare\x20\x27'+a3+'\x27\x20in\x20the\x20guard\x27s\x20params\x20or\x20fee_params\x20(or\x20add\x20an\x20author-literal\x20'+'FEE_PARAM_BINDINGS\x20row),\x20or\x20strip\x20the\x20reference\x20from\x20the\x20spec.'});}a1['includes']('WRITER_ACCOUNT_ADDRESS')&&d['push']({'rule_id':'R-GUARD-PLACEHOLDER','severity':'critical','title':'guard\x20\x27'+R+'\x27\x20carries\x20the\x20LITERAL\x20sentinel\x20\x27WRITER_ACCOUNT_ADDRESS\x27\x20—\x20an\x20unfilled\x20stand-in,\x20never\x20a\x20value','detail':'algr12\x20P0-5:\x20this\x20literal\x20published\x20to\x20mainnet\x20as\x20a\x20VecAddress\x20allowlist\x20row\x20and\x20locked\x20every\x20'+'writer\x20out\x20of\x20evidence\x20writes.\x20A\x20sentinel\x20string\x20is\x20an\x20unfilled\x20placeholder\x20exactly\x20like\x20a\x20'+'${param}\x20remnant.','suggestion':'Replace\x20with\x20a\x20declared\x20param\x20(${...}\x20form)\x20that\x20the\x20merchant\x20fills\x20with\x20REAL\x20address(es)\x20at\x20'+'build\x20time\x20—\x20never\x20ship\x20the\x20sentinel\x20literal.'});return;}if(Array['isArray'](a1)){a1['forEach'](Z);return;}if(a1!==null&&typeof a1==='object')Object['values'](a1)['forEach'](Z);};Z(V);for(const a1 of W??[]){if(a1===null||typeof a1!=='object')continue;const a2=a1;a2['value']===''&&d['push']({'rule_id':'R-GUARD-EMPTY-VALUE','severity':'critical','title':'guard\x20\x27'+R+'\x27\x20table\x20row\x20'+String(a2['identifier'])+'\x20carries\x20an\x20EMPTY\x20value','detail':'An\x20empty\x20string\x20serializes\x20to\x20zero\x20bytes\x20and\x20the\x20chain\x20aborts\x20the\x20Guard\x20create\x20with\x20'+'E_TABLE_ITEM_VALUE_EMPTY=14\x20(the\x20guard-table\x20validator\x20rejects\x20a\x20zero-byte\x20value)\x20—\x20the\x20shape\x20survives\x20compile\x20but\x20dies\x20at\x20the\x20call.','suggestion':'Set\x20a\x20real\x20value\x20(or\x20a\x20${param}\x20reference\x20that\x20resolves),\x20or\x20omit\x20the\x20row.'}),(a2['value_type']==='VecAddress'||a2['value_type']===0xa)&&Array['isArray'](a2['value'])&&a2['value']['some'](a3=>typeof a3==='string'&&/^0x0+$/i['test'](a3))&&d['push']({'rule_id':'R-GUARD-ZERO-ADDR','severity':'critical','title':'guard\x20\x27'+R+'\x27\x20table\x20row\x20'+String(a2['identifier'])+'\x20(VecAddress)\x20carries\x20a\x20ZERO-ADDRESS\x20placeholder','detail':'ddmc4\x20B-04:\x20a\x20zero\x20address\x20is\x20NOT\x20\x22no\x20list\x22\x20—\x20the\x20created\x20guard\x20LIES\x20(\x22address\x200\x20is\x20allowed\x22).\x20'+'It\x20never\x20aborts,\x20so\x20it\x20ships.','suggestion':'Arm\x20the\x20list\x20with\x20real\x20addresses\x20(or\x20a\x20resolving\x20${param}),\x20or\x20omit\x20the\x20guard\x20via\x20'+'guard_resolutions\x20{kind:\x22omit\x22}\x20when\x20\x22no\x20list\x22\x20is\x20the\x20intended\x20polarity.'}),Z(a2['value']);}if(V!==undefined&&h['size']>0x0){const a3=new Set(),a4=a5=>{if(!a5||typeof a5!=='object'||a3['has'](R))return;if(Array['isArray'](a5)){a5['forEach'](a4);return;}const a6=a5,a7=typeof a6['type']==='string'?a6['type']:'',a8=a6['where']??null;if(a7['startsWith']('query_progress_history_time')&&a6['find']==='first'&&a8!==null&&typeof a8==='object'){const a9=w(a8['nextNode'],U);if(a9!==undefined&&j(a9)){a3['add'](R);const aa=/\bper[- ]period\b|\bthis period\b|\beach period\b|\bevery period\b|\u6bcf\u671f|\u5f53\u671f|\u672c\u671f/i['test'](X);d['push']({'rule_id':'R-FIND-POLARITY','severity':aa?'critical':'low','title':'guard\x20\x27'+R+'\x27\x20anchors\x20a\x20history\x20clock\x20at\x20find:\x22first\x22\x20on\x20PERIODIC\x20node\x20\x27'+a9+'\x27\x20'+'(re-enters\x20per\x20billed\x20period)'+(aa?'\x20while\x20its\x20purpose\x20claims\x20per-period\x20semantics\x20—\x20period\x202+\x20reads\x20the\x20FIRST\x20visit\x27s\x20timestamp\x20(ofnz8\x20F-61)':'\x20—\x20intentional\x20once-per-life\x20gate,\x20or\x20the\x20stale-anchor\x20defect\x20(ofnz8\x20F-61)?'),'detail':'The\x20resolved\x20root\x20reads\x20query_progress_history_time{where.nextNode:\x27'+a9+'\x27},\x20find:\x22first\x22,\x20and\x20'+('\x27'+a9+'\x27\x20lies\x20on\x20a\x20renewal/charge\x20loop\x20in\x20this\x20template\x27s\x20machine\x20graph.\x20On\x20period\x202\x20the\x20FIRST\x20')+'visit\x27s\x20clock\x20is\x20the\x20anchor,\x20so\x20a\x20window\x20measured\x20from\x20it\x20is\x20already\x20closed\x20(or\x20already\x20open)\x20'+'the\x20moment\x20the\x20second\x20period\x20begins.\x20Guards\x20freeze\x20at\x20publish;\x20the\x20polarity\x20cannot\x20be\x20repaired\x20'+'on\x20a\x20live\x20shop.'+(aa?'\x20The\x20purpose\x20text\x20promises\x20per-period\x20behavior\x20the\x20find:\x22first\x22\x20anchor\x20cannot\x20deliver.':'\x20The\x20purpose\x20text\x20does\x20NOT\x20claim\x20per-period\x20semantics,\x20so\x20this\x20is\x20most\x20likely\x20the\x20intended\x20once-per-life\x20polarity\x20(e.g.\x20a\x20one-time\x20bounty\x20claimable\x20N\x20days\x20after\x20the\x20FIRST\x20review)\x20—\x20confirm,\x20then\x20ignore\x20this\x20disclosure.'),'suggestion':aa?'Anchor\x20the\x20leg\x20with\x20find:\x22last\x22\x20(the\x20schema\x27s\x20stated\x20polarity\x20for\x20re-entrant\x20anchors),\x20or\x20'+'re-point\x20the\x20where\x20at\x20a\x20node\x20each\x20period\x20enters\x20exactly\x20once\x20—\x20or\x20rewrite\x20the\x20purpose\x20to\x20'+'state\x20the\x20once-per-life\x20semantics\x20the\x20anchor\x20actually\x20enforces.':'No\x20action\x20needed\x20if\x20the\x20once-per-life\x20reading\x20is\x20intended;\x20otherwise\x20anchor\x20with\x20find:\x22last\x22.'});}}for(const ab of Object['values'](a6))a4(ab);};a4(V);}if(X!==''&&o['length']>0x0){const a5=o['filter'](a6=>new RegExp('\x5cb'+a6+'\x5cb')['test'](X));for(const a6 of a5){if(!/_days$|_hours$|_minutes$/['test'](a6))continue;if(/_claim_closes_after_days$/['test'](a6))continue;!y['has'](a6)&&d['push']({'rule_id':'R-DESC-TREE-DRIFT','severity':'high','title':'guard\x20\x27'+R+'\x27\x20purpose\x20names\x20fee_param\x20\x27'+a6+'\x27\x20but\x20NO\x20leg,\x20table\x20row,\x20or\x20binding\x20row\x20lands\x20it\x20'+'(ofnz8\x20F-73:\x20grace_days\x20compiled\x20nowhere\x20and\x20the\x20chain\x20enforced\x20the\x20grace\x20period\x20as\x200)','detail':'The\x20purpose\x20text\x20of\x20guard\x20\x27'+R+'\x27\x20promises\x20\x27'+a6+'\x27,\x20but\x20the\x20resolved\x20spec\x20has\x20no\x20${'+a6+'}\x20'+('reference,\x20no\x20inline\x20params\x20entry,\x20and\x20no\x20FEE_PARAM_BINDINGS\x20row\x20for\x20('+a['id']+',\x20\x27'+R+'\x27,\x20\x27'+a6+'\x27).\x20')+'A\x20merchant\x20who\x20sets\x20the\x20knob\x20changes\x20nothing\x20on\x20chain\x20—\x20the\x20description\x20is\x20the\x20contract\x20the\x20'+'builder\x20buys,\x20and\x20the\x20compiled\x20Guard\x20cannot\x20evaluate\x20a\x20leg\x20it\x20does\x20not\x20have.','suggestion':'Add\x20the\x20landing:\x20an\x20author-literal\x20FEE_PARAM_BINDINGS\x20row\x20({template,\x20guard_key:\x20\x27'+R+'\x27,\x20'+('param:\x20\x27'+a6+'\x27,\x20to:\x20<slot>,\x20scale?})\x20if\x20the\x20value\x20belongs\x20in\x20this\x20guard\x27s\x20table,\x20an\x20explicit\x20')+'params\x20entry,\x20or\x20a\x20second\x20duration\x20term\x20in\x20the\x20root\x20(the\x20period_days\x20+\x20grace_days\x20sum).\x20'+('Otherwise\x20strip\x20the\x20\x27'+a6+'\x27\x20wording\x20from\x20the\x20purpose\x20so\x20the\x20prose\x20states\x20only\x20what\x20ships.')});}}const a0=equalityFaceCheck(R,X,V);a0!==null&&d['push']({'rule_id':'R-DESC-TREE-DRIFT','severity':'high','title':a0['title'],'detail':a0['detail'],'suggestion':a0['suggestion']});for(const a7 of thresholdLiteralCheck(R,W)){d['push']({'rule_id':'R-THRESHOLD-LITERAL','severity':'high','title':a7['title'],'detail':a7['detail'],'suggestion':a7['suggestion']});}for(const a8 of setCollapseCheck(R,W)){d['push']({'rule_id':'R-SET-COLLAPSE','severity':'medium','title':a8['title'],'detail':a8['detail'],'suggestion':a8['suggestion']});}for(const a9 of abortSafeVerbCheck(R,V)){d['push']({'rule_id':'R-GUARD-ABORT-SAFE','severity':'critical','title':a9['title'],'detail':a9['detail'],'suggestion':a9['suggestion']});}if(Q['root']===undefined&&Q['table']===undefined&&R!==''){const aa=fillGuardTemplate(Q['template_id'],Q['params']??{}),ab=aa['ok']?'fill\x00'+JSON['stringify']([aa['root']??null,aa['table']??null]):S+'\x00'+JSON['stringify'](Q['params']??null),ac=s['get'](ab)??{'tplIds':new Set(),'keys':[]};ac['tplIds']['add'](S),ac['keys']['push'](R),s['set'](ab,ac);}}for(const [,ad]of s){const {keys:ae,tplIds:af}=ad;if(ae['length']<0x2)continue;const ag=new Set();for(const ah of ae)for(const ai of l['get'](ah)??[])ag['add'](ai);if(ag['size']<0x2)continue;d['push']({'rule_id':'R-EDGE-GUARD-ALIAS','severity':'medium','title':'guards\x20'+ae['map'](aj=>'\x27'+aj+'\x27')['join']('\x20and\x20')+'\x20compile\x20to\x20IDENTICAL\x20guard\x20enforcement\x20'+('(template'+(af['size']>0x1?'s':'')+'\x20'+[...af]['join']('\x20/\x20')+'\x20—\x20same\x20filled\x20tree\x20and\x20table)\x20')+'mounted\x20on\x20different\x20edges\x20—\x20one\x20edge\x27s\x20designed\x20behavior\x20is\x20an\x20ALIAS\x20of\x20the\x20other\x20'+'(ofnz8\x20F-87:\x20expire_after_review\x20emitted\x20as\x20an\x20expire\x20twin\x20with\x20no\x20after-review\x20leg)','detail':'The\x20compiled\x20enforcement\x20shapes\x20are\x20byte-identical\x20(fillGuardTemplate\x20instantiation:\x20template\x20'+'defaults\x20+\x20params\x20—\x20the\x20SAME\x20normalization\x20the\x20build\x20uses,\x20UCAT-261109\x20③\x20batch\x20A),\x20yet\x20the\x20keys\x20mount\x20'+('on\x20'+ag['size']+'\x20distinct\x20machine\x20edges.\x20Whatever\x20the\x20edge\x20name\x20promises\x20beyond\x20the\x20shared\x20')+'compiled\x20shape\x20(a\x20different\x20anchor\x20node,\x20a\x20longer\x20window,\x20an\x20extra\x20leg)\x20does\x20not\x20exist\x20on\x20chain.\x20'+'Edge\x20names\x20become\x20prose;\x20the\x20tree\x20cannot\x20keep\x20the\x20distinction.','suggestion':'Differentiate\x20the\x20two\x20guards\x20with\x20explicit\x20params\x20(a\x20different\x20anchor\x20node\x20/\x20window\x20row\x20/\x20extra\x20leg),\x20'+'or\x20resolve\x20one\x20of\x20them\x20to\x20its\x20own\x20template\x20or\x20inline\x20table\x20—\x20or\x20rename\x20the\x20edge\x20to\x20state\x20the\x20shared\x20'+'enforcement\x20truthfully.'});}return d;}function feeParamCouplingChecks(a){return feeParamCouplingMismatches(a)['map'](b=>({'rule_id':'R-FEE-PARAM-COUPLING','severity':'medium','title':'guard\x20\x27'+b['key']+'\x27\x20claims\x20to\x20mirror\x20fee_param\x20\x27'+b['param']+'\x27\x20('+b['declared']+')\x20but\x20carries\x20no\x20matching\x20'+('numeric\x20literal\x20(params:\x20'+(b['literals']['length']>0x0?b['literals']['join'](',\x20'):'none')+')\x20(rex5\x20T-02)'),'detail':'The\x20purpose\x20of\x20guard\x20\x27'+b['key']+'\x27\x20('+b['template_id']+')\x20names\x20fee_param\x20\x27'+b['param']+'\x27,\x20but\x20none\x20of\x20'+('its\x20numeric\x20params\x20equals\x20the\x20fee-table\x20value\x20'+b['declared']+'.\x20The\x20numbers\x20are\x20maintained\x20by\x20hand\x20and\x20')+'the\x20guard\x20literal\x20is\x20the\x20ONLY\x20one\x20that\x20becomes\x20on-chain\x20—\x20the\x20fee\x20param\x20the\x20merchant\x20sets\x20stays\x20'+'decorative\x20(rex5-tn-261028\x20T-02:\x20fee_overrides.inspection_window_days\x20=\x201\x20shipped\x20while\x20all\x20'+'three\x20window\x20guards\x20kept\x20the\x20hardcoded\x207).','suggestion':'Re-sync\x20the\x20guard\x20param\x20literal\x20with\x20fee_param\x20\x27'+b['param']+'\x27\x20(keep\x20the\x20purpose\x27s\x20\x22keep\x20in\x20sync\x22\x20note),\x20'+'or\x20drop\x20the\x20fee_param\x20mention\x20from\x20the\x20purpose\x20if\x20the\x20values\x20are\x20intentionally\x20independent.\x20'+'Build-time\x20propagation\x20(fee_overrides\x20reaching\x20guards[].params)\x20is\x20tracked\x20separately\x20(rex5\x205R).'}));}const UNLANDED_REMEDY='zero\x20the\x20knob\x20(direct\x20sales\x20default),\x20wire\x20the\x20allocator\x20rows\x20to\x20it\x20explicitly\x20'+'(value_from\x20/\x20value_from_complement\x20naming\x20the\x20key),\x20or\x20declare\x20an\x20author-literal\x20'+'FEE_PARAM_BINDINGS\x20row\x20so\x20the\x20value\x20provably\x20lands';let guardTemplateParamRefsCache;const NO_REFS=new Set();function guardTemplateParamRefs(a){if(guardTemplateParamRefsCache===undefined){const b=new Map();for(const c of GUARD_TEMPLATES){const d=new Set(),e=f=>{if(typeof f==='string'){for(const g of f['matchAll'](/\$\{([a-z0-9_]+)\}/g))d['add'](g[0x1]);}else{if(Array['isArray'](f)){for(const h of f)e(h);}else{if(f!==null&&typeof f==='object'){for(const j of Object['values'](f))e(j);}}}};e(c['example_table']),e(c['example_root']),b['set'](c['id'],d);}guardTemplateParamRefsCache=b;}return guardTemplateParamRefsCache['get'](a)??NO_REFS;}export function feeParamUnlanded(a,b,c){const d=[],e=new Set(),f=new Set();for(const q of a['allocator']['rows']??[]){const s=q;if(typeof s['value_from']==='string'&&s['value_from']!=='')e['add'](s['value_from']);if(typeof s['value_from_complement']==='string'&&s['value_from_complement']!=='')e['add'](s['value_from_complement']);const w=typeof s['value']==='number'?s['value']:typeof s['value']==='string'?Number(s['value']):NaN;if(Number['isFinite'](w))f['add'](w);}for(const x of a['guards']??[]){for(const y of Object['values'](x['params']??{})){if(typeof y==='number'&&Number['isFinite'](y))f['add'](y);}}const h=new Set();for(const z of a['guards']??[]){if(typeof z['template_id']==='string'&&z['template_id']['startsWith']('tpl_'))h['add'](z['template_id']);}for(const A of Object['values'](c??{})){const B=A?.['kind']==='template'?A['template_id']??A['template']:undefined;if(typeof B==='string'&&B!=='')h['add'](B);}let j=new Set();for(const C of h){for(const D of guardTemplateParamRefs(C))j['add'](D);}const l=new Set(FEE_PARAM_BINDINGS['filter'](E=>E['template']===a['id'])['map'](E=>E['param'])),m=new Set((a['conditional_guards']??[])['map'](E=>E['param'])),o=new Set();for(const E of TIME_GUARD_INSTANTIATIONS){if(E['template']!==a['id'])continue;if(E['days']!==undefined)o['add'](E['days']);if(E['hours']!==undefined)o['add'](E['hours']);for(const F of Array['isArray'](E['plus_days'])?E['plus_days']:E['plus_days']!==undefined?[E['plus_days']]:[]){o['add'](F);}}const p=new Set(a['settlement_window_merge']??[]);for(const [G,H]of Object['entries'](b)){if(typeof H!=='number'||!Number['isFinite'](H)||H===0x0)continue;if(PLATFORM_TAKE_KEY['test'](G))continue;if(l['has'](G))continue;if(e['has'](G))continue;if(isKernelConsumedFeeParam(G))continue;if(GENERATION_SHAPE_KEYS['has'](G))continue;if(EXTERNAL_CARRIER_KEYS['has'](G))continue;if(classifyFeeParam(G,H,m['has'](G))['disclosure']!=='knob')continue;if(j['has'](G))continue;if(f['has'](H))continue;if(o['has'](G))continue;if(p['has'](G))continue;d['push']({'param':G,'value':H,'reason':'non-zero\x20effective\x20fee_param\x20with\x20no\x20live\x20landing:\x20no\x20platform-take\x20landing,\x20no\x20FEE_PARAM_BINDINGS\x20row,\x20'+'no\x20allocator\x20value_from/value_from_complement\x20wiring,\x20no\x20mounted\x20guard-template\x20placeholder,\x20'+'no\x20registered\x20kernel/consumer,\x20no\x20time-instantiation\x20or\x20merged-lock\x20knob,\x20and\x20no\x20identical\x20frozen\x20'+('constant\x20in\x20the\x20shipped\x20shape\x20—\x20the\x20compiled\x20plan\x20ignores\x20it.\x20Fix\x20ONE\x20way:\x20'+UNLANDED_REMEDY+'.')});}return d;}function feeParamUnlandedChecks(a){return feeParamUnlanded(a,a['fee_params'])['map'](b=>({'rule_id':'R-FEE-PARAM-UNLANDED','severity':'critical','title':'fee_param\x20\x27'+b['param']+'\x27\x20=\x20'+b['value']+'\x20lands\x20nowhere\x20—\x20a\x20non-zero\x20knob\x20the\x20money\x20shape\x20ignores\x20(cour-mn-261102-z5t8\x20①②)','detail':'The\x20template\x20ships\x20\x27'+b['param']+'\x27\x20=\x20'+b['value']+'\x20but\x20nothing\x20consumes\x20it:\x20no\x20commission-landing\x20take\x20key,\x20no\x20'+'fee-param\x20binding\x20row,\x20no\x20allocator\x20value_from/value_from_complement,\x20no\x20kernel\x20consumer,\x20and\x20the\x20param\x20is\x20'+'registered\x20as\x20an\x20editable\x20knob\x20(not\x20prose/benchmark).\x20Whoever\x20sets\x20it\x20—\x20the\x20merchant\x20via\x20fee_overrides\x20or\x20'+'the\x20shipped\x20default\x20itself\x20—\x20changes\x20nothing\x20on\x20chain\x20while\x20the\x20settings\x20face\x20advertises\x20an\x20effect.','suggestion':UNLANDED_REMEDY+'.'}));}const SETTLE_WINDOW_RE=/^(?:settle|settlement)[a-z0-9_]*(?:_days|_hours)$/,BUYER_WINDOW_RE=/^(?:return|refund|claim)[a-z0-9_]*(?:_days|_hours)$/;function windowToMs(a,b){if(a['endsWith']('_days'))return b*0x5265c00;if(a['endsWith']('_hours'))return b*0x36ee80;return undefined;}export function windowMathMismatches(a){const c=[],d=a['fee_params']??{},e=new Set(a['settlement_window_merge']??[]),f=[],g=[];for(const [j,k]of Object['entries'](d)){if(typeof k!=='number'||!Number['isFinite'](k))continue;if(SETTLE_WINDOW_RE['test'](j))f['push']({'name':j,'value':k});else{if(BUYER_WINDOW_RE['test'](j))g['push']({'name':j,'value':k});}}const h=[...e]['map'](l=>({'name':l,'ms':windowToMs(l,Number(d[l]))}))['filter'](l=>Number['isFinite'](l['ms']));if(h['length']>0x0&&e['size']>0x0&&f['some'](l=>e['has'](l['name']))){const l=h['reduce']((m,n)=>m+n['ms'],0x0);l<=0x0&&c['push']({'settle_param':h['map'](m=>m['name'])['join']('+'),'settle_value':l,'violates':'non_positive','rule':'R-WINDOW-MATH-ZERO'});for(const m of g){if(e['has'](m['name']))continue;const n=windowToMs(m['name'],m['value']);if(n===undefined||l>=n)continue;c['push']({'settle_param':h['map'](o=>o['name'])['join']('+'),'settle_value':l,'violates':m['name']+'\x20('+m['value']+')','rule':'R-WINDOW-MATH-UNDERCUT'});}return c;}for(const o of f){o['value']<=0x0&&c['push']({'settle_param':o['name'],'settle_value':o['value'],'violates':'non_positive','rule':'R-WINDOW-MATH-ZERO'});}for(const p of f){if(p['value']<=0x0)continue;const q=windowToMs(p['name'],p['value']);if(q===undefined)continue;for(const w of g){const x=windowToMs(w['name'],w['value']);if(x===undefined)continue;q<x&&c['push']({'settle_param':p['name'],'settle_value':p['value'],'violates':w['name']+'\x20('+w['value']+')','rule':'R-WINDOW-MATH-UNDERCUT'});}}return c;}function windowMathChecks(a){return windowMathMismatches(a)['map'](b=>({'rule_id':b['rule'],'severity':'critical','title':b['rule']==='R-WINDOW-MATH-ZERO'?'Settlement\x20window\x20\x27'+b['settle_param']+'\x27\x20=\x20'+b['settle_value']+'\x20—\x20the\x20escrow\x20releases\x20instantly\x20and\x20every\x20buyer\x20window\x20is\x20structurally\x20dead':'Settlement\x20window\x20\x27'+b['settle_param']+'\x27\x20('+b['settle_value']+')\x20opens\x20the\x20release\x20before\x20buyer\x20window\x20'+b['violates']+'\x20closes\x20—\x20the\x20refund\x20rail\x20is\x20structurally\x20dead\x20from\x20the\x20release\x20moment','detail':'Settlement\x20moves\x20the\x20escrow\x20balance\x20to\x200;\x20every\x20refund\x20leg\x20evaluated\x20after\x20the\x20release\x20'+'aborts\x20on\x20empty\x20balance\x20(ktt3\x20F-05:\x20settle\x201h\x20vs\x20return\x20window\x2048h\x20—\x20the\x20advertised\x20return\x20'+'policy\x20was\x20unenforceable;\x20ksk4\x20F-35:\x20settlement\x20delay\x200\x20killed\x20the\x20return\x20window\x20from\x20day\x20one).\x20'+'The\x20settlement\x20time-lock\x20and\x20the\x20buyer\x20windows\x20are\x20maintained\x20by\x20hand\x20in\x20fee_params,\x20so\x20the\x20'+'drift\x20ships\x20silently\x20without\x20this\x20generation-time\x20assert.','suggestion':'Raise\x20the\x20settlement\x20window\x20to\x20>=\x20the\x20largest\x20buyer\x20window\x20(return/refund/claim\x20family),\x20'+'or\x20shorten\x20the\x20buyer\x20window\x20to\x20fit\x20inside\x20the\x20settlement\x20schedule\x20—\x20whichever\x20matches\x20the\x20'+'store\x27s\x20actual\x20after-sales\x20policy.\x20Remember\x20the\x20guard\x20literal\x20is\x20what\x20compiles\x20on-chain:\x20'+'re-sync\x20guards[].params\x20with\x20the\x20new\x20fee_params\x20value\x20(R-FEE-PARAM-COUPLING).'}));}const RATING_FLOOR_SHAPES=[/\brating\b[^.\n]{0,24}?>=\s*([1-5])\b/gi,/\b([1-5])\s*(?:to|-|–|—)\s*([1-5])\s*stars?\b/gi,/\bmin(?:imum)?[\s_-]*rating\b[^.\n]{0,16}?\b([1-5])\b/gi,/\b(?:rated?|rating)\s+([1-5])(?:\s+stars?)?\s+or\s+(?:better|higher|more)\b/gi],PRAISE_FLOOR_SHAPES=[/\b(?:praise|positive|favorable|highly[- ]rated)\s+(?:review|feedback|rating|bounty|rebate|reward)\b/gi,/\bgood\s+(?:review|feedback|rating)\s+(?:bounty|rebate|reward|incentive)\b/gi,/\b(?:good|great|positive)\s+review\b[^.\n]{0,40}?\b(?:reward|bounty|rebate|cashback|incentive)\b/gi,/\u597d\u8bc4(?:\u8fd4\u73b0|\u5956\u52b1|\u8d4f\u91d1|\u7ea2\u5305|\u793c)|\u6b63\u9762\u8bc4\u4ef7(?:\u5956\u52b1|\u8fd4\u73b0)|\u597d\u8bc4(?:\u53ef)?\u5f97(?:\u5956|\u8d4f|\u7ea2\u5305)/gi];export function incentiveRatingFloorClaims(a){const b=[],c=[['build_notes',a['build_notes']],['trust_mechanisms',a['trust_mechanisms']],['key_risk',a['key_risk']],['user_input_specs',a['user_input_specs']?.['map'](d=>d['question']+'\x20'+d['param_key']+'\x20'+(d['note']??''))],['user_inputs',a['user_inputs']],['differences',a['differences']]];for(const [d,e]of c){const f=typeof e==='string'?[e]:e??[];for(const g of f){if(typeof g!=='string')continue;for(const h of RATING_FLOOR_SHAPES){for(const j of g['matchAll'](h)){b['push']({'field':d,'claimed':Number(j[0x1]),'excerpt':j[0x0]['trim'](),'kind':'numeric'});}}for(const k of PRAISE_FLOOR_SHAPES){for(const l of g['matchAll'](k)){b['push']({'field':d,'claimed':0x4,'excerpt':l[0x0]['trim'](),'kind':'praise'});}}}}return b;}const REWARD_WINDOW_SHAPES=[/\b(\d+)\s*[-\s]?\s*days?\s+to\s+claim\b/gi,/\bclaim(?:able)?\s+within\s+(\d+)\s+days?\b/gi,/\b(\d+)\s*[-\s]?\s*day\s+claim\s+window\b/gi,/\bclaimable\s+for\s+(\d+)\s+days?\b/gi];export function rewardWindowDayClaims(a){const b=[],c=[['build_notes',a['build_notes']],['trust_mechanisms',a['trust_mechanisms']],['key_risk',a['key_risk']],['user_input_specs',a['user_input_specs']?.['map'](d=>d['question']+'\x20'+d['param_key']+'\x20'+(d['note']??''))],['user_inputs',a['user_inputs']],['differences',a['differences']]];for(const [d,e]of c){const f=typeof e==='string'?[e]:e??[];for(const g of f){if(typeof g!=='string')continue;for(const h of REWARD_WINDOW_SHAPES){for(const j of g['matchAll'](h)){b['push']({'field':d,'claimed':Number(j[0x1]),'excerpt':j[0x0]['trim']()});}}}}return b;}function incentiveRatingFloorChecks(a){const b=incentiveRatingFloorClaims(a);if(b['length']===0x0)return[];const c=[...new Set(b['map'](e=>'\x27'+e['excerpt']+'\x27\x20('+e['field']+')'))]['join'](',\x20'),d=b['some'](e=>e['kind']==='praise')?'\x20Praise-shaped\x20wording\x20(S14)\x20derives\x20to\x20floor\x204\x20(good\x20==\x204+)\x20—\x20the\x20review_reward\x20default\x20now\x20arms\x204,\x20so\x20a\x20build\x20only\x20fails\x20this\x20rule\x20when\x20reward_rating_floor:\x200\x20(explicit\x20opt-out)\x20or\x20a\x20spec\x20without\x20rating_floor\x20drops\x20the\x20leg.':'';return[{'rule_id':'R-INCENTIVE-RATING-FLOOR','severity':'medium','title':'Incentive\x20prose\x20promises\x20a\x20rating\x20floor\x20('+c+')\x20—\x20the\x20reward\x20track\x20must\x20arm\x20it\x20at\x20build\x20time\x20(S12-T1)','detail':'The\x20promise\x20is\x20free\x20text;\x20the\x20on-chain\x20floor\x20is\x20the\x20reward_rating_floor\x20build\x20input\x20compiled\x20into\x20'+'the\x20claim\x20guard\x27s\x20rating\x20leg.\x20Nothing\x20else\x20couples\x20them\x20—\x20a\x20build\x20that\x20skips\x20the\x20input\x20ships\x20a\x20'+'plain\x20praise\x20bounty\x20that\x20pays\x20even\x20at\x20rating\x201\x20while\x20the\x20store\x20page\x20advertises\x20the\x20floor\x20'+'(ktt3\x20F02/F12\x20residual).'+d,'suggestion':'Either\x20scope\x20the\x20prose\x20to\x20what\x20the\x20chain\x20enforces\x20(name\x20reward_rating_floor\x20as\x20a\x20build\x20input\x20the\x20'+'merchant\x20must\x20set\x20to\x20the\x20promised\x20value),\x20or\x20ship\x20a\x20host:\x22reward\x22\x20spec\x20whose\x20params\x20pin\x20'+'rating_floor\x20to\x20the\x20promised\x20value\x20so\x20every\x20build\x20arms\x20it.\x20The\x20compile\x20gate\x20enforces\x20'+'armed\x20floor\x20===\x20promised\x20on\x20every\x20review_reward\x20build\x20(numeric\x20exact;\x20praise\x20>=\x204,\x20S14).'}];}const THRESHOLD_RELEASE_TPL='tpl_crowdfunding_threshold_gate',THRESHOLD_REFUND_TPL='tpl_crowdfunding_threshold_gate_refund',REFUND_SURFACE_RE=/refund|missed|abandon/i;function arbitrationPolarityChecks(a){const b=[],c=new Map();for(const e of a['guards']??[]){const f=String(e['template_id']??'');(f===THRESHOLD_RELEASE_TPL||f===THRESHOLD_REFUND_TPL)&&c['set'](String(e['key']??''),f);}if(c['size']===0x0)return b;const d=(h,j,k,l)=>{const m=l?THRESHOLD_RELEASE_TPL:THRESHOLD_REFUND_TPL,o=l?THRESHOLD_REFUND_TPL:THRESHOLD_RELEASE_TPL,p=l?'RELEASE\x20polarity\x20(aggregate\x20>=)':'REFUND\x20polarity\x20(aggregate\x20<)',q=l?'a\x20MET\x20goal\x20refunds\x20and\x20a\x20MISSED\x20goal\x20strands\x20(ktt2\x20F-02)':'a\x20MISSED\x20goal\x20releases\x20and\x20a\x20MET\x20goal\x20double-pays\x20(ktt2\x20F-01)';b['push']({'rule_id':'R-ARB-POLARITY-PIN','severity':'high','title':'guard\x20\x27'+h+'\x27\x20binds\x20the\x20'+p+'\x20to\x20'+k+'\x20—\x20'+q,'detail':'fillGuardTemplate\x20has\x20no\x20root\x20swap:\x20the\x20polarity\x20IS\x20the\x20template\x20id.\x20\x27'+m+'\x27\x20compiles\x20the\x20'+(p+'\x20root\x20byte-for-byte\x20wherever\x20it\x20is\x20bound.\x20The\x20ktt2\x20live\x20run\x20bound\x20the\x20release\x20id\x20to\x20both\x20')+'settlement\x20forwards\x20and\x20got\x20two\x20byte-identical\x20>=\x20guards\x20(ThresholdMet\x20and\x20RefundOnMissed\x20verified\x20the\x20'+'same\x20root)\x20—\x20the\x20met\x20round\x20refunded,\x20the\x20missed\x20round\x20stranded.\x20Guards\x20are\x20immutable\x20data,\x20so\x20nothing\x20'+'downstream\x20can\x20flip\x20the\x20comparison.','suggestion':'Bind\x20\x27'+o+'\x27\x20to\x20'+k+'\x20instead\x20and\x20keep\x20\x27'+m+'\x27\x20on\x20its\x20polarity\x20twin\x20surface.\x20'+'Polarity\x20is\x20picked\x20at\x20BIND\x20time\x20—\x20verify\x20the\x20first\x20root\x20leaf\x20after\x20fill:\x20greater_or_equal\x20=\x20release,\x20'+'lesser\x20=\x20refund.'});};for(const h of a['machine_shape']??[]){for(const j of h['from']??[]){if(typeof j==='string')continue;const k=j,l=k['guard_key']===undefined?undefined:c['get'](k['guard_key']);if(l===undefined)continue;const m=String(k['forward']??'');if(m==='')continue;l===THRESHOLD_RELEASE_TPL&&REFUND_SURFACE_RE['test'](m)&&d(String(k['guard_key']),l,'the\x20refund-named\x20forward\x20\x27'+m+'\x27',!![]),l===THRESHOLD_REFUND_TPL&&!REFUND_SURFACE_RE['test'](m)&&d(String(k['guard_key']),l,'the\x20non-refund\x20forward\x20\x27'+m+'\x27',![]);}}for(const o of a['allocator']?.['rows']??[]){const p=c['get'](String(o['guard_key']??''));if(p===undefined)continue;p===THRESHOLD_RELEASE_TPL&&o['track']==='refund'&&d(String(o['guard_key']),p,'a\x20refund-track\x20allocator\x20row',!![]),p===THRESHOLD_REFUND_TPL&&o['track']==='settlement'&&d(String(o['guard_key']),p,'a\x20settlement-track\x20allocator\x20row',![]);}return b;}const DISPUTE_FILING_NODE_RE=/claim_filed/i,DISPUTE_FILING_FORWARD_RE=/dispute/i;function disputeFilingExposureChecks(a){const b=[];for(const d of a['machine_shape']??[]){(DISPUTE_FAMILY_NODE_REGEX['test'](d['name'])||DISPUTE_FILING_NODE_RE['test'](d['name']))&&b['push']('node\x20\x27'+d['name']+'\x27');for(const e of d['from']??[]){const f=typeof e==='string'?'':String(e['forward']??'');f!==''&&DISPUTE_FILING_FORWARD_RE['test'](f)&&b['push']('forward\x20\x27'+f+'\x27');}}if(b['length']===0x0)return[];const c=b['slice'](0x0,0x4)['join'](',\x20')+(b['length']>0x4?',\x20+'+(b['length']-0x4)+'\x20more':'');return[{'rule_id':'R-DISPUTE-FILING-EXPOSURE','severity':'low','title':'DISCLOSURE\x20(ddmc2\x20F-02\x20—\x20not\x20a\x20defect\x20of\x20this\x20build):\x20the\x20dispute\x20filing\x20surface\x20('+c+')\x20rides\x20the\x20chain\x27s\x20case-free\x20dispute\x20edge','detail':'The\x20protocol\x27s\x20dispute\x20advance\x20validates\x20ONLY\x20the\x20filing\x20edge\x27s\x20guard\x20—\x20the\x20chain\x20does\x20NOT\x20require\x20an\x20'+'on-chain\x20arbitration\x20case\x20to\x20exist\x20for\x20the\x20order\x20(ddmc2\x20F-02,\x20PROTOCOL-LEVEL\x20gap;\x20the\x20MCP\x20layer\x20cannot\x20'+'fix\x20it).\x20Any\x20signer\x20who\x20passes\x20the\x20edge\x20guard\x20can\x20advance\x20an\x20order\x20into\x20the\x20dispute\x20node\x20—\x20an\x20'+'APPEND-ONLY\x20state\x20with\x20no\x20clearing\x20primitive\x20—\x20wedging\x20the\x20settlement\x20rails\x20until\x20the\x20buyer\x20withdraws\x20'+'the\x20claim\x20or\x20a\x20real\x20arbitration\x20case\x20resolves.\x20The\x20ddmc2\x20live\x20run\x20(o5):\x20a\x20NON-PARTY\x20account\x20advanced\x20'+'an\x20order\x20to\x20claim_filed\x20with\x20ZERO\x20cases\x20on\x20chain\x20—\x20SettleAfterWindow\x20dead,\x20ArbRefund\x20unusable,\x20'+'refund_full\x20unreachable;\x20a\x20zero-cost\x20escrow-stranding\x20DoS.','suggestion':'Keep\x20PARTY\x20identity\x20legs\x20on\x20the\x20filing\x20edge\x20(order.owner/agent\x20==\x20Signer\x20—\x20a\x20bare\x20time-window\x20or\x20'+'node-pin\x20guard\x20admits\x20any\x20third\x20party).\x20Disclose\x20the\x20exposure\x20to\x20buyers\x20pre-buy\x20(service_quote\x20'+'carries\x20it).\x20Re-audit\x20the\x20filing\x20edge\x20when\x20the\x20chain\x20lands\x20the\x20case-existence\x20precondition\x20'+'(protocol\x20train,\x20ruling\x20three\x20stage\x202).'}];}function templateProseDisclosureChecks(a){const b=findSourceCoordinates(JSON['stringify'](a));if(b['length']===0x0)return[];return[{'rule_id':'R-PROSE-01','severity':'low','title':'Template\x20text\x20cites\x20internal\x20source\x20coordinates','detail':'Template\x20text\x20references\x20internal\x20source\x20coordinates\x20('+b['join'](',\x20')+').\x20'+'Source\x20files/lines\x20are\x20not\x20shipped\x20and\x20users\x20cannot\x20act\x20on\x20them.','suggestion':'Describe\x20the\x20enforced\x20behaviour\x20(what\x20the\x20contract/SDK\x20does,\x20plus\x20the\x20error\x20code)\x20'+'instead\x20of\x20naming\x20a\x20file,\x20directory,\x20function\x20or\x20line\x20number.'}];}export const SCAN_RULE_BUDGET_MS=0x7d0;export function ruleOvertimes(a,b=SCAN_RULE_BUDGET_MS){return a['filter'](c=>c['ms']>b);}function timedFindings(a,b,c){return timed(a,b,c);}function timed(a,b,c){const d=performance['now'](),e=c();return a['push']({'rule':b,'ms':performance['now']()-d}),e;}const OVERTIME_RULE_ID='R-SCAN-RULE-OVERTIME';function discountGateChecks(a){const b=[],c=a['fee_params']??{},d='deposit_amount'in c&&'full_price'in c;if(!d)return b;const e=(a['guards']??[])['filter'](f=>f['template_id']==='tpl_forward_fund_gate')['map'](f=>f['key']??f['template_id']);if(e['length']===0x0)return b;return b['push']({'rule_id':'R-DISCOUNT-GATE-STATIC','severity':'high','title':'Static\x20full-price\x20fund\x20gate\x20('+e['join'](',\x20')+')\x20neutralizes\x20Service-side\x20discount\x20coupons','detail':'This\x20template\x20funds\x20in\x20two\x20phases\x20(deposit_amount\x20+\x20full_price)\x20but\x20gates\x20the\x20balance-phase\x20advance\x20with\x20tpl_forward_fund_gate,\x20whose\x20min_balance\x20is\x20a\x20STATIC\x20compiled\x20full-price\x20constant.\x20A\x20Service-side\x20Discount\x20coupon\x20(the\x20buy-time\x20discount\x20step)\x20reduces\x20only\x20the\x20buy-time\x20quote,\x20so\x20Order.amount\x20freezes\x20at\x20the\x20DISCOUNTED\x20deposit\x20while\x20the\x20gate\x20still\x20demands\x20the\x20full\x20price:\x20the\x20discounted\x20escrow\x20fails\x20the\x20gate\x20and\x20the\x20buyer\x20must\x20top\x20up\x20to\x20full\x20price\x20—\x20the\x20coupon\x20is\x20a\x20false\x20promise\x20(hiswkp\x20F-44/D1\x20measured:\x2010%-off\x20coupon,\x207.2\x20escrowed,\x20gate\x208.0,\x20forced\x200.8\x20top-up).','suggestion':'Mount\x20the\x20discount-aware\x20dynamic\x20twin\x20tpl_forward_fund_gate_order_amount\x20instead:\x20the\x20floor\x20reads\x20allocation.balance\x20>=\x20order.amount\x20+\x20balance_amount\x20(query\x201561),\x20so\x20a\x20couponed\x20order\x20gates\x20on\x20its\x20OWN\x20discounted\x20total\x20and\x20a\x20couponless\x20order\x20gates\x20exactly\x20at\x20full_price\x20(deposit_amount\x20+\x20balance_amount).\x20Fill\x20balance_amount\x20=\x20full_price\x20−\x20deposit_amount.\x20Published\x20machines\x20are\x20immutable\x20—\x20the\x20issuance\x20face\x20(checkDiscountBalanceGateBeforeIssue)\x20blocks\x20coupon\x20distribution\x20against\x20static-gate\x20services.'}),b;}const WHITELIST_OVERSIZE_THRESHOLD=0x14;function countWhitelistAddresses(a){if(typeof a==='string')return a['split'](/[\s,;]+/)['filter'](b=>/^0x[0-9a-fA-F]{4,}$/['test'](b))['length'];if(Array['isArray'](a))return a['filter'](b=>typeof b==='string'&&/^0x[0-9a-fA-F]{4,}$/['test'](b))['length'];return 0x0;}function oversizedWhitelistChecks(a){const b=[];for(const c of a['guards']??[]){if(c['template_id']!=='tpl_buy_guard_whitelist')continue;const d=countWhitelistAddresses(c['params']?.['whitelist']);if(d<=WHITELIST_OVERSIZE_THRESHOLD)continue;b['push']({'rule_id':'R-BUY-WHITELIST-OVERSIZE','severity':'low','title':'Static\x20whitelist\x20buy\x20guard\x20carries\x20'+d+'\x20addresses\x20(membership-growth\x20anti-pattern)','detail':'The\x20buy\x20gate\x20resolves\x20to\x20tpl_buy_guard_whitelist\x20with\x20'+d+'\x20addresses\x20in\x20the\x20VecAddress\x20constant.\x20'+'Guards\x20are\x20immutable\x20after\x20publish\x20(IMMUT-001),\x20so\x20the\x20list\x20is\x20frozen\x20at\x20publish:\x20every\x20new\x20member\x20'+'forces\x20a\x20guard\x20rebuild\x20+\x20republish\x20cycle,\x20and\x20a\x20revoked\x20member\x20stays\x20admitted\x20until\x20that\x20cycle\x20runs.\x20'+'A\x20growing\x20membership\x20list\x20is\x20repository\x20DATA,\x20not\x20a\x20guard\x20constant.','suggestion':'Swap\x20the\x20gate\x20to\x20tpl_buy_guard_member_row\x20(guard_resolutions\x20{\x20kind:\x20\x27template\x27,\x20template_id:\x20'+'\x27tpl_buy_guard_member_row\x27,\x20params:\x20{\x20members_repository:\x20<registry\x20name>,\x20policy_name:\x20\x27members\x27\x20}\x20}):\x20'+'admission\x20reads\x20row\x20existence\x20in\x20the\x20members\x20Repository,\x20so\x20grant/revoke\x20ride\x20repository\x20'+'data_add/data_delete\x20with\x20NO\x20republish.\x20The\x20members\x20policy\x20MUST\x20ship\x20a\x20bound\x20merchant/staff\x20write_guard\x20'+'(R-X1-17\x20—\x20an\x20unbound\x20policy\x20lets\x20buyers\x20self-grant).\x20Keep\x20the\x20static\x20whitelist\x20only\x20for\x20small\x20fixed\x20'+'lists.\x20Re-run\x20action=\x27template_scan\x27\x20after\x20the\x20swap.'});}return b;}export function scanTemplate(a){const b=a,c={...a,'build_notes':b['build_notes']??[],'trust_mechanisms':b['trust_mechanisms']??[],'guards':b['guards']??[],'machine_shape':b['machine_shape']??[],'fee_params':b['fee_params']??{},'allocator':b['allocator']??{'description':'','recipient':'entity','refund_track':'order_anchored','count':0x0,'rows':[]}},d=[],e=timedFindings(d,'machineProseFindings',()=>machineProseFindings(c));let g=canonicalizeMachineProse(c);try{const m=(g['machine_shape']??[])['some'](o=>o['segment']!==undefined);if(m){const n=expandShapeSegments({'template':g,'shape':g['machine_shape'],'inputs':g['fee_params']??{}});n['blockers']['length']===0x0&&(g={...g,'machine_shape':n['shape']});}}catch{}const h=timed(d,'oracleCoverageFindings',()=>oracleCoverageFindings(g)),j=[...e,...timedFindings(d,'templateProseDisclosureChecks',()=>templateProseDisclosureChecks(g)),...timedFindings(d,'staticChecks',()=>staticChecks(g)),...timedFindings(d,'guardRefChecks',()=>guardRefChecks(g)),...timedFindings(d,'buyKeyDeclarationChecks',()=>buyKeyDeclarationChecks(g)),...timedFindings(d,'docExpressionDriftChecks',()=>docExpressionDriftChecks(g)),...timedFindings(d,'taskBindingChecks',()=>taskBindingChecks(g)),...timedFindings(d,'repositoryKeyDriftChecks',()=>repositoryKeyDriftChecks(g)),...timedFindings(d,'evidencePolicyCollisionChecks',()=>evidencePolicyCollisionChecks(g)),...timedFindings(d,'feeParamCouplingChecks',()=>feeParamCouplingChecks(g)),...timedFindings(d,'feeParamUnlandedChecks',()=>feeParamUnlandedChecks(g)),...timedFindings(d,'discountGateChecks',()=>discountGateChecks(g)),...timedFindings(d,'oversizedWhitelistChecks',()=>oversizedWhitelistChecks(g)),...timedFindings(d,'settleBandLadderChecks',()=>settleBandLadderChecks(g)),...timedFindings(d,'guardLegPromiseChecks',()=>guardLegPromiseChecks(g)),...timedFindings(d,'descTreeConsistencyChecks',()=>descTreeConsistencyChecks(g)),...timedFindings(d,'windowMathChecks',()=>windowMathChecks(g)),...timedFindings(d,'incentiveRatingFloorChecks',()=>incentiveRatingFloorChecks(g)),...timedFindings(d,'arbitrationPolarityChecks',()=>arbitrationPolarityChecks(g)),...timedFindings(d,'disputeFilingExposureChecks',()=>disputeFilingExposureChecks(g)),...timedFindings(d,'allocLegSlotChecks',()=>allocLegSlotChecks(g)),...timedFindings(d,'fundAnchorChecks',()=>fundAnchorChecks(g)),...timedFindings(d,'periodicReleaseChecks',()=>periodicReleaseChecks(g)),...timedFindings(d,'timeWindowAnchorChecks',()=>timeWindowAnchorChecks(g)),...timedFindings(d,'signerRefundChecks',()=>signerRefundChecks(g)),...timedFindings(d,'orderAnchorDeclarationChecks',()=>orderAnchorDeclarationChecks(g)),...timedFindings(d,'topologyChecks',()=>topologyChecks(g)),...timedFindings(d,'reachabilityChecks',()=>reachabilityChecks(g)),...timedFindings(d,'rewardReachabilityChecks',()=>rewardReachabilityChecks(g)),...timedFindings(d,'loyaltyClaimNoLegChecks',()=>loyaltyClaimNoLegChecks(g)),...timedFindings(d,'keeperDutyUnkeyedChecks',()=>keeperDutyUnkeyedChecks(g)),...timedFindings(d,'thirdPartyNoRemedyChecks',()=>thirdPartyNoRemedyChecks(g)),...timedFindings(d,'shapeKeyCountChecks',()=>shapeKeyCountChecks(g)),...timedFindings(d,'ladderMonotonicChecks',()=>ladderMonotonicChecks(g)),...timedFindings(d,'pairNoSharedRepoChecks',()=>pairNoSharedRepoChecks(g)),...timedFindings(d,'slaPromiseNoLegChecks',()=>slaPromiseNoLegChecks(g)),...timedFindings(d,'demandNoAwardFactChecks',()=>demandNoAwardFactChecks(g)),...timedFindings(d,'deadEndLockChecks',()=>deadEndLockChecks(g)),...timedFindings(d,'exceptionExitChecks',()=>exceptionExitChecks(g)),...timedFindings(d,'evidenceMarkerEchoChecks',()=>evidenceMarkerEchoChecks(g)),...timedFindings(d,'arbZeroExitChecks',()=>arbZeroExitChecks(g)),...timedFindings(d,'reviewNoRaceChecks',()=>reviewNoRaceChecks(g)),...timedFindings(d,'afterSalesRailChecks',()=>afterSalesRailChecks(g)),...timedFindings(d,'acceptanceModeChecks',()=>acceptanceModeChecks(g)),...timedFindings(d,'revisionLoopChecks',()=>revisionLoopChecks(g)),...timedFindings(d,'exclusivityRegistryChecks',()=>exclusivityRegistryChecks(g)),...timedFindings(d,'rateTierClosureChecks',()=>rateTierClosureChecks(g)),...timedFindings(d,'piiCommitmentChecks',()=>piiCommitmentChecks(g)),...timedFindings(d,'installmentModeChecks',()=>installmentModeChecks(g)),...timedFindings(d,'fundRailUnboundRecipientChecks',()=>fundRailUnboundRecipientChecks(g)),...timedFindings(d,'recoverCoversRefundTerminalChecks',()=>recoverCoversRefundTerminalChecks(g)),...timedFindings(d,'arbVotingGateConstantTrueChecks',()=>arbVotingGateConstantTrueChecks(g)),...timedFindings(d,'proseBodyOnceChecks',()=>proseBodyOnceChecks(g)),...timedFindings(d,'affiliateModeChecks',()=>affiliateModeChecks(g)),...timedFindings(d,'crowdfundingModeChecks',()=>crowdfundingModeChecks(g)),...timedFindings(d,'logisticsModeChecks',()=>logisticsModeChecks(g)),...timedFindings(d,'groupBuyBlockerChecks',()=>groupBuyBlockerChecks(g)),...timedFindings(d,'rewardReplayChecks',()=>rewardReplayChecks(g)),...timedFindings(d,'rewardZeroOrderChecks',()=>rewardZeroOrderChecks(g)),...timedFindings(d,'rewardScaleChecks',()=>rewardScaleChecks(g)),...timedFindings(d,'rewardFundedChecks',()=>rewardFundedChecks(g)),...timedFindings(d,'proseCapabilityChecks',()=>proseCapabilityChecks(g,a)),...timedFindings(d,'rewardRatingKeyChecks',()=>rewardRatingKeyChecks(g)),...timedFindings(d,'loopFundChecks',()=>loopFundChecks(g)),...timedFindings(d,'terminalRailCoverageChecks',()=>terminalRailCoverageChecks(g)),...timedFindings(d,'railNodeDriftChecks',()=>railNodeDriftChecks(g)),...timedFindings(d,'pathClassAnchorChecks',()=>pathClassAnchorChecks(g)),...timedFindings(d,'siblingForwardExclusivityChecks',()=>siblingForwardExclusivityChecks(g)),...timedFindings(d,'compoundPayoutChecks',()=>compoundPayoutChecks(g)),...timedFindings(d,'surplusTrackChecks',()=>surplusTrackChecks(g)),...timedFindings(d,'amountDeadlockChecks',()=>amountDeadlockChecks(g)),...timedFindings(d,'discountRailScaleChecks',()=>discountRailScaleChecks(g)),...timedFindings(d,'cancelCoverageChecks',()=>cancelCoverageChecks(g)),...timedFindings(d,'redundGuardObjectMismatchChecks',()=>redundGuardObjectMismatchChecks(g)),...timedFindings(d,'zeroAmountGuardChecks',()=>zeroAmountGuardChecks(g)),...timedFindings(d,'serialClaimWindowChecks',()=>serialClaimWindowChecks(g)),...timedFindings(d,'dismissEdgeGuardChecks',()=>dismissEdgeGuardChecks(g)),...timedFindings(d,'noteNodeDriftChecks',()=>noteNodeDriftChecks(g)),...timedFindings(d,'noteArbBranchDriftChecks',()=>noteArbBranchDriftChecks(g)),...timedFindings(d,'onewayDisputeChecks',()=>onewayDisputeChecks(g)),...timedFindings(d,'noEscrowExitChecks',()=>noEscrowExitChecks(g)),...timedFindings(d,'pairingProseOnlyChecks',()=>pairingProseOnlyChecks(g)),...timedFindings(d,'claimedDirectionVoidChecks',()=>claimedDirectionVoidChecks(g)),...timedFindings(d,'arbDirectionSanityChecks',()=>arbDirectionSanityChecks(g)),...timedFindings(d,'disputeFreezeChecks',()=>disputeFreezeChecks(g)),...timedFindings(d,'refundGatePolarityChecks',()=>refundGatePolarityChecks(g)),...timedFindings(d,'arbRefundWithoutFundChecks',()=>arbRefundWithoutFundChecks(g)),...timedFindings(d,'rewardBelowClaimGasChecks',()=>rewardBelowClaimGasChecks(g)),...timedFindings(d,'proseCapAdvisoryChecks',()=>proseCapAdvisoryChecks(g)),...timedFindings(d,'salesVocabularyChecks',()=>salesVocabularyChecks(g)),...timedFindings(d,'railUnboundChecks',()=>railUnboundChecks(g)),...timedFindings(d,'rewardBypassChecks',()=>rewardBypassChecks(g)),...timedFindings(d,'guardUnmountedChecks',()=>guardUnmountedChecks(g)),...timedFindings(d,'residualSweepRaceChecks',()=>residualSweepRaceChecks(g)),...timedFindings(d,'damageCapChecks',()=>damageCapChecks(g)),...timedFindings(d,'specParamPlaneChecks',()=>specParamPlaneChecks(g)),...timedFindings(d,'reviewWriteUnreachableChecks',()=>reviewWriteUnreachableChecks(g)),...timedFindings(d,'rewardReplayOpenChecks',()=>rewardReplayOpenChecks(g)),...timedFindings(d,'declaredValueUnfundedChecks',()=>declaredValueUnfundedChecks(g)),...timedFindings(d,'counterpartyFundEvidenceChecks',()=>counterpartyFundEvidenceChecks(g)),...timedFindings(d,'repoWriteOnceIdiomChecks',()=>repoWriteOnceIdiomChecks(g)),...timedFindings(d,'disclosureEnforceabilityChecks',()=>disclosureEnforceabilityChecks(g)),...timedFindings(d,'allocReplayChecks',()=>allocReplayChecks(g)),...timedFindings(d,'draftVoidChecks',()=>draftVoidChecks(g)),...timedFindings(d,'requiredInfoGateChecks',()=>requiredInfoGateChecks(g)),...timedFindings(d,'evidenceRowReadbackChecks',()=>evidenceRowReadbackChecks(g)),...timedFindings(d,'planReadinessChecks',()=>planReadinessChecks(g)),...timedFindings(d,'feeParamLandingChecks',()=>feeParamLandingChecks(g)),...h['findings']['map'](o=>({'rule_id':o['rule_id'],'severity':o['severity']==='info'?'low':o['severity'],'title':o['title'],'detail':o['detail'],'suggestion':o['suggestion']}))];for(const o of timed(d,'analyzerFindings',()=>analyzerFindings(g))){const p=o['severity']==='info'?'low':o['severity'];j['push']({'rule_id':o['ruleId'],'severity':p,'title':o['title'],'detail':o['detail'],'suggestion':o['suggestion']});}for(const q of ruleOvertimes(d)){j['push']({'rule_id':OVERTIME_RULE_ID,'severity':'medium','title':'scan\x20rule\x20\x27'+q['rule']+'\x27\x20overran\x20the\x20'+SCAN_RULE_BUDGET_MS+'ms\x20budget\x20('+Math['round'](q['ms'])+'ms)','detail':'Rule\x20\x27'+q['rule']+'\x27\x20took\x20'+Math['round'](q['ms'])+'ms\x20on\x20template\x20\x27'+g['id']+'\x27\x20—\x20over\x20the\x20'+SCAN_RULE_BUDGET_MS+'ms\x20per-rule\x20wall-clock\x20budget.\x20Slow-burn\x20backtracking\x20class:\x20the\x20rule\x20RETURNED,\x20but\x20a\x20cost\x20explosion\x20here\x20on\x20a\x20bigger\x20template\x20degrades\x20toward\x20the\x20F-SCAN-LOOP\x20hang.','suggestion':'Profile\x20\x27'+q['rule']+'\x27\x20against\x20this\x20template\x20shape;\x20suspect\x20an\x20unbounded\x20regex\x20or\x20an\x20O(n²)\x20shape\x20walk.\x20Lexical\x20rules\x20must\x20stay\x20linear\x20(HARNESS-RULES\x20词法面处方:\x20/g\x20flags\x20on\x20exec\x20loops,\x20terminable\x20negative\x20paths).'});}j['sort']((s,w)=>SEVERITY_ORDER[w['severity']]-SEVERITY_ORDER[s['severity']]);const k=j['length']>0x0?j[0x0]['severity']:'low',l=j['filter'](s=>s['severity']==='critical')['map'](s=>''+(s['rule_id']?s['rule_id']+':\x20':'')+s['title']);return{'template_id':g['id'],'risk_level':k,'passed':l['length']===0x0,'findings':j,'red_flags':l,...h['coverage']?{'oracle_coverage':h['coverage']}:{}};}