import ts from 'typescript'; // Copy pure calculator declarations from the authoritative operations bundle at build time. // Both gateways therefore execute the same historical rules, precedence and rounding. export function teacherEarningsSupport(operationsCode, integrityCode) { const pick=(code,names)=>{const file=ts.createSourceFile('gateway.js',code,ts.ScriptTarget.Latest,true,ts.ScriptKind.JS);return names.map(name=>{const node=file.statements.find(n=>ts.isFunctionDeclaration(n)&&n.name?.text===name);if(!node)throw Error('缺少工资共享函数 '+name);return node.getText(file);}).join('\n');}; const start=operationsCode.indexOf('const TEACHING_STAGE_DEFAULTS='),end=operationsCode.indexOf('async function teachingCategoryRows(',start); if(start<0||endteachingRuleProjection(r,TEACHING_CATEGORY_LABELS),category: (r)=>{const stage=courseStageFromDatabase(r.ancestor_names);return r.confirmed===true&&TEACHING_CATEGORY_LABELS.has(r.categoryKey)&&categoryMatchesStage(r.categoryKey,stage.key)&&(!isWritingCourse(r.courseName)||Boolean(stage.key&&stage.name));}};\n}\n'; }